code
stringlengths 38
801k
| repo_path
stringlengths 6
263
|
---|---|
pub const WDS_CLI_TRANSFER_ASYNCHRONOUS = @as(u32, 1);
pub const WDS_CLI_NO_SPARSE_FILE = @as(u32, 2);
pub const PXE_DHCP_SERVER_PORT = @as(u32, 67);
pub const PXE_DHCP_CLIENT_PORT = @as(u32, 68);
pub const PXE_SERVER_PORT = @as(u32, 4011);
pub const PXE_DHCPV6_SERVER_PORT = @as(u32, 547);
pub const PXE_DHCPV6_CLIENT_PORT = @as(u32, 546);
pub const PXE_DHCP_FILE_SIZE = @as(u32, 128);
pub const PXE_DHCP_SERVER_SIZE = @as(u32, 64);
pub const PXE_DHCP_HWAADR_SIZE = @as(u32, 16);
pub const PXE_DHCP_MAGIC_COOKIE_SIZE = @as(u32, 4);
pub const PXE_REG_INDEX_TOP = @as(u32, 0);
pub const PXE_REG_INDEX_BOTTOM = @as(u32, 4294967295);
pub const PXE_CALLBACK_RECV_REQUEST = @as(u32, 0);
pub const PXE_CALLBACK_SHUTDOWN = @as(u32, 1);
pub const PXE_CALLBACK_SERVICE_CONTROL = @as(u32, 2);
pub const PXE_CALLBACK_MAX = @as(u32, 3);
pub const PXE_GSI_TRACE_ENABLED = @as(u32, 1);
pub const PXE_GSI_SERVER_DUID = @as(u32, 2);
pub const PXE_MAX_ADDRESS = @as(u32, 16);
pub const PXE_ADDR_BROADCAST = @as(u32, 1);
pub const PXE_ADDR_USE_PORT = @as(u32, 2);
pub const PXE_ADDR_USE_ADDR = @as(u32, 4);
pub const PXE_ADDR_USE_DHCP_RULES = @as(u32, 8);
pub const PXE_DHCPV6_RELAY_HOP_COUNT_LIMIT = @as(u32, 32);
pub const PXE_BA_NBP = @as(u32, 1);
pub const PXE_BA_CUSTOM = @as(u32, 2);
pub const PXE_BA_IGNORE = @as(u32, 3);
pub const PXE_BA_REJECTED = @as(u32, 4);
pub const PXE_TRACE_VERBOSE = @as(u32, 65536);
pub const PXE_TRACE_INFO = @as(u32, 131072);
pub const PXE_TRACE_WARNING = @as(u32, 262144);
pub const PXE_TRACE_ERROR = @as(u32, 524288);
pub const PXE_TRACE_FATAL = @as(u32, 1048576);
pub const PXE_PROV_ATTR_FILTER = @as(u32, 0);
pub const PXE_PROV_ATTR_FILTER_IPV6 = @as(u32, 1);
pub const PXE_PROV_ATTR_IPV6_CAPABLE = @as(u32, 2);
pub const PXE_PROV_FILTER_ALL = @as(u32, 0);
pub const PXE_PROV_FILTER_DHCP_ONLY = @as(u32, 1);
pub const PXE_PROV_FILTER_PXE_ONLY = @as(u32, 2);
pub const MC_SERVER_CURRENT_VERSION = @as(u32, 1);
pub const TRANSPORTPROVIDER_CURRENT_VERSION = @as(u32, 1);
pub const WDS_MC_TRACE_VERBOSE = @as(u32, 65536);
pub const WDS_MC_TRACE_INFO = @as(u32, 131072);
pub const WDS_MC_TRACE_WARNING = @as(u32, 262144);
pub const WDS_MC_TRACE_ERROR = @as(u32, 524288);
pub const WDS_MC_TRACE_FATAL = @as(u32, 1048576);
pub const WDS_TRANSPORTCLIENT_CURRENT_API_VERSION = @as(u32, 1);
pub const WDS_TRANSPORTCLIENT_PROTOCOL_MULTICAST = @as(u32, 1);
pub const WDS_TRANSPORTCLIENT_NO_CACHE = @as(u32, 0);
pub const WDS_TRANSPORTCLIENT_STATUS_IN_PROGRESS = @as(u32, 1);
pub const WDS_TRANSPORTCLIENT_STATUS_SUCCESS = @as(u32, 2);
pub const WDS_TRANSPORTCLIENT_STATUS_FAILURE = @as(u32, 3);
pub const WDSTRANSPORT_RESOURCE_UTILIZATION_UNKNOWN = @as(u32, 255);
pub const WDSBP_PK_TYPE_DHCP = @as(u32, 1);
pub const WDSBP_PK_TYPE_WDSNBP = @as(u32, 2);
pub const WDSBP_PK_TYPE_BCD = @as(u32, 4);
pub const WDSBP_PK_TYPE_DHCPV6 = @as(u32, 8);
pub const WDSBP_OPT_TYPE_NONE = @as(u32, 0);
pub const WDSBP_OPT_TYPE_BYTE = @as(u32, 1);
pub const WDSBP_OPT_TYPE_USHORT = @as(u32, 2);
pub const WDSBP_OPT_TYPE_ULONG = @as(u32, 3);
pub const WDSBP_OPT_TYPE_WSTR = @as(u32, 4);
pub const WDSBP_OPT_TYPE_STR = @as(u32, 5);
pub const WDSBP_OPT_TYPE_IP4 = @as(u32, 6);
pub const WDSBP_OPT_TYPE_IP6 = @as(u32, 7);
pub const WDSBP_OPTVAL_ACTION_APPROVAL = @as(u32, 1);
pub const WDSBP_OPTVAL_ACTION_REFERRAL = @as(u32, 3);
pub const WDSBP_OPTVAL_ACTION_ABORT = @as(u32, 5);
pub const WDSBP_OPTVAL_PXE_PROMPT_OPTIN = @as(u32, 1);
pub const WDSBP_OPTVAL_PXE_PROMPT_NOPROMPT = @as(u32, 2);
pub const WDSBP_OPTVAL_PXE_PROMPT_OPTOUT = @as(u32, 3);
pub const WDSBP_OPTVAL_NBP_VER_7 = @as(u32, 1792);
pub const WDSBP_OPTVAL_NBP_VER_8 = @as(u32, 2048);
pub const WdsCliFlagEnumFilterVersion = @as(i32, 1);
pub const WdsCliFlagEnumFilterFirmware = @as(i32, 2);
pub const WDS_LOG_TYPE_CLIENT_ERROR = @as(i32, 1);
pub const WDS_LOG_TYPE_CLIENT_STARTED = @as(i32, 2);
pub const WDS_LOG_TYPE_CLIENT_FINISHED = @as(i32, 3);
pub const WDS_LOG_TYPE_CLIENT_IMAGE_SELECTED = @as(i32, 4);
pub const WDS_LOG_TYPE_CLIENT_APPLY_STARTED = @as(i32, 5);
pub const WDS_LOG_TYPE_CLIENT_APPLY_FINISHED = @as(i32, 6);
pub const WDS_LOG_TYPE_CLIENT_GENERIC_MESSAGE = @as(i32, 7);
pub const WDS_LOG_TYPE_CLIENT_UNATTEND_MODE = @as(i32, 8);
pub const WDS_LOG_TYPE_CLIENT_TRANSFER_START = @as(i32, 9);
pub const WDS_LOG_TYPE_CLIENT_TRANSFER_END = @as(i32, 10);
pub const WDS_LOG_TYPE_CLIENT_TRANSFER_DOWNGRADE = @as(i32, 11);
pub const WDS_LOG_TYPE_CLIENT_DOMAINJOINERROR = @as(i32, 12);
pub const WDS_LOG_TYPE_CLIENT_POST_ACTIONS_START = @as(i32, 13);
pub const WDS_LOG_TYPE_CLIENT_POST_ACTIONS_END = @as(i32, 14);
pub const WDS_LOG_TYPE_CLIENT_APPLY_STARTED_2 = @as(i32, 15);
pub const WDS_LOG_TYPE_CLIENT_APPLY_FINISHED_2 = @as(i32, 16);
pub const WDS_LOG_TYPE_CLIENT_DOMAINJOINERROR_2 = @as(i32, 17);
pub const WDS_LOG_TYPE_CLIENT_DRIVER_PACKAGE_NOT_ACCESSIBLE = @as(i32, 18);
pub const WDS_LOG_TYPE_CLIENT_OFFLINE_DRIVER_INJECTION_START = @as(i32, 19);
pub const WDS_LOG_TYPE_CLIENT_OFFLINE_DRIVER_INJECTION_END = @as(i32, 20);
pub const WDS_LOG_TYPE_CLIENT_OFFLINE_DRIVER_INJECTION_FAILURE = @as(i32, 21);
pub const WDS_LOG_TYPE_CLIENT_IMAGE_SELECTED2 = @as(i32, 22);
pub const WDS_LOG_TYPE_CLIENT_IMAGE_SELECTED3 = @as(i32, 23);
pub const WDS_LOG_TYPE_CLIENT_MAX_CODE = @as(i32, 24);
pub const WDS_LOG_LEVEL_DISABLED = @as(i32, 0);
pub const WDS_LOG_LEVEL_ERROR = @as(i32, 1);
pub const WDS_LOG_LEVEL_WARNING = @as(i32, 2);
pub const WDS_LOG_LEVEL_INFO = @as(i32, 3);
//--------------------------------------------------------------------------------
// Section: Types (89)
//--------------------------------------------------------------------------------
pub const CPU_ARCHITECTURE = enum(u32) {
AMD64 = 9,
IA64 = 6,
INTEL = 0,
};
pub const CPU_ARCHITECTURE_AMD64 = CPU_ARCHITECTURE.AMD64;
pub const CPU_ARCHITECTURE_IA64 = CPU_ARCHITECTURE.IA64;
pub const CPU_ARCHITECTURE_INTEL = CPU_ARCHITECTURE.INTEL;
pub const PFN_WDS_CLI_CALLBACK_MESSAGE_ID = enum(u32) {
START = 0,
COMPLETE = 1,
PROGRESS = 2,
TEXT = 3,
};
// TODO: enum 'PFN_WDS_CLI_CALLBACK_MESSAGE_ID' has known issues with its value aliases
pub const WDS_TRANSPORTCLIENT_REQUEST_AUTH_LEVEL = enum(u32) {
AUTH = 1,
NO_AUTH = 2,
};
pub const WDS_TRANSPORTCLIENT_AUTH = WDS_TRANSPORTCLIENT_REQUEST_AUTH_LEVEL.AUTH;
pub const WDS_TRANSPORTCLIENT_NO_AUTH = WDS_TRANSPORTCLIENT_REQUEST_AUTH_LEVEL.NO_AUTH;
pub const WDS_CLI_CRED = extern struct {
pwszUserName: ?[*:0]const u16,
pwszDomain: ?[*:0]const u16,
pwszPassword: ?[*:0]const u16,
};
pub const PFN_WdsCliTraceFunction = fn(
pwszFormat: ?[*:0]const u16,
Params: ?*i8,
) callconv(@import("std").os.windows.WINAPI) void;
pub const WDS_CLI_IMAGE_TYPE = enum(i32) {
UNKNOWN = 0,
WIM = 1,
VHD = 2,
VHDX = 3,
};
pub const WDS_CLI_IMAGE_TYPE_UNKNOWN = WDS_CLI_IMAGE_TYPE.UNKNOWN;
pub const WDS_CLI_IMAGE_TYPE_WIM = WDS_CLI_IMAGE_TYPE.WIM;
pub const WDS_CLI_IMAGE_TYPE_VHD = WDS_CLI_IMAGE_TYPE.VHD;
pub const WDS_CLI_IMAGE_TYPE_VHDX = WDS_CLI_IMAGE_TYPE.VHDX;
pub const WDS_CLI_FIRMWARE_TYPE = enum(i32) {
UNKNOWN = 0,
BIOS = 1,
EFI = 2,
};
pub const WDS_CLI_FIRMWARE_UNKNOWN = WDS_CLI_FIRMWARE_TYPE.UNKNOWN;
pub const WDS_CLI_FIRMWARE_BIOS = WDS_CLI_FIRMWARE_TYPE.BIOS;
pub const WDS_CLI_FIRMWARE_EFI = WDS_CLI_FIRMWARE_TYPE.EFI;
pub const WDS_CLI_IMAGE_PARAM_TYPE = enum(i32) {
UNKNOWN = 0,
SPARSE_FILE = 1,
SUPPORTED_FIRMWARES = 2,
};
pub const WDS_CLI_IMAGE_PARAM_UNKNOWN = WDS_CLI_IMAGE_PARAM_TYPE.UNKNOWN;
pub const WDS_CLI_IMAGE_PARAM_SPARSE_FILE = WDS_CLI_IMAGE_PARAM_TYPE.SPARSE_FILE;
pub const WDS_CLI_IMAGE_PARAM_SUPPORTED_FIRMWARES = WDS_CLI_IMAGE_PARAM_TYPE.SUPPORTED_FIRMWARES;
pub const PFN_WdsCliCallback = fn(
dwMessageId: PFN_WDS_CLI_CALLBACK_MESSAGE_ID,
wParam: WPARAM,
lParam: LPARAM,
pvUserData: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PXE_DHCP_OPTION = extern struct {
OptionType: u8,
OptionLength: u8,
OptionValue: [1]u8,
};
pub const PXE_DHCP_MESSAGE = packed struct {
Operation: u8,
HardwareAddressType: u8,
HardwareAddressLength: u8,
HopCount: u8,
TransactionID: u32,
SecondsSinceBoot: u16,
Reserved: u16,
ClientIpAddress: u32,
YourIpAddress: u32,
BootstrapServerAddress: u32,
RelayAgentIpAddress: u32,
HardwareAddress: [16]u8,
HostName: [64]u8,
BootFileName: [128]u8,
Anonymous: packed union {
bMagicCookie: [4]u8,
uMagicCookie: u32,
},
Option: PXE_DHCP_OPTION,
};
pub const PXE_DHCPV6_OPTION = packed struct {
OptionCode: u16,
DataLength: u16,
Data: [1]u8,
};
pub const PXE_DHCPV6_MESSAGE_HEADER = extern struct {
MessageType: u8,
Message: [1]u8,
};
pub const PXE_DHCPV6_MESSAGE = extern struct {
MessageType: u8,
TransactionIDByte1: u8,
TransactionIDByte2: u8,
TransactionIDByte3: u8,
Options: [1]PXE_DHCPV6_OPTION,
};
pub const PXE_DHCPV6_RELAY_MESSAGE = extern struct {
MessageType: u8,
HopCount: u8,
LinkAddress: [16]u8,
PeerAddress: [16]u8,
Options: [1]PXE_DHCPV6_OPTION,
};
pub const PXE_PROVIDER = extern struct {
uSizeOfStruct: u32,
pwszName: ?PWSTR,
pwszFilePath: ?PWSTR,
bIsCritical: BOOL,
uIndex: u32,
};
pub const PXE_ADDRESS = extern struct {
uFlags: u32,
Anonymous: extern union {
bAddress: [16]u8,
uIpAddress: u32,
},
uAddrLen: u32,
uPort: u16,
};
pub const PXE_DHCPV6_NESTED_RELAY_MESSAGE = extern struct {
pRelayMessage: ?*PXE_DHCPV6_RELAY_MESSAGE,
cbRelayMessage: u32,
pInterfaceIdOption: ?*c_void,
cbInterfaceIdOption: u16,
};
pub const TRANSPORTPROVIDER_CALLBACK_ID = enum(i32) {
CREATE_INSTANCE = 0,
COMPARE_CONTENT = 1,
OPEN_CONTENT = 2,
USER_ACCESS_CHECK = 3,
GET_CONTENT_SIZE = 4,
READ_CONTENT = 5,
CLOSE_CONTENT = 6,
CLOSE_INSTANCE = 7,
SHUTDOWN = 8,
DUMP_STATE = 9,
REFRESH_SETTINGS = 10,
GET_CONTENT_METADATA = 11,
MAX_CALLBACKS = 12,
};
pub const WDS_TRANSPORTPROVIDER_CREATE_INSTANCE = TRANSPORTPROVIDER_CALLBACK_ID.CREATE_INSTANCE;
pub const WDS_TRANSPORTPROVIDER_COMPARE_CONTENT = TRANSPORTPROVIDER_CALLBACK_ID.COMPARE_CONTENT;
pub const WDS_TRANSPORTPROVIDER_OPEN_CONTENT = TRANSPORTPROVIDER_CALLBACK_ID.OPEN_CONTENT;
pub const WDS_TRANSPORTPROVIDER_USER_ACCESS_CHECK = TRANSPORTPROVIDER_CALLBACK_ID.USER_ACCESS_CHECK;
pub const WDS_TRANSPORTPROVIDER_GET_CONTENT_SIZE = TRANSPORTPROVIDER_CALLBACK_ID.GET_CONTENT_SIZE;
pub const WDS_TRANSPORTPROVIDER_READ_CONTENT = TRANSPORTPROVIDER_CALLBACK_ID.READ_CONTENT;
pub const WDS_TRANSPORTPROVIDER_CLOSE_CONTENT = TRANSPORTPROVIDER_CALLBACK_ID.CLOSE_CONTENT;
pub const WDS_TRANSPORTPROVIDER_CLOSE_INSTANCE = TRANSPORTPROVIDER_CALLBACK_ID.CLOSE_INSTANCE;
pub const WDS_TRANSPORTPROVIDER_SHUTDOWN = TRANSPORTPROVIDER_CALLBACK_ID.SHUTDOWN;
pub const WDS_TRANSPORTPROVIDER_DUMP_STATE = TRANSPORTPROVIDER_CALLBACK_ID.DUMP_STATE;
pub const WDS_TRANSPORTPROVIDER_REFRESH_SETTINGS = TRANSPORTPROVIDER_CALLBACK_ID.REFRESH_SETTINGS;
pub const WDS_TRANSPORTPROVIDER_GET_CONTENT_METADATA = TRANSPORTPROVIDER_CALLBACK_ID.GET_CONTENT_METADATA;
pub const WDS_TRANSPORTPROVIDER_MAX_CALLBACKS = TRANSPORTPROVIDER_CALLBACK_ID.MAX_CALLBACKS;
pub const WDS_TRANSPORTPROVIDER_INIT_PARAMS = extern struct {
ulLength: u32,
ulMcServerVersion: u32,
hRegistryKey: ?HKEY,
hProvider: ?HANDLE,
};
pub const WDS_TRANSPORTPROVIDER_SETTINGS = extern struct {
ulLength: u32,
ulProviderVersion: u32,
};
pub const TRANSPORTCLIENT_CALLBACK_ID = enum(i32) {
SESSION_START = 0,
RECEIVE_CONTENTS = 1,
SESSION_COMPLETE = 2,
RECEIVE_METADATA = 3,
SESSION_STARTEX = 4,
SESSION_NEGOTIATE = 5,
MAX_CALLBACKS = 6,
};
pub const WDS_TRANSPORTCLIENT_SESSION_START = TRANSPORTCLIENT_CALLBACK_ID.SESSION_START;
pub const WDS_TRANSPORTCLIENT_RECEIVE_CONTENTS = TRANSPORTCLIENT_CALLBACK_ID.RECEIVE_CONTENTS;
pub const WDS_TRANSPORTCLIENT_SESSION_COMPLETE = TRANSPORTCLIENT_CALLBACK_ID.SESSION_COMPLETE;
pub const WDS_TRANSPORTCLIENT_RECEIVE_METADATA = TRANSPORTCLIENT_CALLBACK_ID.RECEIVE_METADATA;
pub const WDS_TRANSPORTCLIENT_SESSION_STARTEX = TRANSPORTCLIENT_CALLBACK_ID.SESSION_STARTEX;
pub const WDS_TRANSPORTCLIENT_SESSION_NEGOTIATE = TRANSPORTCLIENT_CALLBACK_ID.SESSION_NEGOTIATE;
pub const WDS_TRANSPORTCLIENT_MAX_CALLBACKS = TRANSPORTCLIENT_CALLBACK_ID.MAX_CALLBACKS;
pub const TRANSPORTCLIENT_SESSION_INFO = extern struct {
ulStructureLength: u32,
ullFileSize: ULARGE_INTEGER,
ulBlockSize: u32,
};
pub const PFN_WdsTransportClientSessionStart = fn(
hSessionKey: ?HANDLE,
pCallerData: ?*c_void,
ullFileSize: ?*ULARGE_INTEGER,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PFN_WdsTransportClientSessionStartEx = fn(
hSessionKey: ?HANDLE,
pCallerData: ?*c_void,
Info: ?*TRANSPORTCLIENT_SESSION_INFO,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PFN_WdsTransportClientReceiveMetadata = fn(
hSessionKey: ?HANDLE,
pCallerData: ?*c_void,
// TODO: what to do with BytesParamIndex 3?
pMetadata: ?*c_void,
ulSize: u32,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PFN_WdsTransportClientReceiveContents = fn(
hSessionKey: ?HANDLE,
pCallerData: ?*c_void,
// TODO: what to do with BytesParamIndex 3?
pContents: ?*c_void,
ulSize: u32,
pullContentOffset: ?*ULARGE_INTEGER,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PFN_WdsTransportClientSessionComplete = fn(
hSessionKey: ?HANDLE,
pCallerData: ?*c_void,
dwError: u32,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PFN_WdsTransportClientSessionNegotiate = fn(
hSessionKey: ?HANDLE,
pCallerData: ?*c_void,
pInfo: ?*TRANSPORTCLIENT_SESSION_INFO,
hNegotiateKey: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) void;
pub const WDS_TRANSPORTCLIENT_REQUEST = extern struct {
ulLength: u32,
ulApiVersion: u32,
ulAuthLevel: WDS_TRANSPORTCLIENT_REQUEST_AUTH_LEVEL,
pwszServer: ?[*:0]const u16,
pwszNamespace: ?[*:0]const u16,
pwszObjectName: ?[*:0]const u16,
ulCacheSize: u32,
ulProtocol: u32,
pvProtocolData: ?*c_void,
ulProtocolDataLength: u32,
};
pub const WDS_TRANSPORTCLIENT_CALLBACKS = extern struct {
SessionStart: ?PFN_WdsTransportClientSessionStart,
SessionStartEx: ?PFN_WdsTransportClientSessionStartEx,
ReceiveContents: ?PFN_WdsTransportClientReceiveContents,
ReceiveMetadata: ?PFN_WdsTransportClientReceiveMetadata,
SessionComplete: ?PFN_WdsTransportClientSessionComplete,
SessionNegotiate: ?PFN_WdsTransportClientSessionNegotiate,
};
const CLSID_WdsTransportCacheable_Value = @import("../zig.zig").Guid.initString("70590b16-f146-46bd-bd9d-4aaa90084bf5");
pub const CLSID_WdsTransportCacheable = &CLSID_WdsTransportCacheable_Value;
const CLSID_WdsTransportCollection_Value = @import("../zig.zig").Guid.initString("c7f18b09-391e-436e-b10b-c3ef46f2c34f");
pub const CLSID_WdsTransportCollection = &CLSID_WdsTransportCollection_Value;
const CLSID_WdsTransportManager_Value = @import("../zig.zig").Guid.initString("f21523f6-837c-4a58-af99-8a7e27f8ff59");
pub const CLSID_WdsTransportManager = &CLSID_WdsTransportManager_Value;
const CLSID_WdsTransportServer_Value = @import("../zig.zig").Guid.initString("ea19b643-4adf-4413-942c-14f379118760");
pub const CLSID_WdsTransportServer = &CLSID_WdsTransportServer_Value;
const CLSID_WdsTransportSetupManager_Value = @import("../zig.zig").Guid.initString("c7beeaad-9f04-4923-9f0c-fbf52bc7590f");
pub const CLSID_WdsTransportSetupManager = &CLSID_WdsTransportSetupManager_Value;
const CLSID_WdsTransportConfigurationManager_Value = @import("../zig.zig").Guid.initString("8743f674-904c-47ca-8512-35fe98f6b0ac");
pub const CLSID_WdsTransportConfigurationManager = &CLSID_WdsTransportConfigurationManager_Value;
const CLSID_WdsTransportNamespaceManager_Value = @import("../zig.zig").Guid.initString("f08cdb63-85de-4a28-a1a9-5ca3e7efda73");
pub const CLSID_WdsTransportNamespaceManager = &CLSID_WdsTransportNamespaceManager_Value;
const CLSID_WdsTransportServicePolicy_Value = @import("../zig.zig").Guid.initString("65aceadc-2f0b-4f43-9f4d-811865d8cead");
pub const CLSID_WdsTransportServicePolicy = &CLSID_WdsTransportServicePolicy_Value;
const CLSID_WdsTransportDiagnosticsPolicy_Value = @import("../zig.zig").Guid.initString("eb3333e1-a7ad-46f5-80d6-6b740204e509");
pub const CLSID_WdsTransportDiagnosticsPolicy = &CLSID_WdsTransportDiagnosticsPolicy_Value;
const CLSID_WdsTransportMulticastSessionPolicy_Value = @import("../zig.zig").Guid.initString("3c6bc3f4-6418-472a-b6f1-52d457195437");
pub const CLSID_WdsTransportMulticastSessionPolicy = &CLSID_WdsTransportMulticastSessionPolicy_Value;
const CLSID_WdsTransportNamespace_Value = @import("../zig.zig").Guid.initString("d8385768-0732-4ec1-95ea-16da581908a1");
pub const CLSID_WdsTransportNamespace = &CLSID_WdsTransportNamespace_Value;
const CLSID_WdsTransportNamespaceAutoCast_Value = @import("../zig.zig").Guid.initString("b091f5a8-6a99-478d-b23b-09e8fee04574");
pub const CLSID_WdsTransportNamespaceAutoCast = &CLSID_WdsTransportNamespaceAutoCast_Value;
const CLSID_WdsTransportNamespaceScheduledCast_Value = @import("../zig.zig").Guid.initString("badc1897-7025-44eb-9108-fb61c4055792");
pub const CLSID_WdsTransportNamespaceScheduledCast = &CLSID_WdsTransportNamespaceScheduledCast_Value;
const CLSID_WdsTransportNamespaceScheduledCastManualStart_Value = @import("../zig.zig").Guid.initString("d3e1a2aa-caac-460e-b98a-47f9f318a1fa");
pub const CLSID_WdsTransportNamespaceScheduledCastManualStart = &CLSID_WdsTransportNamespaceScheduledCastManualStart_Value;
const CLSID_WdsTransportNamespaceScheduledCastAutoStart_Value = @import("../zig.zig").Guid.initString("a1107052-122c-4b81-9b7c-386e6855383f");
pub const CLSID_WdsTransportNamespaceScheduledCastAutoStart = &CLSID_WdsTransportNamespaceScheduledCastAutoStart_Value;
const CLSID_WdsTransportContent_Value = @import("../zig.zig").Guid.initString("0a891fe7-4a3f-4c65-b6f2-1467619679ea");
pub const CLSID_WdsTransportContent = &CLSID_WdsTransportContent_Value;
const CLSID_WdsTransportSession_Value = @import("../zig.zig").Guid.initString("749ac4e0-67bc-4743-bfe5-cacb1f26f57f");
pub const CLSID_WdsTransportSession = &CLSID_WdsTransportSession_Value;
const CLSID_WdsTransportClient_Value = @import("../zig.zig").Guid.initString("66d2c5e9-0ff6-49ec-9733-dafb1e01df1c");
pub const CLSID_WdsTransportClient = &CLSID_WdsTransportClient_Value;
const CLSID_WdsTransportTftpClient_Value = @import("../zig.zig").Guid.initString("50343925-7c5c-4c8c-96c4-ad9fa5005fba");
pub const CLSID_WdsTransportTftpClient = &CLSID_WdsTransportTftpClient_Value;
const CLSID_WdsTransportTftpManager_Value = @import("../zig.zig").Guid.initString("c8e9dca2-3241-4e4d-b806-bc74019dfeda");
pub const CLSID_WdsTransportTftpManager = &CLSID_WdsTransportTftpManager_Value;
const CLSID_WdsTransportContentProvider_Value = @import("../zig.zig").Guid.initString("e0be741f-5a75-4eb9-8a2d-5e189b45f327");
pub const CLSID_WdsTransportContentProvider = &CLSID_WdsTransportContentProvider_Value;
pub const WDSTRANSPORT_FEATURE_FLAGS = enum(i32) {
AdminPack = 1,
TransportServer = 2,
DeploymentServer = 4,
};
pub const WdsTptFeatureAdminPack = WDSTRANSPORT_FEATURE_FLAGS.AdminPack;
pub const WdsTptFeatureTransportServer = WDSTRANSPORT_FEATURE_FLAGS.TransportServer;
pub const WdsTptFeatureDeploymentServer = WDSTRANSPORT_FEATURE_FLAGS.DeploymentServer;
pub const WDSTRANSPORT_PROTOCOL_FLAGS = enum(i32) {
Unicast = 1,
Multicast = 2,
};
pub const WdsTptProtocolUnicast = WDSTRANSPORT_PROTOCOL_FLAGS.Unicast;
pub const WdsTptProtocolMulticast = WDSTRANSPORT_PROTOCOL_FLAGS.Multicast;
pub const WDSTRANSPORT_NAMESPACE_TYPE = enum(i32) {
Unknown = 0,
AutoCast = 1,
ScheduledCastManualStart = 2,
ScheduledCastAutoStart = 3,
};
pub const WdsTptNamespaceTypeUnknown = WDSTRANSPORT_NAMESPACE_TYPE.Unknown;
pub const WdsTptNamespaceTypeAutoCast = WDSTRANSPORT_NAMESPACE_TYPE.AutoCast;
pub const WdsTptNamespaceTypeScheduledCastManualStart = WDSTRANSPORT_NAMESPACE_TYPE.ScheduledCastManualStart;
pub const WdsTptNamespaceTypeScheduledCastAutoStart = WDSTRANSPORT_NAMESPACE_TYPE.ScheduledCastAutoStart;
pub const WDSTRANSPORT_DISCONNECT_TYPE = enum(i32) {
Unknown = 0,
Fallback = 1,
Abort = 2,
};
pub const WdsTptDisconnectUnknown = WDSTRANSPORT_DISCONNECT_TYPE.Unknown;
pub const WdsTptDisconnectFallback = WDSTRANSPORT_DISCONNECT_TYPE.Fallback;
pub const WdsTptDisconnectAbort = WDSTRANSPORT_DISCONNECT_TYPE.Abort;
pub const WDSTRANSPORT_SERVICE_NOTIFICATION = enum(i32) {
Unknown = 0,
ReadSettings = 1,
};
pub const WdsTptServiceNotifyUnknown = WDSTRANSPORT_SERVICE_NOTIFICATION.Unknown;
pub const WdsTptServiceNotifyReadSettings = WDSTRANSPORT_SERVICE_NOTIFICATION.ReadSettings;
pub const WDSTRANSPORT_IP_ADDRESS_TYPE = enum(i32) {
Unknown = 0,
Ipv4 = 1,
Ipv6 = 2,
};
pub const WdsTptIpAddressUnknown = WDSTRANSPORT_IP_ADDRESS_TYPE.Unknown;
pub const WdsTptIpAddressIpv4 = WDSTRANSPORT_IP_ADDRESS_TYPE.Ipv4;
pub const WdsTptIpAddressIpv6 = WDSTRANSPORT_IP_ADDRESS_TYPE.Ipv6;
pub const WDSTRANSPORT_IP_ADDRESS_SOURCE_TYPE = enum(i32) {
Unknown = 0,
Dhcp = 1,
Range = 2,
};
pub const WdsTptIpAddressSourceUnknown = WDSTRANSPORT_IP_ADDRESS_SOURCE_TYPE.Unknown;
pub const WdsTptIpAddressSourceDhcp = WDSTRANSPORT_IP_ADDRESS_SOURCE_TYPE.Dhcp;
pub const WdsTptIpAddressSourceRange = WDSTRANSPORT_IP_ADDRESS_SOURCE_TYPE.Range;
pub const WDSTRANSPORT_NETWORK_PROFILE_TYPE = enum(i32) {
Unknown = 0,
Custom = 1,
@"10Mbps" = 2,
@"100Mbps" = 3,
@"1Gbps" = 4,
};
pub const WdsTptNetworkProfileUnknown = WDSTRANSPORT_NETWORK_PROFILE_TYPE.Unknown;
pub const WdsTptNetworkProfileCustom = WDSTRANSPORT_NETWORK_PROFILE_TYPE.Custom;
pub const WdsTptNetworkProfile10Mbps = WDSTRANSPORT_NETWORK_PROFILE_TYPE.@"10Mbps";
pub const WdsTptNetworkProfile100Mbps = WDSTRANSPORT_NETWORK_PROFILE_TYPE.@"100Mbps";
pub const WdsTptNetworkProfile1Gbps = WDSTRANSPORT_NETWORK_PROFILE_TYPE.@"1Gbps";
pub const WDSTRANSPORT_DIAGNOSTICS_COMPONENT_FLAGS = enum(i32) {
Pxe = 1,
Tftp = 2,
ImageServer = 4,
Multicast = 8,
};
pub const WdsTptDiagnosticsComponentPxe = WDSTRANSPORT_DIAGNOSTICS_COMPONENT_FLAGS.Pxe;
pub const WdsTptDiagnosticsComponentTftp = WDSTRANSPORT_DIAGNOSTICS_COMPONENT_FLAGS.Tftp;
pub const WdsTptDiagnosticsComponentImageServer = WDSTRANSPORT_DIAGNOSTICS_COMPONENT_FLAGS.ImageServer;
pub const WdsTptDiagnosticsComponentMulticast = WDSTRANSPORT_DIAGNOSTICS_COMPONENT_FLAGS.Multicast;
pub const WDSTRANSPORT_SLOW_CLIENT_HANDLING_TYPE = enum(i32) {
Unknown = 0,
None = 1,
AutoDisconnect = 2,
Multistream = 3,
};
pub const WdsTptSlowClientHandlingUnknown = WDSTRANSPORT_SLOW_CLIENT_HANDLING_TYPE.Unknown;
pub const WdsTptSlowClientHandlingNone = WDSTRANSPORT_SLOW_CLIENT_HANDLING_TYPE.None;
pub const WdsTptSlowClientHandlingAutoDisconnect = WDSTRANSPORT_SLOW_CLIENT_HANDLING_TYPE.AutoDisconnect;
pub const WdsTptSlowClientHandlingMultistream = WDSTRANSPORT_SLOW_CLIENT_HANDLING_TYPE.Multistream;
pub const WDSTRANSPORT_UDP_PORT_POLICY = enum(i32) {
Dynamic = 0,
Fixed = 1,
};
pub const WdsTptUdpPortPolicyDynamic = WDSTRANSPORT_UDP_PORT_POLICY.Dynamic;
pub const WdsTptUdpPortPolicyFixed = WDSTRANSPORT_UDP_PORT_POLICY.Fixed;
pub const WDSTRANSPORT_TFTP_CAPABILITY = enum(i32) {
MaximumBlockSize = 1,
VariableWindow = 2,
};
pub const WdsTptTftpCapMaximumBlockSize = WDSTRANSPORT_TFTP_CAPABILITY.MaximumBlockSize;
pub const WdsTptTftpCapVariableWindow = WDSTRANSPORT_TFTP_CAPABILITY.VariableWindow;
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportCacheable_Value = @import("../zig.zig").Guid.initString("46ad894b-0bab-47dc-84b2-7b553f1d8f80");
pub const IID_IWdsTransportCacheable = &IID_IWdsTransportCacheable_Value;
pub const IWdsTransportCacheable = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Dirty: fn(
self: *const IWdsTransportCacheable,
pbDirty: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Discard: fn(
self: *const IWdsTransportCacheable,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Refresh: fn(
self: *const IWdsTransportCacheable,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Commit: fn(
self: *const IWdsTransportCacheable,
) 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 IWdsTransportCacheable_get_Dirty(self: *const T, pbDirty: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportCacheable.VTable, self.vtable).get_Dirty(@ptrCast(*const IWdsTransportCacheable, self), pbDirty);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportCacheable_Discard(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportCacheable.VTable, self.vtable).Discard(@ptrCast(*const IWdsTransportCacheable, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportCacheable_Refresh(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportCacheable.VTable, self.vtable).Refresh(@ptrCast(*const IWdsTransportCacheable, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportCacheable_Commit(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportCacheable.VTable, self.vtable).Commit(@ptrCast(*const IWdsTransportCacheable, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportCollection_Value = @import("../zig.zig").Guid.initString("b8ba4b1a-2ff4-43ab-996c-b2b10a91a6eb");
pub const IID_IWdsTransportCollection = &IID_IWdsTransportCollection_Value;
pub const IWdsTransportCollection = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const IWdsTransportCollection,
pulCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Item: fn(
self: *const IWdsTransportCollection,
ulIndex: u32,
ppVal: ?*?*IDispatch,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const IWdsTransportCollection,
ppVal: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportCollection_get_Count(self: *const T, pulCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportCollection.VTable, self.vtable).get_Count(@ptrCast(*const IWdsTransportCollection, self), pulCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportCollection_get_Item(self: *const T, ulIndex: u32, ppVal: ?*?*IDispatch) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportCollection.VTable, self.vtable).get_Item(@ptrCast(*const IWdsTransportCollection, self), ulIndex, ppVal);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportCollection_get__NewEnum(self: *const T, ppVal: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const IWdsTransportCollection, self), ppVal);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportManager_Value = @import("../zig.zig").Guid.initString("5b0d35f5-1b13-4afd-b878-6526dc340b5d");
pub const IID_IWdsTransportManager = &IID_IWdsTransportManager_Value;
pub const IWdsTransportManager = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
GetWdsTransportServer: fn(
self: *const IWdsTransportManager,
bszServerName: ?BSTR,
ppWdsTransportServer: ?*?*IWdsTransportServer,
) 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 IWdsTransportManager_GetWdsTransportServer(self: *const T, bszServerName: ?BSTR, ppWdsTransportServer: ?*?*IWdsTransportServer) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportManager.VTable, self.vtable).GetWdsTransportServer(@ptrCast(*const IWdsTransportManager, self), bszServerName, ppWdsTransportServer);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportServer_Value = @import("../zig.zig").Guid.initString("09ccd093-830d-4344-a30a-73ae8e8fca90");
pub const IID_IWdsTransportServer = &IID_IWdsTransportServer_Value;
pub const IWdsTransportServer = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Name: fn(
self: *const IWdsTransportServer,
pbszName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_SetupManager: fn(
self: *const IWdsTransportServer,
ppWdsTransportSetupManager: ?*?*IWdsTransportSetupManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ConfigurationManager: fn(
self: *const IWdsTransportServer,
ppWdsTransportConfigurationManager: ?*?*IWdsTransportConfigurationManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NamespaceManager: fn(
self: *const IWdsTransportServer,
ppWdsTransportNamespaceManager: ?*?*IWdsTransportNamespaceManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisconnectClient: fn(
self: *const IWdsTransportServer,
ulClientId: u32,
DisconnectionType: WDSTRANSPORT_DISCONNECT_TYPE,
) 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 IWdsTransportServer_get_Name(self: *const T, pbszName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServer.VTable, self.vtable).get_Name(@ptrCast(*const IWdsTransportServer, self), pbszName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServer_get_SetupManager(self: *const T, ppWdsTransportSetupManager: ?*?*IWdsTransportSetupManager) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServer.VTable, self.vtable).get_SetupManager(@ptrCast(*const IWdsTransportServer, self), ppWdsTransportSetupManager);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServer_get_ConfigurationManager(self: *const T, ppWdsTransportConfigurationManager: ?*?*IWdsTransportConfigurationManager) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServer.VTable, self.vtable).get_ConfigurationManager(@ptrCast(*const IWdsTransportServer, self), ppWdsTransportConfigurationManager);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServer_get_NamespaceManager(self: *const T, ppWdsTransportNamespaceManager: ?*?*IWdsTransportNamespaceManager) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServer.VTable, self.vtable).get_NamespaceManager(@ptrCast(*const IWdsTransportServer, self), ppWdsTransportNamespaceManager);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServer_DisconnectClient(self: *const T, ulClientId: u32, DisconnectionType: WDSTRANSPORT_DISCONNECT_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServer.VTable, self.vtable).DisconnectClient(@ptrCast(*const IWdsTransportServer, self), ulClientId, DisconnectionType);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2012'
const IID_IWdsTransportServer2_Value = @import("../zig.zig").Guid.initString("256e999f-6df4-4538-81b9-857b9ab8fb47");
pub const IID_IWdsTransportServer2 = &IID_IWdsTransportServer2_Value;
pub const IWdsTransportServer2 = extern struct {
pub const VTable = extern struct {
base: IWdsTransportServer.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_TftpManager: fn(
self: *const IWdsTransportServer2,
ppWdsTransportTftpManager: ?*?*IWdsTransportTftpManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportServer.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServer2_get_TftpManager(self: *const T, ppWdsTransportTftpManager: ?*?*IWdsTransportTftpManager) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServer2.VTable, self.vtable).get_TftpManager(@ptrCast(*const IWdsTransportServer2, self), ppWdsTransportTftpManager);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportSetupManager_Value = @import("../zig.zig").Guid.initString("f7238425-efa8-40a4-aef9-c98d969c0b75");
pub const IID_IWdsTransportSetupManager = &IID_IWdsTransportSetupManager_Value;
pub const IWdsTransportSetupManager = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Version: fn(
self: *const IWdsTransportSetupManager,
pullVersion: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_InstalledFeatures: fn(
self: *const IWdsTransportSetupManager,
pulInstalledFeatures: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Protocols: fn(
self: *const IWdsTransportSetupManager,
pulProtocols: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RegisterContentProvider: fn(
self: *const IWdsTransportSetupManager,
bszName: ?BSTR,
bszDescription: ?BSTR,
bszFilePath: ?BSTR,
bszInitializationRoutine: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeregisterContentProvider: fn(
self: *const IWdsTransportSetupManager,
bszName: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSetupManager_get_Version(self: *const T, pullVersion: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSetupManager.VTable, self.vtable).get_Version(@ptrCast(*const IWdsTransportSetupManager, self), pullVersion);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSetupManager_get_InstalledFeatures(self: *const T, pulInstalledFeatures: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSetupManager.VTable, self.vtable).get_InstalledFeatures(@ptrCast(*const IWdsTransportSetupManager, self), pulInstalledFeatures);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSetupManager_get_Protocols(self: *const T, pulProtocols: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSetupManager.VTable, self.vtable).get_Protocols(@ptrCast(*const IWdsTransportSetupManager, self), pulProtocols);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSetupManager_RegisterContentProvider(self: *const T, bszName: ?BSTR, bszDescription: ?BSTR, bszFilePath: ?BSTR, bszInitializationRoutine: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSetupManager.VTable, self.vtable).RegisterContentProvider(@ptrCast(*const IWdsTransportSetupManager, self), bszName, bszDescription, bszFilePath, bszInitializationRoutine);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSetupManager_DeregisterContentProvider(self: *const T, bszName: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSetupManager.VTable, self.vtable).DeregisterContentProvider(@ptrCast(*const IWdsTransportSetupManager, self), bszName);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2012'
const IID_IWdsTransportSetupManager2_Value = @import("../zig.zig").Guid.initString("02be79da-7e9e-4366-8b6e-2aa9a91be47f");
pub const IID_IWdsTransportSetupManager2 = &IID_IWdsTransportSetupManager2_Value;
pub const IWdsTransportSetupManager2 = extern struct {
pub const VTable = extern struct {
base: IWdsTransportSetupManager.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_TftpCapabilities: fn(
self: *const IWdsTransportSetupManager2,
pulTftpCapabilities: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ContentProviders: fn(
self: *const IWdsTransportSetupManager2,
ppProviderCollection: ?*?*IWdsTransportCollection,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportSetupManager.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSetupManager2_get_TftpCapabilities(self: *const T, pulTftpCapabilities: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSetupManager2.VTable, self.vtable).get_TftpCapabilities(@ptrCast(*const IWdsTransportSetupManager2, self), pulTftpCapabilities);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSetupManager2_get_ContentProviders(self: *const T, ppProviderCollection: ?*?*IWdsTransportCollection) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSetupManager2.VTable, self.vtable).get_ContentProviders(@ptrCast(*const IWdsTransportSetupManager2, self), ppProviderCollection);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportConfigurationManager_Value = @import("../zig.zig").Guid.initString("84cc4779-42dd-4792-891e-1321d6d74b44");
pub const IID_IWdsTransportConfigurationManager = &IID_IWdsTransportConfigurationManager_Value;
pub const IWdsTransportConfigurationManager = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ServicePolicy: fn(
self: *const IWdsTransportConfigurationManager,
ppWdsTransportServicePolicy: ?*?*IWdsTransportServicePolicy,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_DiagnosticsPolicy: fn(
self: *const IWdsTransportConfigurationManager,
ppWdsTransportDiagnosticsPolicy: ?*?*IWdsTransportDiagnosticsPolicy,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_WdsTransportServicesRunning: fn(
self: *const IWdsTransportConfigurationManager,
bRealtimeStatus: i16,
pbServicesRunning: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnableWdsTransportServices: fn(
self: *const IWdsTransportConfigurationManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisableWdsTransportServices: fn(
self: *const IWdsTransportConfigurationManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StartWdsTransportServices: fn(
self: *const IWdsTransportConfigurationManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StopWdsTransportServices: fn(
self: *const IWdsTransportConfigurationManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RestartWdsTransportServices: fn(
self: *const IWdsTransportConfigurationManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
NotifyWdsTransportServices: fn(
self: *const IWdsTransportConfigurationManager,
ServiceNotification: WDSTRANSPORT_SERVICE_NOTIFICATION,
) 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 IWdsTransportConfigurationManager_get_ServicePolicy(self: *const T, ppWdsTransportServicePolicy: ?*?*IWdsTransportServicePolicy) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager.VTable, self.vtable).get_ServicePolicy(@ptrCast(*const IWdsTransportConfigurationManager, self), ppWdsTransportServicePolicy);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportConfigurationManager_get_DiagnosticsPolicy(self: *const T, ppWdsTransportDiagnosticsPolicy: ?*?*IWdsTransportDiagnosticsPolicy) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager.VTable, self.vtable).get_DiagnosticsPolicy(@ptrCast(*const IWdsTransportConfigurationManager, self), ppWdsTransportDiagnosticsPolicy);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportConfigurationManager_get_WdsTransportServicesRunning(self: *const T, bRealtimeStatus: i16, pbServicesRunning: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager.VTable, self.vtable).get_WdsTransportServicesRunning(@ptrCast(*const IWdsTransportConfigurationManager, self), bRealtimeStatus, pbServicesRunning);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportConfigurationManager_EnableWdsTransportServices(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager.VTable, self.vtable).EnableWdsTransportServices(@ptrCast(*const IWdsTransportConfigurationManager, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportConfigurationManager_DisableWdsTransportServices(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager.VTable, self.vtable).DisableWdsTransportServices(@ptrCast(*const IWdsTransportConfigurationManager, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportConfigurationManager_StartWdsTransportServices(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager.VTable, self.vtable).StartWdsTransportServices(@ptrCast(*const IWdsTransportConfigurationManager, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportConfigurationManager_StopWdsTransportServices(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager.VTable, self.vtable).StopWdsTransportServices(@ptrCast(*const IWdsTransportConfigurationManager, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportConfigurationManager_RestartWdsTransportServices(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager.VTable, self.vtable).RestartWdsTransportServices(@ptrCast(*const IWdsTransportConfigurationManager, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportConfigurationManager_NotifyWdsTransportServices(self: *const T, ServiceNotification: WDSTRANSPORT_SERVICE_NOTIFICATION) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager.VTable, self.vtable).NotifyWdsTransportServices(@ptrCast(*const IWdsTransportConfigurationManager, self), ServiceNotification);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportConfigurationManager2_Value = @import("../zig.zig").Guid.initString("d0d85caf-a153-4f1d-a9dd-96f431c50717");
pub const IID_IWdsTransportConfigurationManager2 = &IID_IWdsTransportConfigurationManager2_Value;
pub const IWdsTransportConfigurationManager2 = extern struct {
pub const VTable = extern struct {
base: IWdsTransportConfigurationManager.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_MulticastSessionPolicy: fn(
self: *const IWdsTransportConfigurationManager2,
ppWdsTransportMulticastSessionPolicy: ?*?*IWdsTransportMulticastSessionPolicy,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportConfigurationManager.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportConfigurationManager2_get_MulticastSessionPolicy(self: *const T, ppWdsTransportMulticastSessionPolicy: ?*?*IWdsTransportMulticastSessionPolicy) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportConfigurationManager2.VTable, self.vtable).get_MulticastSessionPolicy(@ptrCast(*const IWdsTransportConfigurationManager2, self), ppWdsTransportMulticastSessionPolicy);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportNamespaceManager_Value = @import("../zig.zig").Guid.initString("3e22d9f6-3777-4d98-83e1-f98696717ba3");
pub const IID_IWdsTransportNamespaceManager = &IID_IWdsTransportNamespaceManager_Value;
pub const IWdsTransportNamespaceManager = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
CreateNamespace: fn(
self: *const IWdsTransportNamespaceManager,
NamespaceType: WDSTRANSPORT_NAMESPACE_TYPE,
bszNamespaceName: ?BSTR,
bszContentProvider: ?BSTR,
bszConfiguration: ?BSTR,
ppWdsTransportNamespace: ?*?*IWdsTransportNamespace,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RetrieveNamespace: fn(
self: *const IWdsTransportNamespaceManager,
bszNamespaceName: ?BSTR,
ppWdsTransportNamespace: ?*?*IWdsTransportNamespace,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RetrieveNamespaces: fn(
self: *const IWdsTransportNamespaceManager,
bszContentProvider: ?BSTR,
bszNamespaceName: ?BSTR,
bIncludeTombstones: i16,
ppWdsTransportNamespaces: ?*?*IWdsTransportCollection,
) 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 IWdsTransportNamespaceManager_CreateNamespace(self: *const T, NamespaceType: WDSTRANSPORT_NAMESPACE_TYPE, bszNamespaceName: ?BSTR, bszContentProvider: ?BSTR, bszConfiguration: ?BSTR, ppWdsTransportNamespace: ?*?*IWdsTransportNamespace) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespaceManager.VTable, self.vtable).CreateNamespace(@ptrCast(*const IWdsTransportNamespaceManager, self), NamespaceType, bszNamespaceName, bszContentProvider, bszConfiguration, ppWdsTransportNamespace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespaceManager_RetrieveNamespace(self: *const T, bszNamespaceName: ?BSTR, ppWdsTransportNamespace: ?*?*IWdsTransportNamespace) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespaceManager.VTable, self.vtable).RetrieveNamespace(@ptrCast(*const IWdsTransportNamespaceManager, self), bszNamespaceName, ppWdsTransportNamespace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespaceManager_RetrieveNamespaces(self: *const T, bszContentProvider: ?BSTR, bszNamespaceName: ?BSTR, bIncludeTombstones: i16, ppWdsTransportNamespaces: ?*?*IWdsTransportCollection) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespaceManager.VTable, self.vtable).RetrieveNamespaces(@ptrCast(*const IWdsTransportNamespaceManager, self), bszContentProvider, bszNamespaceName, bIncludeTombstones, ppWdsTransportNamespaces);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2012'
const IID_IWdsTransportTftpManager_Value = @import("../zig.zig").Guid.initString("1327a7c8-ae8a-4fb3-8150-136227c37e9a");
pub const IID_IWdsTransportTftpManager = &IID_IWdsTransportTftpManager_Value;
pub const IWdsTransportTftpManager = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
RetrieveTftpClients: fn(
self: *const IWdsTransportTftpManager,
ppWdsTransportTftpClients: ?*?*IWdsTransportCollection,
) 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 IWdsTransportTftpManager_RetrieveTftpClients(self: *const T, ppWdsTransportTftpClients: ?*?*IWdsTransportCollection) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportTftpManager.VTable, self.vtable).RetrieveTftpClients(@ptrCast(*const IWdsTransportTftpManager, self), ppWdsTransportTftpClients);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportServicePolicy_Value = @import("../zig.zig").Guid.initString("b9468578-9f2b-48cc-b27a-a60799c2750c");
pub const IID_IWdsTransportServicePolicy = &IID_IWdsTransportServicePolicy_Value;
pub const IWdsTransportServicePolicy = extern struct {
pub const VTable = extern struct {
base: IWdsTransportCacheable.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_IpAddressSource: fn(
self: *const IWdsTransportServicePolicy,
AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE,
pSourceType: ?*WDSTRANSPORT_IP_ADDRESS_SOURCE_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_IpAddressSource: fn(
self: *const IWdsTransportServicePolicy,
AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE,
SourceType: WDSTRANSPORT_IP_ADDRESS_SOURCE_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_StartIpAddress: fn(
self: *const IWdsTransportServicePolicy,
AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE,
pbszStartIpAddress: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_StartIpAddress: fn(
self: *const IWdsTransportServicePolicy,
AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE,
bszStartIpAddress: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EndIpAddress: fn(
self: *const IWdsTransportServicePolicy,
AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE,
pbszEndIpAddress: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_EndIpAddress: fn(
self: *const IWdsTransportServicePolicy,
AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE,
bszEndIpAddress: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_StartPort: fn(
self: *const IWdsTransportServicePolicy,
pulStartPort: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_StartPort: fn(
self: *const IWdsTransportServicePolicy,
ulStartPort: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EndPort: fn(
self: *const IWdsTransportServicePolicy,
pulEndPort: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_EndPort: fn(
self: *const IWdsTransportServicePolicy,
ulEndPort: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NetworkProfile: fn(
self: *const IWdsTransportServicePolicy,
pProfileType: ?*WDSTRANSPORT_NETWORK_PROFILE_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_NetworkProfile: fn(
self: *const IWdsTransportServicePolicy,
ProfileType: WDSTRANSPORT_NETWORK_PROFILE_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportCacheable.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_get_IpAddressSource(self: *const T, AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE, pSourceType: ?*WDSTRANSPORT_IP_ADDRESS_SOURCE_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).get_IpAddressSource(@ptrCast(*const IWdsTransportServicePolicy, self), AddressType, pSourceType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_put_IpAddressSource(self: *const T, AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE, SourceType: WDSTRANSPORT_IP_ADDRESS_SOURCE_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).put_IpAddressSource(@ptrCast(*const IWdsTransportServicePolicy, self), AddressType, SourceType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_get_StartIpAddress(self: *const T, AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE, pbszStartIpAddress: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).get_StartIpAddress(@ptrCast(*const IWdsTransportServicePolicy, self), AddressType, pbszStartIpAddress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_put_StartIpAddress(self: *const T, AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE, bszStartIpAddress: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).put_StartIpAddress(@ptrCast(*const IWdsTransportServicePolicy, self), AddressType, bszStartIpAddress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_get_EndIpAddress(self: *const T, AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE, pbszEndIpAddress: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).get_EndIpAddress(@ptrCast(*const IWdsTransportServicePolicy, self), AddressType, pbszEndIpAddress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_put_EndIpAddress(self: *const T, AddressType: WDSTRANSPORT_IP_ADDRESS_TYPE, bszEndIpAddress: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).put_EndIpAddress(@ptrCast(*const IWdsTransportServicePolicy, self), AddressType, bszEndIpAddress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_get_StartPort(self: *const T, pulStartPort: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).get_StartPort(@ptrCast(*const IWdsTransportServicePolicy, self), pulStartPort);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_put_StartPort(self: *const T, ulStartPort: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).put_StartPort(@ptrCast(*const IWdsTransportServicePolicy, self), ulStartPort);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_get_EndPort(self: *const T, pulEndPort: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).get_EndPort(@ptrCast(*const IWdsTransportServicePolicy, self), pulEndPort);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_put_EndPort(self: *const T, ulEndPort: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).put_EndPort(@ptrCast(*const IWdsTransportServicePolicy, self), ulEndPort);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_get_NetworkProfile(self: *const T, pProfileType: ?*WDSTRANSPORT_NETWORK_PROFILE_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).get_NetworkProfile(@ptrCast(*const IWdsTransportServicePolicy, self), pProfileType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy_put_NetworkProfile(self: *const T, ProfileType: WDSTRANSPORT_NETWORK_PROFILE_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy.VTable, self.vtable).put_NetworkProfile(@ptrCast(*const IWdsTransportServicePolicy, self), ProfileType);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2012'
const IID_IWdsTransportServicePolicy2_Value = @import("../zig.zig").Guid.initString("65c19e5c-aa7e-4b91-8944-91e0e5572797");
pub const IID_IWdsTransportServicePolicy2 = &IID_IWdsTransportServicePolicy2_Value;
pub const IWdsTransportServicePolicy2 = extern struct {
pub const VTable = extern struct {
base: IWdsTransportServicePolicy.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_UdpPortPolicy: fn(
self: *const IWdsTransportServicePolicy2,
pUdpPortPolicy: ?*WDSTRANSPORT_UDP_PORT_POLICY,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_UdpPortPolicy: fn(
self: *const IWdsTransportServicePolicy2,
UdpPortPolicy: WDSTRANSPORT_UDP_PORT_POLICY,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_TftpMaximumBlockSize: fn(
self: *const IWdsTransportServicePolicy2,
pulTftpMaximumBlockSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_TftpMaximumBlockSize: fn(
self: *const IWdsTransportServicePolicy2,
ulTftpMaximumBlockSize: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EnableTftpVariableWindowExtension: fn(
self: *const IWdsTransportServicePolicy2,
pbEnableTftpVariableWindowExtension: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_EnableTftpVariableWindowExtension: fn(
self: *const IWdsTransportServicePolicy2,
bEnableTftpVariableWindowExtension: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportServicePolicy.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy2_get_UdpPortPolicy(self: *const T, pUdpPortPolicy: ?*WDSTRANSPORT_UDP_PORT_POLICY) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy2.VTable, self.vtable).get_UdpPortPolicy(@ptrCast(*const IWdsTransportServicePolicy2, self), pUdpPortPolicy);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy2_put_UdpPortPolicy(self: *const T, UdpPortPolicy: WDSTRANSPORT_UDP_PORT_POLICY) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy2.VTable, self.vtable).put_UdpPortPolicy(@ptrCast(*const IWdsTransportServicePolicy2, self), UdpPortPolicy);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy2_get_TftpMaximumBlockSize(self: *const T, pulTftpMaximumBlockSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy2.VTable, self.vtable).get_TftpMaximumBlockSize(@ptrCast(*const IWdsTransportServicePolicy2, self), pulTftpMaximumBlockSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy2_put_TftpMaximumBlockSize(self: *const T, ulTftpMaximumBlockSize: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy2.VTable, self.vtable).put_TftpMaximumBlockSize(@ptrCast(*const IWdsTransportServicePolicy2, self), ulTftpMaximumBlockSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy2_get_EnableTftpVariableWindowExtension(self: *const T, pbEnableTftpVariableWindowExtension: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy2.VTable, self.vtable).get_EnableTftpVariableWindowExtension(@ptrCast(*const IWdsTransportServicePolicy2, self), pbEnableTftpVariableWindowExtension);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportServicePolicy2_put_EnableTftpVariableWindowExtension(self: *const T, bEnableTftpVariableWindowExtension: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportServicePolicy2.VTable, self.vtable).put_EnableTftpVariableWindowExtension(@ptrCast(*const IWdsTransportServicePolicy2, self), bEnableTftpVariableWindowExtension);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportDiagnosticsPolicy_Value = @import("../zig.zig").Guid.initString("13b33efc-7856-4f61-9a59-8de67b6b87b6");
pub const IID_IWdsTransportDiagnosticsPolicy = &IID_IWdsTransportDiagnosticsPolicy_Value;
pub const IWdsTransportDiagnosticsPolicy = extern struct {
pub const VTable = extern struct {
base: IWdsTransportCacheable.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Enabled: fn(
self: *const IWdsTransportDiagnosticsPolicy,
pbEnabled: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Enabled: fn(
self: *const IWdsTransportDiagnosticsPolicy,
bEnabled: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Components: fn(
self: *const IWdsTransportDiagnosticsPolicy,
pulComponents: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Components: fn(
self: *const IWdsTransportDiagnosticsPolicy,
ulComponents: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportCacheable.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportDiagnosticsPolicy_get_Enabled(self: *const T, pbEnabled: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportDiagnosticsPolicy.VTable, self.vtable).get_Enabled(@ptrCast(*const IWdsTransportDiagnosticsPolicy, self), pbEnabled);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportDiagnosticsPolicy_put_Enabled(self: *const T, bEnabled: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportDiagnosticsPolicy.VTable, self.vtable).put_Enabled(@ptrCast(*const IWdsTransportDiagnosticsPolicy, self), bEnabled);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportDiagnosticsPolicy_get_Components(self: *const T, pulComponents: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportDiagnosticsPolicy.VTable, self.vtable).get_Components(@ptrCast(*const IWdsTransportDiagnosticsPolicy, self), pulComponents);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportDiagnosticsPolicy_put_Components(self: *const T, ulComponents: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportDiagnosticsPolicy.VTable, self.vtable).put_Components(@ptrCast(*const IWdsTransportDiagnosticsPolicy, self), ulComponents);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportMulticastSessionPolicy_Value = @import("../zig.zig").Guid.initString("4e5753cf-68ec-4504-a951-4a003266606b");
pub const IID_IWdsTransportMulticastSessionPolicy = &IID_IWdsTransportMulticastSessionPolicy_Value;
pub const IWdsTransportMulticastSessionPolicy = extern struct {
pub const VTable = extern struct {
base: IWdsTransportCacheable.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_SlowClientHandling: fn(
self: *const IWdsTransportMulticastSessionPolicy,
pSlowClientHandling: ?*WDSTRANSPORT_SLOW_CLIENT_HANDLING_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_SlowClientHandling: fn(
self: *const IWdsTransportMulticastSessionPolicy,
SlowClientHandling: WDSTRANSPORT_SLOW_CLIENT_HANDLING_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AutoDisconnectThreshold: fn(
self: *const IWdsTransportMulticastSessionPolicy,
pulThreshold: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_AutoDisconnectThreshold: fn(
self: *const IWdsTransportMulticastSessionPolicy,
ulThreshold: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_MultistreamStreamCount: fn(
self: *const IWdsTransportMulticastSessionPolicy,
pulStreamCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_MultistreamStreamCount: fn(
self: *const IWdsTransportMulticastSessionPolicy,
ulStreamCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_SlowClientFallback: fn(
self: *const IWdsTransportMulticastSessionPolicy,
pbClientFallback: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_SlowClientFallback: fn(
self: *const IWdsTransportMulticastSessionPolicy,
bClientFallback: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportCacheable.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportMulticastSessionPolicy_get_SlowClientHandling(self: *const T, pSlowClientHandling: ?*WDSTRANSPORT_SLOW_CLIENT_HANDLING_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportMulticastSessionPolicy.VTable, self.vtable).get_SlowClientHandling(@ptrCast(*const IWdsTransportMulticastSessionPolicy, self), pSlowClientHandling);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportMulticastSessionPolicy_put_SlowClientHandling(self: *const T, SlowClientHandling: WDSTRANSPORT_SLOW_CLIENT_HANDLING_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportMulticastSessionPolicy.VTable, self.vtable).put_SlowClientHandling(@ptrCast(*const IWdsTransportMulticastSessionPolicy, self), SlowClientHandling);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportMulticastSessionPolicy_get_AutoDisconnectThreshold(self: *const T, pulThreshold: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportMulticastSessionPolicy.VTable, self.vtable).get_AutoDisconnectThreshold(@ptrCast(*const IWdsTransportMulticastSessionPolicy, self), pulThreshold);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportMulticastSessionPolicy_put_AutoDisconnectThreshold(self: *const T, ulThreshold: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportMulticastSessionPolicy.VTable, self.vtable).put_AutoDisconnectThreshold(@ptrCast(*const IWdsTransportMulticastSessionPolicy, self), ulThreshold);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportMulticastSessionPolicy_get_MultistreamStreamCount(self: *const T, pulStreamCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportMulticastSessionPolicy.VTable, self.vtable).get_MultistreamStreamCount(@ptrCast(*const IWdsTransportMulticastSessionPolicy, self), pulStreamCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportMulticastSessionPolicy_put_MultistreamStreamCount(self: *const T, ulStreamCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportMulticastSessionPolicy.VTable, self.vtable).put_MultistreamStreamCount(@ptrCast(*const IWdsTransportMulticastSessionPolicy, self), ulStreamCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportMulticastSessionPolicy_get_SlowClientFallback(self: *const T, pbClientFallback: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportMulticastSessionPolicy.VTable, self.vtable).get_SlowClientFallback(@ptrCast(*const IWdsTransportMulticastSessionPolicy, self), pbClientFallback);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportMulticastSessionPolicy_put_SlowClientFallback(self: *const T, bClientFallback: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportMulticastSessionPolicy.VTable, self.vtable).put_SlowClientFallback(@ptrCast(*const IWdsTransportMulticastSessionPolicy, self), bClientFallback);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportNamespace_Value = @import("../zig.zig").Guid.initString("fa561f57-fbef-4ed3-b056-127cb1b33b84");
pub const IID_IWdsTransportNamespace = &IID_IWdsTransportNamespace_Value;
pub const IWdsTransportNamespace = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Type: fn(
self: *const IWdsTransportNamespace,
pType: ?*WDSTRANSPORT_NAMESPACE_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const IWdsTransportNamespace,
pulId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Name: fn(
self: *const IWdsTransportNamespace,
pbszName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Name: fn(
self: *const IWdsTransportNamespace,
bszName: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FriendlyName: fn(
self: *const IWdsTransportNamespace,
pbszFriendlyName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_FriendlyName: fn(
self: *const IWdsTransportNamespace,
bszFriendlyName: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Description: fn(
self: *const IWdsTransportNamespace,
pbszDescription: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Description: fn(
self: *const IWdsTransportNamespace,
bszDescription: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ContentProvider: fn(
self: *const IWdsTransportNamespace,
pbszContentProvider: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_ContentProvider: fn(
self: *const IWdsTransportNamespace,
bszContentProvider: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Configuration: fn(
self: *const IWdsTransportNamespace,
pbszConfiguration: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Configuration: fn(
self: *const IWdsTransportNamespace,
bszConfiguration: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Registered: fn(
self: *const IWdsTransportNamespace,
pbRegistered: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Tombstoned: fn(
self: *const IWdsTransportNamespace,
pbTombstoned: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_TombstoneTime: fn(
self: *const IWdsTransportNamespace,
pTombstoneTime: ?*f64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_TransmissionStarted: fn(
self: *const IWdsTransportNamespace,
pbTransmissionStarted: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Register: fn(
self: *const IWdsTransportNamespace,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Deregister: fn(
self: *const IWdsTransportNamespace,
bTerminateSessions: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IWdsTransportNamespace,
ppWdsTransportNamespaceClone: ?*?*IWdsTransportNamespace,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Refresh: fn(
self: *const IWdsTransportNamespace,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RetrieveContents: fn(
self: *const IWdsTransportNamespace,
ppWdsTransportContents: ?*?*IWdsTransportCollection,
) 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 IWdsTransportNamespace_get_Type(self: *const T, pType: ?*WDSTRANSPORT_NAMESPACE_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_Type(@ptrCast(*const IWdsTransportNamespace, self), pType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_Id(self: *const T, pulId: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_Id(@ptrCast(*const IWdsTransportNamespace, self), pulId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_Name(self: *const T, pbszName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_Name(@ptrCast(*const IWdsTransportNamespace, self), pbszName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_put_Name(self: *const T, bszName: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).put_Name(@ptrCast(*const IWdsTransportNamespace, self), bszName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_FriendlyName(self: *const T, pbszFriendlyName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_FriendlyName(@ptrCast(*const IWdsTransportNamespace, self), pbszFriendlyName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_put_FriendlyName(self: *const T, bszFriendlyName: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).put_FriendlyName(@ptrCast(*const IWdsTransportNamespace, self), bszFriendlyName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_Description(self: *const T, pbszDescription: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_Description(@ptrCast(*const IWdsTransportNamespace, self), pbszDescription);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_put_Description(self: *const T, bszDescription: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).put_Description(@ptrCast(*const IWdsTransportNamespace, self), bszDescription);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_ContentProvider(self: *const T, pbszContentProvider: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_ContentProvider(@ptrCast(*const IWdsTransportNamespace, self), pbszContentProvider);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_put_ContentProvider(self: *const T, bszContentProvider: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).put_ContentProvider(@ptrCast(*const IWdsTransportNamespace, self), bszContentProvider);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_Configuration(self: *const T, pbszConfiguration: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_Configuration(@ptrCast(*const IWdsTransportNamespace, self), pbszConfiguration);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_put_Configuration(self: *const T, bszConfiguration: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).put_Configuration(@ptrCast(*const IWdsTransportNamespace, self), bszConfiguration);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_Registered(self: *const T, pbRegistered: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_Registered(@ptrCast(*const IWdsTransportNamespace, self), pbRegistered);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_Tombstoned(self: *const T, pbTombstoned: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_Tombstoned(@ptrCast(*const IWdsTransportNamespace, self), pbTombstoned);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_TombstoneTime(self: *const T, pTombstoneTime: ?*f64) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_TombstoneTime(@ptrCast(*const IWdsTransportNamespace, self), pTombstoneTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_get_TransmissionStarted(self: *const T, pbTransmissionStarted: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).get_TransmissionStarted(@ptrCast(*const IWdsTransportNamespace, self), pbTransmissionStarted);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_Register(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).Register(@ptrCast(*const IWdsTransportNamespace, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_Deregister(self: *const T, bTerminateSessions: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).Deregister(@ptrCast(*const IWdsTransportNamespace, self), bTerminateSessions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_Clone(self: *const T, ppWdsTransportNamespaceClone: ?*?*IWdsTransportNamespace) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).Clone(@ptrCast(*const IWdsTransportNamespace, self), ppWdsTransportNamespaceClone);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_Refresh(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).Refresh(@ptrCast(*const IWdsTransportNamespace, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespace_RetrieveContents(self: *const T, ppWdsTransportContents: ?*?*IWdsTransportCollection) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespace.VTable, self.vtable).RetrieveContents(@ptrCast(*const IWdsTransportNamespace, self), ppWdsTransportContents);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportNamespaceAutoCast_Value = @import("../zig.zig").Guid.initString("ad931a72-c4bd-4c41-8fbc-59c9c748df9e");
pub const IID_IWdsTransportNamespaceAutoCast = &IID_IWdsTransportNamespaceAutoCast_Value;
pub const IWdsTransportNamespaceAutoCast = extern struct {
pub const VTable = extern struct {
base: IWdsTransportNamespace.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportNamespace.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportNamespaceScheduledCast_Value = @import("../zig.zig").Guid.initString("3840cecf-d76c-416e-a4cc-31c741d2874b");
pub const IID_IWdsTransportNamespaceScheduledCast = &IID_IWdsTransportNamespaceScheduledCast_Value;
pub const IWdsTransportNamespaceScheduledCast = extern struct {
pub const VTable = extern struct {
base: IWdsTransportNamespace.VTable,
StartTransmission: fn(
self: *const IWdsTransportNamespaceScheduledCast,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportNamespace.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespaceScheduledCast_StartTransmission(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespaceScheduledCast.VTable, self.vtable).StartTransmission(@ptrCast(*const IWdsTransportNamespaceScheduledCast, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportNamespaceScheduledCastManualStart_Value = @import("../zig.zig").Guid.initString("013e6e4c-e6a7-4fb5-b7ff-d9f5da805c31");
pub const IID_IWdsTransportNamespaceScheduledCastManualStart = &IID_IWdsTransportNamespaceScheduledCastManualStart_Value;
pub const IWdsTransportNamespaceScheduledCastManualStart = extern struct {
pub const VTable = extern struct {
base: IWdsTransportNamespaceScheduledCast.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportNamespaceScheduledCast.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportNamespaceScheduledCastAutoStart_Value = @import("../zig.zig").Guid.initString("d606af3d-ea9c-4219-961e-7491d618d9b9");
pub const IID_IWdsTransportNamespaceScheduledCastAutoStart = &IID_IWdsTransportNamespaceScheduledCastAutoStart_Value;
pub const IWdsTransportNamespaceScheduledCastAutoStart = extern struct {
pub const VTable = extern struct {
base: IWdsTransportNamespaceScheduledCast.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_MinimumClients: fn(
self: *const IWdsTransportNamespaceScheduledCastAutoStart,
pulMinimumClients: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_MinimumClients: fn(
self: *const IWdsTransportNamespaceScheduledCastAutoStart,
ulMinimumClients: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_StartTime: fn(
self: *const IWdsTransportNamespaceScheduledCastAutoStart,
pStartTime: ?*f64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_StartTime: fn(
self: *const IWdsTransportNamespaceScheduledCastAutoStart,
StartTime: f64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IWdsTransportNamespaceScheduledCast.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespaceScheduledCastAutoStart_get_MinimumClients(self: *const T, pulMinimumClients: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespaceScheduledCastAutoStart.VTable, self.vtable).get_MinimumClients(@ptrCast(*const IWdsTransportNamespaceScheduledCastAutoStart, self), pulMinimumClients);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespaceScheduledCastAutoStart_put_MinimumClients(self: *const T, ulMinimumClients: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespaceScheduledCastAutoStart.VTable, self.vtable).put_MinimumClients(@ptrCast(*const IWdsTransportNamespaceScheduledCastAutoStart, self), ulMinimumClients);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespaceScheduledCastAutoStart_get_StartTime(self: *const T, pStartTime: ?*f64) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespaceScheduledCastAutoStart.VTable, self.vtable).get_StartTime(@ptrCast(*const IWdsTransportNamespaceScheduledCastAutoStart, self), pStartTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportNamespaceScheduledCastAutoStart_put_StartTime(self: *const T, StartTime: f64) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportNamespaceScheduledCastAutoStart.VTable, self.vtable).put_StartTime(@ptrCast(*const IWdsTransportNamespaceScheduledCastAutoStart, self), StartTime);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportContent_Value = @import("../zig.zig").Guid.initString("d405d711-0296-4ab4-a860-ac7d32e65798");
pub const IID_IWdsTransportContent = &IID_IWdsTransportContent_Value;
pub const IWdsTransportContent = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Namespace: fn(
self: *const IWdsTransportContent,
ppWdsTransportNamespace: ?*?*IWdsTransportNamespace,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const IWdsTransportContent,
pulId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Name: fn(
self: *const IWdsTransportContent,
pbszName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RetrieveSessions: fn(
self: *const IWdsTransportContent,
ppWdsTransportSessions: ?*?*IWdsTransportCollection,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Terminate: fn(
self: *const IWdsTransportContent,
) 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 IWdsTransportContent_get_Namespace(self: *const T, ppWdsTransportNamespace: ?*?*IWdsTransportNamespace) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportContent.VTable, self.vtable).get_Namespace(@ptrCast(*const IWdsTransportContent, self), ppWdsTransportNamespace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportContent_get_Id(self: *const T, pulId: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportContent.VTable, self.vtable).get_Id(@ptrCast(*const IWdsTransportContent, self), pulId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportContent_get_Name(self: *const T, pbszName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportContent.VTable, self.vtable).get_Name(@ptrCast(*const IWdsTransportContent, self), pbszName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportContent_RetrieveSessions(self: *const T, ppWdsTransportSessions: ?*?*IWdsTransportCollection) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportContent.VTable, self.vtable).RetrieveSessions(@ptrCast(*const IWdsTransportContent, self), ppWdsTransportSessions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportContent_Terminate(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportContent.VTable, self.vtable).Terminate(@ptrCast(*const IWdsTransportContent, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportSession_Value = @import("../zig.zig").Guid.initString("f4efea88-65b1-4f30-a4b9-2793987796fb");
pub const IID_IWdsTransportSession = &IID_IWdsTransportSession_Value;
pub const IWdsTransportSession = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Content: fn(
self: *const IWdsTransportSession,
ppWdsTransportContent: ?*?*IWdsTransportContent,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const IWdsTransportSession,
pulId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NetworkInterfaceName: fn(
self: *const IWdsTransportSession,
pbszNetworkInterfaceName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NetworkInterfaceAddress: fn(
self: *const IWdsTransportSession,
pbszNetworkInterfaceAddress: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_TransferRate: fn(
self: *const IWdsTransportSession,
pulTransferRate: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_MasterClientId: fn(
self: *const IWdsTransportSession,
pulMasterClientId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RetrieveClients: fn(
self: *const IWdsTransportSession,
ppWdsTransportClients: ?*?*IWdsTransportCollection,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Terminate: fn(
self: *const IWdsTransportSession,
) 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 IWdsTransportSession_get_Content(self: *const T, ppWdsTransportContent: ?*?*IWdsTransportContent) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSession.VTable, self.vtable).get_Content(@ptrCast(*const IWdsTransportSession, self), ppWdsTransportContent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSession_get_Id(self: *const T, pulId: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSession.VTable, self.vtable).get_Id(@ptrCast(*const IWdsTransportSession, self), pulId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSession_get_NetworkInterfaceName(self: *const T, pbszNetworkInterfaceName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSession.VTable, self.vtable).get_NetworkInterfaceName(@ptrCast(*const IWdsTransportSession, self), pbszNetworkInterfaceName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSession_get_NetworkInterfaceAddress(self: *const T, pbszNetworkInterfaceAddress: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSession.VTable, self.vtable).get_NetworkInterfaceAddress(@ptrCast(*const IWdsTransportSession, self), pbszNetworkInterfaceAddress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSession_get_TransferRate(self: *const T, pulTransferRate: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSession.VTable, self.vtable).get_TransferRate(@ptrCast(*const IWdsTransportSession, self), pulTransferRate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSession_get_MasterClientId(self: *const T, pulMasterClientId: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSession.VTable, self.vtable).get_MasterClientId(@ptrCast(*const IWdsTransportSession, self), pulMasterClientId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSession_RetrieveClients(self: *const T, ppWdsTransportClients: ?*?*IWdsTransportCollection) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSession.VTable, self.vtable).RetrieveClients(@ptrCast(*const IWdsTransportSession, self), ppWdsTransportClients);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportSession_Terminate(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportSession.VTable, self.vtable).Terminate(@ptrCast(*const IWdsTransportSession, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2008'
const IID_IWdsTransportClient_Value = @import("../zig.zig").Guid.initString("b5dbc93a-cabe-46ca-837f-3e44e93c6545");
pub const IID_IWdsTransportClient = &IID_IWdsTransportClient_Value;
pub const IWdsTransportClient = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Session: fn(
self: *const IWdsTransportClient,
ppWdsTransportSession: ?*?*IWdsTransportSession,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const IWdsTransportClient,
pulId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Name: fn(
self: *const IWdsTransportClient,
pbszName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_MacAddress: fn(
self: *const IWdsTransportClient,
pbszMacAddress: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_IpAddress: fn(
self: *const IWdsTransportClient,
pbszIpAddress: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PercentCompletion: fn(
self: *const IWdsTransportClient,
pulPercentCompletion: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_JoinDuration: fn(
self: *const IWdsTransportClient,
pulJoinDuration: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_CpuUtilization: fn(
self: *const IWdsTransportClient,
pulCpuUtilization: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_MemoryUtilization: fn(
self: *const IWdsTransportClient,
pulMemoryUtilization: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NetworkUtilization: fn(
self: *const IWdsTransportClient,
pulNetworkUtilization: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_UserIdentity: fn(
self: *const IWdsTransportClient,
pbszUserIdentity: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Disconnect: fn(
self: *const IWdsTransportClient,
DisconnectionType: WDSTRANSPORT_DISCONNECT_TYPE,
) 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 IWdsTransportClient_get_Session(self: *const T, ppWdsTransportSession: ?*?*IWdsTransportSession) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_Session(@ptrCast(*const IWdsTransportClient, self), ppWdsTransportSession);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_Id(self: *const T, pulId: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_Id(@ptrCast(*const IWdsTransportClient, self), pulId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_Name(self: *const T, pbszName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_Name(@ptrCast(*const IWdsTransportClient, self), pbszName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_MacAddress(self: *const T, pbszMacAddress: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_MacAddress(@ptrCast(*const IWdsTransportClient, self), pbszMacAddress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_IpAddress(self: *const T, pbszIpAddress: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_IpAddress(@ptrCast(*const IWdsTransportClient, self), pbszIpAddress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_PercentCompletion(self: *const T, pulPercentCompletion: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_PercentCompletion(@ptrCast(*const IWdsTransportClient, self), pulPercentCompletion);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_JoinDuration(self: *const T, pulJoinDuration: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_JoinDuration(@ptrCast(*const IWdsTransportClient, self), pulJoinDuration);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_CpuUtilization(self: *const T, pulCpuUtilization: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_CpuUtilization(@ptrCast(*const IWdsTransportClient, self), pulCpuUtilization);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_MemoryUtilization(self: *const T, pulMemoryUtilization: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_MemoryUtilization(@ptrCast(*const IWdsTransportClient, self), pulMemoryUtilization);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_NetworkUtilization(self: *const T, pulNetworkUtilization: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_NetworkUtilization(@ptrCast(*const IWdsTransportClient, self), pulNetworkUtilization);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_get_UserIdentity(self: *const T, pbszUserIdentity: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).get_UserIdentity(@ptrCast(*const IWdsTransportClient, self), pbszUserIdentity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportClient_Disconnect(self: *const T, DisconnectionType: WDSTRANSPORT_DISCONNECT_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportClient.VTable, self.vtable).Disconnect(@ptrCast(*const IWdsTransportClient, self), DisconnectionType);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2012'
const IID_IWdsTransportTftpClient_Value = @import("../zig.zig").Guid.initString("b022d3ae-884d-4d85-b146-53320e76ef62");
pub const IID_IWdsTransportTftpClient = &IID_IWdsTransportTftpClient_Value;
pub const IWdsTransportTftpClient = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FileName: fn(
self: *const IWdsTransportTftpClient,
pbszFileName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_IpAddress: fn(
self: *const IWdsTransportTftpClient,
pbszIpAddress: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Timeout: fn(
self: *const IWdsTransportTftpClient,
pulTimeout: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_CurrentFileOffset: fn(
self: *const IWdsTransportTftpClient,
pul64CurrentOffset: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FileSize: fn(
self: *const IWdsTransportTftpClient,
pul64FileSize: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_BlockSize: fn(
self: *const IWdsTransportTftpClient,
pulBlockSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_WindowSize: fn(
self: *const IWdsTransportTftpClient,
pulWindowSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportTftpClient_get_FileName(self: *const T, pbszFileName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportTftpClient.VTable, self.vtable).get_FileName(@ptrCast(*const IWdsTransportTftpClient, self), pbszFileName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportTftpClient_get_IpAddress(self: *const T, pbszIpAddress: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportTftpClient.VTable, self.vtable).get_IpAddress(@ptrCast(*const IWdsTransportTftpClient, self), pbszIpAddress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportTftpClient_get_Timeout(self: *const T, pulTimeout: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportTftpClient.VTable, self.vtable).get_Timeout(@ptrCast(*const IWdsTransportTftpClient, self), pulTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportTftpClient_get_CurrentFileOffset(self: *const T, pul64CurrentOffset: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportTftpClient.VTable, self.vtable).get_CurrentFileOffset(@ptrCast(*const IWdsTransportTftpClient, self), pul64CurrentOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportTftpClient_get_FileSize(self: *const T, pul64FileSize: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportTftpClient.VTable, self.vtable).get_FileSize(@ptrCast(*const IWdsTransportTftpClient, self), pul64FileSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportTftpClient_get_BlockSize(self: *const T, pulBlockSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportTftpClient.VTable, self.vtable).get_BlockSize(@ptrCast(*const IWdsTransportTftpClient, self), pulBlockSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportTftpClient_get_WindowSize(self: *const T, pulWindowSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportTftpClient.VTable, self.vtable).get_WindowSize(@ptrCast(*const IWdsTransportTftpClient, self), pulWindowSize);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windowsServer2012'
const IID_IWdsTransportContentProvider_Value = @import("../zig.zig").Guid.initString("b9489f24-f219-4acf-aad7-265c7c08a6ae");
pub const IID_IWdsTransportContentProvider = &IID_IWdsTransportContentProvider_Value;
pub const IWdsTransportContentProvider = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Name: fn(
self: *const IWdsTransportContentProvider,
pbszName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Description: fn(
self: *const IWdsTransportContentProvider,
pbszDescription: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FilePath: fn(
self: *const IWdsTransportContentProvider,
pbszFilePath: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_InitializationRoutine: fn(
self: *const IWdsTransportContentProvider,
pbszInitializationRoutine: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportContentProvider_get_Name(self: *const T, pbszName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportContentProvider.VTable, self.vtable).get_Name(@ptrCast(*const IWdsTransportContentProvider, self), pbszName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportContentProvider_get_Description(self: *const T, pbszDescription: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportContentProvider.VTable, self.vtable).get_Description(@ptrCast(*const IWdsTransportContentProvider, self), pbszDescription);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportContentProvider_get_FilePath(self: *const T, pbszFilePath: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportContentProvider.VTable, self.vtable).get_FilePath(@ptrCast(*const IWdsTransportContentProvider, self), pbszFilePath);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWdsTransportContentProvider_get_InitializationRoutine(self: *const T, pbszInitializationRoutine: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IWdsTransportContentProvider.VTable, self.vtable).get_InitializationRoutine(@ptrCast(*const IWdsTransportContentProvider, self), pbszInitializationRoutine);
}
};}
pub usingnamespace MethodMixin(@This());
};
//--------------------------------------------------------------------------------
// Section: Functions (94)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliClose(
Handle: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliRegisterTrace(
pfn: ?PFN_WdsCliTraceFunction,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.1'
pub extern "WDSCLIENTAPI" fn WdsCliFreeStringArray(
ppwszArray: ?[*]?PWSTR,
ulCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliFindFirstImage(
hSession: ?HANDLE,
phFindHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliFindNextImage(
Handle: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetEnumerationFlags(
Handle: ?HANDLE,
pdwFlags: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageHandleFromFindHandle(
FindHandle: ?HANDLE,
phImageHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageHandleFromTransferHandle(
hTransfer: ?HANDLE,
phImageHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliCreateSession(
pwszServer: ?PWSTR,
pCred: ?*WDS_CLI_CRED,
phSession: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliAuthorizeSession(
hSession: ?HANDLE,
pCred: ?*WDS_CLI_CRED,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliInitializeLog(
hSession: ?HANDLE,
ulClientArchitecture: CPU_ARCHITECTURE,
pwszClientId: ?PWSTR,
pwszClientAddress: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliLog(
hSession: ?HANDLE,
ulLogLevel: u32,
ulMessageCode: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageName(
hIfh: ?HANDLE,
ppwszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageDescription(
hIfh: ?HANDLE,
ppwszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "WDSCLIENTAPI" fn WdsCliGetImageType(
hIfh: ?HANDLE,
pImageType: ?*WDS_CLI_IMAGE_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "WDSCLIENTAPI" fn WdsCliGetImageFiles(
hIfh: ?HANDLE,
pppwszFiles: ?*?*?PWSTR,
pdwCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageLanguage(
hIfh: ?HANDLE,
ppwszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageLanguages(
hIfh: ?HANDLE,
pppszValues: ?*?*?*i8,
pdwNumValues: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageVersion(
hIfh: ?HANDLE,
ppwszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImagePath(
hIfh: ?HANDLE,
ppwszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageIndex(
hIfh: ?HANDLE,
pdwValue: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageArchitecture(
hIfh: ?HANDLE,
pdwValue: ?*CPU_ARCHITECTURE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageLastModifiedTime(
hIfh: ?HANDLE,
ppSysTimeValue: ?*?*SYSTEMTIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageSize(
hIfh: ?HANDLE,
pullValue: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageHalName(
hIfh: ?HANDLE,
ppwszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageGroup(
hIfh: ?HANDLE,
ppwszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetImageNamespace(
hIfh: ?HANDLE,
ppwszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "WDSCLIENTAPI" fn WdsCliGetImageParameter(
hIfh: ?HANDLE,
ParamType: WDS_CLI_IMAGE_PARAM_TYPE,
// TODO: what to do with BytesParamIndex 3?
pResponse: ?*c_void,
uResponseLen: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliGetTransferSize(
hIfh: ?HANDLE,
pullValue: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "WDSCLIENTAPI" fn WdsCliSetTransferBufferSize(
ulSizeInBytes: u32,
) callconv(@import("std").os.windows.WINAPI) void;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliTransferImage(
hImage: ?HANDLE,
pwszLocalPath: ?PWSTR,
dwFlags: u32,
dwReserved: u32,
pfnWdsCliCallback: ?PFN_WdsCliCallback,
pvUserData: ?*c_void,
phTransfer: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliTransferFile(
pwszServer: ?[*:0]const u16,
pwszNamespace: ?[*:0]const u16,
pwszRemoteFilePath: ?[*:0]const u16,
pwszLocalFilePath: ?[*:0]const u16,
dwFlags: u32,
dwReserved: u32,
pfnWdsCliCallback: ?PFN_WdsCliCallback,
pvUserData: ?*c_void,
phTransfer: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliCancelTransfer(
hTransfer: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSCLIENTAPI" fn WdsCliWaitForTransfer(
hTransfer: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.1'
pub extern "WDSCLIENTAPI" fn WdsCliObtainDriverPackages(
hImage: ?HANDLE,
ppwszServerName: ?*?PWSTR,
pppwszDriverPackages: ?*?*?PWSTR,
pulCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSCLIENTAPI" fn WdsCliObtainDriverPackagesEx(
hSession: ?HANDLE,
pwszMachineInfo: ?PWSTR,
ppwszServerName: ?*?PWSTR,
pppwszDriverPackages: ?*?*?PWSTR,
pulCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSCLIENTAPI" fn WdsCliGetDriverQueryXml(
pwszWinDirPath: ?PWSTR,
ppwszDriverQuery: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeProviderRegister(
pszProviderName: ?[*:0]const u16,
pszModulePath: ?[*:0]const u16,
Index: u32,
bIsCritical: BOOL,
phProviderKey: ?*?HKEY,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeProviderUnRegister(
pszProviderName: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeProviderQueryIndex(
pszProviderName: ?[*:0]const u16,
puIndex: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeProviderEnumFirst(
phEnum: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeProviderEnumNext(
hEnum: ?HANDLE,
ppProvider: ?*?*PXE_PROVIDER,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeProviderEnumClose(
hEnum: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeProviderFreeInfo(
pProvider: ?*PXE_PROVIDER,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeRegisterCallback(
hProvider: ?HANDLE,
CallbackType: u32,
pCallbackFunction: ?*c_void,
pContext: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeSendReply(
hClientRequest: ?HANDLE,
// TODO: what to do with BytesParamIndex 2?
pPacket: ?*c_void,
uPacketLen: u32,
pAddress: ?*PXE_ADDRESS,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeAsyncRecvDone(
hClientRequest: ?HANDLE,
Action: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeTrace(
hProvider: ?HANDLE,
Severity: u32,
pszFormat: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "WDSPXE" fn PxeTraceV(
hProvider: ?HANDLE,
Severity: u32,
pszFormat: ?[*:0]const u16,
Params: ?*i8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxePacketAllocate(
hProvider: ?HANDLE,
hClientRequest: ?HANDLE,
uSize: u32,
) callconv(@import("std").os.windows.WINAPI) ?*c_void;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxePacketFree(
hProvider: ?HANDLE,
hClientRequest: ?HANDLE,
pPacket: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeProviderSetAttribute(
hProvider: ?HANDLE,
Attribute: u32,
// TODO: what to do with BytesParamIndex 3?
pParameterBuffer: ?*c_void,
uParamLen: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeDhcpInitialize(
// TODO: what to do with BytesParamIndex 1?
pRecvPacket: ?*c_void,
uRecvPacketLen: u32,
// TODO: what to do with BytesParamIndex 3?
pReplyPacket: ?*c_void,
uMaxReplyPacketLen: u32,
puReplyPacketLen: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSPXE" fn PxeDhcpv6Initialize(
// TODO: what to do with BytesParamIndex 1?
pRequest: ?*c_void,
cbRequest: u32,
// TODO: what to do with BytesParamIndex 3?
pReply: ?*c_void,
cbReply: u32,
pcbReplyUsed: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeDhcpAppendOption(
// TODO: what to do with BytesParamIndex 1?
pReplyPacket: ?*c_void,
uMaxReplyPacketLen: u32,
puReplyPacketLen: ?*u32,
bOption: u8,
bOptionLen: u8,
// TODO: what to do with BytesParamIndex 4?
pValue: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSPXE" fn PxeDhcpv6AppendOption(
// TODO: what to do with BytesParamIndex 1?
pReply: ?*c_void,
cbReply: u32,
pcbReplyUsed: ?*u32,
wOptionType: u16,
cbOption: u16,
// TODO: what to do with BytesParamIndex 4?
pOption: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeDhcpAppendOptionRaw(
// TODO: what to do with BytesParamIndex 1?
pReplyPacket: ?*c_void,
uMaxReplyPacketLen: u32,
puReplyPacketLen: ?*u32,
uBufferLen: u16,
// TODO: what to do with BytesParamIndex 3?
pBuffer: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSPXE" fn PxeDhcpv6AppendOptionRaw(
// TODO: what to do with BytesParamIndex 1?
pReply: ?*c_void,
cbReply: u32,
pcbReplyUsed: ?*u32,
cbBuffer: u16,
// TODO: what to do with BytesParamIndex 3?
pBuffer: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeDhcpIsValid(
// TODO: what to do with BytesParamIndex 1?
pPacket: ?*c_void,
uPacketLen: u32,
bRequestPacket: BOOL,
pbPxeOptionPresent: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSPXE" fn PxeDhcpv6IsValid(
// TODO: what to do with BytesParamIndex 1?
pPacket: ?*c_void,
uPacketLen: u32,
bRequestPacket: BOOL,
pbPxeOptionPresent: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeDhcpGetOptionValue(
// TODO: what to do with BytesParamIndex 1?
pPacket: ?*c_void,
uPacketLen: u32,
uInstance: u32,
bOption: u8,
pbOptionLen: ?*u8,
ppOptionValue: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSPXE" fn PxeDhcpv6GetOptionValue(
// TODO: what to do with BytesParamIndex 1?
pPacket: ?*c_void,
uPacketLen: u32,
uInstance: u32,
wOption: u16,
pwOptionLen: ?*u16,
ppOptionValue: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeDhcpGetVendorOptionValue(
// TODO: what to do with BytesParamIndex 1?
pPacket: ?*c_void,
uPacketLen: u32,
bOption: u8,
uInstance: u32,
pbOptionLen: ?*u8,
ppOptionValue: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSPXE" fn PxeDhcpv6GetVendorOptionValue(
// TODO: what to do with BytesParamIndex 1?
pPacket: ?*c_void,
uPacketLen: u32,
dwEnterpriseNumber: u32,
wOption: u16,
uInstance: u32,
pwOptionLen: ?*u16,
ppOptionValue: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSPXE" fn PxeDhcpv6ParseRelayForw(
// TODO: what to do with BytesParamIndex 1?
pRelayForwPacket: ?*c_void,
uRelayForwPacketLen: u32,
pRelayMessages: [*]PXE_DHCPV6_NESTED_RELAY_MESSAGE,
nRelayMessages: u32,
pnRelayMessages: ?*u32,
ppInnerPacket: ?*?*u8,
pcbInnerPacket: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSPXE" fn PxeDhcpv6CreateRelayRepl(
pRelayMessages: [*]PXE_DHCPV6_NESTED_RELAY_MESSAGE,
nRelayMessages: u32,
// TODO: what to do with BytesParamIndex 3?
pInnerPacket: ?*u8,
cbInnerPacket: u32,
// TODO: what to do with BytesParamIndex 5?
pReplyBuffer: ?*c_void,
cbReplyBuffer: u32,
pcbReplyBuffer: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSPXE" fn PxeGetServerInfo(
uInfoType: u32,
// TODO: what to do with BytesParamIndex 2?
pBuffer: ?*c_void,
uBufferLen: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSPXE" fn PxeGetServerInfoEx(
uInfoType: u32,
// TODO: what to do with BytesParamIndex 2?
pBuffer: ?*c_void,
uBufferLen: u32,
puBufferUsed: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSMC" fn WdsTransportServerRegisterCallback(
hProvider: ?HANDLE,
CallbackId: TRANSPORTPROVIDER_CALLBACK_ID,
pfnCallback: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSMC" fn WdsTransportServerCompleteRead(
hProvider: ?HANDLE,
ulBytesRead: u32,
pvUserData: ?*c_void,
hReadResult: HRESULT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSMC" fn WdsTransportServerTrace(
hProvider: ?HANDLE,
Severity: u32,
pwszFormat: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSMC" fn WdsTransportServerTraceV(
hProvider: ?HANDLE,
Severity: u32,
pwszFormat: ?[*:0]const u16,
Params: ?*i8,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSMC" fn WdsTransportServerAllocateBuffer(
hProvider: ?HANDLE,
ulBufferSize: u32,
) callconv(@import("std").os.windows.WINAPI) ?*c_void;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "WDSMC" fn WdsTransportServerFreeBuffer(
hProvider: ?HANDLE,
pvBuffer: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientInitialize(
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientInitializeSession(
pSessionRequest: ?*WDS_TRANSPORTCLIENT_REQUEST,
pCallerData: ?*c_void,
hSessionKey: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientRegisterCallback(
hSessionKey: ?HANDLE,
CallbackId: TRANSPORTCLIENT_CALLBACK_ID,
pfnCallback: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientStartSession(
hSessionKey: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientCompleteReceive(
hSessionKey: ?HANDLE,
ulSize: u32,
pullOffset: ?*ULARGE_INTEGER,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientCancelSession(
hSessionKey: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "WDSTPTC" fn WdsTransportClientCancelSessionEx(
hSessionKey: ?HANDLE,
dwErrorCode: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientWaitForCompletion(
hSessionKey: ?HANDLE,
uTimeout: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientQueryStatus(
hSessionKey: ?HANDLE,
puStatus: ?*u32,
puErrorCode: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientCloseSession(
hSessionKey: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientAddRefBuffer(
pvBuffer: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientReleaseBuffer(
pvBuffer: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSTPTC" fn WdsTransportClientShutdown(
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSBP" fn WdsBpParseInitialize(
// TODO: what to do with BytesParamIndex 1?
pPacket: ?*c_void,
uPacketLen: u32,
pbPacketType: ?*u8,
phHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows8.0'
pub extern "WDSBP" fn WdsBpParseInitializev6(
// TODO: what to do with BytesParamIndex 1?
pPacket: ?*c_void,
uPacketLen: u32,
pbPacketType: ?*u8,
phHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSBP" fn WdsBpInitialize(
bPacketType: u8,
phHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSBP" fn WdsBpCloseHandle(
hHandle: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSBP" fn WdsBpQueryOption(
hHandle: ?HANDLE,
uOption: u32,
uValueLen: u32,
// TODO: what to do with BytesParamIndex 2?
pValue: ?*c_void,
puBytes: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSBP" fn WdsBpAddOption(
hHandle: ?HANDLE,
uOption: u32,
uValueLen: u32,
// TODO: what to do with BytesParamIndex 2?
pValue: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "WDSBP" fn WdsBpGetOptionBuffer(
hHandle: ?HANDLE,
uBufferLen: u32,
// TODO: what to do with BytesParamIndex 1?
pBuffer: ?*c_void,
puBytes: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (0)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../zig.zig").unicode_mode) {
.ansi => struct {
},
.wide => struct {
},
.unspecified => if (@import("builtin").is_test) struct {
} else struct {
},
};
//--------------------------------------------------------------------------------
// Section: Imports (12)
//--------------------------------------------------------------------------------
const BOOL = @import("../foundation.zig").BOOL;
const BSTR = @import("../foundation.zig").BSTR;
const HANDLE = @import("../foundation.zig").HANDLE;
const HKEY = @import("../system/registry.zig").HKEY;
const HRESULT = @import("../foundation.zig").HRESULT;
const IDispatch = @import("../system/ole_automation.zig").IDispatch;
const IUnknown = @import("../system/com.zig").IUnknown;
const LPARAM = @import("../foundation.zig").LPARAM;
const PWSTR = @import("../foundation.zig").PWSTR;
const SYSTEMTIME = @import("../foundation.zig").SYSTEMTIME;
const ULARGE_INTEGER = @import("../system/system_services.zig").ULARGE_INTEGER;
const WPARAM = @import("../foundation.zig").WPARAM;
test {
// The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
if (@hasDecl(@This(), "PFN_WdsCliTraceFunction")) { _ = PFN_WdsCliTraceFunction; }
if (@hasDecl(@This(), "PFN_WdsCliCallback")) { _ = PFN_WdsCliCallback; }
if (@hasDecl(@This(), "PFN_WdsTransportClientSessionStart")) { _ = PFN_WdsTransportClientSessionStart; }
if (@hasDecl(@This(), "PFN_WdsTransportClientSessionStartEx")) { _ = PFN_WdsTransportClientSessionStartEx; }
if (@hasDecl(@This(), "PFN_WdsTransportClientReceiveMetadata")) { _ = PFN_WdsTransportClientReceiveMetadata; }
if (@hasDecl(@This(), "PFN_WdsTransportClientReceiveContents")) { _ = PFN_WdsTransportClientReceiveContents; }
if (@hasDecl(@This(), "PFN_WdsTransportClientSessionComplete")) { _ = PFN_WdsTransportClientSessionComplete; }
if (@hasDecl(@This(), "PFN_WdsTransportClientSessionNegotiate")) { _ = PFN_WdsTransportClientSessionNegotiate; }
@setEvalBranchQuota(
@import("std").meta.declarations(@This()).len * 3
);
// reference all the pub declarations
if (!@import("builtin").is_test) return;
inline for (@import("std").meta.declarations(@This())) |decl| {
if (decl.is_pub) {
_ = decl;
}
}
} | deps/zigwin32/win32/system/deployment_services.zig |
const std = @import("std");
const stdx = @import("stdx");
const log = stdx.log.scoped(.ast);
const document = stdx.textbuf.document;
const _parser = @import("parser.zig");
const Parser = _parser.Parser;
const NodePtr = _parser.NodePtr;
const TokenRef = _parser.TokenRef;
const NodeSlice = _parser.NodeSlice;
const NodeTokenPtr = _parser.NodeTokenPtr;
const NodeId = _parser.NodeId;
const ParseConfig = _parser.ParseConfig;
const Source = _parser.Source;
const grammar = @import("grammar.zig");
const Grammar = grammar.Grammar;
const TokenTag = grammar.TokenTag;
const LiteralTokenTag = grammar.LiteralTokenTag;
const ds = stdx.ds;
const algo = stdx.algo;
// Currently, the token data is owned by Tree and node data is owned by the parser.
// The plan is to move token ownership to the parser as well and implement copy to a standalone tree.
// When we have an incremental tree, we might need to copy over the parser cache too.
pub fn Tree(comptime Config: ParseConfig) type {
return struct {
const Self = @This();
mb_root: ?NodePtr,
alloc: std.mem.Allocator,
grammar: *Grammar,
// TODO: rename to token_buf
tokens: TokenBuffer(Config),
nodeptr_buf: std.ArrayList(NodePtr),
// Currently points to parser buffers.
node_ptrs: *std.ArrayList(NodePtr),
node_slices: *std.ArrayList(NodeSlice),
node_tokens: *std.ArrayList(NodeTokenPtr),
src: Source(Config),
pub fn init(self: *Self, alloc: std.mem.Allocator, parser: *Parser, src: Source(Config)) void {
self.* = .{
.mb_root = null,
.alloc = alloc,
.tokens = undefined,
.node_ptrs = &parser.buf.node_ptrs,
.node_slices = &parser.buf.node_slices,
.node_tokens = &parser.buf.node_tokens,
.grammar = parser.grammar,
.nodeptr_buf = std.ArrayList(NodePtr).init(alloc),
.src = src,
};
if (Config.is_incremental) {
self.tokens = .{
.lines = std.ArrayList(?TokenListId).init(alloc),
.tokens = ds.CompactManySinglyLinkedList(TokenListId, TokenId, Token).init(alloc),
.temp_head_id = undefined,
.num_tokens = 0,
};
self.tokens.temp_head_id = self.tokens.tokens.addDetachedItem(undefined) catch unreachable;
} else {
self.tokens = std.ArrayList(Token).init(alloc);
}
}
pub fn deinit(self: *Self) void {
// if (self.mb_root) |root| {
// self.destroyNodeDeep(root);
// }
self.nodeptr_buf.deinit();
self.tokens.deinit();
}
pub fn getNumTokens(self: *const Self) u32 {
if (Config.is_incremental) {
return self.tokens.num_tokens;
} else {
return @intCast(u32, self.tokens.items.len);
}
}
pub fn getNodeTagName(self: *const Self, node: NodePtr) []const u8 {
return self.grammar.getNodeTagName(node.tag);
}
pub fn getChildNode(self: *const Self, node: NodePtr, idx: u32) NodePtr {
if (node.tag >= self.grammar.decl_tag_end) {
stdx.panic("Expected node");
}
const fields = self.node_slices.items[node.id];
return self.node_ptrs.items[fields.start + idx];
}
pub fn getChildNodeList(self: *const Self, node: NodePtr, idx: u32) []const NodePtr {
if (node.tag >= self.grammar.decl_tag_end) {
stdx.panic("Expected node");
}
const fields = self.node_slices.items[node.id];
const child = self.node_ptrs.items[fields.start + idx];
if (child.tag != self.grammar.node_list_tag) {
stdx.panic("Expected node list");
}
const list = self.node_slices.items[child.id];
return self.node_ptrs.items[list.start..list.end];
}
pub fn getChildStringValue(self: *const Self, node: NodePtr, idx: u32) []const u8 {
if (node.tag >= self.grammar.decl_tag_end) {
stdx.panic("Expected node");
}
const child = self.getChildAssumeParentSyntaxNode(node, idx);
return self.getNodeTokenString(child);
}
pub fn getNodeTokenString(self: *const Self, node: NodePtr) []const u8 {
if (node.tag != self.grammar.token_value_tag) {
stdx.panic("Expected token value node");
}
const node_token = self.node_tokens.items[node.id];
const token = self.getToken(node_token.token_id);
if (Config.is_incremental) {
return self.src.getSubstringFromLineLoc(node_token.token_ctx, token.loc.start, token.loc.end);
} else {
return self.src[token.loc.start..token.loc.end];
}
}
pub fn getNodeTokenChar(self: *const Self, node: NodePtr) u8 {
if (node.tag != self.grammar.token_value_tag) {
stdx.panic("Expected token value node");
}
const node_token = self.node_tokens.items[node.id];
const token = self.getToken(node_token.token_id);
if (Config.is_incremental) {
return self.src.getSubstringFromLineLoc(node_token.token_ctx, token.loc.start, token.loc.end)[0];
} else {
return self.src[token.loc.start];
}
}
pub fn getChildNodeOpt(self: *const Self, node: NodePtr, idx: u32) ?NodePtr {
const child = self.getChildNode(node, idx);
if (child.tag == self.grammar.null_node_tag) {
return null;
} else {
return child;
}
}
fn getChildCharValue(self: *const Self, node: NodePtr, idx: u32) u8 {
if (node.tag >= self.grammar.decl_tag_end) {
stdx.panic("Expected node");
}
const child = self.getChildAssumeParentSyntaxNode(node, idx);
return self.getCharValue(child);
}
fn getChildAssumeParentSyntaxNode(self: *const Self, parent: NodePtr, idx: u32) NodePtr {
const fields = self.node_slices.items[parent.id];
return self.node_ptrs.items[fields.start + idx];
}
// pub fn getCharValue(self: *const Self, node: NodePtr) u8 {
// if (node.tag != self.grammar.char_value_tag) {
// stdx.panic("Expected char value node");
// }
// return @intCast(u8, @ptrToInt(node.data));
// }
// pub fn getStringValue(self: *const Self, node: NodePtr) []const u8 {
// if (node.tag != self.grammar.string_value_tag) {
// stdx.panic("Expected string value node");
// }
// const str_len = std.mem.bytesToValue(u32, node.data[0..@sizeOf(u32)]);
// const str = node.data[@sizeOf(u32)..@sizeOf(u32)+str_len];
// return str;
// }
fn writeDoubleQuoteEscaped(writer: anytype, str: []const u8) !void {
for (str) |ch| {
switch (ch) {
'\n' => _ = try writer.write("\\n"),
'"' => _ = try writer.write("\\\""),
else => try writer.writeByte(ch),
}
}
}
fn getToken(self: *const Self, id: TokenId) Token {
if (Config.is_incremental) {
return self.tokens.tokens.getNoCheck(id);
} else {
return self.tokens.items[id];
}
}
pub fn getTokenName(self: *Self, id: TokenId) []const u8 {
const token = self.getToken(id);
return self.grammar.getTokenName(token.tag);
}
usingnamespace if (Config.is_incremental) struct {
pub fn getTokenString(self: *const Self, doc: *document.Document, line_idx: u32, id: TokenId) []const u8 {
const loc = doc.findLineLoc(line_idx);
return self.getTokenStringByLoc(doc, loc, id);
}
pub fn getTokenStringByLoc(self: *const Self, doc: *document.Document, loc: document.LineLocation, id: TokenId) []const u8 {
const token = self.tokens.tokens.getNoCheck(id);
return doc.getSubstringFromLineLoc(loc, token.loc.start, token.loc.end);
}
pub fn getTokenList(self: *Self, doc: *document.Document, line_idx: u32) TokenListId {
const line_id = doc.getLineId(line_idx);
return self.tokens.lines.items[line_id].?;
}
} else struct {
pub fn getTokenString(self: *const Self, id: TokenId) []const u8 {
const token = self.getToken(id);
return self.src[token.loc.start..token.loc.end];
}
};
pub fn formatTree(self: *Self, writer: anytype) void {
const S = struct {
indent: u32,
writer: @TypeOf(writer),
tree: *const Self,
fn visit(ctx: *algo.VisitContext(.{}), c: *@This(), node: NodePtr) void {
if (ctx.enter) {
const tag_name = c.tree.getNodeTagName(node);
c.writer.writeByteNTimes(' ', c.indent * 2) catch unreachable;
std.fmt.format(c.writer, "{s}", .{tag_name}) catch unreachable;
if (node.tag == c.tree.grammar.string_value_tag) {
// c.writer.print(" \"", .{}) catch unreachable;
// writeDoubleQuoteEscaped(c.writer, c.tree.getStringValue(node)) catch unreachable;
// c.writer.print("\"", .{}) catch unreachable;
unreachable;
} else if (node.tag == c.tree.grammar.token_value_tag) {
c.writer.print(" \"", .{}) catch unreachable;
writeDoubleQuoteEscaped(c.writer, c.tree.getNodeTokenString(node)) catch unreachable;
c.writer.print("\"", .{}) catch unreachable;
} else if (node.tag == c.tree.grammar.char_value_tag) {
// c.writer.print(" \'{c}\'", .{c.tree.getCharValue(node)}) catch unreachable;
unreachable;
}
_ = c.writer.write("\n") catch unreachable;
c.indent += 1;
} else {
c.indent -= 1;
}
}
};
var ctx = S{ .indent = 0, .writer = writer, .tree = self };
var walker = initNodeWalker(Config, self);
_ = writer.write("\n") catch unreachable;
algo.walkPrePost(.{}, *S, &ctx, NodePtr, self.mb_root.?, walker.getIface(), S.visit, &self.nodeptr_buf, &self.grammar.bit_buf);
}
// TODO: Also add printTokens
pub fn formatTokens(self: *const Self, writer: anytype) void {
if (Config.is_incremental) {
unreachable;
} else {
var cur = self.tokens.getFirst();
while (cur != null) {
const tok = self.tokens.get(cur.?);
const str_slice = self.grammar.token_decls.items[tok.tag].name;
const str = self.grammar.getString(str_slice);
std.fmt.format(writer, "[{}] {s} \"{s}\" ", .{ cur.?, str, self.src[tok.loc.start..tok.loc.end] }) catch unreachable;
// std.fmt.format(writer, "[{}-{}] {s} \"{s}\" ", .{tok.loc.start, tok.loc.end, self.tags.items[tok.tag], self.src[tok.loc.start..tok.loc.end]}) catch unreachable;
cur = self.tokens.getNext(cur.?);
}
}
}
pub fn formatContextAtToken(self: *const Self, writer: anytype, tok_ref: TokenRef(Config)) void {
if (Config.is_incremental) {
unreachable;
} else {
const MaxLinesBefore = 30;
const MaxLinesAfter = 30;
const tok_id = tok_ref;
const tok = self.tokens.items[tok_id];
const before = if (std.mem.lastIndexOf(u8, self.src[0..tok.loc.start], "\n")) |res| res + 1 else 0;
const after = if (std.mem.indexOfPos(u8, self.src, tok.loc.end, "\n")) |res| res + 1 else self.src.len;
const before_line = self.src[before..tok.loc.start];
const after_line = self.src[tok.loc.end..after];
const before_num_lines = std.mem.count(u8, self.src[0..before], "\n");
if (before_num_lines > MaxLinesBefore) {
_ = writer.write("TRUNCATED REST\n") catch unreachable;
const idx = stdx.mem.lastIndexOfNth(u8, self.src[0..before], "\n", @intCast(u32, MaxLinesBefore)).? + 1;
var iter = stdx.string.splitLines(self.src[idx..before]);
var i: u32 = 0;
while (i < MaxLinesBefore) : (i += 1) {
const line = iter.next().?;
writer.print("{s}\n", .{line}) catch unreachable;
}
} else {
_ = writer.write(self.src[0..before]) catch unreachable;
}
writer.print("----------------[{}]\n", .{before_num_lines}) catch unreachable;
writer.print("{s}>>>|{s}|<<<{s}", .{ before_line, self.src[tok.loc.start..tok.loc.end], after_line }) catch unreachable;
_ = writer.write("----------------\n") catch unreachable;
const after_num_lines = std.mem.count(u8, self.src[after..], "\n");
if (after_num_lines > MaxLinesAfter) {
var iter = stdx.string.splitLines(self.src[after..]);
var i: u32 = 0;
while (i < MaxLinesAfter) : (i += 1) {
const line = iter.next().?;
writer.print("{s}\n", .{line}) catch unreachable;
}
_ = writer.write("TRUNCATED REST\n") catch unreachable;
} else {
_ = writer.write(self.src[after..]) catch unreachable;
}
}
}
// TODO: Destroy functions will only be used for standalone ast (doesn't depend on parser buffer)
// fn destroyNode(self: *Self, node: NodePtr) void {
// // log.warn("destroying node {s}", .{self.grammar.getNodeTagName(node.tag)});
// if (node.tag < self.grammar.node_list_tag) {
// const size = self.grammar.getNodeDataSize(node.tag);
// self.alloc.free(node.data[0..size]);
// } else if (node.tag == self.grammar.node_list_tag) {
// const slice = std.mem.bytesToValue([]const NodePtr, node.data[0..@sizeOf([]const NodePtr)]);
// // First destroy the node ptr array.
// self.alloc.free(slice);
// const size = self.grammar.getNodeDataSize(node.tag);
// self.alloc.free(node.data[0..size]);
// } else if (node.tag == self.grammar.string_value_tag) {
// const str_len = std.mem.bytesToValue(u32, node.data[0..@sizeOf(u32)]);
// self.alloc.free(node.data[0..@sizeOf(u32)+str_len]);
// } else if (node.tag == self.grammar.char_value_tag) {
// // Nop.
// } else if (node.tag == self.grammar.null_node_tag) {
// // Nop.
// } else stdx.panicFmt("unsupported node: {}", .{node.tag});
// }
// pub fn destroyNodesDeep(self: *Self, roots: []const NodePtr) void {
// for (roots) |it| {
// self.destroyNodeDeep(it);
// }
// }
// pub fn destroyNodesDeepExclude(self: *Self, roots: []const NodePtr, exclude_id: NodeId) void {
// for (roots) |it| {
// self.destroyNodeDeepExclude(it, exclude_id);
// }
// }
// pub fn destroyNodeDeep(self: *Self, root: NodePtr) void {
// const S = struct {
// fn visit(_: *walk.VisitContext(.{}), tree: *Self, node: NodePtr) void {
// tree.destroyNode(node);
// }
// };
// var walker = initNodeWalker(Config, self);
// walk.walkPost(.{}, *Self, self, NodePtr, root, walker.getIface(), S.visit, &self.nodeptr_buf, &self.grammar.bit_buf);
// }
// pub fn destroyNodeDeepExclude(self: *Self, root: NodePtr, exclude_id: NodeId) void {
// const WalkerConfig = walk.WalkerConfig{ .enable_skip = true };
// const S = struct {
// exclude_id: NodeId,
// parser: *Self,
// fn visit(c: *walk.VisitContext(WalkerConfig), ctx: *@This(), node: NodePtr) void {
// if (c.enter) {
// if (node.id == ctx.exclude_id) {
// c.skip();
// }
// } else {
// ctx.parser.destroyNode(node);
// }
// }
// };
// var ctx = S{ .exclude_id = exclude_id, .parser = self };
// var walker = initNodeWalker(Config, self);
// walk.walkPrePost(WalkerConfig, *S, &ctx, NodePtr, root, walker.getIface(), S.visit, &self.nodeptr_buf, &self.grammar.bit_buf);
// }
};
}
pub fn initNodeWalker(comptime Config: ParseConfig, _ast: *const Tree(Config)) algo.Walker(*const Tree(Config), NodePtr) {
const S = struct {
fn _walk(ctx: *algo.WalkerContext(NodePtr), ast: *const Tree(Config), node: NodePtr) void {
// log.warn("walk {s}", .{p.g.getNodeTagName(node.tag)});
if (node.tag < ast.grammar.decl_tag_end) {
const decl = ast.grammar.decls.items[node.tag];
// log.warn("node size {}", .{decl.num_child_items});
const fields = ast.node_slices.items[node.id];
ctx.beginAddNode(decl.num_child_items);
var i = fields.start;
while (i < fields.end) : (i += 1) {
ctx.addNode(ast.node_ptrs.items[i]);
}
} else if (node.tag == ast.grammar.node_list_tag) {
const slice = ast.node_slices.items[node.id];
// log.warn("node list size {}", .{slice.len});
ctx.beginAddNode(@intCast(u32, slice.len()));
var i = slice.start;
while (i < slice.end) : (i += 1) {
ctx.addNode(ast.node_ptrs.items[i]);
}
} else if (node.tag == ast.grammar.token_value_tag) {
// Nop.
} else if (node.tag == ast.grammar.string_value_tag) {
// Nop.
} else if (node.tag == ast.grammar.char_value_tag) {
// Nop.
} else if (node.tag == ast.grammar.null_node_tag) {
// Nop.
} else stdx.panicFmt("unsupported tag {}", .{node.tag});
}
};
return algo.Walker(*const Tree(Config), NodePtr).init(_ast, S._walk);
}
pub const TokenId = u32;
const Location = struct {
start: u32,
end: u32,
};
pub const Token = struct {
tag: TokenTag,
// Separate tag for exact string matching.
literal_tag: LiteralTokenTag,
loc: Location,
pub fn init(tag: TokenTag, literal_tag: LiteralTokenTag, start: u32, end: u32) @This() {
return .{ .tag = tag, .literal_tag = literal_tag, .loc = .{
.start = start,
.end = end,
} };
}
};
pub fn TokenBuffer(comptime Config: ParseConfig) type {
if (Config.is_incremental) {
return LineTokenBuffer;
} else {
return std.ArrayList(Token);
}
}
pub const LineTokenBuffer = struct {
// Maps one to one from Document line ids to tokens list.
lines: std.ArrayList(?TokenListId),
// One buffer for all linked lists.
tokens: ds.CompactManySinglyLinkedList(TokenListId, TokenId, Token),
// Temp head to initialize a list's head before using CompactManySinglyLinkedList.insertAfter.
temp_head_id: TokenId,
num_tokens: u32,
fn deinit(self: *@This()) void {
self.lines.deinit();
self.tokens.deinit();
}
};
pub const TokenListId = u32; | parser/ast.zig |
const std = @import("std");
const str = []const u8;
const Allocator = std.mem.Allocator;
const Dir = std.fs.Dir;
const root = @import("root");
const builtin = @import("builtin");
pub const windows_spec = Os.Spec.Windows.spec;
pub const mac_spec = Os.Spec.MacOs.spec;
pub const xdg_spec = Os.Spec.Xdg.spec;
pub const Dirs = enum {
home,
documents,
pictures,
music,
videos,
desktop,
downloads,
public,
fonts,
app_menu,
cache,
roaming_config,
local_config,
global_config,
data,
runtime,
executable_dir,
pub fn open(a: Allocator, folder: Dirs, args: Dir.OpenDirOptions) OpenError!?Dir {
var path_or_null = try getPath(a, folder);
if (path_or_null) |path| {
defer a.free(path);
return try std.fs.cwd().openDir(path, args);
} else {
return null;
}
}
fn getPathXdg(user_dirs: Dirs, allocator: Allocator, arena: *std.heap.ArenaAllocator) Dirs.Error!?[]const u8 {
const folder_spec = xdg_spec.get(user_dirs);
var env_opt = std.os.getenv(folder_spec.env.name);
if (env_opt == null and folder_spec.env.user_dir) block: {
const config_dir_path = if (std.io.is_async) blk: {
var frame = arena.allocator().create(@Frame(getPathXdg)) catch break :block;
_ = @asyncCall(frame, {}, getPathXdg, .{ arena.allocator(), arena, .local_config });
break :blk (await frame) catch null orelse break :block;
} else blk: {
break :blk getPathXdg(arena.allocator(), arena, .local_config) catch null orelse break :block;
};
const config_dir = std.fs.cwd().openDir(config_dir_path, .{}) catch break :block;
const home = std.os.getenv("HOME") orelse break :block;
const user_dir = config_dir.openFile("user-dirs.dirs", .{}) catch null orelse break :block;
var read: [1024 * 8]u8 = undefined;
_ = user_dir.readAll(&read) catch null orelse break :block;
const start = folder_spec.env.name.len + "=\"$HOME".len;
var line_it = std.mem.split(u8, &read, "\n");
while (line_it.next()) |line| {
if (std.mem.startsWith(u8, line, folder_spec.env.name)) {
const end = line.len - 1;
if (start >= end) {
return error.ParseError;
}
var subdir = line[start..end];
env_opt = try std.mem.concat(arena.allocator(), u8, &[_][]const u8{ home, subdir });
break;
}
}
}
if (env_opt) |env| {
if (folder_spec.env.suffix) |suffix| {
return try std.mem.concat(allocator, u8, &[_][]const u8{ env, suffix });
} else {
return try allocator.dupe(u8, env);
}
} else {
const default = folder_spec.default orelse return null;
if (default[0] == '~') {
const home = std.os.getenv("HOME") orelse return null;
return try std.mem.concat(allocator, u8, &[_][]const u8{ home, default[1..] });
} else {
return try allocator.dupe(u8, default);
}
}
}
/// Returns the path to the folder or, if the folder does not exist, `null`.
pub fn getPath(user_dir: Dirs, allocator: Allocator) Error!?[]const u8 {
if (user_dir == .executable_dir) {
return std.fs.selfExeDirPathAlloc(allocator) catch |err| switch (err) {
error.OutOfMemory => return error.OutOfMemory,
else => null,
};
}
var arena = std.heap.ArenaAllocator.init(allocator);
defer arena.deinit();
switch (builtin.os.tag) {
.windows => {
const folder_spec = windows_spec.get(user_dir);
switch (folder_spec) {
.by_guid => |guid| {
var dir_path_ptr: [*:0]u16 = undefined;
switch (std.os.windows.shell32.SHGetDirsPath(
&guid,
std.os.windows.KF_FLAG_CREATE, // TODO: Chose sane option here?
null,
&dir_path_ptr,
)) {
std.os.windows.S_OK => {
defer std.os.windows.ole32.CoTaskMemFree(@ptrCast(*anyopaque, dir_path_ptr));
const global_dir = std.unicode.utf16leToUtf8Alloc(allocator, std.mem.span(dir_path_ptr)) catch |err| switch (err) {
error.UnexpectedSecondSurrogateHalf => return null,
error.ExpectedSecondSurrogateHalf => return null,
error.DanglingSurrogateHalf => return null,
error.OutOfMemory => return error.OutOfMemory,
};
return global_dir;
},
std.os.windows.E_OUTOFMEMORY => return error.OutOfMemory,
else => return null,
}
},
.by_env => |env_path| {
if (env_path.subdir) |sub_dir| {
const root_path = std.process.getEnvVarOwned(arena.allocator(), env_path.env_var) catch |err| switch (err) {
error.EnvironmentVariableNotFound => return null,
error.InvalidUtf8 => return null,
error.OutOfMemory => |e| return e,
};
return try std.fs.path.join(allocator, &[_][]const u8{ root_path, sub_dir });
} else {
return std.process.getEnvVarOwned(allocator, env_path.env_var) catch |err| switch (err) {
error.EnvironmentVariableNotFound => return null,
error.InvalidUtf8 => return null,
error.OutOfMemory => |e| return e,
};
}
},
}
},
.macos => {
if (@hasDecl(root, "known_folders_config") and root.known_folders_config.xdg_on_mac) {
return getPathXdg(allocator, &arena, user_dir);
}
if (mac_spec.get(user_dir)) |sp| switch (sp) {
.absolute => |abs| {
return try allocator.dupe(u8, abs);
},
.suffix => |s| {
const home_dir = if (std.os.getenv("HOME")) |home|
home
else
return null;
if (s) |suffix| {
return try std.fs.path.join(allocator, &[_][]const u8{ home_dir, suffix });
} else {
return try allocator.dupe(u8, home_dir);
}
},
};
},
// Assume unix derivatives with XDG
else => return getPathXdg(allocator, &arena, user_dir),
}
unreachable;
}
pub fn spec(dirs: Dirs, os: Dirs.Os) Os.Spec {
inline for (std.meta.fields(Dirs)) |fld| {
if (dirs == @field(Dirs, fld.name))
return @field(os, fld.name);
}
}
pub fn specOfOs(dirs: Dirs) Os.Spec {
return switch (builtin.os.tag) {
.windows => @field(Os.Spec.Windows.spec, @tagName(dirs)),
.linux => @field(Os.Spec.Xdg.spec, @tagName(dirs)),
.macos => @field(Os.Spec.MacOs.spec, @tagName(dirs)),
};
}
pub const Error = error{OutOfMemory};
const OpenError = (Dir.OpenError || Dirs.Error);
};
pub const Os = enum(u2) {
linux,
windows,
macos,
pub const Spec = union(Os) {
linux: Xdg,
windows: Windows,
macos: MacOs,
const Self = @This();
pub const Xdg = struct {
default: ?str = null,
env: struct {
name: []const u8,
user_dir: bool = false,
suffix: ?[]const u8 = null,
},
pub const spec = Os.SpecAlt(Xdg){
.home = Xdg.init("HOME", false, null),
.documents = init("XDG_DOCUMENTS_DIR", true, "~/Documents"),
.pictures = init("XDG_PICTURES_DIR", true, "~/Pictures"),
.music = init("XDG_MUSIC_DIR", true, "~/Music"),
.videos = init("XDG_VIDEOS_DIR", true, "~/Videos"),
.desktop = init("XDG_DESKTOP_DIR", true, "~/Desktop"),
.downloads = init("XDG_DOWNLOAD_DIR", true, "~/Downloads"),
.public = init("XDG_PUBLICSHARE_DIR", true, "~/Public"),
.fonts = init("XDG_DATA_HOME", false, "/fonts", "~/.local/share/fonts"),
.app_menu = init("XDG_DATA_HOME", false, "/applications", "~/.local/share/applications"),
.cache = init("XDG_CACHE_HOME", false, "~/.cache", null),
.roaming_config = init("XDG_CONFIG_HOME", false, "~/.config"),
.local_config = init("XDG_CONFIG_HOME", false, "~/.config"),
.global_config = init("XDG_CONFIG_DIRS", false, "/etc"),
.data = init("XDG_DATA_HOME", false, "~/.local/share"),
.runtime = init("XDG_RUNTIME_DIR", false, null),
};
pub fn init(name: str, user_dir: bool, suffix: ?str, default: ?str) Xdg {
const env = .{ .name = name, .user_dir = user_dir, .suffix = suffix };
return Xdg{ .env = env, .default = default };
}
};
pub const MacOs = union(enum) {
suffix: ?[]const u8,
absolute: []const u8,
pub const spec = Os.SpecAlt(MacOs){
.home = MacOs{.suffix = null},
.documents = MacOs{.suffix="Documents"},
.pictures = MacOs{.suffix="Pictures"},
.music = MacOs{.suffix="Music"},
.videos = MacOs{.suffix="Movies"},
.desktop = MacOs{.suffix="Desktop"},
.downloads = MacOs{.suffix="Downloads"},
.public = MacOs{.suffix="Public"},
.fonts = MacOs{.suffix="Library/Fonts"},
.app_menu = MacOs{.suffix="Applications"},
.cache = MacOs{.absolute="Library/Caches"},
.roaming_config = MacOs{.absolute="Library/Preferences"},
.local_config = MacOs{.absolute="Library/Application Support"},
.global_config = MacOs{ .absolute = "/Library/Preferences" },
.data = MacOs{.absolute="Library/Application Support"},
.runtime = MacOs{.absolute="Library/Application Support"},
};
};
pub const Windows = union(enum) {
by_env: struct {
env_var: []const u8,
subdir: ?[]const u8 = null,
},
by_guid: std.os.windows.GUID,
pub fn byGuid(guid: str) Windows {
const guid_parsed = std.os.windows.GUID.parse(guid);
return Windows{ .by_guid = guid_parsed };
}
pub fn byEnv(evar: str, subdir: ?str) Windows {
const env = .{ .env_var = evar, .subdir = subdir };
return Windows{ .by_env = env };
}
pub const spec = blk: {
@setEvalBranchQuota(10_000); // workaround for zig eval branch quota when parsing the GUIDs
break :blk Os.SpecAlt(Windows){
.home = byGuid("{5E6C858F-0E22-4760-9AFE-EA3317B67173}"),
.documents = byGuid("{FDD39AD0-238F-46AF-ADB4-6C85480369C7}"),
.pictures = byGuid("{33E28130-4E1E-4676-835A-98395C3BC3BB}"),
.music = byGuid("{4BD8D571-6D19-48D3-BE97-422220080E43}"),
.videos = byGuid("{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"),
.desktop = byGuid("{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"),
.downloads = byGuid("{374DE290-123F-4565-9164-39C4925E467B}"),
.public = byGuid("{DFDF76A2-C82A-4D63-906A-5644AC457385}"),
.fonts = byGuid("{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}"),
.app_menu = byGuid("{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}"),
.cache = byEnv("LOCALAPPDATA", "Temp"),
.roaming_config = byGuid("{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}"), // FOLDERID_RoamingAppData
.local_config = byGuid("{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}"), // FOLDERID_LocalAppData
.global_config = byGuid("{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}"), // FOLDERID_ProgramData
.data = byEnv("APPDATA", null),
.runtime = byEnv("LOCALAPPDATA", "Temp"),
};
};
};
};
// NOTE: This doesn't seem like the best way to do this,
// but my spec function up there hasn't been tested yet so
// i'll leave this implementation in for now.
fn SpecAlt(comptime T: type) type {
return struct {
const Self = @This();
home: T,
documents: T,
pictures: T,
music: T,
videos: T,
desktop: T,
downloads: T,
public: T,
fonts: T,
app_menu: T,
cache: T,
roaming_config: T,
local_config: T,
global_config: T,
data: T,
runtime: T,
fn get(self: Self, folder: Dirs) ?T {
inline for (std.meta.fields(Self)) |fld| {
if (folder == @field(Dirs, fld.name))
return @field(self, fld.name);
}
return null;
}
};
}
};
// Ref decls
// comptime {
// _ = Dirs;
// _ = Dirs.Error;
// _ = Dirs.open;
// _ = Dirs.getPath;
// }
test "it runs" {
const gpa = std.testing.allocator;
const home = if (try Dirs.getPath(.home, gpa)) |dir| dir else "~/";
const conf = if (try Dirs.getPath(.global_config, gpa)) |d2| d2 else "~/.config/";
const local_conf = if (try Dirs.getPath(.local_config, gpa)) |d3| d3 else "~/.config/";
std.debug.print("HOME DIR: {s}\n" , .{home});
std.debug.print("GLOBAL CONF DIR: {s}\n" , .{conf});
std.debug.print("LOCAL CONF DIR: {s}\n" , .{local_conf});
} | lib/src/dirs.zig |
const std = @import("std");
const print = std.debug.print;
pub const Value = union(enum) {
boolean: bool,
number: f64,
nil,
obj: *Obj,
};
pub const ObjType = enum {
OBJ_STRING,
};
pub const Obj = struct {
objType: ObjType,
next: ?*Obj,
};
pub const ObjString = struct {
obj: Obj,
chars: []u8,
};
pub fn printValue(value: Value) void {
switch (value) {
.boolean => |boolean| print("{}", .{boolean}),
.number => |number| print("{d:.5}", .{number}),
.nil => print("nil", .{}),
.obj => |obj| printObject(obj),
}
}
pub fn printObject(obj: *Obj) void {
switch (obj.objType) {
.OBJ_STRING => print("{}", .{OBJ_AS_STRING(obj).chars}),
}
}
pub fn BOOL_VAL(value: bool) Value {
return Value{ .boolean = value };
}
pub fn NIL_VAL() Value {
return Value.nil;
}
pub fn NUMBER_VAL(value: f64) Value {
return Value{ .number = value };
}
pub fn OBJ_VAL(obj: *Obj) Value {
return Value{ .obj = obj };
}
pub fn OBJ_STRING_VAL(objString: *ObjString) Value {
return OBJ_VAL(@ptrCast(*Obj, objString));
}
pub fn AS_BOOL(value: Value) bool {
return switch (value) {
.boolean => |boolean| boolean,
else => unreachable,
};
}
pub fn AS_NUMBER(value: Value) f64 {
return switch (value) {
.number => |number| number,
else => unreachable,
};
}
pub fn AS_OBJ(value: Value) *Obj {
return switch (value) {
.obj => |obj| obj,
else => unreachable,
};
}
pub fn AS_STRING(value: Value) *ObjString {
return @ptrCast(*ObjString, AS_OBJ(value));
}
pub fn OBJ_AS_STRING(obj: *Obj) *ObjString {
return @ptrCast(*ObjString, obj);
}
pub fn IS_BOOL(value: Value) bool {
return switch (value) {
.boolean => true,
else => false,
};
}
pub fn IS_NIL(value: Value) bool {
return switch (value) {
.nil => true,
else => false,
};
}
pub fn IS_NUMBER(value: Value) bool {
return switch (value) {
.number => true,
else => false,
};
}
pub fn IS_OBJ(value: Value) bool {
return switch (value) {
.obj => true,
else => false,
};
}
pub fn OBJ_TYPE(value: Value) ObjType {
return AS_OBJ(value).objType;
}
pub fn IS_STRING(value: Value) bool {
return isObjType(value, .OBJ_STRING);
}
fn isObjType(value: Value, objType: ObjType) bool {
return IS_OBJ(value) and AS_OBJ(value).objType == objType;
}
pub fn valuesEqual(a: Value, b: Value) bool {
switch (a) {
.boolean => |boolean| {
if (IS_BOOL(b)) {
return AS_BOOL(b) == boolean;
} else {
return false;
}
},
.number => |number| {
if (IS_NUMBER(b)) {
return AS_NUMBER(b) == number;
} else {
return false;
}
},
.nil => {
return if (IS_NIL(b)) true else false;
},
.obj => |obj| {
return if (IS_OBJ(b)) obj == AS_OBJ(b) else false;
},
}
} | vm/src/value.zig |
const std = @import("std");
const string = []const u8;
const input = @embedFile("../input/day07.txt");
pub fn main() !void {
//
var iter = std.mem.split(u8, std.mem.trim(u8, input, "\n"), ",");
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const alloc = &arena.allocator;
var list = std.ArrayList(u32).init(alloc);
defer list.deinit();
while (iter.next()) |num_s| {
const num = std.fmt.parseUnsigned(u32, num_s, 10) catch @panic("");
try list.append(num);
}
const items = list.toOwnedSlice();
const min = minL(items);
const max = maxL(items);
{
var cheapest: u32 = std.math.maxInt(u32);
var i = min;
while (i <= max) : (i += 1) {
cheapest = std.math.min(cheapest, fuelCost1(items, i));
}
std.debug.print("{d}\n", .{cheapest});
}
{
var cheapest: u32 = std.math.maxInt(u32);
var i = min;
while (i <= max) : (i += 1) {
cheapest = std.math.min(cheapest, fuelCost2(items, i));
}
std.debug.print("{d}\n", .{cheapest});
}
}
fn minL(slice: []const u32) u32 {
return minI(slice[0], slice[1..]);
}
fn minI(runner: u32, slice: []const u32) u32 {
if (slice.len == 0) return runner;
return minI(std.math.min(runner, slice[0]), slice[1..]);
}
fn maxL(slice: []const u32) u32 {
return maxI(slice[0], slice[1..]);
}
fn maxI(runner: u32, slice: []const u32) u32 {
if (slice.len == 0) return runner;
return maxI(std.math.max(runner, slice[0]), slice[1..]);
}
fn fuelCost1(slice: []const u32, to: u32) u32 {
var ret: u32 = 0;
for (slice) |item| {
ret += @intCast(u32, std.math.absInt(@intCast(i32, item) - @intCast(i32, to)) catch @panic(""));
}
return ret;
}
fn fuelCost2(slice: []const u32, to: u32) u32 {
var ret: u32 = 0;
for (slice) |item| {
const dist = @intCast(u32, std.math.absInt(@intCast(i32, item) - @intCast(i32, to)) catch @panic(""));
ret += (dist * (dist + 1)) / 2;
}
return ret;
} | src/day07.zig |
const std = @import("../index.zig");
const os = std.os;
const assert = std.debug.assert;
const io = std.io;
const a = std.debug.global_allocator;
const builtin = @import("builtin");
const AtomicRmwOp = builtin.AtomicRmwOp;
const AtomicOrder = builtin.AtomicOrder;
test "makePath, put some files in it, deleteTree" {
if (builtin.os == builtin.Os.windows) {
// TODO implement os.Dir for windows
// https://github.com/zig-lang/zig/issues/709
return;
}
try os.makePath(a, "os_test_tmp/b/c");
try io.writeFile(a, "os_test_tmp/b/c/file.txt", "nonsense");
try io.writeFile(a, "os_test_tmp/b/file2.txt", "blah");
try os.deleteTree(a, "os_test_tmp");
if (os.Dir.open(a, "os_test_tmp")) |dir| {
@panic("expected error");
} else |err| {
assert(err == error.PathNotFound);
}
}
test "access file" {
if (builtin.os == builtin.Os.windows) {
return;
}
try os.makePath(a, "os_test_tmp");
if (os.File.access(a, "os_test_tmp/file.txt", os.default_file_mode)) |ok| {
unreachable;
} else |err| {
assert(err == error.NotFound);
}
try io.writeFile(a, "os_test_tmp/file.txt", "");
assert((try os.File.access(a, "os_test_tmp/file.txt", os.default_file_mode)) == true);
try os.deleteTree(a, "os_test_tmp");
}
test "spawn threads" {
if (builtin.os != builtin.Os.linux) {
// TODO implement threads on macos and windows
return;
}
var direct_allocator = std.heap.DirectAllocator.init();
defer direct_allocator.deinit();
var shared_ctx: i32 = 1;
const thread1 = try std.os.spawnThreadAllocator(&direct_allocator.allocator, {}, start1);
const thread4 = try std.os.spawnThreadAllocator(&direct_allocator.allocator, &shared_ctx, start2);
var stack1: [1024]u8 = undefined;
var stack2: [1024]u8 = undefined;
const thread2 = try std.os.spawnThread(stack1[0..], &shared_ctx, start2);
const thread3 = try std.os.spawnThread(stack2[0..], &shared_ctx, start2);
thread1.wait();
thread2.wait();
thread3.wait();
thread4.wait();
assert(shared_ctx == 4);
}
fn start1(ctx: void) u8 {
return 0;
}
fn start2(ctx: &i32) u8 {
_ = @atomicRmw(i32, ctx, AtomicRmwOp.Add, 1, AtomicOrder.SeqCst);
return 0;
} | std/os/test.zig |
pub const UPNP_E_ROOT_ELEMENT_EXPECTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220992));
pub const UPNP_E_DEVICE_ELEMENT_EXPECTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220991));
pub const UPNP_E_SERVICE_ELEMENT_EXPECTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220990));
pub const UPNP_E_SERVICE_NODE_INCOMPLETE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220989));
pub const UPNP_E_DEVICE_NODE_INCOMPLETE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220988));
pub const UPNP_E_ICON_ELEMENT_EXPECTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220987));
pub const UPNP_E_ICON_NODE_INCOMPLETE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220986));
pub const UPNP_E_INVALID_ACTION = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220985));
pub const UPNP_E_INVALID_ARGUMENTS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220984));
pub const UPNP_E_OUT_OF_SYNC = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220983));
pub const UPNP_E_ACTION_REQUEST_FAILED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220976));
pub const UPNP_E_TRANSPORT_ERROR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220975));
pub const UPNP_E_VARIABLE_VALUE_UNKNOWN = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220974));
pub const UPNP_E_INVALID_VARIABLE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220973));
pub const UPNP_E_DEVICE_ERROR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220972));
pub const UPNP_E_PROTOCOL_ERROR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220971));
pub const UPNP_E_ERROR_PROCESSING_RESPONSE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220970));
pub const UPNP_E_DEVICE_TIMEOUT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220969));
pub const UPNP_E_INVALID_DOCUMENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220224));
pub const UPNP_E_EVENT_SUBSCRIPTION_FAILED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220223));
pub const FAULT_INVALID_ACTION = @as(u32, 401);
pub const FAULT_INVALID_ARG = @as(u32, 402);
pub const FAULT_INVALID_SEQUENCE_NUMBER = @as(u32, 403);
pub const FAULT_INVALID_VARIABLE = @as(u32, 404);
pub const FAULT_DEVICE_INTERNAL_ERROR = @as(u32, 501);
pub const FAULT_ACTION_SPECIFIC_BASE = @as(u32, 600);
pub const FAULT_ACTION_SPECIFIC_MAX = @as(u32, 899);
pub const UPNP_E_ACTION_SPECIFIC_BASE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220736));
pub const UPNP_ADDRESSFAMILY_IPv4 = @as(u32, 1);
pub const UPNP_ADDRESSFAMILY_IPv6 = @as(u32, 2);
pub const UPNP_ADDRESSFAMILY_BOTH = @as(u32, 3);
pub const UPNP_SERVICE_DELAY_SCPD_AND_SUBSCRIPTION = @as(u32, 1);
pub const UPNP_E_REQUIRED_ELEMENT_ERROR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180512));
pub const UPNP_E_DUPLICATE_NOT_ALLOWED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180511));
pub const UPNP_E_DUPLICATE_SERVICE_ID = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180510));
pub const UPNP_E_INVALID_DESCRIPTION = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180509));
pub const UPNP_E_INVALID_SERVICE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180508));
pub const UPNP_E_INVALID_ICON = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180507));
pub const UPNP_E_INVALID_XML = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180506));
pub const UPNP_E_INVALID_ROOT_NAMESPACE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180505));
pub const UPNP_E_SUFFIX_TOO_LONG = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180504));
pub const UPNP_E_URLBASE_PRESENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180503));
pub const UPNP_E_VALUE_TOO_LONG = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180496));
pub const UPNP_E_DEVICE_RUNNING = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180495));
pub const UPNP_E_DEVICE_NOTREGISTERED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147180494));
//--------------------------------------------------------------------------------
// Section: Types (41)
//--------------------------------------------------------------------------------
pub const HSWDEVICE = *opaque{};
pub const SW_DEVICE_CAPABILITIES = enum(i32) {
None = 0,
Removable = 1,
SilentInstall = 2,
NoDisplayInUI = 4,
DriverRequired = 8,
};
pub const SWDeviceCapabilitiesNone = SW_DEVICE_CAPABILITIES.None;
pub const SWDeviceCapabilitiesRemovable = SW_DEVICE_CAPABILITIES.Removable;
pub const SWDeviceCapabilitiesSilentInstall = SW_DEVICE_CAPABILITIES.SilentInstall;
pub const SWDeviceCapabilitiesNoDisplayInUI = SW_DEVICE_CAPABILITIES.NoDisplayInUI;
pub const SWDeviceCapabilitiesDriverRequired = SW_DEVICE_CAPABILITIES.DriverRequired;
pub const SW_DEVICE_CREATE_INFO = extern struct {
cbSize: u32,
pszInstanceId: ?[*:0]const u16,
pszzHardwareIds: ?[*]const u16,
pszzCompatibleIds: ?[*]const u16,
pContainerId: ?*const Guid,
CapabilityFlags: u32,
pszDeviceDescription: ?[*:0]const u16,
pszDeviceLocation: ?[*:0]const u16,
pSecurityDescriptor: ?*const SECURITY_DESCRIPTOR,
};
pub const SW_DEVICE_LIFETIME = enum(i32) {
Handle = 0,
ParentPresent = 1,
Max = 2,
};
pub const SWDeviceLifetimeHandle = SW_DEVICE_LIFETIME.Handle;
pub const SWDeviceLifetimeParentPresent = SW_DEVICE_LIFETIME.ParentPresent;
pub const SWDeviceLifetimeMax = SW_DEVICE_LIFETIME.Max;
pub const SW_DEVICE_CREATE_CALLBACK = fn(
hSwDevice: ?HSWDEVICE,
CreateResult: HRESULT,
pContext: ?*anyopaque,
pszDeviceInstanceId: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) void;
const CLSID_UPnPDeviceFinder_Value = Guid.initString("e2085f28-feb7-404a-b8e7-e659bdeaaa02");
pub const CLSID_UPnPDeviceFinder = &CLSID_UPnPDeviceFinder_Value;
const CLSID_UPnPDevices_Value = Guid.initString("b9e84ffd-ad3c-40a4-b835-0882ebcbaaa8");
pub const CLSID_UPnPDevices = &CLSID_UPnPDevices_Value;
const CLSID_UPnPDevice_Value = Guid.initString("a32552c5-ba61-457a-b59a-a2561e125e33");
pub const CLSID_UPnPDevice = &CLSID_UPnPDevice_Value;
const CLSID_UPnPServices_Value = Guid.initString("c0bc4b4a-a406-4efc-932f-b8546b8100cc");
pub const CLSID_UPnPServices = &CLSID_UPnPServices_Value;
const CLSID_UPnPService_Value = Guid.initString("c624ba95-fbcb-4409-8c03-8cceec533ef1");
pub const CLSID_UPnPService = &CLSID_UPnPService_Value;
const CLSID_UPnPDescriptionDocument_Value = Guid.initString("1d8a9b47-3a28-4ce2-8a4b-bd34e45bceeb");
pub const CLSID_UPnPDescriptionDocument = &CLSID_UPnPDescriptionDocument_Value;
const CLSID_UPnPDeviceFinderEx_Value = Guid.initString("181b54fc-380b-4a75-b3f1-4ac45e9605b0");
pub const CLSID_UPnPDeviceFinderEx = &CLSID_UPnPDeviceFinderEx_Value;
const CLSID_UPnPDescriptionDocumentEx_Value = Guid.initString("33fd0563-d81a-4393-83cc-0195b1da2f91");
pub const CLSID_UPnPDescriptionDocumentEx = &CLSID_UPnPDescriptionDocumentEx_Value;
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPDeviceFinder_Value = Guid.initString("adda3d55-6f72-4319-bff9-18600a539b10");
pub const IID_IUPnPDeviceFinder = &IID_IUPnPDeviceFinder_Value;
pub const IUPnPDeviceFinder = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
FindByType: fn(
self: *const IUPnPDeviceFinder,
bstrTypeURI: ?BSTR,
dwFlags: u32,
pDevices: ?*?*IUPnPDevices,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateAsyncFind: fn(
self: *const IUPnPDeviceFinder,
bstrTypeURI: ?BSTR,
dwFlags: u32,
punkDeviceFinderCallback: ?*IUnknown,
plFindData: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StartAsyncFind: fn(
self: *const IUPnPDeviceFinder,
lFindData: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CancelAsyncFind: fn(
self: *const IUPnPDeviceFinder,
lFindData: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
FindByUDN: fn(
self: *const IUPnPDeviceFinder,
bstrUDN: ?BSTR,
pDevice: ?*?*IUPnPDevice,
) 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 IUPnPDeviceFinder_FindByType(self: *const T, bstrTypeURI: ?BSTR, dwFlags: u32, pDevices: ?*?*IUPnPDevices) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceFinder.VTable, self.vtable).FindByType(@ptrCast(*const IUPnPDeviceFinder, self), bstrTypeURI, dwFlags, pDevices);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceFinder_CreateAsyncFind(self: *const T, bstrTypeURI: ?BSTR, dwFlags: u32, punkDeviceFinderCallback: ?*IUnknown, plFindData: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceFinder.VTable, self.vtable).CreateAsyncFind(@ptrCast(*const IUPnPDeviceFinder, self), bstrTypeURI, dwFlags, punkDeviceFinderCallback, plFindData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceFinder_StartAsyncFind(self: *const T, lFindData: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceFinder.VTable, self.vtable).StartAsyncFind(@ptrCast(*const IUPnPDeviceFinder, self), lFindData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceFinder_CancelAsyncFind(self: *const T, lFindData: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceFinder.VTable, self.vtable).CancelAsyncFind(@ptrCast(*const IUPnPDeviceFinder, self), lFindData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceFinder_FindByUDN(self: *const T, bstrUDN: ?BSTR, pDevice: ?*?*IUPnPDevice) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceFinder.VTable, self.vtable).FindByUDN(@ptrCast(*const IUPnPDeviceFinder, self), bstrUDN, pDevice);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.0.6000'
const IID_IUPnPAddressFamilyControl_Value = Guid.initString("e3bf6178-694e-459f-a5a6-191ea0ffa1c7");
pub const IID_IUPnPAddressFamilyControl = &IID_IUPnPAddressFamilyControl_Value;
pub const IUPnPAddressFamilyControl = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAddressFamily: fn(
self: *const IUPnPAddressFamilyControl,
dwFlags: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAddressFamily: fn(
self: *const IUPnPAddressFamilyControl,
pdwFlags: ?*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 IUPnPAddressFamilyControl_SetAddressFamily(self: *const T, dwFlags: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPAddressFamilyControl.VTable, self.vtable).SetAddressFamily(@ptrCast(*const IUPnPAddressFamilyControl, self), dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPAddressFamilyControl_GetAddressFamily(self: *const T, pdwFlags: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPAddressFamilyControl.VTable, self.vtable).GetAddressFamily(@ptrCast(*const IUPnPAddressFamilyControl, self), pdwFlags);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_IUPnPHttpHeaderControl_Value = Guid.initString("0405af4f-8b5c-447c-80f2-b75984a31f3c");
pub const IID_IUPnPHttpHeaderControl = &IID_IUPnPHttpHeaderControl_Value;
pub const IUPnPHttpHeaderControl = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddRequestHeaders: fn(
self: *const IUPnPHttpHeaderControl,
bstrHttpHeaders: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPHttpHeaderControl_AddRequestHeaders(self: *const T, bstrHttpHeaders: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPHttpHeaderControl.VTable, self.vtable).AddRequestHeaders(@ptrCast(*const IUPnPHttpHeaderControl, self), bstrHttpHeaders);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPDeviceFinderCallback_Value = Guid.initString("415a984a-88b3-49f3-92af-0508bedf0d6c");
pub const IID_IUPnPDeviceFinderCallback = &IID_IUPnPDeviceFinderCallback_Value;
pub const IUPnPDeviceFinderCallback = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
DeviceAdded: fn(
self: *const IUPnPDeviceFinderCallback,
lFindData: i32,
pDevice: ?*IUPnPDevice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeviceRemoved: fn(
self: *const IUPnPDeviceFinderCallback,
lFindData: i32,
bstrUDN: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SearchComplete: fn(
self: *const IUPnPDeviceFinderCallback,
lFindData: 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 IUPnPDeviceFinderCallback_DeviceAdded(self: *const T, lFindData: i32, pDevice: ?*IUPnPDevice) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceFinderCallback.VTable, self.vtable).DeviceAdded(@ptrCast(*const IUPnPDeviceFinderCallback, self), lFindData, pDevice);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceFinderCallback_DeviceRemoved(self: *const T, lFindData: i32, bstrUDN: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceFinderCallback.VTable, self.vtable).DeviceRemoved(@ptrCast(*const IUPnPDeviceFinderCallback, self), lFindData, bstrUDN);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceFinderCallback_SearchComplete(self: *const T, lFindData: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceFinderCallback.VTable, self.vtable).SearchComplete(@ptrCast(*const IUPnPDeviceFinderCallback, self), lFindData);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPServices_Value = Guid.initString("3f8c8e9e-9a7a-4dc8-bc41-ff31fa374956");
pub const IID_IUPnPServices = &IID_IUPnPServices_Value;
pub const IUPnPServices = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const IUPnPServices,
plCount: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const IUPnPServices,
ppunk: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Item: fn(
self: *const IUPnPServices,
bstrServiceId: ?BSTR,
ppService: ?*?*IUPnPService,
) 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 IUPnPServices_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServices.VTable, self.vtable).get_Count(@ptrCast(*const IUPnPServices, self), plCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServices_get__NewEnum(self: *const T, ppunk: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServices.VTable, self.vtable).get__NewEnum(@ptrCast(*const IUPnPServices, self), ppunk);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServices_get_Item(self: *const T, bstrServiceId: ?BSTR, ppService: ?*?*IUPnPService) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServices.VTable, self.vtable).get_Item(@ptrCast(*const IUPnPServices, self), bstrServiceId, ppService);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPService_Value = Guid.initString("a295019c-dc65-47dd-90dc-7fe918a1ab44");
pub const IID_IUPnPService = &IID_IUPnPService_Value;
pub const IUPnPService = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
QueryStateVariable: fn(
self: *const IUPnPService,
bstrVariableName: ?BSTR,
pValue: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
InvokeAction: fn(
self: *const IUPnPService,
bstrActionName: ?BSTR,
vInActionArgs: VARIANT,
pvOutActionArgs: ?*VARIANT,
pvRetVal: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ServiceTypeIdentifier: fn(
self: *const IUPnPService,
pVal: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddCallback: fn(
self: *const IUPnPService,
pUnkCallback: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const IUPnPService,
pbstrId: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LastTransportStatus: fn(
self: *const IUPnPService,
plValue: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPService_QueryStateVariable(self: *const T, bstrVariableName: ?BSTR, pValue: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPService.VTable, self.vtable).QueryStateVariable(@ptrCast(*const IUPnPService, self), bstrVariableName, pValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPService_InvokeAction(self: *const T, bstrActionName: ?BSTR, vInActionArgs: VARIANT, pvOutActionArgs: ?*VARIANT, pvRetVal: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPService.VTable, self.vtable).InvokeAction(@ptrCast(*const IUPnPService, self), bstrActionName, vInActionArgs, pvOutActionArgs, pvRetVal);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPService_get_ServiceTypeIdentifier(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPService.VTable, self.vtable).get_ServiceTypeIdentifier(@ptrCast(*const IUPnPService, self), pVal);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPService_AddCallback(self: *const T, pUnkCallback: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPService.VTable, self.vtable).AddCallback(@ptrCast(*const IUPnPService, self), pUnkCallback);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPService_get_Id(self: *const T, pbstrId: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPService.VTable, self.vtable).get_Id(@ptrCast(*const IUPnPService, self), pbstrId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPService_get_LastTransportStatus(self: *const T, plValue: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPService.VTable, self.vtable).get_LastTransportStatus(@ptrCast(*const IUPnPService, self), plValue);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IUPnPAsyncResult_Value = Guid.initString("4d65fd08-d13e-4274-9c8b-dd8d028c8644");
pub const IID_IUPnPAsyncResult = &IID_IUPnPAsyncResult_Value;
pub const IUPnPAsyncResult = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AsyncOperationComplete: fn(
self: *const IUPnPAsyncResult,
ullRequestID: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPAsyncResult_AsyncOperationComplete(self: *const T, ullRequestID: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPAsyncResult.VTable, self.vtable).AsyncOperationComplete(@ptrCast(*const IUPnPAsyncResult, self), ullRequestID);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IUPnPServiceAsync_Value = Guid.initString("098bdaf5-5ec1-49e7-a260-b3a11dd8680c");
pub const IID_IUPnPServiceAsync = &IID_IUPnPServiceAsync_Value;
pub const IUPnPServiceAsync = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
BeginInvokeAction: fn(
self: *const IUPnPServiceAsync,
bstrActionName: ?BSTR,
vInActionArgs: VARIANT,
pAsyncResult: ?*IUPnPAsyncResult,
pullRequestID: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EndInvokeAction: fn(
self: *const IUPnPServiceAsync,
ullRequestID: u64,
pvOutActionArgs: ?*VARIANT,
pvRetVal: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BeginQueryStateVariable: fn(
self: *const IUPnPServiceAsync,
bstrVariableName: ?BSTR,
pAsyncResult: ?*IUPnPAsyncResult,
pullRequestID: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EndQueryStateVariable: fn(
self: *const IUPnPServiceAsync,
ullRequestID: u64,
pValue: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BeginSubscribeToEvents: fn(
self: *const IUPnPServiceAsync,
pUnkCallback: ?*IUnknown,
pAsyncResult: ?*IUPnPAsyncResult,
pullRequestID: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EndSubscribeToEvents: fn(
self: *const IUPnPServiceAsync,
ullRequestID: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BeginSCPDDownload: fn(
self: *const IUPnPServiceAsync,
pAsyncResult: ?*IUPnPAsyncResult,
pullRequestID: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EndSCPDDownload: fn(
self: *const IUPnPServiceAsync,
ullRequestID: u64,
pbstrSCPDDoc: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CancelAsyncOperation: fn(
self: *const IUPnPServiceAsync,
ullRequestID: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceAsync_BeginInvokeAction(self: *const T, bstrActionName: ?BSTR, vInActionArgs: VARIANT, pAsyncResult: ?*IUPnPAsyncResult, pullRequestID: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceAsync.VTable, self.vtable).BeginInvokeAction(@ptrCast(*const IUPnPServiceAsync, self), bstrActionName, vInActionArgs, pAsyncResult, pullRequestID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceAsync_EndInvokeAction(self: *const T, ullRequestID: u64, pvOutActionArgs: ?*VARIANT, pvRetVal: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceAsync.VTable, self.vtable).EndInvokeAction(@ptrCast(*const IUPnPServiceAsync, self), ullRequestID, pvOutActionArgs, pvRetVal);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceAsync_BeginQueryStateVariable(self: *const T, bstrVariableName: ?BSTR, pAsyncResult: ?*IUPnPAsyncResult, pullRequestID: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceAsync.VTable, self.vtable).BeginQueryStateVariable(@ptrCast(*const IUPnPServiceAsync, self), bstrVariableName, pAsyncResult, pullRequestID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceAsync_EndQueryStateVariable(self: *const T, ullRequestID: u64, pValue: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceAsync.VTable, self.vtable).EndQueryStateVariable(@ptrCast(*const IUPnPServiceAsync, self), ullRequestID, pValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceAsync_BeginSubscribeToEvents(self: *const T, pUnkCallback: ?*IUnknown, pAsyncResult: ?*IUPnPAsyncResult, pullRequestID: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceAsync.VTable, self.vtable).BeginSubscribeToEvents(@ptrCast(*const IUPnPServiceAsync, self), pUnkCallback, pAsyncResult, pullRequestID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceAsync_EndSubscribeToEvents(self: *const T, ullRequestID: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceAsync.VTable, self.vtable).EndSubscribeToEvents(@ptrCast(*const IUPnPServiceAsync, self), ullRequestID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceAsync_BeginSCPDDownload(self: *const T, pAsyncResult: ?*IUPnPAsyncResult, pullRequestID: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceAsync.VTable, self.vtable).BeginSCPDDownload(@ptrCast(*const IUPnPServiceAsync, self), pAsyncResult, pullRequestID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceAsync_EndSCPDDownload(self: *const T, ullRequestID: u64, pbstrSCPDDoc: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceAsync.VTable, self.vtable).EndSCPDDownload(@ptrCast(*const IUPnPServiceAsync, self), ullRequestID, pbstrSCPDDoc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceAsync_CancelAsyncOperation(self: *const T, ullRequestID: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceAsync.VTable, self.vtable).CancelAsyncOperation(@ptrCast(*const IUPnPServiceAsync, self), ullRequestID);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPServiceCallback_Value = Guid.initString("31fadca9-ab73-464b-b67d-5c1d0f83c8b8");
pub const IID_IUPnPServiceCallback = &IID_IUPnPServiceCallback_Value;
pub const IUPnPServiceCallback = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
StateVariableChanged: fn(
self: *const IUPnPServiceCallback,
pus: ?*IUPnPService,
pcwszStateVarName: ?[*:0]const u16,
vaValue: VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ServiceInstanceDied: fn(
self: *const IUPnPServiceCallback,
pus: ?*IUPnPService,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceCallback_StateVariableChanged(self: *const T, pus: ?*IUPnPService, pcwszStateVarName: ?[*:0]const u16, vaValue: VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceCallback.VTable, self.vtable).StateVariableChanged(@ptrCast(*const IUPnPServiceCallback, self), pus, pcwszStateVarName, vaValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceCallback_ServiceInstanceDied(self: *const T, pus: ?*IUPnPService) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceCallback.VTable, self.vtable).ServiceInstanceDied(@ptrCast(*const IUPnPServiceCallback, self), pus);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IUPnPServiceEnumProperty_Value = Guid.initString("38873b37-91bb-49f4-b249-2e8efbb8a816");
pub const IID_IUPnPServiceEnumProperty = &IID_IUPnPServiceEnumProperty_Value;
pub const IUPnPServiceEnumProperty = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetServiceEnumProperty: fn(
self: *const IUPnPServiceEnumProperty,
dwMask: 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 IUPnPServiceEnumProperty_SetServiceEnumProperty(self: *const T, dwMask: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceEnumProperty.VTable, self.vtable).SetServiceEnumProperty(@ptrCast(*const IUPnPServiceEnumProperty, self), dwMask);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IUPnPServiceDocumentAccess_Value = Guid.initString("21905529-0a5e-4589-825d-7e6d87ea6998");
pub const IID_IUPnPServiceDocumentAccess = &IID_IUPnPServiceDocumentAccess_Value;
pub const IUPnPServiceDocumentAccess = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDocumentURL: fn(
self: *const IUPnPServiceDocumentAccess,
pbstrDocUrl: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDocument: fn(
self: *const IUPnPServiceDocumentAccess,
pbstrDoc: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceDocumentAccess_GetDocumentURL(self: *const T, pbstrDocUrl: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceDocumentAccess.VTable, self.vtable).GetDocumentURL(@ptrCast(*const IUPnPServiceDocumentAccess, self), pbstrDocUrl);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPServiceDocumentAccess_GetDocument(self: *const T, pbstrDoc: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPServiceDocumentAccess.VTable, self.vtable).GetDocument(@ptrCast(*const IUPnPServiceDocumentAccess, self), pbstrDoc);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPDevices_Value = Guid.initString("fdbc0c73-bda3-4c66-ac4f-f2d96fdad68c");
pub const IID_IUPnPDevices = &IID_IUPnPDevices_Value;
pub const IUPnPDevices = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const IUPnPDevices,
plCount: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const IUPnPDevices,
ppunk: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Item: fn(
self: *const IUPnPDevices,
bstrUDN: ?BSTR,
ppDevice: ?*?*IUPnPDevice,
) 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 IUPnPDevices_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevices.VTable, self.vtable).get_Count(@ptrCast(*const IUPnPDevices, self), plCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevices_get__NewEnum(self: *const T, ppunk: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevices.VTable, self.vtable).get__NewEnum(@ptrCast(*const IUPnPDevices, self), ppunk);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevices_get_Item(self: *const T, bstrUDN: ?BSTR, ppDevice: ?*?*IUPnPDevice) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevices.VTable, self.vtable).get_Item(@ptrCast(*const IUPnPDevices, self), bstrUDN, ppDevice);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPDevice_Value = Guid.initString("3d44d0d1-98c9-4889-acd1-f9d674bf2221");
pub const IID_IUPnPDevice = &IID_IUPnPDevice_Value;
pub const IUPnPDevice = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_IsRootDevice: fn(
self: *const IUPnPDevice,
pvarb: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RootDevice: fn(
self: *const IUPnPDevice,
ppudRootDevice: ?*?*IUPnPDevice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ParentDevice: fn(
self: *const IUPnPDevice,
ppudDeviceParent: ?*?*IUPnPDevice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_HasChildren: fn(
self: *const IUPnPDevice,
pvarb: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Children: fn(
self: *const IUPnPDevice,
ppudChildren: ?*?*IUPnPDevices,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_UniqueDeviceName: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FriendlyName: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Type: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PresentationURL: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ManufacturerName: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ManufacturerURL: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ModelName: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ModelNumber: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Description: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ModelURL: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_UPC: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_SerialNumber: fn(
self: *const IUPnPDevice,
pbstr: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IconURL: fn(
self: *const IUPnPDevice,
bstrEncodingFormat: ?BSTR,
lSizeX: i32,
lSizeY: i32,
lBitDepth: i32,
pbstrIconURL: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Services: fn(
self: *const IUPnPDevice,
ppusServices: ?*?*IUPnPServices,
) 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 IUPnPDevice_get_IsRootDevice(self: *const T, pvarb: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_IsRootDevice(@ptrCast(*const IUPnPDevice, self), pvarb);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_RootDevice(self: *const T, ppudRootDevice: ?*?*IUPnPDevice) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_RootDevice(@ptrCast(*const IUPnPDevice, self), ppudRootDevice);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_ParentDevice(self: *const T, ppudDeviceParent: ?*?*IUPnPDevice) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_ParentDevice(@ptrCast(*const IUPnPDevice, self), ppudDeviceParent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_HasChildren(self: *const T, pvarb: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_HasChildren(@ptrCast(*const IUPnPDevice, self), pvarb);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_Children(self: *const T, ppudChildren: ?*?*IUPnPDevices) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_Children(@ptrCast(*const IUPnPDevice, self), ppudChildren);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_UniqueDeviceName(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_UniqueDeviceName(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_FriendlyName(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_FriendlyName(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_Type(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_Type(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_PresentationURL(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_PresentationURL(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_ManufacturerName(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_ManufacturerName(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_ManufacturerURL(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_ManufacturerURL(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_ModelName(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_ModelName(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_ModelNumber(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_ModelNumber(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_Description(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_Description(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_ModelURL(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_ModelURL(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_UPC(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_UPC(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_SerialNumber(self: *const T, pbstr: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_SerialNumber(@ptrCast(*const IUPnPDevice, self), pbstr);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_IconURL(self: *const T, bstrEncodingFormat: ?BSTR, lSizeX: i32, lSizeY: i32, lBitDepth: i32, pbstrIconURL: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).IconURL(@ptrCast(*const IUPnPDevice, self), bstrEncodingFormat, lSizeX, lSizeY, lBitDepth, pbstrIconURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDevice_get_Services(self: *const T, ppusServices: ?*?*IUPnPServices) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDevice.VTable, self.vtable).get_Services(@ptrCast(*const IUPnPDevice, self), ppusServices);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPDeviceDocumentAccess_Value = Guid.initString("e7772804-3287-418e-9072-cf2b47238981");
pub const IID_IUPnPDeviceDocumentAccess = &IID_IUPnPDeviceDocumentAccess_Value;
pub const IUPnPDeviceDocumentAccess = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDocumentURL: fn(
self: *const IUPnPDeviceDocumentAccess,
pbstrDocument: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceDocumentAccess_GetDocumentURL(self: *const T, pbstrDocument: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceDocumentAccess.VTable, self.vtable).GetDocumentURL(@ptrCast(*const IUPnPDeviceDocumentAccess, self), pbstrDocument);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_IUPnPDeviceDocumentAccessEx_Value = Guid.initString("c4bc4050-6178-4bd1-a4b8-6398321f3247");
pub const IID_IUPnPDeviceDocumentAccessEx = &IID_IUPnPDeviceDocumentAccessEx_Value;
pub const IUPnPDeviceDocumentAccessEx = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDocument: fn(
self: *const IUPnPDeviceDocumentAccessEx,
pbstrDocument: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceDocumentAccessEx_GetDocument(self: *const T, pbstrDocument: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceDocumentAccessEx.VTable, self.vtable).GetDocument(@ptrCast(*const IUPnPDeviceDocumentAccessEx, self), pbstrDocument);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPDescriptionDocument_Value = Guid.initString("11d1c1b2-7daa-4c9e-9595-7f82ed206d1e");
pub const IID_IUPnPDescriptionDocument = &IID_IUPnPDescriptionDocument_Value;
pub const IUPnPDescriptionDocument = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ReadyState: fn(
self: *const IUPnPDescriptionDocument,
plReadyState: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Load: fn(
self: *const IUPnPDescriptionDocument,
bstrUrl: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadAsync: fn(
self: *const IUPnPDescriptionDocument,
bstrUrl: ?BSTR,
punkCallback: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LoadResult: fn(
self: *const IUPnPDescriptionDocument,
phrError: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Abort: fn(
self: *const IUPnPDescriptionDocument,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RootDevice: fn(
self: *const IUPnPDescriptionDocument,
ppudRootDevice: ?*?*IUPnPDevice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeviceByUDN: fn(
self: *const IUPnPDescriptionDocument,
bstrUDN: ?BSTR,
ppudDevice: ?*?*IUPnPDevice,
) 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 IUPnPDescriptionDocument_get_ReadyState(self: *const T, plReadyState: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDescriptionDocument.VTable, self.vtable).get_ReadyState(@ptrCast(*const IUPnPDescriptionDocument, self), plReadyState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDescriptionDocument_Load(self: *const T, bstrUrl: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDescriptionDocument.VTable, self.vtable).Load(@ptrCast(*const IUPnPDescriptionDocument, self), bstrUrl);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDescriptionDocument_LoadAsync(self: *const T, bstrUrl: ?BSTR, punkCallback: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDescriptionDocument.VTable, self.vtable).LoadAsync(@ptrCast(*const IUPnPDescriptionDocument, self), bstrUrl, punkCallback);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDescriptionDocument_get_LoadResult(self: *const T, phrError: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDescriptionDocument.VTable, self.vtable).get_LoadResult(@ptrCast(*const IUPnPDescriptionDocument, self), phrError);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDescriptionDocument_Abort(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDescriptionDocument.VTable, self.vtable).Abort(@ptrCast(*const IUPnPDescriptionDocument, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDescriptionDocument_RootDevice(self: *const T, ppudRootDevice: ?*?*IUPnPDevice) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDescriptionDocument.VTable, self.vtable).RootDevice(@ptrCast(*const IUPnPDescriptionDocument, self), ppudRootDevice);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDescriptionDocument_DeviceByUDN(self: *const T, bstrUDN: ?BSTR, ppudDevice: ?*?*IUPnPDevice) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDescriptionDocument.VTable, self.vtable).DeviceByUDN(@ptrCast(*const IUPnPDescriptionDocument, self), bstrUDN, ppudDevice);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.0.6000'
const IID_IUPnPDeviceFinderAddCallbackWithInterface_Value = Guid.initString("983dfc0b-1796-44df-8975-ca545b620ee5");
pub const IID_IUPnPDeviceFinderAddCallbackWithInterface = &IID_IUPnPDeviceFinderAddCallbackWithInterface_Value;
pub const IUPnPDeviceFinderAddCallbackWithInterface = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
DeviceAddedWithInterface: fn(
self: *const IUPnPDeviceFinderAddCallbackWithInterface,
lFindData: i32,
pDevice: ?*IUPnPDevice,
pguidInterface: ?*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 IUPnPDeviceFinderAddCallbackWithInterface_DeviceAddedWithInterface(self: *const T, lFindData: i32, pDevice: ?*IUPnPDevice, pguidInterface: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceFinderAddCallbackWithInterface.VTable, self.vtable).DeviceAddedWithInterface(@ptrCast(*const IUPnPDeviceFinderAddCallbackWithInterface, self), lFindData, pDevice, pguidInterface);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPDescriptionDocumentCallback_Value = Guid.initString("77394c69-5486-40d6-9bc3-4991983e02da");
pub const IID_IUPnPDescriptionDocumentCallback = &IID_IUPnPDescriptionDocumentCallback_Value;
pub const IUPnPDescriptionDocumentCallback = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
LoadComplete: fn(
self: *const IUPnPDescriptionDocumentCallback,
hrLoadResult: 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 IUPnPDescriptionDocumentCallback_LoadComplete(self: *const T, hrLoadResult: HRESULT) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDescriptionDocumentCallback.VTable, self.vtable).LoadComplete(@ptrCast(*const IUPnPDescriptionDocumentCallback, self), hrLoadResult);
}
};}
pub usingnamespace MethodMixin(@This());
};
const CLSID_UPnPRegistrar_Value = Guid.initString("204810b9-73b2-11d4-bf42-00b0d0118b56");
pub const CLSID_UPnPRegistrar = &CLSID_UPnPRegistrar_Value;
const CLSID_UPnPRemoteEndpointInfo_Value = Guid.initString("2e5e84e9-4049-4244-b728-2d24227157c7");
pub const CLSID_UPnPRemoteEndpointInfo = &CLSID_UPnPRemoteEndpointInfo_Value;
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPEventSink_Value = Guid.initString("204810b4-73b2-11d4-bf42-00b0d0118b56");
pub const IID_IUPnPEventSink = &IID_IUPnPEventSink_Value;
pub const IUPnPEventSink = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
OnStateChanged: fn(
self: *const IUPnPEventSink,
cChanges: u32,
rgdispidChanges: [*]i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnStateChangedSafe: fn(
self: *const IUPnPEventSink,
varsadispidChanges: VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPEventSink_OnStateChanged(self: *const T, cChanges: u32, rgdispidChanges: [*]i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPEventSink.VTable, self.vtable).OnStateChanged(@ptrCast(*const IUPnPEventSink, self), cChanges, rgdispidChanges);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPEventSink_OnStateChangedSafe(self: *const T, varsadispidChanges: VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPEventSink.VTable, self.vtable).OnStateChangedSafe(@ptrCast(*const IUPnPEventSink, self), varsadispidChanges);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPEventSource_Value = Guid.initString("204810b5-73b2-11d4-bf42-00b0d0118b56");
pub const IID_IUPnPEventSource = &IID_IUPnPEventSource_Value;
pub const IUPnPEventSource = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Advise: fn(
self: *const IUPnPEventSource,
pesSubscriber: ?*IUPnPEventSink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Unadvise: fn(
self: *const IUPnPEventSource,
pesSubscriber: ?*IUPnPEventSink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPEventSource_Advise(self: *const T, pesSubscriber: ?*IUPnPEventSink) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPEventSource.VTable, self.vtable).Advise(@ptrCast(*const IUPnPEventSource, self), pesSubscriber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPEventSource_Unadvise(self: *const T, pesSubscriber: ?*IUPnPEventSink) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPEventSource.VTable, self.vtable).Unadvise(@ptrCast(*const IUPnPEventSource, self), pesSubscriber);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPRegistrar_Value = Guid.initString("204810b6-73b2-11d4-bf42-00b0d0118b56");
pub const IID_IUPnPRegistrar = &IID_IUPnPRegistrar_Value;
pub const IUPnPRegistrar = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
RegisterDevice: fn(
self: *const IUPnPRegistrar,
bstrXMLDesc: ?BSTR,
bstrProgIDDeviceControlClass: ?BSTR,
bstrInitString: ?BSTR,
bstrContainerId: ?BSTR,
bstrResourcePath: ?BSTR,
nLifeTime: i32,
pbstrDeviceIdentifier: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RegisterRunningDevice: fn(
self: *const IUPnPRegistrar,
bstrXMLDesc: ?BSTR,
punkDeviceControl: ?*IUnknown,
bstrInitString: ?BSTR,
bstrResourcePath: ?BSTR,
nLifeTime: i32,
pbstrDeviceIdentifier: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RegisterDeviceProvider: fn(
self: *const IUPnPRegistrar,
bstrProviderName: ?BSTR,
bstrProgIDProviderClass: ?BSTR,
bstrInitString: ?BSTR,
bstrContainerId: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetUniqueDeviceName: fn(
self: *const IUPnPRegistrar,
bstrDeviceIdentifier: ?BSTR,
bstrTemplateUDN: ?BSTR,
pbstrUDN: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnregisterDevice: fn(
self: *const IUPnPRegistrar,
bstrDeviceIdentifier: ?BSTR,
fPermanent: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnregisterDeviceProvider: fn(
self: *const IUPnPRegistrar,
bstrProviderName: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPRegistrar_RegisterDevice(self: *const T, bstrXMLDesc: ?BSTR, bstrProgIDDeviceControlClass: ?BSTR, bstrInitString: ?BSTR, bstrContainerId: ?BSTR, bstrResourcePath: ?BSTR, nLifeTime: i32, pbstrDeviceIdentifier: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPRegistrar.VTable, self.vtable).RegisterDevice(@ptrCast(*const IUPnPRegistrar, self), bstrXMLDesc, bstrProgIDDeviceControlClass, bstrInitString, bstrContainerId, bstrResourcePath, nLifeTime, pbstrDeviceIdentifier);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPRegistrar_RegisterRunningDevice(self: *const T, bstrXMLDesc: ?BSTR, punkDeviceControl: ?*IUnknown, bstrInitString: ?BSTR, bstrResourcePath: ?BSTR, nLifeTime: i32, pbstrDeviceIdentifier: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPRegistrar.VTable, self.vtable).RegisterRunningDevice(@ptrCast(*const IUPnPRegistrar, self), bstrXMLDesc, punkDeviceControl, bstrInitString, bstrResourcePath, nLifeTime, pbstrDeviceIdentifier);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPRegistrar_RegisterDeviceProvider(self: *const T, bstrProviderName: ?BSTR, bstrProgIDProviderClass: ?BSTR, bstrInitString: ?BSTR, bstrContainerId: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPRegistrar.VTable, self.vtable).RegisterDeviceProvider(@ptrCast(*const IUPnPRegistrar, self), bstrProviderName, bstrProgIDProviderClass, bstrInitString, bstrContainerId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPRegistrar_GetUniqueDeviceName(self: *const T, bstrDeviceIdentifier: ?BSTR, bstrTemplateUDN: ?BSTR, pbstrUDN: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPRegistrar.VTable, self.vtable).GetUniqueDeviceName(@ptrCast(*const IUPnPRegistrar, self), bstrDeviceIdentifier, bstrTemplateUDN, pbstrUDN);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPRegistrar_UnregisterDevice(self: *const T, bstrDeviceIdentifier: ?BSTR, fPermanent: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPRegistrar.VTable, self.vtable).UnregisterDevice(@ptrCast(*const IUPnPRegistrar, self), bstrDeviceIdentifier, fPermanent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPRegistrar_UnregisterDeviceProvider(self: *const T, bstrProviderName: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPRegistrar.VTable, self.vtable).UnregisterDeviceProvider(@ptrCast(*const IUPnPRegistrar, self), bstrProviderName);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPReregistrar_Value = Guid.initString("204810b7-73b2-11d4-bf42-00b0d0118b56");
pub const IID_IUPnPReregistrar = &IID_IUPnPReregistrar_Value;
pub const IUPnPReregistrar = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ReregisterDevice: fn(
self: *const IUPnPReregistrar,
bstrDeviceIdentifier: ?BSTR,
bstrXMLDesc: ?BSTR,
bstrProgIDDeviceControlClass: ?BSTR,
bstrInitString: ?BSTR,
bstrContainerId: ?BSTR,
bstrResourcePath: ?BSTR,
nLifeTime: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReregisterRunningDevice: fn(
self: *const IUPnPReregistrar,
bstrDeviceIdentifier: ?BSTR,
bstrXMLDesc: ?BSTR,
punkDeviceControl: ?*IUnknown,
bstrInitString: ?BSTR,
bstrResourcePath: ?BSTR,
nLifeTime: 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 IUPnPReregistrar_ReregisterDevice(self: *const T, bstrDeviceIdentifier: ?BSTR, bstrXMLDesc: ?BSTR, bstrProgIDDeviceControlClass: ?BSTR, bstrInitString: ?BSTR, bstrContainerId: ?BSTR, bstrResourcePath: ?BSTR, nLifeTime: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPReregistrar.VTable, self.vtable).ReregisterDevice(@ptrCast(*const IUPnPReregistrar, self), bstrDeviceIdentifier, bstrXMLDesc, bstrProgIDDeviceControlClass, bstrInitString, bstrContainerId, bstrResourcePath, nLifeTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPReregistrar_ReregisterRunningDevice(self: *const T, bstrDeviceIdentifier: ?BSTR, bstrXMLDesc: ?BSTR, punkDeviceControl: ?*IUnknown, bstrInitString: ?BSTR, bstrResourcePath: ?BSTR, nLifeTime: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPReregistrar.VTable, self.vtable).ReregisterRunningDevice(@ptrCast(*const IUPnPReregistrar, self), bstrDeviceIdentifier, bstrXMLDesc, punkDeviceControl, bstrInitString, bstrResourcePath, nLifeTime);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPDeviceControl_Value = Guid.initString("204810ba-73b2-11d4-bf42-00b0d0118b56");
pub const IID_IUPnPDeviceControl = &IID_IUPnPDeviceControl_Value;
pub const IUPnPDeviceControl = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Initialize: fn(
self: *const IUPnPDeviceControl,
bstrXMLDesc: ?BSTR,
bstrDeviceIdentifier: ?BSTR,
bstrInitString: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetServiceObject: fn(
self: *const IUPnPDeviceControl,
bstrUDN: ?BSTR,
bstrServiceId: ?BSTR,
ppdispService: ?*?*IDispatch,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceControl_Initialize(self: *const T, bstrXMLDesc: ?BSTR, bstrDeviceIdentifier: ?BSTR, bstrInitString: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceControl.VTable, self.vtable).Initialize(@ptrCast(*const IUPnPDeviceControl, self), bstrXMLDesc, bstrDeviceIdentifier, bstrInitString);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceControl_GetServiceObject(self: *const T, bstrUDN: ?BSTR, bstrServiceId: ?BSTR, ppdispService: ?*?*IDispatch) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceControl.VTable, self.vtable).GetServiceObject(@ptrCast(*const IUPnPDeviceControl, self), bstrUDN, bstrServiceId, ppdispService);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IUPnPDeviceControlHttpHeaders_Value = Guid.initString("204810bb-73b2-11d4-bf42-00b0d0118b56");
pub const IID_IUPnPDeviceControlHttpHeaders = &IID_IUPnPDeviceControlHttpHeaders_Value;
pub const IUPnPDeviceControlHttpHeaders = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetAdditionalResponseHeaders: fn(
self: *const IUPnPDeviceControlHttpHeaders,
bstrHttpResponseHeaders: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceControlHttpHeaders_GetAdditionalResponseHeaders(self: *const T, bstrHttpResponseHeaders: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceControlHttpHeaders.VTable, self.vtable).GetAdditionalResponseHeaders(@ptrCast(*const IUPnPDeviceControlHttpHeaders, self), bstrHttpResponseHeaders);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUPnPDeviceProvider_Value = Guid.initString("204810b8-73b2-11d4-bf42-00b0d0118b56");
pub const IID_IUPnPDeviceProvider = &IID_IUPnPDeviceProvider_Value;
pub const IUPnPDeviceProvider = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Start: fn(
self: *const IUPnPDeviceProvider,
bstrInitString: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Stop: fn(
self: *const IUPnPDeviceProvider,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceProvider_Start(self: *const T, bstrInitString: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceProvider.VTable, self.vtable).Start(@ptrCast(*const IUPnPDeviceProvider, self), bstrInitString);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPDeviceProvider_Stop(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPDeviceProvider.VTable, self.vtable).Stop(@ptrCast(*const IUPnPDeviceProvider, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.0.6000'
const IID_IUPnPRemoteEndpointInfo_Value = Guid.initString("c92eb863-0269-4aff-9c72-75321bba2952");
pub const IID_IUPnPRemoteEndpointInfo = &IID_IUPnPRemoteEndpointInfo_Value;
pub const IUPnPRemoteEndpointInfo = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDwordValue: fn(
self: *const IUPnPRemoteEndpointInfo,
bstrValueName: ?BSTR,
pdwValue: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStringValue: fn(
self: *const IUPnPRemoteEndpointInfo,
bstrValueName: ?BSTR,
pbstrValue: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetGuidValue: fn(
self: *const IUPnPRemoteEndpointInfo,
bstrValueName: ?BSTR,
pguidValue: ?*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 IUPnPRemoteEndpointInfo_GetDwordValue(self: *const T, bstrValueName: ?BSTR, pdwValue: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPRemoteEndpointInfo.VTable, self.vtable).GetDwordValue(@ptrCast(*const IUPnPRemoteEndpointInfo, self), bstrValueName, pdwValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPRemoteEndpointInfo_GetStringValue(self: *const T, bstrValueName: ?BSTR, pbstrValue: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPRemoteEndpointInfo.VTable, self.vtable).GetStringValue(@ptrCast(*const IUPnPRemoteEndpointInfo, self), bstrValueName, pbstrValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUPnPRemoteEndpointInfo_GetGuidValue(self: *const T, bstrValueName: ?BSTR, pguidValue: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IUPnPRemoteEndpointInfo.VTable, self.vtable).GetGuidValue(@ptrCast(*const IUPnPRemoteEndpointInfo, self), bstrValueName, pguidValue);
}
};}
pub usingnamespace MethodMixin(@This());
};
//--------------------------------------------------------------------------------
// Section: Functions (9)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows8.0'
pub extern "CFGMGR32" fn SwDeviceCreate(
pszEnumeratorName: ?[*:0]const u16,
pszParentDeviceInstance: ?[*:0]const u16,
pCreateInfo: ?*const SW_DEVICE_CREATE_INFO,
cPropertyCount: u32,
pProperties: ?[*]const DEVPROPERTY,
pCallback: ?SW_DEVICE_CREATE_CALLBACK,
pContext: ?*anyopaque,
phSwDevice: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "CFGMGR32" fn SwDeviceClose(
hSwDevice: ?HSWDEVICE,
) callconv(@import("std").os.windows.WINAPI) void;
// TODO: this type is limited to platform 'windows8.1'
pub extern "CFGMGR32" fn SwDeviceSetLifetime(
hSwDevice: ?HSWDEVICE,
Lifetime: SW_DEVICE_LIFETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.1'
pub extern "CFGMGR32" fn SwDeviceGetLifetime(
hSwDevice: ?HSWDEVICE,
pLifetime: ?*SW_DEVICE_LIFETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "CFGMGR32" fn SwDevicePropertySet(
hSwDevice: ?HSWDEVICE,
cPropertyCount: u32,
pProperties: [*]const DEVPROPERTY,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "CFGMGR32" fn SwDeviceInterfaceRegister(
hSwDevice: ?HSWDEVICE,
pInterfaceClassGuid: ?*const Guid,
pszReferenceString: ?[*:0]const u16,
cPropertyCount: u32,
pProperties: ?[*]const DEVPROPERTY,
fEnabled: BOOL,
ppszDeviceInterfaceId: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "CFGMGR32" fn SwMemFree(
pMem: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void;
// TODO: this type is limited to platform 'windows8.0'
pub extern "CFGMGR32" fn SwDeviceInterfaceSetState(
hSwDevice: ?HSWDEVICE,
pszDeviceInterfaceId: ?[*:0]const u16,
fEnabled: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "CFGMGR32" fn SwDeviceInterfacePropertySet(
hSwDevice: ?HSWDEVICE,
pszDeviceInterfaceId: ?[*:0]const u16,
cPropertyCount: u32,
pProperties: [*]const DEVPROPERTY,
) 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 (10)
//--------------------------------------------------------------------------------
const Guid = @import("../../zig.zig").Guid;
const BOOL = @import("../../foundation.zig").BOOL;
const BSTR = @import("../../foundation.zig").BSTR;
const DEVPROPERTY = @import("../../devices/properties.zig").DEVPROPERTY;
const HRESULT = @import("../../foundation.zig").HRESULT;
const IDispatch = @import("../../system/com.zig").IDispatch;
const IUnknown = @import("../../system/com.zig").IUnknown;
const PWSTR = @import("../../foundation.zig").PWSTR;
const SECURITY_DESCRIPTOR = @import("../../security.zig").SECURITY_DESCRIPTOR;
const VARIANT = @import("../../system/com.zig").VARIANT;
test {
// The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
if (@hasDecl(@This(), "SW_DEVICE_CREATE_CALLBACK")) { _ = SW_DEVICE_CREATE_CALLBACK; }
@setEvalBranchQuota(
@import("std").meta.declarations(@This()).len * 3
);
// reference all the pub declarations
if (!@import("builtin").is_test) return;
inline for (@import("std").meta.declarations(@This())) |decl| {
if (decl.is_pub) {
_ = decl;
}
}
} | win32/devices/enumeration/pnp.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const Fish = ArrayList(u8);
//--------------------------------------------------------------------------------------------------
pub fn part1() anyerror!void {
const file = std.fs.cwd().openFile("data/day06_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();
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 fish = Fish.init(allocator);
var buf: [1024]u8 = undefined;
while (try istream.readUntilDelimiterOrEof(&buf, '\n')) |line| {
var it = std.mem.tokenize(u8, line, ",");
while (it.next()) |value| {
fish.append(std.fmt.parseInt(u8, value, 10) catch 0) catch unreachable;
}
}
std.log.info("num fish before: {d}", .{fish.items.len});
//std.log.info("{d}", .{fish.items});
var day: u32 = 0;
while (day < 80) : (day += 1) {
for (fish.items) |*item| {
if (item.* > 0) {
item.* -= 1;
} else {
item.* = 6;
try fish.append(8); // +1 because we will decrement the end of the list too
}
}
}
std.log.info("num fish after: {d}", .{fish.items.len});
}
//--------------------------------------------------------------------------------------------------
pub fn part2() anyerror!void {
const file = std.fs.cwd().openFile("data/day06_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 fish = [_]u64{0} ** 9;
var buf: [1024]u8 = undefined;
while (try istream.readUntilDelimiterOrEof(&buf, '\n')) |line| {
var it = std.mem.tokenize(u8, line, ",");
while (it.next()) |value| {
const gen = std.fmt.parseInt(u8, value, 10) catch 0;
fish[gen] += 1;
}
}
var sum: u64 = 0;
for (fish) |count| {
sum += count;
}
std.log.info("num fish before: {d}", .{sum});
var day: u32 = 0;
while (day < 256) : (day += 1) {
const num_birthers = fish[0];
var i: u32 = 0;
while (i < 9 - 1) : (i += 1) {
fish[i] = fish[i + 1]; // shift left, means timer reduced by one
}
fish[6] += num_birthers; // timer starts again
fish[8] = num_birthers; // new births
}
sum = 0;
for (fish) |count| {
sum += count;
}
std.log.info("num fish after: {d}", .{sum});
}
//--------------------------------------------------------------------------------------------------
pub fn main() anyerror!void {
try part1();
try part2();
}
//-------------------------------------------------------------------------------------------------- | src/day06.zig |
const std = @import("std");
const c = @import("internal/c.zig");
const internal = @import("internal/internal.zig");
const log = std.log.scoped(.git);
const git = @import("git.zig");
pub const Certificate = extern struct {
/// Type of certificate
cert_type: CertificateType,
pub const CertificateType = enum(c_uint) {
/// No information about the certificate is available. This may happen when using curl.
NONE = 0,
/// The `data` argument to the callback will be a pointer to the DER-encoded data.
X509,
/// The `data` argument to the callback will be a pointer to a `HostkeyCertificate` structure.
HOSTKEY_LIBSSH2,
/// The `data` argument to the callback will be a pointer to a `git.StrArray` with `name:content` strings containing
/// information about the certificate. This is used when using curl.
STRARRAY,
};
/// Hostkey information taken from libssh2
pub const HostkeyCertificate = extern struct {
/// The parent cert
parent: Certificate,
available: HostkeyAvailableFields,
/// Hostkey hash. If `available` has `MD5` set, this will have the MD5 hash of the hostkey.
hash_md5: [16]u8,
/// Hostkey hash. If `available` has `SHA1` set, this will have the SHA1 hash of the hostkey.
hash_sha1: [20]u8,
/// Hostkey hash. If `available` has `SHA256` set, this will have the SHA256 hash of the hostkey.
hash_sha256: [32]u8,
/// Raw hostkey type. If `available` has `RAW` set, this will have the type of the raw hostkey.
raw_type: RawType,
/// Pointer to the raw hostkey. If `available` has `RAW` set, this will be the raw contents of the hostkey.
hostkey: [*]const u8,
/// Length of the raw hostkey. If `available` has `RAW` set, this will have the length of the raw contents of the hostkey.
hostkey_len: usize,
/// A bitmask containing the available fields.
pub const HostkeyAvailableFields = packed struct {
/// MD5 is available
MD5: bool,
/// SHA-1 is available
SHA1: bool,
/// SHA-256 is available
SHA256: bool,
/// Raw hostkey is available
RAW: bool,
z_padding: u28 = 0,
pub fn format(
value: HostkeyAvailableFields,
comptime fmt: []const u8,
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
_ = fmt;
return internal.formatWithoutFields(
value,
options,
writer,
&.{"z_padding"},
);
}
test {
try std.testing.expectEqual(@sizeOf(c_uint), @sizeOf(HostkeyAvailableFields));
try std.testing.expectEqual(@bitSizeOf(c_uint), @bitSizeOf(HostkeyAvailableFields));
}
comptime {
std.testing.refAllDecls(@This());
}
};
pub const RawType = enum(c_uint) {
/// The raw key is of an unknown type.
UNKNOWN = 0,
/// The raw key is an RSA key.
RSA = 1,
/// The raw key is a DSS key.
DSS = 2,
/// The raw key is a ECDSA 256 key.
KEY_ECDSA_256 = 3,
/// The raw key is a ECDSA 384 key.
KEY_ECDSA_384 = 4,
/// The raw key is a ECDSA 521 key.
KEY_ECDSA_521 = 5,
/// The raw key is a ED25519 key.
KEY_ED25519 = 6,
};
comptime {
std.testing.refAllDecls(@This());
}
};
/// X.509 certificate information
pub const X509Certificate = extern struct {
parent: Certificate,
/// Pointer to the X.509 certificate data
data: *anyopaque,
/// Length of the memory block pointed to by `data`.
length: usize,
comptime {
std.testing.refAllDecls(@This());
}
};
comptime {
std.testing.refAllDecls(@This());
}
};
comptime {
std.testing.refAllDecls(@This());
} | src/certificate.zig |
const std = @import("std");
const tools = @import("tools");
const Computer = struct {
const Data = i32;
boot_image: []const Data,
memory_bank: []Data,
const insn_halt = 99;
const insn_add = 1;
const insn_mul = 2;
const insn_input = 3;
const insn_output = 4;
const insn_jne = 5; // jump-if-true
const insn_jeq = 6; // jump-if-false
const insn_slt = 7; // less than
const insn_seq = 8; // equals
const insn_operands = [_][]const bool{
&[_]bool{}, // invalid
&[_]bool{ false, false, true }, // add
&[_]bool{ false, false, true }, // mul
&[_]bool{true}, // input
&[_]bool{false}, // output
&[_]bool{ false, false }, // jne
&[_]bool{ false, false }, // jeq
&[_]bool{ false, false, true }, // slt
&[_]bool{ false, false, true }, // seq
};
fn read_param(c: *Computer, par: Data, mod: bool) Data {
return (if (mod) par else c.memory_bank[@intCast(usize, par)]);
}
fn run(c: *Computer, input: Data) Data {
std.mem.copy(Data, c.memory_bank, c.boot_image);
const mem = c.memory_bank;
var param_registers: [3]Data = undefined;
var output: Data = 0;
var pc: usize = 0;
while (true) {
// decode insn opcode
const opcode_and_mods = @intCast(usize, mem[pc]);
pc += 1;
const opcode = opcode_and_mods % 100;
const mods = [_]bool{
(opcode_and_mods / 100) % 10 != 0,
(opcode_and_mods / 1000) % 10 != 0,
(opcode_and_mods / 10000) % 10 != 0,
};
if (opcode == insn_halt)
break;
// read parameters from insn operands
const p = blk: {
const operands = insn_operands[opcode];
const p = param_registers[0..operands.len];
var i: usize = 0;
while (i < operands.len) : (i += 1) {
p[i] = read_param(c, mem[pc + i], mods[i] or operands[i]);
}
pc += operands.len;
break :blk p;
};
// execute insn
switch (opcode) {
insn_halt => break,
insn_add => mem[@intCast(usize, p[2])] = p[0] + p[1],
insn_mul => mem[@intCast(usize, p[2])] = p[0] * p[1],
insn_input => mem[@intCast(usize, p[0])] = input,
insn_output => output = p[0],
insn_jne => pc = if (p[0] != 0) @intCast(usize, p[1]) else pc,
insn_jeq => pc = if (p[0] == 0) @intCast(usize, p[1]) else pc,
insn_slt => mem[@intCast(usize, p[2])] = if (p[0] < p[1]) 1 else 0,
insn_seq => mem[@intCast(usize, p[2])] = if (p[0] == p[1]) 1 else 0,
else => @panic("Illegal instruction"),
}
}
return output;
}
};
pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 {
const int_count = blk: {
var int_count: usize = 0;
var it = std.mem.split(u8, input, ",");
while (it.next()) |_| int_count += 1;
break :blk int_count;
};
const image = try allocator.alloc(Computer.Data, int_count);
defer allocator.free(image);
{
var it = std.mem.split(u8, input, ",");
var i: usize = 0;
while (it.next()) |n_text| : (i += 1) {
const trimmed = std.mem.trim(u8, n_text, " \n\r\t");
image[i] = try std.fmt.parseInt(Computer.Data, trimmed, 10);
}
}
var computer = Computer{
.boot_image = image,
.memory_bank = try allocator.alloc(Computer.Data, int_count),
};
defer allocator.free(computer.memory_bank);
const ans1 = try std.fmt.allocPrint(allocator, "{}", .{computer.run(1)});
const ans2 = try std.fmt.allocPrint(allocator, "{}", .{computer.run(5)});
return [_][]const u8{ ans1, ans2 };
}
pub const main = tools.defaultMain("2019/day05.txt", run); | 2019/day05.zig |
const std = @import("std");
pub fn RPNStack(comptime T: type) type {
const DEFAULT_MAX = 20;
return struct {
allocator: *std.mem.Allocator,
buf: []T,
len: usize,
pub fn init(allocator: *std.mem.Allocator) !RPNStack(T) {
return RPNStack(T) {
.allocator = allocator,
.buf = try allocator.alloc(T,DEFAULT_MAX),
.len = 0,
};
}
pub fn deinit(self: RPNStack(T)) void {
self.allocator.free(self.buf);
}
pub fn push(self: *RPNStack(T), item: T) *RPNStack(T) {
if(self.len==self.buf.len){
self.len *= 2;
self.buf = self.allocator.realloc(self.buf,self.len) catch {
@panic("Could not push to RPNStack");
};
}
self.buf[self.len] = item;
self.len += 1;
return self;
}
pub fn pop(self: *RPNStack(T)) T {
if(self.buf.len==0)
@panic("Cannot pop from empty RPNStack");
const item = self.buf[self.len-1];
self.len -= 1;
return item;
}
pub fn add(self: *RPNStack(T)) *RPNStack(T) {
if(self.len<2)
@panic("Cannot add with less than 2 stack slots");
const res = self.buf[self.len-2] + self.buf[self.len-1];
self.len -= 1;
self.buf[self.len-1] = res;
return self;
}
pub fn sub(self: *RPNStack(T)) *RPNStack(T) {
if(self.len<2)
@panic("Cannot subtract with less than 2 stack slots");
const res = self.buf[self.len-2] - self.buf[self.len-1];
self.len -= 1;
self.buf[self.len-1] = res;
return self;
}
pub fn mul(self: *RPNStack(T)) *RPNStack(T) {
if(self.len<2)
@panic("Cannot multiply with less than 2 stack slots");
const res = self.buf[self.len-2] * self.buf[self.len-1];
self.len -= 1;
self.buf[self.len-1] = res;
return self;
}
pub fn div(self: *RPNStack(T)) *RPNStack(T) {
if(self.len<2)
@panic("Cannot divide with less than 2 stack slots");
const res = self.buf[self.len-2] / self.buf[self.len-1];
self.len -= 1;
self.buf[self.len-1] = res;
return self;
}
pub fn mod(self: *RPNStack(T)) *RPNStack(T) {
if(self.len<2)
@panic("Cannot modulus with less than 2 stack slots");
const res = self.buf[self.len-2] % self.buf[self.len-1];
self.len -= 1;
self.buf[self.len-1] = res;
return self;
}
pub fn neg(self: *RPNStack(T)) *RPNStack(T) {
if(self.len<1)
@panic("Cannot negate with less than 1 stack slot");
const res = -self.buf[self.len-1];
self.buf[self.len-1] = res;
return self;
}
};
} | rpnstack.zig |
const std = @import("std");
const Builder = std.build.Builder;
const os = std.os;
const path = os.path;
const builtin = @import("builtin");
const CACHE_DIR = "./zig-cache/";
const MAIN_PROGRAM = "src/main.zig";
pub fn build(b: *Builder) !void {
const mode = b.standardReleaseOptions();
const main = b.addObject(
"zigspire",
b.option(
[]const u8,
"exe",
"The program to build. Default " ++ MAIN_PROGRAM,
) orelse MAIN_PROGRAM,
);
main.setBuildMode(mode);
main.setTarget(
builtin.Arch{
.arm = builtin.Arch.Arm32.v5te,
},
builtin.Os.nspire,
builtin.Abi.gnueabi,
);
main.linkSystemLibrary("c");
main.single_threaded = true;
const ndless_dir = b.option(
[]const u8,
"ndless-dir",
"The path to your ndless sdk install.",
) orelse path.dirname(try b.exec([][]const u8{
"nspire-tools", "path",
})) orelse unreachable;
main.addIncludeDir(try os.path.join(b.allocator, [][]const u8{
ndless_dir,
"toolchain/install/bin/lib/gcc/arm-none-eabi/8.2.0/include",
}));
main.addIncludeDir(try os.path.join(b.allocator, [][]const u8{
ndless_dir,
"toolchain/install/lib/gcc/arm-none-eabi/8.2.0/include-fixed",
}));
main.addIncludeDir(try os.path.join(b.allocator, [][]const u8{
ndless_dir,
"toolchain/install/arm-none-eabi/sys-include",
}));
main.addIncludeDir(try os.path.join(b.allocator, [][]const u8{
ndless_dir,
"toolchain/install/arm-none-eabi/include",
}));
main.addIncludeDir(try os.path.join(b.allocator, [][]const u8{
ndless_dir,
"include",
}));
const nspireio = if (b.option(
bool,
"nspireio",
"Whether to build with nspireio or not",
) orelse false) "-Wl,--nspireio" else "-U________";
const link_main_step = b.addSystemCommand([][]const u8{
"nspire-ld", "-o", CACHE_DIR ++ "main", "-Wl,--gc-sections", nspireio,
});
link_main_step.addArtifactArg(main);
link_main_step.step.dependOn(&main.step);
const genzehn_step = b.addSystemCommand([][]const u8{"genzehn"});
genzehn_step.addArgs([][]const u8{
"--input", CACHE_DIR ++ "main",
"--output", CACHE_DIR ++ "zigspire.zehn",
"--240x320-support", "true",
"--uses-lcd-blit", "true",
});
genzehn_step.step.dependOn(&link_main_step.step);
const make_prg_step = b.addSystemCommand([][]const u8{
"make-prg", CACHE_DIR ++ "zigspire.zehn", CACHE_DIR ++ "zigspire.tns",
});
make_prg_step.step.dependOn(&genzehn_step.step);
const prg_step = b.step("prg", "Build a genzehn program");
prg_step.dependOn(&make_prg_step.step);
const firebird_send_step = b.addSystemCommand([][]const u8{
"firebird-send", CACHE_DIR ++ "zigspire.tns", b.option(
[]const u8,
"send-dir",
"The directory in Firebird to send the program to. Default /programs",
) orelse "/programs",
});
firebird_send_step.step.dependOn(&make_prg_step.step);
const send_step = b.step("send", "Send to firebird emu");
send_step.dependOn(&firebird_send_step.step);
b.default_step.dependOn(prg_step);
} | build.zig |
comptime {
if (std.Target.current.os.tag != .uefi) {
asm (
\\.extern __pmm_base
\\.extern __dram_base
\\
\\.global dram_base
\\.global pmm_head
\\
\\ .section .data.memmap
\\ // Prekernel reclaimable
\\ dram_base:
\\ .8byte __dram_base
\\ prekernel_size:
\\ .8byte 0
\\ .8byte 0x1000 // Reclaimable
\\
\\ // Kernel and module pages
\\ stivalehdr_pages_base:
\\ .8byte 0
\\ stivalehdr_pages_size:
\\ .8byte 0
\\ .8byte 0x1001 // Kernel and modules
\\
\\ // Page tables
\\ pt_base:
\\ .8byte 0
\\ pt_size:
\\ .8byte 0
\\ .8byte 0x1000 // Reclaimable
\\
\\ // Usable region
\\ pmm_head:
\\ .8byte __pmm_base
\\ usable_size:
\\ .8byte 0
\\ .8byte 1 // Usable
);
}
}
const sabaton = @import("root").sabaton;
const std = @import("std");
const pmm_state = enum(u2) {
Prekernel = 0,
KernelPages,
PageTables,
Sealed,
};
var current_state: pmm_state = .Prekernel;
pub fn verify_transition(s: pmm_state) void {
if (sabaton.safety and (current_state == .Sealed or (@enumToInt(current_state) + 1 != @enumToInt(s)))) {
sabaton.puts("Unexpected pmm sate: ");
sabaton.print_str(@tagName(s));
sabaton.puts(" while in state: ");
sabaton.print_str(@tagName(current_state));
sabaton.putchar('\n');
unreachable;
}
}
pub fn switch_state(new_state: pmm_state) void {
verify_transition(new_state);
// Transition out of current state and apply changes
const page_size = sabaton.platform.get_page_size();
// Page align the addresses and sizes
var current_base = sabaton.near("pmm_head").read(u64);
current_base += page_size - 1;
current_base &= ~(page_size - 1);
const eff_idx = @as(usize, @enumToInt(current_state)) * 3;
const current_entry = sabaton.near("dram_base").addr(u64);
// Size = head - base
current_entry[eff_idx + 1] = current_base - current_entry[eff_idx + 0];
// next_base = head
current_entry[eff_idx + 3] = current_base;
current_state = new_state;
}
const purpose = enum {
ReclaimableData,
KernelPage,
PageTable,
Hole,
};
fn verify_purpose(p: purpose) void {
if (sabaton.safety and switch (current_state) {
// When we're doing page tables, only allow that
.PageTables => p != .PageTable,
// When loading the kernel, only allow it
.KernelPages => p != .KernelPage,
// Before and after kernel loading we can do normal allocations
.Prekernel => p != .ReclaimableData,
// When we're sealed we don't want to allocate anything anymore
.Sealed => p != .Hole,
}) {
sabaton.puts("Allocation purpose ");
sabaton.print_str(@tagName(p));
sabaton.puts(" not valid in state ");
sabaton.print_str(@tagName(current_state));
sabaton.putchar('\n');
unreachable;
}
}
fn alloc_impl(num_bytes: u64, comptime aligned: bool, p: purpose) []u8 {
if (comptime (std.Target.current.os.tag == .uefi)) {
const mem = sabaton.vital(@import("root").allocator.alignedAlloc(u8, 0x1000, num_bytes), "PMM allocation on UEFI", true);
std.mem.set(u8, mem, 0);
return mem;
} else {
var current_base = sabaton.near("pmm_head").read(u64);
verify_purpose(p);
if (aligned) {
const page_size = sabaton.platform.get_page_size();
current_base += page_size - 1;
current_base &= ~(page_size - 1);
}
sabaton.near("pmm_head").write(current_base + num_bytes);
const ptr = @intToPtr([*]u8, current_base);
@memset(ptr, 0, num_bytes);
return ptr[0..num_bytes];
}
}
pub fn alloc_aligned(num_bytes: u64, p: purpose) []align(0x1000) u8 {
return @alignCast(0x1000, alloc_impl(num_bytes, true, p));
}
pub fn write_dram_size(dram_end: u64) void {
if (sabaton.safety and current_state != .Sealed) {
sabaton.puts("Unexpected pmm sate: ");
sabaton.print_str(@tagName(current_state));
sabaton.puts("while writing dram size\n");
unreachable;
}
// Align the current base
const current_head = @ptrToInt(alloc_aligned(0, .Hole).ptr);
sabaton.near("usable_size").write(dram_end - current_head);
} | src/lib/pmm.zig |
const ORG_NAME = "FabioWare";
const APP_NAME = "Karaoke";
const std = @import("std");
const builtin = @import("builtin");
const c = @cImport({
@cInclude("video.h");
@cInclude("glad/glad.h");
});
const nvg = @import("nanovg");
const gl = @import("zgl.zig");
const za = @import("zalgebra");
const Menu = @import("Menu.zig");
const Song = @import("Song.zig");
extern fn SetProcessDPIAware() callconv(.C) c_int; // enable High DPI on Windows
const FF_QUIT_EVENT = c.SDL_USEREVENT + 2; // is generated when ffplay encounters an error
const SDL_AUDIO_MIN_BUFFER_SIZE = 512; // Minimum SDL audio buffer size, in samples.
// Calculate actual buffer size keeping in mind not cause too frequent audio callbacks
const SDL_AUDIO_MAX_CALLBACKS_PER_SEC = 30;
var program: gl.Program = undefined;
var mvp_loc: u32 = undefined;
var window: ?*c.SDL_Window = null;
var audio_dev: c.SDL_AudioDeviceID = 0;
var audio_input_dev: c.SDL_AudioDeviceID = 0;
var path_buf: [2048]u8 = undefined;
var buf: [0x1000]u8 = undefined;
const AppData = struct {
const State = enum { intro, menu, play, pause };
const Settings = struct {
window_width: i32 = 0, // <= 0 means undefined, let app choose
window_height: i32 = 0,
fullscreen: bool = true,
audio_input_enabled: bool = true,
volume: f32 = 0.5, // 0-1
show_intro: bool = false,
fn load(self: *Settings, pref_path: []const u8) !void {
const allocator = std.heap.FixedBufferAllocator.init(&buf).allocator();
const filepath = try std.fs.path.join(allocator, &.{ pref_path, "settings.json" });
defer allocator.free(filepath);
const file = try std.fs.cwd().openFile(filepath, .{});
defer file.close();
const len = try file.readAll(&buf);
var stream = std.json.TokenStream.init(buf[0..len]);
self.* = try std.json.parse(Settings, &stream, .{ .allocator = allocator, .ignore_unknown_fields = true });
}
fn write(self: Settings, pref_path: []const u8) !void {
const allocator = std.heap.FixedBufferAllocator.init(&buf).allocator();
const filepath = try std.fs.path.join(allocator, &.{ pref_path, "settings.json" });
defer allocator.free(filepath);
var file = try std.fs.cwd().createFile(filepath, .{});
defer file.close();
try std.json.stringify(self, .{}, file.writer());
}
};
settings: Settings = Settings{},
menu: Menu = Menu{},
state: State = .intro,
intro_duration: f32 = 9,
quit: bool = false,
video_background: ?*c.VideoState = null,
video_song: ?*c.VideoState = null,
vc: ?*c.VideoContext = null,
fn load(app: *AppData, allocator: std.mem.Allocator, pref_path: []const u8) !void {
app.menu.songs = try Song.loadSongs(allocator, pref_path);
for (app.menu.songs) |*song| {
const filepath = try allocator.dupeZ(u8, song.album_art);
defer allocator.free(filepath);
song.image = nvg.createImage(filepath, .{});
}
try app.menu.loadFonts();
if (app.settings.show_intro) {
app.state = .intro;
app.video_background = c.stream_open("data/intro.mp4", app.vc) orelse return error.StreamOpenFail;
} else {
app.state = .menu;
app.video_background = c.stream_open("data/bluedust.mp4", app.vc) orelse return error.StreamOpenFail;
c.video_set_looping(app.video_background, 1);
}
}
fn free(app: *AppData, allocator: std.mem.Allocator) void {
for (app.menu.songs) |song| song.free(allocator);
allocator.free(app.menu.songs);
if (app.video_background) |video| {
app.video_background = null;
c.stream_close(video);
}
if (app.video_song) |video| {
app.video_song = null;
c.stream_close(video);
}
}
fn onEscapePressed(app: *AppData) void {
switch (app.state) {
.intro => {},
.menu => app.quit = true,
.play => {
c.video_set_paused(app.video_song, 1);
app.state = .pause;
},
.pause => {
// close video
if (app.video_song) |video| {
app.video_song = null;
c.SDL_LockAudioDevice(audio_dev);
defer c.SDL_UnlockAudioDevice(audio_dev);
c.stream_close(video);
}
c.video_set_paused(app.video_background, 0); // continue background video
app.state = .menu;
},
}
}
fn onLeftPressed(app: *AppData) void {
switch (app.state) {
.intro => {},
.menu => app.menu.prevSong(),
.play, .pause => {
var pos = c.video_get_position(app.video_song);
pos = std.math.max(0, pos - 10.0);
c.video_stream_seek(app.video_song, @floatToInt(i64, pos * 1_000_000));
app.menu.progress_alpha = 5;
},
}
}
fn onRightPressed(app: *AppData) void {
switch (app.state) {
.intro => {},
.menu => app.menu.nextSong(),
.play, .pause => {
var pos = c.video_get_position(app.video_song);
pos += 10.0;
c.video_stream_seek(app.video_song, @floatToInt(i64, pos * 1_000_000));
app.menu.progress_alpha = 5;
},
}
}
fn onReturnPressed(app: *AppData) !void {
switch (app.state) {
.intro => {},
.menu => {
if (app.menu.song_selected < app.menu.songs.len) {
c.video_set_paused(app.video_background, 1);
const song = app.menu.songs[app.menu.song_selected];
const allocator = std.heap.FixedBufferAllocator.init(&path_buf).allocator();
const filepath = try allocator.dupeZ(u8, song.video);
defer allocator.free(filepath);
app.video_song = c.stream_open(filepath, app.vc) orelse return error.StreamOpenFail;
//c.video_stream_seek(app.video_song, (3 * 60 + 52) * 1_000_000); // TEST: seek to end
c.video_set_volume(app.video_song, app.settings.volume);
app.state = .play;
}
},
.play => {
c.video_set_paused(app.video_song, 1);
app.state = .pause;
},
.pause => {
c.video_set_paused(app.video_song, 0);
app.state = .play;
},
}
}
fn draw(app: *AppData) void {
var window_width: i32 = undefined;
var window_height: i32 = undefined;
c.SDL_GetWindowSize(window, &window_width, &window_height);
gl.viewport(0, 0, @intCast(u32, window_width), @intCast(u32, window_height));
const width: f32 = @intToFloat(f32, window_width);
const height = @intToFloat(f32, window_height);
const window_ar = width / height;
gl.clearColor(0, 0, 0, 1);
gl.clear(.{ .color = true, .stencil = true });
var video_width: i32 = undefined;
var video_height: i32 = undefined;
const proj = za.perspective(45.0, window_ar, 0.1, 100.0);
const view = za.lookAt(za.Vec3.new(0, 0, 3), za.Vec3.zero(), za.Vec3.up());
_ = proj;
_ = view;
if (app.state == .intro or app.state == .menu) {
// background video
if (app.video_background) |video| {
c.video_update(video);
c.video_get_dims(video, &video_width, &video_height);
const video_ar = @intToFloat(f32, video_width) / @intToFloat(f32, video_height);
// const model = za.Mat4.fromScale(za.Vec3.new(video_ar, 1, 1)).rotate(45 + 15 * std.math.sin(select_time * 2.3), za.Vec3.new(0, 1, 0)).translate(za.Vec3.new(-1, 0, 0));
// const mvp = proj.mult(view).mult(model);
const s = video_ar / window_ar;
const sx = std.math.max(1, s);
const sy = std.math.max(1, 1 / s);
const mvp = za.Mat4.fromScale(za.Vec3.new(sx, sy, 1));
c.video_bind_texture(video);
program.uniformMatrix4(mvp_loc, false, &.{mvp.data});
c.glRectf(-1, -1, 1, 1);
// handle end of intro video
if (app.state == .intro) {
if (c.video_is_finished(video) != 0) {
app.video_background = null;
c.stream_close(video);
}
}
}
}
if (app.state == .intro) {
app.intro_duration -= 1.0 / 60.0;
if (app.intro_duration <= 0) {
app.state = .menu;
app.video_background = c.stream_open("data/background.mov", app.vc) orelse null;
if (app.video_background != null) c.video_set_looping(app.video_background, 1);
}
}
var progress: f32 = 0;
if (app.state == .play or app.state == .pause) {
if (app.video_song) |video| {
c.video_update(video);
const pos = c.video_get_position(video);
const dur = c.video_get_duration(video);
if (dur > 0) {
progress = std.math.clamp(@floatCast(f32, pos / dur), 0, 1);
}
c.video_get_dims(video, &video_width, &video_height);
const video_ar = @intToFloat(f32, video_width) / @intToFloat(f32, video_height);
// const model = za.Mat4.fromScale(za.Vec3.new(video_ar, 1, 1)).rotate(-45 + 15 * std.math.sin(select_time * 1.3), za.Vec3.new(0, 1, 0)).translate(za.Vec3.new(1, 0, 0));
// const mvp = proj.mult(view).mult(model);
const s = video_ar / window_ar;
const sx = std.math.max(1, s);
const sy = std.math.max(1, 1 / s);
const mvp = za.Mat4.fromScale(za.Vec3.new(sx, sy, 1));
c.video_bind_texture(video);
program.uniformMatrix4(mvp_loc, false, &.{mvp.data});
c.glRectf(-1, -1, 1, 1);
// handle end of video
if (c.video_is_finished(video) != 0) {
app.video_song = null;
c.stream_close(video);
app.state = .menu;
c.video_set_paused(app.video_background, 0);
}
}
}
// draw 2D UI
nvg.beginFrame(width, height, 1); // TODO: pixel scale
switch (app.state) {
.intro => {
if (app.video_background == null) {
app.menu.drawTitle(width, height);
}
},
.menu => app.menu.drawUi(width, height),
.play => app.menu.drawProgress(width, height, progress),
.pause => {
app.menu.drawPauseUi(width, height);
app.menu.progress_alpha = 1; // always visible
app.menu.drawProgress(width, height, progress);
},
}
nvg.endFrame();
c.SDL_GL_SwapWindow(window);
}
};
fn initGl() void {
program = gl.Program.create();
{
const vs = gl.Shader.create(.vertex);
defer vs.delete();
vs.source(1, &.{@embedFile("shaders/yuv.vert")});
vs.compile();
const fs = gl.Shader.create(.fragment);
defer fs.delete();
fs.source(1, &.{@embedFile("shaders/yuv.frag")});
fs.compile();
program.attach(vs);
defer program.detach(vs);
program.attach(fs);
defer program.detach(fs);
program.link();
}
program.use();
mvp_loc = program.uniformLocation("mvp").?;
if (program.uniformLocation("tex0")) |tex0| program.uniform1i(tex0, 0);
if (program.uniformLocation("tex1")) |tex1| program.uniform1i(tex1, 1);
if (program.uniformLocation("tex2")) |tex2| program.uniform1i(tex2, 2);
}
fn sdlAudioCallback(userdata: ?*anyopaque, stream: [*c]u8, len: c_int) callconv(.C) void {
const queue_len = c.SDL_GetQueuedAudioSize(audio_input_dev);
if (queue_len >= len and len > 0) {
const dequeued_len = c.SDL_DequeueAudio(audio_input_dev, stream, @intCast(c_uint, len));
if (queue_len > 3 * len) { // avoid too much latency
c.SDL_ClearQueuedAudio(audio_input_dev);
std.log.warn("clearing queued audio", .{});
}
_ = dequeued_len;
//std.log.info("dequeued {} bytes", .{dequeued_len});
} else {
std.mem.set(u8, stream[0..@intCast(usize, len)], 0); // silence
}
var app_data = @ptrCast(*AppData, @alignCast(@alignOf(*AppData), userdata.?));
if (app_data.video_background) |video| c.video_sdl_audio_callback(video, stream, len);
if (app_data.video_song) |video| c.video_sdl_audio_callback(video, stream, len);
}
fn sdlIsFullscreen() bool {
return c.SDL_GetWindowFlags(window) & c.SDL_WINDOW_FULLSCREEN_DESKTOP != 0;
}
fn sdlToggleFullscreen() void {
if (sdlIsFullscreen()) {
_ = c.SDL_SetWindowFullscreen(window, 0);
_ = c.SDL_ShowCursor(1);
} else {
_ = c.SDL_SetWindowFullscreen(window, c.SDL_WINDOW_FULLSCREEN_DESKTOP);
_ = c.SDL_ShowCursor(0);
}
}
fn sdlEventWatch(userdata: ?*anyopaque, sdl_event_ptr: [*c]c.SDL_Event) callconv(.C) c_int {
var app_data = @ptrCast(*AppData, @alignCast(@alignOf(*AppData), userdata.?));
if (app_data.quit) return 1;
const sdl_event = sdl_event_ptr[0];
if (sdl_event.type == c.SDL_WINDOWEVENT) {
if (sdl_event.window.event == c.SDL_WINDOWEVENT_RESIZED) {
app_data.draw();
return 0;
}
}
return 1; // unhandled
}
fn eventLoop(app: *AppData) !void {
while (!app.quit) {
var event: c.SDL_Event = undefined;
while (c.SDL_PollEvent(&event) != 0) {
switch (event.type) {
c.SDL_KEYDOWN => {
switch (event.key.keysym.sym) {
c.SDLK_ESCAPE => app.onEscapePressed(),
c.SDLK_LEFT => app.onLeftPressed(),
c.SDLK_RIGHT => app.onRightPressed(),
c.SDLK_RETURN => try app.onReturnPressed(),
c.SDLK_F11, c.SDLK_f => sdlToggleFullscreen(),
else => {},
}
},
c.SDL_QUIT, FF_QUIT_EVENT => app.quit = true,
else => {},
}
}
app.menu.tick();
app.draw();
}
}
pub fn main() anyerror!void {
// enable High DPI on Windows
if (builtin.os.tag == .windows) _ = SetProcessDPIAware();
var gpa = std.heap.GeneralPurposeAllocator(.{
.enable_memory_limit = true,
}){};
defer {
const leaked = gpa.deinit();
if (leaked) @panic("Memory leak :(");
}
const allocator = gpa.allocator();
var app_data = AppData{};
const flags = c.SDL_INIT_VIDEO | c.SDL_INIT_AUDIO;
if (c.SDL_Init(flags) != 0) {
std.log.err("SDL_Init failed: {s}", .{c.SDL_GetError()});
return;
}
defer c.SDL_Quit();
const sdl_pref_path = c.SDL_GetPrefPath(ORG_NAME, APP_NAME);
if (sdl_pref_path == null) {
std.log.err("SDL_GetPrefPath failed: {s}", .{c.SDL_GetError()});
return;
}
const pref_path = std.mem.sliceTo(sdl_pref_path, 0);
app_data.settings.load(pref_path) catch {}; // ignore
_ = c.SDL_GL_SetAttribute(c.SDL_GL_STENCIL_SIZE, 1);
_ = c.SDL_GL_SetAttribute(c.SDL_GL_MULTISAMPLEBUFFERS, 1);
_ = c.SDL_GL_SetAttribute(c.SDL_GL_MULTISAMPLESAMPLES, 4);
const window_x: c_int = @bitCast(c_int, c.SDL_WINDOWPOS_UNDEFINED);
const window_y: c_int = @bitCast(c_int, c.SDL_WINDOWPOS_UNDEFINED);
var display_mode: c.SDL_DisplayMode = undefined;
_ = c.SDL_GetDesktopDisplayMode(0, &display_mode);
var window_width: c_int = @divTrunc(display_mode.w * 3, 4);
var window_height: c_int = @divTrunc(display_mode.h * 3, 4);
if (app_data.settings.window_width > 0) window_width = app_data.settings.window_width;
if (app_data.settings.window_height > 0) window_height = app_data.settings.window_height;
var window_flags: u32 = c.SDL_WINDOW_RESIZABLE | c.SDL_WINDOW_OPENGL | c.SDL_WINDOW_HIDDEN;
if (app_data.settings.fullscreen) {
window_flags |= c.SDL_WINDOW_FULLSCREEN_DESKTOP;
_ = c.SDL_ShowCursor(0);
}
window = c.SDL_CreateWindow("Karaoke", window_x, window_y, window_width, window_height, window_flags);
if (window == null) {
std.log.err("SDL_CreateWindow failed: {s}", .{c.SDL_GetError()});
return;
}
defer c.SDL_DestroyWindow(window);
defer {
app_data.settings.fullscreen = sdlIsFullscreen();
if (!app_data.settings.fullscreen) {
c.SDL_GetWindowSize(window, &app_data.settings.window_width, &app_data.settings.window_height);
}
app_data.settings.write(pref_path) catch {}; // ignore
}
var gl_context = c.SDL_GL_CreateContext(window);
defer c.SDL_GL_DeleteContext(gl_context);
_ = c.SDL_GL_SetSwapInterval(1); // vsync
c.SDL_AddEventWatch(sdlEventWatch, &app_data);
_ = c.gladLoadGL(); // load OpenGL functions
initGl();
nvg.init();
defer nvg.quit();
// audio specs containers
var wanted_specs: c.SDL_AudioSpec = undefined;
var specs: c.SDL_AudioSpec = undefined;
// set audio settings
wanted_specs.freq = 44100;
wanted_specs.format = c.AUDIO_S16SYS;
wanted_specs.channels = 2;
wanted_specs.silence = 0;
// copied from ffplay
const exp = std.math.log2_int(u16, @intCast(u16, @intCast(u32, wanted_specs.freq) / SDL_AUDIO_MAX_CALLBACKS_PER_SEC));
wanted_specs.samples = std.math.max(SDL_AUDIO_MIN_BUFFER_SIZE, @as(u16, 2) << exp);
wanted_specs.callback = sdlAudioCallback;
wanted_specs.userdata = &app_data;
// open audio output device
const allowed_changes = c.SDL_AUDIO_ALLOW_FREQUENCY_CHANGE; // | c.SDL_AUDIO_ALLOW_FORMAT_CHANGE;
audio_dev = c.SDL_OpenAudioDevice(null, 0, &wanted_specs, &specs, allowed_changes);
if (audio_dev == 0) return error.OpenAudioDeviceFail;
defer c.SDL_CloseAudioDevice(audio_dev);
app_data.vc = c.video_init(specs.freq, specs.channels, specs.size) orelse return error.VideoInitFailed;
defer c.video_quit(app_data.vc);
// open audio input device
if (app_data.settings.audio_input_enabled) {
wanted_specs.freq = specs.freq;
wanted_specs.callback = null; // use sdl queue
audio_input_dev = c.SDL_OpenAudioDevice(null, 1, &wanted_specs, &specs, 0);
if (audio_input_dev != 0) {
std.log.info("audio input device: {s}", .{c.SDL_GetAudioDeviceName(0, 1)});
}
}
defer c.SDL_CloseAudioDevice(audio_input_dev);
try app_data.load(allocator, pref_path);
defer app_data.free(allocator);
c.SDL_PauseAudioDevice(audio_input_dev, 0); // start recording
defer c.SDL_PauseAudioDevice(audio_input_dev, 1); // stop
c.SDL_PauseAudioDevice(audio_dev, 0); // play audio
defer c.SDL_PauseAudioDevice(audio_dev, 1); // stop
c.SDL_ShowWindow(window);
try eventLoop(&app_data);
} | src/main.zig |
const std = @import("../std.zig");
const assert = std.debug.assert;
const builtin = @import("builtin");
const macho = std.macho;
usingnamespace @import("../os/bits.zig");
extern "c" fn __error() *c_int;
pub extern "c" fn _NSGetExecutablePath(buf: [*]u8, bufsize: *u32) c_int;
pub extern "c" fn _dyld_get_image_header(image_index: u32) ?*mach_header;
pub extern "c" fn __getdirentries64(fd: c_int, buf_ptr: [*]u8, buf_len: usize, basep: *i64) isize;
pub extern "c" fn mach_absolute_time() u64;
pub extern "c" fn mach_timebase_info(tinfo: ?*mach_timebase_info_data) void;
pub extern "c" fn kevent64(
kq: c_int,
changelist: [*]const kevent64_s,
nchanges: c_int,
eventlist: [*]kevent64_s,
nevents: c_int,
flags: c_uint,
timeout: ?*const timespec,
) c_int;
const mach_hdr = if (@sizeOf(usize) == 8) mach_header_64 else mach_header;
/// The value of the link editor defined symbol _MH_EXECUTE_SYM is the address
/// of the mach header in a Mach-O executable file type. It does not appear in
/// any file type other than a MH_EXECUTE file type. The type of the symbol is
/// absolute as the header is not part of any section.
/// This symbol is populated when linking the system's libc, which is guaranteed
/// on this operating system. However when building object files or libraries,
/// the system libc won't be linked until the final executable. So we
/// export a weak symbol here, to be overridden by the real one.
pub extern "c" var _mh_execute_header: mach_hdr = undefined;
comptime {
if (std.os.darwin.is_the_target) {
@export("__mh_execute_header", _mh_execute_header, .Weak);
}
}
pub const mach_header_64 = macho.mach_header_64;
pub const mach_header = macho.mach_header;
pub const _errno = __error;
pub extern "c" fn mach_host_self() mach_port_t;
pub extern "c" fn clock_get_time(clock_serv: clock_serv_t, cur_time: *mach_timespec_t) kern_return_t;
pub extern "c" fn host_get_clock_service(host: host_t, clock_id: clock_id_t, clock_serv: ?[*]clock_serv_t) kern_return_t;
pub extern "c" fn mach_port_deallocate(task: ipc_space_t, name: mach_port_name_t) kern_return_t;
pub fn sigaddset(set: *sigset_t, signo: u5) void {
set.* |= u32(1) << (signo - 1);
}
pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; | std/c/darwin.zig |
const wordSize: u4 = 12;
const inputFile = @embedFile("./input/day03.txt");
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
// const assert = std.debug.assert;
const MostCommonResult = enum {
Zero,
One,
Equal,
All,
};
// Returns an array of 0, 1, or 2 (0 if 0 is most common, 1 is 1 is most common, 2 if it's equal)
fn mostCommon(input: []const u8) ![wordSize]MostCommonResult {
var numOnes = [_]u32{0} ** wordSize;
// number of lines in the file
var numWords: i32 = 0;
var start: usize = 0;
while (std.mem.indexOfScalarPos(u8, input, start, '\n')) |end| : (start = end + 1) {
numWords += 1;
var i: usize = 0;
while (i < end - start) : (i += 1) {
const c = input[start + i];
switch (c) {
'1' => numOnes[i] += 1,
'0' => continue,
else => unreachable,
}
}
}
const half = @divFloor(numWords, 2);
var result = [_]MostCommonResult{MostCommonResult.Zero} ** wordSize;
var i: usize = 0;
while (i < wordSize) : (i += 1) {
if (numOnes[i] > half) {
result[i] = MostCommonResult.One;
} else if (numOnes[i] == half) {
result[i] = MostCommonResult.Equal;
} else {
result[i] = MostCommonResult.Zero;
}
}
return result;
}
fn calcGamma(input: []const u8) !u32 {
var gamma: u32 = 0;
var eps: u32 = 0;
const commonBit = try mostCommon(input);
// use typeof here, Zig will ensure absolutely no overflow (cool!)
var i: @TypeOf(wordSize) = 0;
while (i < wordSize) : (i += 1) {
const x = @as(u32, 1) << (wordSize - i - 1);
if (commonBit[i] == MostCommonResult.One) {
gamma += x;
} else {
eps += x;
}
}
return gamma * eps;
}
// -------------- Part 2 -----------------
fn getSlices(input: []const u8, allocator: Allocator) !ArrayList([]const u8) {
var result = ArrayList([]const u8).init(allocator);
var start: usize = 0;
while (std.mem.indexOfScalarPos(u8, input, start, '\n')) |end| : (start = end + 1) {
try result.append(input[start..end]);
}
return result;
}
fn co2Rating(input: []const u8, allocator: Allocator) !u32 {
var slices = try getSlices(input, allocator);
defer slices.deinit();
var i: u32 = 0;
while (i < wordSize) : (i += 1) {
// first, check for the most common digit amongst the slices
// Then, filter out slices that don't meet the most common digit
const digitWanted = switch (mostCommonDigit(slices, i)) {
.One, .Equal => @as(u8, '0'),
.Zero => @as(u8, '1'),
// if all the digits are the same, ignore this round
.All => continue,
};
filterOut(&slices, i, digitWanted);
if (slices.items.len == 1) {
// Found it
return try parseBinary(slices.items[0]);
}
}
unreachable;
}
fn oxygenRating(input: []const u8, allocator: Allocator) !u32 {
var slices = try getSlices(input, allocator);
defer slices.deinit();
var i: u32 = 0;
while (i < wordSize) : (i += 1) {
// first, check for the most common digit amongst the slices
// std.debug.print("\nCurrent slices:", .{});
// for (slices.items) |slice| {
// std.debug.print("{s}, ", .{slice});
// }
// std.debug.print("\n", .{});
// Then, filter out slices that don't meet the most common digit
const digitWanted = switch (mostCommonDigit(slices, i)) {
// Note: the @as u8 casts are not strictly needed, but are due to this 5 year old issue in the Type checker
// which causes comptime values returned in if else branches to not be implicitly castable
// https://github.com/ziglang/zig/issues/137
.One, .Equal => @as(u8, '1'),
.Zero => @as(u8, '0'),
.All => continue,
};
filterOut(&slices, i, digitWanted);
if (slices.items.len == 1) {
// Found it
return try parseBinary(slices.items[0]);
}
}
unreachable;
}
// Removes element in slices that don't have the digit at pos
fn filterOut(slices: *ArrayList([]const u8), pos: u32, digit: u8) void {
var j: u32 = 0;
for (slices.items) |slice| {
if (slice[pos] == digit) {
slices.items[j] = slice;
j += 1;
}
}
slices.shrinkRetainingCapacity(j);
}
fn mostCommonDigit(slices: ArrayList([]const u8), pos: u32) MostCommonResult {
var numOnes: i32 = 0;
for (slices.items) |slice| {
if (slice[pos] == '1') numOnes += 1;
}
const half = @divFloor(slices.items.len, 2);
if (numOnes == 0 or numOnes == slices.items.len) {
return .All;
} else if (numOnes > half) {
return .One;
} else if (numOnes == half and 2 * half == slices.items.len) {
return .Equal;
} else {
// if this is an odd number. We round down, so equality means that there are less ones than zeroes.
return .Zero;
}
}
fn parseBinary(input: []const u8) std.fmt.ParseIntError!u32 {
if (input.len > 32) return std.fmt.ParseIntError.Overflow;
var result: u32 = 0;
var i: u5 = 0;
while (i < input.len) : (i += 1) {
switch (input[i]) {
'1' =>
// Safety: input.len is checked above
result += (@as(u32, 1) << (@intCast(u5, input.len) - i - 1)),
'0' => continue,
else => return std.fmt.ParseIntError.InvalidCharacter,
}
}
return result;
}
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var allocator = &gpa.allocator;
defer std.debug.assert(!gpa.deinit()); // no leaks
try stdout.print("Part 1: Gamma * eps = {d}\nPart2: oxygen * co2: {d}\n", .{ try calcGamma(inputFile), (try oxygenRating(inputFile, allocator)) * try co2Rating(inputFile, allocator) });
}
test "life support" {
const input =
\\000000000100
\\000000011110
\\000000010110
\\000000010111
\\000000010101
\\000000001111
\\000000000111
\\000000011100
\\000000010000
\\000000011001
\\000000000010
\\000000001010
\\
;
try std.testing.expectEqual(@as(u32, 23), try oxygenRating(input, std.testing.allocator));
try std.testing.expectEqual(@as(u32, 10), try co2Rating(input, std.testing.allocator));
}
test "Filter out" {
var slices = ArrayList([]const u8).init(std.testing.allocator);
defer slices.deinit();
try slices.appendSlice(&.{ "000000000000", "100000000000", "101000000000" });
filterOut(&slices, 0, '1');
try std.testing.expectEqual(@as(usize, 2), slices.items.len);
} | src/day03.zig |
usingnamespace @import("MathUtil.zig");
usingnamespace @import("Vec3.zig");
const math = @import("std").math;
pub const identity = Quat{ .x = 0.0, .y = 0.0, .z = 0.0, .w = 1.0 };
pub const Quat = packed struct {
x: f32 = 0.0,
y: f32 = 0.0,
z: f32 = 0.0,
w: f32 = 0.0,
pub fn Equals(lhs: *const Quat, rhs: *const Quat) bool {
return EqualWithinTolerance(f32, lhs.x, rhs.x, f32_epsilon);
}
// Roll
pub fn GetXEuler(self: *const Quat) f32 {
return math.atan(2.0 * (self.y * self.z + self.x * self.w), 1 - (2 * (self.x * self.x + self.y * self.y)));
}
// Pitch
pub fn GetYEuler(self: *const Quat) f32 {
return math.asin(2.0 * (self.x * self.z - self.y * self.w));
}
// Yaw
pub fn GetZEuler(self: *const Quat) f32 {
return math.atan(2.0 * (self.w * self.z + self.x * self.y), 1 - (2 * (self.y * self.y + self.z * self.z)));
}
pub fn GetEulerAngles(self: *const Quat) Vec3 {
return Vec3{ .x = self.GetXEuler(), .y = self.GetYEuler(), .z = self.GetZEuler() };
}
pub fn GetInverse(self: *const Quat) Quat {
return Quat{ .x = -self.x, .y = -self.y, .z = -self.z, .w = self.w };
}
pub fn Inverse(self: *Quat) void {
self.x = -self.x;
self.y = -self.y;
self.z = -self.z;
}
pub fn Length(self: *const Quat) f32 {
return math.sqrt(self.LengthSqrd());
}
pub fn LengthSqrd(self: *const Quat) f32 {
return self.x * self.x + self.y * self.y + self.z * self.z + self.w * self.w;
}
pub fn Normalized(self: *const Quat) Quat {
const length = self.Length();
if (length == 0.0) @panic("Normalizing quaternion with length 0");
return Quat{
.x = self.x / length,
.y = self.y / length,
.z = self.z / length,
.w = self.w / length,
};
}
pub fn NormalizeSelf(self: *Quat) void {
const length = self.Length();
if (length == 0.0) @panic("Normalizing quaternion with length 0");
self.x /= length;
self.y /= length;
self.z /= length;
self.w /= length;
}
pub fn FromToRotation(lhs: *const Quat, rhs: *const Quat) Quat {
return Mul(lhs.GetInverse(), rhs);
}
pub fn Mul(lhs: *const Quat, rhs: *const Quat) Quat {
return Quat{
.x = lhs.w * rhs.x + lhs.x * rhs.w - lhs.y * rhs.z + lhs.z * rhs.y,
.y = lhs.w * rhs.y + lhs.x * rhs.z + lhs.y * rhs.w - lhs.z * rhs.x,
.z = lhs.w * rhs.z - lhs.x * rhs.y + lhs.y * rhs.x + lhs.z * rhs.w,
.w = lhs.w * rhs.w - lhs.x * rhs.x - lhs.y * rhs.y - lhs.z * rhs.z,
};
}
//TODO
//pub fn AngleBetween(lhs: *const Quat, rhs: *const Quat) f32 {}
//TODO lerp
//TODO slerp
};
//TODO testing | src/math/Quat.zig |
const std = @import("std");
const c = @cImport(@cInclude("picohttpparser.h"));
const fmt = std.fmt;
const assert = std.debug.assert;
pub fn addTo(step: *std.build.LibExeObjStep, comptime dir: []const u8) void {
step.addCSourceFile(dir ++ "/lib/picohttpparser.c", &[_][]const u8{});
step.addIncludeDir(dir ++ "/lib");
step.addPackage(.{
.name = "picohttp",
.path = dir ++ "/picohttp.zig",
});
}
pub const Header = struct {
name: []const u8,
value: []const u8,
pub fn isMultiline(self: Header) bool {
return @ptrToInt(self.name.ptr) == 0;
}
pub fn format(self: Header, comptime layout: []const u8, opts: fmt.FormatOptions, writer: anytype) !void {
if (self.isMultiline()) {
try fmt.format(writer, "{s}", .{self.value});
} else {
try fmt.format(writer, "{s}: {s}", .{ self.name, self.value });
}
}
comptime {
assert(@sizeOf(Header) == @sizeOf(c.phr_header));
assert(@alignOf(Header) == @alignOf(c.phr_header));
}
};
pub const Request = struct {
method: []const u8,
path: []const u8,
minor_version: usize,
headers: []const Header,
pub fn parse(buf: []const u8, src: []Header) !Request {
var method: []const u8 = undefined;
var path: []const u8 = undefined;
var minor_version: c_int = undefined;
var num_headers: usize = src.len;
const rc = c.phr_parse_request(
buf.ptr,
buf.len,
@ptrCast([*c][*c]const u8, &method.ptr),
&method.len,
@ptrCast([*c][*c]const u8, &path.ptr),
&path.len,
&minor_version,
@ptrCast([*c]c.phr_header, src.ptr),
&num_headers,
0,
);
return switch (rc) {
-1 => error.BadRequest,
-2 => error.ShortRead,
else => |bytes_read| Request{
.method = method,
.path = path,
.minor_version = @intCast(usize, minor_version),
.headers = src[0..num_headers],
},
};
}
};
test "pico_http: parse request" {
const REQ = "GET /wp-content/uploads/2010/03/hello-kitty-darth-vader-pink.jpg HTTP/1.1\r\n" ++
"Host: www.kittyhell.com\r\n" ++
"User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 " ++
"Pathtraq/0.9\r\n" ++
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" ++
"Accept-Language: ja,en-us;q=0.7,en;q=0.3\r\n" ++
"Accept-Encoding: gzip,deflate\r\n" ++
"Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7\r\n" ++
"Keep-Alive: 115\r\n" ++
"Connection: keep-alive\r\n" ++
"TestMultiline: Hello world\r\n" ++
" This is a second line in the header!\r\n" ++
"Cookie: wp_ozh_wsa_visits=2; wp_ozh_wsa_visit_lasttime=xxxxxxxxxx; " ++
"__utma=xxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.x; " ++
"__utmz=xxxxxxxxx.xxxxxxxxxx.x.x.utmccn=(referral)|utmcsr=reader.livedoor.com|utmcct=/reader/|utmcmd=referral\r\n" ++
"\r\n";
var headers: [32]Header = undefined;
const req = try Request.parse(REQ, &headers);
std.debug.print("Method: {s}\n", .{req.method});
std.debug.print("Path: {s}\n", .{req.path});
std.debug.print("Minor Version: {}\n", .{req.minor_version});
for (req.headers) |header| {
std.debug.print("{}\n", .{header});
}
}
pub const Response = struct {
minor_version: usize,
status_code: usize,
status: []const u8,
headers: []const Header,
pub fn parse(buf: []const u8, src: []Header) !Response {
var minor_version: c_int = undefined;
var status_code: c_int = undefined;
var status: []const u8 = undefined;
var num_headers: usize = src.len;
const rc = c.phr_parse_response(
buf.ptr,
buf.len,
&minor_version,
&status_code,
@ptrCast([*c][*c]const u8, &status.ptr),
&status.len,
@ptrCast([*c]c.phr_header, src.ptr),
&num_headers,
0,
);
return switch (rc) {
-1 => error.BadResponse,
-2 => error.ShortRead,
else => |bytes_read| Response{
.minor_version = @intCast(usize, minor_version),
.status_code = @intCast(usize, status_code),
.status = status,
.headers = src[0..num_headers],
},
};
}
};
test "pico_http: parse response" {
const RES = "HTTP/1.1 200 OK\r\n" ++
"Date: Mon, 22 Mar 2021 08:15:54 GMT\r\n" ++
"Content-Type: text/html; charset=utf-8\r\n" ++
"Content-Length: 9593\r\n" ++
"Connection: keep-alive\r\n" ++
"Server: gunicorn/19.9.0\r\n" ++
"Access-Control-Allow-Origin: *\r\n" ++
"Access-Control-Allow-Credentials: true\r\n" ++
"\r\n";
var headers: [32]Header = undefined;
const res = try Response.parse(RES, &headers);
std.debug.print("Minor Version: {}\n", .{res.minor_version});
std.debug.print("Status Code: {}\n", .{res.status_code});
std.debug.print("Status: {s}\n", .{res.status});
for (res.headers) |header| {
std.debug.print("{}\n", .{header});
}
}
pub const Headers = struct {
headers: []const Header,
pub fn parse(buf: []const u8, src: []Header) !Headers {
var num_headers: usize = src.len;
const rc = c.phr_parse_headers(
buf.ptr,
buf.len,
@ptrCast([*c]c.phr_header, src.ptr),
@ptrCast([*c]usize, &num_headers),
0,
);
return switch (rc) {
-1 => error.BadHeaders,
-2 => error.ShortRead,
else => |bytes_read| Headers{
.headers = src[0..num_headers],
},
};
}
};
test "pico_http: parse headers" {
const HEADERS = "Date: Mon, 22 Mar 2021 08:15:54 GMT\r\n" ++
"Content-Type: text/html; charset=utf-8\r\n" ++
"Content-Length: 9593\r\n" ++
"Connection: keep-alive\r\n" ++
"Server: gunicorn/19.9.0\r\n" ++
"Access-Control-Allow-Origin: *\r\n" ++
"Access-Control-Allow-Credentials: true\r\n" ++
"\r\n";
var headers: [32]Header = undefined;
const result = try Headers.parse(HEADERS, &headers);
for (result.headers) |header| {
std.debug.print("{}\n", .{header});
}
} | picohttp/picohttp.zig |
const std = @import("std");
const types = @import("types.zig");
const descriptors = @import("descriptors.zig");
const Reflector = @This();
allocator: *std.mem.Allocator,
env: *types.JNIEnv,
pub fn init(allocator: *std.mem.Allocator, env: *types.JNIEnv) Reflector {
return .{ .allocator = allocator, .env = env };
}
pub fn getClass(self: *Reflector, name: [*:0]const u8) !Class {
return Class.init(self, try self.env.newReference(.global, try self.env.findClass(name)));
}
pub fn ObjectType(name_: []const u8) type {
return struct {
pub const object_class_name = name_;
};
}
pub const StringChars = union(enum) {
utf8: [:0]const u8,
unicode: []const u16,
};
pub const String = struct {
const Self = @This();
const object_class_name = "java/lang/String";
reflector: *Reflector,
chars: StringChars,
string: types.jstring,
pub fn init(reflector: *Reflector, chars: StringChars) !Self {
var string = try switch (chars) {
.utf8 => |buf| reflector.env.newStringUTF(@ptrCast([*:0]const u8, buf)),
.unicode => |buf| reflector.env.newString(buf),
};
return Self{ .reflector = reflector, .chars = chars, .string = string };
}
/// Only use when a string is `get`-ed
/// Tells the JVM that the string you've obtained is no longer being used
pub fn release(self: Self) void {
switch (self.chars) {
.utf8 => |buf| self.reflector.env.releaseStringUTFChars(self.string, buf),
.unicode => |buf| self.reflector.env.releaseStringChars(self.string, @ptrCast([*]const u16, buf)),
}
}
pub fn toJValue(self: Self) types.jvalue {
return .{ .l = self.string };
}
pub fn fromObject(reflector: *Reflector, object: types.jobject) !Self {
var chars_len = reflector.env.getStringUTFLength(object);
var chars_ret = try reflector.env.getStringUTFChars(object);
return Self{ .reflector = reflector, .chars = .{ .utf8 = @bitCast([:0]const u8, chars_ret.chars[0..@intCast(usize, chars_len)]) }, .string = object };
}
pub fn fromJValue(reflector: *Reflector, value: types.jvalue) !Self {
return fromObject(reflector, value.l);
}
};
fn valueToDescriptor(comptime T: type) descriptors.Descriptor {
if (@typeInfo(T) == .Struct and @hasDecl(T, "object_class_name")) {
return .{ .object = @field(T, "object_class_name") };
}
return switch (T) {
types.jint => .int,
void => .@"void",
else => @compileError("Unsupported type: " ++ @typeName(T)),
};
}
fn funcToMethodDescriptor(comptime func: type) descriptors.MethodDescriptor {
const Fn = @typeInfo(func).Fn;
var parameters: [Fn.args.len]descriptors.Descriptor = undefined;
inline for (Fn.args) |param, u| {
parameters[u] = valueToDescriptor(param.arg_type.?);
}
return .{
.parameters = ¶meters,
.return_type = &valueToDescriptor(Fn.return_type.?),
};
}
fn sm(comptime func: type) type {
return StaticMethod(funcToMethodDescriptor(func));
}
fn nsm(comptime func: type) type {
return Method(funcToMethodDescriptor(func));
}
fn cnsm(comptime func: type) type {
return Constructor(funcToMethodDescriptor(func));
}
pub const Object = struct {
const Self = @This();
class: *Class,
object: types.jobject,
pub fn init(class: *Class, object: types.jobject) Self {
return .{ .class = class, .object = object };
}
};
pub const Class = struct {
const Self = @This();
reflector: *Reflector,
class: types.jclass,
pub fn init(reflector: *Reflector, class: types.jclass) Self {
return .{ .reflector = reflector, .class = class };
}
/// Creates an instance of the current class without invoking constructors
pub fn create(self: *Self) !Object {
return Object.init(self, try self.reflector.env.allocObject(self.class));
}
pub fn getConstructor(self: *Self, comptime func: type) !cnsm(func) {
return try self.getConstructor_(cnsm(func));
}
fn getConstructor_(self: *Self, comptime T: type) !T {
var buf = std.ArrayList(u8).init(self.reflector.allocator);
defer buf.deinit();
try @field(T, "descriptor_").toStringArrayList(&buf);
try buf.append(0);
return T{ .class = self, .method_id = try self.reflector.env.getMethodId(self.class, "<init>", @ptrCast([*:0]const u8, buf.items)) };
}
pub fn getMethod(self: *Self, name: [*:0]const u8, comptime func: type) !nsm(func) {
return try self.getMethod_(nsm(func), name);
}
fn getMethod_(self: *Self, comptime T: type, name: [*:0]const u8) !T {
var buf = std.ArrayList(u8).init(self.reflector.allocator);
defer buf.deinit();
try @field(T, "descriptor_").toStringArrayList(&buf);
try buf.append(0);
return T{ .class = self, .method_id = try self.reflector.env.getMethodId(self.class, name, @ptrCast([*:0]const u8, buf.items)) };
}
pub fn getStaticMethod(self: *Self, name: [*:0]const u8, comptime func: type) !sm(func) {
return try self.getStaticMethod_(sm(func), name);
}
fn getStaticMethod_(self: *Self, comptime T: type, name: [*:0]const u8) !T {
var buf = std.ArrayList(u8).init(self.reflector.allocator);
defer buf.deinit();
try @field(T, "descriptor_").toStringArrayList(&buf);
try buf.append(0);
return T{ .class = self, .method_id = try self.reflector.env.getStaticMethodId(self.class, name, @ptrCast([*:0]const u8, buf.items)) };
}
};
fn MapDescriptorLowLevelType(comptime value: *const descriptors.Descriptor) type {
return switch (value.*) {
.byte => types.jbyte,
.char => types.jchar,
.int => types.jint,
.long => types.jlong,
.short => types.jshort,
.float => types.jfloat,
.double => types.jdouble,
.boolean => types.jboolean,
.void => void,
.object => types.jobject,
.array => types.jarray,
.method => unreachable,
};
}
fn MapDescriptorType(comptime value: *const descriptors.Descriptor) type {
return switch (value.*) {
.byte => types.jbyte,
.char => types.jchar,
.int => types.jint,
.long => types.jlong,
.short => types.jshort,
.float => types.jfloat,
.double => types.jdouble,
.boolean => types.jboolean,
.void => void,
.object => |name| if (std.mem.eql(u8, name, "java/lang/String"))
String
else
types.jobject,
.array => types.jarray,
.method => unreachable,
};
}
fn MapDescriptorToNativeTypeEnum(comptime value: *const descriptors.Descriptor) types.NativeType {
return switch (value.*) {
.byte => .byte,
.char => .char,
.int => .int,
.long => .long,
.short => .short,
.float => .float,
.double => .double,
.boolean => .boolean,
.object, .array => .object,
.void => .void,
.method => unreachable,
};
}
fn ArgsFromDescriptor(comptime descriptor: *const descriptors.MethodDescriptor) type {
var Ts: [descriptor.parameters.len]type = undefined;
for (descriptor.parameters) |param, i| Ts[i] = MapDescriptorType(¶m);
return std.meta.Tuple(&Ts);
}
pub fn Constructor(descriptor: descriptors.MethodDescriptor) type {
return struct {
const Self = @This();
pub const descriptor_ = descriptor;
class: *Class,
method_id: types.jmethodID,
pub fn call(self: Self, args: ArgsFromDescriptor(&descriptor)) !Object {
_ = self;
_ = args;
var processed_args: [args.len]types.jvalue = undefined;
comptime var index: usize = 0;
inline while (index < args.len) : (index += 1) {
processed_args[index] = types.jvalue.toJValue(args[index]);
}
return Object.init(self.class, try self.callJValues(&processed_args));
}
pub fn callJValues(self: Self, args: []types.jvalue) types.JNIEnv.NewObjectError!types.jobject {
return self.class.reflector.env.newObject(self.class.class, self.method_id, if (args.len == 0) null else @ptrCast([*]types.jvalue, args));
}
};
}
pub fn Method(descriptor: descriptors.MethodDescriptor) type {
return struct {
const Self = @This();
pub const descriptor_ = descriptor;
class: *Class,
method_id: types.jmethodID,
pub fn call(self: Self, object: Object, args: ArgsFromDescriptor(&descriptor)) !MapDescriptorType(descriptor.return_type) {
_ = self;
_ = args;
var processed_args: [args.len]types.jvalue = undefined;
comptime var index: usize = 0;
inline while (index < args.len) : (index += 1) {
processed_args[index] = types.jvalue.toJValue(args[index]);
}
var ret = try self.callJValues(object.object, &processed_args);
const mdt = MapDescriptorType(descriptor.return_type);
return if (@typeInfo(mdt) == .Struct and @hasDecl(mdt, "fromJValue")) @field(mdt, "fromJValue")(self.class.reflector, .{ .l = ret }) else ret;
}
pub fn callJValues(self: Self, object: types.jobject, args: []types.jvalue) types.JNIEnv.CallStaticMethodError!MapDescriptorLowLevelType(descriptor.return_type) {
return self.class.reflector.env.callMethod(comptime MapDescriptorToNativeTypeEnum(descriptor.return_type), object, self.method_id, if (args.len == 0) null else @ptrCast([*]types.jvalue, args));
}
};
}
pub fn StaticMethod(descriptor: descriptors.MethodDescriptor) type {
return struct {
const Self = @This();
const descriptor_ = descriptor;
class: *Class,
method_id: types.jmethodID,
pub fn call(self: Self, args: ArgsFromDescriptor(&descriptor)) !MapDescriptorType(descriptor.return_type) {
_ = self;
_ = args;
var processed_args: [args.len]types.jvalue = undefined;
comptime var index: usize = 0;
inline while (index < args.len) : (index += 1) {
processed_args[index] = types.jvalue.toJValue(args[index]);
}
var ret = try self.callJValues(&processed_args);
const mdt = MapDescriptorType(descriptor.return_type);
return if (@typeInfo(mdt) == .Struct and @hasDecl(mdt, "fromJValue")) @field(mdt, "fromJValue")(self.class.reflector, .{ .l = ret }) else ret;
}
pub fn callJValues(self: Self, args: []types.jvalue) types.JNIEnv.CallStaticMethodError!MapDescriptorLowLevelType(descriptor.return_type) {
return self.class.reflector.env.callStaticMethod(comptime MapDescriptorToNativeTypeEnum(descriptor.return_type), self.class.class, self.method_id, if (args.len == 0) null else @ptrCast([*]types.jvalue, args));
}
};
} | src/Reflector.zig |
pub const CGD_DEFAULT = @as(u32, 0);
pub const CGD_UNKNOWN_PROPERTY = @as(u32, 0);
pub const CGD_STRING_PROPERTY = @as(u32, 1);
pub const CGD_DATE_PROPERTY = @as(u32, 2);
pub const CGD_BINARY_PROPERTY = @as(u32, 4);
pub const CGD_ARRAY_NODE = @as(u32, 8);
//--------------------------------------------------------------------------------
// Section: Types (7)
//--------------------------------------------------------------------------------
const CLSID_Contact_Value = @import("../zig.zig").Guid.initString("61b68808-8eee-4fd1-acb8-3d804c8db056");
pub const CLSID_Contact = &CLSID_Contact_Value;
const CLSID_ContactManager_Value = @import("../zig.zig").Guid.initString("7165c8ab-af88-42bd-86fd-5310b4285a02");
pub const CLSID_ContactManager = &CLSID_ContactManager_Value;
// TODO: this type is limited to platform 'windows6.0.6000'
const IID_IContactManager_Value = @import("../zig.zig").Guid.initString("ad553d98-deb1-474a-8e17-fc0c2075b738");
pub const IID_IContactManager = &IID_IContactManager_Value;
pub const IContactManager = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Initialize: fn(
self: *const IContactManager,
pszAppName: ?[*:0]const u16,
pszAppVersion: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Load: fn(
self: *const IContactManager,
pszContactID: ?[*:0]const u16,
ppContact: ?*?*IContact,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MergeContactIDs: fn(
self: *const IContactManager,
pszNewContactID: ?[*:0]const u16,
pszOldContactID: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMeContact: fn(
self: *const IContactManager,
ppMeContact: ?*?*IContact,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMeContact: fn(
self: *const IContactManager,
pMeContact: ?*IContact,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetContactCollection: fn(
self: *const IContactManager,
ppContactCollection: ?*?*IContactCollection,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactManager_Initialize(self: *const T, pszAppName: ?[*:0]const u16, pszAppVersion: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactManager.VTable, self.vtable).Initialize(@ptrCast(*const IContactManager, self), pszAppName, pszAppVersion);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactManager_Load(self: *const T, pszContactID: ?[*:0]const u16, ppContact: ?*?*IContact) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactManager.VTable, self.vtable).Load(@ptrCast(*const IContactManager, self), pszContactID, ppContact);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactManager_MergeContactIDs(self: *const T, pszNewContactID: ?[*:0]const u16, pszOldContactID: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactManager.VTable, self.vtable).MergeContactIDs(@ptrCast(*const IContactManager, self), pszNewContactID, pszOldContactID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactManager_GetMeContact(self: *const T, ppMeContact: ?*?*IContact) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactManager.VTable, self.vtable).GetMeContact(@ptrCast(*const IContactManager, self), ppMeContact);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactManager_SetMeContact(self: *const T, pMeContact: ?*IContact) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactManager.VTable, self.vtable).SetMeContact(@ptrCast(*const IContactManager, self), pMeContact);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactManager_GetContactCollection(self: *const T, ppContactCollection: ?*?*IContactCollection) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactManager.VTable, self.vtable).GetContactCollection(@ptrCast(*const IContactManager, self), ppContactCollection);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.0.6000'
const IID_IContactCollection_Value = @import("../zig.zig").Guid.initString("b6afa338-d779-11d9-8bde-f66bad1e3f3a");
pub const IID_IContactCollection = &IID_IContactCollection_Value;
pub const IContactCollection = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Reset: fn(
self: *const IContactCollection,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Next: fn(
self: *const IContactCollection,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCurrent: fn(
self: *const IContactCollection,
ppContact: ?*?*IContact,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactCollection_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactCollection.VTable, self.vtable).Reset(@ptrCast(*const IContactCollection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactCollection_Next(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactCollection.VTable, self.vtable).Next(@ptrCast(*const IContactCollection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactCollection_GetCurrent(self: *const T, ppContact: ?*?*IContact) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactCollection.VTable, self.vtable).GetCurrent(@ptrCast(*const IContactCollection, self), ppContact);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.0.6000'
const IID_IContactProperties_Value = @import("../zig.zig").Guid.initString("70dd27dd-5cbd-46e8-bef0-23b6b346288f");
pub const IID_IContactProperties = &IID_IContactProperties_Value;
pub const IContactProperties = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetString: fn(
self: *const IContactProperties,
pszPropertyName: ?[*:0]const u16,
dwFlags: u32,
pszValue: [*:0]u16,
cchValue: u32,
pdwcchPropertyValueRequired: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDate: fn(
self: *const IContactProperties,
pszPropertyName: ?[*:0]const u16,
dwFlags: u32,
pftDateTime: ?*FILETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBinary: fn(
self: *const IContactProperties,
pszPropertyName: ?[*:0]const u16,
dwFlags: u32,
pszContentType: [*:0]u16,
cchContentType: u32,
pdwcchContentTypeRequired: ?*u32,
ppStream: ?*?*IStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLabels: fn(
self: *const IContactProperties,
pszArrayElementName: ?[*:0]const u16,
dwFlags: u32,
pszLabels: [*:0]u16,
cchLabels: u32,
pdwcchLabelsRequired: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetString: fn(
self: *const IContactProperties,
pszPropertyName: ?[*:0]const u16,
dwFlags: u32,
pszValue: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDate: fn(
self: *const IContactProperties,
pszPropertyName: ?[*:0]const u16,
dwFlags: u32,
ftDateTime: FILETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBinary: fn(
self: *const IContactProperties,
pszPropertyName: ?[*:0]const u16,
dwFlags: u32,
pszContentType: ?[*:0]const u16,
pStream: ?*IStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetLabels: fn(
self: *const IContactProperties,
pszArrayElementName: ?[*:0]const u16,
dwFlags: u32,
dwLabelCount: u32,
ppszLabels: [*]?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateArrayNode: fn(
self: *const IContactProperties,
pszArrayName: ?[*:0]const u16,
dwFlags: u32,
fAppend: BOOL,
pszNewArrayElementName: [*:0]u16,
cchNewArrayElementName: u32,
pdwcchNewArrayElementNameRequired: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteProperty: fn(
self: *const IContactProperties,
pszPropertyName: ?[*:0]const u16,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteArrayNode: fn(
self: *const IContactProperties,
pszArrayElementName: ?[*:0]const u16,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteLabels: fn(
self: *const IContactProperties,
pszArrayElementName: ?[*:0]const u16,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyCollection: fn(
self: *const IContactProperties,
ppPropertyCollection: ?*?*IContactPropertyCollection,
dwFlags: u32,
pszMultiValueName: ?[*:0]const u16,
dwLabelCount: u32,
ppszLabels: [*]?PWSTR,
fAnyLabelMatches: 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 IContactProperties_GetString(self: *const T, pszPropertyName: ?[*:0]const u16, dwFlags: u32, pszValue: [*:0]u16, cchValue: u32, pdwcchPropertyValueRequired: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).GetString(@ptrCast(*const IContactProperties, self), pszPropertyName, dwFlags, pszValue, cchValue, pdwcchPropertyValueRequired);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_GetDate(self: *const T, pszPropertyName: ?[*:0]const u16, dwFlags: u32, pftDateTime: ?*FILETIME) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).GetDate(@ptrCast(*const IContactProperties, self), pszPropertyName, dwFlags, pftDateTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_GetBinary(self: *const T, pszPropertyName: ?[*:0]const u16, dwFlags: u32, pszContentType: [*:0]u16, cchContentType: u32, pdwcchContentTypeRequired: ?*u32, ppStream: ?*?*IStream) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).GetBinary(@ptrCast(*const IContactProperties, self), pszPropertyName, dwFlags, pszContentType, cchContentType, pdwcchContentTypeRequired, ppStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_GetLabels(self: *const T, pszArrayElementName: ?[*:0]const u16, dwFlags: u32, pszLabels: [*:0]u16, cchLabels: u32, pdwcchLabelsRequired: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).GetLabels(@ptrCast(*const IContactProperties, self), pszArrayElementName, dwFlags, pszLabels, cchLabels, pdwcchLabelsRequired);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_SetString(self: *const T, pszPropertyName: ?[*:0]const u16, dwFlags: u32, pszValue: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).SetString(@ptrCast(*const IContactProperties, self), pszPropertyName, dwFlags, pszValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_SetDate(self: *const T, pszPropertyName: ?[*:0]const u16, dwFlags: u32, ftDateTime: FILETIME) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).SetDate(@ptrCast(*const IContactProperties, self), pszPropertyName, dwFlags, ftDateTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_SetBinary(self: *const T, pszPropertyName: ?[*:0]const u16, dwFlags: u32, pszContentType: ?[*:0]const u16, pStream: ?*IStream) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).SetBinary(@ptrCast(*const IContactProperties, self), pszPropertyName, dwFlags, pszContentType, pStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_SetLabels(self: *const T, pszArrayElementName: ?[*:0]const u16, dwFlags: u32, dwLabelCount: u32, ppszLabels: [*]?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).SetLabels(@ptrCast(*const IContactProperties, self), pszArrayElementName, dwFlags, dwLabelCount, ppszLabels);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_CreateArrayNode(self: *const T, pszArrayName: ?[*:0]const u16, dwFlags: u32, fAppend: BOOL, pszNewArrayElementName: [*:0]u16, cchNewArrayElementName: u32, pdwcchNewArrayElementNameRequired: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).CreateArrayNode(@ptrCast(*const IContactProperties, self), pszArrayName, dwFlags, fAppend, pszNewArrayElementName, cchNewArrayElementName, pdwcchNewArrayElementNameRequired);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_DeleteProperty(self: *const T, pszPropertyName: ?[*:0]const u16, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).DeleteProperty(@ptrCast(*const IContactProperties, self), pszPropertyName, dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_DeleteArrayNode(self: *const T, pszArrayElementName: ?[*:0]const u16, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).DeleteArrayNode(@ptrCast(*const IContactProperties, self), pszArrayElementName, dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_DeleteLabels(self: *const T, pszArrayElementName: ?[*:0]const u16, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).DeleteLabels(@ptrCast(*const IContactProperties, self), pszArrayElementName, dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactProperties_GetPropertyCollection(self: *const T, ppPropertyCollection: ?*?*IContactPropertyCollection, dwFlags: u32, pszMultiValueName: ?[*:0]const u16, dwLabelCount: u32, ppszLabels: [*]?PWSTR, fAnyLabelMatches: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactProperties.VTable, self.vtable).GetPropertyCollection(@ptrCast(*const IContactProperties, self), ppPropertyCollection, dwFlags, pszMultiValueName, dwLabelCount, ppszLabels, fAnyLabelMatches);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.0.6000'
const IID_IContact_Value = @import("../zig.zig").Guid.initString("f941b671-bda7-4f77-884a-f46462f226a7");
pub const IID_IContact = &IID_IContact_Value;
pub const IContact = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetContactID: fn(
self: *const IContact,
pszContactID: [*:0]u16,
cchContactID: u32,
pdwcchContactIDRequired: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPath: fn(
self: *const IContact,
pszPath: [*:0]u16,
cchPath: u32,
pdwcchPathRequired: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CommitChanges: fn(
self: *const IContact,
dwCommitFlags: 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 IContact_GetContactID(self: *const T, pszContactID: [*:0]u16, cchContactID: u32, pdwcchContactIDRequired: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContact.VTable, self.vtable).GetContactID(@ptrCast(*const IContact, self), pszContactID, cchContactID, pdwcchContactIDRequired);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContact_GetPath(self: *const T, pszPath: [*:0]u16, cchPath: u32, pdwcchPathRequired: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContact.VTable, self.vtable).GetPath(@ptrCast(*const IContact, self), pszPath, cchPath, pdwcchPathRequired);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContact_CommitChanges(self: *const T, dwCommitFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContact.VTable, self.vtable).CommitChanges(@ptrCast(*const IContact, self), dwCommitFlags);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.0.6000'
const IID_IContactPropertyCollection_Value = @import("../zig.zig").Guid.initString("ffd3adf8-fa64-4328-b1b6-2e0db509cb3c");
pub const IID_IContactPropertyCollection = &IID_IContactPropertyCollection_Value;
pub const IContactPropertyCollection = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Reset: fn(
self: *const IContactPropertyCollection,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Next: fn(
self: *const IContactPropertyCollection,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyName: fn(
self: *const IContactPropertyCollection,
pszPropertyName: [*:0]u16,
cchPropertyName: u32,
pdwcchPropertyNameRequired: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyType: fn(
self: *const IContactPropertyCollection,
pdwType: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyVersion: fn(
self: *const IContactPropertyCollection,
pdwVersion: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyModificationDate: fn(
self: *const IContactPropertyCollection,
pftModificationDate: ?*FILETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyArrayElementID: fn(
self: *const IContactPropertyCollection,
pszArrayElementID: [*:0]u16,
cchArrayElementID: u32,
pdwcchArrayElementIDRequired: ?*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 IContactPropertyCollection_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactPropertyCollection.VTable, self.vtable).Reset(@ptrCast(*const IContactPropertyCollection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactPropertyCollection_Next(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactPropertyCollection.VTable, self.vtable).Next(@ptrCast(*const IContactPropertyCollection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactPropertyCollection_GetPropertyName(self: *const T, pszPropertyName: [*:0]u16, cchPropertyName: u32, pdwcchPropertyNameRequired: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactPropertyCollection.VTable, self.vtable).GetPropertyName(@ptrCast(*const IContactPropertyCollection, self), pszPropertyName, cchPropertyName, pdwcchPropertyNameRequired);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactPropertyCollection_GetPropertyType(self: *const T, pdwType: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactPropertyCollection.VTable, self.vtable).GetPropertyType(@ptrCast(*const IContactPropertyCollection, self), pdwType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactPropertyCollection_GetPropertyVersion(self: *const T, pdwVersion: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactPropertyCollection.VTable, self.vtable).GetPropertyVersion(@ptrCast(*const IContactPropertyCollection, self), pdwVersion);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactPropertyCollection_GetPropertyModificationDate(self: *const T, pftModificationDate: ?*FILETIME) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactPropertyCollection.VTable, self.vtable).GetPropertyModificationDate(@ptrCast(*const IContactPropertyCollection, self), pftModificationDate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IContactPropertyCollection_GetPropertyArrayElementID(self: *const T, pszArrayElementID: [*:0]u16, cchArrayElementID: u32, pdwcchArrayElementIDRequired: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IContactPropertyCollection.VTable, self.vtable).GetPropertyArrayElementID(@ptrCast(*const IContactPropertyCollection, self), pszArrayElementID, cchArrayElementID, pdwcchArrayElementIDRequired);
}
};}
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 (6)
//--------------------------------------------------------------------------------
const BOOL = @import("../foundation.zig").BOOL;
const FILETIME = @import("../foundation.zig").FILETIME;
const HRESULT = @import("../foundation.zig").HRESULT;
const IStream = @import("../storage/structured_storage.zig").IStream;
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;
}
}
} | deps/zigwin32/win32/system/contacts.zig |
pub const SP_LOW_CONFIDENCE = @as(i32, -1);
pub const SP_NORMAL_CONFIDENCE = @as(u32, 0);
pub const DEFAULT_WEIGHT = @as(u32, 1);
pub const SP_MAX_WORD_LENGTH = @as(u32, 128);
pub const SP_MAX_PRON_LENGTH = @as(u32, 384);
pub const SP_EMULATE_RESULT = @as(u32, 1073741824);
pub const SP_STREAMPOS_ASAP = @as(u32, 0);
pub const SP_STREAMPOS_REALTIME = @as(i32, -1);
pub const SPRP_NORMAL = @as(u32, 0);
pub const SP_MAX_LANGIDS = @as(u32, 20);
pub const Speech_Default_Weight = @as(f32, 1);
pub const Speech_Max_Word_Length = @as(i32, 128);
pub const Speech_Max_Pron_Length = @as(i32, 384);
pub const Speech_StreamPos_Asap = @as(i32, 0);
pub const Speech_StreamPos_RealTime = @as(i32, -1);
pub const SpeechAllElements = @as(i32, -1);
//--------------------------------------------------------------------------------
// Section: Types (294)
//--------------------------------------------------------------------------------
const CLSID_SpNotifyTranslator_Value = @import("../zig.zig").Guid.initString("e2ae5372-5d40-11d2-960e-00c04f8ee628");
pub const CLSID_SpNotifyTranslator = &CLSID_SpNotifyTranslator_Value;
const CLSID_SpObjectTokenCategory_Value = @import("../zig.zig").Guid.initString("a910187f-0c7a-45ac-92<PASSWORD>");
pub const CLSID_SpObjectTokenCategory = &CLSID_SpObjectTokenCategory_Value;
const CLSID_SpObjectToken_Value = @import("../zig.zig").Guid.initString("ef411752-3736-4cb4-9c8c-8ef4ccb58efe");
pub const CLSID_SpObjectToken = &CLSID_SpObjectToken_Value;
const CLSID_SpResourceManager_Value = @import("../zig.zig").Guid.initString("96749373-3391-11d2-9ee3-00c04f797396");
pub const CLSID_SpResourceManager = &CLSID_SpResourceManager_Value;
const CLSID_SpStreamFormatConverter_Value = @import("../zig.zig").Guid.initString("7013943a-e2ec-11d2-a086-00c04f8ef9b5");
pub const CLSID_SpStreamFormatConverter = &CLSID_SpStreamFormatConverter_Value;
const CLSID_SpMMAudioEnum_Value = @import("../zig.zig").Guid.initString("ab1890a0-e91f-11d2-bb91-00c04f8ee6c0");
pub const CLSID_SpMMAudioEnum = &CLSID_SpMMAudioEnum_Value;
const CLSID_SpMMAudioIn_Value = @import("../zig.zig").Guid.initString("cf3d2e50-53f2-11d2-960c-00c04f8ee628");
pub const CLSID_SpMMAudioIn = &CLSID_SpMMAudioIn_Value;
const CLSID_SpMMAudioOut_Value = @import("../zig.zig").Guid.initString("a8c680eb-3d32-11d2-9ee7-00c04f797396");
pub const CLSID_SpMMAudioOut = &CLSID_SpMMAudioOut_Value;
const CLSID_SpStream_Value = @import("../zig.zig").Guid.initString("715d9c59-4442-11d2-9605-00c04f8ee628");
pub const CLSID_SpStream = &CLSID_SpStream_Value;
const CLSID_SpVoice_Value = @import("../zig.zig").Guid.initString("96749377-3391-11d2-9ee3-00c04f797396");
pub const CLSID_SpVoice = &CLSID_SpVoice_Value;
const CLSID_SpSharedRecoContext_Value = @import("../zig.zig").Guid.initString("47206204-5eca-11d2-960f-00c04f8ee628");
pub const CLSID_SpSharedRecoContext = &CLSID_SpSharedRecoContext_Value;
const CLSID_SpInprocRecognizer_Value = @import("../zig.zig").Guid.initString("41b89b6b-9399-11d2-9623-00c04f8ee628");
pub const CLSID_SpInprocRecognizer = &CLSID_SpInprocRecognizer_Value;
const CLSID_SpSharedRecognizer_Value = @import("../zig.zig").Guid.initString("3bee4890-4fe9-4a37-8c1e-5e7e12791c1f");
pub const CLSID_SpSharedRecognizer = &CLSID_SpSharedRecognizer_Value;
const CLSID_SpLexicon_Value = @import("../zig.zig").Guid.initString("0655e396-25d0-11d3-9c26-00c04f8ef87c");
pub const CLSID_SpLexicon = &CLSID_SpLexicon_Value;
const CLSID_SpUnCompressedLexicon_Value = @import("../zig.zig").Guid.initString("c9e37c15-df92-4727-85d6-72e5eeb6995a");
pub const CLSID_SpUnCompressedLexicon = &CLSID_SpUnCompressedLexicon_Value;
const CLSID_SpCompressedLexicon_Value = @import("../zig.zig").Guid.initString("90903716-2f42-11d3-9c26-00c04f8ef87c");
pub const CLSID_SpCompressedLexicon = &CLSID_SpCompressedLexicon_Value;
const CLSID_SpShortcut_Value = @import("../zig.zig").Guid.initString("0d722f1a-9fcf-4e62-96d8-6df8f01a26aa");
pub const CLSID_SpShortcut = &CLSID_SpShortcut_Value;
const CLSID_SpPhoneConverter_Value = @import("../zig.zig").Guid.initString("9185f743-1143-4c28-86b5-bff14f20e5c8");
pub const CLSID_SpPhoneConverter = &CLSID_SpPhoneConverter_Value;
const CLSID_SpPhoneticAlphabetConverter_Value = @import("../zig.zig").Guid.initString("4f414126-dfe3-4629-99ee-797978317ead");
pub const CLSID_SpPhoneticAlphabetConverter = &CLSID_SpPhoneticAlphabetConverter_Value;
const CLSID_SpNullPhoneConverter_Value = @import("../zig.zig").Guid.initString("455f24e9-7396-4a16-9715-7c0fdbe3efe3");
pub const CLSID_SpNullPhoneConverter = &CLSID_SpNullPhoneConverter_Value;
const CLSID_SpTextSelectionInformation_Value = @import("../zig.zig").Guid.initString("0f92030a-cbfd-4ab8-a164-ff5985547ff6");
pub const CLSID_SpTextSelectionInformation = &CLSID_SpTextSelectionInformation_Value;
const CLSID_SpPhraseInfoBuilder_Value = @import("../zig.zig").Guid.initString("c23fc28d-c55f-4720-8b32-91f73c2bd5d1");
pub const CLSID_SpPhraseInfoBuilder = &CLSID_SpPhraseInfoBuilder_Value;
const CLSID_SpAudioFormat_Value = @import("../zig.zig").Guid.initString("9ef96870-e160-4792-820d-48cf0649e4ec");
pub const CLSID_SpAudioFormat = &CLSID_SpAudioFormat_Value;
const CLSID_SpWaveFormatEx_Value = @import("../zig.zig").Guid.initString("c79a574c-63be-44b9-801f-283f87f898be");
pub const CLSID_SpWaveFormatEx = &CLSID_SpWaveFormatEx_Value;
const CLSID_SpInProcRecoContext_Value = @import("../zig.zig").Guid.initString("73ad6842-ace0-45e8-a4dd-8795881a2c2a");
pub const CLSID_SpInProcRecoContext = &CLSID_SpInProcRecoContext_Value;
const CLSID_SpCustomStream_Value = @import("../zig.zig").Guid.initString("8dbef13f-1948-4aa8-8cf0-048eebed95d8");
pub const CLSID_SpCustomStream = &CLSID_SpCustomStream_Value;
const CLSID_SpFileStream_Value = @import("../zig.zig").Guid.initString("947812b3-2ae1-4644-ba86-9e90ded7ec91");
pub const CLSID_SpFileStream = &CLSID_SpFileStream_Value;
const CLSID_SpMemoryStream_Value = @import("../zig.zig").Guid.initString("5fb7ef7d-dff4-468a-b6b7-2fcbd188f994");
pub const CLSID_SpMemoryStream = &CLSID_SpMemoryStream_Value;
pub const SPDATAKEYLOCATION = enum(i32) {
DefaultLocation = 0,
CurrentUser = 1,
LocalMachine = 2,
CurrentConfig = 5,
};
pub const SPDKL_DefaultLocation = SPDATAKEYLOCATION.DefaultLocation;
pub const SPDKL_CurrentUser = SPDATAKEYLOCATION.CurrentUser;
pub const SPDKL_LocalMachine = SPDATAKEYLOCATION.LocalMachine;
pub const SPDKL_CurrentConfig = SPDATAKEYLOCATION.CurrentConfig;
pub const SPSTREAMFORMAT = enum(i32) {
Default = -1,
NoAssignedFormat = 0,
Text = 1,
NonStandardFormat = 2,
ExtendedAudioFormat = 3,
@"8kHz8BitMono" = 4,
@"8kHz8BitStereo" = 5,
@"8kHz16BitMono" = 6,
@"8kHz16BitStereo" = 7,
@"11kHz8BitMono" = 8,
@"11kHz8BitStereo" = 9,
@"11kHz16BitMono" = 10,
@"11kHz16BitStereo" = 11,
@"12kHz8BitMono" = 12,
@"12kHz8BitStereo" = 13,
@"12kHz16BitMono" = 14,
@"12kHz16BitStereo" = 15,
@"16kHz8BitMono" = 16,
@"16kHz8BitStereo" = 17,
@"16kHz16BitMono" = 18,
@"16kHz16BitStereo" = 19,
@"22kHz8BitMono" = 20,
@"22kHz8BitStereo" = 21,
@"22kHz16BitMono" = 22,
@"22kHz16BitStereo" = 23,
@"24kHz8BitMono" = 24,
@"24kHz8BitStereo" = 25,
@"24kHz16BitMono" = 26,
@"24kHz16BitStereo" = 27,
@"32kHz8BitMono" = 28,
@"32kHz8BitStereo" = 29,
@"32kHz16BitMono" = 30,
@"32kHz16BitStereo" = 31,
@"44kHz8BitMono" = 32,
@"44kHz8BitStereo" = 33,
@"44kHz16BitMono" = 34,
@"44kHz16BitStereo" = 35,
@"48kHz8BitMono" = 36,
@"48kHz8BitStereo" = 37,
@"48kHz16BitMono" = 38,
@"48kHz16BitStereo" = 39,
TrueSpeech_8kHz1BitMono = 40,
CCITT_ALaw_8kHzMono = 41,
CCITT_ALaw_8kHzStereo = 42,
CCITT_ALaw_11kHzMono = 43,
CCITT_ALaw_11kHzStereo = 44,
CCITT_ALaw_22kHzMono = 45,
CCITT_ALaw_22kHzStereo = 46,
CCITT_ALaw_44kHzMono = 47,
CCITT_ALaw_44kHzStereo = 48,
CCITT_uLaw_8kHzMono = 49,
CCITT_uLaw_8kHzStereo = 50,
CCITT_uLaw_11kHzMono = 51,
CCITT_uLaw_11kHzStereo = 52,
CCITT_uLaw_22kHzMono = 53,
CCITT_uLaw_22kHzStereo = 54,
CCITT_uLaw_44kHzMono = 55,
CCITT_uLaw_44kHzStereo = 56,
ADPCM_8kHzMono = 57,
ADPCM_8kHzStereo = 58,
ADPCM_11kHzMono = 59,
ADPCM_11kHzStereo = 60,
ADPCM_22kHzMono = 61,
ADPCM_22kHzStereo = 62,
ADPCM_44kHzMono = 63,
ADPCM_44kHzStereo = 64,
GSM610_8kHzMono = 65,
GSM610_11kHzMono = 66,
GSM610_22kHzMono = 67,
GSM610_44kHzMono = 68,
NUM_FORMATS = 69,
};
pub const SPSF_Default = SPSTREAMFORMAT.Default;
pub const SPSF_NoAssignedFormat = SPSTREAMFORMAT.NoAssignedFormat;
pub const SPSF_Text = SPSTREAMFORMAT.Text;
pub const SPSF_NonStandardFormat = SPSTREAMFORMAT.NonStandardFormat;
pub const SPSF_ExtendedAudioFormat = SPSTREAMFORMAT.ExtendedAudioFormat;
pub const SPSF_8kHz8BitMono = SPSTREAMFORMAT.@"8kHz8BitMono";
pub const SPSF_8kHz8BitStereo = SPSTREAMFORMAT.@"8kHz8BitStereo";
pub const SPSF_8kHz16BitMono = SPSTREAMFORMAT.@"8kHz16BitMono";
pub const SPSF_8kHz16BitStereo = SPSTREAMFORMAT.@"8kHz16BitStereo";
pub const SPSF_11kHz8BitMono = SPSTREAMFORMAT.@"11kHz8BitMono";
pub const SPSF_11kHz8BitStereo = SPSTREAMFORMAT.@"11kHz8BitStereo";
pub const SPSF_11kHz16BitMono = SPSTREAMFORMAT.@"11kHz16BitMono";
pub const SPSF_11kHz16BitStereo = SPSTREAMFORMAT.@"11kHz16BitStereo";
pub const SPSF_12kHz8BitMono = SPSTREAMFORMAT.@"12kHz8BitMono";
pub const SPSF_12kHz8BitStereo = SPSTREAMFORMAT.@"12kHz8BitStereo";
pub const SPSF_12kHz16BitMono = SPSTREAMFORMAT.@"12kHz16BitMono";
pub const SPSF_12kHz16BitStereo = SPSTREAMFORMAT.@"12kHz16BitStereo";
pub const SPSF_16kHz8BitMono = SPSTREAMFORMAT.@"16kHz8BitMono";
pub const SPSF_16kHz8BitStereo = SPSTREAMFORMAT.@"16kHz8BitStereo";
pub const SPSF_16kHz16BitMono = SPSTREAMFORMAT.@"16kHz16BitMono";
pub const SPSF_16kHz16BitStereo = SPSTREAMFORMAT.@"16kHz16BitStereo";
pub const SPSF_22kHz8BitMono = SPSTREAMFORMAT.@"22kHz8BitMono";
pub const SPSF_22kHz8BitStereo = SPSTREAMFORMAT.@"22kHz8BitStereo";
pub const SPSF_22kHz16BitMono = SPSTREAMFORMAT.@"22kHz16BitMono";
pub const SPSF_22kHz16BitStereo = SPSTREAMFORMAT.@"22kHz16BitStereo";
pub const SPSF_24kHz8BitMono = SPSTREAMFORMAT.@"24kHz8BitMono";
pub const SPSF_24kHz8BitStereo = SPSTREAMFORMAT.@"24kHz8BitStereo";
pub const SPSF_24kHz16BitMono = SPSTREAMFORMAT.@"24kHz16BitMono";
pub const SPSF_24kHz16BitStereo = SPSTREAMFORMAT.@"24kHz16BitStereo";
pub const SPSF_32kHz8BitMono = SPSTREAMFORMAT.@"32kHz8BitMono";
pub const SPSF_32kHz8BitStereo = SPSTREAMFORMAT.@"32kHz8BitStereo";
pub const SPSF_32kHz16BitMono = SPSTREAMFORMAT.@"32kHz16BitMono";
pub const SPSF_32kHz16BitStereo = SPSTREAMFORMAT.@"32kHz16BitStereo";
pub const SPSF_44kHz8BitMono = SPSTREAMFORMAT.@"44kHz8BitMono";
pub const SPSF_44kHz8BitStereo = SPSTREAMFORMAT.@"44kHz8BitStereo";
pub const SPSF_44kHz16BitMono = SPSTREAMFORMAT.@"44kHz16BitMono";
pub const SPSF_44kHz16BitStereo = SPSTREAMFORMAT.@"44kHz16BitStereo";
pub const SPSF_48kHz8BitMono = SPSTREAMFORMAT.@"48kHz8BitMono";
pub const SPSF_48kHz8BitStereo = SPSTREAMFORMAT.@"48kHz8BitStereo";
pub const SPSF_48kHz16BitMono = SPSTREAMFORMAT.@"48kHz16BitMono";
pub const SPSF_48kHz16BitStereo = SPSTREAMFORMAT.@"48kHz16BitStereo";
pub const SPSF_TrueSpeech_8kHz1BitMono = SPSTREAMFORMAT.TrueSpeech_8kHz1BitMono;
pub const SPSF_CCITT_ALaw_8kHzMono = SPSTREAMFORMAT.CCITT_ALaw_8kHzMono;
pub const SPSF_CCITT_ALaw_8kHzStereo = SPSTREAMFORMAT.CCITT_ALaw_8kHzStereo;
pub const SPSF_CCITT_ALaw_11kHzMono = SPSTREAMFORMAT.CCITT_ALaw_11kHzMono;
pub const SPSF_CCITT_ALaw_11kHzStereo = SPSTREAMFORMAT.CCITT_ALaw_11kHzStereo;
pub const SPSF_CCITT_ALaw_22kHzMono = SPSTREAMFORMAT.CCITT_ALaw_22kHzMono;
pub const SPSF_CCITT_ALaw_22kHzStereo = SPSTREAMFORMAT.CCITT_ALaw_22kHzStereo;
pub const SPSF_CCITT_ALaw_44kHzMono = SPSTREAMFORMAT.CCITT_ALaw_44kHzMono;
pub const SPSF_CCITT_ALaw_44kHzStereo = SPSTREAMFORMAT.CCITT_ALaw_44kHzStereo;
pub const SPSF_CCITT_uLaw_8kHzMono = SPSTREAMFORMAT.CCITT_uLaw_8kHzMono;
pub const SPSF_CCITT_uLaw_8kHzStereo = SPSTREAMFORMAT.CCITT_uLaw_8kHzStereo;
pub const SPSF_CCITT_uLaw_11kHzMono = SPSTREAMFORMAT.CCITT_uLaw_11kHzMono;
pub const SPSF_CCITT_uLaw_11kHzStereo = SPSTREAMFORMAT.CCITT_uLaw_11kHzStereo;
pub const SPSF_CCITT_uLaw_22kHzMono = SPSTREAMFORMAT.CCITT_uLaw_22kHzMono;
pub const SPSF_CCITT_uLaw_22kHzStereo = SPSTREAMFORMAT.CCITT_uLaw_22kHzStereo;
pub const SPSF_CCITT_uLaw_44kHzMono = SPSTREAMFORMAT.CCITT_uLaw_44kHzMono;
pub const SPSF_CCITT_uLaw_44kHzStereo = SPSTREAMFORMAT.CCITT_uLaw_44kHzStereo;
pub const SPSF_ADPCM_8kHzMono = SPSTREAMFORMAT.ADPCM_8kHzMono;
pub const SPSF_ADPCM_8kHzStereo = SPSTREAMFORMAT.ADPCM_8kHzStereo;
pub const SPSF_ADPCM_11kHzMono = SPSTREAMFORMAT.ADPCM_11kHzMono;
pub const SPSF_ADPCM_11kHzStereo = SPSTREAMFORMAT.ADPCM_11kHzStereo;
pub const SPSF_ADPCM_22kHzMono = SPSTREAMFORMAT.ADPCM_22kHzMono;
pub const SPSF_ADPCM_22kHzStereo = SPSTREAMFORMAT.ADPCM_22kHzStereo;
pub const SPSF_ADPCM_44kHzMono = SPSTREAMFORMAT.ADPCM_44kHzMono;
pub const SPSF_ADPCM_44kHzStereo = SPSTREAMFORMAT.ADPCM_44kHzStereo;
pub const SPSF_GSM610_8kHzMono = SPSTREAMFORMAT.GSM610_8kHzMono;
pub const SPSF_GSM610_11kHzMono = SPSTREAMFORMAT.GSM610_11kHzMono;
pub const SPSF_GSM610_22kHzMono = SPSTREAMFORMAT.GSM610_22kHzMono;
pub const SPSF_GSM610_44kHzMono = SPSTREAMFORMAT.GSM610_44kHzMono;
pub const SPSF_NUM_FORMATS = SPSTREAMFORMAT.NUM_FORMATS;
pub const ISpNotifyCallback = extern struct {
pub const VTable = extern struct {
NotifyCallback: fn(
self: *const ISpNotifyCallback,
wParam: WPARAM,
lParam: LPARAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
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 ISpNotifyCallback_NotifyCallback(self: *const T, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifyCallback.VTable, self.vtable).NotifyCallback(@ptrCast(*const ISpNotifyCallback, self), wParam, lParam);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPNOTIFYCALLBACK = fn(
wParam: WPARAM,
lParam: LPARAM,
) callconv(@import("std").os.windows.WINAPI) void;
const IID_ISpNotifySource_Value = @import("../zig.zig").Guid.initString("5eff4aef-8487-11d2-961c-00c04f8ee628");
pub const IID_ISpNotifySource = &IID_ISpNotifySource_Value;
pub const ISpNotifySource = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetNotifySink: fn(
self: *const ISpNotifySource,
pNotifySink: ?*ISpNotifySink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNotifyWindowMessage: fn(
self: *const ISpNotifySource,
hWnd: ?HWND,
Msg: u32,
wParam: WPARAM,
lParam: LPARAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNotifyCallbackFunction: fn(
self: *const ISpNotifySource,
pfnCallback: ?*?SPNOTIFYCALLBACK,
wParam: WPARAM,
lParam: LPARAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNotifyCallbackInterface: fn(
self: *const ISpNotifySource,
pSpCallback: ?*ISpNotifyCallback,
wParam: WPARAM,
lParam: LPARAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNotifyWin32Event: fn(
self: *const ISpNotifySource,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WaitForNotifyEvent: fn(
self: *const ISpNotifySource,
dwMilliseconds: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetNotifyEventHandle: fn(
self: *const ISpNotifySource,
) callconv(@import("std").os.windows.WINAPI) ?HANDLE,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifySource_SetNotifySink(self: *const T, pNotifySink: ?*ISpNotifySink) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifySource.VTable, self.vtable).SetNotifySink(@ptrCast(*const ISpNotifySource, self), pNotifySink);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifySource_SetNotifyWindowMessage(self: *const T, hWnd: ?HWND, Msg: u32, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifySource.VTable, self.vtable).SetNotifyWindowMessage(@ptrCast(*const ISpNotifySource, self), hWnd, Msg, wParam, lParam);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifySource_SetNotifyCallbackFunction(self: *const T, pfnCallback: ?*?SPNOTIFYCALLBACK, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifySource.VTable, self.vtable).SetNotifyCallbackFunction(@ptrCast(*const ISpNotifySource, self), pfnCallback, wParam, lParam);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifySource_SetNotifyCallbackInterface(self: *const T, pSpCallback: ?*ISpNotifyCallback, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifySource.VTable, self.vtable).SetNotifyCallbackInterface(@ptrCast(*const ISpNotifySource, self), pSpCallback, wParam, lParam);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifySource_SetNotifyWin32Event(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifySource.VTable, self.vtable).SetNotifyWin32Event(@ptrCast(*const ISpNotifySource, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifySource_WaitForNotifyEvent(self: *const T, dwMilliseconds: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifySource.VTable, self.vtable).WaitForNotifyEvent(@ptrCast(*const ISpNotifySource, self), dwMilliseconds);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifySource_GetNotifyEventHandle(self: *const T) callconv(.Inline) ?HANDLE {
return @ptrCast(*const ISpNotifySource.VTable, self.vtable).GetNotifyEventHandle(@ptrCast(*const ISpNotifySource, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpNotifySink_Value = @import("../zig.zig").Guid.initString("259684dc-37c3-11d2-9603-00c04f8ee628");
pub const IID_ISpNotifySink = &IID_ISpNotifySink_Value;
pub const ISpNotifySink = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Notify: fn(
self: *const ISpNotifySink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifySink_Notify(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifySink.VTable, self.vtable).Notify(@ptrCast(*const ISpNotifySink, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpNotifyTranslator_Value = @import("../zig.zig").Guid.initString("aca16614-5d3d-11d2-960e-00c04f8ee628");
pub const IID_ISpNotifyTranslator = &IID_ISpNotifyTranslator_Value;
pub const ISpNotifyTranslator = extern struct {
pub const VTable = extern struct {
base: ISpNotifySink.VTable,
InitWindowMessage: fn(
self: *const ISpNotifyTranslator,
hWnd: ?HWND,
Msg: u32,
wParam: WPARAM,
lParam: LPARAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
InitCallback: fn(
self: *const ISpNotifyTranslator,
pfnCallback: ?*?SPNOTIFYCALLBACK,
wParam: WPARAM,
lParam: LPARAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
InitSpNotifyCallback: fn(
self: *const ISpNotifyTranslator,
pSpCallback: ?*ISpNotifyCallback,
wParam: WPARAM,
lParam: LPARAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
InitWin32Event: fn(
self: *const ISpNotifyTranslator,
hEvent: ?HANDLE,
fCloseHandleOnRelease: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Wait: fn(
self: *const ISpNotifyTranslator,
dwMilliseconds: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetEventHandle: fn(
self: *const ISpNotifyTranslator,
) callconv(@import("std").os.windows.WINAPI) ?HANDLE,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpNotifySink.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifyTranslator_InitWindowMessage(self: *const T, hWnd: ?HWND, Msg: u32, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifyTranslator.VTable, self.vtable).InitWindowMessage(@ptrCast(*const ISpNotifyTranslator, self), hWnd, Msg, wParam, lParam);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifyTranslator_InitCallback(self: *const T, pfnCallback: ?*?SPNOTIFYCALLBACK, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifyTranslator.VTable, self.vtable).InitCallback(@ptrCast(*const ISpNotifyTranslator, self), pfnCallback, wParam, lParam);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifyTranslator_InitSpNotifyCallback(self: *const T, pSpCallback: ?*ISpNotifyCallback, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifyTranslator.VTable, self.vtable).InitSpNotifyCallback(@ptrCast(*const ISpNotifyTranslator, self), pSpCallback, wParam, lParam);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifyTranslator_InitWin32Event(self: *const T, hEvent: ?HANDLE, fCloseHandleOnRelease: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifyTranslator.VTable, self.vtable).InitWin32Event(@ptrCast(*const ISpNotifyTranslator, self), hEvent, fCloseHandleOnRelease);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifyTranslator_Wait(self: *const T, dwMilliseconds: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpNotifyTranslator.VTable, self.vtable).Wait(@ptrCast(*const ISpNotifyTranslator, self), dwMilliseconds);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpNotifyTranslator_GetEventHandle(self: *const T) callconv(.Inline) ?HANDLE {
return @ptrCast(*const ISpNotifyTranslator.VTable, self.vtable).GetEventHandle(@ptrCast(*const ISpNotifyTranslator, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpDataKey_Value = @import("../zig.zig").Guid.initString("14056581-<KEY>");
pub const IID_ISpDataKey = &IID_ISpDataKey_Value;
pub const ISpDataKey = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetData: fn(
self: *const ISpDataKey,
pszValueName: ?[*:0]const u16,
cbData: u32,
pData: ?*const u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetData: fn(
self: *const ISpDataKey,
pszValueName: ?[*:0]const u16,
pcbData: ?*u32,
pData: ?*u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetStringValue: fn(
self: *const ISpDataKey,
pszValueName: ?[*:0]const u16,
pszValue: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStringValue: fn(
self: *const ISpDataKey,
pszValueName: ?[*:0]const u16,
ppszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDWORD: fn(
self: *const ISpDataKey,
pszValueName: ?[*:0]const u16,
dwValue: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDWORD: fn(
self: *const ISpDataKey,
pszValueName: ?[*:0]const u16,
pdwValue: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenKey: fn(
self: *const ISpDataKey,
pszSubKeyName: ?[*:0]const u16,
ppSubKey: ?*?*ISpDataKey,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateKey: fn(
self: *const ISpDataKey,
pszSubKey: ?[*:0]const u16,
ppSubKey: ?*?*ISpDataKey,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteKey: fn(
self: *const ISpDataKey,
pszSubKey: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteValue: fn(
self: *const ISpDataKey,
pszValueName: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumKeys: fn(
self: *const ISpDataKey,
Index: u32,
ppszSubKeyName: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumValues: fn(
self: *const ISpDataKey,
Index: u32,
ppszValueName: ?*?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 ISpDataKey_SetData(self: *const T, pszValueName: ?[*:0]const u16, cbData: u32, pData: ?*const u8) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).SetData(@ptrCast(*const ISpDataKey, self), pszValueName, cbData, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_GetData(self: *const T, pszValueName: ?[*:0]const u16, pcbData: ?*u32, pData: ?*u8) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).GetData(@ptrCast(*const ISpDataKey, self), pszValueName, pcbData, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_SetStringValue(self: *const T, pszValueName: ?[*:0]const u16, pszValue: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).SetStringValue(@ptrCast(*const ISpDataKey, self), pszValueName, pszValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_GetStringValue(self: *const T, pszValueName: ?[*:0]const u16, ppszValue: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).GetStringValue(@ptrCast(*const ISpDataKey, self), pszValueName, ppszValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_SetDWORD(self: *const T, pszValueName: ?[*:0]const u16, dwValue: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).SetDWORD(@ptrCast(*const ISpDataKey, self), pszValueName, dwValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_GetDWORD(self: *const T, pszValueName: ?[*:0]const u16, pdwValue: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).GetDWORD(@ptrCast(*const ISpDataKey, self), pszValueName, pdwValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_OpenKey(self: *const T, pszSubKeyName: ?[*:0]const u16, ppSubKey: ?*?*ISpDataKey) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).OpenKey(@ptrCast(*const ISpDataKey, self), pszSubKeyName, ppSubKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_CreateKey(self: *const T, pszSubKey: ?[*:0]const u16, ppSubKey: ?*?*ISpDataKey) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).CreateKey(@ptrCast(*const ISpDataKey, self), pszSubKey, ppSubKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_DeleteKey(self: *const T, pszSubKey: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).DeleteKey(@ptrCast(*const ISpDataKey, self), pszSubKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_DeleteValue(self: *const T, pszValueName: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).DeleteValue(@ptrCast(*const ISpDataKey, self), pszValueName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_EnumKeys(self: *const T, Index: u32, ppszSubKeyName: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).EnumKeys(@ptrCast(*const ISpDataKey, self), Index, ppszSubKeyName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDataKey_EnumValues(self: *const T, Index: u32, ppszValueName: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDataKey.VTable, self.vtable).EnumValues(@ptrCast(*const ISpDataKey, self), Index, ppszValueName);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpRegDataKey_Value = @import("../zig.zig").Guid.initString("92a66e2b-c830-4149-83df-6fc2ba1e7a5b");
pub const IID_ISpRegDataKey = &IID_ISpRegDataKey_Value;
pub const ISpRegDataKey = extern struct {
pub const VTable = extern struct {
base: ISpDataKey.VTable,
SetKey: fn(
self: *const ISpRegDataKey,
hkey: ?HKEY,
fReadOnly: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpDataKey.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRegDataKey_SetKey(self: *const T, hkey: ?HKEY, fReadOnly: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRegDataKey.VTable, self.vtable).SetKey(@ptrCast(*const ISpRegDataKey, self), hkey, fReadOnly);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpObjectTokenCategory_Value = @import("../zig.zig").Guid.initString("2d3d3845-39af-4850-bbf9-40b49780011d");
pub const IID_ISpObjectTokenCategory = &IID_ISpObjectTokenCategory_Value;
pub const ISpObjectTokenCategory = extern struct {
pub const VTable = extern struct {
base: ISpDataKey.VTable,
SetId: fn(
self: *const ISpObjectTokenCategory,
pszCategoryId: ?[*:0]const u16,
fCreateIfNotExist: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetId: fn(
self: *const ISpObjectTokenCategory,
ppszCoMemCategoryId: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDataKey: fn(
self: *const ISpObjectTokenCategory,
spdkl: SPDATAKEYLOCATION,
ppDataKey: ?*?*ISpDataKey,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumTokens: fn(
self: *const ISpObjectTokenCategory,
pzsReqAttribs: ?[*:0]const u16,
pszOptAttribs: ?[*:0]const u16,
ppEnum: ?*?*IEnumSpObjectTokens,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDefaultTokenId: fn(
self: *const ISpObjectTokenCategory,
pszTokenId: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDefaultTokenId: fn(
self: *const ISpObjectTokenCategory,
ppszCoMemTokenId: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpDataKey.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectTokenCategory_SetId(self: *const T, pszCategoryId: ?[*:0]const u16, fCreateIfNotExist: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectTokenCategory.VTable, self.vtable).SetId(@ptrCast(*const ISpObjectTokenCategory, self), pszCategoryId, fCreateIfNotExist);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectTokenCategory_GetId(self: *const T, ppszCoMemCategoryId: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectTokenCategory.VTable, self.vtable).GetId(@ptrCast(*const ISpObjectTokenCategory, self), ppszCoMemCategoryId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectTokenCategory_GetDataKey(self: *const T, spdkl: SPDATAKEYLOCATION, ppDataKey: ?*?*ISpDataKey) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectTokenCategory.VTable, self.vtable).GetDataKey(@ptrCast(*const ISpObjectTokenCategory, self), spdkl, ppDataKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectTokenCategory_EnumTokens(self: *const T, pzsReqAttribs: ?[*:0]const u16, pszOptAttribs: ?[*:0]const u16, ppEnum: ?*?*IEnumSpObjectTokens) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectTokenCategory.VTable, self.vtable).EnumTokens(@ptrCast(*const ISpObjectTokenCategory, self), pzsReqAttribs, pszOptAttribs, ppEnum);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectTokenCategory_SetDefaultTokenId(self: *const T, pszTokenId: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectTokenCategory.VTable, self.vtable).SetDefaultTokenId(@ptrCast(*const ISpObjectTokenCategory, self), pszTokenId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectTokenCategory_GetDefaultTokenId(self: *const T, ppszCoMemTokenId: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectTokenCategory.VTable, self.vtable).GetDefaultTokenId(@ptrCast(*const ISpObjectTokenCategory, self), ppszCoMemTokenId);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpObjectToken_Value = @import("../zig.zig").Guid.initString("14056589-e16c-11d2-bb90-00c04f8ee6c0");
pub const IID_ISpObjectToken = &IID_ISpObjectToken_Value;
pub const ISpObjectToken = extern struct {
pub const VTable = extern struct {
base: ISpDataKey.VTable,
SetId: fn(
self: *const ISpObjectToken,
pszCategoryId: ?[*:0]const u16,
pszTokenId: ?[*:0]const u16,
fCreateIfNotExist: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetId: fn(
self: *const ISpObjectToken,
ppszCoMemTokenId: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCategory: fn(
self: *const ISpObjectToken,
ppTokenCategory: ?*?*ISpObjectTokenCategory,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateInstance: fn(
self: *const ISpObjectToken,
pUnkOuter: ?*IUnknown,
dwClsContext: u32,
riid: ?*const Guid,
ppvObject: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStorageFileName: fn(
self: *const ISpObjectToken,
clsidCaller: ?*const Guid,
pszValueName: ?[*:0]const u16,
pszFileNameSpecifier: ?[*:0]const u16,
nFolder: u32,
ppszFilePath: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemoveStorageFileName: fn(
self: *const ISpObjectToken,
clsidCaller: ?*const Guid,
pszKeyName: ?[*:0]const u16,
fDeleteFile: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Remove: fn(
self: *const ISpObjectToken,
pclsidCaller: ?*const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsUISupported: fn(
self: *const ISpObjectToken,
pszTypeOfUI: ?[*:0]const u16,
pvExtraData: ?*c_void,
cbExtraData: u32,
punkObject: ?*IUnknown,
pfSupported: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisplayUI: fn(
self: *const ISpObjectToken,
hwndParent: ?HWND,
pszTitle: ?[*:0]const u16,
pszTypeOfUI: ?[*:0]const u16,
pvExtraData: ?*c_void,
cbExtraData: u32,
punkObject: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MatchesAttributes: fn(
self: *const ISpObjectToken,
pszAttributes: ?[*:0]const u16,
pfMatches: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpDataKey.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_SetId(self: *const T, pszCategoryId: ?[*:0]const u16, pszTokenId: ?[*:0]const u16, fCreateIfNotExist: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).SetId(@ptrCast(*const ISpObjectToken, self), pszCategoryId, pszTokenId, fCreateIfNotExist);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_GetId(self: *const T, ppszCoMemTokenId: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).GetId(@ptrCast(*const ISpObjectToken, self), ppszCoMemTokenId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_GetCategory(self: *const T, ppTokenCategory: ?*?*ISpObjectTokenCategory) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).GetCategory(@ptrCast(*const ISpObjectToken, self), ppTokenCategory);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_CreateInstance(self: *const T, pUnkOuter: ?*IUnknown, dwClsContext: u32, riid: ?*const Guid, ppvObject: ?*?*c_void) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).CreateInstance(@ptrCast(*const ISpObjectToken, self), pUnkOuter, dwClsContext, riid, ppvObject);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_GetStorageFileName(self: *const T, clsidCaller: ?*const Guid, pszValueName: ?[*:0]const u16, pszFileNameSpecifier: ?[*:0]const u16, nFolder: u32, ppszFilePath: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).GetStorageFileName(@ptrCast(*const ISpObjectToken, self), clsidCaller, pszValueName, pszFileNameSpecifier, nFolder, ppszFilePath);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_RemoveStorageFileName(self: *const T, clsidCaller: ?*const Guid, pszKeyName: ?[*:0]const u16, fDeleteFile: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).RemoveStorageFileName(@ptrCast(*const ISpObjectToken, self), clsidCaller, pszKeyName, fDeleteFile);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_Remove(self: *const T, pclsidCaller: ?*const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).Remove(@ptrCast(*const ISpObjectToken, self), pclsidCaller);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_IsUISupported(self: *const T, pszTypeOfUI: ?[*:0]const u16, pvExtraData: ?*c_void, cbExtraData: u32, punkObject: ?*IUnknown, pfSupported: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).IsUISupported(@ptrCast(*const ISpObjectToken, self), pszTypeOfUI, pvExtraData, cbExtraData, punkObject, pfSupported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_DisplayUI(self: *const T, hwndParent: ?HWND, pszTitle: ?[*:0]const u16, pszTypeOfUI: ?[*:0]const u16, pvExtraData: ?*c_void, cbExtraData: u32, punkObject: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).DisplayUI(@ptrCast(*const ISpObjectToken, self), hwndParent, pszTitle, pszTypeOfUI, pvExtraData, cbExtraData, punkObject);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectToken_MatchesAttributes(self: *const T, pszAttributes: ?[*:0]const u16, pfMatches: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectToken.VTable, self.vtable).MatchesAttributes(@ptrCast(*const ISpObjectToken, self), pszAttributes, pfMatches);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpObjectTokenInit_Value = @import("../zig.zig").Guid.initString("b8aab0cf-346f-49d8-9499-c8b03f161d51");
pub const IID_ISpObjectTokenInit = &IID_ISpObjectTokenInit_Value;
pub const ISpObjectTokenInit = extern struct {
pub const VTable = extern struct {
base: ISpObjectToken.VTable,
InitFromDataKey: fn(
self: *const ISpObjectTokenInit,
pszCategoryId: ?[*:0]const u16,
pszTokenId: ?[*:0]const u16,
pDataKey: ?*ISpDataKey,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpObjectToken.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectTokenInit_InitFromDataKey(self: *const T, pszCategoryId: ?[*:0]const u16, pszTokenId: ?[*:0]const u16, pDataKey: ?*ISpDataKey) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectTokenInit.VTable, self.vtable).InitFromDataKey(@ptrCast(*const ISpObjectTokenInit, self), pszCategoryId, pszTokenId, pDataKey);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IEnumSpObjectTokens_Value = @import("../zig.zig").Guid.initString("06b64f9e-7fda-11d2-b4f2-00c04f797396");
pub const IID_IEnumSpObjectTokens = &IID_IEnumSpObjectTokens_Value;
pub const IEnumSpObjectTokens = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Next: fn(
self: *const IEnumSpObjectTokens,
celt: u32,
pelt: ?*?*ISpObjectToken,
pceltFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const IEnumSpObjectTokens,
celt: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IEnumSpObjectTokens,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IEnumSpObjectTokens,
ppEnum: ?*?*IEnumSpObjectTokens,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const IEnumSpObjectTokens,
Index: u32,
ppToken: ?*?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCount: fn(
self: *const IEnumSpObjectTokens,
pCount: ?*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 IEnumSpObjectTokens_Next(self: *const T, celt: u32, pelt: ?*?*ISpObjectToken, pceltFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSpObjectTokens.VTable, self.vtable).Next(@ptrCast(*const IEnumSpObjectTokens, self), celt, pelt, pceltFetched);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSpObjectTokens_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSpObjectTokens.VTable, self.vtable).Skip(@ptrCast(*const IEnumSpObjectTokens, self), celt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSpObjectTokens_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSpObjectTokens.VTable, self.vtable).Reset(@ptrCast(*const IEnumSpObjectTokens, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSpObjectTokens_Clone(self: *const T, ppEnum: ?*?*IEnumSpObjectTokens) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSpObjectTokens.VTable, self.vtable).Clone(@ptrCast(*const IEnumSpObjectTokens, self), ppEnum);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSpObjectTokens_Item(self: *const T, Index: u32, ppToken: ?*?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSpObjectTokens.VTable, self.vtable).Item(@ptrCast(*const IEnumSpObjectTokens, self), Index, ppToken);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSpObjectTokens_GetCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSpObjectTokens.VTable, self.vtable).GetCount(@ptrCast(*const IEnumSpObjectTokens, self), pCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpObjectWithToken_Value = @import("../zig.zig").Guid.initString("5b559f40-e952-11d2-bb91-00c04f8ee6c0");
pub const IID_ISpObjectWithToken = &IID_ISpObjectWithToken_Value;
pub const ISpObjectWithToken = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetObjectToken: fn(
self: *const ISpObjectWithToken,
pToken: ?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetObjectToken: fn(
self: *const ISpObjectWithToken,
ppToken: ?*?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectWithToken_SetObjectToken(self: *const T, pToken: ?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectWithToken.VTable, self.vtable).SetObjectToken(@ptrCast(*const ISpObjectWithToken, self), pToken);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpObjectWithToken_GetObjectToken(self: *const T, ppToken: ?*?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpObjectWithToken.VTable, self.vtable).GetObjectToken(@ptrCast(*const ISpObjectWithToken, self), ppToken);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpResourceManager_Value = @import("../zig.zig").Guid.initString("93384e18-5014-43d5-adbb-a78e055926bd");
pub const IID_ISpResourceManager = &IID_ISpResourceManager_Value;
pub const ISpResourceManager = extern struct {
pub const VTable = extern struct {
base: IServiceProvider.VTable,
SetObject: fn(
self: *const ISpResourceManager,
guidServiceId: ?*const Guid,
pUnkObject: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetObject: fn(
self: *const ISpResourceManager,
guidServiceId: ?*const Guid,
ObjectCLSID: ?*const Guid,
ObjectIID: ?*const Guid,
fReleaseWhenLastExternalRefReleased: BOOL,
ppObject: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IServiceProvider.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpResourceManager_SetObject(self: *const T, guidServiceId: ?*const Guid, pUnkObject: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpResourceManager.VTable, self.vtable).SetObject(@ptrCast(*const ISpResourceManager, self), guidServiceId, pUnkObject);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpResourceManager_GetObject(self: *const T, guidServiceId: ?*const Guid, ObjectCLSID: ?*const Guid, ObjectIID: ?*const Guid, fReleaseWhenLastExternalRefReleased: BOOL, ppObject: ?*?*c_void) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpResourceManager.VTable, self.vtable).GetObject(@ptrCast(*const ISpResourceManager, self), guidServiceId, ObjectCLSID, ObjectIID, fReleaseWhenLastExternalRefReleased, ppObject);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPEVENTLPARAMTYPE = enum(i32) {
UNDEFINED = 0,
TOKEN = 1,
OBJECT = 2,
POINTER = 3,
STRING = 4,
};
pub const SPET_LPARAM_IS_UNDEFINED = SPEVENTLPARAMTYPE.UNDEFINED;
pub const SPET_LPARAM_IS_TOKEN = SPEVENTLPARAMTYPE.TOKEN;
pub const SPET_LPARAM_IS_OBJECT = SPEVENTLPARAMTYPE.OBJECT;
pub const SPET_LPARAM_IS_POINTER = SPEVENTLPARAMTYPE.POINTER;
pub const SPET_LPARAM_IS_STRING = SPEVENTLPARAMTYPE.STRING;
pub const SPEVENTENUM = enum(i32) {
UNDEFINED = 0,
START_INPUT_STREAM = 1,
END_INPUT_STREAM = 2,
VOICE_CHANGE = 3,
TTS_BOOKMARK = 4,
WORD_BOUNDARY = 5,
PHONEME = 6,
SENTENCE_BOUNDARY = 7,
VISEME = 8,
TTS_AUDIO_LEVEL = 9,
TTS_PRIVATE = 15,
// MIN_TTS = 1, this enum value conflicts with START_INPUT_STREAM
// MAX_TTS = 15, this enum value conflicts with TTS_PRIVATE
END_SR_STREAM = 34,
SOUND_START = 35,
SOUND_END = 36,
PHRASE_START = 37,
RECOGNITION = 38,
HYPOTHESIS = 39,
SR_BOOKMARK = 40,
PROPERTY_NUM_CHANGE = 41,
PROPERTY_STRING_CHANGE = 42,
FALSE_RECOGNITION = 43,
INTERFERENCE = 44,
REQUEST_UI = 45,
RECO_STATE_CHANGE = 46,
ADAPTATION = 47,
START_SR_STREAM = 48,
RECO_OTHER_CONTEXT = 49,
SR_AUDIO_LEVEL = 50,
SR_RETAINEDAUDIO = 51,
SR_PRIVATE = 52,
RESERVED4 = 53,
RESERVED5 = 54,
RESERVED6 = 55,
// MIN_SR = 34, this enum value conflicts with END_SR_STREAM
// MAX_SR = 55, this enum value conflicts with RESERVED6
RESERVED1 = 30,
RESERVED2 = 33,
RESERVED3 = 63,
};
pub const SPEI_UNDEFINED = SPEVENTENUM.UNDEFINED;
pub const SPEI_START_INPUT_STREAM = SPEVENTENUM.START_INPUT_STREAM;
pub const SPEI_END_INPUT_STREAM = SPEVENTENUM.END_INPUT_STREAM;
pub const SPEI_VOICE_CHANGE = SPEVENTENUM.VOICE_CHANGE;
pub const SPEI_TTS_BOOKMARK = SPEVENTENUM.TTS_BOOKMARK;
pub const SPEI_WORD_BOUNDARY = SPEVENTENUM.WORD_BOUNDARY;
pub const SPEI_PHONEME = SPEVENTENUM.PHONEME;
pub const SPEI_SENTENCE_BOUNDARY = SPEVENTENUM.SENTENCE_BOUNDARY;
pub const SPEI_VISEME = SPEVENTENUM.VISEME;
pub const SPEI_TTS_AUDIO_LEVEL = SPEVENTENUM.TTS_AUDIO_LEVEL;
pub const SPEI_TTS_PRIVATE = SPEVENTENUM.TTS_PRIVATE;
pub const SPEI_MIN_TTS = SPEVENTENUM.START_INPUT_STREAM;
pub const SPEI_MAX_TTS = SPEVENTENUM.TTS_PRIVATE;
pub const SPEI_END_SR_STREAM = SPEVENTENUM.END_SR_STREAM;
pub const SPEI_SOUND_START = SPEVENTENUM.SOUND_START;
pub const SPEI_SOUND_END = SPEVENTENUM.SOUND_END;
pub const SPEI_PHRASE_START = SPEVENTENUM.PHRASE_START;
pub const SPEI_RECOGNITION = SPEVENTENUM.RECOGNITION;
pub const SPEI_HYPOTHESIS = SPEVENTENUM.HYPOTHESIS;
pub const SPEI_SR_BOOKMARK = SPEVENTENUM.SR_BOOKMARK;
pub const SPEI_PROPERTY_NUM_CHANGE = SPEVENTENUM.PROPERTY_NUM_CHANGE;
pub const SPEI_PROPERTY_STRING_CHANGE = SPEVENTENUM.PROPERTY_STRING_CHANGE;
pub const SPEI_FALSE_RECOGNITION = SPEVENTENUM.FALSE_RECOGNITION;
pub const SPEI_INTERFERENCE = SPEVENTENUM.INTERFERENCE;
pub const SPEI_REQUEST_UI = SPEVENTENUM.REQUEST_UI;
pub const SPEI_RECO_STATE_CHANGE = SPEVENTENUM.RECO_STATE_CHANGE;
pub const SPEI_ADAPTATION = SPEVENTENUM.ADAPTATION;
pub const SPEI_START_SR_STREAM = SPEVENTENUM.START_SR_STREAM;
pub const SPEI_RECO_OTHER_CONTEXT = SPEVENTENUM.RECO_OTHER_CONTEXT;
pub const SPEI_SR_AUDIO_LEVEL = SPEVENTENUM.SR_AUDIO_LEVEL;
pub const SPEI_SR_RETAINEDAUDIO = SPEVENTENUM.SR_RETAINEDAUDIO;
pub const SPEI_SR_PRIVATE = SPEVENTENUM.SR_PRIVATE;
pub const SPEI_RESERVED4 = SPEVENTENUM.RESERVED4;
pub const SPEI_RESERVED5 = SPEVENTENUM.RESERVED5;
pub const SPEI_RESERVED6 = SPEVENTENUM.RESERVED6;
pub const SPEI_MIN_SR = SPEVENTENUM.END_SR_STREAM;
pub const SPEI_MAX_SR = SPEVENTENUM.RESERVED6;
pub const SPEI_RESERVED1 = SPEVENTENUM.RESERVED1;
pub const SPEI_RESERVED2 = SPEVENTENUM.RESERVED2;
pub const SPEI_RESERVED3 = SPEVENTENUM.RESERVED3;
pub const SPEVENT = extern struct {
_bitfield: i32,
ulStreamNum: u32,
ullAudioStreamOffset: u64,
wParam: WPARAM,
lParam: LPARAM,
};
pub const SPSERIALIZEDEVENT = extern struct {
_bitfield: i32,
ulStreamNum: u32,
ullAudioStreamOffset: u64,
SerializedwParam: u32,
SerializedlParam: i32,
};
pub const SPSERIALIZEDEVENT64 = extern struct {
_bitfield: i32,
ulStreamNum: u32,
ullAudioStreamOffset: u64,
SerializedwParam: u64,
SerializedlParam: i64,
};
pub const SPEVENTEX = extern struct {
_bitfield: i32,
ulStreamNum: u32,
ullAudioStreamOffset: u64,
wParam: WPARAM,
lParam: LPARAM,
ullAudioTimeOffset: u64,
};
pub const SPINTERFERENCE = enum(i32) {
NONE = 0,
NOISE = 1,
NOSIGNAL = 2,
TOOLOUD = 3,
TOOQUIET = 4,
TOOFAST = 5,
TOOSLOW = 6,
LATENCY_WARNING = 7,
LATENCY_TRUNCATE_BEGIN = 8,
LATENCY_TRUNCATE_END = 9,
};
pub const SPINTERFERENCE_NONE = SPINTERFERENCE.NONE;
pub const SPINTERFERENCE_NOISE = SPINTERFERENCE.NOISE;
pub const SPINTERFERENCE_NOSIGNAL = SPINTERFERENCE.NOSIGNAL;
pub const SPINTERFERENCE_TOOLOUD = SPINTERFERENCE.TOOLOUD;
pub const SPINTERFERENCE_TOOQUIET = SPINTERFERENCE.TOOQUIET;
pub const SPINTERFERENCE_TOOFAST = SPINTERFERENCE.TOOFAST;
pub const SPINTERFERENCE_TOOSLOW = SPINTERFERENCE.TOOSLOW;
pub const SPINTERFERENCE_LATENCY_WARNING = SPINTERFERENCE.LATENCY_WARNING;
pub const SPINTERFERENCE_LATENCY_TRUNCATE_BEGIN = SPINTERFERENCE.LATENCY_TRUNCATE_BEGIN;
pub const SPINTERFERENCE_LATENCY_TRUNCATE_END = SPINTERFERENCE.LATENCY_TRUNCATE_END;
pub const SPENDSRSTREAMFLAGS = enum(i32) {
NONE = 0,
STREAM_RELEASED = 1,
EMULATED = 2,
};
pub const SPESF_NONE = SPENDSRSTREAMFLAGS.NONE;
pub const SPESF_STREAM_RELEASED = SPENDSRSTREAMFLAGS.STREAM_RELEASED;
pub const SPESF_EMULATED = SPENDSRSTREAMFLAGS.EMULATED;
pub const SPVFEATURE = enum(i32) {
STRESSED = 1,
EMPHASIS = 2,
};
pub const SPVFEATURE_STRESSED = SPVFEATURE.STRESSED;
pub const SPVFEATURE_EMPHASIS = SPVFEATURE.EMPHASIS;
pub const SPVISEMES = enum(i32) {
@"0" = 0,
@"1" = 1,
@"2" = 2,
@"3" = 3,
@"4" = 4,
@"5" = 5,
@"6" = 6,
@"7" = 7,
@"8" = 8,
@"9" = 9,
@"10" = 10,
@"11" = 11,
@"12" = 12,
@"13" = 13,
@"14" = 14,
@"15" = 15,
@"16" = 16,
@"17" = 17,
@"18" = 18,
@"19" = 19,
@"20" = 20,
@"21" = 21,
};
pub const SP_VISEME_0 = SPVISEMES.@"0";
pub const SP_VISEME_1 = SPVISEMES.@"1";
pub const SP_VISEME_2 = SPVISEMES.@"2";
pub const SP_VISEME_3 = SPVISEMES.@"3";
pub const SP_VISEME_4 = SPVISEMES.@"4";
pub const SP_VISEME_5 = SPVISEMES.@"5";
pub const SP_VISEME_6 = SPVISEMES.@"6";
pub const SP_VISEME_7 = SPVISEMES.@"7";
pub const SP_VISEME_8 = SPVISEMES.@"8";
pub const SP_VISEME_9 = SPVISEMES.@"9";
pub const SP_VISEME_10 = SPVISEMES.@"10";
pub const SP_VISEME_11 = SPVISEMES.@"11";
pub const SP_VISEME_12 = SPVISEMES.@"12";
pub const SP_VISEME_13 = SPVISEMES.@"13";
pub const SP_VISEME_14 = SPVISEMES.@"14";
pub const SP_VISEME_15 = SPVISEMES.@"15";
pub const SP_VISEME_16 = SPVISEMES.@"16";
pub const SP_VISEME_17 = SPVISEMES.@"17";
pub const SP_VISEME_18 = SPVISEMES.@"18";
pub const SP_VISEME_19 = SPVISEMES.@"19";
pub const SP_VISEME_20 = SPVISEMES.@"20";
pub const SP_VISEME_21 = SPVISEMES.@"21";
pub const SPEVENTSOURCEINFO = extern struct {
ullEventInterest: u64,
ullQueuedInterest: u64,
ulCount: u32,
};
const IID_ISpEventSource_Value = @import("../zig.zig").Guid.initString("be7a9cce-5f9e-11d2-960f-00c04f8ee628");
pub const IID_ISpEventSource = &IID_ISpEventSource_Value;
pub const ISpEventSource = extern struct {
pub const VTable = extern struct {
base: ISpNotifySource.VTable,
SetInterest: fn(
self: *const ISpEventSource,
ullEventInterest: u64,
ullQueuedInterest: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetEvents: fn(
self: *const ISpEventSource,
ulCount: u32,
pEventArray: ?*SPEVENT,
pulFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetInfo: fn(
self: *const ISpEventSource,
pInfo: ?*SPEVENTSOURCEINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpNotifySource.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpEventSource_SetInterest(self: *const T, ullEventInterest: u64, ullQueuedInterest: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpEventSource.VTable, self.vtable).SetInterest(@ptrCast(*const ISpEventSource, self), ullEventInterest, ullQueuedInterest);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpEventSource_GetEvents(self: *const T, ulCount: u32, pEventArray: ?*SPEVENT, pulFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpEventSource.VTable, self.vtable).GetEvents(@ptrCast(*const ISpEventSource, self), ulCount, pEventArray, pulFetched);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpEventSource_GetInfo(self: *const T, pInfo: ?*SPEVENTSOURCEINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpEventSource.VTable, self.vtable).GetInfo(@ptrCast(*const ISpEventSource, self), pInfo);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpEventSource2_Value = @import("../zig.zig").Guid.initString("2373a435-6a4b-429e-a6ac-d4231a61975b");
pub const IID_ISpEventSource2 = &IID_ISpEventSource2_Value;
pub const ISpEventSource2 = extern struct {
pub const VTable = extern struct {
base: ISpEventSource.VTable,
GetEventsEx: fn(
self: *const ISpEventSource2,
ulCount: u32,
pEventArray: ?*SPEVENTEX,
pulFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpEventSource.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpEventSource2_GetEventsEx(self: *const T, ulCount: u32, pEventArray: ?*SPEVENTEX, pulFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpEventSource2.VTable, self.vtable).GetEventsEx(@ptrCast(*const ISpEventSource2, self), ulCount, pEventArray, pulFetched);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpEventSink_Value = @import("../zig.zig").Guid.initString("be7a9cc9-5f9e-11d2-960f-00c04f8ee628");
pub const IID_ISpEventSink = &IID_ISpEventSink_Value;
pub const ISpEventSink = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddEvents: fn(
self: *const ISpEventSink,
pEventArray: ?*const SPEVENT,
ulCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetEventInterest: fn(
self: *const ISpEventSink,
pullEventInterest: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpEventSink_AddEvents(self: *const T, pEventArray: ?*const SPEVENT, ulCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpEventSink.VTable, self.vtable).AddEvents(@ptrCast(*const ISpEventSink, self), pEventArray, ulCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpEventSink_GetEventInterest(self: *const T, pullEventInterest: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpEventSink.VTable, self.vtable).GetEventInterest(@ptrCast(*const ISpEventSink, self), pullEventInterest);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpStreamFormat_Value = @import("../zig.zig").Guid.initString("bed530be-2606-4f4d-a1c0-54c5cda5566f");
pub const IID_ISpStreamFormat = &IID_ISpStreamFormat_Value;
pub const ISpStreamFormat = extern struct {
pub const VTable = extern struct {
base: IStream.VTable,
GetFormat: fn(
self: *const ISpStreamFormat,
pguidFormatId: ?*Guid,
ppCoMemWaveFormatEx: ?*?*WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IStream.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStreamFormat_GetFormat(self: *const T, pguidFormatId: ?*Guid, ppCoMemWaveFormatEx: ?*?*WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStreamFormat.VTable, self.vtable).GetFormat(@ptrCast(*const ISpStreamFormat, self), pguidFormatId, ppCoMemWaveFormatEx);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPFILEMODE = enum(i32) {
OPEN_READONLY = 0,
OPEN_READWRITE = 1,
CREATE = 2,
CREATE_ALWAYS = 3,
NUM_MODES = 4,
};
pub const SPFM_OPEN_READONLY = SPFILEMODE.OPEN_READONLY;
pub const SPFM_OPEN_READWRITE = SPFILEMODE.OPEN_READWRITE;
pub const SPFM_CREATE = SPFILEMODE.CREATE;
pub const SPFM_CREATE_ALWAYS = SPFILEMODE.CREATE_ALWAYS;
pub const SPFM_NUM_MODES = SPFILEMODE.NUM_MODES;
const IID_ISpStream_Value = @import("../zig.zig").Guid.initString("12e3cca9-7518-44c5-a5e7-ba5a79cb929e");
pub const IID_ISpStream = &IID_ISpStream_Value;
pub const ISpStream = extern struct {
pub const VTable = extern struct {
base: ISpStreamFormat.VTable,
SetBaseStream: fn(
self: *const ISpStream,
pStream: ?*IStream,
rguidFormat: ?*const Guid,
pWaveFormatEx: ?*const WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBaseStream: fn(
self: *const ISpStream,
ppStream: ?*?*IStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindToFile: fn(
self: *const ISpStream,
pszFileName: ?[*:0]const u16,
eMode: SPFILEMODE,
pFormatId: ?*const Guid,
pWaveFormatEx: ?*const WAVEFORMATEX,
ullEventInterest: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Close: fn(
self: *const ISpStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpStreamFormat.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStream_SetBaseStream(self: *const T, pStream: ?*IStream, rguidFormat: ?*const Guid, pWaveFormatEx: ?*const WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStream.VTable, self.vtable).SetBaseStream(@ptrCast(*const ISpStream, self), pStream, rguidFormat, pWaveFormatEx);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStream_GetBaseStream(self: *const T, ppStream: ?*?*IStream) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStream.VTable, self.vtable).GetBaseStream(@ptrCast(*const ISpStream, self), ppStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStream_BindToFile(self: *const T, pszFileName: ?[*:0]const u16, eMode: SPFILEMODE, pFormatId: ?*const Guid, pWaveFormatEx: ?*const WAVEFORMATEX, ullEventInterest: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStream.VTable, self.vtable).BindToFile(@ptrCast(*const ISpStream, self), pszFileName, eMode, pFormatId, pWaveFormatEx, ullEventInterest);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStream_Close(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStream.VTable, self.vtable).Close(@ptrCast(*const ISpStream, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpStreamFormatConverter_Value = @import("../zig.zig").Guid.initString("678a932c-ea71-4446-9b41-78fda6280a29");
pub const IID_ISpStreamFormatConverter = &IID_ISpStreamFormatConverter_Value;
pub const ISpStreamFormatConverter = extern struct {
pub const VTable = extern struct {
base: ISpStreamFormat.VTable,
SetBaseStream: fn(
self: *const ISpStreamFormatConverter,
pStream: ?*ISpStreamFormat,
fSetFormatToBaseStreamFormat: BOOL,
fWriteToBaseStream: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBaseStream: fn(
self: *const ISpStreamFormatConverter,
ppStream: ?*?*ISpStreamFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetFormat: fn(
self: *const ISpStreamFormatConverter,
rguidFormatIdOfConvertedStream: ?*const Guid,
pWaveFormatExOfConvertedStream: ?*const WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ResetSeekPosition: fn(
self: *const ISpStreamFormatConverter,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ScaleConvertedToBaseOffset: fn(
self: *const ISpStreamFormatConverter,
ullOffsetConvertedStream: u64,
pullOffsetBaseStream: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ScaleBaseToConvertedOffset: fn(
self: *const ISpStreamFormatConverter,
ullOffsetBaseStream: u64,
pullOffsetConvertedStream: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpStreamFormat.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStreamFormatConverter_SetBaseStream(self: *const T, pStream: ?*ISpStreamFormat, fSetFormatToBaseStreamFormat: BOOL, fWriteToBaseStream: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStreamFormatConverter.VTable, self.vtable).SetBaseStream(@ptrCast(*const ISpStreamFormatConverter, self), pStream, fSetFormatToBaseStreamFormat, fWriteToBaseStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStreamFormatConverter_GetBaseStream(self: *const T, ppStream: ?*?*ISpStreamFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStreamFormatConverter.VTable, self.vtable).GetBaseStream(@ptrCast(*const ISpStreamFormatConverter, self), ppStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStreamFormatConverter_SetFormat(self: *const T, rguidFormatIdOfConvertedStream: ?*const Guid, pWaveFormatExOfConvertedStream: ?*const WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStreamFormatConverter.VTable, self.vtable).SetFormat(@ptrCast(*const ISpStreamFormatConverter, self), rguidFormatIdOfConvertedStream, pWaveFormatExOfConvertedStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStreamFormatConverter_ResetSeekPosition(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStreamFormatConverter.VTable, self.vtable).ResetSeekPosition(@ptrCast(*const ISpStreamFormatConverter, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStreamFormatConverter_ScaleConvertedToBaseOffset(self: *const T, ullOffsetConvertedStream: u64, pullOffsetBaseStream: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStreamFormatConverter.VTable, self.vtable).ScaleConvertedToBaseOffset(@ptrCast(*const ISpStreamFormatConverter, self), ullOffsetConvertedStream, pullOffsetBaseStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpStreamFormatConverter_ScaleBaseToConvertedOffset(self: *const T, ullOffsetBaseStream: u64, pullOffsetConvertedStream: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpStreamFormatConverter.VTable, self.vtable).ScaleBaseToConvertedOffset(@ptrCast(*const ISpStreamFormatConverter, self), ullOffsetBaseStream, pullOffsetConvertedStream);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPAUDIOSTATE = enum(i32) {
CLOSED = 0,
STOP = 1,
PAUSE = 2,
RUN = 3,
};
pub const SPAS_CLOSED = SPAUDIOSTATE.CLOSED;
pub const SPAS_STOP = SPAUDIOSTATE.STOP;
pub const SPAS_PAUSE = SPAUDIOSTATE.PAUSE;
pub const SPAS_RUN = SPAUDIOSTATE.RUN;
pub const SPAUDIOSTATUS = extern struct {
cbFreeBuffSpace: i32,
cbNonBlockingIO: u32,
State: SPAUDIOSTATE,
CurSeekPos: u64,
CurDevicePos: u64,
dwAudioLevel: u32,
dwReserved2: u32,
};
pub const SPAUDIOBUFFERINFO = extern struct {
ulMsMinNotification: u32,
ulMsBufferSize: u32,
ulMsEventBias: u32,
};
const IID_ISpAudio_Value = @import("../zig.zig").Guid.initString("c05c768f-fae8-4ec2-8e07-338321c12452");
pub const IID_ISpAudio = &IID_ISpAudio_Value;
pub const ISpAudio = extern struct {
pub const VTable = extern struct {
base: ISpStreamFormat.VTable,
SetState: fn(
self: *const ISpAudio,
NewState: SPAUDIOSTATE,
ullReserved: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetFormat: fn(
self: *const ISpAudio,
rguidFmtId: ?*const Guid,
pWaveFormatEx: ?*const WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStatus: fn(
self: *const ISpAudio,
pStatus: ?*SPAUDIOSTATUS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBufferInfo: fn(
self: *const ISpAudio,
pBuffInfo: ?*const SPAUDIOBUFFERINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBufferInfo: fn(
self: *const ISpAudio,
pBuffInfo: ?*SPAUDIOBUFFERINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDefaultFormat: fn(
self: *const ISpAudio,
pFormatId: ?*Guid,
ppCoMemWaveFormatEx: ?*?*WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EventHandle: fn(
self: *const ISpAudio,
) callconv(@import("std").os.windows.WINAPI) ?HANDLE,
GetVolumeLevel: fn(
self: *const ISpAudio,
pLevel: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVolumeLevel: fn(
self: *const ISpAudio,
Level: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBufferNotifySize: fn(
self: *const ISpAudio,
pcbSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBufferNotifySize: fn(
self: *const ISpAudio,
cbSize: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpStreamFormat.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_SetState(self: *const T, NewState: SPAUDIOSTATE, ullReserved: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).SetState(@ptrCast(*const ISpAudio, self), NewState, ullReserved);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_SetFormat(self: *const T, rguidFmtId: ?*const Guid, pWaveFormatEx: ?*const WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).SetFormat(@ptrCast(*const ISpAudio, self), rguidFmtId, pWaveFormatEx);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_GetStatus(self: *const T, pStatus: ?*SPAUDIOSTATUS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).GetStatus(@ptrCast(*const ISpAudio, self), pStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_SetBufferInfo(self: *const T, pBuffInfo: ?*const SPAUDIOBUFFERINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).SetBufferInfo(@ptrCast(*const ISpAudio, self), pBuffInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_GetBufferInfo(self: *const T, pBuffInfo: ?*SPAUDIOBUFFERINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).GetBufferInfo(@ptrCast(*const ISpAudio, self), pBuffInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_GetDefaultFormat(self: *const T, pFormatId: ?*Guid, ppCoMemWaveFormatEx: ?*?*WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).GetDefaultFormat(@ptrCast(*const ISpAudio, self), pFormatId, ppCoMemWaveFormatEx);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_EventHandle(self: *const T) callconv(.Inline) ?HANDLE {
return @ptrCast(*const ISpAudio.VTable, self.vtable).EventHandle(@ptrCast(*const ISpAudio, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_GetVolumeLevel(self: *const T, pLevel: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).GetVolumeLevel(@ptrCast(*const ISpAudio, self), pLevel);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_SetVolumeLevel(self: *const T, Level: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).SetVolumeLevel(@ptrCast(*const ISpAudio, self), Level);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_GetBufferNotifySize(self: *const T, pcbSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).GetBufferNotifySize(@ptrCast(*const ISpAudio, self), pcbSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpAudio_SetBufferNotifySize(self: *const T, cbSize: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpAudio.VTable, self.vtable).SetBufferNotifySize(@ptrCast(*const ISpAudio, self), cbSize);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpMMSysAudio_Value = @import("../zig.zig").Guid.initString("15806f6e-1d70-4b48-98e6-3b1a007509ab");
pub const IID_ISpMMSysAudio = &IID_ISpMMSysAudio_Value;
pub const ISpMMSysAudio = extern struct {
pub const VTable = extern struct {
base: ISpAudio.VTable,
GetDeviceId: fn(
self: *const ISpMMSysAudio,
puDeviceId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDeviceId: fn(
self: *const ISpMMSysAudio,
uDeviceId: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMMHandle: fn(
self: *const ISpMMSysAudio,
pHandle: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLineId: fn(
self: *const ISpMMSysAudio,
puLineId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetLineId: fn(
self: *const ISpMMSysAudio,
uLineId: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpAudio.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpMMSysAudio_GetDeviceId(self: *const T, puDeviceId: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpMMSysAudio.VTable, self.vtable).GetDeviceId(@ptrCast(*const ISpMMSysAudio, self), puDeviceId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpMMSysAudio_SetDeviceId(self: *const T, uDeviceId: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpMMSysAudio.VTable, self.vtable).SetDeviceId(@ptrCast(*const ISpMMSysAudio, self), uDeviceId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpMMSysAudio_GetMMHandle(self: *const T, pHandle: ?*?*c_void) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpMMSysAudio.VTable, self.vtable).GetMMHandle(@ptrCast(*const ISpMMSysAudio, self), pHandle);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpMMSysAudio_GetLineId(self: *const T, puLineId: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpMMSysAudio.VTable, self.vtable).GetLineId(@ptrCast(*const ISpMMSysAudio, self), puLineId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpMMSysAudio_SetLineId(self: *const T, uLineId: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpMMSysAudio.VTable, self.vtable).SetLineId(@ptrCast(*const ISpMMSysAudio, self), uLineId);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpTranscript_Value = @import("../zig.zig").Guid.initString("10f63bce-201a-11d3-ac70-00c04f8ee6c0");
pub const IID_ISpTranscript = &IID_ISpTranscript_Value;
pub const ISpTranscript = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetTranscript: fn(
self: *const ISpTranscript,
ppszTranscript: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AppendTranscript: fn(
self: *const ISpTranscript,
pszTranscript: ?[*: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 ISpTranscript_GetTranscript(self: *const T, ppszTranscript: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpTranscript.VTable, self.vtable).GetTranscript(@ptrCast(*const ISpTranscript, self), ppszTranscript);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpTranscript_AppendTranscript(self: *const T, pszTranscript: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpTranscript.VTable, self.vtable).AppendTranscript(@ptrCast(*const ISpTranscript, self), pszTranscript);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPDISPLYATTRIBUTES = enum(i32) {
ONE_TRAILING_SPACE = 2,
TWO_TRAILING_SPACES = 4,
CONSUME_LEADING_SPACES = 8,
BUFFER_POSITION = 16,
ALL = 31,
USER_SPECIFIED = 128,
};
pub const SPAF_ONE_TRAILING_SPACE = SPDISPLYATTRIBUTES.ONE_TRAILING_SPACE;
pub const SPAF_TWO_TRAILING_SPACES = SPDISPLYATTRIBUTES.TWO_TRAILING_SPACES;
pub const SPAF_CONSUME_LEADING_SPACES = SPDISPLYATTRIBUTES.CONSUME_LEADING_SPACES;
pub const SPAF_BUFFER_POSITION = SPDISPLYATTRIBUTES.BUFFER_POSITION;
pub const SPAF_ALL = SPDISPLYATTRIBUTES.ALL;
pub const SPAF_USER_SPECIFIED = SPDISPLYATTRIBUTES.USER_SPECIFIED;
pub const SPPHRASEELEMENT = extern struct {
ulAudioTimeOffset: u32,
ulAudioSizeTime: u32,
ulAudioStreamOffset: u32,
ulAudioSizeBytes: u32,
ulRetainedStreamOffset: u32,
ulRetainedSizeBytes: u32,
pszDisplayText: ?[*:0]const u16,
pszLexicalForm: ?[*:0]const u16,
pszPronunciation: ?*const u16,
bDisplayAttributes: u8,
RequiredConfidence: i8,
ActualConfidence: i8,
Reserved: u8,
SREngineConfidence: f32,
};
pub const SPPHRASERULE = extern struct {
pszName: ?[*:0]const u16,
ulId: u32,
ulFirstElement: u32,
ulCountOfElements: u32,
pNextSibling: ?*const SPPHRASERULE,
pFirstChild: ?*const SPPHRASERULE,
SREngineConfidence: f32,
Confidence: i8,
};
pub const SPPHRASEPROPERTYUNIONTYPE = enum(i32) {
UNUSED = 0,
ARRAY_INDEX = 1,
};
pub const SPPPUT_UNUSED = SPPHRASEPROPERTYUNIONTYPE.UNUSED;
pub const SPPPUT_ARRAY_INDEX = SPPHRASEPROPERTYUNIONTYPE.ARRAY_INDEX;
pub const SPPHRASEPROPERTY = extern struct {
pszName: ?[*:0]const u16,
Anonymous: extern union {
ulId: u32,
Anonymous: extern struct {
bType: u8,
bReserved: u8,
usArrayIndex: u16,
},
},
pszValue: ?[*:0]const u16,
vValue: VARIANT,
ulFirstElement: u32,
ulCountOfElements: u32,
pNextSibling: ?*const SPPHRASEPROPERTY,
pFirstChild: ?*const SPPHRASEPROPERTY,
SREngineConfidence: f32,
Confidence: i8,
};
pub const SPPHRASEREPLACEMENT = extern struct {
bDisplayAttributes: u8,
pszReplacementText: ?[*:0]const u16,
ulFirstElement: u32,
ulCountOfElements: u32,
};
pub const SPSEMANTICERRORINFO = extern struct {
ulLineNumber: u32,
pszScriptLine: ?PWSTR,
pszSource: ?PWSTR,
pszDescription: ?PWSTR,
hrResultCode: HRESULT,
};
pub const SPSEMANTICFORMAT = enum(i32) {
SAPI_PROPERTIES = 0,
SRGS_SEMANTICINTERPRETATION_MS = 1,
SRGS_SAPIPROPERTIES = 2,
UPS = 4,
SRGS_SEMANTICINTERPRETATION_W3C = 8,
};
pub const SPSMF_SAPI_PROPERTIES = SPSEMANTICFORMAT.SAPI_PROPERTIES;
pub const SPSMF_SRGS_SEMANTICINTERPRETATION_MS = SPSEMANTICFORMAT.SRGS_SEMANTICINTERPRETATION_MS;
pub const SPSMF_SRGS_SAPIPROPERTIES = SPSEMANTICFORMAT.SRGS_SAPIPROPERTIES;
pub const SPSMF_UPS = SPSEMANTICFORMAT.UPS;
pub const SPSMF_SRGS_SEMANTICINTERPRETATION_W3C = SPSEMANTICFORMAT.SRGS_SEMANTICINTERPRETATION_W3C;
pub const SPPHRASE_50 = extern struct {
cbSize: u32,
LangID: u16,
wHomophoneGroupId: u16,
ullGrammarID: u64,
ftStartTime: u64,
ullAudioStreamPosition: u64,
ulAudioSizeBytes: u32,
ulRetainedSizeBytes: u32,
ulAudioSizeTime: u32,
Rule: SPPHRASERULE,
pProperties: ?*const SPPHRASEPROPERTY,
pElements: ?*const SPPHRASEELEMENT,
cReplacements: u32,
pReplacements: ?*const SPPHRASEREPLACEMENT,
SREngineID: Guid,
ulSREnginePrivateDataSize: u32,
pSREnginePrivateData: ?*const u8,
};
pub const SPPHRASE = extern struct {
__AnonymousBase_sapi53_L5517_C34: SPPHRASE_50,
pSML: ?PWSTR,
pSemanticErrorInfo: ?*SPSEMANTICERRORINFO,
};
pub const SPSERIALIZEDPHRASE = extern struct {
ulSerializedSize: u32,
};
pub const SPRULE = extern struct {
pszRuleName: ?[*:0]const u16,
ulRuleId: u32,
dwAttributes: u32,
};
pub const SPVALUETYPE = enum(i32) {
PROPERTY = 1,
REPLACEMENT = 2,
RULE = 4,
DISPLAYTEXT = 8,
LEXICALFORM = 16,
PRONUNCIATION = 32,
AUDIO = 64,
ALTERNATES = 128,
ALL = 255,
};
pub const SPDF_PROPERTY = SPVALUETYPE.PROPERTY;
pub const SPDF_REPLACEMENT = SPVALUETYPE.REPLACEMENT;
pub const SPDF_RULE = SPVALUETYPE.RULE;
pub const SPDF_DISPLAYTEXT = SPVALUETYPE.DISPLAYTEXT;
pub const SPDF_LEXICALFORM = SPVALUETYPE.LEXICALFORM;
pub const SPDF_PRONUNCIATION = SPVALUETYPE.PRONUNCIATION;
pub const SPDF_AUDIO = SPVALUETYPE.AUDIO;
pub const SPDF_ALTERNATES = SPVALUETYPE.ALTERNATES;
pub const SPDF_ALL = SPVALUETYPE.ALL;
pub const SPBINARYGRAMMAR = extern struct {
ulTotalSerializedSize: u32,
};
pub const SPPHRASERNG = enum(i32) {
S = -1,
};
pub const SPPR_ALL_ELEMENTS = SPPHRASERNG.S;
pub const SPSTATEHANDLE__ = extern struct {
unused: i32,
};
pub const SPRECOEVENTFLAGS = enum(i32) {
AutoPause = 1,
Emulated = 2,
SMLTimeout = 4,
ExtendableParse = 8,
ReSent = 16,
Hypothesis = 32,
FalseRecognition = 64,
};
pub const SPREF_AutoPause = SPRECOEVENTFLAGS.AutoPause;
pub const SPREF_Emulated = SPRECOEVENTFLAGS.Emulated;
pub const SPREF_SMLTimeout = SPRECOEVENTFLAGS.SMLTimeout;
pub const SPREF_ExtendableParse = SPRECOEVENTFLAGS.ExtendableParse;
pub const SPREF_ReSent = SPRECOEVENTFLAGS.ReSent;
pub const SPREF_Hypothesis = SPRECOEVENTFLAGS.Hypothesis;
pub const SPREF_FalseRecognition = SPRECOEVENTFLAGS.FalseRecognition;
pub const SPPARTOFSPEECH = enum(i32) {
NotOverriden = -1,
Unknown = 0,
Noun = 4096,
Verb = 8192,
Modifier = 12288,
Function = 16384,
Interjection = 20480,
Noncontent = 24576,
LMA = 28672,
SuppressWord = 61440,
};
pub const SPPS_NotOverriden = SPPARTOFSPEECH.NotOverriden;
pub const SPPS_Unknown = SPPARTOFSPEECH.Unknown;
pub const SPPS_Noun = SPPARTOFSPEECH.Noun;
pub const SPPS_Verb = SPPARTOFSPEECH.Verb;
pub const SPPS_Modifier = SPPARTOFSPEECH.Modifier;
pub const SPPS_Function = SPPARTOFSPEECH.Function;
pub const SPPS_Interjection = SPPARTOFSPEECH.Interjection;
pub const SPPS_Noncontent = SPPARTOFSPEECH.Noncontent;
pub const SPPS_LMA = SPPARTOFSPEECH.LMA;
pub const SPPS_SuppressWord = SPPARTOFSPEECH.SuppressWord;
pub const SPLEXICONTYPE = enum(i32) {
USER = 1,
APP = 2,
VENDORLEXICON = 4,
LETTERTOSOUND = 8,
MORPHOLOGY = 16,
RESERVED4 = 32,
USER_SHORTCUT = 64,
RESERVED6 = 128,
RESERVED7 = 256,
RESERVED8 = 512,
RESERVED9 = 1024,
RESERVED10 = 2048,
PRIVATE1 = 4096,
PRIVATE2 = 8192,
PRIVATE3 = 16384,
PRIVATE4 = 32768,
PRIVATE5 = 65536,
PRIVATE6 = 131072,
PRIVATE7 = 262144,
PRIVATE8 = 524288,
PRIVATE9 = 1048576,
PRIVATE10 = 2097152,
PRIVATE11 = 4194304,
PRIVATE12 = 8388608,
PRIVATE13 = 16777216,
PRIVATE14 = 33554432,
PRIVATE15 = 67108864,
PRIVATE16 = 134217728,
PRIVATE17 = 268435456,
PRIVATE18 = 536870912,
PRIVATE19 = 1073741824,
PRIVATE20 = -2147483648,
};
pub const eLEXTYPE_USER = SPLEXICONTYPE.USER;
pub const eLEXTYPE_APP = SPLEXICONTYPE.APP;
pub const eLEXTYPE_VENDORLEXICON = SPLEXICONTYPE.VENDORLEXICON;
pub const eLEXTYPE_LETTERTOSOUND = SPLEXICONTYPE.LETTERTOSOUND;
pub const eLEXTYPE_MORPHOLOGY = SPLEXICONTYPE.MORPHOLOGY;
pub const eLEXTYPE_RESERVED4 = SPLEXICONTYPE.RESERVED4;
pub const eLEXTYPE_USER_SHORTCUT = SPLEXICONTYPE.USER_SHORTCUT;
pub const eLEXTYPE_RESERVED6 = SPLEXICONTYPE.RESERVED6;
pub const eLEXTYPE_RESERVED7 = SPLEXICONTYPE.RESERVED7;
pub const eLEXTYPE_RESERVED8 = SPLEXICONTYPE.RESERVED8;
pub const eLEXTYPE_RESERVED9 = SPLEXICONTYPE.RESERVED9;
pub const eLEXTYPE_RESERVED10 = SPLEXICONTYPE.RESERVED10;
pub const eLEXTYPE_PRIVATE1 = SPLEXICONTYPE.PRIVATE1;
pub const eLEXTYPE_PRIVATE2 = SPLEXICONTYPE.PRIVATE2;
pub const eLEXTYPE_PRIVATE3 = SPLEXICONTYPE.PRIVATE3;
pub const eLEXTYPE_PRIVATE4 = SPLEXICONTYPE.PRIVATE4;
pub const eLEXTYPE_PRIVATE5 = SPLEXICONTYPE.PRIVATE5;
pub const eLEXTYPE_PRIVATE6 = SPLEXICONTYPE.PRIVATE6;
pub const eLEXTYPE_PRIVATE7 = SPLEXICONTYPE.PRIVATE7;
pub const eLEXTYPE_PRIVATE8 = SPLEXICONTYPE.PRIVATE8;
pub const eLEXTYPE_PRIVATE9 = SPLEXICONTYPE.PRIVATE9;
pub const eLEXTYPE_PRIVATE10 = SPLEXICONTYPE.PRIVATE10;
pub const eLEXTYPE_PRIVATE11 = SPLEXICONTYPE.PRIVATE11;
pub const eLEXTYPE_PRIVATE12 = SPLEXICONTYPE.PRIVATE12;
pub const eLEXTYPE_PRIVATE13 = SPLEXICONTYPE.PRIVATE13;
pub const eLEXTYPE_PRIVATE14 = SPLEXICONTYPE.PRIVATE14;
pub const eLEXTYPE_PRIVATE15 = SPLEXICONTYPE.PRIVATE15;
pub const eLEXTYPE_PRIVATE16 = SPLEXICONTYPE.PRIVATE16;
pub const eLEXTYPE_PRIVATE17 = SPLEXICONTYPE.PRIVATE17;
pub const eLEXTYPE_PRIVATE18 = SPLEXICONTYPE.PRIVATE18;
pub const eLEXTYPE_PRIVATE19 = SPLEXICONTYPE.PRIVATE19;
pub const eLEXTYPE_PRIVATE20 = SPLEXICONTYPE.PRIVATE20;
pub const SPWORDTYPE = enum(i32) {
ADDED = 1,
DELETED = 2,
};
pub const eWORDTYPE_ADDED = SPWORDTYPE.ADDED;
pub const eWORDTYPE_DELETED = SPWORDTYPE.DELETED;
pub const SPPRONUNCIATIONFLAGS = enum(i32) {
D = 1,
};
pub const ePRONFLAG_USED = SPPRONUNCIATIONFLAGS.D;
pub const SPWORDPRONUNCIATION = extern struct {
pNextWordPronunciation: ?*SPWORDPRONUNCIATION,
eLexiconType: SPLEXICONTYPE,
LangID: u16,
wPronunciationFlags: u16,
ePartOfSpeech: SPPARTOFSPEECH,
szPronunciation: [1]u16,
};
pub const SPWORDPRONUNCIATIONLIST = extern struct {
ulSize: u32,
pvBuffer: ?*u8,
pFirstWordPronunciation: ?*SPWORDPRONUNCIATION,
};
pub const SPWORD = extern struct {
pNextWord: ?*SPWORD,
LangID: u16,
wReserved: u16,
eWordType: SPWORDTYPE,
pszWord: ?PWSTR,
pFirstWordPronunciation: ?*SPWORDPRONUNCIATION,
};
pub const SPWORDLIST = extern struct {
ulSize: u32,
pvBuffer: ?*u8,
pFirstWord: ?*SPWORD,
};
const IID_ISpLexicon_Value = @import("../zig.zig").Guid.initString("da41a7c2-5383-4db2-916b-6c1719e3db58");
pub const IID_ISpLexicon = &IID_ISpLexicon_Value;
pub const ISpLexicon = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetPronunciations: fn(
self: *const ISpLexicon,
pszWord: ?[*:0]const u16,
LangID: u16,
dwFlags: u32,
pWordPronunciationList: ?*SPWORDPRONUNCIATIONLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddPronunciation: fn(
self: *const ISpLexicon,
pszWord: ?[*:0]const u16,
LangID: u16,
ePartOfSpeech: SPPARTOFSPEECH,
pszPronunciation: ?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemovePronunciation: fn(
self: *const ISpLexicon,
pszWord: ?[*:0]const u16,
LangID: u16,
ePartOfSpeech: SPPARTOFSPEECH,
pszPronunciation: ?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetGeneration: fn(
self: *const ISpLexicon,
pdwGeneration: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetGenerationChange: fn(
self: *const ISpLexicon,
dwFlags: u32,
pdwGeneration: ?*u32,
pWordList: ?*SPWORDLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetWords: fn(
self: *const ISpLexicon,
dwFlags: u32,
pdwGeneration: ?*u32,
pdwCookie: ?*u32,
pWordList: ?*SPWORDLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpLexicon_GetPronunciations(self: *const T, pszWord: ?[*:0]const u16, LangID: u16, dwFlags: u32, pWordPronunciationList: ?*SPWORDPRONUNCIATIONLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpLexicon.VTable, self.vtable).GetPronunciations(@ptrCast(*const ISpLexicon, self), pszWord, LangID, dwFlags, pWordPronunciationList);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpLexicon_AddPronunciation(self: *const T, pszWord: ?[*:0]const u16, LangID: u16, ePartOfSpeech: SPPARTOFSPEECH, pszPronunciation: ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpLexicon.VTable, self.vtable).AddPronunciation(@ptrCast(*const ISpLexicon, self), pszWord, LangID, ePartOfSpeech, pszPronunciation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpLexicon_RemovePronunciation(self: *const T, pszWord: ?[*:0]const u16, LangID: u16, ePartOfSpeech: SPPARTOFSPEECH, pszPronunciation: ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpLexicon.VTable, self.vtable).RemovePronunciation(@ptrCast(*const ISpLexicon, self), pszWord, LangID, ePartOfSpeech, pszPronunciation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpLexicon_GetGeneration(self: *const T, pdwGeneration: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpLexicon.VTable, self.vtable).GetGeneration(@ptrCast(*const ISpLexicon, self), pdwGeneration);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpLexicon_GetGenerationChange(self: *const T, dwFlags: u32, pdwGeneration: ?*u32, pWordList: ?*SPWORDLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpLexicon.VTable, self.vtable).GetGenerationChange(@ptrCast(*const ISpLexicon, self), dwFlags, pdwGeneration, pWordList);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpLexicon_GetWords(self: *const T, dwFlags: u32, pdwGeneration: ?*u32, pdwCookie: ?*u32, pWordList: ?*SPWORDLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpLexicon.VTable, self.vtable).GetWords(@ptrCast(*const ISpLexicon, self), dwFlags, pdwGeneration, pdwCookie, pWordList);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpContainerLexicon_Value = @import("../zig.zig").Guid.initString("8565572f-c094-41cc-b56e-10bd9c3ff044");
pub const IID_ISpContainerLexicon = &IID_ISpContainerLexicon_Value;
pub const ISpContainerLexicon = extern struct {
pub const VTable = extern struct {
base: ISpLexicon.VTable,
AddLexicon: fn(
self: *const ISpContainerLexicon,
pAddLexicon: ?*ISpLexicon,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpLexicon.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpContainerLexicon_AddLexicon(self: *const T, pAddLexicon: ?*ISpLexicon, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpContainerLexicon.VTable, self.vtable).AddLexicon(@ptrCast(*const ISpContainerLexicon, self), pAddLexicon, dwFlags);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPSHORTCUTTYPE = enum(i32) {
SHT_NotOverriden = -1,
SHT_Unknown = 0,
SHT_EMAIL = 4096,
SHT_OTHER = 8192,
PS_RESERVED1 = 12288,
PS_RESERVED2 = 16384,
PS_RESERVED3 = 20480,
PS_RESERVED4 = 61440,
};
pub const SPSHT_NotOverriden = SPSHORTCUTTYPE.SHT_NotOverriden;
pub const SPSHT_Unknown = SPSHORTCUTTYPE.SHT_Unknown;
pub const SPSHT_EMAIL = SPSHORTCUTTYPE.SHT_EMAIL;
pub const SPSHT_OTHER = SPSHORTCUTTYPE.SHT_OTHER;
pub const SPPS_RESERVED1 = SPSHORTCUTTYPE.PS_RESERVED1;
pub const SPPS_RESERVED2 = SPSHORTCUTTYPE.PS_RESERVED2;
pub const SPPS_RESERVED3 = SPSHORTCUTTYPE.PS_RESERVED3;
pub const SPPS_RESERVED4 = SPSHORTCUTTYPE.PS_RESERVED4;
pub const SPSHORTCUTPAIR = extern struct {
pNextSHORTCUTPAIR: ?*SPSHORTCUTPAIR,
LangID: u16,
shType: SPSHORTCUTTYPE,
pszDisplay: ?PWSTR,
pszSpoken: ?PWSTR,
};
pub const SPSHORTCUTPAIRLIST = extern struct {
ulSize: u32,
pvBuffer: ?*u8,
pFirstShortcutPair: ?*SPSHORTCUTPAIR,
};
const IID_ISpShortcut_Value = @import("../zig.zig").Guid.initString("3df681e2-ea56-11d9-8bde-f66bad1e3f3a");
pub const IID_ISpShortcut = &IID_ISpShortcut_Value;
pub const ISpShortcut = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddShortcut: fn(
self: *const ISpShortcut,
pszDisplay: ?[*:0]const u16,
LangID: u16,
pszSpoken: ?[*:0]const u16,
shType: SPSHORTCUTTYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemoveShortcut: fn(
self: *const ISpShortcut,
pszDisplay: ?[*:0]const u16,
LangID: u16,
pszSpoken: ?[*:0]const u16,
shType: SPSHORTCUTTYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetShortcuts: fn(
self: *const ISpShortcut,
LangID: u16,
pShortcutpairList: ?*SPSHORTCUTPAIRLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetGeneration: fn(
self: *const ISpShortcut,
pdwGeneration: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetWordsFromGenerationChange: fn(
self: *const ISpShortcut,
pdwGeneration: ?*u32,
pWordList: ?*SPWORDLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetWords: fn(
self: *const ISpShortcut,
pdwGeneration: ?*u32,
pdwCookie: ?*u32,
pWordList: ?*SPWORDLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetShortcutsForGeneration: fn(
self: *const ISpShortcut,
pdwGeneration: ?*u32,
pdwCookie: ?*u32,
pShortcutpairList: ?*SPSHORTCUTPAIRLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetGenerationChange: fn(
self: *const ISpShortcut,
pdwGeneration: ?*u32,
pShortcutpairList: ?*SPSHORTCUTPAIRLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpShortcut_AddShortcut(self: *const T, pszDisplay: ?[*:0]const u16, LangID: u16, pszSpoken: ?[*:0]const u16, shType: SPSHORTCUTTYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpShortcut.VTable, self.vtable).AddShortcut(@ptrCast(*const ISpShortcut, self), pszDisplay, LangID, pszSpoken, shType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpShortcut_RemoveShortcut(self: *const T, pszDisplay: ?[*:0]const u16, LangID: u16, pszSpoken: ?[*:0]const u16, shType: SPSHORTCUTTYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpShortcut.VTable, self.vtable).RemoveShortcut(@ptrCast(*const ISpShortcut, self), pszDisplay, LangID, pszSpoken, shType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpShortcut_GetShortcuts(self: *const T, LangID: u16, pShortcutpairList: ?*SPSHORTCUTPAIRLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpShortcut.VTable, self.vtable).GetShortcuts(@ptrCast(*const ISpShortcut, self), LangID, pShortcutpairList);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpShortcut_GetGeneration(self: *const T, pdwGeneration: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpShortcut.VTable, self.vtable).GetGeneration(@ptrCast(*const ISpShortcut, self), pdwGeneration);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpShortcut_GetWordsFromGenerationChange(self: *const T, pdwGeneration: ?*u32, pWordList: ?*SPWORDLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpShortcut.VTable, self.vtable).GetWordsFromGenerationChange(@ptrCast(*const ISpShortcut, self), pdwGeneration, pWordList);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpShortcut_GetWords(self: *const T, pdwGeneration: ?*u32, pdwCookie: ?*u32, pWordList: ?*SPWORDLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpShortcut.VTable, self.vtable).GetWords(@ptrCast(*const ISpShortcut, self), pdwGeneration, pdwCookie, pWordList);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpShortcut_GetShortcutsForGeneration(self: *const T, pdwGeneration: ?*u32, pdwCookie: ?*u32, pShortcutpairList: ?*SPSHORTCUTPAIRLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpShortcut.VTable, self.vtable).GetShortcutsForGeneration(@ptrCast(*const ISpShortcut, self), pdwGeneration, pdwCookie, pShortcutpairList);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpShortcut_GetGenerationChange(self: *const T, pdwGeneration: ?*u32, pShortcutpairList: ?*SPSHORTCUTPAIRLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpShortcut.VTable, self.vtable).GetGenerationChange(@ptrCast(*const ISpShortcut, self), pdwGeneration, pShortcutpairList);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpPhoneConverter_Value = @import("../zig.zig").Guid.initString("8445c581-0cac-4a38-abfe-9b2ce2826455");
pub const IID_ISpPhoneConverter = &IID_ISpPhoneConverter_Value;
pub const ISpPhoneConverter = extern struct {
pub const VTable = extern struct {
base: ISpObjectWithToken.VTable,
PhoneToId: fn(
self: *const ISpPhoneConverter,
pszPhone: ?[*:0]const u16,
pId: ?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IdToPhone: fn(
self: *const ISpPhoneConverter,
pId: ?*u16,
pszPhone: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpObjectWithToken.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhoneConverter_PhoneToId(self: *const T, pszPhone: ?[*:0]const u16, pId: ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhoneConverter.VTable, self.vtable).PhoneToId(@ptrCast(*const ISpPhoneConverter, self), pszPhone, pId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhoneConverter_IdToPhone(self: *const T, pId: ?*u16, pszPhone: ?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhoneConverter.VTable, self.vtable).IdToPhone(@ptrCast(*const ISpPhoneConverter, self), pId, pszPhone);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpPhoneticAlphabetConverter_Value = @import("../zig.zig").Guid.initString("133adcd4-19b4-4020-9fdc-842e78253b17");
pub const IID_ISpPhoneticAlphabetConverter = &IID_ISpPhoneticAlphabetConverter_Value;
pub const ISpPhoneticAlphabetConverter = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetLangId: fn(
self: *const ISpPhoneticAlphabetConverter,
pLangID: ?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetLangId: fn(
self: *const ISpPhoneticAlphabetConverter,
LangID: u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SAPI2UPS: fn(
self: *const ISpPhoneticAlphabetConverter,
pszSAPIId: ?*const u16,
pszUPSId: [*:0]u16,
cMaxLength: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UPS2SAPI: fn(
self: *const ISpPhoneticAlphabetConverter,
pszUPSId: ?*const u16,
pszSAPIId: [*:0]u16,
cMaxLength: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMaxConvertLength: fn(
self: *const ISpPhoneticAlphabetConverter,
cSrcLength: u32,
bSAPI2UPS: BOOL,
pcMaxDestLength: ?*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 ISpPhoneticAlphabetConverter_GetLangId(self: *const T, pLangID: ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhoneticAlphabetConverter.VTable, self.vtable).GetLangId(@ptrCast(*const ISpPhoneticAlphabetConverter, self), pLangID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhoneticAlphabetConverter_SetLangId(self: *const T, LangID: u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhoneticAlphabetConverter.VTable, self.vtable).SetLangId(@ptrCast(*const ISpPhoneticAlphabetConverter, self), LangID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhoneticAlphabetConverter_SAPI2UPS(self: *const T, pszSAPIId: ?*const u16, pszUPSId: [*:0]u16, cMaxLength: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhoneticAlphabetConverter.VTable, self.vtable).SAPI2UPS(@ptrCast(*const ISpPhoneticAlphabetConverter, self), pszSAPIId, pszUPSId, cMaxLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhoneticAlphabetConverter_UPS2SAPI(self: *const T, pszUPSId: ?*const u16, pszSAPIId: [*:0]u16, cMaxLength: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhoneticAlphabetConverter.VTable, self.vtable).UPS2SAPI(@ptrCast(*const ISpPhoneticAlphabetConverter, self), pszUPSId, pszSAPIId, cMaxLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhoneticAlphabetConverter_GetMaxConvertLength(self: *const T, cSrcLength: u32, bSAPI2UPS: BOOL, pcMaxDestLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhoneticAlphabetConverter.VTable, self.vtable).GetMaxConvertLength(@ptrCast(*const ISpPhoneticAlphabetConverter, self), cSrcLength, bSAPI2UPS, pcMaxDestLength);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpPhoneticAlphabetSelection_Value = @import("../zig.zig").Guid.initString("b2745efd-42ce-48ca-81f1-a96e02538a90");
pub const IID_ISpPhoneticAlphabetSelection = &IID_ISpPhoneticAlphabetSelection_Value;
pub const ISpPhoneticAlphabetSelection = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
IsAlphabetUPS: fn(
self: *const ISpPhoneticAlphabetSelection,
pfIsUPS: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphabetToUPS: fn(
self: *const ISpPhoneticAlphabetSelection,
fForceUPS: 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 ISpPhoneticAlphabetSelection_IsAlphabetUPS(self: *const T, pfIsUPS: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhoneticAlphabetSelection.VTable, self.vtable).IsAlphabetUPS(@ptrCast(*const ISpPhoneticAlphabetSelection, self), pfIsUPS);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhoneticAlphabetSelection_SetAlphabetToUPS(self: *const T, fForceUPS: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhoneticAlphabetSelection.VTable, self.vtable).SetAlphabetToUPS(@ptrCast(*const ISpPhoneticAlphabetSelection, self), fForceUPS);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPVPITCH = extern struct {
MiddleAdj: i32,
RangeAdj: i32,
};
pub const SPVACTIONS = enum(i32) {
Speak = 0,
Silence = 1,
Pronounce = 2,
Bookmark = 3,
SpellOut = 4,
Section = 5,
ParseUnknownTag = 6,
};
pub const SPVA_Speak = SPVACTIONS.Speak;
pub const SPVA_Silence = SPVACTIONS.Silence;
pub const SPVA_Pronounce = SPVACTIONS.Pronounce;
pub const SPVA_Bookmark = SPVACTIONS.Bookmark;
pub const SPVA_SpellOut = SPVACTIONS.SpellOut;
pub const SPVA_Section = SPVACTIONS.Section;
pub const SPVA_ParseUnknownTag = SPVACTIONS.ParseUnknownTag;
pub const SPVCONTEXT = extern struct {
pCategory: ?[*:0]const u16,
pBefore: ?[*:0]const u16,
pAfter: ?[*:0]const u16,
};
pub const SPVSTATE = extern struct {
eAction: SPVACTIONS,
LangID: u16,
wReserved: u16,
EmphAdj: i32,
RateAdj: i32,
Volume: u32,
PitchAdj: SPVPITCH,
SilenceMSecs: u32,
pPhoneIds: ?*u16,
ePartOfSpeech: SPPARTOFSPEECH,
Context: SPVCONTEXT,
};
pub const SPRUNSTATE = enum(i32) {
DONE = 1,
IS_SPEAKING = 2,
};
pub const SPRS_DONE = SPRUNSTATE.DONE;
pub const SPRS_IS_SPEAKING = SPRUNSTATE.IS_SPEAKING;
pub const SPVLIMITS = enum(i32) {
IN_VOLUME = 0,
AX_VOLUME = 100,
IN_RATE = -10,
AX_RATE = 10,
};
pub const SPMIN_VOLUME = SPVLIMITS.IN_VOLUME;
pub const SPMAX_VOLUME = SPVLIMITS.AX_VOLUME;
pub const SPMIN_RATE = SPVLIMITS.IN_RATE;
pub const SPMAX_RATE = SPVLIMITS.AX_RATE;
pub const SPVPRIORITY = enum(i32) {
NORMAL = 0,
ALERT = 1,
OVER = 2,
};
pub const SPVPRI_NORMAL = SPVPRIORITY.NORMAL;
pub const SPVPRI_ALERT = SPVPRIORITY.ALERT;
pub const SPVPRI_OVER = SPVPRIORITY.OVER;
pub const SPVOICESTATUS = extern struct {
ulCurrentStream: u32,
ulLastStreamQueued: u32,
hrLastResult: HRESULT,
dwRunningState: u32,
ulInputWordPos: u32,
ulInputWordLen: u32,
ulInputSentPos: u32,
ulInputSentLen: u32,
lBookmarkId: i32,
PhonemeId: u16,
VisemeId: SPVISEMES,
dwReserved1: u32,
dwReserved2: u32,
};
pub const SPEAKFLAGS = enum(i32) {
DEFAULT = 0,
ASYNC = 1,
PURGEBEFORESPEAK = 2,
IS_FILENAME = 4,
IS_XML = 8,
IS_NOT_XML = 16,
PERSIST_XML = 32,
NLP_SPEAK_PUNC = 64,
PARSE_SAPI = 128,
PARSE_SSML = 256,
// PARSE_AUTODETECT = 0, this enum value conflicts with DEFAULT
// NLP_MASK = 64, this enum value conflicts with NLP_SPEAK_PUNC
PARSE_MASK = 384,
VOICE_MASK = 511,
UNUSED_FLAGS = -512,
};
pub const SPF_DEFAULT = SPEAKFLAGS.DEFAULT;
pub const SPF_ASYNC = SPEAKFLAGS.ASYNC;
pub const SPF_PURGEBEFORESPEAK = SPEAKFLAGS.PURGEBEFORESPEAK;
pub const SPF_IS_FILENAME = SPEAKFLAGS.IS_FILENAME;
pub const SPF_IS_XML = SPEAKFLAGS.IS_XML;
pub const SPF_IS_NOT_XML = SPEAKFLAGS.IS_NOT_XML;
pub const SPF_PERSIST_XML = SPEAKFLAGS.PERSIST_XML;
pub const SPF_NLP_SPEAK_PUNC = SPEAKFLAGS.NLP_SPEAK_PUNC;
pub const SPF_PARSE_SAPI = SPEAKFLAGS.PARSE_SAPI;
pub const SPF_PARSE_SSML = SPEAKFLAGS.PARSE_SSML;
pub const SPF_PARSE_AUTODETECT = SPEAKFLAGS.DEFAULT;
pub const SPF_NLP_MASK = SPEAKFLAGS.NLP_SPEAK_PUNC;
pub const SPF_PARSE_MASK = SPEAKFLAGS.PARSE_MASK;
pub const SPF_VOICE_MASK = SPEAKFLAGS.VOICE_MASK;
pub const SPF_UNUSED_FLAGS = SPEAKFLAGS.UNUSED_FLAGS;
const IID_ISpVoice_Value = @import("../zig.zig").Guid.initString("6c44df74-72b9-4992-a1ec-ef996e0422d4");
pub const IID_ISpVoice = &IID_ISpVoice_Value;
pub const ISpVoice = extern struct {
pub const VTable = extern struct {
base: ISpEventSource.VTable,
SetOutput: fn(
self: *const ISpVoice,
pUnkOutput: ?*IUnknown,
fAllowFormatChanges: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetOutputObjectToken: fn(
self: *const ISpVoice,
ppObjectToken: ?*?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetOutputStream: fn(
self: *const ISpVoice,
ppStream: ?*?*ISpStreamFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Pause: fn(
self: *const ISpVoice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Resume: fn(
self: *const ISpVoice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVoice: fn(
self: *const ISpVoice,
pToken: ?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVoice: fn(
self: *const ISpVoice,
ppToken: ?*?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Speak: fn(
self: *const ISpVoice,
pwcs: ?[*:0]const u16,
dwFlags: u32,
pulStreamNumber: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SpeakStream: fn(
self: *const ISpVoice,
pStream: ?*IStream,
dwFlags: u32,
pulStreamNumber: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStatus: fn(
self: *const ISpVoice,
pStatus: ?*SPVOICESTATUS,
ppszLastBookmark: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const ISpVoice,
pItemType: ?[*:0]const u16,
lNumItems: i32,
pulNumSkipped: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPriority: fn(
self: *const ISpVoice,
ePriority: SPVPRIORITY,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPriority: fn(
self: *const ISpVoice,
pePriority: ?*SPVPRIORITY,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlertBoundary: fn(
self: *const ISpVoice,
eBoundary: SPEVENTENUM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAlertBoundary: fn(
self: *const ISpVoice,
peBoundary: ?*SPEVENTENUM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRate: fn(
self: *const ISpVoice,
RateAdjust: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRate: fn(
self: *const ISpVoice,
pRateAdjust: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVolume: fn(
self: *const ISpVoice,
usVolume: u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVolume: fn(
self: *const ISpVoice,
pusVolume: ?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WaitUntilDone: fn(
self: *const ISpVoice,
msTimeout: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSyncSpeakTimeout: fn(
self: *const ISpVoice,
msTimeout: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSyncSpeakTimeout: fn(
self: *const ISpVoice,
pmsTimeout: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SpeakCompleteEvent: fn(
self: *const ISpVoice,
) callconv(@import("std").os.windows.WINAPI) ?HANDLE,
IsUISupported: fn(
self: *const ISpVoice,
pszTypeOfUI: ?[*:0]const u16,
pvExtraData: ?*c_void,
cbExtraData: u32,
pfSupported: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisplayUI: fn(
self: *const ISpVoice,
hwndParent: ?HWND,
pszTitle: ?[*:0]const u16,
pszTypeOfUI: ?[*:0]const u16,
pvExtraData: ?*c_void,
cbExtraData: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpEventSource.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_SetOutput(self: *const T, pUnkOutput: ?*IUnknown, fAllowFormatChanges: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).SetOutput(@ptrCast(*const ISpVoice, self), pUnkOutput, fAllowFormatChanges);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_GetOutputObjectToken(self: *const T, ppObjectToken: ?*?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).GetOutputObjectToken(@ptrCast(*const ISpVoice, self), ppObjectToken);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_GetOutputStream(self: *const T, ppStream: ?*?*ISpStreamFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).GetOutputStream(@ptrCast(*const ISpVoice, self), ppStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_Pause(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).Pause(@ptrCast(*const ISpVoice, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_Resume(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).Resume(@ptrCast(*const ISpVoice, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_SetVoice(self: *const T, pToken: ?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).SetVoice(@ptrCast(*const ISpVoice, self), pToken);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_GetVoice(self: *const T, ppToken: ?*?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).GetVoice(@ptrCast(*const ISpVoice, self), ppToken);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_Speak(self: *const T, pwcs: ?[*:0]const u16, dwFlags: u32, pulStreamNumber: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).Speak(@ptrCast(*const ISpVoice, self), pwcs, dwFlags, pulStreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_SpeakStream(self: *const T, pStream: ?*IStream, dwFlags: u32, pulStreamNumber: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).SpeakStream(@ptrCast(*const ISpVoice, self), pStream, dwFlags, pulStreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_GetStatus(self: *const T, pStatus: ?*SPVOICESTATUS, ppszLastBookmark: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).GetStatus(@ptrCast(*const ISpVoice, self), pStatus, ppszLastBookmark);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_Skip(self: *const T, pItemType: ?[*:0]const u16, lNumItems: i32, pulNumSkipped: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).Skip(@ptrCast(*const ISpVoice, self), pItemType, lNumItems, pulNumSkipped);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_SetPriority(self: *const T, ePriority: SPVPRIORITY) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).SetPriority(@ptrCast(*const ISpVoice, self), ePriority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_GetPriority(self: *const T, pePriority: ?*SPVPRIORITY) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).GetPriority(@ptrCast(*const ISpVoice, self), pePriority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_SetAlertBoundary(self: *const T, eBoundary: SPEVENTENUM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).SetAlertBoundary(@ptrCast(*const ISpVoice, self), eBoundary);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_GetAlertBoundary(self: *const T, peBoundary: ?*SPEVENTENUM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).GetAlertBoundary(@ptrCast(*const ISpVoice, self), peBoundary);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_SetRate(self: *const T, RateAdjust: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).SetRate(@ptrCast(*const ISpVoice, self), RateAdjust);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_GetRate(self: *const T, pRateAdjust: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).GetRate(@ptrCast(*const ISpVoice, self), pRateAdjust);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_SetVolume(self: *const T, usVolume: u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).SetVolume(@ptrCast(*const ISpVoice, self), usVolume);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_GetVolume(self: *const T, pusVolume: ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).GetVolume(@ptrCast(*const ISpVoice, self), pusVolume);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_WaitUntilDone(self: *const T, msTimeout: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).WaitUntilDone(@ptrCast(*const ISpVoice, self), msTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_SetSyncSpeakTimeout(self: *const T, msTimeout: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).SetSyncSpeakTimeout(@ptrCast(*const ISpVoice, self), msTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_GetSyncSpeakTimeout(self: *const T, pmsTimeout: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).GetSyncSpeakTimeout(@ptrCast(*const ISpVoice, self), pmsTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_SpeakCompleteEvent(self: *const T) callconv(.Inline) ?HANDLE {
return @ptrCast(*const ISpVoice.VTable, self.vtable).SpeakCompleteEvent(@ptrCast(*const ISpVoice, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_IsUISupported(self: *const T, pszTypeOfUI: ?[*:0]const u16, pvExtraData: ?*c_void, cbExtraData: u32, pfSupported: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).IsUISupported(@ptrCast(*const ISpVoice, self), pszTypeOfUI, pvExtraData, cbExtraData, pfSupported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpVoice_DisplayUI(self: *const T, hwndParent: ?HWND, pszTitle: ?[*:0]const u16, pszTypeOfUI: ?[*:0]const u16, pvExtraData: ?*c_void, cbExtraData: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpVoice.VTable, self.vtable).DisplayUI(@ptrCast(*const ISpVoice, self), hwndParent, pszTitle, pszTypeOfUI, pvExtraData, cbExtraData);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpPhrase_Value = @import("../zig.zig").Guid.initString("1a5c0354-b621-4b5a-8791-d306ed379e53");
pub const IID_ISpPhrase = &IID_ISpPhrase_Value;
pub const ISpPhrase = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetPhrase: fn(
self: *const ISpPhrase,
ppCoMemPhrase: ?*?*SPPHRASE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSerializedPhrase: fn(
self: *const ISpPhrase,
ppCoMemPhrase: ?*?*SPSERIALIZEDPHRASE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetText: fn(
self: *const ISpPhrase,
ulStart: u32,
ulCount: u32,
fUseTextReplacements: BOOL,
ppszCoMemText: ?*?PWSTR,
pbDisplayAttributes: ?*u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Discard: fn(
self: *const ISpPhrase,
dwValueTypes: 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 ISpPhrase_GetPhrase(self: *const T, ppCoMemPhrase: ?*?*SPPHRASE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhrase.VTable, self.vtable).GetPhrase(@ptrCast(*const ISpPhrase, self), ppCoMemPhrase);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhrase_GetSerializedPhrase(self: *const T, ppCoMemPhrase: ?*?*SPSERIALIZEDPHRASE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhrase.VTable, self.vtable).GetSerializedPhrase(@ptrCast(*const ISpPhrase, self), ppCoMemPhrase);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhrase_GetText(self: *const T, ulStart: u32, ulCount: u32, fUseTextReplacements: BOOL, ppszCoMemText: ?*?PWSTR, pbDisplayAttributes: ?*u8) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhrase.VTable, self.vtable).GetText(@ptrCast(*const ISpPhrase, self), ulStart, ulCount, fUseTextReplacements, ppszCoMemText, pbDisplayAttributes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhrase_Discard(self: *const T, dwValueTypes: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhrase.VTable, self.vtable).Discard(@ptrCast(*const ISpPhrase, self), dwValueTypes);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpPhraseAlt_Value = @import("../zig.zig").Guid.initString("8fcebc98-4e49-4067-9c6c-d86a0e092e3d");
pub const IID_ISpPhraseAlt = &IID_ISpPhraseAlt_Value;
pub const ISpPhraseAlt = extern struct {
pub const VTable = extern struct {
base: ISpPhrase.VTable,
GetAltInfo: fn(
self: *const ISpPhraseAlt,
ppParent: ?*?*ISpPhrase,
pulStartElementInParent: ?*u32,
pcElementsInParent: ?*u32,
pcElementsInAlt: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Commit: fn(
self: *const ISpPhraseAlt,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpPhrase.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhraseAlt_GetAltInfo(self: *const T, ppParent: ?*?*ISpPhrase, pulStartElementInParent: ?*u32, pcElementsInParent: ?*u32, pcElementsInAlt: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhraseAlt.VTable, self.vtable).GetAltInfo(@ptrCast(*const ISpPhraseAlt, self), ppParent, pulStartElementInParent, pcElementsInParent, pcElementsInAlt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhraseAlt_Commit(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhraseAlt.VTable, self.vtable).Commit(@ptrCast(*const ISpPhraseAlt, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPXMLRESULTOPTIONS = enum(i32) {
SML = 0,
Alternates_SML = 1,
};
pub const SPXRO_SML = SPXMLRESULTOPTIONS.SML;
pub const SPXRO_Alternates_SML = SPXMLRESULTOPTIONS.Alternates_SML;
const IID_ISpPhrase2_Value = @import("../zig.zig").Guid.initString("f264da52-e457-4696-b856-a737b717af79");
pub const IID_ISpPhrase2 = &IID_ISpPhrase2_Value;
pub const ISpPhrase2 = extern struct {
pub const VTable = extern struct {
base: ISpPhrase.VTable,
GetXMLResult: fn(
self: *const ISpPhrase2,
ppszCoMemXMLResult: ?*?PWSTR,
Options: SPXMLRESULTOPTIONS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetXMLErrorInfo: fn(
self: *const ISpPhrase2,
pSemanticErrorInfo: ?*SPSEMANTICERRORINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAudio: fn(
self: *const ISpPhrase2,
ulStartElement: u32,
cElements: u32,
ppStream: ?*?*ISpStreamFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpPhrase.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhrase2_GetXMLResult(self: *const T, ppszCoMemXMLResult: ?*?PWSTR, Options: SPXMLRESULTOPTIONS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhrase2.VTable, self.vtable).GetXMLResult(@ptrCast(*const ISpPhrase2, self), ppszCoMemXMLResult, Options);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhrase2_GetXMLErrorInfo(self: *const T, pSemanticErrorInfo: ?*SPSEMANTICERRORINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhrase2.VTable, self.vtable).GetXMLErrorInfo(@ptrCast(*const ISpPhrase2, self), pSemanticErrorInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpPhrase2_GetAudio(self: *const T, ulStartElement: u32, cElements: u32, ppStream: ?*?*ISpStreamFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpPhrase2.VTable, self.vtable).GetAudio(@ptrCast(*const ISpPhrase2, self), ulStartElement, cElements, ppStream);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPRECORESULTTIMES = extern struct {
ftStreamTime: FILETIME,
ullLength: u64,
dwTickCount: u32,
ullStart: u64,
};
pub const SPSERIALIZEDRESULT = extern struct {
ulSerializedSize: u32,
};
const IID_ISpRecoResult_Value = @import("../zig.zig").Guid.initString("20b053be-e235-43cd-9a2a-8d17a48b7842");
pub const IID_ISpRecoResult = &IID_ISpRecoResult_Value;
pub const ISpRecoResult = extern struct {
pub const VTable = extern struct {
base: ISpPhrase.VTable,
GetResultTimes: fn(
self: *const ISpRecoResult,
pTimes: ?*SPRECORESULTTIMES,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAlternates: fn(
self: *const ISpRecoResult,
ulStartElement: u32,
cElements: u32,
ulRequestCount: u32,
ppPhrases: [*]?*ISpPhraseAlt,
pcPhrasesReturned: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAudio: fn(
self: *const ISpRecoResult,
ulStartElement: u32,
cElements: u32,
ppStream: ?*?*ISpStreamFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SpeakAudio: fn(
self: *const ISpRecoResult,
ulStartElement: u32,
cElements: u32,
dwFlags: u32,
pulStreamNumber: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Serialize: fn(
self: *const ISpRecoResult,
ppCoMemSerializedResult: ?*?*SPSERIALIZEDRESULT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ScaleAudio: fn(
self: *const ISpRecoResult,
pAudioFormatId: ?*const Guid,
pWaveFormatEx: ?*const WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRecoContext: fn(
self: *const ISpRecoResult,
ppRecoContext: ?*?*ISpRecoContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpPhrase.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult_GetResultTimes(self: *const T, pTimes: ?*SPRECORESULTTIMES) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult.VTable, self.vtable).GetResultTimes(@ptrCast(*const ISpRecoResult, self), pTimes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult_GetAlternates(self: *const T, ulStartElement: u32, cElements: u32, ulRequestCount: u32, ppPhrases: [*]?*ISpPhraseAlt, pcPhrasesReturned: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult.VTable, self.vtable).GetAlternates(@ptrCast(*const ISpRecoResult, self), ulStartElement, cElements, ulRequestCount, ppPhrases, pcPhrasesReturned);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult_GetAudio(self: *const T, ulStartElement: u32, cElements: u32, ppStream: ?*?*ISpStreamFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult.VTable, self.vtable).GetAudio(@ptrCast(*const ISpRecoResult, self), ulStartElement, cElements, ppStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult_SpeakAudio(self: *const T, ulStartElement: u32, cElements: u32, dwFlags: u32, pulStreamNumber: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult.VTable, self.vtable).SpeakAudio(@ptrCast(*const ISpRecoResult, self), ulStartElement, cElements, dwFlags, pulStreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult_Serialize(self: *const T, ppCoMemSerializedResult: ?*?*SPSERIALIZEDRESULT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult.VTable, self.vtable).Serialize(@ptrCast(*const ISpRecoResult, self), ppCoMemSerializedResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult_ScaleAudio(self: *const T, pAudioFormatId: ?*const Guid, pWaveFormatEx: ?*const WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult.VTable, self.vtable).ScaleAudio(@ptrCast(*const ISpRecoResult, self), pAudioFormatId, pWaveFormatEx);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult_GetRecoContext(self: *const T, ppRecoContext: ?*?*ISpRecoContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult.VTable, self.vtable).GetRecoContext(@ptrCast(*const ISpRecoResult, self), ppRecoContext);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPCOMMITFLAGS = enum(i32) {
NONE = 0,
ADD_TO_USER_LEXICON = 1,
DEFINITE_CORRECTION = 2,
};
pub const SPCF_NONE = SPCOMMITFLAGS.NONE;
pub const SPCF_ADD_TO_USER_LEXICON = SPCOMMITFLAGS.ADD_TO_USER_LEXICON;
pub const SPCF_DEFINITE_CORRECTION = SPCOMMITFLAGS.DEFINITE_CORRECTION;
const IID_ISpRecoResult2_Value = @import("../zig.zig").Guid.initString("27cac6c4-88f2-41f2-8817-0c95e59f1e6e");
pub const IID_ISpRecoResult2 = &IID_ISpRecoResult2_Value;
pub const ISpRecoResult2 = extern struct {
pub const VTable = extern struct {
base: ISpRecoResult.VTable,
CommitAlternate: fn(
self: *const ISpRecoResult2,
pPhraseAlt: ?*ISpPhraseAlt,
ppNewResult: ?*?*ISpRecoResult,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CommitText: fn(
self: *const ISpRecoResult2,
ulStartElement: u32,
cElements: u32,
pszCorrectedData: ?[*:0]const u16,
eCommitFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTextFeedback: fn(
self: *const ISpRecoResult2,
pszFeedback: ?[*:0]const u16,
fSuccessful: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpRecoResult.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult2_CommitAlternate(self: *const T, pPhraseAlt: ?*ISpPhraseAlt, ppNewResult: ?*?*ISpRecoResult) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult2.VTable, self.vtable).CommitAlternate(@ptrCast(*const ISpRecoResult2, self), pPhraseAlt, ppNewResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult2_CommitText(self: *const T, ulStartElement: u32, cElements: u32, pszCorrectedData: ?[*:0]const u16, eCommitFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult2.VTable, self.vtable).CommitText(@ptrCast(*const ISpRecoResult2, self), ulStartElement, cElements, pszCorrectedData, eCommitFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoResult2_SetTextFeedback(self: *const T, pszFeedback: ?[*:0]const u16, fSuccessful: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoResult2.VTable, self.vtable).SetTextFeedback(@ptrCast(*const ISpRecoResult2, self), pszFeedback, fSuccessful);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpXMLRecoResult_Value = @import("../zig.zig").Guid.initString("ae39362b-45a8-4074-9b9e-ccf49aa2d0b6");
pub const IID_ISpXMLRecoResult = &IID_ISpXMLRecoResult_Value;
pub const ISpXMLRecoResult = extern struct {
pub const VTable = extern struct {
base: ISpRecoResult.VTable,
GetXMLResult: fn(
self: *const ISpXMLRecoResult,
ppszCoMemXMLResult: ?*?PWSTR,
Options: SPXMLRESULTOPTIONS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetXMLErrorInfo: fn(
self: *const ISpXMLRecoResult,
pSemanticErrorInfo: ?*SPSEMANTICERRORINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpRecoResult.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpXMLRecoResult_GetXMLResult(self: *const T, ppszCoMemXMLResult: ?*?PWSTR, Options: SPXMLRESULTOPTIONS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpXMLRecoResult.VTable, self.vtable).GetXMLResult(@ptrCast(*const ISpXMLRecoResult, self), ppszCoMemXMLResult, Options);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpXMLRecoResult_GetXMLErrorInfo(self: *const T, pSemanticErrorInfo: ?*SPSEMANTICERRORINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpXMLRecoResult.VTable, self.vtable).GetXMLErrorInfo(@ptrCast(*const ISpXMLRecoResult, self), pSemanticErrorInfo);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPTEXTSELECTIONINFO = extern struct {
ulStartActiveOffset: u32,
cchActiveChars: u32,
ulStartSelection: u32,
cchSelection: u32,
};
pub const SPWORDPRONOUNCEABLE = enum(i32) {
UNKNOWN_WORD_UNPRONOUNCEABLE = 0,
UNKNOWN_WORD_PRONOUNCEABLE = 1,
KNOWN_WORD_PRONOUNCEABLE = 2,
};
pub const SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE = SPWORDPRONOUNCEABLE.UNKNOWN_WORD_UNPRONOUNCEABLE;
pub const SPWP_UNKNOWN_WORD_PRONOUNCEABLE = SPWORDPRONOUNCEABLE.UNKNOWN_WORD_PRONOUNCEABLE;
pub const SPWP_KNOWN_WORD_PRONOUNCEABLE = SPWORDPRONOUNCEABLE.KNOWN_WORD_PRONOUNCEABLE;
pub const SPGRAMMARSTATE = enum(i32) {
DISABLED = 0,
ENABLED = 1,
EXCLUSIVE = 3,
};
pub const SPGS_DISABLED = SPGRAMMARSTATE.DISABLED;
pub const SPGS_ENABLED = SPGRAMMARSTATE.ENABLED;
pub const SPGS_EXCLUSIVE = SPGRAMMARSTATE.EXCLUSIVE;
pub const SPCONTEXTSTATE = enum(i32) {
DISABLED = 0,
ENABLED = 1,
};
pub const SPCS_DISABLED = SPCONTEXTSTATE.DISABLED;
pub const SPCS_ENABLED = SPCONTEXTSTATE.ENABLED;
pub const SPRULESTATE = enum(i32) {
INACTIVE = 0,
ACTIVE = 1,
ACTIVE_WITH_AUTO_PAUSE = 3,
ACTIVE_USER_DELIMITED = 4,
};
pub const SPRS_INACTIVE = SPRULESTATE.INACTIVE;
pub const SPRS_ACTIVE = SPRULESTATE.ACTIVE;
pub const SPRS_ACTIVE_WITH_AUTO_PAUSE = SPRULESTATE.ACTIVE_WITH_AUTO_PAUSE;
pub const SPRS_ACTIVE_USER_DELIMITED = SPRULESTATE.ACTIVE_USER_DELIMITED;
pub const SPGRAMMARWORDTYPE = enum(i32) {
DISPLAY = 0,
LEXICAL = 1,
PRONUNCIATION = 2,
LEXICAL_NO_SPECIAL_CHARS = 3,
};
pub const SPWT_DISPLAY = SPGRAMMARWORDTYPE.DISPLAY;
pub const SPWT_LEXICAL = SPGRAMMARWORDTYPE.LEXICAL;
pub const SPWT_PRONUNCIATION = SPGRAMMARWORDTYPE.PRONUNCIATION;
pub const SPWT_LEXICAL_NO_SPECIAL_CHARS = SPGRAMMARWORDTYPE.LEXICAL_NO_SPECIAL_CHARS;
pub const SPPROPERTYINFO = extern struct {
pszName: ?[*:0]const u16,
ulId: u32,
pszValue: ?[*:0]const u16,
vValue: VARIANT,
};
pub const SPCFGRULEATTRIBUTES = enum(i32) {
TopLevel = 1,
Active = 2,
Export = 4,
Import = 8,
Interpreter = 16,
Dynamic = 32,
Root = 64,
AutoPause = 65536,
UserDelimited = 131072,
};
pub const SPRAF_TopLevel = SPCFGRULEATTRIBUTES.TopLevel;
pub const SPRAF_Active = SPCFGRULEATTRIBUTES.Active;
pub const SPRAF_Export = SPCFGRULEATTRIBUTES.Export;
pub const SPRAF_Import = SPCFGRULEATTRIBUTES.Import;
pub const SPRAF_Interpreter = SPCFGRULEATTRIBUTES.Interpreter;
pub const SPRAF_Dynamic = SPCFGRULEATTRIBUTES.Dynamic;
pub const SPRAF_Root = SPCFGRULEATTRIBUTES.Root;
pub const SPRAF_AutoPause = SPCFGRULEATTRIBUTES.AutoPause;
pub const SPRAF_UserDelimited = SPCFGRULEATTRIBUTES.UserDelimited;
const IID_ISpGrammarBuilder_Value = @import("../zig.zig").Guid.initString("8137828f-591a-4a42-be58-49ea7ebaac68");
pub const IID_ISpGrammarBuilder = &IID_ISpGrammarBuilder_Value;
pub const ISpGrammarBuilder = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ResetGrammar: fn(
self: *const ISpGrammarBuilder,
NewLanguage: u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRule: fn(
self: *const ISpGrammarBuilder,
pszRuleName: ?[*:0]const u16,
dwRuleId: u32,
dwAttributes: u32,
fCreateIfNotExist: BOOL,
phInitialState: ?*?*SPSTATEHANDLE__,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ClearRule: fn(
self: *const ISpGrammarBuilder,
hState: ?*SPSTATEHANDLE__,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateNewState: fn(
self: *const ISpGrammarBuilder,
hState: ?*SPSTATEHANDLE__,
phState: ?*?*SPSTATEHANDLE__,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddWordTransition: fn(
self: *const ISpGrammarBuilder,
hFromState: ?*SPSTATEHANDLE__,
hToState: ?*SPSTATEHANDLE__,
psz: ?[*:0]const u16,
pszSeparators: ?[*:0]const u16,
eWordType: SPGRAMMARWORDTYPE,
Weight: f32,
pPropInfo: ?*const SPPROPERTYINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddRuleTransition: fn(
self: *const ISpGrammarBuilder,
hFromState: ?*SPSTATEHANDLE__,
hToState: ?*SPSTATEHANDLE__,
hRule: ?*SPSTATEHANDLE__,
Weight: f32,
pPropInfo: ?*const SPPROPERTYINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddResource: fn(
self: *const ISpGrammarBuilder,
hRuleState: ?*SPSTATEHANDLE__,
pszResourceName: ?[*:0]const u16,
pszResourceValue: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Commit: fn(
self: *const ISpGrammarBuilder,
dwReserved: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder_ResetGrammar(self: *const T, NewLanguage: u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder.VTable, self.vtable).ResetGrammar(@ptrCast(*const ISpGrammarBuilder, self), NewLanguage);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder_GetRule(self: *const T, pszRuleName: ?[*:0]const u16, dwRuleId: u32, dwAttributes: u32, fCreateIfNotExist: BOOL, phInitialState: ?*?*SPSTATEHANDLE__) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder.VTable, self.vtable).GetRule(@ptrCast(*const ISpGrammarBuilder, self), pszRuleName, dwRuleId, dwAttributes, fCreateIfNotExist, phInitialState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder_ClearRule(self: *const T, hState: ?*SPSTATEHANDLE__) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder.VTable, self.vtable).ClearRule(@ptrCast(*const ISpGrammarBuilder, self), hState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder_CreateNewState(self: *const T, hState: ?*SPSTATEHANDLE__, phState: ?*?*SPSTATEHANDLE__) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder.VTable, self.vtable).CreateNewState(@ptrCast(*const ISpGrammarBuilder, self), hState, phState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder_AddWordTransition(self: *const T, hFromState: ?*SPSTATEHANDLE__, hToState: ?*SPSTATEHANDLE__, psz: ?[*:0]const u16, pszSeparators: ?[*:0]const u16, eWordType: SPGRAMMARWORDTYPE, Weight: f32, pPropInfo: ?*const SPPROPERTYINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder.VTable, self.vtable).AddWordTransition(@ptrCast(*const ISpGrammarBuilder, self), hFromState, hToState, psz, pszSeparators, eWordType, Weight, pPropInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder_AddRuleTransition(self: *const T, hFromState: ?*SPSTATEHANDLE__, hToState: ?*SPSTATEHANDLE__, hRule: ?*SPSTATEHANDLE__, Weight: f32, pPropInfo: ?*const SPPROPERTYINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder.VTable, self.vtable).AddRuleTransition(@ptrCast(*const ISpGrammarBuilder, self), hFromState, hToState, hRule, Weight, pPropInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder_AddResource(self: *const T, hRuleState: ?*SPSTATEHANDLE__, pszResourceName: ?[*:0]const u16, pszResourceValue: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder.VTable, self.vtable).AddResource(@ptrCast(*const ISpGrammarBuilder, self), hRuleState, pszResourceName, pszResourceValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder_Commit(self: *const T, dwReserved: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder.VTable, self.vtable).Commit(@ptrCast(*const ISpGrammarBuilder, self), dwReserved);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPLOADOPTIONS = enum(i32) {
STATIC = 0,
DYNAMIC = 1,
};
pub const SPLO_STATIC = SPLOADOPTIONS.STATIC;
pub const SPLO_DYNAMIC = SPLOADOPTIONS.DYNAMIC;
const IID_ISpRecoGrammar_Value = @import("../zig.zig").Guid.initString("2177db29-7f45-47d0-8554-067e91c80502");
pub const IID_ISpRecoGrammar = &IID_ISpRecoGrammar_Value;
pub const ISpRecoGrammar = extern struct {
pub const VTable = extern struct {
base: ISpGrammarBuilder.VTable,
GetGrammarId: fn(
self: *const ISpRecoGrammar,
pullGrammarId: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRecoContext: fn(
self: *const ISpRecoGrammar,
ppRecoCtxt: ?*?*ISpRecoContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadCmdFromFile: fn(
self: *const ISpRecoGrammar,
pszFileName: ?[*:0]const u16,
Options: SPLOADOPTIONS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadCmdFromObject: fn(
self: *const ISpRecoGrammar,
rcid: ?*const Guid,
pszGrammarName: ?[*:0]const u16,
Options: SPLOADOPTIONS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadCmdFromResource: fn(
self: *const ISpRecoGrammar,
hModule: ?HINSTANCE,
pszResourceName: ?[*:0]const u16,
pszResourceType: ?[*:0]const u16,
wLanguage: u16,
Options: SPLOADOPTIONS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadCmdFromMemory: fn(
self: *const ISpRecoGrammar,
pGrammar: ?*const SPBINARYGRAMMAR,
Options: SPLOADOPTIONS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadCmdFromProprietaryGrammar: fn(
self: *const ISpRecoGrammar,
rguidParam: ?*const Guid,
pszStringParam: ?[*:0]const u16,
pvDataPrarm: ?*const c_void,
cbDataSize: u32,
Options: SPLOADOPTIONS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRuleState: fn(
self: *const ISpRecoGrammar,
pszName: ?[*:0]const u16,
pReserved: ?*c_void,
NewState: SPRULESTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRuleIdState: fn(
self: *const ISpRecoGrammar,
ulRuleId: u32,
NewState: SPRULESTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadDictation: fn(
self: *const ISpRecoGrammar,
pszTopicName: ?[*:0]const u16,
Options: SPLOADOPTIONS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnloadDictation: fn(
self: *const ISpRecoGrammar,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDictationState: fn(
self: *const ISpRecoGrammar,
NewState: SPRULESTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetWordSequenceData: fn(
self: *const ISpRecoGrammar,
pText: ?[*:0]const u16,
cchText: u32,
pInfo: ?*const SPTEXTSELECTIONINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTextSelection: fn(
self: *const ISpRecoGrammar,
pInfo: ?*const SPTEXTSELECTIONINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsPronounceable: fn(
self: *const ISpRecoGrammar,
pszWord: ?[*:0]const u16,
pWordPronounceable: ?*SPWORDPRONOUNCEABLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGrammarState: fn(
self: *const ISpRecoGrammar,
eGrammarState: SPGRAMMARSTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SaveCmd: fn(
self: *const ISpRecoGrammar,
pStream: ?*IStream,
ppszCoMemErrorText: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetGrammarState: fn(
self: *const ISpRecoGrammar,
peGrammarState: ?*SPGRAMMARSTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpGrammarBuilder.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_GetGrammarId(self: *const T, pullGrammarId: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).GetGrammarId(@ptrCast(*const ISpRecoGrammar, self), pullGrammarId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_GetRecoContext(self: *const T, ppRecoCtxt: ?*?*ISpRecoContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).GetRecoContext(@ptrCast(*const ISpRecoGrammar, self), ppRecoCtxt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_LoadCmdFromFile(self: *const T, pszFileName: ?[*:0]const u16, Options: SPLOADOPTIONS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).LoadCmdFromFile(@ptrCast(*const ISpRecoGrammar, self), pszFileName, Options);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_LoadCmdFromObject(self: *const T, rcid: ?*const Guid, pszGrammarName: ?[*:0]const u16, Options: SPLOADOPTIONS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).LoadCmdFromObject(@ptrCast(*const ISpRecoGrammar, self), rcid, pszGrammarName, Options);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_LoadCmdFromResource(self: *const T, hModule: ?HINSTANCE, pszResourceName: ?[*:0]const u16, pszResourceType: ?[*:0]const u16, wLanguage: u16, Options: SPLOADOPTIONS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).LoadCmdFromResource(@ptrCast(*const ISpRecoGrammar, self), hModule, pszResourceName, pszResourceType, wLanguage, Options);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_LoadCmdFromMemory(self: *const T, pGrammar: ?*const SPBINARYGRAMMAR, Options: SPLOADOPTIONS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).LoadCmdFromMemory(@ptrCast(*const ISpRecoGrammar, self), pGrammar, Options);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_LoadCmdFromProprietaryGrammar(self: *const T, rguidParam: ?*const Guid, pszStringParam: ?[*:0]const u16, pvDataPrarm: ?*const c_void, cbDataSize: u32, Options: SPLOADOPTIONS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).LoadCmdFromProprietaryGrammar(@ptrCast(*const ISpRecoGrammar, self), rguidParam, pszStringParam, pvDataPrarm, cbDataSize, Options);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_SetRuleState(self: *const T, pszName: ?[*:0]const u16, pReserved: ?*c_void, NewState: SPRULESTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).SetRuleState(@ptrCast(*const ISpRecoGrammar, self), pszName, pReserved, NewState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_SetRuleIdState(self: *const T, ulRuleId: u32, NewState: SPRULESTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).SetRuleIdState(@ptrCast(*const ISpRecoGrammar, self), ulRuleId, NewState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_LoadDictation(self: *const T, pszTopicName: ?[*:0]const u16, Options: SPLOADOPTIONS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).LoadDictation(@ptrCast(*const ISpRecoGrammar, self), pszTopicName, Options);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_UnloadDictation(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).UnloadDictation(@ptrCast(*const ISpRecoGrammar, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_SetDictationState(self: *const T, NewState: SPRULESTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).SetDictationState(@ptrCast(*const ISpRecoGrammar, self), NewState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_SetWordSequenceData(self: *const T, pText: ?[*:0]const u16, cchText: u32, pInfo: ?*const SPTEXTSELECTIONINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).SetWordSequenceData(@ptrCast(*const ISpRecoGrammar, self), pText, cchText, pInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_SetTextSelection(self: *const T, pInfo: ?*const SPTEXTSELECTIONINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).SetTextSelection(@ptrCast(*const ISpRecoGrammar, self), pInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_IsPronounceable(self: *const T, pszWord: ?[*:0]const u16, pWordPronounceable: ?*SPWORDPRONOUNCEABLE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).IsPronounceable(@ptrCast(*const ISpRecoGrammar, self), pszWord, pWordPronounceable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_SetGrammarState(self: *const T, eGrammarState: SPGRAMMARSTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).SetGrammarState(@ptrCast(*const ISpRecoGrammar, self), eGrammarState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_SaveCmd(self: *const T, pStream: ?*IStream, ppszCoMemErrorText: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).SaveCmd(@ptrCast(*const ISpRecoGrammar, self), pStream, ppszCoMemErrorText);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar_GetGrammarState(self: *const T, peGrammarState: ?*SPGRAMMARSTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar.VTable, self.vtable).GetGrammarState(@ptrCast(*const ISpRecoGrammar, self), peGrammarState);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPMATCHINGMODE = enum(i32) {
AllWords = 0,
Subsequence = 1,
OrderedSubset = 3,
SubsequenceContentRequired = 5,
OrderedSubsetContentRequired = 7,
};
pub const AllWords = SPMATCHINGMODE.AllWords;
pub const Subsequence = SPMATCHINGMODE.Subsequence;
pub const OrderedSubset = SPMATCHINGMODE.OrderedSubset;
pub const SubsequenceContentRequired = SPMATCHINGMODE.SubsequenceContentRequired;
pub const OrderedSubsetContentRequired = SPMATCHINGMODE.OrderedSubsetContentRequired;
pub const PHONETICALPHABET = enum(i32) {
Ipa = 0,
Ups = 1,
Sapi = 2,
};
pub const PA_Ipa = PHONETICALPHABET.Ipa;
pub const PA_Ups = PHONETICALPHABET.Ups;
pub const PA_Sapi = PHONETICALPHABET.Sapi;
const IID_ISpGrammarBuilder2_Value = @import("../zig.zig").Guid.initString("8ab10026-20cc-4b20-8c22-a49c9ba78f60");
pub const IID_ISpGrammarBuilder2 = &IID_ISpGrammarBuilder2_Value;
pub const ISpGrammarBuilder2 = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddTextSubset: fn(
self: *const ISpGrammarBuilder2,
hFromState: ?*SPSTATEHANDLE__,
hToState: ?*SPSTATEHANDLE__,
psz: ?[*:0]const u16,
eMatchMode: SPMATCHINGMODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPhoneticAlphabet: fn(
self: *const ISpGrammarBuilder2,
phoneticALphabet: PHONETICALPHABET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder2_AddTextSubset(self: *const T, hFromState: ?*SPSTATEHANDLE__, hToState: ?*SPSTATEHANDLE__, psz: ?[*:0]const u16, eMatchMode: SPMATCHINGMODE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder2.VTable, self.vtable).AddTextSubset(@ptrCast(*const ISpGrammarBuilder2, self), hFromState, hToState, psz, eMatchMode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpGrammarBuilder2_SetPhoneticAlphabet(self: *const T, phoneticALphabet: PHONETICALPHABET) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpGrammarBuilder2.VTable, self.vtable).SetPhoneticAlphabet(@ptrCast(*const ISpGrammarBuilder2, self), phoneticALphabet);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpRecoGrammar2_Value = @import("../zig.zig").Guid.initString("4b37bc9e-9ed6-44a3-93d3-18f022b79ec3");
pub const IID_ISpRecoGrammar2 = &IID_ISpRecoGrammar2_Value;
pub const ISpRecoGrammar2 = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetRules: fn(
self: *const ISpRecoGrammar2,
ppCoMemRules: ?*?*SPRULE,
puNumRules: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadCmdFromFile2: fn(
self: *const ISpRecoGrammar2,
pszFileName: ?[*:0]const u16,
Options: SPLOADOPTIONS,
pszSharingUri: ?[*:0]const u16,
pszBaseUri: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadCmdFromMemory2: fn(
self: *const ISpRecoGrammar2,
pGrammar: ?*const SPBINARYGRAMMAR,
Options: SPLOADOPTIONS,
pszSharingUri: ?[*:0]const u16,
pszBaseUri: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRulePriority: fn(
self: *const ISpRecoGrammar2,
pszRuleName: ?[*:0]const u16,
ulRuleId: u32,
nRulePriority: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRuleWeight: fn(
self: *const ISpRecoGrammar2,
pszRuleName: ?[*:0]const u16,
ulRuleId: u32,
flWeight: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDictationWeight: fn(
self: *const ISpRecoGrammar2,
flWeight: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGrammarLoader: fn(
self: *const ISpRecoGrammar2,
pLoader: ?*ISpeechResourceLoader,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSMLSecurityManager: fn(
self: *const ISpRecoGrammar2,
pSMLSecurityManager: ?*IInternetSecurityManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar2_GetRules(self: *const T, ppCoMemRules: ?*?*SPRULE, puNumRules: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar2.VTable, self.vtable).GetRules(@ptrCast(*const ISpRecoGrammar2, self), ppCoMemRules, puNumRules);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar2_LoadCmdFromFile2(self: *const T, pszFileName: ?[*:0]const u16, Options: SPLOADOPTIONS, pszSharingUri: ?[*:0]const u16, pszBaseUri: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar2.VTable, self.vtable).LoadCmdFromFile2(@ptrCast(*const ISpRecoGrammar2, self), pszFileName, Options, pszSharingUri, pszBaseUri);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar2_LoadCmdFromMemory2(self: *const T, pGrammar: ?*const SPBINARYGRAMMAR, Options: SPLOADOPTIONS, pszSharingUri: ?[*:0]const u16, pszBaseUri: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar2.VTable, self.vtable).LoadCmdFromMemory2(@ptrCast(*const ISpRecoGrammar2, self), pGrammar, Options, pszSharingUri, pszBaseUri);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar2_SetRulePriority(self: *const T, pszRuleName: ?[*:0]const u16, ulRuleId: u32, nRulePriority: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar2.VTable, self.vtable).SetRulePriority(@ptrCast(*const ISpRecoGrammar2, self), pszRuleName, ulRuleId, nRulePriority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar2_SetRuleWeight(self: *const T, pszRuleName: ?[*:0]const u16, ulRuleId: u32, flWeight: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar2.VTable, self.vtable).SetRuleWeight(@ptrCast(*const ISpRecoGrammar2, self), pszRuleName, ulRuleId, flWeight);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar2_SetDictationWeight(self: *const T, flWeight: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar2.VTable, self.vtable).SetDictationWeight(@ptrCast(*const ISpRecoGrammar2, self), flWeight);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar2_SetGrammarLoader(self: *const T, pLoader: ?*ISpeechResourceLoader) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar2.VTable, self.vtable).SetGrammarLoader(@ptrCast(*const ISpRecoGrammar2, self), pLoader);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoGrammar2_SetSMLSecurityManager(self: *const T, pSMLSecurityManager: ?*IInternetSecurityManager) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoGrammar2.VTable, self.vtable).SetSMLSecurityManager(@ptrCast(*const ISpRecoGrammar2, self), pSMLSecurityManager);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechResourceLoader_Value = @import("../zig.zig").Guid.initString("b9ac5783-fcd0-4b21-b119-b4f8da8fd2c3");
pub const IID_ISpeechResourceLoader = &IID_ISpeechResourceLoader_Value;
pub const ISpeechResourceLoader = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
LoadResource: fn(
self: *const ISpeechResourceLoader,
bstrResourceUri: ?BSTR,
fAlwaysReload: i16,
pStream: ?*?*IUnknown,
pbstrMIMEType: ?*?BSTR,
pfModified: ?*i16,
pbstrRedirectUrl: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLocalCopy: fn(
self: *const ISpeechResourceLoader,
bstrResourceUri: ?BSTR,
pbstrLocalPath: ?*?BSTR,
pbstrMIMEType: ?*?BSTR,
pbstrRedirectUrl: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReleaseLocalCopy: fn(
self: *const ISpeechResourceLoader,
pbstrLocalPath: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechResourceLoader_LoadResource(self: *const T, bstrResourceUri: ?BSTR, fAlwaysReload: i16, pStream: ?*?*IUnknown, pbstrMIMEType: ?*?BSTR, pfModified: ?*i16, pbstrRedirectUrl: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechResourceLoader.VTable, self.vtable).LoadResource(@ptrCast(*const ISpeechResourceLoader, self), bstrResourceUri, fAlwaysReload, pStream, pbstrMIMEType, pfModified, pbstrRedirectUrl);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechResourceLoader_GetLocalCopy(self: *const T, bstrResourceUri: ?BSTR, pbstrLocalPath: ?*?BSTR, pbstrMIMEType: ?*?BSTR, pbstrRedirectUrl: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechResourceLoader.VTable, self.vtable).GetLocalCopy(@ptrCast(*const ISpeechResourceLoader, self), bstrResourceUri, pbstrLocalPath, pbstrMIMEType, pbstrRedirectUrl);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechResourceLoader_ReleaseLocalCopy(self: *const T, pbstrLocalPath: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechResourceLoader.VTable, self.vtable).ReleaseLocalCopy(@ptrCast(*const ISpeechResourceLoader, self), pbstrLocalPath);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPRECOCONTEXTSTATUS = extern struct {
eInterference: SPINTERFERENCE,
szRequestTypeOfUI: [255]u16,
dwReserved1: u32,
dwReserved2: u32,
};
pub const SPBOOKMARKOPTIONS = enum(i32) {
NONE = 0,
PAUSE = 1,
AHEAD = 2,
TIME_UNITS = 4,
};
pub const SPBO_NONE = SPBOOKMARKOPTIONS.NONE;
pub const SPBO_PAUSE = SPBOOKMARKOPTIONS.PAUSE;
pub const SPBO_AHEAD = SPBOOKMARKOPTIONS.AHEAD;
pub const SPBO_TIME_UNITS = SPBOOKMARKOPTIONS.TIME_UNITS;
pub const SPAUDIOOPTIONS = enum(i32) {
NONE = 0,
RETAIN_AUDIO = 1,
};
pub const SPAO_NONE = SPAUDIOOPTIONS.NONE;
pub const SPAO_RETAIN_AUDIO = SPAUDIOOPTIONS.RETAIN_AUDIO;
const IID_ISpRecoContext_Value = @import("../zig.zig").Guid.initString("f740a62f-7c15-489e-8234-940a33d9272d");
pub const IID_ISpRecoContext = &IID_ISpRecoContext_Value;
pub const ISpRecoContext = extern struct {
pub const VTable = extern struct {
base: ISpEventSource.VTable,
GetRecognizer: fn(
self: *const ISpRecoContext,
ppRecognizer: ?*?*ISpRecognizer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateGrammar: fn(
self: *const ISpRecoContext,
ullGrammarId: u64,
ppGrammar: ?*?*ISpRecoGrammar,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStatus: fn(
self: *const ISpRecoContext,
pStatus: ?*SPRECOCONTEXTSTATUS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMaxAlternates: fn(
self: *const ISpRecoContext,
pcAlternates: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMaxAlternates: fn(
self: *const ISpRecoContext,
cAlternates: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAudioOptions: fn(
self: *const ISpRecoContext,
Options: SPAUDIOOPTIONS,
pAudioFormatId: ?*const Guid,
pWaveFormatEx: ?*const WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAudioOptions: fn(
self: *const ISpRecoContext,
pOptions: ?*SPAUDIOOPTIONS,
pAudioFormatId: ?*Guid,
ppCoMemWFEX: ?*?*WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeserializeResult: fn(
self: *const ISpRecoContext,
pSerializedResult: ?*const SPSERIALIZEDRESULT,
ppResult: ?*?*ISpRecoResult,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Bookmark: fn(
self: *const ISpRecoContext,
Options: SPBOOKMARKOPTIONS,
ullStreamPosition: u64,
lparamEvent: LPARAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAdaptationData: fn(
self: *const ISpRecoContext,
pAdaptationData: ?[*:0]const u16,
cch: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Pause: fn(
self: *const ISpRecoContext,
dwReserved: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Resume: fn(
self: *const ISpRecoContext,
dwReserved: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVoice: fn(
self: *const ISpRecoContext,
pVoice: ?*ISpVoice,
fAllowFormatChanges: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVoice: fn(
self: *const ISpRecoContext,
ppVoice: ?*?*ISpVoice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVoicePurgeEvent: fn(
self: *const ISpRecoContext,
ullEventInterest: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVoicePurgeEvent: fn(
self: *const ISpRecoContext,
pullEventInterest: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetContextState: fn(
self: *const ISpRecoContext,
eContextState: SPCONTEXTSTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetContextState: fn(
self: *const ISpRecoContext,
peContextState: ?*SPCONTEXTSTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpEventSource.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_GetRecognizer(self: *const T, ppRecognizer: ?*?*ISpRecognizer) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).GetRecognizer(@ptrCast(*const ISpRecoContext, self), ppRecognizer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_CreateGrammar(self: *const T, ullGrammarId: u64, ppGrammar: ?*?*ISpRecoGrammar) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).CreateGrammar(@ptrCast(*const ISpRecoContext, self), ullGrammarId, ppGrammar);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_GetStatus(self: *const T, pStatus: ?*SPRECOCONTEXTSTATUS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).GetStatus(@ptrCast(*const ISpRecoContext, self), pStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_GetMaxAlternates(self: *const T, pcAlternates: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).GetMaxAlternates(@ptrCast(*const ISpRecoContext, self), pcAlternates);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_SetMaxAlternates(self: *const T, cAlternates: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).SetMaxAlternates(@ptrCast(*const ISpRecoContext, self), cAlternates);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_SetAudioOptions(self: *const T, Options: SPAUDIOOPTIONS, pAudioFormatId: ?*const Guid, pWaveFormatEx: ?*const WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).SetAudioOptions(@ptrCast(*const ISpRecoContext, self), Options, pAudioFormatId, pWaveFormatEx);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_GetAudioOptions(self: *const T, pOptions: ?*SPAUDIOOPTIONS, pAudioFormatId: ?*Guid, ppCoMemWFEX: ?*?*WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).GetAudioOptions(@ptrCast(*const ISpRecoContext, self), pOptions, pAudioFormatId, ppCoMemWFEX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_DeserializeResult(self: *const T, pSerializedResult: ?*const SPSERIALIZEDRESULT, ppResult: ?*?*ISpRecoResult) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).DeserializeResult(@ptrCast(*const ISpRecoContext, self), pSerializedResult, ppResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_Bookmark(self: *const T, Options: SPBOOKMARKOPTIONS, ullStreamPosition: u64, lparamEvent: LPARAM) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).Bookmark(@ptrCast(*const ISpRecoContext, self), Options, ullStreamPosition, lparamEvent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_SetAdaptationData(self: *const T, pAdaptationData: ?[*:0]const u16, cch: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).SetAdaptationData(@ptrCast(*const ISpRecoContext, self), pAdaptationData, cch);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_Pause(self: *const T, dwReserved: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).Pause(@ptrCast(*const ISpRecoContext, self), dwReserved);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_Resume(self: *const T, dwReserved: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).Resume(@ptrCast(*const ISpRecoContext, self), dwReserved);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_SetVoice(self: *const T, pVoice: ?*ISpVoice, fAllowFormatChanges: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).SetVoice(@ptrCast(*const ISpRecoContext, self), pVoice, fAllowFormatChanges);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_GetVoice(self: *const T, ppVoice: ?*?*ISpVoice) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).GetVoice(@ptrCast(*const ISpRecoContext, self), ppVoice);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_SetVoicePurgeEvent(self: *const T, ullEventInterest: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).SetVoicePurgeEvent(@ptrCast(*const ISpRecoContext, self), ullEventInterest);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_GetVoicePurgeEvent(self: *const T, pullEventInterest: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).GetVoicePurgeEvent(@ptrCast(*const ISpRecoContext, self), pullEventInterest);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_SetContextState(self: *const T, eContextState: SPCONTEXTSTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).SetContextState(@ptrCast(*const ISpRecoContext, self), eContextState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext_GetContextState(self: *const T, peContextState: ?*SPCONTEXTSTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext.VTable, self.vtable).GetContextState(@ptrCast(*const ISpRecoContext, self), peContextState);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPGRAMMAROPTIONS = enum(i32) {
SAPI = 1,
SRGS = 2,
UPS = 4,
SRGS_MS_SCRIPT = 8,
SRGS_W3C_SCRIPT = 256,
SRGS_STG_SCRIPT = 512,
SRGS_SCRIPT = 778,
FILE = 16,
HTTP = 32,
RES = 64,
OBJECT = 128,
DEFAULT = 1019,
ALL = 1023,
};
pub const SPGO_SAPI = SPGRAMMAROPTIONS.SAPI;
pub const SPGO_SRGS = SPGRAMMAROPTIONS.SRGS;
pub const SPGO_UPS = SPGRAMMAROPTIONS.UPS;
pub const SPGO_SRGS_MS_SCRIPT = SPGRAMMAROPTIONS.SRGS_MS_SCRIPT;
pub const SPGO_SRGS_W3C_SCRIPT = SPGRAMMAROPTIONS.SRGS_W3C_SCRIPT;
pub const SPGO_SRGS_STG_SCRIPT = SPGRAMMAROPTIONS.SRGS_STG_SCRIPT;
pub const SPGO_SRGS_SCRIPT = SPGRAMMAROPTIONS.SRGS_SCRIPT;
pub const SPGO_FILE = SPGRAMMAROPTIONS.FILE;
pub const SPGO_HTTP = SPGRAMMAROPTIONS.HTTP;
pub const SPGO_RES = SPGRAMMAROPTIONS.RES;
pub const SPGO_OBJECT = SPGRAMMAROPTIONS.OBJECT;
pub const SPGO_DEFAULT = SPGRAMMAROPTIONS.DEFAULT;
pub const SPGO_ALL = SPGRAMMAROPTIONS.ALL;
pub const SPADAPTATIONSETTINGS = enum(i32) {
Default = 0,
CurrentRecognizer = 1,
RecoProfile = 2,
Immediate = 4,
Reset = 8,
HighVolumeDataSource = 16,
};
pub const SPADS_Default = SPADAPTATIONSETTINGS.Default;
pub const SPADS_CurrentRecognizer = SPADAPTATIONSETTINGS.CurrentRecognizer;
pub const SPADS_RecoProfile = SPADAPTATIONSETTINGS.RecoProfile;
pub const SPADS_Immediate = SPADAPTATIONSETTINGS.Immediate;
pub const SPADS_Reset = SPADAPTATIONSETTINGS.Reset;
pub const SPADS_HighVolumeDataSource = SPADAPTATIONSETTINGS.HighVolumeDataSource;
pub const SPADAPTATIONRELEVANCE = enum(i32) {
Unknown = 0,
Low = 1,
Medium = 2,
High = 3,
};
pub const SPAR_Unknown = SPADAPTATIONRELEVANCE.Unknown;
pub const SPAR_Low = SPADAPTATIONRELEVANCE.Low;
pub const SPAR_Medium = SPADAPTATIONRELEVANCE.Medium;
pub const SPAR_High = SPADAPTATIONRELEVANCE.High;
const IID_ISpRecoContext2_Value = @import("../zig.zig").Guid.initString("bead311c-52ff-437f-9464-6b21054ca73d");
pub const IID_ISpRecoContext2 = &IID_ISpRecoContext2_Value;
pub const ISpRecoContext2 = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetGrammarOptions: fn(
self: *const ISpRecoContext2,
eGrammarOptions: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetGrammarOptions: fn(
self: *const ISpRecoContext2,
peGrammarOptions: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAdaptationData2: fn(
self: *const ISpRecoContext2,
pAdaptationData: ?[*:0]const u16,
cch: u32,
pTopicName: ?[*:0]const u16,
eAdaptationSettings: u32,
eRelevance: SPADAPTATIONRELEVANCE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext2_SetGrammarOptions(self: *const T, eGrammarOptions: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext2.VTable, self.vtable).SetGrammarOptions(@ptrCast(*const ISpRecoContext2, self), eGrammarOptions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext2_GetGrammarOptions(self: *const T, peGrammarOptions: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext2.VTable, self.vtable).GetGrammarOptions(@ptrCast(*const ISpRecoContext2, self), peGrammarOptions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecoContext2_SetAdaptationData2(self: *const T, pAdaptationData: ?[*:0]const u16, cch: u32, pTopicName: ?[*:0]const u16, eAdaptationSettings: u32, eRelevance: SPADAPTATIONRELEVANCE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecoContext2.VTable, self.vtable).SetAdaptationData2(@ptrCast(*const ISpRecoContext2, self), pAdaptationData, cch, pTopicName, eAdaptationSettings, eRelevance);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpProperties_Value = @import("../zig.zig").Guid.initString("5b4fb971-b115-4de1-ad97-e482e3bf6ee4");
pub const IID_ISpProperties = &IID_ISpProperties_Value;
pub const ISpProperties = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetPropertyNum: fn(
self: *const ISpProperties,
pName: ?[*:0]const u16,
lValue: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyNum: fn(
self: *const ISpProperties,
pName: ?[*:0]const u16,
plValue: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPropertyString: fn(
self: *const ISpProperties,
pName: ?[*:0]const u16,
pValue: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyString: fn(
self: *const ISpProperties,
pName: ?[*:0]const u16,
ppCoMemValue: ?*?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 ISpProperties_SetPropertyNum(self: *const T, pName: ?[*:0]const u16, lValue: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpProperties.VTable, self.vtable).SetPropertyNum(@ptrCast(*const ISpProperties, self), pName, lValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpProperties_GetPropertyNum(self: *const T, pName: ?[*:0]const u16, plValue: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpProperties.VTable, self.vtable).GetPropertyNum(@ptrCast(*const ISpProperties, self), pName, plValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpProperties_SetPropertyString(self: *const T, pName: ?[*:0]const u16, pValue: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpProperties.VTable, self.vtable).SetPropertyString(@ptrCast(*const ISpProperties, self), pName, pValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpProperties_GetPropertyString(self: *const T, pName: ?[*:0]const u16, ppCoMemValue: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpProperties.VTable, self.vtable).GetPropertyString(@ptrCast(*const ISpProperties, self), pName, ppCoMemValue);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPRECOGNIZERSTATUS = extern struct {
AudioStatus: SPAUDIOSTATUS,
ullRecognitionStreamPos: u64,
ulStreamNumber: u32,
ulNumActive: u32,
clsidEngine: Guid,
cLangIDs: u32,
aLangID: [20]u16,
ullRecognitionStreamTime: u64,
};
pub const SPWAVEFORMATTYPE = enum(i32) {
INPUT = 0,
SRENGINE = 1,
};
pub const SPWF_INPUT = SPWAVEFORMATTYPE.INPUT;
pub const SPWF_SRENGINE = SPWAVEFORMATTYPE.SRENGINE;
pub const SPRECOSTATE = enum(i32) {
INACTIVE = 0,
ACTIVE = 1,
ACTIVE_ALWAYS = 2,
INACTIVE_WITH_PURGE = 3,
NUM_STATES = 4,
};
pub const SPRST_INACTIVE = SPRECOSTATE.INACTIVE;
pub const SPRST_ACTIVE = SPRECOSTATE.ACTIVE;
pub const SPRST_ACTIVE_ALWAYS = SPRECOSTATE.ACTIVE_ALWAYS;
pub const SPRST_INACTIVE_WITH_PURGE = SPRECOSTATE.INACTIVE_WITH_PURGE;
pub const SPRST_NUM_STATES = SPRECOSTATE.NUM_STATES;
const IID_ISpRecognizer_Value = @import("../zig.zig").Guid.initString("c2b5f241-daa0-4507-9e16-5a1eaa2b7a5c");
pub const IID_ISpRecognizer = &IID_ISpRecognizer_Value;
pub const ISpRecognizer = extern struct {
pub const VTable = extern struct {
base: ISpProperties.VTable,
SetRecognizer: fn(
self: *const ISpRecognizer,
pRecognizer: ?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRecognizer: fn(
self: *const ISpRecognizer,
ppRecognizer: ?*?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetInput: fn(
self: *const ISpRecognizer,
pUnkInput: ?*IUnknown,
fAllowFormatChanges: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetInputObjectToken: fn(
self: *const ISpRecognizer,
ppToken: ?*?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetInputStream: fn(
self: *const ISpRecognizer,
ppStream: ?*?*ISpStreamFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRecoContext: fn(
self: *const ISpRecognizer,
ppNewCtxt: ?*?*ISpRecoContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRecoProfile: fn(
self: *const ISpRecognizer,
ppToken: ?*?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRecoProfile: fn(
self: *const ISpRecognizer,
pToken: ?*ISpObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsSharedInstance: fn(
self: *const ISpRecognizer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRecoState: fn(
self: *const ISpRecognizer,
pState: ?*SPRECOSTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRecoState: fn(
self: *const ISpRecognizer,
NewState: SPRECOSTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStatus: fn(
self: *const ISpRecognizer,
pStatus: ?*SPRECOGNIZERSTATUS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFormat: fn(
self: *const ISpRecognizer,
WaveFormatType: SPWAVEFORMATTYPE,
pFormatId: ?*Guid,
ppCoMemWFEX: ?*?*WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsUISupported: fn(
self: *const ISpRecognizer,
pszTypeOfUI: ?[*:0]const u16,
pvExtraData: ?*c_void,
cbExtraData: u32,
pfSupported: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisplayUI: fn(
self: *const ISpRecognizer,
hwndParent: ?HWND,
pszTitle: ?[*:0]const u16,
pszTypeOfUI: ?[*:0]const u16,
pvExtraData: ?*c_void,
cbExtraData: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EmulateRecognition: fn(
self: *const ISpRecognizer,
pPhrase: ?*ISpPhrase,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpProperties.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_SetRecognizer(self: *const T, pRecognizer: ?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).SetRecognizer(@ptrCast(*const ISpRecognizer, self), pRecognizer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_GetRecognizer(self: *const T, ppRecognizer: ?*?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).GetRecognizer(@ptrCast(*const ISpRecognizer, self), ppRecognizer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_SetInput(self: *const T, pUnkInput: ?*IUnknown, fAllowFormatChanges: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).SetInput(@ptrCast(*const ISpRecognizer, self), pUnkInput, fAllowFormatChanges);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_GetInputObjectToken(self: *const T, ppToken: ?*?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).GetInputObjectToken(@ptrCast(*const ISpRecognizer, self), ppToken);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_GetInputStream(self: *const T, ppStream: ?*?*ISpStreamFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).GetInputStream(@ptrCast(*const ISpRecognizer, self), ppStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_CreateRecoContext(self: *const T, ppNewCtxt: ?*?*ISpRecoContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).CreateRecoContext(@ptrCast(*const ISpRecognizer, self), ppNewCtxt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_GetRecoProfile(self: *const T, ppToken: ?*?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).GetRecoProfile(@ptrCast(*const ISpRecognizer, self), ppToken);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_SetRecoProfile(self: *const T, pToken: ?*ISpObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).SetRecoProfile(@ptrCast(*const ISpRecognizer, self), pToken);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_IsSharedInstance(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).IsSharedInstance(@ptrCast(*const ISpRecognizer, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_GetRecoState(self: *const T, pState: ?*SPRECOSTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).GetRecoState(@ptrCast(*const ISpRecognizer, self), pState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_SetRecoState(self: *const T, NewState: SPRECOSTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).SetRecoState(@ptrCast(*const ISpRecognizer, self), NewState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_GetStatus(self: *const T, pStatus: ?*SPRECOGNIZERSTATUS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).GetStatus(@ptrCast(*const ISpRecognizer, self), pStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_GetFormat(self: *const T, WaveFormatType: SPWAVEFORMATTYPE, pFormatId: ?*Guid, ppCoMemWFEX: ?*?*WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).GetFormat(@ptrCast(*const ISpRecognizer, self), WaveFormatType, pFormatId, ppCoMemWFEX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_IsUISupported(self: *const T, pszTypeOfUI: ?[*:0]const u16, pvExtraData: ?*c_void, cbExtraData: u32, pfSupported: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).IsUISupported(@ptrCast(*const ISpRecognizer, self), pszTypeOfUI, pvExtraData, cbExtraData, pfSupported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_DisplayUI(self: *const T, hwndParent: ?HWND, pszTitle: ?[*:0]const u16, pszTypeOfUI: ?[*:0]const u16, pvExtraData: ?*c_void, cbExtraData: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).DisplayUI(@ptrCast(*const ISpRecognizer, self), hwndParent, pszTitle, pszTypeOfUI, pvExtraData, cbExtraData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer_EmulateRecognition(self: *const T, pPhrase: ?*ISpPhrase) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer.VTable, self.vtable).EmulateRecognition(@ptrCast(*const ISpRecognizer, self), pPhrase);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpSerializeState_Value = @import("../zig.zig").Guid.initString("21b501a0-0ec7-46c9-92c3-a2bc784c54b9");
pub const IID_ISpSerializeState = &IID_ISpSerializeState_Value;
pub const ISpSerializeState = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetSerializedState: fn(
self: *const ISpSerializeState,
ppbData: ?*?*u8,
pulSize: ?*u32,
dwReserved: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSerializedState: fn(
self: *const ISpSerializeState,
pbData: ?*u8,
ulSize: u32,
dwReserved: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpSerializeState_GetSerializedState(self: *const T, ppbData: ?*?*u8, pulSize: ?*u32, dwReserved: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpSerializeState.VTable, self.vtable).GetSerializedState(@ptrCast(*const ISpSerializeState, self), ppbData, pulSize, dwReserved);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpSerializeState_SetSerializedState(self: *const T, pbData: ?*u8, ulSize: u32, dwReserved: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpSerializeState.VTable, self.vtable).SetSerializedState(@ptrCast(*const ISpSerializeState, self), pbData, ulSize, dwReserved);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpRecognizer2_Value = @import("../zig.zig").Guid.initString("8fc6d974-c81e-4098-93c5-0147f61ed4d3");
pub const IID_ISpRecognizer2 = &IID_ISpRecognizer2_Value;
pub const ISpRecognizer2 = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
EmulateRecognitionEx: fn(
self: *const ISpRecognizer2,
pPhrase: ?*ISpPhrase,
dwCompareFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTrainingState: fn(
self: *const ISpRecognizer2,
fDoingTraining: BOOL,
fAdaptFromTrainingData: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ResetAcousticModelAdaptation: fn(
self: *const ISpRecognizer2,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer2_EmulateRecognitionEx(self: *const T, pPhrase: ?*ISpPhrase, dwCompareFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer2.VTable, self.vtable).EmulateRecognitionEx(@ptrCast(*const ISpRecognizer2, self), pPhrase, dwCompareFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer2_SetTrainingState(self: *const T, fDoingTraining: BOOL, fAdaptFromTrainingData: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer2.VTable, self.vtable).SetTrainingState(@ptrCast(*const ISpRecognizer2, self), fDoingTraining, fAdaptFromTrainingData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpRecognizer2_ResetAcousticModelAdaptation(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpRecognizer2.VTable, self.vtable).ResetAcousticModelAdaptation(@ptrCast(*const ISpRecognizer2, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPNORMALIZATIONLIST = extern struct {
ulSize: u32,
ppszzNormalizedList: ?*?*u16,
};
const IID_ISpEnginePronunciation_Value = @import("../zig.zig").Guid.initString("c360ce4b-76d1-4214-ad68-52657d5083da");
pub const IID_ISpEnginePronunciation = &IID_ISpEnginePronunciation_Value;
pub const ISpEnginePronunciation = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Normalize: fn(
self: *const ISpEnginePronunciation,
pszWord: ?[*:0]const u16,
pszLeftContext: ?[*:0]const u16,
pszRightContext: ?[*:0]const u16,
LangID: u16,
pNormalizationList: ?*SPNORMALIZATIONLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPronunciations: fn(
self: *const ISpEnginePronunciation,
pszWord: ?[*:0]const u16,
pszLeftContext: ?[*:0]const u16,
pszRightContext: ?[*:0]const u16,
LangID: u16,
pEnginePronunciationList: ?*SPWORDPRONUNCIATIONLIST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpEnginePronunciation_Normalize(self: *const T, pszWord: ?[*:0]const u16, pszLeftContext: ?[*:0]const u16, pszRightContext: ?[*:0]const u16, LangID: u16, pNormalizationList: ?*SPNORMALIZATIONLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpEnginePronunciation.VTable, self.vtable).Normalize(@ptrCast(*const ISpEnginePronunciation, self), pszWord, pszLeftContext, pszRightContext, LangID, pNormalizationList);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpEnginePronunciation_GetPronunciations(self: *const T, pszWord: ?[*:0]const u16, pszLeftContext: ?[*:0]const u16, pszRightContext: ?[*:0]const u16, LangID: u16, pEnginePronunciationList: ?*SPWORDPRONUNCIATIONLIST) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpEnginePronunciation.VTable, self.vtable).GetPronunciations(@ptrCast(*const ISpEnginePronunciation, self), pszWord, pszLeftContext, pszRightContext, LangID, pEnginePronunciationList);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SPDISPLAYTOKEN = extern struct {
pszLexical: ?[*:0]const u16,
pszDisplay: ?[*:0]const u16,
bDisplayAttributes: u8,
};
pub const SPDISPLAYPHRASE = extern struct {
ulNumTokens: u32,
pTokens: ?*SPDISPLAYTOKEN,
};
const IID_ISpDisplayAlternates_Value = @import("../zig.zig").Guid.initString("c8d7c7e2-0dde-44b7-afe3-b0c991fbeb5e");
pub const IID_ISpDisplayAlternates = &IID_ISpDisplayAlternates_Value;
pub const ISpDisplayAlternates = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDisplayAlternates: fn(
self: *const ISpDisplayAlternates,
pPhrase: ?*const SPDISPLAYPHRASE,
cRequestCount: u32,
ppCoMemPhrases: ?*?*SPDISPLAYPHRASE,
pcPhrasesReturned: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetFullStopTrailSpace: fn(
self: *const ISpDisplayAlternates,
ulTrailSpace: 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 ISpDisplayAlternates_GetDisplayAlternates(self: *const T, pPhrase: ?*const SPDISPLAYPHRASE, cRequestCount: u32, ppCoMemPhrases: ?*?*SPDISPLAYPHRASE, pcPhrasesReturned: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDisplayAlternates.VTable, self.vtable).GetDisplayAlternates(@ptrCast(*const ISpDisplayAlternates, self), pPhrase, cRequestCount, ppCoMemPhrases, pcPhrasesReturned);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpDisplayAlternates_SetFullStopTrailSpace(self: *const T, ulTrailSpace: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpDisplayAlternates.VTable, self.vtable).SetFullStopTrailSpace(@ptrCast(*const ISpDisplayAlternates, self), ulTrailSpace);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DISPID_SpeechDataKey = enum(i32) {
SetBinaryValue = 1,
GetBinaryValue = 2,
SetStringValue = 3,
GetStringValue = 4,
SetLongValue = 5,
GetlongValue = 6,
OpenKey = 7,
CreateKey = 8,
DeleteKey = 9,
DeleteValue = 10,
EnumKeys = 11,
EnumValues = 12,
};
pub const DISPID_SDKSetBinaryValue = DISPID_SpeechDataKey.SetBinaryValue;
pub const DISPID_SDKGetBinaryValue = DISPID_SpeechDataKey.GetBinaryValue;
pub const DISPID_SDKSetStringValue = DISPID_SpeechDataKey.SetStringValue;
pub const DISPID_SDKGetStringValue = DISPID_SpeechDataKey.GetStringValue;
pub const DISPID_SDKSetLongValue = DISPID_SpeechDataKey.SetLongValue;
pub const DISPID_SDKGetlongValue = DISPID_SpeechDataKey.GetlongValue;
pub const DISPID_SDKOpenKey = DISPID_SpeechDataKey.OpenKey;
pub const DISPID_SDKCreateKey = DISPID_SpeechDataKey.CreateKey;
pub const DISPID_SDKDeleteKey = DISPID_SpeechDataKey.DeleteKey;
pub const DISPID_SDKDeleteValue = DISPID_SpeechDataKey.DeleteValue;
pub const DISPID_SDKEnumKeys = DISPID_SpeechDataKey.EnumKeys;
pub const DISPID_SDKEnumValues = DISPID_SpeechDataKey.EnumValues;
pub const DISPID_SpeechObjectToken = enum(i32) {
Id = 1,
DataKey = 2,
Category = 3,
GetDescription = 4,
SetId = 5,
GetAttribute = 6,
CreateInstance = 7,
Remove = 8,
GetStorageFileName = 9,
RemoveStorageFileName = 10,
IsUISupported = 11,
DisplayUI = 12,
MatchesAttributes = 13,
};
pub const DISPID_SOTId = DISPID_SpeechObjectToken.Id;
pub const DISPID_SOTDataKey = DISPID_SpeechObjectToken.DataKey;
pub const DISPID_SOTCategory = DISPID_SpeechObjectToken.Category;
pub const DISPID_SOTGetDescription = DISPID_SpeechObjectToken.GetDescription;
pub const DISPID_SOTSetId = DISPID_SpeechObjectToken.SetId;
pub const DISPID_SOTGetAttribute = DISPID_SpeechObjectToken.GetAttribute;
pub const DISPID_SOTCreateInstance = DISPID_SpeechObjectToken.CreateInstance;
pub const DISPID_SOTRemove = DISPID_SpeechObjectToken.Remove;
pub const DISPID_SOTGetStorageFileName = DISPID_SpeechObjectToken.GetStorageFileName;
pub const DISPID_SOTRemoveStorageFileName = DISPID_SpeechObjectToken.RemoveStorageFileName;
pub const DISPID_SOTIsUISupported = DISPID_SpeechObjectToken.IsUISupported;
pub const DISPID_SOTDisplayUI = DISPID_SpeechObjectToken.DisplayUI;
pub const DISPID_SOTMatchesAttributes = DISPID_SpeechObjectToken.MatchesAttributes;
pub const SpeechDataKeyLocation = enum(i32) {
DefaultLocation = 0,
CurrentUser = 1,
LocalMachine = 2,
CurrentConfig = 5,
};
pub const SDKLDefaultLocation = SpeechDataKeyLocation.DefaultLocation;
pub const SDKLCurrentUser = SpeechDataKeyLocation.CurrentUser;
pub const SDKLLocalMachine = SpeechDataKeyLocation.LocalMachine;
pub const SDKLCurrentConfig = SpeechDataKeyLocation.CurrentConfig;
pub const SpeechTokenContext = enum(u32) {
InprocServer = 1,
InprocHandler = 2,
LocalServer = 4,
RemoteServer = 16,
All = 23,
};
pub const STCInprocServer = SpeechTokenContext.InprocServer;
pub const STCInprocHandler = SpeechTokenContext.InprocHandler;
pub const STCLocalServer = SpeechTokenContext.LocalServer;
pub const STCRemoteServer = SpeechTokenContext.RemoteServer;
pub const STCAll = SpeechTokenContext.All;
pub const SpeechTokenShellFolder = enum(i32) {
AppData = 26,
LocalAppData = 28,
CommonAppData = 35,
FlagCreate = 32768,
};
pub const STSF_AppData = SpeechTokenShellFolder.AppData;
pub const STSF_LocalAppData = SpeechTokenShellFolder.LocalAppData;
pub const STSF_CommonAppData = SpeechTokenShellFolder.CommonAppData;
pub const STSF_FlagCreate = SpeechTokenShellFolder.FlagCreate;
pub const DISPID_SpeechObjectTokens = enum(i32) {
Count = 1,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SOTsCount = DISPID_SpeechObjectTokens.Count;
pub const DISPID_SOTsItem = DISPID_SpeechObjectTokens.Item;
pub const DISPID_SOTs_NewEnum = DISPID_SpeechObjectTokens._NewEnum;
pub const DISPID_SpeechObjectTokenCategory = enum(i32) {
Id = 1,
Default = 2,
SetId = 3,
GetDataKey = 4,
EnumerateTokens = 5,
};
pub const DISPID_SOTCId = DISPID_SpeechObjectTokenCategory.Id;
pub const DISPID_SOTCDefault = DISPID_SpeechObjectTokenCategory.Default;
pub const DISPID_SOTCSetId = DISPID_SpeechObjectTokenCategory.SetId;
pub const DISPID_SOTCGetDataKey = DISPID_SpeechObjectTokenCategory.GetDataKey;
pub const DISPID_SOTCEnumerateTokens = DISPID_SpeechObjectTokenCategory.EnumerateTokens;
pub const SpeechAudioFormatType = enum(i32) {
Default = -1,
NoAssignedFormat = 0,
Text = 1,
NonStandardFormat = 2,
ExtendedAudioFormat = 3,
@"8kHz8BitMono" = 4,
@"8kHz8BitStereo" = 5,
@"8kHz16BitMono" = 6,
@"8kHz16BitStereo" = 7,
@"11kHz8BitMono" = 8,
@"11kHz8BitStereo" = 9,
@"11kHz16BitMono" = 10,
@"11kHz16BitStereo" = 11,
@"12kHz8BitMono" = 12,
@"12kHz8BitStereo" = 13,
@"12kHz16BitMono" = 14,
@"12kHz16BitStereo" = 15,
@"16kHz8BitMono" = 16,
@"16kHz8BitStereo" = 17,
@"16kHz16BitMono" = 18,
@"16kHz16BitStereo" = 19,
@"22kHz8BitMono" = 20,
@"22kHz8BitStereo" = 21,
@"22kHz16BitMono" = 22,
@"22kHz16BitStereo" = 23,
@"24kHz8BitMono" = 24,
@"24kHz8BitStereo" = 25,
@"24kHz16BitMono" = 26,
@"24kHz16BitStereo" = 27,
@"32kHz8BitMono" = 28,
@"32kHz8BitStereo" = 29,
@"32kHz16BitMono" = 30,
@"32kHz16BitStereo" = 31,
@"44kHz8BitMono" = 32,
@"44kHz8BitStereo" = 33,
@"44kHz16BitMono" = 34,
@"44kHz16BitStereo" = 35,
@"48kHz8BitMono" = 36,
@"48kHz8BitStereo" = 37,
@"48kHz16BitMono" = 38,
@"48kHz16BitStereo" = 39,
TrueSpeech_8kHz1BitMono = 40,
CCITT_ALaw_8kHzMono = 41,
CCITT_ALaw_8kHzStereo = 42,
CCITT_ALaw_11kHzMono = 43,
CCITT_ALaw_11kHzStereo = 44,
CCITT_ALaw_22kHzMono = 45,
CCITT_ALaw_22kHzStereo = 46,
CCITT_ALaw_44kHzMono = 47,
CCITT_ALaw_44kHzStereo = 48,
CCITT_uLaw_8kHzMono = 49,
CCITT_uLaw_8kHzStereo = 50,
CCITT_uLaw_11kHzMono = 51,
CCITT_uLaw_11kHzStereo = 52,
CCITT_uLaw_22kHzMono = 53,
CCITT_uLaw_22kHzStereo = 54,
CCITT_uLaw_44kHzMono = 55,
CCITT_uLaw_44kHzStereo = 56,
ADPCM_8kHzMono = 57,
ADPCM_8kHzStereo = 58,
ADPCM_11kHzMono = 59,
ADPCM_11kHzStereo = 60,
ADPCM_22kHzMono = 61,
ADPCM_22kHzStereo = 62,
ADPCM_44kHzMono = 63,
ADPCM_44kHzStereo = 64,
GSM610_8kHzMono = 65,
GSM610_11kHzMono = 66,
GSM610_22kHzMono = 67,
GSM610_44kHzMono = 68,
};
pub const SAFTDefault = SpeechAudioFormatType.Default;
pub const SAFTNoAssignedFormat = SpeechAudioFormatType.NoAssignedFormat;
pub const SAFTText = SpeechAudioFormatType.Text;
pub const SAFTNonStandardFormat = SpeechAudioFormatType.NonStandardFormat;
pub const SAFTExtendedAudioFormat = SpeechAudioFormatType.ExtendedAudioFormat;
pub const SAFT8kHz8BitMono = SpeechAudioFormatType.@"8kHz8BitMono";
pub const SAFT8kHz8BitStereo = SpeechAudioFormatType.@"8kHz8BitStereo";
pub const SAFT8kHz16BitMono = SpeechAudioFormatType.@"8kHz16BitMono";
pub const SAFT8kHz16BitStereo = SpeechAudioFormatType.@"8kHz16BitStereo";
pub const SAFT11kHz8BitMono = SpeechAudioFormatType.@"11kHz8BitMono";
pub const SAFT11kHz8BitStereo = SpeechAudioFormatType.@"11kHz8BitStereo";
pub const SAFT11kHz16BitMono = SpeechAudioFormatType.@"11kHz16BitMono";
pub const SAFT11kHz16BitStereo = SpeechAudioFormatType.@"11kHz16BitStereo";
pub const SAFT12kHz8BitMono = SpeechAudioFormatType.@"12kHz8BitMono";
pub const SAFT12kHz8BitStereo = SpeechAudioFormatType.@"12kHz8BitStereo";
pub const SAFT12kHz16BitMono = SpeechAudioFormatType.@"12kHz16BitMono";
pub const SAFT12kHz16BitStereo = SpeechAudioFormatType.@"12kHz16BitStereo";
pub const SAFT16kHz8BitMono = SpeechAudioFormatType.@"16kHz8BitMono";
pub const SAFT16kHz8BitStereo = SpeechAudioFormatType.@"16kHz8BitStereo";
pub const SAFT16kHz16BitMono = SpeechAudioFormatType.@"16kHz16BitMono";
pub const SAFT16kHz16BitStereo = SpeechAudioFormatType.@"16kHz16BitStereo";
pub const SAFT22kHz8BitMono = SpeechAudioFormatType.@"22kHz8BitMono";
pub const SAFT22kHz8BitStereo = SpeechAudioFormatType.@"22kHz8BitStereo";
pub const SAFT22kHz16BitMono = SpeechAudioFormatType.@"22kHz16BitMono";
pub const SAFT22kHz16BitStereo = SpeechAudioFormatType.@"22kHz16BitStereo";
pub const SAFT24kHz8BitMono = SpeechAudioFormatType.@"24kHz8BitMono";
pub const SAFT24kHz8BitStereo = SpeechAudioFormatType.@"24kHz8BitStereo";
pub const SAFT24kHz16BitMono = SpeechAudioFormatType.@"24kHz16BitMono";
pub const SAFT24kHz16BitStereo = SpeechAudioFormatType.@"24kHz16BitStereo";
pub const SAFT32kHz8BitMono = SpeechAudioFormatType.@"32kHz8BitMono";
pub const SAFT32kHz8BitStereo = SpeechAudioFormatType.@"32kHz8BitStereo";
pub const SAFT32kHz16BitMono = SpeechAudioFormatType.@"32kHz16BitMono";
pub const SAFT32kHz16BitStereo = SpeechAudioFormatType.@"32kHz16BitStereo";
pub const SAFT44kHz8BitMono = SpeechAudioFormatType.@"44kHz8BitMono";
pub const SAFT44kHz8BitStereo = SpeechAudioFormatType.@"44kHz8BitStereo";
pub const SAFT44kHz16BitMono = SpeechAudioFormatType.@"44kHz16BitMono";
pub const SAFT44kHz16BitStereo = SpeechAudioFormatType.@"44kHz16BitStereo";
pub const SAFT48kHz8BitMono = SpeechAudioFormatType.@"48kHz8BitMono";
pub const SAFT48kHz8BitStereo = SpeechAudioFormatType.@"48kHz8BitStereo";
pub const SAFT48kHz16BitMono = SpeechAudioFormatType.@"48kHz16BitMono";
pub const SAFT48kHz16BitStereo = SpeechAudioFormatType.@"48kHz16BitStereo";
pub const SAFTTrueSpeech_8kHz1BitMono = SpeechAudioFormatType.TrueSpeech_8kHz1BitMono;
pub const SAFTCCITT_ALaw_8kHzMono = SpeechAudioFormatType.CCITT_ALaw_8kHzMono;
pub const SAFTCCITT_ALaw_8kHzStereo = SpeechAudioFormatType.CCITT_ALaw_8kHzStereo;
pub const SAFTCCITT_ALaw_11kHzMono = SpeechAudioFormatType.CCITT_ALaw_11kHzMono;
pub const SAFTCCITT_ALaw_11kHzStereo = SpeechAudioFormatType.CCITT_ALaw_11kHzStereo;
pub const SAFTCCITT_ALaw_22kHzMono = SpeechAudioFormatType.CCITT_ALaw_22kHzMono;
pub const SAFTCCITT_ALaw_22kHzStereo = SpeechAudioFormatType.CCITT_ALaw_22kHzStereo;
pub const SAFTCCITT_ALaw_44kHzMono = SpeechAudioFormatType.CCITT_ALaw_44kHzMono;
pub const SAFTCCITT_ALaw_44kHzStereo = SpeechAudioFormatType.CCITT_ALaw_44kHzStereo;
pub const SAFTCCITT_uLaw_8kHzMono = SpeechAudioFormatType.CCITT_uLaw_8kHzMono;
pub const SAFTCCITT_uLaw_8kHzStereo = SpeechAudioFormatType.CCITT_uLaw_8kHzStereo;
pub const SAFTCCITT_uLaw_11kHzMono = SpeechAudioFormatType.CCITT_uLaw_11kHzMono;
pub const SAFTCCITT_uLaw_11kHzStereo = SpeechAudioFormatType.CCITT_uLaw_11kHzStereo;
pub const SAFTCCITT_uLaw_22kHzMono = SpeechAudioFormatType.CCITT_uLaw_22kHzMono;
pub const SAFTCCITT_uLaw_22kHzStereo = SpeechAudioFormatType.CCITT_uLaw_22kHzStereo;
pub const SAFTCCITT_uLaw_44kHzMono = SpeechAudioFormatType.CCITT_uLaw_44kHzMono;
pub const SAFTCCITT_uLaw_44kHzStereo = SpeechAudioFormatType.CCITT_uLaw_44kHzStereo;
pub const SAFTADPCM_8kHzMono = SpeechAudioFormatType.ADPCM_8kHzMono;
pub const SAFTADPCM_8kHzStereo = SpeechAudioFormatType.ADPCM_8kHzStereo;
pub const SAFTADPCM_11kHzMono = SpeechAudioFormatType.ADPCM_11kHzMono;
pub const SAFTADPCM_11kHzStereo = SpeechAudioFormatType.ADPCM_11kHzStereo;
pub const SAFTADPCM_22kHzMono = SpeechAudioFormatType.ADPCM_22kHzMono;
pub const SAFTADPCM_22kHzStereo = SpeechAudioFormatType.ADPCM_22kHzStereo;
pub const SAFTADPCM_44kHzMono = SpeechAudioFormatType.ADPCM_44kHzMono;
pub const SAFTADPCM_44kHzStereo = SpeechAudioFormatType.ADPCM_44kHzStereo;
pub const SAFTGSM610_8kHzMono = SpeechAudioFormatType.GSM610_8kHzMono;
pub const SAFTGSM610_11kHzMono = SpeechAudioFormatType.GSM610_11kHzMono;
pub const SAFTGSM610_22kHzMono = SpeechAudioFormatType.GSM610_22kHzMono;
pub const SAFTGSM610_44kHzMono = SpeechAudioFormatType.GSM610_44kHzMono;
pub const DISPID_SpeechAudioFormat = enum(i32) {
Type = 1,
Guid = 2,
GetWaveFormatEx = 3,
SetWaveFormatEx = 4,
};
pub const DISPID_SAFType = DISPID_SpeechAudioFormat.Type;
pub const DISPID_SAFGuid = DISPID_SpeechAudioFormat.Guid;
pub const DISPID_SAFGetWaveFormatEx = DISPID_SpeechAudioFormat.GetWaveFormatEx;
pub const DISPID_SAFSetWaveFormatEx = DISPID_SpeechAudioFormat.SetWaveFormatEx;
pub const DISPID_SpeechBaseStream = enum(i32) {
Format = 1,
Read = 2,
Write = 3,
Seek = 4,
};
pub const DISPID_SBSFormat = DISPID_SpeechBaseStream.Format;
pub const DISPID_SBSRead = DISPID_SpeechBaseStream.Read;
pub const DISPID_SBSWrite = DISPID_SpeechBaseStream.Write;
pub const DISPID_SBSSeek = DISPID_SpeechBaseStream.Seek;
pub const SpeechStreamSeekPositionType = enum(u32) {
Start = 0,
CurrentPosition = 1,
End = 2,
};
pub const SSSPTRelativeToStart = SpeechStreamSeekPositionType.Start;
pub const SSSPTRelativeToCurrentPosition = SpeechStreamSeekPositionType.CurrentPosition;
pub const SSSPTRelativeToEnd = SpeechStreamSeekPositionType.End;
pub const DISPID_SpeechAudio = enum(i32) {
Status = 200,
BufferInfo = 201,
DefaultFormat = 202,
Volume = 203,
BufferNotifySize = 204,
EventHandle = 205,
SetState = 206,
};
pub const DISPID_SAStatus = DISPID_SpeechAudio.Status;
pub const DISPID_SABufferInfo = DISPID_SpeechAudio.BufferInfo;
pub const DISPID_SADefaultFormat = DISPID_SpeechAudio.DefaultFormat;
pub const DISPID_SAVolume = DISPID_SpeechAudio.Volume;
pub const DISPID_SABufferNotifySize = DISPID_SpeechAudio.BufferNotifySize;
pub const DISPID_SAEventHandle = DISPID_SpeechAudio.EventHandle;
pub const DISPID_SASetState = DISPID_SpeechAudio.SetState;
pub const SpeechAudioState = enum(i32) {
Closed = 0,
Stop = 1,
Pause = 2,
Run = 3,
};
pub const SASClosed = SpeechAudioState.Closed;
pub const SASStop = SpeechAudioState.Stop;
pub const SASPause = SpeechAudioState.Pause;
pub const SASRun = SpeechAudioState.Run;
pub const DISPID_SpeechMMSysAudio = enum(i32) {
DeviceId = 300,
LineId = 301,
MMHandle = 302,
};
pub const DISPID_SMSADeviceId = DISPID_SpeechMMSysAudio.DeviceId;
pub const DISPID_SMSALineId = DISPID_SpeechMMSysAudio.LineId;
pub const DISPID_SMSAMMHandle = DISPID_SpeechMMSysAudio.MMHandle;
pub const DISPID_SpeechFileStream = enum(i32) {
Open = 100,
Close = 101,
};
pub const DISPID_SFSOpen = DISPID_SpeechFileStream.Open;
pub const DISPID_SFSClose = DISPID_SpeechFileStream.Close;
pub const SpeechStreamFileMode = enum(i32) {
OpenForRead = 0,
OpenReadWrite = 1,
Create = 2,
CreateForWrite = 3,
};
pub const SSFMOpenForRead = SpeechStreamFileMode.OpenForRead;
pub const SSFMOpenReadWrite = SpeechStreamFileMode.OpenReadWrite;
pub const SSFMCreate = SpeechStreamFileMode.Create;
pub const SSFMCreateForWrite = SpeechStreamFileMode.CreateForWrite;
pub const DISPID_SpeechCustomStream = enum(i32) {
m = 100,
};
pub const DISPID_SCSBaseStream = DISPID_SpeechCustomStream.m;
pub const DISPID_SpeechMemoryStream = enum(i32) {
SetData = 100,
GetData = 101,
};
pub const DISPID_SMSSetData = DISPID_SpeechMemoryStream.SetData;
pub const DISPID_SMSGetData = DISPID_SpeechMemoryStream.GetData;
pub const DISPID_SpeechAudioStatus = enum(i32) {
FreeBufferSpace = 1,
NonBlockingIO = 2,
State = 3,
CurrentSeekPosition = 4,
CurrentDevicePosition = 5,
};
pub const DISPID_SASFreeBufferSpace = DISPID_SpeechAudioStatus.FreeBufferSpace;
pub const DISPID_SASNonBlockingIO = DISPID_SpeechAudioStatus.NonBlockingIO;
pub const DISPID_SASState = DISPID_SpeechAudioStatus.State;
pub const DISPID_SASCurrentSeekPosition = DISPID_SpeechAudioStatus.CurrentSeekPosition;
pub const DISPID_SASCurrentDevicePosition = DISPID_SpeechAudioStatus.CurrentDevicePosition;
pub const DISPID_SpeechAudioBufferInfo = enum(i32) {
MinNotification = 1,
BufferSize = 2,
EventBias = 3,
};
pub const DISPID_SABIMinNotification = DISPID_SpeechAudioBufferInfo.MinNotification;
pub const DISPID_SABIBufferSize = DISPID_SpeechAudioBufferInfo.BufferSize;
pub const DISPID_SABIEventBias = DISPID_SpeechAudioBufferInfo.EventBias;
pub const DISPID_SpeechWaveFormatEx = enum(i32) {
FormatTag = 1,
Channels = 2,
SamplesPerSec = 3,
AvgBytesPerSec = 4,
BlockAlign = 5,
BitsPerSample = 6,
ExtraData = 7,
};
pub const DISPID_SWFEFormatTag = DISPID_SpeechWaveFormatEx.FormatTag;
pub const DISPID_SWFEChannels = DISPID_SpeechWaveFormatEx.Channels;
pub const DISPID_SWFESamplesPerSec = DISPID_SpeechWaveFormatEx.SamplesPerSec;
pub const DISPID_SWFEAvgBytesPerSec = DISPID_SpeechWaveFormatEx.AvgBytesPerSec;
pub const DISPID_SWFEBlockAlign = DISPID_SpeechWaveFormatEx.BlockAlign;
pub const DISPID_SWFEBitsPerSample = DISPID_SpeechWaveFormatEx.BitsPerSample;
pub const DISPID_SWFEExtraData = DISPID_SpeechWaveFormatEx.ExtraData;
pub const DISPID_SpeechVoice = enum(i32) {
Status = 1,
Voice = 2,
AudioOutput = 3,
AudioOutputStream = 4,
Rate = 5,
Volume = 6,
AllowAudioOuputFormatChangesOnNextSet = 7,
EventInterests = 8,
Priority = 9,
AlertBoundary = 10,
SyncronousSpeakTimeout = 11,
Speak = 12,
SpeakStream = 13,
Pause = 14,
Resume = 15,
Skip = 16,
GetVoices = 17,
GetAudioOutputs = 18,
WaitUntilDone = 19,
SpeakCompleteEvent = 20,
IsUISupported = 21,
DisplayUI = 22,
};
pub const DISPID_SVStatus = DISPID_SpeechVoice.Status;
pub const DISPID_SVVoice = DISPID_SpeechVoice.Voice;
pub const DISPID_SVAudioOutput = DISPID_SpeechVoice.AudioOutput;
pub const DISPID_SVAudioOutputStream = DISPID_SpeechVoice.AudioOutputStream;
pub const DISPID_SVRate = DISPID_SpeechVoice.Rate;
pub const DISPID_SVVolume = DISPID_SpeechVoice.Volume;
pub const DISPID_SVAllowAudioOuputFormatChangesOnNextSet = DISPID_SpeechVoice.AllowAudioOuputFormatChangesOnNextSet;
pub const DISPID_SVEventInterests = DISPID_SpeechVoice.EventInterests;
pub const DISPID_SVPriority = DISPID_SpeechVoice.Priority;
pub const DISPID_SVAlertBoundary = DISPID_SpeechVoice.AlertBoundary;
pub const DISPID_SVSyncronousSpeakTimeout = DISPID_SpeechVoice.SyncronousSpeakTimeout;
pub const DISPID_SVSpeak = DISPID_SpeechVoice.Speak;
pub const DISPID_SVSpeakStream = DISPID_SpeechVoice.SpeakStream;
pub const DISPID_SVPause = DISPID_SpeechVoice.Pause;
pub const DISPID_SVResume = DISPID_SpeechVoice.Resume;
pub const DISPID_SVSkip = DISPID_SpeechVoice.Skip;
pub const DISPID_SVGetVoices = DISPID_SpeechVoice.GetVoices;
pub const DISPID_SVGetAudioOutputs = DISPID_SpeechVoice.GetAudioOutputs;
pub const DISPID_SVWaitUntilDone = DISPID_SpeechVoice.WaitUntilDone;
pub const DISPID_SVSpeakCompleteEvent = DISPID_SpeechVoice.SpeakCompleteEvent;
pub const DISPID_SVIsUISupported = DISPID_SpeechVoice.IsUISupported;
pub const DISPID_SVDisplayUI = DISPID_SpeechVoice.DisplayUI;
pub const SpeechVoicePriority = enum(i32) {
Normal = 0,
Alert = 1,
Over = 2,
};
pub const SVPNormal = SpeechVoicePriority.Normal;
pub const SVPAlert = SpeechVoicePriority.Alert;
pub const SVPOver = SpeechVoicePriority.Over;
pub const SpeechVoiceSpeakFlags = enum(i32) {
Default = 0,
lagsAsync = 1,
PurgeBeforeSpeak = 2,
IsFilename = 4,
IsXML = 8,
IsNotXML = 16,
PersistXML = 32,
NLPSpeakPunc = 64,
ParseSapi = 128,
ParseSsml = 256,
// ParseAutodetect = 0, this enum value conflicts with Default
// NLPMask = 64, this enum value conflicts with NLPSpeakPunc
ParseMask = 384,
VoiceMask = 511,
UnusedFlags = -512,
};
pub const SVSFDefault = SpeechVoiceSpeakFlags.Default;
pub const SVSFlagsAsync = SpeechVoiceSpeakFlags.lagsAsync;
pub const SVSFPurgeBeforeSpeak = SpeechVoiceSpeakFlags.PurgeBeforeSpeak;
pub const SVSFIsFilename = SpeechVoiceSpeakFlags.IsFilename;
pub const SVSFIsXML = SpeechVoiceSpeakFlags.IsXML;
pub const SVSFIsNotXML = SpeechVoiceSpeakFlags.IsNotXML;
pub const SVSFPersistXML = SpeechVoiceSpeakFlags.PersistXML;
pub const SVSFNLPSpeakPunc = SpeechVoiceSpeakFlags.NLPSpeakPunc;
pub const SVSFParseSapi = SpeechVoiceSpeakFlags.ParseSapi;
pub const SVSFParseSsml = SpeechVoiceSpeakFlags.ParseSsml;
pub const SVSFParseAutodetect = SpeechVoiceSpeakFlags.Default;
pub const SVSFNLPMask = SpeechVoiceSpeakFlags.NLPSpeakPunc;
pub const SVSFParseMask = SpeechVoiceSpeakFlags.ParseMask;
pub const SVSFVoiceMask = SpeechVoiceSpeakFlags.VoiceMask;
pub const SVSFUnusedFlags = SpeechVoiceSpeakFlags.UnusedFlags;
pub const SpeechVoiceEvents = enum(i32) {
StartInputStream = 2,
EndInputStream = 4,
VoiceChange = 8,
Bookmark = 16,
WordBoundary = 32,
Phoneme = 64,
SentenceBoundary = 128,
Viseme = 256,
AudioLevel = 512,
Private = 32768,
AllEvents = 33790,
};
pub const SVEStartInputStream = SpeechVoiceEvents.StartInputStream;
pub const SVEEndInputStream = SpeechVoiceEvents.EndInputStream;
pub const SVEVoiceChange = SpeechVoiceEvents.VoiceChange;
pub const SVEBookmark = SpeechVoiceEvents.Bookmark;
pub const SVEWordBoundary = SpeechVoiceEvents.WordBoundary;
pub const SVEPhoneme = SpeechVoiceEvents.Phoneme;
pub const SVESentenceBoundary = SpeechVoiceEvents.SentenceBoundary;
pub const SVEViseme = SpeechVoiceEvents.Viseme;
pub const SVEAudioLevel = SpeechVoiceEvents.AudioLevel;
pub const SVEPrivate = SpeechVoiceEvents.Private;
pub const SVEAllEvents = SpeechVoiceEvents.AllEvents;
pub const DISPID_SpeechVoiceStatus = enum(i32) {
CurrentStreamNumber = 1,
LastStreamNumberQueued = 2,
LastResult = 3,
RunningState = 4,
InputWordPosition = 5,
InputWordLength = 6,
InputSentencePosition = 7,
InputSentenceLength = 8,
LastBookmark = 9,
LastBookmarkId = 10,
PhonemeId = 11,
VisemeId = 12,
};
pub const DISPID_SVSCurrentStreamNumber = DISPID_SpeechVoiceStatus.CurrentStreamNumber;
pub const DISPID_SVSLastStreamNumberQueued = DISPID_SpeechVoiceStatus.LastStreamNumberQueued;
pub const DISPID_SVSLastResult = DISPID_SpeechVoiceStatus.LastResult;
pub const DISPID_SVSRunningState = DISPID_SpeechVoiceStatus.RunningState;
pub const DISPID_SVSInputWordPosition = DISPID_SpeechVoiceStatus.InputWordPosition;
pub const DISPID_SVSInputWordLength = DISPID_SpeechVoiceStatus.InputWordLength;
pub const DISPID_SVSInputSentencePosition = DISPID_SpeechVoiceStatus.InputSentencePosition;
pub const DISPID_SVSInputSentenceLength = DISPID_SpeechVoiceStatus.InputSentenceLength;
pub const DISPID_SVSLastBookmark = DISPID_SpeechVoiceStatus.LastBookmark;
pub const DISPID_SVSLastBookmarkId = DISPID_SpeechVoiceStatus.LastBookmarkId;
pub const DISPID_SVSPhonemeId = DISPID_SpeechVoiceStatus.PhonemeId;
pub const DISPID_SVSVisemeId = DISPID_SpeechVoiceStatus.VisemeId;
pub const SpeechRunState = enum(i32) {
Done = 1,
IsSpeaking = 2,
};
pub const SRSEDone = SpeechRunState.Done;
pub const SRSEIsSpeaking = SpeechRunState.IsSpeaking;
pub const SpeechVisemeType = enum(i32) {
@"0" = 0,
@"1" = 1,
@"2" = 2,
@"3" = 3,
@"4" = 4,
@"5" = 5,
@"6" = 6,
@"7" = 7,
@"8" = 8,
@"9" = 9,
@"10" = 10,
@"11" = 11,
@"12" = 12,
@"13" = 13,
@"14" = 14,
@"15" = 15,
@"16" = 16,
@"17" = 17,
@"18" = 18,
@"19" = 19,
@"20" = 20,
@"21" = 21,
};
pub const SVP_0 = SpeechVisemeType.@"0";
pub const SVP_1 = SpeechVisemeType.@"1";
pub const SVP_2 = SpeechVisemeType.@"2";
pub const SVP_3 = SpeechVisemeType.@"3";
pub const SVP_4 = SpeechVisemeType.@"4";
pub const SVP_5 = SpeechVisemeType.@"5";
pub const SVP_6 = SpeechVisemeType.@"6";
pub const SVP_7 = SpeechVisemeType.@"7";
pub const SVP_8 = SpeechVisemeType.@"8";
pub const SVP_9 = SpeechVisemeType.@"9";
pub const SVP_10 = SpeechVisemeType.@"10";
pub const SVP_11 = SpeechVisemeType.@"11";
pub const SVP_12 = SpeechVisemeType.@"12";
pub const SVP_13 = SpeechVisemeType.@"13";
pub const SVP_14 = SpeechVisemeType.@"14";
pub const SVP_15 = SpeechVisemeType.@"15";
pub const SVP_16 = SpeechVisemeType.@"16";
pub const SVP_17 = SpeechVisemeType.@"17";
pub const SVP_18 = SpeechVisemeType.@"18";
pub const SVP_19 = SpeechVisemeType.@"19";
pub const SVP_20 = SpeechVisemeType.@"20";
pub const SVP_21 = SpeechVisemeType.@"21";
pub const SpeechVisemeFeature = enum(i32) {
None = 0,
Stressed = 1,
Emphasis = 2,
};
pub const SVF_None = SpeechVisemeFeature.None;
pub const SVF_Stressed = SpeechVisemeFeature.Stressed;
pub const SVF_Emphasis = SpeechVisemeFeature.Emphasis;
pub const DISPID_SpeechVoiceEvent = enum(i32) {
StreamStart = 1,
StreamEnd = 2,
VoiceChange = 3,
Bookmark = 4,
Word = 5,
Phoneme = 6,
SentenceBoundary = 7,
Viseme = 8,
AudioLevel = 9,
EnginePrivate = 10,
};
pub const DISPID_SVEStreamStart = DISPID_SpeechVoiceEvent.StreamStart;
pub const DISPID_SVEStreamEnd = DISPID_SpeechVoiceEvent.StreamEnd;
pub const DISPID_SVEVoiceChange = DISPID_SpeechVoiceEvent.VoiceChange;
pub const DISPID_SVEBookmark = DISPID_SpeechVoiceEvent.Bookmark;
pub const DISPID_SVEWord = DISPID_SpeechVoiceEvent.Word;
pub const DISPID_SVEPhoneme = DISPID_SpeechVoiceEvent.Phoneme;
pub const DISPID_SVESentenceBoundary = DISPID_SpeechVoiceEvent.SentenceBoundary;
pub const DISPID_SVEViseme = DISPID_SpeechVoiceEvent.Viseme;
pub const DISPID_SVEAudioLevel = DISPID_SpeechVoiceEvent.AudioLevel;
pub const DISPID_SVEEnginePrivate = DISPID_SpeechVoiceEvent.EnginePrivate;
pub const DISPID_SpeechRecognizer = enum(i32) {
RRecognizer = 1,
RAllowAudioInputFormatChangesOnNextSet = 2,
RAudioInput = 3,
RAudioInputStream = 4,
RIsShared = 5,
RState = 6,
RStatus = 7,
RProfile = 8,
REmulateRecognition = 9,
RCreateRecoContext = 10,
RGetFormat = 11,
RSetPropertyNumber = 12,
RGetPropertyNumber = 13,
RSetPropertyString = 14,
RGetPropertyString = 15,
RIsUISupported = 16,
RDisplayUI = 17,
RGetRecognizers = 18,
VGetAudioInputs = 19,
VGetProfiles = 20,
};
pub const DISPID_SRRecognizer = DISPID_SpeechRecognizer.RRecognizer;
pub const DISPID_SRAllowAudioInputFormatChangesOnNextSet = DISPID_SpeechRecognizer.RAllowAudioInputFormatChangesOnNextSet;
pub const DISPID_SRAudioInput = DISPID_SpeechRecognizer.RAudioInput;
pub const DISPID_SRAudioInputStream = DISPID_SpeechRecognizer.RAudioInputStream;
pub const DISPID_SRIsShared = DISPID_SpeechRecognizer.RIsShared;
pub const DISPID_SRState = DISPID_SpeechRecognizer.RState;
pub const DISPID_SRStatus = DISPID_SpeechRecognizer.RStatus;
pub const DISPID_SRProfile = DISPID_SpeechRecognizer.RProfile;
pub const DISPID_SREmulateRecognition = DISPID_SpeechRecognizer.REmulateRecognition;
pub const DISPID_SRCreateRecoContext = DISPID_SpeechRecognizer.RCreateRecoContext;
pub const DISPID_SRGetFormat = DISPID_SpeechRecognizer.RGetFormat;
pub const DISPID_SRSetPropertyNumber = DISPID_SpeechRecognizer.RSetPropertyNumber;
pub const DISPID_SRGetPropertyNumber = DISPID_SpeechRecognizer.RGetPropertyNumber;
pub const DISPID_SRSetPropertyString = DISPID_SpeechRecognizer.RSetPropertyString;
pub const DISPID_SRGetPropertyString = DISPID_SpeechRecognizer.RGetPropertyString;
pub const DISPID_SRIsUISupported = DISPID_SpeechRecognizer.RIsUISupported;
pub const DISPID_SRDisplayUI = DISPID_SpeechRecognizer.RDisplayUI;
pub const DISPID_SRGetRecognizers = DISPID_SpeechRecognizer.RGetRecognizers;
pub const DISPID_SVGetAudioInputs = DISPID_SpeechRecognizer.VGetAudioInputs;
pub const DISPID_SVGetProfiles = DISPID_SpeechRecognizer.VGetProfiles;
pub const SpeechRecognizerState = enum(i32) {
Inactive = 0,
Active = 1,
ActiveAlways = 2,
InactiveWithPurge = 3,
};
pub const SRSInactive = SpeechRecognizerState.Inactive;
pub const SRSActive = SpeechRecognizerState.Active;
pub const SRSActiveAlways = SpeechRecognizerState.ActiveAlways;
pub const SRSInactiveWithPurge = SpeechRecognizerState.InactiveWithPurge;
pub const SpeechDisplayAttributes = enum(i32) {
No_Trailing_Space = 0,
One_Trailing_Space = 2,
Two_Trailing_Spaces = 4,
Consume_Leading_Spaces = 8,
};
pub const SDA_No_Trailing_Space = SpeechDisplayAttributes.No_Trailing_Space;
pub const SDA_One_Trailing_Space = SpeechDisplayAttributes.One_Trailing_Space;
pub const SDA_Two_Trailing_Spaces = SpeechDisplayAttributes.Two_Trailing_Spaces;
pub const SDA_Consume_Leading_Spaces = SpeechDisplayAttributes.Consume_Leading_Spaces;
pub const SpeechFormatType = enum(i32) {
Input = 0,
SREngine = 1,
};
pub const SFTInput = SpeechFormatType.Input;
pub const SFTSREngine = SpeechFormatType.SREngine;
pub const SpeechEmulationCompareFlags = enum(i32) {
IgnoreCase = 1,
IgnoreKanaType = 65536,
IgnoreWidth = 131072,
NoSpecialChars = 536870912,
EmulateResult = 1073741824,
Default = 196609,
};
pub const SECFIgnoreCase = SpeechEmulationCompareFlags.IgnoreCase;
pub const SECFIgnoreKanaType = SpeechEmulationCompareFlags.IgnoreKanaType;
pub const SECFIgnoreWidth = SpeechEmulationCompareFlags.IgnoreWidth;
pub const SECFNoSpecialChars = SpeechEmulationCompareFlags.NoSpecialChars;
pub const SECFEmulateResult = SpeechEmulationCompareFlags.EmulateResult;
pub const SECFDefault = SpeechEmulationCompareFlags.Default;
pub const DISPID_SpeechRecognizerStatus = enum(i32) {
AudioStatus = 1,
CurrentStreamPosition = 2,
CurrentStreamNumber = 3,
NumberOfActiveRules = 4,
ClsidEngine = 5,
SupportedLanguages = 6,
};
pub const DISPID_SRSAudioStatus = DISPID_SpeechRecognizerStatus.AudioStatus;
pub const DISPID_SRSCurrentStreamPosition = DISPID_SpeechRecognizerStatus.CurrentStreamPosition;
pub const DISPID_SRSCurrentStreamNumber = DISPID_SpeechRecognizerStatus.CurrentStreamNumber;
pub const DISPID_SRSNumberOfActiveRules = DISPID_SpeechRecognizerStatus.NumberOfActiveRules;
pub const DISPID_SRSClsidEngine = DISPID_SpeechRecognizerStatus.ClsidEngine;
pub const DISPID_SRSSupportedLanguages = DISPID_SpeechRecognizerStatus.SupportedLanguages;
pub const DISPID_SpeechRecoContext = enum(i32) {
CRecognizer = 1,
CAudioInInterferenceStatus = 2,
CRequestedUIType = 3,
CVoice = 4,
AllowVoiceFormatMatchingOnNextSet = 5,
CVoicePurgeEvent = 6,
CEventInterests = 7,
CCmdMaxAlternates = 8,
CState = 9,
CRetainedAudio = 10,
CRetainedAudioFormat = 11,
CPause = 12,
CResume = 13,
CCreateGrammar = 14,
CCreateResultFromMemory = 15,
CBookmark = 16,
CSetAdaptationData = 17,
};
pub const DISPID_SRCRecognizer = DISPID_SpeechRecoContext.CRecognizer;
pub const DISPID_SRCAudioInInterferenceStatus = DISPID_SpeechRecoContext.CAudioInInterferenceStatus;
pub const DISPID_SRCRequestedUIType = DISPID_SpeechRecoContext.CRequestedUIType;
pub const DISPID_SRCVoice = DISPID_SpeechRecoContext.CVoice;
pub const DISPID_SRAllowVoiceFormatMatchingOnNextSet = DISPID_SpeechRecoContext.AllowVoiceFormatMatchingOnNextSet;
pub const DISPID_SRCVoicePurgeEvent = DISPID_SpeechRecoContext.CVoicePurgeEvent;
pub const DISPID_SRCEventInterests = DISPID_SpeechRecoContext.CEventInterests;
pub const DISPID_SRCCmdMaxAlternates = DISPID_SpeechRecoContext.CCmdMaxAlternates;
pub const DISPID_SRCState = DISPID_SpeechRecoContext.CState;
pub const DISPID_SRCRetainedAudio = DISPID_SpeechRecoContext.CRetainedAudio;
pub const DISPID_SRCRetainedAudioFormat = DISPID_SpeechRecoContext.CRetainedAudioFormat;
pub const DISPID_SRCPause = DISPID_SpeechRecoContext.CPause;
pub const DISPID_SRCResume = DISPID_SpeechRecoContext.CResume;
pub const DISPID_SRCCreateGrammar = DISPID_SpeechRecoContext.CCreateGrammar;
pub const DISPID_SRCCreateResultFromMemory = DISPID_SpeechRecoContext.CCreateResultFromMemory;
pub const DISPID_SRCBookmark = DISPID_SpeechRecoContext.CBookmark;
pub const DISPID_SRCSetAdaptationData = DISPID_SpeechRecoContext.CSetAdaptationData;
pub const SpeechRetainedAudioOptions = enum(i32) {
None = 0,
RetainAudio = 1,
};
pub const SRAONone = SpeechRetainedAudioOptions.None;
pub const SRAORetainAudio = SpeechRetainedAudioOptions.RetainAudio;
pub const SpeechBookmarkOptions = enum(i32) {
None = 0,
Pause = 1,
};
pub const SBONone = SpeechBookmarkOptions.None;
pub const SBOPause = SpeechBookmarkOptions.Pause;
pub const SpeechInterference = enum(i32) {
None = 0,
Noise = 1,
NoSignal = 2,
TooLoud = 3,
TooQuiet = 4,
TooFast = 5,
TooSlow = 6,
};
pub const SINone = SpeechInterference.None;
pub const SINoise = SpeechInterference.Noise;
pub const SINoSignal = SpeechInterference.NoSignal;
pub const SITooLoud = SpeechInterference.TooLoud;
pub const SITooQuiet = SpeechInterference.TooQuiet;
pub const SITooFast = SpeechInterference.TooFast;
pub const SITooSlow = SpeechInterference.TooSlow;
pub const SpeechRecoEvents = enum(i32) {
StreamEnd = 1,
SoundStart = 2,
SoundEnd = 4,
PhraseStart = 8,
Recognition = 16,
Hypothesis = 32,
Bookmark = 64,
PropertyNumChange = 128,
PropertyStringChange = 256,
FalseRecognition = 512,
Interference = 1024,
RequestUI = 2048,
StateChange = 4096,
Adaptation = 8192,
StreamStart = 16384,
RecoOtherContext = 32768,
AudioLevel = 65536,
Private = 262144,
AllEvents = 393215,
};
pub const SREStreamEnd = SpeechRecoEvents.StreamEnd;
pub const SRESoundStart = SpeechRecoEvents.SoundStart;
pub const SRESoundEnd = SpeechRecoEvents.SoundEnd;
pub const SREPhraseStart = SpeechRecoEvents.PhraseStart;
pub const SRERecognition = SpeechRecoEvents.Recognition;
pub const SREHypothesis = SpeechRecoEvents.Hypothesis;
pub const SREBookmark = SpeechRecoEvents.Bookmark;
pub const SREPropertyNumChange = SpeechRecoEvents.PropertyNumChange;
pub const SREPropertyStringChange = SpeechRecoEvents.PropertyStringChange;
pub const SREFalseRecognition = SpeechRecoEvents.FalseRecognition;
pub const SREInterference = SpeechRecoEvents.Interference;
pub const SRERequestUI = SpeechRecoEvents.RequestUI;
pub const SREStateChange = SpeechRecoEvents.StateChange;
pub const SREAdaptation = SpeechRecoEvents.Adaptation;
pub const SREStreamStart = SpeechRecoEvents.StreamStart;
pub const SRERecoOtherContext = SpeechRecoEvents.RecoOtherContext;
pub const SREAudioLevel = SpeechRecoEvents.AudioLevel;
pub const SREPrivate = SpeechRecoEvents.Private;
pub const SREAllEvents = SpeechRecoEvents.AllEvents;
pub const SpeechRecoContextState = enum(i32) {
Disabled = 0,
Enabled = 1,
};
pub const SRCS_Disabled = SpeechRecoContextState.Disabled;
pub const SRCS_Enabled = SpeechRecoContextState.Enabled;
pub const DISPIDSPRG = enum(i32) {
Id = 1,
RecoContext = 2,
State = 3,
Rules = 4,
Reset = 5,
Commit = 6,
CmdLoadFromFile = 7,
CmdLoadFromObject = 8,
CmdLoadFromResource = 9,
CmdLoadFromMemory = 10,
CmdLoadFromProprietaryGrammar = 11,
CmdSetRuleState = 12,
CmdSetRuleIdState = 13,
DictationLoad = 14,
DictationUnload = 15,
DictationSetState = 16,
SetWordSequenceData = 17,
SetTextSelection = 18,
IsPronounceable = 19,
};
pub const DISPID_SRGId = DISPIDSPRG.Id;
pub const DISPID_SRGRecoContext = DISPIDSPRG.RecoContext;
pub const DISPID_SRGState = DISPIDSPRG.State;
pub const DISPID_SRGRules = DISPIDSPRG.Rules;
pub const DISPID_SRGReset = DISPIDSPRG.Reset;
pub const DISPID_SRGCommit = DISPIDSPRG.Commit;
pub const DISPID_SRGCmdLoadFromFile = DISPIDSPRG.CmdLoadFromFile;
pub const DISPID_SRGCmdLoadFromObject = DISPIDSPRG.CmdLoadFromObject;
pub const DISPID_SRGCmdLoadFromResource = DISPIDSPRG.CmdLoadFromResource;
pub const DISPID_SRGCmdLoadFromMemory = DISPIDSPRG.CmdLoadFromMemory;
pub const DISPID_SRGCmdLoadFromProprietaryGrammar = DISPIDSPRG.CmdLoadFromProprietaryGrammar;
pub const DISPID_SRGCmdSetRuleState = DISPIDSPRG.CmdSetRuleState;
pub const DISPID_SRGCmdSetRuleIdState = DISPIDSPRG.CmdSetRuleIdState;
pub const DISPID_SRGDictationLoad = DISPIDSPRG.DictationLoad;
pub const DISPID_SRGDictationUnload = DISPIDSPRG.DictationUnload;
pub const DISPID_SRGDictationSetState = DISPIDSPRG.DictationSetState;
pub const DISPID_SRGSetWordSequenceData = DISPIDSPRG.SetWordSequenceData;
pub const DISPID_SRGSetTextSelection = DISPIDSPRG.SetTextSelection;
pub const DISPID_SRGIsPronounceable = DISPIDSPRG.IsPronounceable;
pub const SpeechLoadOption = enum(i32) {
Static = 0,
Dynamic = 1,
};
pub const SLOStatic = SpeechLoadOption.Static;
pub const SLODynamic = SpeechLoadOption.Dynamic;
pub const SpeechWordPronounceable = enum(i32) {
UnknownWordUnpronounceable = 0,
UnknownWordPronounceable = 1,
KnownWordPronounceable = 2,
};
pub const SWPUnknownWordUnpronounceable = SpeechWordPronounceable.UnknownWordUnpronounceable;
pub const SWPUnknownWordPronounceable = SpeechWordPronounceable.UnknownWordPronounceable;
pub const SWPKnownWordPronounceable = SpeechWordPronounceable.KnownWordPronounceable;
pub const SpeechGrammarState = enum(i32) {
Enabled = 1,
Disabled = 0,
Exclusive = 3,
};
pub const SGSEnabled = SpeechGrammarState.Enabled;
pub const SGSDisabled = SpeechGrammarState.Disabled;
pub const SGSExclusive = SpeechGrammarState.Exclusive;
pub const SpeechRuleState = enum(i32) {
Inactive = 0,
Active = 1,
ActiveWithAutoPause = 3,
ActiveUserDelimited = 4,
};
pub const SGDSInactive = SpeechRuleState.Inactive;
pub const SGDSActive = SpeechRuleState.Active;
pub const SGDSActiveWithAutoPause = SpeechRuleState.ActiveWithAutoPause;
pub const SGDSActiveUserDelimited = SpeechRuleState.ActiveUserDelimited;
pub const SpeechRuleAttributes = enum(i32) {
TopLevel = 1,
DefaultToActive = 2,
Export = 4,
Import = 8,
Interpreter = 16,
Dynamic = 32,
Root = 64,
};
pub const SRATopLevel = SpeechRuleAttributes.TopLevel;
pub const SRADefaultToActive = SpeechRuleAttributes.DefaultToActive;
pub const SRAExport = SpeechRuleAttributes.Export;
pub const SRAImport = SpeechRuleAttributes.Import;
pub const SRAInterpreter = SpeechRuleAttributes.Interpreter;
pub const SRADynamic = SpeechRuleAttributes.Dynamic;
pub const SRARoot = SpeechRuleAttributes.Root;
pub const SpeechGrammarWordType = enum(i32) {
Display = 0,
Lexical = 1,
Pronounciation = 2,
LexicalNoSpecialChars = 3,
};
pub const SGDisplay = SpeechGrammarWordType.Display;
pub const SGLexical = SpeechGrammarWordType.Lexical;
pub const SGPronounciation = SpeechGrammarWordType.Pronounciation;
pub const SGLexicalNoSpecialChars = SpeechGrammarWordType.LexicalNoSpecialChars;
pub const DISPID_SpeechRecoContextEvents = enum(i32) {
StartStream = 1,
EndStream = 2,
Bookmark = 3,
SoundStart = 4,
SoundEnd = 5,
PhraseStart = 6,
Recognition = 7,
Hypothesis = 8,
PropertyNumberChange = 9,
PropertyStringChange = 10,
FalseRecognition = 11,
Interference = 12,
RequestUI = 13,
RecognizerStateChange = 14,
Adaptation = 15,
RecognitionForOtherContext = 16,
AudioLevel = 17,
EnginePrivate = 18,
};
pub const DISPID_SRCEStartStream = DISPID_SpeechRecoContextEvents.StartStream;
pub const DISPID_SRCEEndStream = DISPID_SpeechRecoContextEvents.EndStream;
pub const DISPID_SRCEBookmark = DISPID_SpeechRecoContextEvents.Bookmark;
pub const DISPID_SRCESoundStart = DISPID_SpeechRecoContextEvents.SoundStart;
pub const DISPID_SRCESoundEnd = DISPID_SpeechRecoContextEvents.SoundEnd;
pub const DISPID_SRCEPhraseStart = DISPID_SpeechRecoContextEvents.PhraseStart;
pub const DISPID_SRCERecognition = DISPID_SpeechRecoContextEvents.Recognition;
pub const DISPID_SRCEHypothesis = DISPID_SpeechRecoContextEvents.Hypothesis;
pub const DISPID_SRCEPropertyNumberChange = DISPID_SpeechRecoContextEvents.PropertyNumberChange;
pub const DISPID_SRCEPropertyStringChange = DISPID_SpeechRecoContextEvents.PropertyStringChange;
pub const DISPID_SRCEFalseRecognition = DISPID_SpeechRecoContextEvents.FalseRecognition;
pub const DISPID_SRCEInterference = DISPID_SpeechRecoContextEvents.Interference;
pub const DISPID_SRCERequestUI = DISPID_SpeechRecoContextEvents.RequestUI;
pub const DISPID_SRCERecognizerStateChange = DISPID_SpeechRecoContextEvents.RecognizerStateChange;
pub const DISPID_SRCEAdaptation = DISPID_SpeechRecoContextEvents.Adaptation;
pub const DISPID_SRCERecognitionForOtherContext = DISPID_SpeechRecoContextEvents.RecognitionForOtherContext;
pub const DISPID_SRCEAudioLevel = DISPID_SpeechRecoContextEvents.AudioLevel;
pub const DISPID_SRCEEnginePrivate = DISPID_SpeechRecoContextEvents.EnginePrivate;
pub const SpeechRecognitionType = enum(i32) {
Standard = 0,
Autopause = 1,
Emulated = 2,
SMLTimeout = 4,
ExtendableParse = 8,
ReSent = 16,
};
pub const SRTStandard = SpeechRecognitionType.Standard;
pub const SRTAutopause = SpeechRecognitionType.Autopause;
pub const SRTEmulated = SpeechRecognitionType.Emulated;
pub const SRTSMLTimeout = SpeechRecognitionType.SMLTimeout;
pub const SRTExtendableParse = SpeechRecognitionType.ExtendableParse;
pub const SRTReSent = SpeechRecognitionType.ReSent;
pub const DISPID_SpeechGrammarRule = enum(i32) {
Attributes = 1,
InitialState = 2,
Name = 3,
Id = 4,
Clear = 5,
AddResource = 6,
AddState = 7,
};
pub const DISPID_SGRAttributes = DISPID_SpeechGrammarRule.Attributes;
pub const DISPID_SGRInitialState = DISPID_SpeechGrammarRule.InitialState;
pub const DISPID_SGRName = DISPID_SpeechGrammarRule.Name;
pub const DISPID_SGRId = DISPID_SpeechGrammarRule.Id;
pub const DISPID_SGRClear = DISPID_SpeechGrammarRule.Clear;
pub const DISPID_SGRAddResource = DISPID_SpeechGrammarRule.AddResource;
pub const DISPID_SGRAddState = DISPID_SpeechGrammarRule.AddState;
pub const DISPID_SpeechGrammarRules = enum(i32) {
Count = 1,
Dynamic = 2,
Add = 3,
Commit = 4,
CommitAndSave = 5,
FindRule = 6,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SGRsCount = DISPID_SpeechGrammarRules.Count;
pub const DISPID_SGRsDynamic = DISPID_SpeechGrammarRules.Dynamic;
pub const DISPID_SGRsAdd = DISPID_SpeechGrammarRules.Add;
pub const DISPID_SGRsCommit = DISPID_SpeechGrammarRules.Commit;
pub const DISPID_SGRsCommitAndSave = DISPID_SpeechGrammarRules.CommitAndSave;
pub const DISPID_SGRsFindRule = DISPID_SpeechGrammarRules.FindRule;
pub const DISPID_SGRsItem = DISPID_SpeechGrammarRules.Item;
pub const DISPID_SGRs_NewEnum = DISPID_SpeechGrammarRules._NewEnum;
pub const DISPID_SpeechGrammarRuleState = enum(i32) {
Rule = 1,
Transitions = 2,
AddWordTransition = 3,
AddRuleTransition = 4,
AddSpecialTransition = 5,
};
pub const DISPID_SGRSRule = DISPID_SpeechGrammarRuleState.Rule;
pub const DISPID_SGRSTransitions = DISPID_SpeechGrammarRuleState.Transitions;
pub const DISPID_SGRSAddWordTransition = DISPID_SpeechGrammarRuleState.AddWordTransition;
pub const DISPID_SGRSAddRuleTransition = DISPID_SpeechGrammarRuleState.AddRuleTransition;
pub const DISPID_SGRSAddSpecialTransition = DISPID_SpeechGrammarRuleState.AddSpecialTransition;
pub const SpeechSpecialTransitionType = enum(i32) {
Wildcard = 1,
Dictation = 2,
TextBuffer = 3,
};
pub const SSTTWildcard = SpeechSpecialTransitionType.Wildcard;
pub const SSTTDictation = SpeechSpecialTransitionType.Dictation;
pub const SSTTTextBuffer = SpeechSpecialTransitionType.TextBuffer;
pub const DISPID_SpeechGrammarRuleStateTransitions = enum(i32) {
Count = 1,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SGRSTsCount = DISPID_SpeechGrammarRuleStateTransitions.Count;
pub const DISPID_SGRSTsItem = DISPID_SpeechGrammarRuleStateTransitions.Item;
pub const DISPID_SGRSTs_NewEnum = DISPID_SpeechGrammarRuleStateTransitions._NewEnum;
pub const DISPID_SpeechGrammarRuleStateTransition = enum(i32) {
Type = 1,
Text = 2,
Rule = 3,
Weight = 4,
PropertyName = 5,
PropertyId = 6,
PropertyValue = 7,
NextState = 8,
};
pub const DISPID_SGRSTType = DISPID_SpeechGrammarRuleStateTransition.Type;
pub const DISPID_SGRSTText = DISPID_SpeechGrammarRuleStateTransition.Text;
pub const DISPID_SGRSTRule = DISPID_SpeechGrammarRuleStateTransition.Rule;
pub const DISPID_SGRSTWeight = DISPID_SpeechGrammarRuleStateTransition.Weight;
pub const DISPID_SGRSTPropertyName = DISPID_SpeechGrammarRuleStateTransition.PropertyName;
pub const DISPID_SGRSTPropertyId = DISPID_SpeechGrammarRuleStateTransition.PropertyId;
pub const DISPID_SGRSTPropertyValue = DISPID_SpeechGrammarRuleStateTransition.PropertyValue;
pub const DISPID_SGRSTNextState = DISPID_SpeechGrammarRuleStateTransition.NextState;
pub const SpeechGrammarRuleStateTransitionType = enum(i32) {
Epsilon = 0,
Word = 1,
Rule = 2,
Dictation = 3,
Wildcard = 4,
TextBuffer = 5,
};
pub const SGRSTTEpsilon = SpeechGrammarRuleStateTransitionType.Epsilon;
pub const SGRSTTWord = SpeechGrammarRuleStateTransitionType.Word;
pub const SGRSTTRule = SpeechGrammarRuleStateTransitionType.Rule;
pub const SGRSTTDictation = SpeechGrammarRuleStateTransitionType.Dictation;
pub const SGRSTTWildcard = SpeechGrammarRuleStateTransitionType.Wildcard;
pub const SGRSTTTextBuffer = SpeechGrammarRuleStateTransitionType.TextBuffer;
pub const DISPIDSPTSI = enum(i32) {
ActiveOffset = 1,
ActiveLength = 2,
SelectionOffset = 3,
SelectionLength = 4,
};
pub const DISPIDSPTSI_ActiveOffset = DISPIDSPTSI.ActiveOffset;
pub const DISPIDSPTSI_ActiveLength = DISPIDSPTSI.ActiveLength;
pub const DISPIDSPTSI_SelectionOffset = DISPIDSPTSI.SelectionOffset;
pub const DISPIDSPTSI_SelectionLength = DISPIDSPTSI.SelectionLength;
pub const DISPID_SpeechRecoResult = enum(i32) {
RecoContext = 1,
Times = 2,
AudioFormat = 3,
PhraseInfo = 4,
Alternates = 5,
Audio = 6,
SpeakAudio = 7,
SaveToMemory = 8,
DiscardResultInfo = 9,
};
pub const DISPID_SRRRecoContext = DISPID_SpeechRecoResult.RecoContext;
pub const DISPID_SRRTimes = DISPID_SpeechRecoResult.Times;
pub const DISPID_SRRAudioFormat = DISPID_SpeechRecoResult.AudioFormat;
pub const DISPID_SRRPhraseInfo = DISPID_SpeechRecoResult.PhraseInfo;
pub const DISPID_SRRAlternates = DISPID_SpeechRecoResult.Alternates;
pub const DISPID_SRRAudio = DISPID_SpeechRecoResult.Audio;
pub const DISPID_SRRSpeakAudio = DISPID_SpeechRecoResult.SpeakAudio;
pub const DISPID_SRRSaveToMemory = DISPID_SpeechRecoResult.SaveToMemory;
pub const DISPID_SRRDiscardResultInfo = DISPID_SpeechRecoResult.DiscardResultInfo;
pub const SpeechDiscardType = enum(i32) {
Property = 1,
Replacement = 2,
Rule = 4,
DisplayText = 8,
LexicalForm = 16,
Pronunciation = 32,
Audio = 64,
Alternates = 128,
All = 255,
};
pub const SDTProperty = SpeechDiscardType.Property;
pub const SDTReplacement = SpeechDiscardType.Replacement;
pub const SDTRule = SpeechDiscardType.Rule;
pub const SDTDisplayText = SpeechDiscardType.DisplayText;
pub const SDTLexicalForm = SpeechDiscardType.LexicalForm;
pub const SDTPronunciation = SpeechDiscardType.Pronunciation;
pub const SDTAudio = SpeechDiscardType.Audio;
pub const SDTAlternates = SpeechDiscardType.Alternates;
pub const SDTAll = SpeechDiscardType.All;
pub const DISPID_SpeechXMLRecoResult = enum(i32) {
Result = 10,
ErrorInfo = 11,
};
pub const DISPID_SRRGetXMLResult = DISPID_SpeechXMLRecoResult.Result;
pub const DISPID_SRRGetXMLErrorInfo = DISPID_SpeechXMLRecoResult.ErrorInfo;
pub const DISPID_SpeechRecoResult2 = enum(i32) {
k = 12,
};
pub const DISPID_SRRSetTextFeedback = DISPID_SpeechRecoResult2.k;
pub const DISPID_SpeechPhraseBuilder = enum(i32) {
y = 1,
};
pub const DISPID_SPPBRestorePhraseFromMemory = DISPID_SpeechPhraseBuilder.y;
pub const DISPID_SpeechRecoResultTimes = enum(i32) {
StreamTime = 1,
Length = 2,
TickCount = 3,
OffsetFromStart = 4,
};
pub const DISPID_SRRTStreamTime = DISPID_SpeechRecoResultTimes.StreamTime;
pub const DISPID_SRRTLength = DISPID_SpeechRecoResultTimes.Length;
pub const DISPID_SRRTTickCount = DISPID_SpeechRecoResultTimes.TickCount;
pub const DISPID_SRRTOffsetFromStart = DISPID_SpeechRecoResultTimes.OffsetFromStart;
pub const DISPID_SpeechPhraseAlternate = enum(i32) {
RecoResult = 1,
StartElementInResult = 2,
NumberOfElementsInResult = 3,
PhraseInfo = 4,
Commit = 5,
};
pub const DISPID_SPARecoResult = DISPID_SpeechPhraseAlternate.RecoResult;
pub const DISPID_SPAStartElementInResult = DISPID_SpeechPhraseAlternate.StartElementInResult;
pub const DISPID_SPANumberOfElementsInResult = DISPID_SpeechPhraseAlternate.NumberOfElementsInResult;
pub const DISPID_SPAPhraseInfo = DISPID_SpeechPhraseAlternate.PhraseInfo;
pub const DISPID_SPACommit = DISPID_SpeechPhraseAlternate.Commit;
pub const DISPID_SpeechPhraseAlternates = enum(i32) {
Count = 1,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SPAsCount = DISPID_SpeechPhraseAlternates.Count;
pub const DISPID_SPAsItem = DISPID_SpeechPhraseAlternates.Item;
pub const DISPID_SPAs_NewEnum = DISPID_SpeechPhraseAlternates._NewEnum;
pub const DISPID_SpeechPhraseInfo = enum(i32) {
LanguageId = 1,
GrammarId = 2,
StartTime = 3,
AudioStreamPosition = 4,
AudioSizeBytes = 5,
RetainedSizeBytes = 6,
AudioSizeTime = 7,
Rule = 8,
Properties = 9,
Elements = 10,
Replacements = 11,
EngineId = 12,
EnginePrivateData = 13,
SaveToMemory = 14,
GetText = 15,
GetDisplayAttributes = 16,
};
pub const DISPID_SPILanguageId = DISPID_SpeechPhraseInfo.LanguageId;
pub const DISPID_SPIGrammarId = DISPID_SpeechPhraseInfo.GrammarId;
pub const DISPID_SPIStartTime = DISPID_SpeechPhraseInfo.StartTime;
pub const DISPID_SPIAudioStreamPosition = DISPID_SpeechPhraseInfo.AudioStreamPosition;
pub const DISPID_SPIAudioSizeBytes = DISPID_SpeechPhraseInfo.AudioSizeBytes;
pub const DISPID_SPIRetainedSizeBytes = DISPID_SpeechPhraseInfo.RetainedSizeBytes;
pub const DISPID_SPIAudioSizeTime = DISPID_SpeechPhraseInfo.AudioSizeTime;
pub const DISPID_SPIRule = DISPID_SpeechPhraseInfo.Rule;
pub const DISPID_SPIProperties = DISPID_SpeechPhraseInfo.Properties;
pub const DISPID_SPIElements = DISPID_SpeechPhraseInfo.Elements;
pub const DISPID_SPIReplacements = DISPID_SpeechPhraseInfo.Replacements;
pub const DISPID_SPIEngineId = DISPID_SpeechPhraseInfo.EngineId;
pub const DISPID_SPIEnginePrivateData = DISPID_SpeechPhraseInfo.EnginePrivateData;
pub const DISPID_SPISaveToMemory = DISPID_SpeechPhraseInfo.SaveToMemory;
pub const DISPID_SPIGetText = DISPID_SpeechPhraseInfo.GetText;
pub const DISPID_SPIGetDisplayAttributes = DISPID_SpeechPhraseInfo.GetDisplayAttributes;
pub const DISPID_SpeechPhraseElement = enum(i32) {
AudioTimeOffset = 1,
AudioSizeTime = 2,
AudioStreamOffset = 3,
AudioSizeBytes = 4,
RetainedStreamOffset = 5,
RetainedSizeBytes = 6,
DisplayText = 7,
LexicalForm = 8,
Pronunciation = 9,
DisplayAttributes = 10,
RequiredConfidence = 11,
ActualConfidence = 12,
EngineConfidence = 13,
};
pub const DISPID_SPEAudioTimeOffset = DISPID_SpeechPhraseElement.AudioTimeOffset;
pub const DISPID_SPEAudioSizeTime = DISPID_SpeechPhraseElement.AudioSizeTime;
pub const DISPID_SPEAudioStreamOffset = DISPID_SpeechPhraseElement.AudioStreamOffset;
pub const DISPID_SPEAudioSizeBytes = DISPID_SpeechPhraseElement.AudioSizeBytes;
pub const DISPID_SPERetainedStreamOffset = DISPID_SpeechPhraseElement.RetainedStreamOffset;
pub const DISPID_SPERetainedSizeBytes = DISPID_SpeechPhraseElement.RetainedSizeBytes;
pub const DISPID_SPEDisplayText = DISPID_SpeechPhraseElement.DisplayText;
pub const DISPID_SPELexicalForm = DISPID_SpeechPhraseElement.LexicalForm;
pub const DISPID_SPEPronunciation = DISPID_SpeechPhraseElement.Pronunciation;
pub const DISPID_SPEDisplayAttributes = DISPID_SpeechPhraseElement.DisplayAttributes;
pub const DISPID_SPERequiredConfidence = DISPID_SpeechPhraseElement.RequiredConfidence;
pub const DISPID_SPEActualConfidence = DISPID_SpeechPhraseElement.ActualConfidence;
pub const DISPID_SPEEngineConfidence = DISPID_SpeechPhraseElement.EngineConfidence;
pub const SpeechEngineConfidence = enum(i32) {
LowConfidence = -1,
NormalConfidence = 0,
HighConfidence = 1,
};
pub const SECLowConfidence = SpeechEngineConfidence.LowConfidence;
pub const SECNormalConfidence = SpeechEngineConfidence.NormalConfidence;
pub const SECHighConfidence = SpeechEngineConfidence.HighConfidence;
pub const DISPID_SpeechPhraseElements = enum(i32) {
Count = 1,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SPEsCount = DISPID_SpeechPhraseElements.Count;
pub const DISPID_SPEsItem = DISPID_SpeechPhraseElements.Item;
pub const DISPID_SPEs_NewEnum = DISPID_SpeechPhraseElements._NewEnum;
pub const DISPID_SpeechPhraseReplacement = enum(i32) {
DisplayAttributes = 1,
Text = 2,
FirstElement = 3,
NumberOfElements = 4,
};
pub const DISPID_SPRDisplayAttributes = DISPID_SpeechPhraseReplacement.DisplayAttributes;
pub const DISPID_SPRText = DISPID_SpeechPhraseReplacement.Text;
pub const DISPID_SPRFirstElement = DISPID_SpeechPhraseReplacement.FirstElement;
pub const DISPID_SPRNumberOfElements = DISPID_SpeechPhraseReplacement.NumberOfElements;
pub const DISPID_SpeechPhraseReplacements = enum(i32) {
Count = 1,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SPRsCount = DISPID_SpeechPhraseReplacements.Count;
pub const DISPID_SPRsItem = DISPID_SpeechPhraseReplacements.Item;
pub const DISPID_SPRs_NewEnum = DISPID_SpeechPhraseReplacements._NewEnum;
pub const DISPID_SpeechPhraseProperty = enum(i32) {
Name = 1,
Id = 2,
Value = 3,
FirstElement = 4,
NumberOfElements = 5,
EngineConfidence = 6,
Confidence = 7,
Parent = 8,
Children = 9,
};
pub const DISPID_SPPName = DISPID_SpeechPhraseProperty.Name;
pub const DISPID_SPPId = DISPID_SpeechPhraseProperty.Id;
pub const DISPID_SPPValue = DISPID_SpeechPhraseProperty.Value;
pub const DISPID_SPPFirstElement = DISPID_SpeechPhraseProperty.FirstElement;
pub const DISPID_SPPNumberOfElements = DISPID_SpeechPhraseProperty.NumberOfElements;
pub const DISPID_SPPEngineConfidence = DISPID_SpeechPhraseProperty.EngineConfidence;
pub const DISPID_SPPConfidence = DISPID_SpeechPhraseProperty.Confidence;
pub const DISPID_SPPParent = DISPID_SpeechPhraseProperty.Parent;
pub const DISPID_SPPChildren = DISPID_SpeechPhraseProperty.Children;
pub const DISPID_SpeechPhraseProperties = enum(i32) {
Count = 1,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SPPsCount = DISPID_SpeechPhraseProperties.Count;
pub const DISPID_SPPsItem = DISPID_SpeechPhraseProperties.Item;
pub const DISPID_SPPs_NewEnum = DISPID_SpeechPhraseProperties._NewEnum;
pub const DISPID_SpeechPhraseRule = enum(i32) {
Name = 1,
Id = 2,
FirstElement = 3,
NumberOfElements = 4,
Parent = 5,
Children = 6,
Confidence = 7,
EngineConfidence = 8,
};
pub const DISPID_SPRuleName = DISPID_SpeechPhraseRule.Name;
pub const DISPID_SPRuleId = DISPID_SpeechPhraseRule.Id;
pub const DISPID_SPRuleFirstElement = DISPID_SpeechPhraseRule.FirstElement;
pub const DISPID_SPRuleNumberOfElements = DISPID_SpeechPhraseRule.NumberOfElements;
pub const DISPID_SPRuleParent = DISPID_SpeechPhraseRule.Parent;
pub const DISPID_SPRuleChildren = DISPID_SpeechPhraseRule.Children;
pub const DISPID_SPRuleConfidence = DISPID_SpeechPhraseRule.Confidence;
pub const DISPID_SPRuleEngineConfidence = DISPID_SpeechPhraseRule.EngineConfidence;
pub const DISPID_SpeechPhraseRules = enum(i32) {
Count = 1,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SPRulesCount = DISPID_SpeechPhraseRules.Count;
pub const DISPID_SPRulesItem = DISPID_SpeechPhraseRules.Item;
pub const DISPID_SPRules_NewEnum = DISPID_SpeechPhraseRules._NewEnum;
pub const DISPID_SpeechLexicon = enum(i32) {
GenerationId = 1,
GetWords = 2,
AddPronunciation = 3,
AddPronunciationByPhoneIds = 4,
RemovePronunciation = 5,
RemovePronunciationByPhoneIds = 6,
GetPronunciations = 7,
GetGenerationChange = 8,
};
pub const DISPID_SLGenerationId = DISPID_SpeechLexicon.GenerationId;
pub const DISPID_SLGetWords = DISPID_SpeechLexicon.GetWords;
pub const DISPID_SLAddPronunciation = DISPID_SpeechLexicon.AddPronunciation;
pub const DISPID_SLAddPronunciationByPhoneIds = DISPID_SpeechLexicon.AddPronunciationByPhoneIds;
pub const DISPID_SLRemovePronunciation = DISPID_SpeechLexicon.RemovePronunciation;
pub const DISPID_SLRemovePronunciationByPhoneIds = DISPID_SpeechLexicon.RemovePronunciationByPhoneIds;
pub const DISPID_SLGetPronunciations = DISPID_SpeechLexicon.GetPronunciations;
pub const DISPID_SLGetGenerationChange = DISPID_SpeechLexicon.GetGenerationChange;
pub const SpeechLexiconType = enum(i32) {
User = 1,
App = 2,
};
pub const SLTUser = SpeechLexiconType.User;
pub const SLTApp = SpeechLexiconType.App;
pub const SpeechPartOfSpeech = enum(i32) {
NotOverriden = -1,
Unknown = 0,
Noun = 4096,
Verb = 8192,
Modifier = 12288,
Function = 16384,
Interjection = 20480,
LMA = 28672,
SuppressWord = 61440,
};
pub const SPSNotOverriden = SpeechPartOfSpeech.NotOverriden;
pub const SPSUnknown = SpeechPartOfSpeech.Unknown;
pub const SPSNoun = SpeechPartOfSpeech.Noun;
pub const SPSVerb = SpeechPartOfSpeech.Verb;
pub const SPSModifier = SpeechPartOfSpeech.Modifier;
pub const SPSFunction = SpeechPartOfSpeech.Function;
pub const SPSInterjection = SpeechPartOfSpeech.Interjection;
pub const SPSLMA = SpeechPartOfSpeech.LMA;
pub const SPSSuppressWord = SpeechPartOfSpeech.SuppressWord;
pub const DISPID_SpeechLexiconWords = enum(i32) {
Count = 1,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SLWsCount = DISPID_SpeechLexiconWords.Count;
pub const DISPID_SLWsItem = DISPID_SpeechLexiconWords.Item;
pub const DISPID_SLWs_NewEnum = DISPID_SpeechLexiconWords._NewEnum;
pub const SpeechWordType = enum(i32) {
Added = 1,
Deleted = 2,
};
pub const SWTAdded = SpeechWordType.Added;
pub const SWTDeleted = SpeechWordType.Deleted;
pub const DISPID_SpeechLexiconWord = enum(i32) {
LangId = 1,
Type = 2,
Word = 3,
Pronunciations = 4,
};
pub const DISPID_SLWLangId = DISPID_SpeechLexiconWord.LangId;
pub const DISPID_SLWType = DISPID_SpeechLexiconWord.Type;
pub const DISPID_SLWWord = DISPID_SpeechLexiconWord.Word;
pub const DISPID_SLWPronunciations = DISPID_SpeechLexiconWord.Pronunciations;
pub const DISPID_SpeechLexiconProns = enum(i32) {
Count = 1,
Item = 0,
_NewEnum = -4,
};
pub const DISPID_SLPsCount = DISPID_SpeechLexiconProns.Count;
pub const DISPID_SLPsItem = DISPID_SpeechLexiconProns.Item;
pub const DISPID_SLPs_NewEnum = DISPID_SpeechLexiconProns._NewEnum;
pub const DISPID_SpeechLexiconPronunciation = enum(i32) {
Type = 1,
LangId = 2,
PartOfSpeech = 3,
PhoneIds = 4,
Symbolic = 5,
};
pub const DISPID_SLPType = DISPID_SpeechLexiconPronunciation.Type;
pub const DISPID_SLPLangId = DISPID_SpeechLexiconPronunciation.LangId;
pub const DISPID_SLPPartOfSpeech = DISPID_SpeechLexiconPronunciation.PartOfSpeech;
pub const DISPID_SLPPhoneIds = DISPID_SpeechLexiconPronunciation.PhoneIds;
pub const DISPID_SLPSymbolic = DISPID_SpeechLexiconPronunciation.Symbolic;
pub const DISPID_SpeechPhoneConverter = enum(i32) {
LangId = 1,
PhoneToId = 2,
IdToPhone = 3,
};
pub const DISPID_SPCLangId = DISPID_SpeechPhoneConverter.LangId;
pub const DISPID_SPCPhoneToId = DISPID_SpeechPhoneConverter.PhoneToId;
pub const DISPID_SPCIdToPhone = DISPID_SpeechPhoneConverter.IdToPhone;
const IID_ISpeechDataKey_Value = @import("../zig.zig").Guid.initString("ce17c09b-4efa-44d5-a4c9-59d9585ab0cd");
pub const IID_ISpeechDataKey = &IID_ISpeechDataKey_Value;
pub const ISpeechDataKey = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
SetBinaryValue: fn(
self: *const ISpeechDataKey,
ValueName: ?BSTR,
Value: VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBinaryValue: fn(
self: *const ISpeechDataKey,
ValueName: ?BSTR,
Value: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetStringValue: fn(
self: *const ISpeechDataKey,
ValueName: ?BSTR,
Value: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStringValue: fn(
self: *const ISpeechDataKey,
ValueName: ?BSTR,
Value: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetLongValue: fn(
self: *const ISpeechDataKey,
ValueName: ?BSTR,
Value: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLongValue: fn(
self: *const ISpeechDataKey,
ValueName: ?BSTR,
Value: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenKey: fn(
self: *const ISpeechDataKey,
SubKeyName: ?BSTR,
SubKey: ?*?*ISpeechDataKey,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateKey: fn(
self: *const ISpeechDataKey,
SubKeyName: ?BSTR,
SubKey: ?*?*ISpeechDataKey,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteKey: fn(
self: *const ISpeechDataKey,
SubKeyName: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteValue: fn(
self: *const ISpeechDataKey,
ValueName: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumKeys: fn(
self: *const ISpeechDataKey,
Index: i32,
SubKeyName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumValues: fn(
self: *const ISpeechDataKey,
Index: i32,
ValueName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_SetBinaryValue(self: *const T, ValueName: ?BSTR, Value: VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).SetBinaryValue(@ptrCast(*const ISpeechDataKey, self), ValueName, Value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_GetBinaryValue(self: *const T, ValueName: ?BSTR, Value: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).GetBinaryValue(@ptrCast(*const ISpeechDataKey, self), ValueName, Value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_SetStringValue(self: *const T, ValueName: ?BSTR, Value: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).SetStringValue(@ptrCast(*const ISpeechDataKey, self), ValueName, Value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_GetStringValue(self: *const T, ValueName: ?BSTR, Value: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).GetStringValue(@ptrCast(*const ISpeechDataKey, self), ValueName, Value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_SetLongValue(self: *const T, ValueName: ?BSTR, Value: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).SetLongValue(@ptrCast(*const ISpeechDataKey, self), ValueName, Value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_GetLongValue(self: *const T, ValueName: ?BSTR, Value: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).GetLongValue(@ptrCast(*const ISpeechDataKey, self), ValueName, Value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_OpenKey(self: *const T, SubKeyName: ?BSTR, SubKey: ?*?*ISpeechDataKey) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).OpenKey(@ptrCast(*const ISpeechDataKey, self), SubKeyName, SubKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_CreateKey(self: *const T, SubKeyName: ?BSTR, SubKey: ?*?*ISpeechDataKey) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).CreateKey(@ptrCast(*const ISpeechDataKey, self), SubKeyName, SubKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_DeleteKey(self: *const T, SubKeyName: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).DeleteKey(@ptrCast(*const ISpeechDataKey, self), SubKeyName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_DeleteValue(self: *const T, ValueName: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).DeleteValue(@ptrCast(*const ISpeechDataKey, self), ValueName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_EnumKeys(self: *const T, Index: i32, SubKeyName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).EnumKeys(@ptrCast(*const ISpeechDataKey, self), Index, SubKeyName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechDataKey_EnumValues(self: *const T, Index: i32, ValueName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechDataKey.VTable, self.vtable).EnumValues(@ptrCast(*const ISpeechDataKey, self), Index, ValueName);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechObjectToken_Value = @import("../zig.zig").Guid.initString("c74a3adc-b727-4500-a84a-b526721c8b8c");
pub const IID_ISpeechObjectToken = &IID_ISpeechObjectToken_Value;
pub const ISpeechObjectToken = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const ISpeechObjectToken,
ObjectId: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_DataKey: fn(
self: *const ISpeechObjectToken,
DataKey: ?*?*ISpeechDataKey,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Category: fn(
self: *const ISpeechObjectToken,
Category: ?*?*ISpeechObjectTokenCategory,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDescription: fn(
self: *const ISpeechObjectToken,
Locale: i32,
Description: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetId: fn(
self: *const ISpeechObjectToken,
Id: ?BSTR,
CategoryID: ?BSTR,
CreateIfNotExist: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAttribute: fn(
self: *const ISpeechObjectToken,
AttributeName: ?BSTR,
AttributeValue: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateInstance: fn(
self: *const ISpeechObjectToken,
pUnkOuter: ?*IUnknown,
ClsContext: SpeechTokenContext,
Object: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Remove: fn(
self: *const ISpeechObjectToken,
ObjectStorageCLSID: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStorageFileName: fn(
self: *const ISpeechObjectToken,
ObjectStorageCLSID: ?BSTR,
KeyName: ?BSTR,
FileName: ?BSTR,
Folder: SpeechTokenShellFolder,
FilePath: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemoveStorageFileName: fn(
self: *const ISpeechObjectToken,
ObjectStorageCLSID: ?BSTR,
KeyName: ?BSTR,
DeleteFileA: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsUISupported: fn(
self: *const ISpeechObjectToken,
TypeOfUI: ?BSTR,
ExtraData: ?*const VARIANT,
Object: ?*IUnknown,
Supported: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisplayUI: fn(
self: *const ISpeechObjectToken,
hWnd: i32,
Title: ?BSTR,
TypeOfUI: ?BSTR,
ExtraData: ?*const VARIANT,
Object: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MatchesAttributes: fn(
self: *const ISpeechObjectToken,
Attributes: ?BSTR,
Matches: ?*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 ISpeechObjectToken_get_Id(self: *const T, ObjectId: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).get_Id(@ptrCast(*const ISpeechObjectToken, self), ObjectId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_get_DataKey(self: *const T, DataKey: ?*?*ISpeechDataKey) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).get_DataKey(@ptrCast(*const ISpeechObjectToken, self), DataKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_get_Category(self: *const T, Category: ?*?*ISpeechObjectTokenCategory) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).get_Category(@ptrCast(*const ISpeechObjectToken, self), Category);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_GetDescription(self: *const T, Locale: i32, Description: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).GetDescription(@ptrCast(*const ISpeechObjectToken, self), Locale, Description);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_SetId(self: *const T, Id: ?BSTR, CategoryID: ?BSTR, CreateIfNotExist: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).SetId(@ptrCast(*const ISpeechObjectToken, self), Id, CategoryID, CreateIfNotExist);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_GetAttribute(self: *const T, AttributeName: ?BSTR, AttributeValue: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).GetAttribute(@ptrCast(*const ISpeechObjectToken, self), AttributeName, AttributeValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_CreateInstance(self: *const T, pUnkOuter: ?*IUnknown, ClsContext: SpeechTokenContext, Object: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).CreateInstance(@ptrCast(*const ISpeechObjectToken, self), pUnkOuter, ClsContext, Object);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_Remove(self: *const T, ObjectStorageCLSID: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).Remove(@ptrCast(*const ISpeechObjectToken, self), ObjectStorageCLSID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_GetStorageFileName(self: *const T, ObjectStorageCLSID: ?BSTR, KeyName: ?BSTR, FileName: ?BSTR, Folder: SpeechTokenShellFolder, FilePath: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).GetStorageFileName(@ptrCast(*const ISpeechObjectToken, self), ObjectStorageCLSID, KeyName, FileName, Folder, FilePath);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_RemoveStorageFileName(self: *const T, ObjectStorageCLSID: ?BSTR, KeyName: ?BSTR, DeleteFileA: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).RemoveStorageFileName(@ptrCast(*const ISpeechObjectToken, self), ObjectStorageCLSID, KeyName, DeleteFileA);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_IsUISupported(self: *const T, TypeOfUI: ?BSTR, ExtraData: ?*const VARIANT, Object: ?*IUnknown, Supported: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).IsUISupported(@ptrCast(*const ISpeechObjectToken, self), TypeOfUI, ExtraData, Object, Supported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_DisplayUI(self: *const T, hWnd: i32, Title: ?BSTR, TypeOfUI: ?BSTR, ExtraData: ?*const VARIANT, Object: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).DisplayUI(@ptrCast(*const ISpeechObjectToken, self), hWnd, Title, TypeOfUI, ExtraData, Object);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectToken_MatchesAttributes(self: *const T, Attributes: ?BSTR, Matches: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectToken.VTable, self.vtable).MatchesAttributes(@ptrCast(*const ISpeechObjectToken, self), Attributes, Matches);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechObjectTokens_Value = @import("../zig.zig").Guid.initString("9285b776-2e7b-4bc0-b53e-580eb6fa967f");
pub const IID_ISpeechObjectTokens = &IID_ISpeechObjectTokens_Value;
pub const ISpeechObjectTokens = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechObjectTokens,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechObjectTokens,
Index: i32,
Token: ?*?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechObjectTokens,
ppEnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectTokens_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectTokens.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechObjectTokens, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectTokens_Item(self: *const T, Index: i32, Token: ?*?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectTokens.VTable, self.vtable).Item(@ptrCast(*const ISpeechObjectTokens, self), Index, Token);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectTokens_get__NewEnum(self: *const T, ppEnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectTokens.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechObjectTokens, self), ppEnumVARIANT);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechObjectTokenCategory_Value = @import("../zig.zig").Guid.initString("ca7eac50-2d01-4145-86d4-5ae7d70f4469");
pub const IID_ISpeechObjectTokenCategory = &IID_ISpeechObjectTokenCategory_Value;
pub const ISpeechObjectTokenCategory = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const ISpeechObjectTokenCategory,
Id: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Default: fn(
self: *const ISpeechObjectTokenCategory,
TokenId: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Default: fn(
self: *const ISpeechObjectTokenCategory,
TokenId: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetId: fn(
self: *const ISpeechObjectTokenCategory,
Id: ?BSTR,
CreateIfNotExist: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDataKey: fn(
self: *const ISpeechObjectTokenCategory,
Location: SpeechDataKeyLocation,
DataKey: ?*?*ISpeechDataKey,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumerateTokens: fn(
self: *const ISpeechObjectTokenCategory,
RequiredAttributes: ?BSTR,
OptionalAttributes: ?BSTR,
Tokens: ?*?*ISpeechObjectTokens,
) 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 ISpeechObjectTokenCategory_get_Id(self: *const T, Id: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectTokenCategory.VTable, self.vtable).get_Id(@ptrCast(*const ISpeechObjectTokenCategory, self), Id);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectTokenCategory_put_Default(self: *const T, TokenId: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectTokenCategory.VTable, self.vtable).put_Default(@ptrCast(*const ISpeechObjectTokenCategory, self), TokenId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectTokenCategory_get_Default(self: *const T, TokenId: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectTokenCategory.VTable, self.vtable).get_Default(@ptrCast(*const ISpeechObjectTokenCategory, self), TokenId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectTokenCategory_SetId(self: *const T, Id: ?BSTR, CreateIfNotExist: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectTokenCategory.VTable, self.vtable).SetId(@ptrCast(*const ISpeechObjectTokenCategory, self), Id, CreateIfNotExist);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectTokenCategory_GetDataKey(self: *const T, Location: SpeechDataKeyLocation, DataKey: ?*?*ISpeechDataKey) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectTokenCategory.VTable, self.vtable).GetDataKey(@ptrCast(*const ISpeechObjectTokenCategory, self), Location, DataKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechObjectTokenCategory_EnumerateTokens(self: *const T, RequiredAttributes: ?BSTR, OptionalAttributes: ?BSTR, Tokens: ?*?*ISpeechObjectTokens) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechObjectTokenCategory.VTable, self.vtable).EnumerateTokens(@ptrCast(*const ISpeechObjectTokenCategory, self), RequiredAttributes, OptionalAttributes, Tokens);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechAudioBufferInfo_Value = @import("../zig.zig").Guid.initString("11b103d8-1142-4edf-a093-82fb3915f8cc");
pub const IID_ISpeechAudioBufferInfo = &IID_ISpeechAudioBufferInfo_Value;
pub const ISpeechAudioBufferInfo = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_MinNotification: fn(
self: *const ISpeechAudioBufferInfo,
MinNotification: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_MinNotification: fn(
self: *const ISpeechAudioBufferInfo,
MinNotification: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_BufferSize: fn(
self: *const ISpeechAudioBufferInfo,
BufferSize: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_BufferSize: fn(
self: *const ISpeechAudioBufferInfo,
BufferSize: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EventBias: fn(
self: *const ISpeechAudioBufferInfo,
EventBias: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_EventBias: fn(
self: *const ISpeechAudioBufferInfo,
EventBias: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioBufferInfo_get_MinNotification(self: *const T, MinNotification: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioBufferInfo.VTable, self.vtable).get_MinNotification(@ptrCast(*const ISpeechAudioBufferInfo, self), MinNotification);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioBufferInfo_put_MinNotification(self: *const T, MinNotification: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioBufferInfo.VTable, self.vtable).put_MinNotification(@ptrCast(*const ISpeechAudioBufferInfo, self), MinNotification);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioBufferInfo_get_BufferSize(self: *const T, BufferSize: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioBufferInfo.VTable, self.vtable).get_BufferSize(@ptrCast(*const ISpeechAudioBufferInfo, self), BufferSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioBufferInfo_put_BufferSize(self: *const T, BufferSize: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioBufferInfo.VTable, self.vtable).put_BufferSize(@ptrCast(*const ISpeechAudioBufferInfo, self), BufferSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioBufferInfo_get_EventBias(self: *const T, EventBias: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioBufferInfo.VTable, self.vtable).get_EventBias(@ptrCast(*const ISpeechAudioBufferInfo, self), EventBias);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioBufferInfo_put_EventBias(self: *const T, EventBias: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioBufferInfo.VTable, self.vtable).put_EventBias(@ptrCast(*const ISpeechAudioBufferInfo, self), EventBias);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechAudioStatus_Value = @import("../zig.zig").Guid.initString("c62d9c91-7458-47f6-862d-1ef86fb0b278");
pub const IID_ISpeechAudioStatus = &IID_ISpeechAudioStatus_Value;
pub const ISpeechAudioStatus = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FreeBufferSpace: fn(
self: *const ISpeechAudioStatus,
FreeBufferSpace: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NonBlockingIO: fn(
self: *const ISpeechAudioStatus,
NonBlockingIO: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_State: fn(
self: *const ISpeechAudioStatus,
State: ?*SpeechAudioState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_CurrentSeekPosition: fn(
self: *const ISpeechAudioStatus,
CurrentSeekPosition: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_CurrentDevicePosition: fn(
self: *const ISpeechAudioStatus,
CurrentDevicePosition: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioStatus_get_FreeBufferSpace(self: *const T, FreeBufferSpace: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioStatus.VTable, self.vtable).get_FreeBufferSpace(@ptrCast(*const ISpeechAudioStatus, self), FreeBufferSpace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioStatus_get_NonBlockingIO(self: *const T, NonBlockingIO: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioStatus.VTable, self.vtable).get_NonBlockingIO(@ptrCast(*const ISpeechAudioStatus, self), NonBlockingIO);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioStatus_get_State(self: *const T, State: ?*SpeechAudioState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioStatus.VTable, self.vtable).get_State(@ptrCast(*const ISpeechAudioStatus, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioStatus_get_CurrentSeekPosition(self: *const T, CurrentSeekPosition: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioStatus.VTable, self.vtable).get_CurrentSeekPosition(@ptrCast(*const ISpeechAudioStatus, self), CurrentSeekPosition);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioStatus_get_CurrentDevicePosition(self: *const T, CurrentDevicePosition: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioStatus.VTable, self.vtable).get_CurrentDevicePosition(@ptrCast(*const ISpeechAudioStatus, self), CurrentDevicePosition);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechAudioFormat_Value = @import("../zig.zig").Guid.initString("e6e9c590-3e18-40e3-8299-061f98bde7c7");
pub const IID_ISpeechAudioFormat = &IID_ISpeechAudioFormat_Value;
pub const ISpeechAudioFormat = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Type: fn(
self: *const ISpeechAudioFormat,
AudioFormat: ?*SpeechAudioFormatType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Type: fn(
self: *const ISpeechAudioFormat,
AudioFormat: SpeechAudioFormatType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Guid: fn(
self: *const ISpeechAudioFormat,
Guid: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Guid: fn(
self: *const ISpeechAudioFormat,
Guid: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetWaveFormatEx: fn(
self: *const ISpeechAudioFormat,
SpeechWaveFormatEx: ?*?*ISpeechWaveFormatEx,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetWaveFormatEx: fn(
self: *const ISpeechAudioFormat,
SpeechWaveFormatEx: ?*ISpeechWaveFormatEx,
) 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 ISpeechAudioFormat_get_Type(self: *const T, AudioFormat: ?*SpeechAudioFormatType) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioFormat.VTable, self.vtable).get_Type(@ptrCast(*const ISpeechAudioFormat, self), AudioFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioFormat_put_Type(self: *const T, AudioFormat: SpeechAudioFormatType) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioFormat.VTable, self.vtable).put_Type(@ptrCast(*const ISpeechAudioFormat, self), AudioFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioFormat_get_Guid(self: *const T, _param_Guid: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioFormat.VTable, self.vtable).get_Guid(@ptrCast(*const ISpeechAudioFormat, self), _param_Guid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioFormat_put_Guid(self: *const T, _param_Guid: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioFormat.VTable, self.vtable).put_Guid(@ptrCast(*const ISpeechAudioFormat, self), _param_Guid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioFormat_GetWaveFormatEx(self: *const T, SpeechWaveFormatEx: ?*?*ISpeechWaveFormatEx) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioFormat.VTable, self.vtable).GetWaveFormatEx(@ptrCast(*const ISpeechAudioFormat, self), SpeechWaveFormatEx);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudioFormat_SetWaveFormatEx(self: *const T, SpeechWaveFormatEx: ?*ISpeechWaveFormatEx) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudioFormat.VTable, self.vtable).SetWaveFormatEx(@ptrCast(*const ISpeechAudioFormat, self), SpeechWaveFormatEx);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechWaveFormatEx_Value = @import("../zig.zig").Guid.initString("7a1ef0d5-1581-4741-88e4-209a49f11a10");
pub const IID_ISpeechWaveFormatEx = &IID_ISpeechWaveFormatEx_Value;
pub const ISpeechWaveFormatEx = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FormatTag: fn(
self: *const ISpeechWaveFormatEx,
FormatTag: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_FormatTag: fn(
self: *const ISpeechWaveFormatEx,
FormatTag: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Channels: fn(
self: *const ISpeechWaveFormatEx,
Channels: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Channels: fn(
self: *const ISpeechWaveFormatEx,
Channels: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_SamplesPerSec: fn(
self: *const ISpeechWaveFormatEx,
SamplesPerSec: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_SamplesPerSec: fn(
self: *const ISpeechWaveFormatEx,
SamplesPerSec: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AvgBytesPerSec: fn(
self: *const ISpeechWaveFormatEx,
AvgBytesPerSec: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_AvgBytesPerSec: fn(
self: *const ISpeechWaveFormatEx,
AvgBytesPerSec: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_BlockAlign: fn(
self: *const ISpeechWaveFormatEx,
BlockAlign: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_BlockAlign: fn(
self: *const ISpeechWaveFormatEx,
BlockAlign: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_BitsPerSample: fn(
self: *const ISpeechWaveFormatEx,
BitsPerSample: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_BitsPerSample: fn(
self: *const ISpeechWaveFormatEx,
BitsPerSample: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ExtraData: fn(
self: *const ISpeechWaveFormatEx,
ExtraData: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_ExtraData: fn(
self: *const ISpeechWaveFormatEx,
ExtraData: VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_get_FormatTag(self: *const T, FormatTag: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).get_FormatTag(@ptrCast(*const ISpeechWaveFormatEx, self), FormatTag);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_put_FormatTag(self: *const T, FormatTag: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).put_FormatTag(@ptrCast(*const ISpeechWaveFormatEx, self), FormatTag);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_get_Channels(self: *const T, Channels: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).get_Channels(@ptrCast(*const ISpeechWaveFormatEx, self), Channels);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_put_Channels(self: *const T, Channels: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).put_Channels(@ptrCast(*const ISpeechWaveFormatEx, self), Channels);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_get_SamplesPerSec(self: *const T, SamplesPerSec: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).get_SamplesPerSec(@ptrCast(*const ISpeechWaveFormatEx, self), SamplesPerSec);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_put_SamplesPerSec(self: *const T, SamplesPerSec: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).put_SamplesPerSec(@ptrCast(*const ISpeechWaveFormatEx, self), SamplesPerSec);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_get_AvgBytesPerSec(self: *const T, AvgBytesPerSec: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).get_AvgBytesPerSec(@ptrCast(*const ISpeechWaveFormatEx, self), AvgBytesPerSec);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_put_AvgBytesPerSec(self: *const T, AvgBytesPerSec: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).put_AvgBytesPerSec(@ptrCast(*const ISpeechWaveFormatEx, self), AvgBytesPerSec);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_get_BlockAlign(self: *const T, BlockAlign: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).get_BlockAlign(@ptrCast(*const ISpeechWaveFormatEx, self), BlockAlign);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_put_BlockAlign(self: *const T, BlockAlign: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).put_BlockAlign(@ptrCast(*const ISpeechWaveFormatEx, self), BlockAlign);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_get_BitsPerSample(self: *const T, BitsPerSample: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).get_BitsPerSample(@ptrCast(*const ISpeechWaveFormatEx, self), BitsPerSample);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_put_BitsPerSample(self: *const T, BitsPerSample: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).put_BitsPerSample(@ptrCast(*const ISpeechWaveFormatEx, self), BitsPerSample);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_get_ExtraData(self: *const T, ExtraData: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).get_ExtraData(@ptrCast(*const ISpeechWaveFormatEx, self), ExtraData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechWaveFormatEx_put_ExtraData(self: *const T, ExtraData: VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechWaveFormatEx.VTable, self.vtable).put_ExtraData(@ptrCast(*const ISpeechWaveFormatEx, self), ExtraData);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechBaseStream_Value = @import("../zig.zig").Guid.initString("6450336f-7d49-4ced-8097-49d6dee37294");
pub const IID_ISpeechBaseStream = &IID_ISpeechBaseStream_Value;
pub const ISpeechBaseStream = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Format: fn(
self: *const ISpeechBaseStream,
AudioFormat: ?*?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_Format: fn(
self: *const ISpeechBaseStream,
AudioFormat: ?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Read: fn(
self: *const ISpeechBaseStream,
Buffer: ?*VARIANT,
NumberOfBytes: i32,
BytesRead: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Write: fn(
self: *const ISpeechBaseStream,
Buffer: VARIANT,
BytesWritten: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Seek: fn(
self: *const ISpeechBaseStream,
Position: VARIANT,
Origin: SpeechStreamSeekPositionType,
NewPosition: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechBaseStream_get_Format(self: *const T, AudioFormat: ?*?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechBaseStream.VTable, self.vtable).get_Format(@ptrCast(*const ISpeechBaseStream, self), AudioFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechBaseStream_putref_Format(self: *const T, AudioFormat: ?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechBaseStream.VTable, self.vtable).putref_Format(@ptrCast(*const ISpeechBaseStream, self), AudioFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechBaseStream_Read(self: *const T, Buffer: ?*VARIANT, NumberOfBytes: i32, BytesRead: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechBaseStream.VTable, self.vtable).Read(@ptrCast(*const ISpeechBaseStream, self), Buffer, NumberOfBytes, BytesRead);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechBaseStream_Write(self: *const T, Buffer: VARIANT, BytesWritten: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechBaseStream.VTable, self.vtable).Write(@ptrCast(*const ISpeechBaseStream, self), Buffer, BytesWritten);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechBaseStream_Seek(self: *const T, Position: VARIANT, Origin: SpeechStreamSeekPositionType, NewPosition: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechBaseStream.VTable, self.vtable).Seek(@ptrCast(*const ISpeechBaseStream, self), Position, Origin, NewPosition);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechFileStream_Value = @import("../zig.zig").Guid.initString("af67f125-ab39-4e93-b4a2-cc2e66e182a7");
pub const IID_ISpeechFileStream = &IID_ISpeechFileStream_Value;
pub const ISpeechFileStream = extern struct {
pub const VTable = extern struct {
base: ISpeechBaseStream.VTable,
Open: fn(
self: *const ISpeechFileStream,
FileName: ?BSTR,
FileMode: SpeechStreamFileMode,
DoEvents: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Close: fn(
self: *const ISpeechFileStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpeechBaseStream.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechFileStream_Open(self: *const T, FileName: ?BSTR, FileMode: SpeechStreamFileMode, DoEvents: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechFileStream.VTable, self.vtable).Open(@ptrCast(*const ISpeechFileStream, self), FileName, FileMode, DoEvents);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechFileStream_Close(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechFileStream.VTable, self.vtable).Close(@ptrCast(*const ISpeechFileStream, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechMemoryStream_Value = @import("../zig.zig").Guid.initString("eeb14b68-808b-4abe-a5ea-b51da7588008");
pub const IID_ISpeechMemoryStream = &IID_ISpeechMemoryStream_Value;
pub const ISpeechMemoryStream = extern struct {
pub const VTable = extern struct {
base: ISpeechBaseStream.VTable,
SetData: fn(
self: *const ISpeechMemoryStream,
Data: VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetData: fn(
self: *const ISpeechMemoryStream,
pData: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpeechBaseStream.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechMemoryStream_SetData(self: *const T, Data: VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechMemoryStream.VTable, self.vtable).SetData(@ptrCast(*const ISpeechMemoryStream, self), Data);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechMemoryStream_GetData(self: *const T, pData: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechMemoryStream.VTable, self.vtable).GetData(@ptrCast(*const ISpeechMemoryStream, self), pData);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechCustomStream_Value = @import("../zig.zig").Guid.initString("1a9e9f4f-104f-4db8-a115-efd7fd0c97ae");
pub const IID_ISpeechCustomStream = &IID_ISpeechCustomStream_Value;
pub const ISpeechCustomStream = extern struct {
pub const VTable = extern struct {
base: ISpeechBaseStream.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_BaseStream: fn(
self: *const ISpeechCustomStream,
ppUnkStream: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_BaseStream: fn(
self: *const ISpeechCustomStream,
pUnkStream: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpeechBaseStream.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechCustomStream_get_BaseStream(self: *const T, ppUnkStream: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechCustomStream.VTable, self.vtable).get_BaseStream(@ptrCast(*const ISpeechCustomStream, self), ppUnkStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechCustomStream_putref_BaseStream(self: *const T, pUnkStream: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechCustomStream.VTable, self.vtable).putref_BaseStream(@ptrCast(*const ISpeechCustomStream, self), pUnkStream);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechAudio_Value = @import("../zig.zig").Guid.initString("cff8e175-019e-11d3-a08e-00c04f8ef9b5");
pub const IID_ISpeechAudio = &IID_ISpeechAudio_Value;
pub const ISpeechAudio = extern struct {
pub const VTable = extern struct {
base: ISpeechBaseStream.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Status: fn(
self: *const ISpeechAudio,
Status: ?*?*ISpeechAudioStatus,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_BufferInfo: fn(
self: *const ISpeechAudio,
BufferInfo: ?*?*ISpeechAudioBufferInfo,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_DefaultFormat: fn(
self: *const ISpeechAudio,
StreamFormat: ?*?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Volume: fn(
self: *const ISpeechAudio,
Volume: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Volume: fn(
self: *const ISpeechAudio,
Volume: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_BufferNotifySize: fn(
self: *const ISpeechAudio,
BufferNotifySize: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_BufferNotifySize: fn(
self: *const ISpeechAudio,
BufferNotifySize: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EventHandle: fn(
self: *const ISpeechAudio,
EventHandle: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetState: fn(
self: *const ISpeechAudio,
State: SpeechAudioState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpeechBaseStream.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudio_get_Status(self: *const T, Status: ?*?*ISpeechAudioStatus) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudio.VTable, self.vtable).get_Status(@ptrCast(*const ISpeechAudio, self), Status);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudio_get_BufferInfo(self: *const T, BufferInfo: ?*?*ISpeechAudioBufferInfo) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudio.VTable, self.vtable).get_BufferInfo(@ptrCast(*const ISpeechAudio, self), BufferInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudio_get_DefaultFormat(self: *const T, StreamFormat: ?*?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudio.VTable, self.vtable).get_DefaultFormat(@ptrCast(*const ISpeechAudio, self), StreamFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudio_get_Volume(self: *const T, Volume: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudio.VTable, self.vtable).get_Volume(@ptrCast(*const ISpeechAudio, self), Volume);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudio_put_Volume(self: *const T, Volume: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudio.VTable, self.vtable).put_Volume(@ptrCast(*const ISpeechAudio, self), Volume);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudio_get_BufferNotifySize(self: *const T, BufferNotifySize: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudio.VTable, self.vtable).get_BufferNotifySize(@ptrCast(*const ISpeechAudio, self), BufferNotifySize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudio_put_BufferNotifySize(self: *const T, BufferNotifySize: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudio.VTable, self.vtable).put_BufferNotifySize(@ptrCast(*const ISpeechAudio, self), BufferNotifySize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudio_get_EventHandle(self: *const T, EventHandle: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudio.VTable, self.vtable).get_EventHandle(@ptrCast(*const ISpeechAudio, self), EventHandle);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechAudio_SetState(self: *const T, State: SpeechAudioState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechAudio.VTable, self.vtable).SetState(@ptrCast(*const ISpeechAudio, self), State);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechMMSysAudio_Value = @import("../zig.zig").Guid.initString("3c76af6d-1fd7-4831-81d1-3b71d5a13c44");
pub const IID_ISpeechMMSysAudio = &IID_ISpeechMMSysAudio_Value;
pub const ISpeechMMSysAudio = extern struct {
pub const VTable = extern struct {
base: ISpeechAudio.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_DeviceId: fn(
self: *const ISpeechMMSysAudio,
DeviceId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_DeviceId: fn(
self: *const ISpeechMMSysAudio,
DeviceId: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LineId: fn(
self: *const ISpeechMMSysAudio,
LineId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_LineId: fn(
self: *const ISpeechMMSysAudio,
LineId: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_MMHandle: fn(
self: *const ISpeechMMSysAudio,
Handle: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpeechAudio.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechMMSysAudio_get_DeviceId(self: *const T, DeviceId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechMMSysAudio.VTable, self.vtable).get_DeviceId(@ptrCast(*const ISpeechMMSysAudio, self), DeviceId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechMMSysAudio_put_DeviceId(self: *const T, DeviceId: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechMMSysAudio.VTable, self.vtable).put_DeviceId(@ptrCast(*const ISpeechMMSysAudio, self), DeviceId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechMMSysAudio_get_LineId(self: *const T, LineId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechMMSysAudio.VTable, self.vtable).get_LineId(@ptrCast(*const ISpeechMMSysAudio, self), LineId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechMMSysAudio_put_LineId(self: *const T, LineId: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechMMSysAudio.VTable, self.vtable).put_LineId(@ptrCast(*const ISpeechMMSysAudio, self), LineId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechMMSysAudio_get_MMHandle(self: *const T, Handle: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechMMSysAudio.VTable, self.vtable).get_MMHandle(@ptrCast(*const ISpeechMMSysAudio, self), Handle);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechVoice_Value = @import("../zig.zig").Guid.initString("269316d8-57bd-11d2-9eee-00c04f797396");
pub const IID_ISpeechVoice = &IID_ISpeechVoice_Value;
pub const ISpeechVoice = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Status: fn(
self: *const ISpeechVoice,
Status: ?*?*ISpeechVoiceStatus,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Voice: fn(
self: *const ISpeechVoice,
Voice: ?*?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_Voice: fn(
self: *const ISpeechVoice,
Voice: ?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioOutput: fn(
self: *const ISpeechVoice,
AudioOutput: ?*?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_AudioOutput: fn(
self: *const ISpeechVoice,
AudioOutput: ?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioOutputStream: fn(
self: *const ISpeechVoice,
AudioOutputStream: ?*?*ISpeechBaseStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_AudioOutputStream: fn(
self: *const ISpeechVoice,
AudioOutputStream: ?*ISpeechBaseStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Rate: fn(
self: *const ISpeechVoice,
Rate: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Rate: fn(
self: *const ISpeechVoice,
Rate: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Volume: fn(
self: *const ISpeechVoice,
Volume: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Volume: fn(
self: *const ISpeechVoice,
Volume: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_AllowAudioOutputFormatChangesOnNextSet: fn(
self: *const ISpeechVoice,
Allow: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AllowAudioOutputFormatChangesOnNextSet: fn(
self: *const ISpeechVoice,
Allow: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EventInterests: fn(
self: *const ISpeechVoice,
EventInterestFlags: ?*SpeechVoiceEvents,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_EventInterests: fn(
self: *const ISpeechVoice,
EventInterestFlags: SpeechVoiceEvents,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Priority: fn(
self: *const ISpeechVoice,
Priority: SpeechVoicePriority,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Priority: fn(
self: *const ISpeechVoice,
Priority: ?*SpeechVoicePriority,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_AlertBoundary: fn(
self: *const ISpeechVoice,
Boundary: SpeechVoiceEvents,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AlertBoundary: fn(
self: *const ISpeechVoice,
Boundary: ?*SpeechVoiceEvents,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_SynchronousSpeakTimeout: fn(
self: *const ISpeechVoice,
msTimeout: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_SynchronousSpeakTimeout: fn(
self: *const ISpeechVoice,
msTimeout: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Speak: fn(
self: *const ISpeechVoice,
Text: ?BSTR,
Flags: SpeechVoiceSpeakFlags,
StreamNumber: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SpeakStream: fn(
self: *const ISpeechVoice,
Stream: ?*ISpeechBaseStream,
Flags: SpeechVoiceSpeakFlags,
StreamNumber: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Pause: fn(
self: *const ISpeechVoice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Resume: fn(
self: *const ISpeechVoice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const ISpeechVoice,
Type: ?BSTR,
NumItems: i32,
NumSkipped: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVoices: fn(
self: *const ISpeechVoice,
RequiredAttributes: ?BSTR,
OptionalAttributes: ?BSTR,
ObjectTokens: ?*?*ISpeechObjectTokens,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAudioOutputs: fn(
self: *const ISpeechVoice,
RequiredAttributes: ?BSTR,
OptionalAttributes: ?BSTR,
ObjectTokens: ?*?*ISpeechObjectTokens,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WaitUntilDone: fn(
self: *const ISpeechVoice,
msTimeout: i32,
Done: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SpeakCompleteEvent: fn(
self: *const ISpeechVoice,
Handle: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsUISupported: fn(
self: *const ISpeechVoice,
TypeOfUI: ?BSTR,
ExtraData: ?*const VARIANT,
Supported: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisplayUI: fn(
self: *const ISpeechVoice,
hWndParent: i32,
Title: ?BSTR,
TypeOfUI: ?BSTR,
ExtraData: ?*const VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_Status(self: *const T, Status: ?*?*ISpeechVoiceStatus) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_Status(@ptrCast(*const ISpeechVoice, self), Status);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_Voice(self: *const T, Voice: ?*?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_Voice(@ptrCast(*const ISpeechVoice, self), Voice);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_putref_Voice(self: *const T, Voice: ?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).putref_Voice(@ptrCast(*const ISpeechVoice, self), Voice);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_AudioOutput(self: *const T, AudioOutput: ?*?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_AudioOutput(@ptrCast(*const ISpeechVoice, self), AudioOutput);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_putref_AudioOutput(self: *const T, AudioOutput: ?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).putref_AudioOutput(@ptrCast(*const ISpeechVoice, self), AudioOutput);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_AudioOutputStream(self: *const T, AudioOutputStream: ?*?*ISpeechBaseStream) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_AudioOutputStream(@ptrCast(*const ISpeechVoice, self), AudioOutputStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_putref_AudioOutputStream(self: *const T, AudioOutputStream: ?*ISpeechBaseStream) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).putref_AudioOutputStream(@ptrCast(*const ISpeechVoice, self), AudioOutputStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_Rate(self: *const T, Rate: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_Rate(@ptrCast(*const ISpeechVoice, self), Rate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_put_Rate(self: *const T, Rate: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).put_Rate(@ptrCast(*const ISpeechVoice, self), Rate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_Volume(self: *const T, Volume: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_Volume(@ptrCast(*const ISpeechVoice, self), Volume);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_put_Volume(self: *const T, Volume: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).put_Volume(@ptrCast(*const ISpeechVoice, self), Volume);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_put_AllowAudioOutputFormatChangesOnNextSet(self: *const T, Allow: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).put_AllowAudioOutputFormatChangesOnNextSet(@ptrCast(*const ISpeechVoice, self), Allow);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_AllowAudioOutputFormatChangesOnNextSet(self: *const T, Allow: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_AllowAudioOutputFormatChangesOnNextSet(@ptrCast(*const ISpeechVoice, self), Allow);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_EventInterests(self: *const T, EventInterestFlags: ?*SpeechVoiceEvents) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_EventInterests(@ptrCast(*const ISpeechVoice, self), EventInterestFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_put_EventInterests(self: *const T, EventInterestFlags: SpeechVoiceEvents) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).put_EventInterests(@ptrCast(*const ISpeechVoice, self), EventInterestFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_put_Priority(self: *const T, Priority: SpeechVoicePriority) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).put_Priority(@ptrCast(*const ISpeechVoice, self), Priority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_Priority(self: *const T, Priority: ?*SpeechVoicePriority) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_Priority(@ptrCast(*const ISpeechVoice, self), Priority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_put_AlertBoundary(self: *const T, Boundary: SpeechVoiceEvents) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).put_AlertBoundary(@ptrCast(*const ISpeechVoice, self), Boundary);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_AlertBoundary(self: *const T, Boundary: ?*SpeechVoiceEvents) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_AlertBoundary(@ptrCast(*const ISpeechVoice, self), Boundary);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_put_SynchronousSpeakTimeout(self: *const T, msTimeout: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).put_SynchronousSpeakTimeout(@ptrCast(*const ISpeechVoice, self), msTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_get_SynchronousSpeakTimeout(self: *const T, msTimeout: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).get_SynchronousSpeakTimeout(@ptrCast(*const ISpeechVoice, self), msTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_Speak(self: *const T, Text: ?BSTR, Flags: SpeechVoiceSpeakFlags, StreamNumber: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).Speak(@ptrCast(*const ISpeechVoice, self), Text, Flags, StreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_SpeakStream(self: *const T, Stream: ?*ISpeechBaseStream, Flags: SpeechVoiceSpeakFlags, StreamNumber: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).SpeakStream(@ptrCast(*const ISpeechVoice, self), Stream, Flags, StreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_Pause(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).Pause(@ptrCast(*const ISpeechVoice, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_Resume(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).Resume(@ptrCast(*const ISpeechVoice, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_Skip(self: *const T, Type: ?BSTR, NumItems: i32, NumSkipped: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).Skip(@ptrCast(*const ISpeechVoice, self), Type, NumItems, NumSkipped);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_GetVoices(self: *const T, RequiredAttributes: ?BSTR, OptionalAttributes: ?BSTR, ObjectTokens: ?*?*ISpeechObjectTokens) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).GetVoices(@ptrCast(*const ISpeechVoice, self), RequiredAttributes, OptionalAttributes, ObjectTokens);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_GetAudioOutputs(self: *const T, RequiredAttributes: ?BSTR, OptionalAttributes: ?BSTR, ObjectTokens: ?*?*ISpeechObjectTokens) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).GetAudioOutputs(@ptrCast(*const ISpeechVoice, self), RequiredAttributes, OptionalAttributes, ObjectTokens);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_WaitUntilDone(self: *const T, msTimeout: i32, Done: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).WaitUntilDone(@ptrCast(*const ISpeechVoice, self), msTimeout, Done);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_SpeakCompleteEvent(self: *const T, Handle: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).SpeakCompleteEvent(@ptrCast(*const ISpeechVoice, self), Handle);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_IsUISupported(self: *const T, TypeOfUI: ?BSTR, ExtraData: ?*const VARIANT, Supported: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).IsUISupported(@ptrCast(*const ISpeechVoice, self), TypeOfUI, ExtraData, Supported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoice_DisplayUI(self: *const T, hWndParent: i32, Title: ?BSTR, TypeOfUI: ?BSTR, ExtraData: ?*const VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoice.VTable, self.vtable).DisplayUI(@ptrCast(*const ISpeechVoice, self), hWndParent, Title, TypeOfUI, ExtraData);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechVoiceStatus_Value = @import("../zig.zig").Guid.initString("8be47b07-57f6-11d2-9eee-00c04f797396");
pub const IID_ISpeechVoiceStatus = &IID_ISpeechVoiceStatus_Value;
pub const ISpeechVoiceStatus = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_CurrentStreamNumber: fn(
self: *const ISpeechVoiceStatus,
StreamNumber: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LastStreamNumberQueued: fn(
self: *const ISpeechVoiceStatus,
StreamNumber: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LastHResult: fn(
self: *const ISpeechVoiceStatus,
HResult: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RunningState: fn(
self: *const ISpeechVoiceStatus,
State: ?*SpeechRunState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_InputWordPosition: fn(
self: *const ISpeechVoiceStatus,
Position: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_InputWordLength: fn(
self: *const ISpeechVoiceStatus,
Length: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_InputSentencePosition: fn(
self: *const ISpeechVoiceStatus,
Position: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_InputSentenceLength: fn(
self: *const ISpeechVoiceStatus,
Length: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LastBookmark: fn(
self: *const ISpeechVoiceStatus,
Bookmark: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LastBookmarkId: fn(
self: *const ISpeechVoiceStatus,
BookmarkId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PhonemeId: fn(
self: *const ISpeechVoiceStatus,
PhoneId: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_VisemeId: fn(
self: *const ISpeechVoiceStatus,
VisemeId: ?*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 ISpeechVoiceStatus_get_CurrentStreamNumber(self: *const T, StreamNumber: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_CurrentStreamNumber(@ptrCast(*const ISpeechVoiceStatus, self), StreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_LastStreamNumberQueued(self: *const T, StreamNumber: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_LastStreamNumberQueued(@ptrCast(*const ISpeechVoiceStatus, self), StreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_LastHResult(self: *const T, HResult: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_LastHResult(@ptrCast(*const ISpeechVoiceStatus, self), HResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_RunningState(self: *const T, State: ?*SpeechRunState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_RunningState(@ptrCast(*const ISpeechVoiceStatus, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_InputWordPosition(self: *const T, Position: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_InputWordPosition(@ptrCast(*const ISpeechVoiceStatus, self), Position);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_InputWordLength(self: *const T, Length: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_InputWordLength(@ptrCast(*const ISpeechVoiceStatus, self), Length);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_InputSentencePosition(self: *const T, Position: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_InputSentencePosition(@ptrCast(*const ISpeechVoiceStatus, self), Position);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_InputSentenceLength(self: *const T, Length: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_InputSentenceLength(@ptrCast(*const ISpeechVoiceStatus, self), Length);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_LastBookmark(self: *const T, Bookmark: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_LastBookmark(@ptrCast(*const ISpeechVoiceStatus, self), Bookmark);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_LastBookmarkId(self: *const T, BookmarkId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_LastBookmarkId(@ptrCast(*const ISpeechVoiceStatus, self), BookmarkId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_PhonemeId(self: *const T, PhoneId: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_PhonemeId(@ptrCast(*const ISpeechVoiceStatus, self), PhoneId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechVoiceStatus_get_VisemeId(self: *const T, VisemeId: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechVoiceStatus.VTable, self.vtable).get_VisemeId(@ptrCast(*const ISpeechVoiceStatus, self), VisemeId);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID__ISpeechVoiceEvents_Value = @import("../zig.zig").Guid.initString("a372acd1-3bef-4bbd-8ffb-cb3e2b416af8");
pub const IID__ISpeechVoiceEvents = &IID__ISpeechVoiceEvents_Value;
pub const _ISpeechVoiceEvents = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechRecognizer_Value = @import("../zig.zig").Guid.initString("2d5f1c0c-bd75-4b08-9478-3b11fea2586c");
pub const IID_ISpeechRecognizer = &IID_ISpeechRecognizer_Value;
pub const ISpeechRecognizer = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
putref_Recognizer: fn(
self: *const ISpeechRecognizer,
Recognizer: ?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Recognizer: fn(
self: *const ISpeechRecognizer,
Recognizer: ?*?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_AllowAudioInputFormatChangesOnNextSet: fn(
self: *const ISpeechRecognizer,
Allow: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AllowAudioInputFormatChangesOnNextSet: fn(
self: *const ISpeechRecognizer,
Allow: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_AudioInput: fn(
self: *const ISpeechRecognizer,
AudioInput: ?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioInput: fn(
self: *const ISpeechRecognizer,
AudioInput: ?*?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_AudioInputStream: fn(
self: *const ISpeechRecognizer,
AudioInputStream: ?*ISpeechBaseStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioInputStream: fn(
self: *const ISpeechRecognizer,
AudioInputStream: ?*?*ISpeechBaseStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_IsShared: fn(
self: *const ISpeechRecognizer,
Shared: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_State: fn(
self: *const ISpeechRecognizer,
State: SpeechRecognizerState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_State: fn(
self: *const ISpeechRecognizer,
State: ?*SpeechRecognizerState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Status: fn(
self: *const ISpeechRecognizer,
Status: ?*?*ISpeechRecognizerStatus,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_Profile: fn(
self: *const ISpeechRecognizer,
Profile: ?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Profile: fn(
self: *const ISpeechRecognizer,
Profile: ?*?*ISpeechObjectToken,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EmulateRecognition: fn(
self: *const ISpeechRecognizer,
TextElements: VARIANT,
ElementDisplayAttributes: ?*VARIANT,
LanguageId: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRecoContext: fn(
self: *const ISpeechRecognizer,
NewContext: ?*?*ISpeechRecoContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFormat: fn(
self: *const ISpeechRecognizer,
Type: SpeechFormatType,
Format: ?*?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPropertyNumber: fn(
self: *const ISpeechRecognizer,
Name: ?BSTR,
Value: i32,
Supported: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyNumber: fn(
self: *const ISpeechRecognizer,
Name: ?BSTR,
Value: ?*i32,
Supported: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPropertyString: fn(
self: *const ISpeechRecognizer,
Name: ?BSTR,
Value: ?BSTR,
Supported: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyString: fn(
self: *const ISpeechRecognizer,
Name: ?BSTR,
Value: ?*?BSTR,
Supported: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsUISupported: fn(
self: *const ISpeechRecognizer,
TypeOfUI: ?BSTR,
ExtraData: ?*const VARIANT,
Supported: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisplayUI: fn(
self: *const ISpeechRecognizer,
hWndParent: i32,
Title: ?BSTR,
TypeOfUI: ?BSTR,
ExtraData: ?*const VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRecognizers: fn(
self: *const ISpeechRecognizer,
RequiredAttributes: ?BSTR,
OptionalAttributes: ?BSTR,
ObjectTokens: ?*?*ISpeechObjectTokens,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAudioInputs: fn(
self: *const ISpeechRecognizer,
RequiredAttributes: ?BSTR,
OptionalAttributes: ?BSTR,
ObjectTokens: ?*?*ISpeechObjectTokens,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetProfiles: fn(
self: *const ISpeechRecognizer,
RequiredAttributes: ?BSTR,
OptionalAttributes: ?BSTR,
ObjectTokens: ?*?*ISpeechObjectTokens,
) 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 ISpeechRecognizer_putref_Recognizer(self: *const T, Recognizer: ?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).putref_Recognizer(@ptrCast(*const ISpeechRecognizer, self), Recognizer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_get_Recognizer(self: *const T, Recognizer: ?*?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).get_Recognizer(@ptrCast(*const ISpeechRecognizer, self), Recognizer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_put_AllowAudioInputFormatChangesOnNextSet(self: *const T, Allow: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).put_AllowAudioInputFormatChangesOnNextSet(@ptrCast(*const ISpeechRecognizer, self), Allow);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_get_AllowAudioInputFormatChangesOnNextSet(self: *const T, Allow: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).get_AllowAudioInputFormatChangesOnNextSet(@ptrCast(*const ISpeechRecognizer, self), Allow);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_putref_AudioInput(self: *const T, AudioInput: ?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).putref_AudioInput(@ptrCast(*const ISpeechRecognizer, self), AudioInput);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_get_AudioInput(self: *const T, AudioInput: ?*?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).get_AudioInput(@ptrCast(*const ISpeechRecognizer, self), AudioInput);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_putref_AudioInputStream(self: *const T, AudioInputStream: ?*ISpeechBaseStream) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).putref_AudioInputStream(@ptrCast(*const ISpeechRecognizer, self), AudioInputStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_get_AudioInputStream(self: *const T, AudioInputStream: ?*?*ISpeechBaseStream) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).get_AudioInputStream(@ptrCast(*const ISpeechRecognizer, self), AudioInputStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_get_IsShared(self: *const T, Shared: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).get_IsShared(@ptrCast(*const ISpeechRecognizer, self), Shared);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_put_State(self: *const T, State: SpeechRecognizerState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).put_State(@ptrCast(*const ISpeechRecognizer, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_get_State(self: *const T, State: ?*SpeechRecognizerState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).get_State(@ptrCast(*const ISpeechRecognizer, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_get_Status(self: *const T, Status: ?*?*ISpeechRecognizerStatus) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).get_Status(@ptrCast(*const ISpeechRecognizer, self), Status);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_putref_Profile(self: *const T, Profile: ?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).putref_Profile(@ptrCast(*const ISpeechRecognizer, self), Profile);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_get_Profile(self: *const T, Profile: ?*?*ISpeechObjectToken) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).get_Profile(@ptrCast(*const ISpeechRecognizer, self), Profile);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_EmulateRecognition(self: *const T, TextElements: VARIANT, ElementDisplayAttributes: ?*VARIANT, LanguageId: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).EmulateRecognition(@ptrCast(*const ISpeechRecognizer, self), TextElements, ElementDisplayAttributes, LanguageId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_CreateRecoContext(self: *const T, NewContext: ?*?*ISpeechRecoContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).CreateRecoContext(@ptrCast(*const ISpeechRecognizer, self), NewContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_GetFormat(self: *const T, Type: SpeechFormatType, Format: ?*?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).GetFormat(@ptrCast(*const ISpeechRecognizer, self), Type, Format);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_SetPropertyNumber(self: *const T, Name: ?BSTR, Value: i32, Supported: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).SetPropertyNumber(@ptrCast(*const ISpeechRecognizer, self), Name, Value, Supported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_GetPropertyNumber(self: *const T, Name: ?BSTR, Value: ?*i32, Supported: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).GetPropertyNumber(@ptrCast(*const ISpeechRecognizer, self), Name, Value, Supported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_SetPropertyString(self: *const T, Name: ?BSTR, Value: ?BSTR, Supported: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).SetPropertyString(@ptrCast(*const ISpeechRecognizer, self), Name, Value, Supported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_GetPropertyString(self: *const T, Name: ?BSTR, Value: ?*?BSTR, Supported: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).GetPropertyString(@ptrCast(*const ISpeechRecognizer, self), Name, Value, Supported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_IsUISupported(self: *const T, TypeOfUI: ?BSTR, ExtraData: ?*const VARIANT, Supported: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).IsUISupported(@ptrCast(*const ISpeechRecognizer, self), TypeOfUI, ExtraData, Supported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_DisplayUI(self: *const T, hWndParent: i32, Title: ?BSTR, TypeOfUI: ?BSTR, ExtraData: ?*const VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).DisplayUI(@ptrCast(*const ISpeechRecognizer, self), hWndParent, Title, TypeOfUI, ExtraData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_GetRecognizers(self: *const T, RequiredAttributes: ?BSTR, OptionalAttributes: ?BSTR, ObjectTokens: ?*?*ISpeechObjectTokens) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).GetRecognizers(@ptrCast(*const ISpeechRecognizer, self), RequiredAttributes, OptionalAttributes, ObjectTokens);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_GetAudioInputs(self: *const T, RequiredAttributes: ?BSTR, OptionalAttributes: ?BSTR, ObjectTokens: ?*?*ISpeechObjectTokens) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).GetAudioInputs(@ptrCast(*const ISpeechRecognizer, self), RequiredAttributes, OptionalAttributes, ObjectTokens);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizer_GetProfiles(self: *const T, RequiredAttributes: ?BSTR, OptionalAttributes: ?BSTR, ObjectTokens: ?*?*ISpeechObjectTokens) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizer.VTable, self.vtable).GetProfiles(@ptrCast(*const ISpeechRecognizer, self), RequiredAttributes, OptionalAttributes, ObjectTokens);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechRecognizerStatus_Value = @import("../zig.zig").Guid.initString("bff9e781-53ec-484e-bb8a-0e1b5551e35c");
pub const IID_ISpeechRecognizerStatus = &IID_ISpeechRecognizerStatus_Value;
pub const ISpeechRecognizerStatus = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioStatus: fn(
self: *const ISpeechRecognizerStatus,
AudioStatus: ?*?*ISpeechAudioStatus,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_CurrentStreamPosition: fn(
self: *const ISpeechRecognizerStatus,
pCurrentStreamPos: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_CurrentStreamNumber: fn(
self: *const ISpeechRecognizerStatus,
StreamNumber: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NumberOfActiveRules: fn(
self: *const ISpeechRecognizerStatus,
NumberOfActiveRules: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ClsidEngine: fn(
self: *const ISpeechRecognizerStatus,
ClsidEngine: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_SupportedLanguages: fn(
self: *const ISpeechRecognizerStatus,
SupportedLanguages: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizerStatus_get_AudioStatus(self: *const T, AudioStatus: ?*?*ISpeechAudioStatus) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizerStatus.VTable, self.vtable).get_AudioStatus(@ptrCast(*const ISpeechRecognizerStatus, self), AudioStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizerStatus_get_CurrentStreamPosition(self: *const T, pCurrentStreamPos: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizerStatus.VTable, self.vtable).get_CurrentStreamPosition(@ptrCast(*const ISpeechRecognizerStatus, self), pCurrentStreamPos);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizerStatus_get_CurrentStreamNumber(self: *const T, StreamNumber: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizerStatus.VTable, self.vtable).get_CurrentStreamNumber(@ptrCast(*const ISpeechRecognizerStatus, self), StreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizerStatus_get_NumberOfActiveRules(self: *const T, NumberOfActiveRules: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizerStatus.VTable, self.vtable).get_NumberOfActiveRules(@ptrCast(*const ISpeechRecognizerStatus, self), NumberOfActiveRules);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizerStatus_get_ClsidEngine(self: *const T, ClsidEngine: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizerStatus.VTable, self.vtable).get_ClsidEngine(@ptrCast(*const ISpeechRecognizerStatus, self), ClsidEngine);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecognizerStatus_get_SupportedLanguages(self: *const T, SupportedLanguages: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecognizerStatus.VTable, self.vtable).get_SupportedLanguages(@ptrCast(*const ISpeechRecognizerStatus, self), SupportedLanguages);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechRecoContext_Value = @import("../zig.zig").Guid.initString("580aa49d-7e1e-4809-b8e2-57da806104b8");
pub const IID_ISpeechRecoContext = &IID_ISpeechRecoContext_Value;
pub const ISpeechRecoContext = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Recognizer: fn(
self: *const ISpeechRecoContext,
Recognizer: ?*?*ISpeechRecognizer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioInputInterferenceStatus: fn(
self: *const ISpeechRecoContext,
Interference: ?*SpeechInterference,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RequestedUIType: fn(
self: *const ISpeechRecoContext,
UIType: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_Voice: fn(
self: *const ISpeechRecoContext,
Voice: ?*ISpeechVoice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Voice: fn(
self: *const ISpeechRecoContext,
Voice: ?*?*ISpeechVoice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_AllowVoiceFormatMatchingOnNextSet: fn(
self: *const ISpeechRecoContext,
Allow: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AllowVoiceFormatMatchingOnNextSet: fn(
self: *const ISpeechRecoContext,
pAllow: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_VoicePurgeEvent: fn(
self: *const ISpeechRecoContext,
EventInterest: SpeechRecoEvents,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_VoicePurgeEvent: fn(
self: *const ISpeechRecoContext,
EventInterest: ?*SpeechRecoEvents,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_EventInterests: fn(
self: *const ISpeechRecoContext,
EventInterest: SpeechRecoEvents,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EventInterests: fn(
self: *const ISpeechRecoContext,
EventInterest: ?*SpeechRecoEvents,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_CmdMaxAlternates: fn(
self: *const ISpeechRecoContext,
MaxAlternates: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_CmdMaxAlternates: fn(
self: *const ISpeechRecoContext,
MaxAlternates: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_State: fn(
self: *const ISpeechRecoContext,
State: SpeechRecoContextState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_State: fn(
self: *const ISpeechRecoContext,
State: ?*SpeechRecoContextState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_RetainedAudio: fn(
self: *const ISpeechRecoContext,
Option: SpeechRetainedAudioOptions,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RetainedAudio: fn(
self: *const ISpeechRecoContext,
Option: ?*SpeechRetainedAudioOptions,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_RetainedAudioFormat: fn(
self: *const ISpeechRecoContext,
Format: ?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RetainedAudioFormat: fn(
self: *const ISpeechRecoContext,
Format: ?*?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Pause: fn(
self: *const ISpeechRecoContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Resume: fn(
self: *const ISpeechRecoContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateGrammar: fn(
self: *const ISpeechRecoContext,
GrammarId: VARIANT,
Grammar: ?*?*ISpeechRecoGrammar,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateResultFromMemory: fn(
self: *const ISpeechRecoContext,
ResultBlock: ?*VARIANT,
Result: ?*?*ISpeechRecoResult,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Bookmark: fn(
self: *const ISpeechRecoContext,
Options: SpeechBookmarkOptions,
StreamPos: VARIANT,
BookmarkId: VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAdaptationData: fn(
self: *const ISpeechRecoContext,
AdaptationString: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_Recognizer(self: *const T, Recognizer: ?*?*ISpeechRecognizer) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_Recognizer(@ptrCast(*const ISpeechRecoContext, self), Recognizer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_AudioInputInterferenceStatus(self: *const T, Interference: ?*SpeechInterference) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_AudioInputInterferenceStatus(@ptrCast(*const ISpeechRecoContext, self), Interference);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_RequestedUIType(self: *const T, UIType: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_RequestedUIType(@ptrCast(*const ISpeechRecoContext, self), UIType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_putref_Voice(self: *const T, Voice: ?*ISpeechVoice) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).putref_Voice(@ptrCast(*const ISpeechRecoContext, self), Voice);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_Voice(self: *const T, Voice: ?*?*ISpeechVoice) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_Voice(@ptrCast(*const ISpeechRecoContext, self), Voice);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_put_AllowVoiceFormatMatchingOnNextSet(self: *const T, Allow: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).put_AllowVoiceFormatMatchingOnNextSet(@ptrCast(*const ISpeechRecoContext, self), Allow);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_AllowVoiceFormatMatchingOnNextSet(self: *const T, pAllow: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_AllowVoiceFormatMatchingOnNextSet(@ptrCast(*const ISpeechRecoContext, self), pAllow);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_put_VoicePurgeEvent(self: *const T, EventInterest: SpeechRecoEvents) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).put_VoicePurgeEvent(@ptrCast(*const ISpeechRecoContext, self), EventInterest);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_VoicePurgeEvent(self: *const T, EventInterest: ?*SpeechRecoEvents) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_VoicePurgeEvent(@ptrCast(*const ISpeechRecoContext, self), EventInterest);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_put_EventInterests(self: *const T, EventInterest: SpeechRecoEvents) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).put_EventInterests(@ptrCast(*const ISpeechRecoContext, self), EventInterest);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_EventInterests(self: *const T, EventInterest: ?*SpeechRecoEvents) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_EventInterests(@ptrCast(*const ISpeechRecoContext, self), EventInterest);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_put_CmdMaxAlternates(self: *const T, MaxAlternates: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).put_CmdMaxAlternates(@ptrCast(*const ISpeechRecoContext, self), MaxAlternates);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_CmdMaxAlternates(self: *const T, MaxAlternates: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_CmdMaxAlternates(@ptrCast(*const ISpeechRecoContext, self), MaxAlternates);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_put_State(self: *const T, State: SpeechRecoContextState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).put_State(@ptrCast(*const ISpeechRecoContext, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_State(self: *const T, State: ?*SpeechRecoContextState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_State(@ptrCast(*const ISpeechRecoContext, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_put_RetainedAudio(self: *const T, Option: SpeechRetainedAudioOptions) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).put_RetainedAudio(@ptrCast(*const ISpeechRecoContext, self), Option);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_RetainedAudio(self: *const T, Option: ?*SpeechRetainedAudioOptions) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_RetainedAudio(@ptrCast(*const ISpeechRecoContext, self), Option);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_putref_RetainedAudioFormat(self: *const T, Format: ?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).putref_RetainedAudioFormat(@ptrCast(*const ISpeechRecoContext, self), Format);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_get_RetainedAudioFormat(self: *const T, Format: ?*?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).get_RetainedAudioFormat(@ptrCast(*const ISpeechRecoContext, self), Format);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_Pause(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).Pause(@ptrCast(*const ISpeechRecoContext, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_Resume(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).Resume(@ptrCast(*const ISpeechRecoContext, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_CreateGrammar(self: *const T, GrammarId: VARIANT, Grammar: ?*?*ISpeechRecoGrammar) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).CreateGrammar(@ptrCast(*const ISpeechRecoContext, self), GrammarId, Grammar);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_CreateResultFromMemory(self: *const T, ResultBlock: ?*VARIANT, Result: ?*?*ISpeechRecoResult) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).CreateResultFromMemory(@ptrCast(*const ISpeechRecoContext, self), ResultBlock, Result);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_Bookmark(self: *const T, Options: SpeechBookmarkOptions, StreamPos: VARIANT, BookmarkId: VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).Bookmark(@ptrCast(*const ISpeechRecoContext, self), Options, StreamPos, BookmarkId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoContext_SetAdaptationData(self: *const T, AdaptationString: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoContext.VTable, self.vtable).SetAdaptationData(@ptrCast(*const ISpeechRecoContext, self), AdaptationString);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechRecoGrammar_Value = @import("../zig.zig").Guid.initString("b6d6f79f-2158-4e50-b5bc-9a9ccd852a09");
pub const IID_ISpeechRecoGrammar = &IID_ISpeechRecoGrammar_Value;
pub const ISpeechRecoGrammar = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const ISpeechRecoGrammar,
Id: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RecoContext: fn(
self: *const ISpeechRecoGrammar,
RecoContext: ?*?*ISpeechRecoContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_State: fn(
self: *const ISpeechRecoGrammar,
State: SpeechGrammarState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_State: fn(
self: *const ISpeechRecoGrammar,
State: ?*SpeechGrammarState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Rules: fn(
self: *const ISpeechRecoGrammar,
Rules: ?*?*ISpeechGrammarRules,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const ISpeechRecoGrammar,
NewLanguage: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CmdLoadFromFile: fn(
self: *const ISpeechRecoGrammar,
FileName: ?BSTR,
LoadOption: SpeechLoadOption,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CmdLoadFromObject: fn(
self: *const ISpeechRecoGrammar,
ClassId: ?BSTR,
GrammarName: ?BSTR,
LoadOption: SpeechLoadOption,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CmdLoadFromResource: fn(
self: *const ISpeechRecoGrammar,
hModule: i32,
ResourceName: VARIANT,
ResourceType: VARIANT,
LanguageId: i32,
LoadOption: SpeechLoadOption,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CmdLoadFromMemory: fn(
self: *const ISpeechRecoGrammar,
GrammarData: VARIANT,
LoadOption: SpeechLoadOption,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CmdLoadFromProprietaryGrammar: fn(
self: *const ISpeechRecoGrammar,
ProprietaryGuid: ?BSTR,
ProprietaryString: ?BSTR,
ProprietaryData: VARIANT,
LoadOption: SpeechLoadOption,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CmdSetRuleState: fn(
self: *const ISpeechRecoGrammar,
Name: ?BSTR,
State: SpeechRuleState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CmdSetRuleIdState: fn(
self: *const ISpeechRecoGrammar,
RuleId: i32,
State: SpeechRuleState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DictationLoad: fn(
self: *const ISpeechRecoGrammar,
TopicName: ?BSTR,
LoadOption: SpeechLoadOption,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DictationUnload: fn(
self: *const ISpeechRecoGrammar,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DictationSetState: fn(
self: *const ISpeechRecoGrammar,
State: SpeechRuleState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetWordSequenceData: fn(
self: *const ISpeechRecoGrammar,
Text: ?BSTR,
TextLength: i32,
Info: ?*ISpeechTextSelectionInformation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTextSelection: fn(
self: *const ISpeechRecoGrammar,
Info: ?*ISpeechTextSelectionInformation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsPronounceable: fn(
self: *const ISpeechRecoGrammar,
Word: ?BSTR,
WordPronounceable: ?*SpeechWordPronounceable,
) 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 ISpeechRecoGrammar_get_Id(self: *const T, Id: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).get_Id(@ptrCast(*const ISpeechRecoGrammar, self), Id);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_get_RecoContext(self: *const T, RecoContext: ?*?*ISpeechRecoContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).get_RecoContext(@ptrCast(*const ISpeechRecoGrammar, self), RecoContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_put_State(self: *const T, State: SpeechGrammarState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).put_State(@ptrCast(*const ISpeechRecoGrammar, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_get_State(self: *const T, State: ?*SpeechGrammarState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).get_State(@ptrCast(*const ISpeechRecoGrammar, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_get_Rules(self: *const T, Rules: ?*?*ISpeechGrammarRules) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).get_Rules(@ptrCast(*const ISpeechRecoGrammar, self), Rules);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_Reset(self: *const T, NewLanguage: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).Reset(@ptrCast(*const ISpeechRecoGrammar, self), NewLanguage);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_CmdLoadFromFile(self: *const T, FileName: ?BSTR, LoadOption: SpeechLoadOption) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).CmdLoadFromFile(@ptrCast(*const ISpeechRecoGrammar, self), FileName, LoadOption);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_CmdLoadFromObject(self: *const T, ClassId: ?BSTR, GrammarName: ?BSTR, LoadOption: SpeechLoadOption) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).CmdLoadFromObject(@ptrCast(*const ISpeechRecoGrammar, self), ClassId, GrammarName, LoadOption);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_CmdLoadFromResource(self: *const T, hModule: i32, ResourceName: VARIANT, ResourceType: VARIANT, LanguageId: i32, LoadOption: SpeechLoadOption) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).CmdLoadFromResource(@ptrCast(*const ISpeechRecoGrammar, self), hModule, ResourceName, ResourceType, LanguageId, LoadOption);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_CmdLoadFromMemory(self: *const T, GrammarData: VARIANT, LoadOption: SpeechLoadOption) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).CmdLoadFromMemory(@ptrCast(*const ISpeechRecoGrammar, self), GrammarData, LoadOption);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_CmdLoadFromProprietaryGrammar(self: *const T, ProprietaryGuid: ?BSTR, ProprietaryString: ?BSTR, ProprietaryData: VARIANT, LoadOption: SpeechLoadOption) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).CmdLoadFromProprietaryGrammar(@ptrCast(*const ISpeechRecoGrammar, self), ProprietaryGuid, ProprietaryString, ProprietaryData, LoadOption);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_CmdSetRuleState(self: *const T, Name: ?BSTR, State: SpeechRuleState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).CmdSetRuleState(@ptrCast(*const ISpeechRecoGrammar, self), Name, State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_CmdSetRuleIdState(self: *const T, RuleId: i32, State: SpeechRuleState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).CmdSetRuleIdState(@ptrCast(*const ISpeechRecoGrammar, self), RuleId, State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_DictationLoad(self: *const T, TopicName: ?BSTR, LoadOption: SpeechLoadOption) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).DictationLoad(@ptrCast(*const ISpeechRecoGrammar, self), TopicName, LoadOption);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_DictationUnload(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).DictationUnload(@ptrCast(*const ISpeechRecoGrammar, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_DictationSetState(self: *const T, State: SpeechRuleState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).DictationSetState(@ptrCast(*const ISpeechRecoGrammar, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_SetWordSequenceData(self: *const T, Text: ?BSTR, TextLength: i32, Info: ?*ISpeechTextSelectionInformation) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).SetWordSequenceData(@ptrCast(*const ISpeechRecoGrammar, self), Text, TextLength, Info);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_SetTextSelection(self: *const T, Info: ?*ISpeechTextSelectionInformation) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).SetTextSelection(@ptrCast(*const ISpeechRecoGrammar, self), Info);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoGrammar_IsPronounceable(self: *const T, Word: ?BSTR, WordPronounceable: ?*SpeechWordPronounceable) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoGrammar.VTable, self.vtable).IsPronounceable(@ptrCast(*const ISpeechRecoGrammar, self), Word, WordPronounceable);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID__ISpeechRecoContextEvents_Value = @import("../zig.zig").Guid.initString("7b8fcb42-0e9d-4f00-a048-7b04d6179d3d");
pub const IID__ISpeechRecoContextEvents = &IID__ISpeechRecoContextEvents_Value;
pub const _ISpeechRecoContextEvents = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechGrammarRule_Value = @import("../zig.zig").Guid.initString("afe719cf-5dd1-44f2-999c-7a399f1cfccc");
pub const IID_ISpeechGrammarRule = &IID_ISpeechGrammarRule_Value;
pub const ISpeechGrammarRule = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Attributes: fn(
self: *const ISpeechGrammarRule,
Attributes: ?*SpeechRuleAttributes,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_InitialState: fn(
self: *const ISpeechGrammarRule,
State: ?*?*ISpeechGrammarRuleState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Name: fn(
self: *const ISpeechGrammarRule,
Name: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const ISpeechGrammarRule,
Id: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clear: fn(
self: *const ISpeechGrammarRule,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddResource: fn(
self: *const ISpeechGrammarRule,
ResourceName: ?BSTR,
ResourceValue: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddState: fn(
self: *const ISpeechGrammarRule,
State: ?*?*ISpeechGrammarRuleState,
) 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 ISpeechGrammarRule_get_Attributes(self: *const T, Attributes: ?*SpeechRuleAttributes) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRule.VTable, self.vtable).get_Attributes(@ptrCast(*const ISpeechGrammarRule, self), Attributes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRule_get_InitialState(self: *const T, State: ?*?*ISpeechGrammarRuleState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRule.VTable, self.vtable).get_InitialState(@ptrCast(*const ISpeechGrammarRule, self), State);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRule_get_Name(self: *const T, Name: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRule.VTable, self.vtable).get_Name(@ptrCast(*const ISpeechGrammarRule, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRule_get_Id(self: *const T, Id: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRule.VTable, self.vtable).get_Id(@ptrCast(*const ISpeechGrammarRule, self), Id);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRule_Clear(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRule.VTable, self.vtable).Clear(@ptrCast(*const ISpeechGrammarRule, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRule_AddResource(self: *const T, ResourceName: ?BSTR, ResourceValue: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRule.VTable, self.vtable).AddResource(@ptrCast(*const ISpeechGrammarRule, self), ResourceName, ResourceValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRule_AddState(self: *const T, State: ?*?*ISpeechGrammarRuleState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRule.VTable, self.vtable).AddState(@ptrCast(*const ISpeechGrammarRule, self), State);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechGrammarRules_Value = @import("../zig.zig").Guid.initString("6ffa3b44-fc2d-40d1-8afc-32911c7f1ad1");
pub const IID_ISpeechGrammarRules = &IID_ISpeechGrammarRules_Value;
pub const ISpeechGrammarRules = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechGrammarRules,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
FindRule: fn(
self: *const ISpeechGrammarRules,
RuleNameOrId: VARIANT,
Rule: ?*?*ISpeechGrammarRule,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechGrammarRules,
Index: i32,
Rule: ?*?*ISpeechGrammarRule,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechGrammarRules,
EnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Dynamic: fn(
self: *const ISpeechGrammarRules,
Dynamic: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Add: fn(
self: *const ISpeechGrammarRules,
RuleName: ?BSTR,
Attributes: SpeechRuleAttributes,
RuleId: i32,
Rule: ?*?*ISpeechGrammarRule,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Commit: fn(
self: *const ISpeechGrammarRules,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CommitAndSave: fn(
self: *const ISpeechGrammarRules,
ErrorText: ?*?BSTR,
SaveStream: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRules_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRules.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechGrammarRules, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRules_FindRule(self: *const T, RuleNameOrId: VARIANT, Rule: ?*?*ISpeechGrammarRule) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRules.VTable, self.vtable).FindRule(@ptrCast(*const ISpeechGrammarRules, self), RuleNameOrId, Rule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRules_Item(self: *const T, Index: i32, Rule: ?*?*ISpeechGrammarRule) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRules.VTable, self.vtable).Item(@ptrCast(*const ISpeechGrammarRules, self), Index, Rule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRules_get__NewEnum(self: *const T, EnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRules.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechGrammarRules, self), EnumVARIANT);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRules_get_Dynamic(self: *const T, Dynamic: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRules.VTable, self.vtable).get_Dynamic(@ptrCast(*const ISpeechGrammarRules, self), Dynamic);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRules_Add(self: *const T, RuleName: ?BSTR, Attributes: SpeechRuleAttributes, RuleId: i32, Rule: ?*?*ISpeechGrammarRule) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRules.VTable, self.vtable).Add(@ptrCast(*const ISpeechGrammarRules, self), RuleName, Attributes, RuleId, Rule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRules_Commit(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRules.VTable, self.vtable).Commit(@ptrCast(*const ISpeechGrammarRules, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRules_CommitAndSave(self: *const T, ErrorText: ?*?BSTR, SaveStream: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRules.VTable, self.vtable).CommitAndSave(@ptrCast(*const ISpeechGrammarRules, self), ErrorText, SaveStream);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechGrammarRuleState_Value = @import("../zig.zig").Guid.initString("d4286f2c-ee67-45ae-b928-28d695362eda");
pub const IID_ISpeechGrammarRuleState = &IID_ISpeechGrammarRuleState_Value;
pub const ISpeechGrammarRuleState = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Rule: fn(
self: *const ISpeechGrammarRuleState,
Rule: ?*?*ISpeechGrammarRule,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Transitions: fn(
self: *const ISpeechGrammarRuleState,
Transitions: ?*?*ISpeechGrammarRuleStateTransitions,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddWordTransition: fn(
self: *const ISpeechGrammarRuleState,
DestState: ?*ISpeechGrammarRuleState,
Words: ?BSTR,
Separators: ?BSTR,
Type: SpeechGrammarWordType,
PropertyName: ?BSTR,
PropertyId: i32,
PropertyValue: ?*VARIANT,
Weight: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddRuleTransition: fn(
self: *const ISpeechGrammarRuleState,
DestinationState: ?*ISpeechGrammarRuleState,
Rule: ?*ISpeechGrammarRule,
PropertyName: ?BSTR,
PropertyId: i32,
PropertyValue: ?*VARIANT,
Weight: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddSpecialTransition: fn(
self: *const ISpeechGrammarRuleState,
DestinationState: ?*ISpeechGrammarRuleState,
Type: SpeechSpecialTransitionType,
PropertyName: ?BSTR,
PropertyId: i32,
PropertyValue: ?*VARIANT,
Weight: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleState_get_Rule(self: *const T, Rule: ?*?*ISpeechGrammarRule) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleState.VTable, self.vtable).get_Rule(@ptrCast(*const ISpeechGrammarRuleState, self), Rule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleState_get_Transitions(self: *const T, Transitions: ?*?*ISpeechGrammarRuleStateTransitions) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleState.VTable, self.vtable).get_Transitions(@ptrCast(*const ISpeechGrammarRuleState, self), Transitions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleState_AddWordTransition(self: *const T, DestState: ?*ISpeechGrammarRuleState, Words: ?BSTR, Separators: ?BSTR, Type: SpeechGrammarWordType, PropertyName: ?BSTR, PropertyId: i32, PropertyValue: ?*VARIANT, Weight: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleState.VTable, self.vtable).AddWordTransition(@ptrCast(*const ISpeechGrammarRuleState, self), DestState, Words, Separators, Type, PropertyName, PropertyId, PropertyValue, Weight);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleState_AddRuleTransition(self: *const T, DestinationState: ?*ISpeechGrammarRuleState, Rule: ?*ISpeechGrammarRule, PropertyName: ?BSTR, PropertyId: i32, PropertyValue: ?*VARIANT, Weight: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleState.VTable, self.vtable).AddRuleTransition(@ptrCast(*const ISpeechGrammarRuleState, self), DestinationState, Rule, PropertyName, PropertyId, PropertyValue, Weight);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleState_AddSpecialTransition(self: *const T, DestinationState: ?*ISpeechGrammarRuleState, Type: SpeechSpecialTransitionType, PropertyName: ?BSTR, PropertyId: i32, PropertyValue: ?*VARIANT, Weight: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleState.VTable, self.vtable).AddSpecialTransition(@ptrCast(*const ISpeechGrammarRuleState, self), DestinationState, Type, PropertyName, PropertyId, PropertyValue, Weight);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechGrammarRuleStateTransition_Value = @import("../zig.zig").Guid.initString("cafd1db1-41d1-4a06-9863-e2e81da17a9a");
pub const IID_ISpeechGrammarRuleStateTransition = &IID_ISpeechGrammarRuleStateTransition_Value;
pub const ISpeechGrammarRuleStateTransition = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Type: fn(
self: *const ISpeechGrammarRuleStateTransition,
Type: ?*SpeechGrammarRuleStateTransitionType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Text: fn(
self: *const ISpeechGrammarRuleStateTransition,
Text: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Rule: fn(
self: *const ISpeechGrammarRuleStateTransition,
Rule: ?*?*ISpeechGrammarRule,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Weight: fn(
self: *const ISpeechGrammarRuleStateTransition,
Weight: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PropertyName: fn(
self: *const ISpeechGrammarRuleStateTransition,
PropertyName: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PropertyId: fn(
self: *const ISpeechGrammarRuleStateTransition,
PropertyId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PropertyValue: fn(
self: *const ISpeechGrammarRuleStateTransition,
PropertyValue: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NextState: fn(
self: *const ISpeechGrammarRuleStateTransition,
NextState: ?*?*ISpeechGrammarRuleState,
) 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 ISpeechGrammarRuleStateTransition_get_Type(self: *const T, Type: ?*SpeechGrammarRuleStateTransitionType) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransition.VTable, self.vtable).get_Type(@ptrCast(*const ISpeechGrammarRuleStateTransition, self), Type);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransition_get_Text(self: *const T, Text: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransition.VTable, self.vtable).get_Text(@ptrCast(*const ISpeechGrammarRuleStateTransition, self), Text);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransition_get_Rule(self: *const T, Rule: ?*?*ISpeechGrammarRule) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransition.VTable, self.vtable).get_Rule(@ptrCast(*const ISpeechGrammarRuleStateTransition, self), Rule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransition_get_Weight(self: *const T, Weight: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransition.VTable, self.vtable).get_Weight(@ptrCast(*const ISpeechGrammarRuleStateTransition, self), Weight);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransition_get_PropertyName(self: *const T, PropertyName: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransition.VTable, self.vtable).get_PropertyName(@ptrCast(*const ISpeechGrammarRuleStateTransition, self), PropertyName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransition_get_PropertyId(self: *const T, PropertyId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransition.VTable, self.vtable).get_PropertyId(@ptrCast(*const ISpeechGrammarRuleStateTransition, self), PropertyId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransition_get_PropertyValue(self: *const T, PropertyValue: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransition.VTable, self.vtable).get_PropertyValue(@ptrCast(*const ISpeechGrammarRuleStateTransition, self), PropertyValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransition_get_NextState(self: *const T, NextState: ?*?*ISpeechGrammarRuleState) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransition.VTable, self.vtable).get_NextState(@ptrCast(*const ISpeechGrammarRuleStateTransition, self), NextState);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechGrammarRuleStateTransitions_Value = @import("../zig.zig").Guid.initString("eabce657-75bc-44a2-aa7f-c56476742963");
pub const IID_ISpeechGrammarRuleStateTransitions = &IID_ISpeechGrammarRuleStateTransitions_Value;
pub const ISpeechGrammarRuleStateTransitions = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechGrammarRuleStateTransitions,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechGrammarRuleStateTransitions,
Index: i32,
Transition: ?*?*ISpeechGrammarRuleStateTransition,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechGrammarRuleStateTransitions,
EnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransitions_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransitions.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechGrammarRuleStateTransitions, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransitions_Item(self: *const T, Index: i32, Transition: ?*?*ISpeechGrammarRuleStateTransition) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransitions.VTable, self.vtable).Item(@ptrCast(*const ISpeechGrammarRuleStateTransitions, self), Index, Transition);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechGrammarRuleStateTransitions_get__NewEnum(self: *const T, EnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechGrammarRuleStateTransitions.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechGrammarRuleStateTransitions, self), EnumVARIANT);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechTextSelectionInformation_Value = @import("../zig.zig").Guid.initString("3b9c7e7a-6eee-4ded-9092-11657279adbe");
pub const IID_ISpeechTextSelectionInformation = &IID_ISpeechTextSelectionInformation_Value;
pub const ISpeechTextSelectionInformation = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_ActiveOffset: fn(
self: *const ISpeechTextSelectionInformation,
ActiveOffset: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ActiveOffset: fn(
self: *const ISpeechTextSelectionInformation,
ActiveOffset: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_ActiveLength: fn(
self: *const ISpeechTextSelectionInformation,
ActiveLength: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ActiveLength: fn(
self: *const ISpeechTextSelectionInformation,
ActiveLength: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_SelectionOffset: fn(
self: *const ISpeechTextSelectionInformation,
SelectionOffset: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_SelectionOffset: fn(
self: *const ISpeechTextSelectionInformation,
SelectionOffset: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_SelectionLength: fn(
self: *const ISpeechTextSelectionInformation,
SelectionLength: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_SelectionLength: fn(
self: *const ISpeechTextSelectionInformation,
SelectionLength: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechTextSelectionInformation_put_ActiveOffset(self: *const T, ActiveOffset: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechTextSelectionInformation.VTable, self.vtable).put_ActiveOffset(@ptrCast(*const ISpeechTextSelectionInformation, self), ActiveOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechTextSelectionInformation_get_ActiveOffset(self: *const T, ActiveOffset: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechTextSelectionInformation.VTable, self.vtable).get_ActiveOffset(@ptrCast(*const ISpeechTextSelectionInformation, self), ActiveOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechTextSelectionInformation_put_ActiveLength(self: *const T, ActiveLength: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechTextSelectionInformation.VTable, self.vtable).put_ActiveLength(@ptrCast(*const ISpeechTextSelectionInformation, self), ActiveLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechTextSelectionInformation_get_ActiveLength(self: *const T, ActiveLength: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechTextSelectionInformation.VTable, self.vtable).get_ActiveLength(@ptrCast(*const ISpeechTextSelectionInformation, self), ActiveLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechTextSelectionInformation_put_SelectionOffset(self: *const T, SelectionOffset: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechTextSelectionInformation.VTable, self.vtable).put_SelectionOffset(@ptrCast(*const ISpeechTextSelectionInformation, self), SelectionOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechTextSelectionInformation_get_SelectionOffset(self: *const T, SelectionOffset: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechTextSelectionInformation.VTable, self.vtable).get_SelectionOffset(@ptrCast(*const ISpeechTextSelectionInformation, self), SelectionOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechTextSelectionInformation_put_SelectionLength(self: *const T, SelectionLength: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechTextSelectionInformation.VTable, self.vtable).put_SelectionLength(@ptrCast(*const ISpeechTextSelectionInformation, self), SelectionLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechTextSelectionInformation_get_SelectionLength(self: *const T, SelectionLength: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechTextSelectionInformation.VTable, self.vtable).get_SelectionLength(@ptrCast(*const ISpeechTextSelectionInformation, self), SelectionLength);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechRecoResult_Value = @import("../zig.zig").Guid.initString("ed2879cf-ced9-4ee6-a534-de0191d5468d");
pub const IID_ISpeechRecoResult = &IID_ISpeechRecoResult_Value;
pub const ISpeechRecoResult = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RecoContext: fn(
self: *const ISpeechRecoResult,
RecoContext: ?*?*ISpeechRecoContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Times: fn(
self: *const ISpeechRecoResult,
Times: ?*?*ISpeechRecoResultTimes,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_AudioFormat: fn(
self: *const ISpeechRecoResult,
Format: ?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioFormat: fn(
self: *const ISpeechRecoResult,
Format: ?*?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PhraseInfo: fn(
self: *const ISpeechRecoResult,
PhraseInfo: ?*?*ISpeechPhraseInfo,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Alternates: fn(
self: *const ISpeechRecoResult,
RequestCount: i32,
StartElement: i32,
Elements: i32,
Alternates: ?*?*ISpeechPhraseAlternates,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Audio: fn(
self: *const ISpeechRecoResult,
StartElement: i32,
Elements: i32,
Stream: ?*?*ISpeechMemoryStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SpeakAudio: fn(
self: *const ISpeechRecoResult,
StartElement: i32,
Elements: i32,
Flags: SpeechVoiceSpeakFlags,
StreamNumber: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SaveToMemory: fn(
self: *const ISpeechRecoResult,
ResultBlock: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DiscardResultInfo: fn(
self: *const ISpeechRecoResult,
ValueTypes: SpeechDiscardType,
) 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 ISpeechRecoResult_get_RecoContext(self: *const T, RecoContext: ?*?*ISpeechRecoContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).get_RecoContext(@ptrCast(*const ISpeechRecoResult, self), RecoContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult_get_Times(self: *const T, Times: ?*?*ISpeechRecoResultTimes) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).get_Times(@ptrCast(*const ISpeechRecoResult, self), Times);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult_putref_AudioFormat(self: *const T, Format: ?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).putref_AudioFormat(@ptrCast(*const ISpeechRecoResult, self), Format);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult_get_AudioFormat(self: *const T, Format: ?*?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).get_AudioFormat(@ptrCast(*const ISpeechRecoResult, self), Format);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult_get_PhraseInfo(self: *const T, PhraseInfo: ?*?*ISpeechPhraseInfo) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).get_PhraseInfo(@ptrCast(*const ISpeechRecoResult, self), PhraseInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult_Alternates(self: *const T, RequestCount: i32, StartElement: i32, Elements: i32, Alternates: ?*?*ISpeechPhraseAlternates) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).Alternates(@ptrCast(*const ISpeechRecoResult, self), RequestCount, StartElement, Elements, Alternates);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult_Audio(self: *const T, StartElement: i32, Elements: i32, Stream: ?*?*ISpeechMemoryStream) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).Audio(@ptrCast(*const ISpeechRecoResult, self), StartElement, Elements, Stream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult_SpeakAudio(self: *const T, StartElement: i32, Elements: i32, Flags: SpeechVoiceSpeakFlags, StreamNumber: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).SpeakAudio(@ptrCast(*const ISpeechRecoResult, self), StartElement, Elements, Flags, StreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult_SaveToMemory(self: *const T, ResultBlock: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).SaveToMemory(@ptrCast(*const ISpeechRecoResult, self), ResultBlock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult_DiscardResultInfo(self: *const T, ValueTypes: SpeechDiscardType) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult.VTable, self.vtable).DiscardResultInfo(@ptrCast(*const ISpeechRecoResult, self), ValueTypes);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechRecoResult2_Value = @import("../zig.zig").Guid.initString("8e0a246d-d3c8-45de-8657-04290c458c3c");
pub const IID_ISpeechRecoResult2 = &IID_ISpeechRecoResult2_Value;
pub const ISpeechRecoResult2 = extern struct {
pub const VTable = extern struct {
base: ISpeechRecoResult.VTable,
SetTextFeedback: fn(
self: *const ISpeechRecoResult2,
Feedback: ?BSTR,
WasSuccessful: i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpeechRecoResult.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResult2_SetTextFeedback(self: *const T, Feedback: ?BSTR, WasSuccessful: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResult2.VTable, self.vtable).SetTextFeedback(@ptrCast(*const ISpeechRecoResult2, self), Feedback, WasSuccessful);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechRecoResultTimes_Value = @import("../zig.zig").Guid.initString("62b3b8fb-f6e7-41be-bdcb-056b1c29efc0");
pub const IID_ISpeechRecoResultTimes = &IID_ISpeechRecoResultTimes_Value;
pub const ISpeechRecoResultTimes = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_StreamTime: fn(
self: *const ISpeechRecoResultTimes,
Time: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Length: fn(
self: *const ISpeechRecoResultTimes,
Length: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_TickCount: fn(
self: *const ISpeechRecoResultTimes,
TickCount: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_OffsetFromStart: fn(
self: *const ISpeechRecoResultTimes,
OffsetFromStart: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultTimes_get_StreamTime(self: *const T, Time: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultTimes.VTable, self.vtable).get_StreamTime(@ptrCast(*const ISpeechRecoResultTimes, self), Time);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultTimes_get_Length(self: *const T, Length: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultTimes.VTable, self.vtable).get_Length(@ptrCast(*const ISpeechRecoResultTimes, self), Length);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultTimes_get_TickCount(self: *const T, TickCount: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultTimes.VTable, self.vtable).get_TickCount(@ptrCast(*const ISpeechRecoResultTimes, self), TickCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultTimes_get_OffsetFromStart(self: *const T, OffsetFromStart: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultTimes.VTable, self.vtable).get_OffsetFromStart(@ptrCast(*const ISpeechRecoResultTimes, self), OffsetFromStart);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseAlternate_Value = @import("../zig.zig").Guid.initString("27864a2a-2b9f-4cb8-92d3-0d2722fd1e73");
pub const IID_ISpeechPhraseAlternate = &IID_ISpeechPhraseAlternate_Value;
pub const ISpeechPhraseAlternate = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RecoResult: fn(
self: *const ISpeechPhraseAlternate,
RecoResult: ?*?*ISpeechRecoResult,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_StartElementInResult: fn(
self: *const ISpeechPhraseAlternate,
StartElement: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NumberOfElementsInResult: fn(
self: *const ISpeechPhraseAlternate,
NumberOfElements: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PhraseInfo: fn(
self: *const ISpeechPhraseAlternate,
PhraseInfo: ?*?*ISpeechPhraseInfo,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Commit: fn(
self: *const ISpeechPhraseAlternate,
) 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 ISpeechPhraseAlternate_get_RecoResult(self: *const T, RecoResult: ?*?*ISpeechRecoResult) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseAlternate.VTable, self.vtable).get_RecoResult(@ptrCast(*const ISpeechPhraseAlternate, self), RecoResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseAlternate_get_StartElementInResult(self: *const T, StartElement: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseAlternate.VTable, self.vtable).get_StartElementInResult(@ptrCast(*const ISpeechPhraseAlternate, self), StartElement);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseAlternate_get_NumberOfElementsInResult(self: *const T, NumberOfElements: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseAlternate.VTable, self.vtable).get_NumberOfElementsInResult(@ptrCast(*const ISpeechPhraseAlternate, self), NumberOfElements);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseAlternate_get_PhraseInfo(self: *const T, PhraseInfo: ?*?*ISpeechPhraseInfo) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseAlternate.VTable, self.vtable).get_PhraseInfo(@ptrCast(*const ISpeechPhraseAlternate, self), PhraseInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseAlternate_Commit(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseAlternate.VTable, self.vtable).Commit(@ptrCast(*const ISpeechPhraseAlternate, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseAlternates_Value = @import("../zig.zig").Guid.initString("b238b6d5-f276-4c3d-a6c1-2974801c3cc2");
pub const IID_ISpeechPhraseAlternates = &IID_ISpeechPhraseAlternates_Value;
pub const ISpeechPhraseAlternates = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechPhraseAlternates,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechPhraseAlternates,
Index: i32,
PhraseAlternate: ?*?*ISpeechPhraseAlternate,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechPhraseAlternates,
EnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseAlternates_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseAlternates.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechPhraseAlternates, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseAlternates_Item(self: *const T, Index: i32, PhraseAlternate: ?*?*ISpeechPhraseAlternate) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseAlternates.VTable, self.vtable).Item(@ptrCast(*const ISpeechPhraseAlternates, self), Index, PhraseAlternate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseAlternates_get__NewEnum(self: *const T, EnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseAlternates.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechPhraseAlternates, self), EnumVARIANT);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseInfo_Value = @import("../zig.zig").Guid.initString("961559cf-4e67-4662-8bf0-d93f1fcd61b3");
pub const IID_ISpeechPhraseInfo = &IID_ISpeechPhraseInfo_Value;
pub const ISpeechPhraseInfo = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LanguageId: fn(
self: *const ISpeechPhraseInfo,
LanguageId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_GrammarId: fn(
self: *const ISpeechPhraseInfo,
GrammarId: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_StartTime: fn(
self: *const ISpeechPhraseInfo,
StartTime: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioStreamPosition: fn(
self: *const ISpeechPhraseInfo,
AudioStreamPosition: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioSizeBytes: fn(
self: *const ISpeechPhraseInfo,
pAudioSizeBytes: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RetainedSizeBytes: fn(
self: *const ISpeechPhraseInfo,
RetainedSizeBytes: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioSizeTime: fn(
self: *const ISpeechPhraseInfo,
AudioSizeTime: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Rule: fn(
self: *const ISpeechPhraseInfo,
Rule: ?*?*ISpeechPhraseRule,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Properties: fn(
self: *const ISpeechPhraseInfo,
Properties: ?*?*ISpeechPhraseProperties,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Elements: fn(
self: *const ISpeechPhraseInfo,
Elements: ?*?*ISpeechPhraseElements,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Replacements: fn(
self: *const ISpeechPhraseInfo,
Replacements: ?*?*ISpeechPhraseReplacements,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EngineId: fn(
self: *const ISpeechPhraseInfo,
EngineIdGuid: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EnginePrivateData: fn(
self: *const ISpeechPhraseInfo,
PrivateData: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SaveToMemory: fn(
self: *const ISpeechPhraseInfo,
PhraseBlock: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetText: fn(
self: *const ISpeechPhraseInfo,
StartElement: i32,
Elements: i32,
UseReplacements: i16,
Text: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDisplayAttributes: fn(
self: *const ISpeechPhraseInfo,
StartElement: i32,
Elements: i32,
UseReplacements: i16,
DisplayAttributes: ?*SpeechDisplayAttributes,
) 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 ISpeechPhraseInfo_get_LanguageId(self: *const T, LanguageId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_LanguageId(@ptrCast(*const ISpeechPhraseInfo, self), LanguageId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_GrammarId(self: *const T, GrammarId: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_GrammarId(@ptrCast(*const ISpeechPhraseInfo, self), GrammarId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_StartTime(self: *const T, StartTime: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_StartTime(@ptrCast(*const ISpeechPhraseInfo, self), StartTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_AudioStreamPosition(self: *const T, AudioStreamPosition: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_AudioStreamPosition(@ptrCast(*const ISpeechPhraseInfo, self), AudioStreamPosition);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_AudioSizeBytes(self: *const T, pAudioSizeBytes: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_AudioSizeBytes(@ptrCast(*const ISpeechPhraseInfo, self), pAudioSizeBytes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_RetainedSizeBytes(self: *const T, RetainedSizeBytes: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_RetainedSizeBytes(@ptrCast(*const ISpeechPhraseInfo, self), RetainedSizeBytes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_AudioSizeTime(self: *const T, AudioSizeTime: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_AudioSizeTime(@ptrCast(*const ISpeechPhraseInfo, self), AudioSizeTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_Rule(self: *const T, Rule: ?*?*ISpeechPhraseRule) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_Rule(@ptrCast(*const ISpeechPhraseInfo, self), Rule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_Properties(self: *const T, Properties: ?*?*ISpeechPhraseProperties) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_Properties(@ptrCast(*const ISpeechPhraseInfo, self), Properties);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_Elements(self: *const T, Elements: ?*?*ISpeechPhraseElements) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_Elements(@ptrCast(*const ISpeechPhraseInfo, self), Elements);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_Replacements(self: *const T, Replacements: ?*?*ISpeechPhraseReplacements) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_Replacements(@ptrCast(*const ISpeechPhraseInfo, self), Replacements);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_EngineId(self: *const T, EngineIdGuid: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_EngineId(@ptrCast(*const ISpeechPhraseInfo, self), EngineIdGuid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_get_EnginePrivateData(self: *const T, PrivateData: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).get_EnginePrivateData(@ptrCast(*const ISpeechPhraseInfo, self), PrivateData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_SaveToMemory(self: *const T, PhraseBlock: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).SaveToMemory(@ptrCast(*const ISpeechPhraseInfo, self), PhraseBlock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_GetText(self: *const T, StartElement: i32, Elements: i32, UseReplacements: i16, Text: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).GetText(@ptrCast(*const ISpeechPhraseInfo, self), StartElement, Elements, UseReplacements, Text);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseInfo_GetDisplayAttributes(self: *const T, StartElement: i32, Elements: i32, UseReplacements: i16, DisplayAttributes: ?*SpeechDisplayAttributes) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfo.VTable, self.vtable).GetDisplayAttributes(@ptrCast(*const ISpeechPhraseInfo, self), StartElement, Elements, UseReplacements, DisplayAttributes);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseElement_Value = @import("../zig.zig").Guid.initString("e6176f96-e373-4801-b223-3b62c068c0b4");
pub const IID_ISpeechPhraseElement = &IID_ISpeechPhraseElement_Value;
pub const ISpeechPhraseElement = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioTimeOffset: fn(
self: *const ISpeechPhraseElement,
AudioTimeOffset: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioSizeTime: fn(
self: *const ISpeechPhraseElement,
AudioSizeTime: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioStreamOffset: fn(
self: *const ISpeechPhraseElement,
AudioStreamOffset: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioSizeBytes: fn(
self: *const ISpeechPhraseElement,
AudioSizeBytes: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RetainedStreamOffset: fn(
self: *const ISpeechPhraseElement,
RetainedStreamOffset: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RetainedSizeBytes: fn(
self: *const ISpeechPhraseElement,
RetainedSizeBytes: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_DisplayText: fn(
self: *const ISpeechPhraseElement,
DisplayText: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LexicalForm: fn(
self: *const ISpeechPhraseElement,
LexicalForm: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Pronunciation: fn(
self: *const ISpeechPhraseElement,
Pronunciation: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_DisplayAttributes: fn(
self: *const ISpeechPhraseElement,
DisplayAttributes: ?*SpeechDisplayAttributes,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RequiredConfidence: fn(
self: *const ISpeechPhraseElement,
RequiredConfidence: ?*SpeechEngineConfidence,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ActualConfidence: fn(
self: *const ISpeechPhraseElement,
ActualConfidence: ?*SpeechEngineConfidence,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EngineConfidence: fn(
self: *const ISpeechPhraseElement,
EngineConfidence: ?*f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_AudioTimeOffset(self: *const T, AudioTimeOffset: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_AudioTimeOffset(@ptrCast(*const ISpeechPhraseElement, self), AudioTimeOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_AudioSizeTime(self: *const T, AudioSizeTime: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_AudioSizeTime(@ptrCast(*const ISpeechPhraseElement, self), AudioSizeTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_AudioStreamOffset(self: *const T, AudioStreamOffset: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_AudioStreamOffset(@ptrCast(*const ISpeechPhraseElement, self), AudioStreamOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_AudioSizeBytes(self: *const T, AudioSizeBytes: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_AudioSizeBytes(@ptrCast(*const ISpeechPhraseElement, self), AudioSizeBytes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_RetainedStreamOffset(self: *const T, RetainedStreamOffset: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_RetainedStreamOffset(@ptrCast(*const ISpeechPhraseElement, self), RetainedStreamOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_RetainedSizeBytes(self: *const T, RetainedSizeBytes: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_RetainedSizeBytes(@ptrCast(*const ISpeechPhraseElement, self), RetainedSizeBytes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_DisplayText(self: *const T, DisplayText: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_DisplayText(@ptrCast(*const ISpeechPhraseElement, self), DisplayText);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_LexicalForm(self: *const T, LexicalForm: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_LexicalForm(@ptrCast(*const ISpeechPhraseElement, self), LexicalForm);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_Pronunciation(self: *const T, Pronunciation: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_Pronunciation(@ptrCast(*const ISpeechPhraseElement, self), Pronunciation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_DisplayAttributes(self: *const T, DisplayAttributes: ?*SpeechDisplayAttributes) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_DisplayAttributes(@ptrCast(*const ISpeechPhraseElement, self), DisplayAttributes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_RequiredConfidence(self: *const T, RequiredConfidence: ?*SpeechEngineConfidence) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_RequiredConfidence(@ptrCast(*const ISpeechPhraseElement, self), RequiredConfidence);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_ActualConfidence(self: *const T, ActualConfidence: ?*SpeechEngineConfidence) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_ActualConfidence(@ptrCast(*const ISpeechPhraseElement, self), ActualConfidence);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElement_get_EngineConfidence(self: *const T, EngineConfidence: ?*f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElement.VTable, self.vtable).get_EngineConfidence(@ptrCast(*const ISpeechPhraseElement, self), EngineConfidence);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseElements_Value = @import("../zig.zig").Guid.initString("0626b328-3478-467d-a0b3-d0853b93dda3");
pub const IID_ISpeechPhraseElements = &IID_ISpeechPhraseElements_Value;
pub const ISpeechPhraseElements = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechPhraseElements,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechPhraseElements,
Index: i32,
Element: ?*?*ISpeechPhraseElement,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechPhraseElements,
EnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElements_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElements.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechPhraseElements, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElements_Item(self: *const T, Index: i32, Element: ?*?*ISpeechPhraseElement) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElements.VTable, self.vtable).Item(@ptrCast(*const ISpeechPhraseElements, self), Index, Element);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseElements_get__NewEnum(self: *const T, EnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseElements.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechPhraseElements, self), EnumVARIANT);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseReplacement_Value = @import("../zig.zig").Guid.initString("2890a410-53a7-4fb5-94ec-06d4998e3d02");
pub const IID_ISpeechPhraseReplacement = &IID_ISpeechPhraseReplacement_Value;
pub const ISpeechPhraseReplacement = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_DisplayAttributes: fn(
self: *const ISpeechPhraseReplacement,
DisplayAttributes: ?*SpeechDisplayAttributes,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Text: fn(
self: *const ISpeechPhraseReplacement,
Text: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FirstElement: fn(
self: *const ISpeechPhraseReplacement,
FirstElement: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NumberOfElements: fn(
self: *const ISpeechPhraseReplacement,
NumberOfElements: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseReplacement_get_DisplayAttributes(self: *const T, DisplayAttributes: ?*SpeechDisplayAttributes) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseReplacement.VTable, self.vtable).get_DisplayAttributes(@ptrCast(*const ISpeechPhraseReplacement, self), DisplayAttributes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseReplacement_get_Text(self: *const T, Text: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseReplacement.VTable, self.vtable).get_Text(@ptrCast(*const ISpeechPhraseReplacement, self), Text);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseReplacement_get_FirstElement(self: *const T, FirstElement: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseReplacement.VTable, self.vtable).get_FirstElement(@ptrCast(*const ISpeechPhraseReplacement, self), FirstElement);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseReplacement_get_NumberOfElements(self: *const T, NumberOfElements: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseReplacement.VTable, self.vtable).get_NumberOfElements(@ptrCast(*const ISpeechPhraseReplacement, self), NumberOfElements);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseReplacements_Value = @import("../zig.zig").Guid.initString("38bc662f-2257-4525-959e-2069d2596c05");
pub const IID_ISpeechPhraseReplacements = &IID_ISpeechPhraseReplacements_Value;
pub const ISpeechPhraseReplacements = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechPhraseReplacements,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechPhraseReplacements,
Index: i32,
Reps: ?*?*ISpeechPhraseReplacement,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechPhraseReplacements,
EnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseReplacements_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseReplacements.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechPhraseReplacements, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseReplacements_Item(self: *const T, Index: i32, Reps: ?*?*ISpeechPhraseReplacement) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseReplacements.VTable, self.vtable).Item(@ptrCast(*const ISpeechPhraseReplacements, self), Index, Reps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseReplacements_get__NewEnum(self: *const T, EnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseReplacements.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechPhraseReplacements, self), EnumVARIANT);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseProperty_Value = @import("../zig.zig").Guid.initString("ce563d48-961e-4732-a2e1-378a42b430be");
pub const IID_ISpeechPhraseProperty = &IID_ISpeechPhraseProperty_Value;
pub const ISpeechPhraseProperty = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Name: fn(
self: *const ISpeechPhraseProperty,
Name: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const ISpeechPhraseProperty,
Id: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Value: fn(
self: *const ISpeechPhraseProperty,
Value: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FirstElement: fn(
self: *const ISpeechPhraseProperty,
FirstElement: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NumberOfElements: fn(
self: *const ISpeechPhraseProperty,
NumberOfElements: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EngineConfidence: fn(
self: *const ISpeechPhraseProperty,
Confidence: ?*f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Confidence: fn(
self: *const ISpeechPhraseProperty,
Confidence: ?*SpeechEngineConfidence,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Parent: fn(
self: *const ISpeechPhraseProperty,
ParentProperty: ?*?*ISpeechPhraseProperty,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Children: fn(
self: *const ISpeechPhraseProperty,
Children: ?*?*ISpeechPhraseProperties,
) 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 ISpeechPhraseProperty_get_Name(self: *const T, Name: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperty.VTable, self.vtable).get_Name(@ptrCast(*const ISpeechPhraseProperty, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperty_get_Id(self: *const T, Id: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperty.VTable, self.vtable).get_Id(@ptrCast(*const ISpeechPhraseProperty, self), Id);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperty_get_Value(self: *const T, Value: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperty.VTable, self.vtable).get_Value(@ptrCast(*const ISpeechPhraseProperty, self), Value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperty_get_FirstElement(self: *const T, FirstElement: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperty.VTable, self.vtable).get_FirstElement(@ptrCast(*const ISpeechPhraseProperty, self), FirstElement);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperty_get_NumberOfElements(self: *const T, NumberOfElements: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperty.VTable, self.vtable).get_NumberOfElements(@ptrCast(*const ISpeechPhraseProperty, self), NumberOfElements);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperty_get_EngineConfidence(self: *const T, Confidence: ?*f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperty.VTable, self.vtable).get_EngineConfidence(@ptrCast(*const ISpeechPhraseProperty, self), Confidence);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperty_get_Confidence(self: *const T, Confidence: ?*SpeechEngineConfidence) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperty.VTable, self.vtable).get_Confidence(@ptrCast(*const ISpeechPhraseProperty, self), Confidence);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperty_get_Parent(self: *const T, ParentProperty: ?*?*ISpeechPhraseProperty) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperty.VTable, self.vtable).get_Parent(@ptrCast(*const ISpeechPhraseProperty, self), ParentProperty);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperty_get_Children(self: *const T, Children: ?*?*ISpeechPhraseProperties) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperty.VTable, self.vtable).get_Children(@ptrCast(*const ISpeechPhraseProperty, self), Children);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseProperties_Value = @import("../zig.zig").Guid.initString("08166b47-102e-4b23-a599-bdb98dbfd1f4");
pub const IID_ISpeechPhraseProperties = &IID_ISpeechPhraseProperties_Value;
pub const ISpeechPhraseProperties = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechPhraseProperties,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechPhraseProperties,
Index: i32,
Property: ?*?*ISpeechPhraseProperty,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechPhraseProperties,
EnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperties_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperties.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechPhraseProperties, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperties_Item(self: *const T, Index: i32, Property: ?*?*ISpeechPhraseProperty) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperties.VTable, self.vtable).Item(@ptrCast(*const ISpeechPhraseProperties, self), Index, Property);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseProperties_get__NewEnum(self: *const T, EnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseProperties.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechPhraseProperties, self), EnumVARIANT);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseRule_Value = @import("../zig.zig").Guid.initString("a7bfe112-a4a0-48d9-b602-c313843f6964");
pub const IID_ISpeechPhraseRule = &IID_ISpeechPhraseRule_Value;
pub const ISpeechPhraseRule = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Name: fn(
self: *const ISpeechPhraseRule,
Name: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Id: fn(
self: *const ISpeechPhraseRule,
Id: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FirstElement: fn(
self: *const ISpeechPhraseRule,
FirstElement: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_NumberOfElements: fn(
self: *const ISpeechPhraseRule,
NumberOfElements: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Parent: fn(
self: *const ISpeechPhraseRule,
Parent: ?*?*ISpeechPhraseRule,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Children: fn(
self: *const ISpeechPhraseRule,
Children: ?*?*ISpeechPhraseRules,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Confidence: fn(
self: *const ISpeechPhraseRule,
ActualConfidence: ?*SpeechEngineConfidence,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EngineConfidence: fn(
self: *const ISpeechPhraseRule,
EngineConfidence: ?*f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRule_get_Name(self: *const T, Name: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRule.VTable, self.vtable).get_Name(@ptrCast(*const ISpeechPhraseRule, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRule_get_Id(self: *const T, Id: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRule.VTable, self.vtable).get_Id(@ptrCast(*const ISpeechPhraseRule, self), Id);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRule_get_FirstElement(self: *const T, FirstElement: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRule.VTable, self.vtable).get_FirstElement(@ptrCast(*const ISpeechPhraseRule, self), FirstElement);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRule_get_NumberOfElements(self: *const T, NumberOfElements: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRule.VTable, self.vtable).get_NumberOfElements(@ptrCast(*const ISpeechPhraseRule, self), NumberOfElements);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRule_get_Parent(self: *const T, Parent: ?*?*ISpeechPhraseRule) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRule.VTable, self.vtable).get_Parent(@ptrCast(*const ISpeechPhraseRule, self), Parent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRule_get_Children(self: *const T, Children: ?*?*ISpeechPhraseRules) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRule.VTable, self.vtable).get_Children(@ptrCast(*const ISpeechPhraseRule, self), Children);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRule_get_Confidence(self: *const T, ActualConfidence: ?*SpeechEngineConfidence) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRule.VTable, self.vtable).get_Confidence(@ptrCast(*const ISpeechPhraseRule, self), ActualConfidence);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRule_get_EngineConfidence(self: *const T, EngineConfidence: ?*f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRule.VTable, self.vtable).get_EngineConfidence(@ptrCast(*const ISpeechPhraseRule, self), EngineConfidence);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseRules_Value = @import("../zig.zig").Guid.initString("9047d593-01dd-4b72-81a3-e4a0ca69f407");
pub const IID_ISpeechPhraseRules = &IID_ISpeechPhraseRules_Value;
pub const ISpeechPhraseRules = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechPhraseRules,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechPhraseRules,
Index: i32,
Rule: ?*?*ISpeechPhraseRule,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechPhraseRules,
EnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRules_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRules.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechPhraseRules, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRules_Item(self: *const T, Index: i32, Rule: ?*?*ISpeechPhraseRule) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRules.VTable, self.vtable).Item(@ptrCast(*const ISpeechPhraseRules, self), Index, Rule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhraseRules_get__NewEnum(self: *const T, EnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseRules.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechPhraseRules, self), EnumVARIANT);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechLexicon_Value = @import("../zig.zig").Guid.initString("3da7627a-c7ae-4b23-8708-638c50362c25");
pub const IID_ISpeechLexicon = &IID_ISpeechLexicon_Value;
pub const ISpeechLexicon = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_GenerationId: fn(
self: *const ISpeechLexicon,
GenerationId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetWords: fn(
self: *const ISpeechLexicon,
Flags: SpeechLexiconType,
GenerationID: ?*i32,
Words: ?*?*ISpeechLexiconWords,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddPronunciation: fn(
self: *const ISpeechLexicon,
bstrWord: ?BSTR,
LangId: i32,
PartOfSpeech: SpeechPartOfSpeech,
bstrPronunciation: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddPronunciationByPhoneIds: fn(
self: *const ISpeechLexicon,
bstrWord: ?BSTR,
LangId: i32,
PartOfSpeech: SpeechPartOfSpeech,
PhoneIds: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemovePronunciation: fn(
self: *const ISpeechLexicon,
bstrWord: ?BSTR,
LangId: i32,
PartOfSpeech: SpeechPartOfSpeech,
bstrPronunciation: ?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemovePronunciationByPhoneIds: fn(
self: *const ISpeechLexicon,
bstrWord: ?BSTR,
LangId: i32,
PartOfSpeech: SpeechPartOfSpeech,
PhoneIds: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPronunciations: fn(
self: *const ISpeechLexicon,
bstrWord: ?BSTR,
LangId: i32,
TypeFlags: SpeechLexiconType,
ppPronunciations: ?*?*ISpeechLexiconPronunciations,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetGenerationChange: fn(
self: *const ISpeechLexicon,
GenerationID: ?*i32,
ppWords: ?*?*ISpeechLexiconWords,
) 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 ISpeechLexicon_get_GenerationId(self: *const T, GenerationId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexicon.VTable, self.vtable).get_GenerationId(@ptrCast(*const ISpeechLexicon, self), GenerationId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexicon_GetWords(self: *const T, Flags: SpeechLexiconType, GenerationID: ?*i32, Words: ?*?*ISpeechLexiconWords) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexicon.VTable, self.vtable).GetWords(@ptrCast(*const ISpeechLexicon, self), Flags, GenerationID, Words);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexicon_AddPronunciation(self: *const T, bstrWord: ?BSTR, LangId: i32, PartOfSpeech: SpeechPartOfSpeech, bstrPronunciation: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexicon.VTable, self.vtable).AddPronunciation(@ptrCast(*const ISpeechLexicon, self), bstrWord, LangId, PartOfSpeech, bstrPronunciation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexicon_AddPronunciationByPhoneIds(self: *const T, bstrWord: ?BSTR, LangId: i32, PartOfSpeech: SpeechPartOfSpeech, PhoneIds: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexicon.VTable, self.vtable).AddPronunciationByPhoneIds(@ptrCast(*const ISpeechLexicon, self), bstrWord, LangId, PartOfSpeech, PhoneIds);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexicon_RemovePronunciation(self: *const T, bstrWord: ?BSTR, LangId: i32, PartOfSpeech: SpeechPartOfSpeech, bstrPronunciation: ?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexicon.VTable, self.vtable).RemovePronunciation(@ptrCast(*const ISpeechLexicon, self), bstrWord, LangId, PartOfSpeech, bstrPronunciation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexicon_RemovePronunciationByPhoneIds(self: *const T, bstrWord: ?BSTR, LangId: i32, PartOfSpeech: SpeechPartOfSpeech, PhoneIds: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexicon.VTable, self.vtable).RemovePronunciationByPhoneIds(@ptrCast(*const ISpeechLexicon, self), bstrWord, LangId, PartOfSpeech, PhoneIds);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexicon_GetPronunciations(self: *const T, bstrWord: ?BSTR, LangId: i32, TypeFlags: SpeechLexiconType, ppPronunciations: ?*?*ISpeechLexiconPronunciations) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexicon.VTable, self.vtable).GetPronunciations(@ptrCast(*const ISpeechLexicon, self), bstrWord, LangId, TypeFlags, ppPronunciations);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexicon_GetGenerationChange(self: *const T, GenerationID: ?*i32, ppWords: ?*?*ISpeechLexiconWords) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexicon.VTable, self.vtable).GetGenerationChange(@ptrCast(*const ISpeechLexicon, self), GenerationID, ppWords);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechLexiconWords_Value = @import("../zig.zig").Guid.initString("8d199862-415e-47d5-ac4f-faa608b424e6");
pub const IID_ISpeechLexiconWords = &IID_ISpeechLexiconWords_Value;
pub const ISpeechLexiconWords = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechLexiconWords,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechLexiconWords,
Index: i32,
Word: ?*?*ISpeechLexiconWord,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechLexiconWords,
EnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconWords_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconWords.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechLexiconWords, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconWords_Item(self: *const T, Index: i32, Word: ?*?*ISpeechLexiconWord) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconWords.VTable, self.vtable).Item(@ptrCast(*const ISpeechLexiconWords, self), Index, Word);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconWords_get__NewEnum(self: *const T, EnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconWords.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechLexiconWords, self), EnumVARIANT);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechLexiconWord_Value = @import("../zig.zig").Guid.initString("4e5b933c-c9be-48ed-8842-1ee51bb1d4ff");
pub const IID_ISpeechLexiconWord = &IID_ISpeechLexiconWord_Value;
pub const ISpeechLexiconWord = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LangId: fn(
self: *const ISpeechLexiconWord,
LangId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Type: fn(
self: *const ISpeechLexiconWord,
WordType: ?*SpeechWordType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Word: fn(
self: *const ISpeechLexiconWord,
Word: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Pronunciations: fn(
self: *const ISpeechLexiconWord,
Pronunciations: ?*?*ISpeechLexiconPronunciations,
) 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 ISpeechLexiconWord_get_LangId(self: *const T, LangId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconWord.VTable, self.vtable).get_LangId(@ptrCast(*const ISpeechLexiconWord, self), LangId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconWord_get_Type(self: *const T, WordType: ?*SpeechWordType) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconWord.VTable, self.vtable).get_Type(@ptrCast(*const ISpeechLexiconWord, self), WordType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconWord_get_Word(self: *const T, Word: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconWord.VTable, self.vtable).get_Word(@ptrCast(*const ISpeechLexiconWord, self), Word);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconWord_get_Pronunciations(self: *const T, Pronunciations: ?*?*ISpeechLexiconPronunciations) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconWord.VTable, self.vtable).get_Pronunciations(@ptrCast(*const ISpeechLexiconWord, self), Pronunciations);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechLexiconPronunciations_Value = @import("../zig.zig").Guid.initString("72829128-5682-4704-a0d4-3e2bb6f2ead3");
pub const IID_ISpeechLexiconPronunciations = &IID_ISpeechLexiconPronunciations_Value;
pub const ISpeechLexiconPronunciations = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Count: fn(
self: *const ISpeechLexiconPronunciations,
Count: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Item: fn(
self: *const ISpeechLexiconPronunciations,
Index: i32,
Pronunciation: ?*?*ISpeechLexiconPronunciation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get__NewEnum: fn(
self: *const ISpeechLexiconPronunciations,
EnumVARIANT: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconPronunciations_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconPronunciations.VTable, self.vtable).get_Count(@ptrCast(*const ISpeechLexiconPronunciations, self), Count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconPronunciations_Item(self: *const T, Index: i32, Pronunciation: ?*?*ISpeechLexiconPronunciation) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconPronunciations.VTable, self.vtable).Item(@ptrCast(*const ISpeechLexiconPronunciations, self), Index, Pronunciation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconPronunciations_get__NewEnum(self: *const T, EnumVARIANT: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconPronunciations.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISpeechLexiconPronunciations, self), EnumVARIANT);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechLexiconPronunciation_Value = @import("../zig.zig").Guid.initString("95252c5d-9e43-4f4a-9899-48ee73352f9f");
pub const IID_ISpeechLexiconPronunciation = &IID_ISpeechLexiconPronunciation_Value;
pub const ISpeechLexiconPronunciation = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Type: fn(
self: *const ISpeechLexiconPronunciation,
LexiconType: ?*SpeechLexiconType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LangId: fn(
self: *const ISpeechLexiconPronunciation,
LangId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PartOfSpeech: fn(
self: *const ISpeechLexiconPronunciation,
PartOfSpeech: ?*SpeechPartOfSpeech,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PhoneIds: fn(
self: *const ISpeechLexiconPronunciation,
PhoneIds: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Symbolic: fn(
self: *const ISpeechLexiconPronunciation,
Symbolic: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconPronunciation_get_Type(self: *const T, LexiconType: ?*SpeechLexiconType) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconPronunciation.VTable, self.vtable).get_Type(@ptrCast(*const ISpeechLexiconPronunciation, self), LexiconType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconPronunciation_get_LangId(self: *const T, LangId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconPronunciation.VTable, self.vtable).get_LangId(@ptrCast(*const ISpeechLexiconPronunciation, self), LangId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconPronunciation_get_PartOfSpeech(self: *const T, PartOfSpeech: ?*SpeechPartOfSpeech) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconPronunciation.VTable, self.vtable).get_PartOfSpeech(@ptrCast(*const ISpeechLexiconPronunciation, self), PartOfSpeech);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconPronunciation_get_PhoneIds(self: *const T, PhoneIds: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconPronunciation.VTable, self.vtable).get_PhoneIds(@ptrCast(*const ISpeechLexiconPronunciation, self), PhoneIds);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechLexiconPronunciation_get_Symbolic(self: *const T, Symbolic: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechLexiconPronunciation.VTable, self.vtable).get_Symbolic(@ptrCast(*const ISpeechLexiconPronunciation, self), Symbolic);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechXMLRecoResult_Value = @import("../zig.zig").Guid.initString("aaec54af-8f85-4924-944d-b79d39d72e19");
pub const IID_ISpeechXMLRecoResult = &IID_ISpeechXMLRecoResult_Value;
pub const ISpeechXMLRecoResult = extern struct {
pub const VTable = extern struct {
base: ISpeechRecoResult.VTable,
GetXMLResult: fn(
self: *const ISpeechXMLRecoResult,
Options: SPXMLRESULTOPTIONS,
pResult: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetXMLErrorInfo: fn(
self: *const ISpeechXMLRecoResult,
LineNumber: ?*i32,
ScriptLine: ?*?BSTR,
Source: ?*?BSTR,
Description: ?*?BSTR,
ResultCode: ?*i32,
IsError: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISpeechRecoResult.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechXMLRecoResult_GetXMLResult(self: *const T, Options: SPXMLRESULTOPTIONS, pResult: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechXMLRecoResult.VTable, self.vtable).GetXMLResult(@ptrCast(*const ISpeechXMLRecoResult, self), Options, pResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechXMLRecoResult_GetXMLErrorInfo(self: *const T, LineNumber: ?*i32, ScriptLine: ?*?BSTR, Source: ?*?BSTR, Description: ?*?BSTR, ResultCode: ?*i32, IsError: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechXMLRecoResult.VTable, self.vtable).GetXMLErrorInfo(@ptrCast(*const ISpeechXMLRecoResult, self), LineNumber, ScriptLine, Source, Description, ResultCode, IsError);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechRecoResultDispatch_Value = @import("../zig.zig").Guid.initString("6d60eb64-aced-40a6-bbf3-4e557f71dee2");
pub const IID_ISpeechRecoResultDispatch = &IID_ISpeechRecoResultDispatch_Value;
pub const ISpeechRecoResultDispatch = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RecoContext: fn(
self: *const ISpeechRecoResultDispatch,
RecoContext: ?*?*ISpeechRecoContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Times: fn(
self: *const ISpeechRecoResultDispatch,
Times: ?*?*ISpeechRecoResultTimes,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
putref_AudioFormat: fn(
self: *const ISpeechRecoResultDispatch,
Format: ?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AudioFormat: fn(
self: *const ISpeechRecoResultDispatch,
Format: ?*?*ISpeechAudioFormat,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PhraseInfo: fn(
self: *const ISpeechRecoResultDispatch,
PhraseInfo: ?*?*ISpeechPhraseInfo,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Alternates: fn(
self: *const ISpeechRecoResultDispatch,
RequestCount: i32,
StartElement: i32,
Elements: i32,
Alternates: ?*?*ISpeechPhraseAlternates,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Audio: fn(
self: *const ISpeechRecoResultDispatch,
StartElement: i32,
Elements: i32,
Stream: ?*?*ISpeechMemoryStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SpeakAudio: fn(
self: *const ISpeechRecoResultDispatch,
StartElement: i32,
Elements: i32,
Flags: SpeechVoiceSpeakFlags,
StreamNumber: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SaveToMemory: fn(
self: *const ISpeechRecoResultDispatch,
ResultBlock: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DiscardResultInfo: fn(
self: *const ISpeechRecoResultDispatch,
ValueTypes: SpeechDiscardType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetXMLResult: fn(
self: *const ISpeechRecoResultDispatch,
Options: SPXMLRESULTOPTIONS,
pResult: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetXMLErrorInfo: fn(
self: *const ISpeechRecoResultDispatch,
LineNumber: ?*i32,
ScriptLine: ?*?BSTR,
Source: ?*?BSTR,
Description: ?*?BSTR,
ResultCode: ?*HRESULT,
IsError: ?*i16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTextFeedback: fn(
self: *const ISpeechRecoResultDispatch,
Feedback: ?BSTR,
WasSuccessful: 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 ISpeechRecoResultDispatch_get_RecoContext(self: *const T, RecoContext: ?*?*ISpeechRecoContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).get_RecoContext(@ptrCast(*const ISpeechRecoResultDispatch, self), RecoContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_get_Times(self: *const T, Times: ?*?*ISpeechRecoResultTimes) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).get_Times(@ptrCast(*const ISpeechRecoResultDispatch, self), Times);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_putref_AudioFormat(self: *const T, Format: ?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).putref_AudioFormat(@ptrCast(*const ISpeechRecoResultDispatch, self), Format);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_get_AudioFormat(self: *const T, Format: ?*?*ISpeechAudioFormat) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).get_AudioFormat(@ptrCast(*const ISpeechRecoResultDispatch, self), Format);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_get_PhraseInfo(self: *const T, PhraseInfo: ?*?*ISpeechPhraseInfo) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).get_PhraseInfo(@ptrCast(*const ISpeechRecoResultDispatch, self), PhraseInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_Alternates(self: *const T, RequestCount: i32, StartElement: i32, Elements: i32, Alternates: ?*?*ISpeechPhraseAlternates) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).Alternates(@ptrCast(*const ISpeechRecoResultDispatch, self), RequestCount, StartElement, Elements, Alternates);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_Audio(self: *const T, StartElement: i32, Elements: i32, Stream: ?*?*ISpeechMemoryStream) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).Audio(@ptrCast(*const ISpeechRecoResultDispatch, self), StartElement, Elements, Stream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_SpeakAudio(self: *const T, StartElement: i32, Elements: i32, Flags: SpeechVoiceSpeakFlags, StreamNumber: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).SpeakAudio(@ptrCast(*const ISpeechRecoResultDispatch, self), StartElement, Elements, Flags, StreamNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_SaveToMemory(self: *const T, ResultBlock: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).SaveToMemory(@ptrCast(*const ISpeechRecoResultDispatch, self), ResultBlock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_DiscardResultInfo(self: *const T, ValueTypes: SpeechDiscardType) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).DiscardResultInfo(@ptrCast(*const ISpeechRecoResultDispatch, self), ValueTypes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_GetXMLResult(self: *const T, Options: SPXMLRESULTOPTIONS, pResult: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).GetXMLResult(@ptrCast(*const ISpeechRecoResultDispatch, self), Options, pResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_GetXMLErrorInfo(self: *const T, LineNumber: ?*i32, ScriptLine: ?*?BSTR, Source: ?*?BSTR, Description: ?*?BSTR, ResultCode: ?*HRESULT, IsError: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).GetXMLErrorInfo(@ptrCast(*const ISpeechRecoResultDispatch, self), LineNumber, ScriptLine, Source, Description, ResultCode, IsError);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechRecoResultDispatch_SetTextFeedback(self: *const T, Feedback: ?BSTR, WasSuccessful: i16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechRecoResultDispatch.VTable, self.vtable).SetTextFeedback(@ptrCast(*const ISpeechRecoResultDispatch, self), Feedback, WasSuccessful);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhraseInfoBuilder_Value = @import("../zig.zig").Guid.initString("3b151836-df3a-4e0a-846c-d2adc9334333");
pub const IID_ISpeechPhraseInfoBuilder = &IID_ISpeechPhraseInfoBuilder_Value;
pub const ISpeechPhraseInfoBuilder = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
RestorePhraseFromMemory: fn(
self: *const ISpeechPhraseInfoBuilder,
PhraseInMemory: ?*VARIANT,
PhraseInfo: ?*?*ISpeechPhraseInfo,
) 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 ISpeechPhraseInfoBuilder_RestorePhraseFromMemory(self: *const T, PhraseInMemory: ?*VARIANT, PhraseInfo: ?*?*ISpeechPhraseInfo) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhraseInfoBuilder.VTable, self.vtable).RestorePhraseFromMemory(@ptrCast(*const ISpeechPhraseInfoBuilder, self), PhraseInMemory, PhraseInfo);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISpeechPhoneConverter_Value = @import("../zig.zig").Guid.initString("c3e4f353-433f-43d6-89a1-6a62a7054c3d");
pub const IID_ISpeechPhoneConverter = &IID_ISpeechPhoneConverter_Value;
pub const ISpeechPhoneConverter = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LanguageId: fn(
self: *const ISpeechPhoneConverter,
LanguageId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_LanguageId: fn(
self: *const ISpeechPhoneConverter,
LanguageId: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PhoneToId: fn(
self: *const ISpeechPhoneConverter,
Phonemes: ?BSTR,
IdArray: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IdToPhone: fn(
self: *const ISpeechPhoneConverter,
IdArray: VARIANT,
Phonemes: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhoneConverter_get_LanguageId(self: *const T, LanguageId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhoneConverter.VTable, self.vtable).get_LanguageId(@ptrCast(*const ISpeechPhoneConverter, self), LanguageId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhoneConverter_put_LanguageId(self: *const T, LanguageId: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhoneConverter.VTable, self.vtable).put_LanguageId(@ptrCast(*const ISpeechPhoneConverter, self), LanguageId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhoneConverter_PhoneToId(self: *const T, Phonemes: ?BSTR, IdArray: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhoneConverter.VTable, self.vtable).PhoneToId(@ptrCast(*const ISpeechPhoneConverter, self), Phonemes, IdArray);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISpeechPhoneConverter_IdToPhone(self: *const T, IdArray: VARIANT, Phonemes: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISpeechPhoneConverter.VTable, self.vtable).IdToPhone(@ptrCast(*const ISpeechPhoneConverter, self), IdArray, Phonemes);
}
};}
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 (19)
//--------------------------------------------------------------------------------
const Guid = @import("../zig.zig").Guid;
const BOOL = @import("../foundation.zig").BOOL;
const BSTR = @import("../foundation.zig").BSTR;
const FILETIME = @import("../foundation.zig").FILETIME;
const HANDLE = @import("../foundation.zig").HANDLE;
const HINSTANCE = @import("../foundation.zig").HINSTANCE;
const HKEY = @import("../system/registry.zig").HKEY;
const HRESULT = @import("../foundation.zig").HRESULT;
const HWND = @import("../foundation.zig").HWND;
const IDispatch = @import("../system/ole_automation.zig").IDispatch;
const IInternetSecurityManager = @import("../system/com.zig").IInternetSecurityManager;
const IServiceProvider = @import("../system/system_services.zig").IServiceProvider;
const IStream = @import("../storage/structured_storage.zig").IStream;
const IUnknown = @import("../system/com.zig").IUnknown;
const LPARAM = @import("../foundation.zig").LPARAM;
const PWSTR = @import("../foundation.zig").PWSTR;
const VARIANT = @import("../system/ole_automation.zig").VARIANT;
const WAVEFORMATEX = @import("../media/multimedia.zig").WAVEFORMATEX;
const WPARAM = @import("../foundation.zig").WPARAM;
test {
// The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
if (@hasDecl(@This(), "SPNOTIFYCALLBACK")) { _ = SPNOTIFYCALLBACK; }
@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/media/speech.zig |
pub const D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION = @as(u32, 2048);
pub const D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION = @as(u32, 4096);
pub const D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION = @as(u32, 2048);
pub const D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION = @as(u32, 4096);
pub const D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION = @as(u32, 512);
pub const D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION = @as(u32, 4096);
pub const D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION = @as(u32, 256);
pub const D3D_FL9_1_DEFAULT_MAX_ANISOTROPY = @as(u32, 2);
pub const D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT = @as(u32, 65535);
pub const D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT = @as(u32, 1048575);
pub const D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT = @as(u32, 1);
pub const D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT = @as(u32, 4);
pub const D3D_FL9_1_MAX_TEXTURE_REPEAT = @as(u32, 128);
pub const D3D_FL9_2_MAX_TEXTURE_REPEAT = @as(u32, 2048);
pub const D3D_FL9_3_MAX_TEXTURE_REPEAT = @as(u32, 8192);
pub const D3D_SHADER_FEATURE_DOUBLES = @as(u32, 1);
pub const D3D_SHADER_FEATURE_COMPUTE_SHADERS_PLUS_RAW_AND_STRUCTURED_BUFFERS_VIA_SHADER_4_X = @as(u32, 2);
pub const D3D_SHADER_FEATURE_UAVS_AT_EVERY_STAGE = @as(u32, 4);
pub const D3D_SHADER_FEATURE_64_UAVS = @as(u32, 8);
pub const D3D_SHADER_FEATURE_MINIMUM_PRECISION = @as(u32, 16);
pub const D3D_SHADER_FEATURE_11_1_DOUBLE_EXTENSIONS = @as(u32, 32);
pub const D3D_SHADER_FEATURE_11_1_SHADER_EXTENSIONS = @as(u32, 64);
pub const D3D_SHADER_FEATURE_LEVEL_9_COMPARISON_FILTERING = @as(u32, 128);
pub const D3D_SHADER_FEATURE_TILED_RESOURCES = @as(u32, 256);
pub const D3D_SHADER_FEATURE_STENCIL_REF = @as(u32, 512);
pub const D3D_SHADER_FEATURE_INNER_COVERAGE = @as(u32, 1024);
pub const D3D_SHADER_FEATURE_TYPED_UAV_LOAD_ADDITIONAL_FORMATS = @as(u32, 2048);
pub const D3D_SHADER_FEATURE_ROVS = @as(u32, 4096);
pub const D3D_SHADER_FEATURE_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER = @as(u32, 8192);
pub const D3D_SHADER_FEATURE_WAVE_OPS = @as(u32, 16384);
pub const D3D_SHADER_FEATURE_INT64_OPS = @as(u32, 32768);
pub const D3D_SHADER_FEATURE_VIEW_ID = @as(u32, 65536);
pub const D3D_SHADER_FEATURE_BARYCENTRICS = @as(u32, 131072);
pub const D3D_SHADER_FEATURE_NATIVE_16BIT_OPS = @as(u32, 262144);
pub const D3D_SHADER_FEATURE_SHADING_RATE = @as(u32, 524288);
pub const D3D_SHADER_FEATURE_RAYTRACING_TIER_1_1 = @as(u32, 1048576);
pub const D3D_SHADER_FEATURE_SAMPLER_FEEDBACK = @as(u32, 2097152);
pub const D3D_SHADER_FEATURE_ATOMIC_INT64_ON_TYPED_RESOURCE = @as(u32, 4194304);
pub const D3D_SHADER_FEATURE_ATOMIC_INT64_ON_GROUP_SHARED = @as(u32, 8388608);
pub const D3D_SHADER_FEATURE_DERIVATIVES_IN_MESH_AND_AMPLIFICATION_SHADERS = @as(u32, 16777216);
pub const D3D_SHADER_FEATURE_RESOURCE_DESCRIPTOR_HEAP_INDEXING = @as(u32, 33554432);
pub const D3D_SHADER_FEATURE_SAMPLER_DESCRIPTOR_HEAP_INDEXING = @as(u32, 67108864);
pub const D3D_SHADER_FEATURE_WAVE_MMA = @as(u32, 134217728);
pub const D3D_SHADER_FEATURE_ATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE = @as(u32, 268435456);
pub const WKPDID_D3DDebugObjectName = Guid.initString("429b8c22-9188-4b0c-8742-acb0bf85c200");
pub const WKPDID_D3DDebugObjectNameW = Guid.initString("4cca5fd8-921f-42c8-8566-70caf2a9b741");
pub const WKPDID_CommentStringW = Guid.initString("d0149dc0-90e8-4ec8-8144-e900ad266bb2");
pub const WKPDID_D3D12UniqueObjectId = Guid.initString("1b39de15-ec04-4bae-ba4d-8cef79fc04c1");
pub const D3D_COMPONENT_MASK_X = @as(u32, 1);
pub const D3D_COMPONENT_MASK_Y = @as(u32, 2);
pub const D3D_COMPONENT_MASK_Z = @as(u32, 4);
pub const D3D_COMPONENT_MASK_W = @as(u32, 8);
pub const D3D_TEXTURE_LAYOUT_ROW_MAJOR = Guid.initString("b5dc234f-72bb-4bec-9705-8cf258df6b6c");
pub const D3D_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE = Guid.initString("4c0f29e3-3f5f-4d35-84c9-bc0983b62c28");
//--------------------------------------------------------------------------------
// Section: Types (29)
//--------------------------------------------------------------------------------
pub const D3D_DRIVER_TYPE = enum(i32) {
UNKNOWN = 0,
HARDWARE = 1,
REFERENCE = 2,
NULL = 3,
SOFTWARE = 4,
WARP = 5,
};
pub const D3D_DRIVER_TYPE_UNKNOWN = D3D_DRIVER_TYPE.UNKNOWN;
pub const D3D_DRIVER_TYPE_HARDWARE = D3D_DRIVER_TYPE.HARDWARE;
pub const D3D_DRIVER_TYPE_REFERENCE = D3D_DRIVER_TYPE.REFERENCE;
pub const D3D_DRIVER_TYPE_NULL = D3D_DRIVER_TYPE.NULL;
pub const D3D_DRIVER_TYPE_SOFTWARE = D3D_DRIVER_TYPE.SOFTWARE;
pub const D3D_DRIVER_TYPE_WARP = D3D_DRIVER_TYPE.WARP;
pub const D3D_FEATURE_LEVEL = enum(i32) {
@"1_0_CORE" = 4096,
@"9_1" = 37120,
@"9_2" = 37376,
@"9_3" = 37632,
@"10_0" = 40960,
@"10_1" = 41216,
@"11_0" = 45056,
@"11_1" = 45312,
@"12_0" = 49152,
@"12_1" = 49408,
@"12_2" = 49664,
};
pub const D3D_FEATURE_LEVEL_1_0_CORE = D3D_FEATURE_LEVEL.@"1_0_CORE";
pub const D3D_FEATURE_LEVEL_9_1 = D3D_FEATURE_LEVEL.@"9_1";
pub const D3D_FEATURE_LEVEL_9_2 = D3D_FEATURE_LEVEL.@"9_2";
pub const D3D_FEATURE_LEVEL_9_3 = D3D_FEATURE_LEVEL.@"9_3";
pub const D3D_FEATURE_LEVEL_10_0 = D3D_FEATURE_LEVEL.@"10_0";
pub const D3D_FEATURE_LEVEL_10_1 = D3D_FEATURE_LEVEL.@"10_1";
pub const D3D_FEATURE_LEVEL_11_0 = D3D_FEATURE_LEVEL.@"11_0";
pub const D3D_FEATURE_LEVEL_11_1 = D3D_FEATURE_LEVEL.@"11_1";
pub const D3D_FEATURE_LEVEL_12_0 = D3D_FEATURE_LEVEL.@"12_0";
pub const D3D_FEATURE_LEVEL_12_1 = D3D_FEATURE_LEVEL.@"12_1";
pub const D3D_FEATURE_LEVEL_12_2 = D3D_FEATURE_LEVEL.@"12_2";
pub const D3D_PRIMITIVE_TOPOLOGY = enum(i32) {
_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
_PRIMITIVE_TOPOLOGY_LINELIST = 2,
_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33,
_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34,
_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35,
_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36,
_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37,
_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38,
_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39,
_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40,
_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41,
_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42,
_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43,
_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44,
_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45,
_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46,
_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47,
_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48,
_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49,
_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50,
_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51,
_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52,
_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53,
_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54,
_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55,
_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56,
_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57,
_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58,
_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59,
_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60,
_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61,
_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62,
_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63,
_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64,
// @"10_PRIMITIVE_TOPOLOGY_UNDEFINED" = 0, this enum value conflicts with _PRIMITIVE_TOPOLOGY_UNDEFINED
// @"10_PRIMITIVE_TOPOLOGY_POINTLIST" = 1, this enum value conflicts with _PRIMITIVE_TOPOLOGY_POINTLIST
// @"10_PRIMITIVE_TOPOLOGY_LINELIST" = 2, this enum value conflicts with _PRIMITIVE_TOPOLOGY_LINELIST
// @"10_PRIMITIVE_TOPOLOGY_LINESTRIP" = 3, this enum value conflicts with _PRIMITIVE_TOPOLOGY_LINESTRIP
// @"10_PRIMITIVE_TOPOLOGY_TRIANGLELIST" = 4, this enum value conflicts with _PRIMITIVE_TOPOLOGY_TRIANGLELIST
// @"10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP" = 5, this enum value conflicts with _PRIMITIVE_TOPOLOGY_TRIANGLESTRIP
// @"10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ" = 10, this enum value conflicts with _PRIMITIVE_TOPOLOGY_LINELIST_ADJ
// @"10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ" = 11, this enum value conflicts with _PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ
// @"10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ" = 12, this enum value conflicts with _PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ
// @"10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ" = 13, this enum value conflicts with _PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ
// @"11_PRIMITIVE_TOPOLOGY_UNDEFINED" = 0, this enum value conflicts with _PRIMITIVE_TOPOLOGY_UNDEFINED
// @"11_PRIMITIVE_TOPOLOGY_POINTLIST" = 1, this enum value conflicts with _PRIMITIVE_TOPOLOGY_POINTLIST
// @"11_PRIMITIVE_TOPOLOGY_LINELIST" = 2, this enum value conflicts with _PRIMITIVE_TOPOLOGY_LINELIST
// @"11_PRIMITIVE_TOPOLOGY_LINESTRIP" = 3, this enum value conflicts with _PRIMITIVE_TOPOLOGY_LINESTRIP
// @"11_PRIMITIVE_TOPOLOGY_TRIANGLELIST" = 4, this enum value conflicts with _PRIMITIVE_TOPOLOGY_TRIANGLELIST
// @"11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP" = 5, this enum value conflicts with _PRIMITIVE_TOPOLOGY_TRIANGLESTRIP
// @"11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ" = 10, this enum value conflicts with _PRIMITIVE_TOPOLOGY_LINELIST_ADJ
// @"11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ" = 11, this enum value conflicts with _PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ
// @"11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ" = 12, this enum value conflicts with _PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ
// @"11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ" = 13, this enum value conflicts with _PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ
// @"11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST" = 33, this enum value conflicts with _PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST" = 34, this enum value conflicts with _PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST" = 35, this enum value conflicts with _PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST" = 36, this enum value conflicts with _PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST" = 37, this enum value conflicts with _PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST" = 38, this enum value conflicts with _PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST" = 39, this enum value conflicts with _PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST" = 40, this enum value conflicts with _PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST" = 41, this enum value conflicts with _PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST" = 42, this enum value conflicts with _PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST" = 43, this enum value conflicts with _PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST" = 44, this enum value conflicts with _PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST" = 45, this enum value conflicts with _PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST" = 46, this enum value conflicts with _PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST" = 47, this enum value conflicts with _PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST" = 48, this enum value conflicts with _PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST" = 49, this enum value conflicts with _PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST" = 50, this enum value conflicts with _PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST" = 51, this enum value conflicts with _PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST" = 52, this enum value conflicts with _PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST" = 53, this enum value conflicts with _PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST" = 54, this enum value conflicts with _PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST" = 55, this enum value conflicts with _PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST" = 56, this enum value conflicts with _PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST" = 57, this enum value conflicts with _PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST" = 58, this enum value conflicts with _PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST" = 59, this enum value conflicts with _PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST" = 60, this enum value conflicts with _PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST" = 61, this enum value conflicts with _PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST" = 62, this enum value conflicts with _PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST" = 63, this enum value conflicts with _PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST
// @"11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST" = 64, this enum value conflicts with _PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST
};
pub const D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_UNDEFINED;
pub const D3D_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_POINTLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINELIST;
pub const D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINESTRIP;
pub const D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLELIST;
pub const D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
pub const D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINELIST_ADJ;
pub const D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ;
pub const D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ;
pub const D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ;
pub const D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST;
pub const D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_UNDEFINED;
pub const D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_POINTLIST;
pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINELIST;
pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINESTRIP;
pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLELIST;
pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINELIST_ADJ;
pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ;
pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ;
pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ;
pub const D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_UNDEFINED;
pub const D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_POINTLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINELIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINESTRIP;
pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLELIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINELIST_ADJ;
pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ;
pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ;
pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ;
pub const D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST;
pub const D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY._PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST;
pub const D3D_PRIMITIVE = enum(i32) {
_PRIMITIVE_UNDEFINED = 0,
_PRIMITIVE_POINT = 1,
_PRIMITIVE_LINE = 2,
_PRIMITIVE_TRIANGLE = 3,
_PRIMITIVE_LINE_ADJ = 6,
_PRIMITIVE_TRIANGLE_ADJ = 7,
_PRIMITIVE_1_CONTROL_POINT_PATCH = 8,
_PRIMITIVE_2_CONTROL_POINT_PATCH = 9,
_PRIMITIVE_3_CONTROL_POINT_PATCH = 10,
_PRIMITIVE_4_CONTROL_POINT_PATCH = 11,
_PRIMITIVE_5_CONTROL_POINT_PATCH = 12,
_PRIMITIVE_6_CONTROL_POINT_PATCH = 13,
_PRIMITIVE_7_CONTROL_POINT_PATCH = 14,
_PRIMITIVE_8_CONTROL_POINT_PATCH = 15,
_PRIMITIVE_9_CONTROL_POINT_PATCH = 16,
_PRIMITIVE_10_CONTROL_POINT_PATCH = 17,
_PRIMITIVE_11_CONTROL_POINT_PATCH = 18,
_PRIMITIVE_12_CONTROL_POINT_PATCH = 19,
_PRIMITIVE_13_CONTROL_POINT_PATCH = 20,
_PRIMITIVE_14_CONTROL_POINT_PATCH = 21,
_PRIMITIVE_15_CONTROL_POINT_PATCH = 22,
_PRIMITIVE_16_CONTROL_POINT_PATCH = 23,
_PRIMITIVE_17_CONTROL_POINT_PATCH = 24,
_PRIMITIVE_18_CONTROL_POINT_PATCH = 25,
_PRIMITIVE_19_CONTROL_POINT_PATCH = 26,
_PRIMITIVE_20_CONTROL_POINT_PATCH = 27,
_PRIMITIVE_21_CONTROL_POINT_PATCH = 28,
_PRIMITIVE_22_CONTROL_POINT_PATCH = 29,
_PRIMITIVE_23_CONTROL_POINT_PATCH = 30,
_PRIMITIVE_24_CONTROL_POINT_PATCH = 31,
_PRIMITIVE_25_CONTROL_POINT_PATCH = 32,
_PRIMITIVE_26_CONTROL_POINT_PATCH = 33,
_PRIMITIVE_27_CONTROL_POINT_PATCH = 34,
_PRIMITIVE_28_CONTROL_POINT_PATCH = 35,
_PRIMITIVE_29_CONTROL_POINT_PATCH = 36,
_PRIMITIVE_30_CONTROL_POINT_PATCH = 37,
_PRIMITIVE_31_CONTROL_POINT_PATCH = 38,
_PRIMITIVE_32_CONTROL_POINT_PATCH = 39,
// @"10_PRIMITIVE_UNDEFINED" = 0, this enum value conflicts with _PRIMITIVE_UNDEFINED
// @"10_PRIMITIVE_POINT" = 1, this enum value conflicts with _PRIMITIVE_POINT
// @"10_PRIMITIVE_LINE" = 2, this enum value conflicts with _PRIMITIVE_LINE
// @"10_PRIMITIVE_TRIANGLE" = 3, this enum value conflicts with _PRIMITIVE_TRIANGLE
// @"10_PRIMITIVE_LINE_ADJ" = 6, this enum value conflicts with _PRIMITIVE_LINE_ADJ
// @"10_PRIMITIVE_TRIANGLE_ADJ" = 7, this enum value conflicts with _PRIMITIVE_TRIANGLE_ADJ
// @"11_PRIMITIVE_UNDEFINED" = 0, this enum value conflicts with _PRIMITIVE_UNDEFINED
// @"11_PRIMITIVE_POINT" = 1, this enum value conflicts with _PRIMITIVE_POINT
// @"11_PRIMITIVE_LINE" = 2, this enum value conflicts with _PRIMITIVE_LINE
// @"11_PRIMITIVE_TRIANGLE" = 3, this enum value conflicts with _PRIMITIVE_TRIANGLE
// @"11_PRIMITIVE_LINE_ADJ" = 6, this enum value conflicts with _PRIMITIVE_LINE_ADJ
// @"11_PRIMITIVE_TRIANGLE_ADJ" = 7, this enum value conflicts with _PRIMITIVE_TRIANGLE_ADJ
// @"11_PRIMITIVE_1_CONTROL_POINT_PATCH" = 8, this enum value conflicts with _PRIMITIVE_1_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_2_CONTROL_POINT_PATCH" = 9, this enum value conflicts with _PRIMITIVE_2_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_3_CONTROL_POINT_PATCH" = 10, this enum value conflicts with _PRIMITIVE_3_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_4_CONTROL_POINT_PATCH" = 11, this enum value conflicts with _PRIMITIVE_4_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_5_CONTROL_POINT_PATCH" = 12, this enum value conflicts with _PRIMITIVE_5_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_6_CONTROL_POINT_PATCH" = 13, this enum value conflicts with _PRIMITIVE_6_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_7_CONTROL_POINT_PATCH" = 14, this enum value conflicts with _PRIMITIVE_7_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_8_CONTROL_POINT_PATCH" = 15, this enum value conflicts with _PRIMITIVE_8_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_9_CONTROL_POINT_PATCH" = 16, this enum value conflicts with _PRIMITIVE_9_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_10_CONTROL_POINT_PATCH" = 17, this enum value conflicts with _PRIMITIVE_10_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_11_CONTROL_POINT_PATCH" = 18, this enum value conflicts with _PRIMITIVE_11_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_12_CONTROL_POINT_PATCH" = 19, this enum value conflicts with _PRIMITIVE_12_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_13_CONTROL_POINT_PATCH" = 20, this enum value conflicts with _PRIMITIVE_13_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_14_CONTROL_POINT_PATCH" = 21, this enum value conflicts with _PRIMITIVE_14_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_15_CONTROL_POINT_PATCH" = 22, this enum value conflicts with _PRIMITIVE_15_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_16_CONTROL_POINT_PATCH" = 23, this enum value conflicts with _PRIMITIVE_16_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_17_CONTROL_POINT_PATCH" = 24, this enum value conflicts with _PRIMITIVE_17_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_18_CONTROL_POINT_PATCH" = 25, this enum value conflicts with _PRIMITIVE_18_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_19_CONTROL_POINT_PATCH" = 26, this enum value conflicts with _PRIMITIVE_19_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_20_CONTROL_POINT_PATCH" = 27, this enum value conflicts with _PRIMITIVE_20_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_21_CONTROL_POINT_PATCH" = 28, this enum value conflicts with _PRIMITIVE_21_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_22_CONTROL_POINT_PATCH" = 29, this enum value conflicts with _PRIMITIVE_22_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_23_CONTROL_POINT_PATCH" = 30, this enum value conflicts with _PRIMITIVE_23_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_24_CONTROL_POINT_PATCH" = 31, this enum value conflicts with _PRIMITIVE_24_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_25_CONTROL_POINT_PATCH" = 32, this enum value conflicts with _PRIMITIVE_25_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_26_CONTROL_POINT_PATCH" = 33, this enum value conflicts with _PRIMITIVE_26_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_27_CONTROL_POINT_PATCH" = 34, this enum value conflicts with _PRIMITIVE_27_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_28_CONTROL_POINT_PATCH" = 35, this enum value conflicts with _PRIMITIVE_28_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_29_CONTROL_POINT_PATCH" = 36, this enum value conflicts with _PRIMITIVE_29_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_30_CONTROL_POINT_PATCH" = 37, this enum value conflicts with _PRIMITIVE_30_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_31_CONTROL_POINT_PATCH" = 38, this enum value conflicts with _PRIMITIVE_31_CONTROL_POINT_PATCH
// @"11_PRIMITIVE_32_CONTROL_POINT_PATCH" = 39, this enum value conflicts with _PRIMITIVE_32_CONTROL_POINT_PATCH
};
pub const D3D_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE._PRIMITIVE_UNDEFINED;
pub const D3D_PRIMITIVE_POINT = D3D_PRIMITIVE._PRIMITIVE_POINT;
pub const D3D_PRIMITIVE_LINE = D3D_PRIMITIVE._PRIMITIVE_LINE;
pub const D3D_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE._PRIMITIVE_TRIANGLE;
pub const D3D_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE._PRIMITIVE_LINE_ADJ;
pub const D3D_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE._PRIMITIVE_TRIANGLE_ADJ;
pub const D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_1_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_2_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_3_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_4_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_5_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_6_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_7_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_8_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_9_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_10_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_11_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_12_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_13_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_14_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_15_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_16_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_17_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_18_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_19_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_20_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_21_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_22_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_23_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_24_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_25_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_26_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_27_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_28_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_29_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_30_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_31_CONTROL_POINT_PATCH;
pub const D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_32_CONTROL_POINT_PATCH;
pub const D3D10_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE._PRIMITIVE_UNDEFINED;
pub const D3D10_PRIMITIVE_POINT = D3D_PRIMITIVE._PRIMITIVE_POINT;
pub const D3D10_PRIMITIVE_LINE = D3D_PRIMITIVE._PRIMITIVE_LINE;
pub const D3D10_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE._PRIMITIVE_TRIANGLE;
pub const D3D10_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE._PRIMITIVE_LINE_ADJ;
pub const D3D10_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE._PRIMITIVE_TRIANGLE_ADJ;
pub const D3D11_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE._PRIMITIVE_UNDEFINED;
pub const D3D11_PRIMITIVE_POINT = D3D_PRIMITIVE._PRIMITIVE_POINT;
pub const D3D11_PRIMITIVE_LINE = D3D_PRIMITIVE._PRIMITIVE_LINE;
pub const D3D11_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE._PRIMITIVE_TRIANGLE;
pub const D3D11_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE._PRIMITIVE_LINE_ADJ;
pub const D3D11_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE._PRIMITIVE_TRIANGLE_ADJ;
pub const D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_1_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_2_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_3_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_4_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_5_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_6_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_7_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_8_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_9_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_10_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_11_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_12_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_13_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_14_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_15_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_16_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_17_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_18_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_19_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_20_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_21_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_22_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_23_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_24_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_25_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_26_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_27_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_28_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_29_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_30_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_31_CONTROL_POINT_PATCH;
pub const D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE._PRIMITIVE_32_CONTROL_POINT_PATCH;
pub const D3D_SRV_DIMENSION = enum(i32) {
_SRV_DIMENSION_UNKNOWN = 0,
_SRV_DIMENSION_BUFFER = 1,
_SRV_DIMENSION_TEXTURE1D = 2,
_SRV_DIMENSION_TEXTURE1DARRAY = 3,
_SRV_DIMENSION_TEXTURE2D = 4,
_SRV_DIMENSION_TEXTURE2DARRAY = 5,
_SRV_DIMENSION_TEXTURE2DMS = 6,
_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
_SRV_DIMENSION_TEXTURE3D = 8,
_SRV_DIMENSION_TEXTURECUBE = 9,
_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
_SRV_DIMENSION_BUFFEREX = 11,
// @"10_SRV_DIMENSION_UNKNOWN" = 0, this enum value conflicts with _SRV_DIMENSION_UNKNOWN
// @"10_SRV_DIMENSION_BUFFER" = 1, this enum value conflicts with _SRV_DIMENSION_BUFFER
// @"10_SRV_DIMENSION_TEXTURE1D" = 2, this enum value conflicts with _SRV_DIMENSION_TEXTURE1D
// @"10_SRV_DIMENSION_TEXTURE1DARRAY" = 3, this enum value conflicts with _SRV_DIMENSION_TEXTURE1DARRAY
// @"10_SRV_DIMENSION_TEXTURE2D" = 4, this enum value conflicts with _SRV_DIMENSION_TEXTURE2D
// @"10_SRV_DIMENSION_TEXTURE2DARRAY" = 5, this enum value conflicts with _SRV_DIMENSION_TEXTURE2DARRAY
// @"10_SRV_DIMENSION_TEXTURE2DMS" = 6, this enum value conflicts with _SRV_DIMENSION_TEXTURE2DMS
// @"10_SRV_DIMENSION_TEXTURE2DMSARRAY" = 7, this enum value conflicts with _SRV_DIMENSION_TEXTURE2DMSARRAY
// @"10_SRV_DIMENSION_TEXTURE3D" = 8, this enum value conflicts with _SRV_DIMENSION_TEXTURE3D
// @"10_SRV_DIMENSION_TEXTURECUBE" = 9, this enum value conflicts with _SRV_DIMENSION_TEXTURECUBE
// @"10_1_SRV_DIMENSION_UNKNOWN" = 0, this enum value conflicts with _SRV_DIMENSION_UNKNOWN
// @"10_1_SRV_DIMENSION_BUFFER" = 1, this enum value conflicts with _SRV_DIMENSION_BUFFER
// @"10_1_SRV_DIMENSION_TEXTURE1D" = 2, this enum value conflicts with _SRV_DIMENSION_TEXTURE1D
// @"10_1_SRV_DIMENSION_TEXTURE1DARRAY" = 3, this enum value conflicts with _SRV_DIMENSION_TEXTURE1DARRAY
// @"10_1_SRV_DIMENSION_TEXTURE2D" = 4, this enum value conflicts with _SRV_DIMENSION_TEXTURE2D
// @"10_1_SRV_DIMENSION_TEXTURE2DARRAY" = 5, this enum value conflicts with _SRV_DIMENSION_TEXTURE2DARRAY
// @"10_1_SRV_DIMENSION_TEXTURE2DMS" = 6, this enum value conflicts with _SRV_DIMENSION_TEXTURE2DMS
// @"10_1_SRV_DIMENSION_TEXTURE2DMSARRAY" = 7, this enum value conflicts with _SRV_DIMENSION_TEXTURE2DMSARRAY
// @"10_1_SRV_DIMENSION_TEXTURE3D" = 8, this enum value conflicts with _SRV_DIMENSION_TEXTURE3D
// @"10_1_SRV_DIMENSION_TEXTURECUBE" = 9, this enum value conflicts with _SRV_DIMENSION_TEXTURECUBE
// @"10_1_SRV_DIMENSION_TEXTURECUBEARRAY" = 10, this enum value conflicts with _SRV_DIMENSION_TEXTURECUBEARRAY
// @"11_SRV_DIMENSION_UNKNOWN" = 0, this enum value conflicts with _SRV_DIMENSION_UNKNOWN
// @"11_SRV_DIMENSION_BUFFER" = 1, this enum value conflicts with _SRV_DIMENSION_BUFFER
// @"11_SRV_DIMENSION_TEXTURE1D" = 2, this enum value conflicts with _SRV_DIMENSION_TEXTURE1D
// @"11_SRV_DIMENSION_TEXTURE1DARRAY" = 3, this enum value conflicts with _SRV_DIMENSION_TEXTURE1DARRAY
// @"11_SRV_DIMENSION_TEXTURE2D" = 4, this enum value conflicts with _SRV_DIMENSION_TEXTURE2D
// @"11_SRV_DIMENSION_TEXTURE2DARRAY" = 5, this enum value conflicts with _SRV_DIMENSION_TEXTURE2DARRAY
// @"11_SRV_DIMENSION_TEXTURE2DMS" = 6, this enum value conflicts with _SRV_DIMENSION_TEXTURE2DMS
// @"11_SRV_DIMENSION_TEXTURE2DMSARRAY" = 7, this enum value conflicts with _SRV_DIMENSION_TEXTURE2DMSARRAY
// @"11_SRV_DIMENSION_TEXTURE3D" = 8, this enum value conflicts with _SRV_DIMENSION_TEXTURE3D
// @"11_SRV_DIMENSION_TEXTURECUBE" = 9, this enum value conflicts with _SRV_DIMENSION_TEXTURECUBE
// @"11_SRV_DIMENSION_TEXTURECUBEARRAY" = 10, this enum value conflicts with _SRV_DIMENSION_TEXTURECUBEARRAY
// @"11_SRV_DIMENSION_BUFFEREX" = 11, this enum value conflicts with _SRV_DIMENSION_BUFFEREX
};
pub const D3D_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION._SRV_DIMENSION_UNKNOWN;
pub const D3D_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION._SRV_DIMENSION_BUFFER;
pub const D3D_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE1D;
pub const D3D_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE1DARRAY;
pub const D3D_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2D;
pub const D3D_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DARRAY;
pub const D3D_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DMS;
pub const D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DMSARRAY;
pub const D3D_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE3D;
pub const D3D_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURECUBE;
pub const D3D_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURECUBEARRAY;
pub const D3D_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION._SRV_DIMENSION_BUFFEREX;
pub const D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION._SRV_DIMENSION_UNKNOWN;
pub const D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION._SRV_DIMENSION_BUFFER;
pub const D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE1D;
pub const D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE1DARRAY;
pub const D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2D;
pub const D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DARRAY;
pub const D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DMS;
pub const D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DMSARRAY;
pub const D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE3D;
pub const D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURECUBE;
pub const D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION._SRV_DIMENSION_UNKNOWN;
pub const D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION._SRV_DIMENSION_BUFFER;
pub const D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE1D;
pub const D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE1DARRAY;
pub const D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2D;
pub const D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DARRAY;
pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DMS;
pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DMSARRAY;
pub const D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE3D;
pub const D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURECUBE;
pub const D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURECUBEARRAY;
pub const D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION._SRV_DIMENSION_UNKNOWN;
pub const D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION._SRV_DIMENSION_BUFFER;
pub const D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE1D;
pub const D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE1DARRAY;
pub const D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2D;
pub const D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DARRAY;
pub const D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DMS;
pub const D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE2DMSARRAY;
pub const D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURE3D;
pub const D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURECUBE;
pub const D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION._SRV_DIMENSION_TEXTURECUBEARRAY;
pub const D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION._SRV_DIMENSION_BUFFEREX;
pub const D3D_SHADER_MACRO = extern struct {
Name: ?[*:0]const u8,
Definition: ?[*:0]const u8,
};
const IID_ID3DBlob_Value = Guid.initString("8ba5fb08-5195-40e2-ac58-0d989c3a0102");
pub const IID_ID3DBlob = &IID_ID3DBlob_Value;
pub const ID3DBlob = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetBufferPointer: fn(
self: *const ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) ?*anyopaque,
GetBufferSize: fn(
self: *const ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) usize,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DBlob_GetBufferPointer(self: *const T) callconv(.Inline) ?*anyopaque {
return @ptrCast(*const ID3DBlob.VTable, self.vtable).GetBufferPointer(@ptrCast(*const ID3DBlob, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DBlob_GetBufferSize(self: *const T) callconv(.Inline) usize {
return @ptrCast(*const ID3DBlob.VTable, self.vtable).GetBufferSize(@ptrCast(*const ID3DBlob, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const PFN_DESTRUCTION_CALLBACK = fn(
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void;
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3DDestructionNotifier_Value = Guid.initString("a06eb39a-50da-425b-8c31-4eecd6c270f3");
pub const IID_ID3DDestructionNotifier = &IID_ID3DDestructionNotifier_Value;
pub const ID3DDestructionNotifier = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
RegisterDestructionCallback: fn(
self: *const ID3DDestructionNotifier,
callbackFn: ?PFN_DESTRUCTION_CALLBACK,
pData: ?*anyopaque,
pCallbackID: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnregisterDestructionCallback: fn(
self: *const ID3DDestructionNotifier,
callbackID: 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 ID3DDestructionNotifier_RegisterDestructionCallback(self: *const T, callbackFn: ?PFN_DESTRUCTION_CALLBACK, pData: ?*anyopaque, pCallbackID: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DDestructionNotifier.VTable, self.vtable).RegisterDestructionCallback(@ptrCast(*const ID3DDestructionNotifier, self), callbackFn, pData, pCallbackID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DDestructionNotifier_UnregisterDestructionCallback(self: *const T, callbackID: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DDestructionNotifier.VTable, self.vtable).UnregisterDestructionCallback(@ptrCast(*const ID3DDestructionNotifier, self), callbackID);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D_INCLUDE_TYPE = enum(i32) {
_INCLUDE_LOCAL = 0,
_INCLUDE_SYSTEM = 1,
// @"10_INCLUDE_LOCAL" = 0, this enum value conflicts with _INCLUDE_LOCAL
// @"10_INCLUDE_SYSTEM" = 1, this enum value conflicts with _INCLUDE_SYSTEM
_INCLUDE_FORCE_DWORD = 2147483647,
};
pub const D3D_INCLUDE_LOCAL = D3D_INCLUDE_TYPE._INCLUDE_LOCAL;
pub const D3D_INCLUDE_SYSTEM = D3D_INCLUDE_TYPE._INCLUDE_SYSTEM;
pub const D3D10_INCLUDE_LOCAL = D3D_INCLUDE_TYPE._INCLUDE_LOCAL;
pub const D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_TYPE._INCLUDE_SYSTEM;
pub const D3D_INCLUDE_FORCE_DWORD = D3D_INCLUDE_TYPE._INCLUDE_FORCE_DWORD;
pub const ID3DInclude = extern struct {
pub const VTable = extern struct {
Open: fn(
self: *const ID3DInclude,
IncludeType: D3D_INCLUDE_TYPE,
pFileName: ?[*:0]const u8,
pParentData: ?*const anyopaque,
ppData: ?*?*anyopaque,
pBytes: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Close: fn(
self: *const ID3DInclude,
pData: ?*const anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
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 ID3DInclude_Open(self: *const T, IncludeType: D3D_INCLUDE_TYPE, pFileName: ?[*:0]const u8, pParentData: ?*const anyopaque, ppData: ?*?*anyopaque, pBytes: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DInclude.VTable, self.vtable).Open(@ptrCast(*const ID3DInclude, self), IncludeType, pFileName, pParentData, ppData, pBytes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DInclude_Close(self: *const T, pData: ?*const anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DInclude.VTable, self.vtable).Close(@ptrCast(*const ID3DInclude, self), pData);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D_SHADER_VARIABLE_CLASS = enum(i32) {
_SVC_SCALAR = 0,
_SVC_VECTOR = 1,
_SVC_MATRIX_ROWS = 2,
_SVC_MATRIX_COLUMNS = 3,
_SVC_OBJECT = 4,
_SVC_STRUCT = 5,
_SVC_INTERFACE_CLASS = 6,
_SVC_INTERFACE_POINTER = 7,
// @"10_SVC_SCALAR" = 0, this enum value conflicts with _SVC_SCALAR
// @"10_SVC_VECTOR" = 1, this enum value conflicts with _SVC_VECTOR
// @"10_SVC_MATRIX_ROWS" = 2, this enum value conflicts with _SVC_MATRIX_ROWS
// @"10_SVC_MATRIX_COLUMNS" = 3, this enum value conflicts with _SVC_MATRIX_COLUMNS
// @"10_SVC_OBJECT" = 4, this enum value conflicts with _SVC_OBJECT
// @"10_SVC_STRUCT" = 5, this enum value conflicts with _SVC_STRUCT
// @"11_SVC_INTERFACE_CLASS" = 6, this enum value conflicts with _SVC_INTERFACE_CLASS
// @"11_SVC_INTERFACE_POINTER" = 7, this enum value conflicts with _SVC_INTERFACE_POINTER
_SVC_FORCE_DWORD = 2147483647,
};
pub const D3D_SVC_SCALAR = D3D_SHADER_VARIABLE_CLASS._SVC_SCALAR;
pub const D3D_SVC_VECTOR = D3D_SHADER_VARIABLE_CLASS._SVC_VECTOR;
pub const D3D_SVC_MATRIX_ROWS = D3D_SHADER_VARIABLE_CLASS._SVC_MATRIX_ROWS;
pub const D3D_SVC_MATRIX_COLUMNS = D3D_SHADER_VARIABLE_CLASS._SVC_MATRIX_COLUMNS;
pub const D3D_SVC_OBJECT = D3D_SHADER_VARIABLE_CLASS._SVC_OBJECT;
pub const D3D_SVC_STRUCT = D3D_SHADER_VARIABLE_CLASS._SVC_STRUCT;
pub const D3D_SVC_INTERFACE_CLASS = D3D_SHADER_VARIABLE_CLASS._SVC_INTERFACE_CLASS;
pub const D3D_SVC_INTERFACE_POINTER = D3D_SHADER_VARIABLE_CLASS._SVC_INTERFACE_POINTER;
pub const D3D10_SVC_SCALAR = D3D_SHADER_VARIABLE_CLASS._SVC_SCALAR;
pub const D3D10_SVC_VECTOR = D3D_SHADER_VARIABLE_CLASS._SVC_VECTOR;
pub const D3D10_SVC_MATRIX_ROWS = D3D_SHADER_VARIABLE_CLASS._SVC_MATRIX_ROWS;
pub const D3D10_SVC_MATRIX_COLUMNS = D3D_SHADER_VARIABLE_CLASS._SVC_MATRIX_COLUMNS;
pub const D3D10_SVC_OBJECT = D3D_SHADER_VARIABLE_CLASS._SVC_OBJECT;
pub const D3D10_SVC_STRUCT = D3D_SHADER_VARIABLE_CLASS._SVC_STRUCT;
pub const D3D11_SVC_INTERFACE_CLASS = D3D_SHADER_VARIABLE_CLASS._SVC_INTERFACE_CLASS;
pub const D3D11_SVC_INTERFACE_POINTER = D3D_SHADER_VARIABLE_CLASS._SVC_INTERFACE_POINTER;
pub const D3D_SVC_FORCE_DWORD = D3D_SHADER_VARIABLE_CLASS._SVC_FORCE_DWORD;
pub const D3D_SHADER_VARIABLE_FLAGS = enum(i32) {
_SVF_USERPACKED = 1,
_SVF_USED = 2,
_SVF_INTERFACE_POINTER = 4,
_SVF_INTERFACE_PARAMETER = 8,
// @"10_SVF_USERPACKED" = 1, this enum value conflicts with _SVF_USERPACKED
// @"10_SVF_USED" = 2, this enum value conflicts with _SVF_USED
// @"11_SVF_INTERFACE_POINTER" = 4, this enum value conflicts with _SVF_INTERFACE_POINTER
// @"11_SVF_INTERFACE_PARAMETER" = 8, this enum value conflicts with _SVF_INTERFACE_PARAMETER
_SVF_FORCE_DWORD = 2147483647,
};
pub const D3D_SVF_USERPACKED = D3D_SHADER_VARIABLE_FLAGS._SVF_USERPACKED;
pub const D3D_SVF_USED = D3D_SHADER_VARIABLE_FLAGS._SVF_USED;
pub const D3D_SVF_INTERFACE_POINTER = D3D_SHADER_VARIABLE_FLAGS._SVF_INTERFACE_POINTER;
pub const D3D_SVF_INTERFACE_PARAMETER = D3D_SHADER_VARIABLE_FLAGS._SVF_INTERFACE_PARAMETER;
pub const D3D10_SVF_USERPACKED = D3D_SHADER_VARIABLE_FLAGS._SVF_USERPACKED;
pub const D3D10_SVF_USED = D3D_SHADER_VARIABLE_FLAGS._SVF_USED;
pub const D3D11_SVF_INTERFACE_POINTER = D3D_SHADER_VARIABLE_FLAGS._SVF_INTERFACE_POINTER;
pub const D3D11_SVF_INTERFACE_PARAMETER = D3D_SHADER_VARIABLE_FLAGS._SVF_INTERFACE_PARAMETER;
pub const D3D_SVF_FORCE_DWORD = D3D_SHADER_VARIABLE_FLAGS._SVF_FORCE_DWORD;
pub const D3D_SHADER_VARIABLE_TYPE = enum(i32) {
_SVT_VOID = 0,
_SVT_BOOL = 1,
_SVT_INT = 2,
_SVT_FLOAT = 3,
_SVT_STRING = 4,
_SVT_TEXTURE = 5,
_SVT_TEXTURE1D = 6,
_SVT_TEXTURE2D = 7,
_SVT_TEXTURE3D = 8,
_SVT_TEXTURECUBE = 9,
_SVT_SAMPLER = 10,
_SVT_SAMPLER1D = 11,
_SVT_SAMPLER2D = 12,
_SVT_SAMPLER3D = 13,
_SVT_SAMPLERCUBE = 14,
_SVT_PIXELSHADER = 15,
_SVT_VERTEXSHADER = 16,
_SVT_PIXELFRAGMENT = 17,
_SVT_VERTEXFRAGMENT = 18,
_SVT_UINT = 19,
_SVT_UINT8 = 20,
_SVT_GEOMETRYSHADER = 21,
_SVT_RASTERIZER = 22,
_SVT_DEPTHSTENCIL = 23,
_SVT_BLEND = 24,
_SVT_BUFFER = 25,
_SVT_CBUFFER = 26,
_SVT_TBUFFER = 27,
_SVT_TEXTURE1DARRAY = 28,
_SVT_TEXTURE2DARRAY = 29,
_SVT_RENDERTARGETVIEW = 30,
_SVT_DEPTHSTENCILVIEW = 31,
_SVT_TEXTURE2DMS = 32,
_SVT_TEXTURE2DMSARRAY = 33,
_SVT_TEXTURECUBEARRAY = 34,
_SVT_HULLSHADER = 35,
_SVT_DOMAINSHADER = 36,
_SVT_INTERFACE_POINTER = 37,
_SVT_COMPUTESHADER = 38,
_SVT_DOUBLE = 39,
_SVT_RWTEXTURE1D = 40,
_SVT_RWTEXTURE1DARRAY = 41,
_SVT_RWTEXTURE2D = 42,
_SVT_RWTEXTURE2DARRAY = 43,
_SVT_RWTEXTURE3D = 44,
_SVT_RWBUFFER = 45,
_SVT_BYTEADDRESS_BUFFER = 46,
_SVT_RWBYTEADDRESS_BUFFER = 47,
_SVT_STRUCTURED_BUFFER = 48,
_SVT_RWSTRUCTURED_BUFFER = 49,
_SVT_APPEND_STRUCTURED_BUFFER = 50,
_SVT_CONSUME_STRUCTURED_BUFFER = 51,
_SVT_MIN8FLOAT = 52,
_SVT_MIN10FLOAT = 53,
_SVT_MIN16FLOAT = 54,
_SVT_MIN12INT = 55,
_SVT_MIN16INT = 56,
_SVT_MIN16UINT = 57,
_SVT_INT16 = 58,
_SVT_UINT16 = 59,
_SVT_FLOAT16 = 60,
_SVT_INT64 = 61,
_SVT_UINT64 = 62,
// @"10_SVT_VOID" = 0, this enum value conflicts with _SVT_VOID
// @"10_SVT_BOOL" = 1, this enum value conflicts with _SVT_BOOL
// @"10_SVT_INT" = 2, this enum value conflicts with _SVT_INT
// @"10_SVT_FLOAT" = 3, this enum value conflicts with _SVT_FLOAT
// @"10_SVT_STRING" = 4, this enum value conflicts with _SVT_STRING
// @"10_SVT_TEXTURE" = 5, this enum value conflicts with _SVT_TEXTURE
// @"10_SVT_TEXTURE1D" = 6, this enum value conflicts with _SVT_TEXTURE1D
// @"10_SVT_TEXTURE2D" = 7, this enum value conflicts with _SVT_TEXTURE2D
// @"10_SVT_TEXTURE3D" = 8, this enum value conflicts with _SVT_TEXTURE3D
// @"10_SVT_TEXTURECUBE" = 9, this enum value conflicts with _SVT_TEXTURECUBE
// @"10_SVT_SAMPLER" = 10, this enum value conflicts with _SVT_SAMPLER
// @"10_SVT_SAMPLER1D" = 11, this enum value conflicts with _SVT_SAMPLER1D
// @"10_SVT_SAMPLER2D" = 12, this enum value conflicts with _SVT_SAMPLER2D
// @"10_SVT_SAMPLER3D" = 13, this enum value conflicts with _SVT_SAMPLER3D
// @"10_SVT_SAMPLERCUBE" = 14, this enum value conflicts with _SVT_SAMPLERCUBE
// @"10_SVT_PIXELSHADER" = 15, this enum value conflicts with _SVT_PIXELSHADER
// @"10_SVT_VERTEXSHADER" = 16, this enum value conflicts with _SVT_VERTEXSHADER
// @"10_SVT_PIXELFRAGMENT" = 17, this enum value conflicts with _SVT_PIXELFRAGMENT
// @"10_SVT_VERTEXFRAGMENT" = 18, this enum value conflicts with _SVT_VERTEXFRAGMENT
// @"10_SVT_UINT" = 19, this enum value conflicts with _SVT_UINT
// @"10_SVT_UINT8" = 20, this enum value conflicts with _SVT_UINT8
// @"10_SVT_GEOMETRYSHADER" = 21, this enum value conflicts with _SVT_GEOMETRYSHADER
// @"10_SVT_RASTERIZER" = 22, this enum value conflicts with _SVT_RASTERIZER
// @"10_SVT_DEPTHSTENCIL" = 23, this enum value conflicts with _SVT_DEPTHSTENCIL
// @"10_SVT_BLEND" = 24, this enum value conflicts with _SVT_BLEND
// @"10_SVT_BUFFER" = 25, this enum value conflicts with _SVT_BUFFER
// @"10_SVT_CBUFFER" = 26, this enum value conflicts with _SVT_CBUFFER
// @"10_SVT_TBUFFER" = 27, this enum value conflicts with _SVT_TBUFFER
// @"10_SVT_TEXTURE1DARRAY" = 28, this enum value conflicts with _SVT_TEXTURE1DARRAY
// @"10_SVT_TEXTURE2DARRAY" = 29, this enum value conflicts with _SVT_TEXTURE2DARRAY
// @"10_SVT_RENDERTARGETVIEW" = 30, this enum value conflicts with _SVT_RENDERTARGETVIEW
// @"10_SVT_DEPTHSTENCILVIEW" = 31, this enum value conflicts with _SVT_DEPTHSTENCILVIEW
// @"10_SVT_TEXTURE2DMS" = 32, this enum value conflicts with _SVT_TEXTURE2DMS
// @"10_SVT_TEXTURE2DMSARRAY" = 33, this enum value conflicts with _SVT_TEXTURE2DMSARRAY
// @"10_SVT_TEXTURECUBEARRAY" = 34, this enum value conflicts with _SVT_TEXTURECUBEARRAY
// @"11_SVT_HULLSHADER" = 35, this enum value conflicts with _SVT_HULLSHADER
// @"11_SVT_DOMAINSHADER" = 36, this enum value conflicts with _SVT_DOMAINSHADER
// @"11_SVT_INTERFACE_POINTER" = 37, this enum value conflicts with _SVT_INTERFACE_POINTER
// @"11_SVT_COMPUTESHADER" = 38, this enum value conflicts with _SVT_COMPUTESHADER
// @"11_SVT_DOUBLE" = 39, this enum value conflicts with _SVT_DOUBLE
// @"11_SVT_RWTEXTURE1D" = 40, this enum value conflicts with _SVT_RWTEXTURE1D
// @"11_SVT_RWTEXTURE1DARRAY" = 41, this enum value conflicts with _SVT_RWTEXTURE1DARRAY
// @"11_SVT_RWTEXTURE2D" = 42, this enum value conflicts with _SVT_RWTEXTURE2D
// @"11_SVT_RWTEXTURE2DARRAY" = 43, this enum value conflicts with _SVT_RWTEXTURE2DARRAY
// @"11_SVT_RWTEXTURE3D" = 44, this enum value conflicts with _SVT_RWTEXTURE3D
// @"11_SVT_RWBUFFER" = 45, this enum value conflicts with _SVT_RWBUFFER
// @"11_SVT_BYTEADDRESS_BUFFER" = 46, this enum value conflicts with _SVT_BYTEADDRESS_BUFFER
// @"11_SVT_RWBYTEADDRESS_BUFFER" = 47, this enum value conflicts with _SVT_RWBYTEADDRESS_BUFFER
// @"11_SVT_STRUCTURED_BUFFER" = 48, this enum value conflicts with _SVT_STRUCTURED_BUFFER
// @"11_SVT_RWSTRUCTURED_BUFFER" = 49, this enum value conflicts with _SVT_RWSTRUCTURED_BUFFER
// @"11_SVT_APPEND_STRUCTURED_BUFFER" = 50, this enum value conflicts with _SVT_APPEND_STRUCTURED_BUFFER
// @"11_SVT_CONSUME_STRUCTURED_BUFFER" = 51, this enum value conflicts with _SVT_CONSUME_STRUCTURED_BUFFER
_SVT_FORCE_DWORD = 2147483647,
};
pub const D3D_SVT_VOID = D3D_SHADER_VARIABLE_TYPE._SVT_VOID;
pub const D3D_SVT_BOOL = D3D_SHADER_VARIABLE_TYPE._SVT_BOOL;
pub const D3D_SVT_INT = D3D_SHADER_VARIABLE_TYPE._SVT_INT;
pub const D3D_SVT_FLOAT = D3D_SHADER_VARIABLE_TYPE._SVT_FLOAT;
pub const D3D_SVT_STRING = D3D_SHADER_VARIABLE_TYPE._SVT_STRING;
pub const D3D_SVT_TEXTURE = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE;
pub const D3D_SVT_TEXTURE1D = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE1D;
pub const D3D_SVT_TEXTURE2D = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE2D;
pub const D3D_SVT_TEXTURE3D = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE3D;
pub const D3D_SVT_TEXTURECUBE = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURECUBE;
pub const D3D_SVT_SAMPLER = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLER;
pub const D3D_SVT_SAMPLER1D = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLER1D;
pub const D3D_SVT_SAMPLER2D = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLER2D;
pub const D3D_SVT_SAMPLER3D = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLER3D;
pub const D3D_SVT_SAMPLERCUBE = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLERCUBE;
pub const D3D_SVT_PIXELSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_PIXELSHADER;
pub const D3D_SVT_VERTEXSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_VERTEXSHADER;
pub const D3D_SVT_PIXELFRAGMENT = D3D_SHADER_VARIABLE_TYPE._SVT_PIXELFRAGMENT;
pub const D3D_SVT_VERTEXFRAGMENT = D3D_SHADER_VARIABLE_TYPE._SVT_VERTEXFRAGMENT;
pub const D3D_SVT_UINT = D3D_SHADER_VARIABLE_TYPE._SVT_UINT;
pub const D3D_SVT_UINT8 = D3D_SHADER_VARIABLE_TYPE._SVT_UINT8;
pub const D3D_SVT_GEOMETRYSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_GEOMETRYSHADER;
pub const D3D_SVT_RASTERIZER = D3D_SHADER_VARIABLE_TYPE._SVT_RASTERIZER;
pub const D3D_SVT_DEPTHSTENCIL = D3D_SHADER_VARIABLE_TYPE._SVT_DEPTHSTENCIL;
pub const D3D_SVT_BLEND = D3D_SHADER_VARIABLE_TYPE._SVT_BLEND;
pub const D3D_SVT_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_BUFFER;
pub const D3D_SVT_CBUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_CBUFFER;
pub const D3D_SVT_TBUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_TBUFFER;
pub const D3D_SVT_TEXTURE1DARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE1DARRAY;
pub const D3D_SVT_TEXTURE2DARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE2DARRAY;
pub const D3D_SVT_RENDERTARGETVIEW = D3D_SHADER_VARIABLE_TYPE._SVT_RENDERTARGETVIEW;
pub const D3D_SVT_DEPTHSTENCILVIEW = D3D_SHADER_VARIABLE_TYPE._SVT_DEPTHSTENCILVIEW;
pub const D3D_SVT_TEXTURE2DMS = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE2DMS;
pub const D3D_SVT_TEXTURE2DMSARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE2DMSARRAY;
pub const D3D_SVT_TEXTURECUBEARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURECUBEARRAY;
pub const D3D_SVT_HULLSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_HULLSHADER;
pub const D3D_SVT_DOMAINSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_DOMAINSHADER;
pub const D3D_SVT_INTERFACE_POINTER = D3D_SHADER_VARIABLE_TYPE._SVT_INTERFACE_POINTER;
pub const D3D_SVT_COMPUTESHADER = D3D_SHADER_VARIABLE_TYPE._SVT_COMPUTESHADER;
pub const D3D_SVT_DOUBLE = D3D_SHADER_VARIABLE_TYPE._SVT_DOUBLE;
pub const D3D_SVT_RWTEXTURE1D = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE1D;
pub const D3D_SVT_RWTEXTURE1DARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE1DARRAY;
pub const D3D_SVT_RWTEXTURE2D = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE2D;
pub const D3D_SVT_RWTEXTURE2DARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE2DARRAY;
pub const D3D_SVT_RWTEXTURE3D = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE3D;
pub const D3D_SVT_RWBUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_RWBUFFER;
pub const D3D_SVT_BYTEADDRESS_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_BYTEADDRESS_BUFFER;
pub const D3D_SVT_RWBYTEADDRESS_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_RWBYTEADDRESS_BUFFER;
pub const D3D_SVT_STRUCTURED_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_STRUCTURED_BUFFER;
pub const D3D_SVT_RWSTRUCTURED_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_RWSTRUCTURED_BUFFER;
pub const D3D_SVT_APPEND_STRUCTURED_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_APPEND_STRUCTURED_BUFFER;
pub const D3D_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_CONSUME_STRUCTURED_BUFFER;
pub const D3D_SVT_MIN8FLOAT = D3D_SHADER_VARIABLE_TYPE._SVT_MIN8FLOAT;
pub const D3D_SVT_MIN10FLOAT = D3D_SHADER_VARIABLE_TYPE._SVT_MIN10FLOAT;
pub const D3D_SVT_MIN16FLOAT = D3D_SHADER_VARIABLE_TYPE._SVT_MIN16FLOAT;
pub const D3D_SVT_MIN12INT = D3D_SHADER_VARIABLE_TYPE._SVT_MIN12INT;
pub const D3D_SVT_MIN16INT = D3D_SHADER_VARIABLE_TYPE._SVT_MIN16INT;
pub const D3D_SVT_MIN16UINT = D3D_SHADER_VARIABLE_TYPE._SVT_MIN16UINT;
pub const D3D_SVT_INT16 = D3D_SHADER_VARIABLE_TYPE._SVT_INT16;
pub const D3D_SVT_UINT16 = D3D_SHADER_VARIABLE_TYPE._SVT_UINT16;
pub const D3D_SVT_FLOAT16 = D3D_SHADER_VARIABLE_TYPE._SVT_FLOAT16;
pub const D3D_SVT_INT64 = D3D_SHADER_VARIABLE_TYPE._SVT_INT64;
pub const D3D_SVT_UINT64 = D3D_SHADER_VARIABLE_TYPE._SVT_UINT64;
pub const D3D10_SVT_VOID = D3D_SHADER_VARIABLE_TYPE._SVT_VOID;
pub const D3D10_SVT_BOOL = D3D_SHADER_VARIABLE_TYPE._SVT_BOOL;
pub const D3D10_SVT_INT = D3D_SHADER_VARIABLE_TYPE._SVT_INT;
pub const D3D10_SVT_FLOAT = D3D_SHADER_VARIABLE_TYPE._SVT_FLOAT;
pub const D3D10_SVT_STRING = D3D_SHADER_VARIABLE_TYPE._SVT_STRING;
pub const D3D10_SVT_TEXTURE = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE;
pub const D3D10_SVT_TEXTURE1D = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE1D;
pub const D3D10_SVT_TEXTURE2D = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE2D;
pub const D3D10_SVT_TEXTURE3D = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE3D;
pub const D3D10_SVT_TEXTURECUBE = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURECUBE;
pub const D3D10_SVT_SAMPLER = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLER;
pub const D3D10_SVT_SAMPLER1D = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLER1D;
pub const D3D10_SVT_SAMPLER2D = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLER2D;
pub const D3D10_SVT_SAMPLER3D = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLER3D;
pub const D3D10_SVT_SAMPLERCUBE = D3D_SHADER_VARIABLE_TYPE._SVT_SAMPLERCUBE;
pub const D3D10_SVT_PIXELSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_PIXELSHADER;
pub const D3D10_SVT_VERTEXSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_VERTEXSHADER;
pub const D3D10_SVT_PIXELFRAGMENT = D3D_SHADER_VARIABLE_TYPE._SVT_PIXELFRAGMENT;
pub const D3D10_SVT_VERTEXFRAGMENT = D3D_SHADER_VARIABLE_TYPE._SVT_VERTEXFRAGMENT;
pub const D3D10_SVT_UINT = D3D_SHADER_VARIABLE_TYPE._SVT_UINT;
pub const D3D10_SVT_UINT8 = D3D_SHADER_VARIABLE_TYPE._SVT_UINT8;
pub const D3D10_SVT_GEOMETRYSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_GEOMETRYSHADER;
pub const D3D10_SVT_RASTERIZER = D3D_SHADER_VARIABLE_TYPE._SVT_RASTERIZER;
pub const D3D10_SVT_DEPTHSTENCIL = D3D_SHADER_VARIABLE_TYPE._SVT_DEPTHSTENCIL;
pub const D3D10_SVT_BLEND = D3D_SHADER_VARIABLE_TYPE._SVT_BLEND;
pub const D3D10_SVT_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_BUFFER;
pub const D3D10_SVT_CBUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_CBUFFER;
pub const D3D10_SVT_TBUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_TBUFFER;
pub const D3D10_SVT_TEXTURE1DARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE1DARRAY;
pub const D3D10_SVT_TEXTURE2DARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE2DARRAY;
pub const D3D10_SVT_RENDERTARGETVIEW = D3D_SHADER_VARIABLE_TYPE._SVT_RENDERTARGETVIEW;
pub const D3D10_SVT_DEPTHSTENCILVIEW = D3D_SHADER_VARIABLE_TYPE._SVT_DEPTHSTENCILVIEW;
pub const D3D10_SVT_TEXTURE2DMS = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE2DMS;
pub const D3D10_SVT_TEXTURE2DMSARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURE2DMSARRAY;
pub const D3D10_SVT_TEXTURECUBEARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_TEXTURECUBEARRAY;
pub const D3D11_SVT_HULLSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_HULLSHADER;
pub const D3D11_SVT_DOMAINSHADER = D3D_SHADER_VARIABLE_TYPE._SVT_DOMAINSHADER;
pub const D3D11_SVT_INTERFACE_POINTER = D3D_SHADER_VARIABLE_TYPE._SVT_INTERFACE_POINTER;
pub const D3D11_SVT_COMPUTESHADER = D3D_SHADER_VARIABLE_TYPE._SVT_COMPUTESHADER;
pub const D3D11_SVT_DOUBLE = D3D_SHADER_VARIABLE_TYPE._SVT_DOUBLE;
pub const D3D11_SVT_RWTEXTURE1D = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE1D;
pub const D3D11_SVT_RWTEXTURE1DARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE1DARRAY;
pub const D3D11_SVT_RWTEXTURE2D = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE2D;
pub const D3D11_SVT_RWTEXTURE2DARRAY = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE2DARRAY;
pub const D3D11_SVT_RWTEXTURE3D = D3D_SHADER_VARIABLE_TYPE._SVT_RWTEXTURE3D;
pub const D3D11_SVT_RWBUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_RWBUFFER;
pub const D3D11_SVT_BYTEADDRESS_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_BYTEADDRESS_BUFFER;
pub const D3D11_SVT_RWBYTEADDRESS_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_RWBYTEADDRESS_BUFFER;
pub const D3D11_SVT_STRUCTURED_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_STRUCTURED_BUFFER;
pub const D3D11_SVT_RWSTRUCTURED_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_RWSTRUCTURED_BUFFER;
pub const D3D11_SVT_APPEND_STRUCTURED_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_APPEND_STRUCTURED_BUFFER;
pub const D3D11_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SHADER_VARIABLE_TYPE._SVT_CONSUME_STRUCTURED_BUFFER;
pub const D3D_SVT_FORCE_DWORD = D3D_SHADER_VARIABLE_TYPE._SVT_FORCE_DWORD;
pub const D3D_SHADER_INPUT_FLAGS = enum(i32) {
_SIF_USERPACKED = 1,
_SIF_COMPARISON_SAMPLER = 2,
_SIF_TEXTURE_COMPONENT_0 = 4,
_SIF_TEXTURE_COMPONENT_1 = 8,
_SIF_TEXTURE_COMPONENTS = 12,
_SIF_UNUSED = 16,
// @"10_SIF_USERPACKED" = 1, this enum value conflicts with _SIF_USERPACKED
// @"10_SIF_COMPARISON_SAMPLER" = 2, this enum value conflicts with _SIF_COMPARISON_SAMPLER
// @"10_SIF_TEXTURE_COMPONENT_0" = 4, this enum value conflicts with _SIF_TEXTURE_COMPONENT_0
// @"10_SIF_TEXTURE_COMPONENT_1" = 8, this enum value conflicts with _SIF_TEXTURE_COMPONENT_1
// @"10_SIF_TEXTURE_COMPONENTS" = 12, this enum value conflicts with _SIF_TEXTURE_COMPONENTS
_SIF_FORCE_DWORD = 2147483647,
};
pub const D3D_SIF_USERPACKED = D3D_SHADER_INPUT_FLAGS._SIF_USERPACKED;
pub const D3D_SIF_COMPARISON_SAMPLER = D3D_SHADER_INPUT_FLAGS._SIF_COMPARISON_SAMPLER;
pub const D3D_SIF_TEXTURE_COMPONENT_0 = D3D_SHADER_INPUT_FLAGS._SIF_TEXTURE_COMPONENT_0;
pub const D3D_SIF_TEXTURE_COMPONENT_1 = D3D_SHADER_INPUT_FLAGS._SIF_TEXTURE_COMPONENT_1;
pub const D3D_SIF_TEXTURE_COMPONENTS = D3D_SHADER_INPUT_FLAGS._SIF_TEXTURE_COMPONENTS;
pub const D3D_SIF_UNUSED = D3D_SHADER_INPUT_FLAGS._SIF_UNUSED;
pub const D3D10_SIF_USERPACKED = D3D_SHADER_INPUT_FLAGS._SIF_USERPACKED;
pub const D3D10_SIF_COMPARISON_SAMPLER = D3D_SHADER_INPUT_FLAGS._SIF_COMPARISON_SAMPLER;
pub const D3D10_SIF_TEXTURE_COMPONENT_0 = D3D_SHADER_INPUT_FLAGS._SIF_TEXTURE_COMPONENT_0;
pub const D3D10_SIF_TEXTURE_COMPONENT_1 = D3D_SHADER_INPUT_FLAGS._SIF_TEXTURE_COMPONENT_1;
pub const D3D10_SIF_TEXTURE_COMPONENTS = D3D_SHADER_INPUT_FLAGS._SIF_TEXTURE_COMPONENTS;
pub const D3D_SIF_FORCE_DWORD = D3D_SHADER_INPUT_FLAGS._SIF_FORCE_DWORD;
pub const D3D_SHADER_INPUT_TYPE = enum(i32) {
_SIT_CBUFFER = 0,
_SIT_TBUFFER = 1,
_SIT_TEXTURE = 2,
_SIT_SAMPLER = 3,
_SIT_UAV_RWTYPED = 4,
_SIT_STRUCTURED = 5,
_SIT_UAV_RWSTRUCTURED = 6,
_SIT_BYTEADDRESS = 7,
_SIT_UAV_RWBYTEADDRESS = 8,
_SIT_UAV_APPEND_STRUCTURED = 9,
_SIT_UAV_CONSUME_STRUCTURED = 10,
_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = 11,
_SIT_RTACCELERATIONSTRUCTURE = 12,
_SIT_UAV_FEEDBACKTEXTURE = 13,
// @"10_SIT_CBUFFER" = 0, this enum value conflicts with _SIT_CBUFFER
// @"10_SIT_TBUFFER" = 1, this enum value conflicts with _SIT_TBUFFER
// @"10_SIT_TEXTURE" = 2, this enum value conflicts with _SIT_TEXTURE
// @"10_SIT_SAMPLER" = 3, this enum value conflicts with _SIT_SAMPLER
// @"11_SIT_UAV_RWTYPED" = 4, this enum value conflicts with _SIT_UAV_RWTYPED
// @"11_SIT_STRUCTURED" = 5, this enum value conflicts with _SIT_STRUCTURED
// @"11_SIT_UAV_RWSTRUCTURED" = 6, this enum value conflicts with _SIT_UAV_RWSTRUCTURED
// @"11_SIT_BYTEADDRESS" = 7, this enum value conflicts with _SIT_BYTEADDRESS
// @"11_SIT_UAV_RWBYTEADDRESS" = 8, this enum value conflicts with _SIT_UAV_RWBYTEADDRESS
// @"11_SIT_UAV_APPEND_STRUCTURED" = 9, this enum value conflicts with _SIT_UAV_APPEND_STRUCTURED
// @"11_SIT_UAV_CONSUME_STRUCTURED" = 10, this enum value conflicts with _SIT_UAV_CONSUME_STRUCTURED
// @"11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER" = 11, this enum value conflicts with _SIT_UAV_RWSTRUCTURED_WITH_COUNTER
};
pub const D3D_SIT_CBUFFER = D3D_SHADER_INPUT_TYPE._SIT_CBUFFER;
pub const D3D_SIT_TBUFFER = D3D_SHADER_INPUT_TYPE._SIT_TBUFFER;
pub const D3D_SIT_TEXTURE = D3D_SHADER_INPUT_TYPE._SIT_TEXTURE;
pub const D3D_SIT_SAMPLER = D3D_SHADER_INPUT_TYPE._SIT_SAMPLER;
pub const D3D_SIT_UAV_RWTYPED = D3D_SHADER_INPUT_TYPE._SIT_UAV_RWTYPED;
pub const D3D_SIT_STRUCTURED = D3D_SHADER_INPUT_TYPE._SIT_STRUCTURED;
pub const D3D_SIT_UAV_RWSTRUCTURED = D3D_SHADER_INPUT_TYPE._SIT_UAV_RWSTRUCTURED;
pub const D3D_SIT_BYTEADDRESS = D3D_SHADER_INPUT_TYPE._SIT_BYTEADDRESS;
pub const D3D_SIT_UAV_RWBYTEADDRESS = D3D_SHADER_INPUT_TYPE._SIT_UAV_RWBYTEADDRESS;
pub const D3D_SIT_UAV_APPEND_STRUCTURED = D3D_SHADER_INPUT_TYPE._SIT_UAV_APPEND_STRUCTURED;
pub const D3D_SIT_UAV_CONSUME_STRUCTURED = D3D_SHADER_INPUT_TYPE._SIT_UAV_CONSUME_STRUCTURED;
pub const D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SHADER_INPUT_TYPE._SIT_UAV_RWSTRUCTURED_WITH_COUNTER;
pub const D3D_SIT_RTACCELERATIONSTRUCTURE = D3D_SHADER_INPUT_TYPE._SIT_RTACCELERATIONSTRUCTURE;
pub const D3D_SIT_UAV_FEEDBACKTEXTURE = D3D_SHADER_INPUT_TYPE._SIT_UAV_FEEDBACKTEXTURE;
pub const D3D10_SIT_CBUFFER = D3D_SHADER_INPUT_TYPE._SIT_CBUFFER;
pub const D3D10_SIT_TBUFFER = D3D_SHADER_INPUT_TYPE._SIT_TBUFFER;
pub const D3D10_SIT_TEXTURE = D3D_SHADER_INPUT_TYPE._SIT_TEXTURE;
pub const D3D10_SIT_SAMPLER = D3D_SHADER_INPUT_TYPE._SIT_SAMPLER;
pub const D3D11_SIT_UAV_RWTYPED = D3D_SHADER_INPUT_TYPE._SIT_UAV_RWTYPED;
pub const D3D11_SIT_STRUCTURED = D3D_SHADER_INPUT_TYPE._SIT_STRUCTURED;
pub const D3D11_SIT_UAV_RWSTRUCTURED = D3D_SHADER_INPUT_TYPE._SIT_UAV_RWSTRUCTURED;
pub const D3D11_SIT_BYTEADDRESS = D3D_SHADER_INPUT_TYPE._SIT_BYTEADDRESS;
pub const D3D11_SIT_UAV_RWBYTEADDRESS = D3D_SHADER_INPUT_TYPE._SIT_UAV_RWBYTEADDRESS;
pub const D3D11_SIT_UAV_APPEND_STRUCTURED = D3D_SHADER_INPUT_TYPE._SIT_UAV_APPEND_STRUCTURED;
pub const D3D11_SIT_UAV_CONSUME_STRUCTURED = D3D_SHADER_INPUT_TYPE._SIT_UAV_CONSUME_STRUCTURED;
pub const D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SHADER_INPUT_TYPE._SIT_UAV_RWSTRUCTURED_WITH_COUNTER;
pub const D3D_SHADER_CBUFFER_FLAGS = enum(i32) {
_CBF_USERPACKED = 1,
// @"10_CBF_USERPACKED" = 1, this enum value conflicts with _CBF_USERPACKED
_CBF_FORCE_DWORD = 2147483647,
};
pub const D3D_CBF_USERPACKED = D3D_SHADER_CBUFFER_FLAGS._CBF_USERPACKED;
pub const D3D10_CBF_USERPACKED = D3D_SHADER_CBUFFER_FLAGS._CBF_USERPACKED;
pub const D3D_CBF_FORCE_DWORD = D3D_SHADER_CBUFFER_FLAGS._CBF_FORCE_DWORD;
pub const D3D_CBUFFER_TYPE = enum(i32) {
_CT_CBUFFER = 0,
_CT_TBUFFER = 1,
_CT_INTERFACE_POINTERS = 2,
_CT_RESOURCE_BIND_INFO = 3,
// @"10_CT_CBUFFER" = 0, this enum value conflicts with _CT_CBUFFER
// @"10_CT_TBUFFER" = 1, this enum value conflicts with _CT_TBUFFER
// @"11_CT_CBUFFER" = 0, this enum value conflicts with _CT_CBUFFER
// @"11_CT_TBUFFER" = 1, this enum value conflicts with _CT_TBUFFER
// @"11_CT_INTERFACE_POINTERS" = 2, this enum value conflicts with _CT_INTERFACE_POINTERS
// @"11_CT_RESOURCE_BIND_INFO" = 3, this enum value conflicts with _CT_RESOURCE_BIND_INFO
};
pub const D3D_CT_CBUFFER = D3D_CBUFFER_TYPE._CT_CBUFFER;
pub const D3D_CT_TBUFFER = D3D_CBUFFER_TYPE._CT_TBUFFER;
pub const D3D_CT_INTERFACE_POINTERS = D3D_CBUFFER_TYPE._CT_INTERFACE_POINTERS;
pub const D3D_CT_RESOURCE_BIND_INFO = D3D_CBUFFER_TYPE._CT_RESOURCE_BIND_INFO;
pub const D3D10_CT_CBUFFER = D3D_CBUFFER_TYPE._CT_CBUFFER;
pub const D3D10_CT_TBUFFER = D3D_CBUFFER_TYPE._CT_TBUFFER;
pub const D3D11_CT_CBUFFER = D3D_CBUFFER_TYPE._CT_CBUFFER;
pub const D3D11_CT_TBUFFER = D3D_CBUFFER_TYPE._CT_TBUFFER;
pub const D3D11_CT_INTERFACE_POINTERS = D3D_CBUFFER_TYPE._CT_INTERFACE_POINTERS;
pub const D3D11_CT_RESOURCE_BIND_INFO = D3D_CBUFFER_TYPE._CT_RESOURCE_BIND_INFO;
pub const D3D_NAME = enum(i32) {
_NAME_UNDEFINED = 0,
_NAME_POSITION = 1,
_NAME_CLIP_DISTANCE = 2,
_NAME_CULL_DISTANCE = 3,
_NAME_RENDER_TARGET_ARRAY_INDEX = 4,
_NAME_VIEWPORT_ARRAY_INDEX = 5,
_NAME_VERTEX_ID = 6,
_NAME_PRIMITIVE_ID = 7,
_NAME_INSTANCE_ID = 8,
_NAME_IS_FRONT_FACE = 9,
_NAME_SAMPLE_INDEX = 10,
_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11,
_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12,
_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13,
_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14,
_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15,
_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16,
_NAME_BARYCENTRICS = 23,
_NAME_SHADINGRATE = 24,
_NAME_CULLPRIMITIVE = 25,
_NAME_TARGET = 64,
_NAME_DEPTH = 65,
_NAME_COVERAGE = 66,
_NAME_DEPTH_GREATER_EQUAL = 67,
_NAME_DEPTH_LESS_EQUAL = 68,
_NAME_STENCIL_REF = 69,
_NAME_INNER_COVERAGE = 70,
// @"10_NAME_UNDEFINED" = 0, this enum value conflicts with _NAME_UNDEFINED
// @"10_NAME_POSITION" = 1, this enum value conflicts with _NAME_POSITION
// @"10_NAME_CLIP_DISTANCE" = 2, this enum value conflicts with _NAME_CLIP_DISTANCE
// @"10_NAME_CULL_DISTANCE" = 3, this enum value conflicts with _NAME_CULL_DISTANCE
// @"10_NAME_RENDER_TARGET_ARRAY_INDEX" = 4, this enum value conflicts with _NAME_RENDER_TARGET_ARRAY_INDEX
// @"10_NAME_VIEWPORT_ARRAY_INDEX" = 5, this enum value conflicts with _NAME_VIEWPORT_ARRAY_INDEX
// @"10_NAME_VERTEX_ID" = 6, this enum value conflicts with _NAME_VERTEX_ID
// @"10_NAME_PRIMITIVE_ID" = 7, this enum value conflicts with _NAME_PRIMITIVE_ID
// @"10_NAME_INSTANCE_ID" = 8, this enum value conflicts with _NAME_INSTANCE_ID
// @"10_NAME_IS_FRONT_FACE" = 9, this enum value conflicts with _NAME_IS_FRONT_FACE
// @"10_NAME_SAMPLE_INDEX" = 10, this enum value conflicts with _NAME_SAMPLE_INDEX
// @"10_NAME_TARGET" = 64, this enum value conflicts with _NAME_TARGET
// @"10_NAME_DEPTH" = 65, this enum value conflicts with _NAME_DEPTH
// @"10_NAME_COVERAGE" = 66, this enum value conflicts with _NAME_COVERAGE
// @"11_NAME_FINAL_QUAD_EDGE_TESSFACTOR" = 11, this enum value conflicts with _NAME_FINAL_QUAD_EDGE_TESSFACTOR
// @"11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR" = 12, this enum value conflicts with _NAME_FINAL_QUAD_INSIDE_TESSFACTOR
// @"11_NAME_FINAL_TRI_EDGE_TESSFACTOR" = 13, this enum value conflicts with _NAME_FINAL_TRI_EDGE_TESSFACTOR
// @"11_NAME_FINAL_TRI_INSIDE_TESSFACTOR" = 14, this enum value conflicts with _NAME_FINAL_TRI_INSIDE_TESSFACTOR
// @"11_NAME_FINAL_LINE_DETAIL_TESSFACTOR" = 15, this enum value conflicts with _NAME_FINAL_LINE_DETAIL_TESSFACTOR
// @"11_NAME_FINAL_LINE_DENSITY_TESSFACTOR" = 16, this enum value conflicts with _NAME_FINAL_LINE_DENSITY_TESSFACTOR
// @"11_NAME_DEPTH_GREATER_EQUAL" = 67, this enum value conflicts with _NAME_DEPTH_GREATER_EQUAL
// @"11_NAME_DEPTH_LESS_EQUAL" = 68, this enum value conflicts with _NAME_DEPTH_LESS_EQUAL
// @"11_NAME_STENCIL_REF" = 69, this enum value conflicts with _NAME_STENCIL_REF
// @"11_NAME_INNER_COVERAGE" = 70, this enum value conflicts with _NAME_INNER_COVERAGE
// @"12_NAME_BARYCENTRICS" = 23, this enum value conflicts with _NAME_BARYCENTRICS
// @"12_NAME_SHADINGRATE" = 24, this enum value conflicts with _NAME_SHADINGRATE
// @"12_NAME_CULLPRIMITIVE" = 25, this enum value conflicts with _NAME_CULLPRIMITIVE
};
pub const D3D_NAME_UNDEFINED = D3D_NAME._NAME_UNDEFINED;
pub const D3D_NAME_POSITION = D3D_NAME._NAME_POSITION;
pub const D3D_NAME_CLIP_DISTANCE = D3D_NAME._NAME_CLIP_DISTANCE;
pub const D3D_NAME_CULL_DISTANCE = D3D_NAME._NAME_CULL_DISTANCE;
pub const D3D_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME._NAME_RENDER_TARGET_ARRAY_INDEX;
pub const D3D_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME._NAME_VIEWPORT_ARRAY_INDEX;
pub const D3D_NAME_VERTEX_ID = D3D_NAME._NAME_VERTEX_ID;
pub const D3D_NAME_PRIMITIVE_ID = D3D_NAME._NAME_PRIMITIVE_ID;
pub const D3D_NAME_INSTANCE_ID = D3D_NAME._NAME_INSTANCE_ID;
pub const D3D_NAME_IS_FRONT_FACE = D3D_NAME._NAME_IS_FRONT_FACE;
pub const D3D_NAME_SAMPLE_INDEX = D3D_NAME._NAME_SAMPLE_INDEX;
pub const D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME._NAME_FINAL_QUAD_EDGE_TESSFACTOR;
pub const D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME._NAME_FINAL_QUAD_INSIDE_TESSFACTOR;
pub const D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME._NAME_FINAL_TRI_EDGE_TESSFACTOR;
pub const D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME._NAME_FINAL_TRI_INSIDE_TESSFACTOR;
pub const D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME._NAME_FINAL_LINE_DETAIL_TESSFACTOR;
pub const D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME._NAME_FINAL_LINE_DENSITY_TESSFACTOR;
pub const D3D_NAME_BARYCENTRICS = D3D_NAME._NAME_BARYCENTRICS;
pub const D3D_NAME_SHADINGRATE = D3D_NAME._NAME_SHADINGRATE;
pub const D3D_NAME_CULLPRIMITIVE = D3D_NAME._NAME_CULLPRIMITIVE;
pub const D3D_NAME_TARGET = D3D_NAME._NAME_TARGET;
pub const D3D_NAME_DEPTH = D3D_NAME._NAME_DEPTH;
pub const D3D_NAME_COVERAGE = D3D_NAME._NAME_COVERAGE;
pub const D3D_NAME_DEPTH_GREATER_EQUAL = D3D_NAME._NAME_DEPTH_GREATER_EQUAL;
pub const D3D_NAME_DEPTH_LESS_EQUAL = D3D_NAME._NAME_DEPTH_LESS_EQUAL;
pub const D3D_NAME_STENCIL_REF = D3D_NAME._NAME_STENCIL_REF;
pub const D3D_NAME_INNER_COVERAGE = D3D_NAME._NAME_INNER_COVERAGE;
pub const D3D10_NAME_UNDEFINED = D3D_NAME._NAME_UNDEFINED;
pub const D3D10_NAME_POSITION = D3D_NAME._NAME_POSITION;
pub const D3D10_NAME_CLIP_DISTANCE = D3D_NAME._NAME_CLIP_DISTANCE;
pub const D3D10_NAME_CULL_DISTANCE = D3D_NAME._NAME_CULL_DISTANCE;
pub const D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME._NAME_RENDER_TARGET_ARRAY_INDEX;
pub const D3D10_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME._NAME_VIEWPORT_ARRAY_INDEX;
pub const D3D10_NAME_VERTEX_ID = D3D_NAME._NAME_VERTEX_ID;
pub const D3D10_NAME_PRIMITIVE_ID = D3D_NAME._NAME_PRIMITIVE_ID;
pub const D3D10_NAME_INSTANCE_ID = D3D_NAME._NAME_INSTANCE_ID;
pub const D3D10_NAME_IS_FRONT_FACE = D3D_NAME._NAME_IS_FRONT_FACE;
pub const D3D10_NAME_SAMPLE_INDEX = D3D_NAME._NAME_SAMPLE_INDEX;
pub const D3D10_NAME_TARGET = D3D_NAME._NAME_TARGET;
pub const D3D10_NAME_DEPTH = D3D_NAME._NAME_DEPTH;
pub const D3D10_NAME_COVERAGE = D3D_NAME._NAME_COVERAGE;
pub const D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME._NAME_FINAL_QUAD_EDGE_TESSFACTOR;
pub const D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME._NAME_FINAL_QUAD_INSIDE_TESSFACTOR;
pub const D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME._NAME_FINAL_TRI_EDGE_TESSFACTOR;
pub const D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME._NAME_FINAL_TRI_INSIDE_TESSFACTOR;
pub const D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME._NAME_FINAL_LINE_DETAIL_TESSFACTOR;
pub const D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME._NAME_FINAL_LINE_DENSITY_TESSFACTOR;
pub const D3D11_NAME_DEPTH_GREATER_EQUAL = D3D_NAME._NAME_DEPTH_GREATER_EQUAL;
pub const D3D11_NAME_DEPTH_LESS_EQUAL = D3D_NAME._NAME_DEPTH_LESS_EQUAL;
pub const D3D11_NAME_STENCIL_REF = D3D_NAME._NAME_STENCIL_REF;
pub const D3D11_NAME_INNER_COVERAGE = D3D_NAME._NAME_INNER_COVERAGE;
pub const D3D12_NAME_BARYCENTRICS = D3D_NAME._NAME_BARYCENTRICS;
pub const D3D12_NAME_SHADINGRATE = D3D_NAME._NAME_SHADINGRATE;
pub const D3D12_NAME_CULLPRIMITIVE = D3D_NAME._NAME_CULLPRIMITIVE;
pub const D3D_RESOURCE_RETURN_TYPE = enum(i32) {
_RETURN_TYPE_UNORM = 1,
_RETURN_TYPE_SNORM = 2,
_RETURN_TYPE_SINT = 3,
_RETURN_TYPE_UINT = 4,
_RETURN_TYPE_FLOAT = 5,
_RETURN_TYPE_MIXED = 6,
_RETURN_TYPE_DOUBLE = 7,
_RETURN_TYPE_CONTINUED = 8,
// @"10_RETURN_TYPE_UNORM" = 1, this enum value conflicts with _RETURN_TYPE_UNORM
// @"10_RETURN_TYPE_SNORM" = 2, this enum value conflicts with _RETURN_TYPE_SNORM
// @"10_RETURN_TYPE_SINT" = 3, this enum value conflicts with _RETURN_TYPE_SINT
// @"10_RETURN_TYPE_UINT" = 4, this enum value conflicts with _RETURN_TYPE_UINT
// @"10_RETURN_TYPE_FLOAT" = 5, this enum value conflicts with _RETURN_TYPE_FLOAT
// @"10_RETURN_TYPE_MIXED" = 6, this enum value conflicts with _RETURN_TYPE_MIXED
// @"11_RETURN_TYPE_UNORM" = 1, this enum value conflicts with _RETURN_TYPE_UNORM
// @"11_RETURN_TYPE_SNORM" = 2, this enum value conflicts with _RETURN_TYPE_SNORM
// @"11_RETURN_TYPE_SINT" = 3, this enum value conflicts with _RETURN_TYPE_SINT
// @"11_RETURN_TYPE_UINT" = 4, this enum value conflicts with _RETURN_TYPE_UINT
// @"11_RETURN_TYPE_FLOAT" = 5, this enum value conflicts with _RETURN_TYPE_FLOAT
// @"11_RETURN_TYPE_MIXED" = 6, this enum value conflicts with _RETURN_TYPE_MIXED
// @"11_RETURN_TYPE_DOUBLE" = 7, this enum value conflicts with _RETURN_TYPE_DOUBLE
// @"11_RETURN_TYPE_CONTINUED" = 8, this enum value conflicts with _RETURN_TYPE_CONTINUED
};
pub const D3D_RETURN_TYPE_UNORM = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_UNORM;
pub const D3D_RETURN_TYPE_SNORM = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_SNORM;
pub const D3D_RETURN_TYPE_SINT = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_SINT;
pub const D3D_RETURN_TYPE_UINT = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_UINT;
pub const D3D_RETURN_TYPE_FLOAT = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_FLOAT;
pub const D3D_RETURN_TYPE_MIXED = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_MIXED;
pub const D3D_RETURN_TYPE_DOUBLE = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_DOUBLE;
pub const D3D_RETURN_TYPE_CONTINUED = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_CONTINUED;
pub const D3D10_RETURN_TYPE_UNORM = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_UNORM;
pub const D3D10_RETURN_TYPE_SNORM = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_SNORM;
pub const D3D10_RETURN_TYPE_SINT = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_SINT;
pub const D3D10_RETURN_TYPE_UINT = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_UINT;
pub const D3D10_RETURN_TYPE_FLOAT = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_FLOAT;
pub const D3D10_RETURN_TYPE_MIXED = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_MIXED;
pub const D3D11_RETURN_TYPE_UNORM = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_UNORM;
pub const D3D11_RETURN_TYPE_SNORM = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_SNORM;
pub const D3D11_RETURN_TYPE_SINT = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_SINT;
pub const D3D11_RETURN_TYPE_UINT = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_UINT;
pub const D3D11_RETURN_TYPE_FLOAT = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_FLOAT;
pub const D3D11_RETURN_TYPE_MIXED = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_MIXED;
pub const D3D11_RETURN_TYPE_DOUBLE = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_DOUBLE;
pub const D3D11_RETURN_TYPE_CONTINUED = D3D_RESOURCE_RETURN_TYPE._RETURN_TYPE_CONTINUED;
pub const D3D_REGISTER_COMPONENT_TYPE = enum(i32) {
_REGISTER_COMPONENT_UNKNOWN = 0,
_REGISTER_COMPONENT_UINT32 = 1,
_REGISTER_COMPONENT_SINT32 = 2,
_REGISTER_COMPONENT_FLOAT32 = 3,
// @"10_REGISTER_COMPONENT_UNKNOWN" = 0, this enum value conflicts with _REGISTER_COMPONENT_UNKNOWN
// @"10_REGISTER_COMPONENT_UINT32" = 1, this enum value conflicts with _REGISTER_COMPONENT_UINT32
// @"10_REGISTER_COMPONENT_SINT32" = 2, this enum value conflicts with _REGISTER_COMPONENT_SINT32
// @"10_REGISTER_COMPONENT_FLOAT32" = 3, this enum value conflicts with _REGISTER_COMPONENT_FLOAT32
};
pub const D3D_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_TYPE._REGISTER_COMPONENT_UNKNOWN;
pub const D3D_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_TYPE._REGISTER_COMPONENT_UINT32;
pub const D3D_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_TYPE._REGISTER_COMPONENT_SINT32;
pub const D3D_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_TYPE._REGISTER_COMPONENT_FLOAT32;
pub const D3D10_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_TYPE._REGISTER_COMPONENT_UNKNOWN;
pub const D3D10_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_TYPE._REGISTER_COMPONENT_UINT32;
pub const D3D10_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_TYPE._REGISTER_COMPONENT_SINT32;
pub const D3D10_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_TYPE._REGISTER_COMPONENT_FLOAT32;
pub const D3D_TESSELLATOR_DOMAIN = enum(i32) {
_TESSELLATOR_DOMAIN_UNDEFINED = 0,
_TESSELLATOR_DOMAIN_ISOLINE = 1,
_TESSELLATOR_DOMAIN_TRI = 2,
_TESSELLATOR_DOMAIN_QUAD = 3,
// @"11_TESSELLATOR_DOMAIN_UNDEFINED" = 0, this enum value conflicts with _TESSELLATOR_DOMAIN_UNDEFINED
// @"11_TESSELLATOR_DOMAIN_ISOLINE" = 1, this enum value conflicts with _TESSELLATOR_DOMAIN_ISOLINE
// @"11_TESSELLATOR_DOMAIN_TRI" = 2, this enum value conflicts with _TESSELLATOR_DOMAIN_TRI
// @"11_TESSELLATOR_DOMAIN_QUAD" = 3, this enum value conflicts with _TESSELLATOR_DOMAIN_QUAD
};
pub const D3D_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN._TESSELLATOR_DOMAIN_UNDEFINED;
pub const D3D_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN._TESSELLATOR_DOMAIN_ISOLINE;
pub const D3D_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN._TESSELLATOR_DOMAIN_TRI;
pub const D3D_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN._TESSELLATOR_DOMAIN_QUAD;
pub const D3D11_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN._TESSELLATOR_DOMAIN_UNDEFINED;
pub const D3D11_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN._TESSELLATOR_DOMAIN_ISOLINE;
pub const D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN._TESSELLATOR_DOMAIN_TRI;
pub const D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN._TESSELLATOR_DOMAIN_QUAD;
pub const D3D_TESSELLATOR_PARTITIONING = enum(i32) {
_TESSELLATOR_PARTITIONING_UNDEFINED = 0,
_TESSELLATOR_PARTITIONING_INTEGER = 1,
_TESSELLATOR_PARTITIONING_POW2 = 2,
_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3,
_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4,
// @"11_TESSELLATOR_PARTITIONING_UNDEFINED" = 0, this enum value conflicts with _TESSELLATOR_PARTITIONING_UNDEFINED
// @"11_TESSELLATOR_PARTITIONING_INTEGER" = 1, this enum value conflicts with _TESSELLATOR_PARTITIONING_INTEGER
// @"11_TESSELLATOR_PARTITIONING_POW2" = 2, this enum value conflicts with _TESSELLATOR_PARTITIONING_POW2
// @"11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD" = 3, this enum value conflicts with _TESSELLATOR_PARTITIONING_FRACTIONAL_ODD
// @"11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN" = 4, this enum value conflicts with _TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN
};
pub const D3D_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_UNDEFINED;
pub const D3D_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_INTEGER;
pub const D3D_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_POW2;
pub const D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_FRACTIONAL_ODD;
pub const D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN;
pub const D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_UNDEFINED;
pub const D3D11_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_INTEGER;
pub const D3D11_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_POW2;
pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_FRACTIONAL_ODD;
pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING._TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN;
pub const D3D_TESSELLATOR_OUTPUT_PRIMITIVE = enum(i32) {
_TESSELLATOR_OUTPUT_UNDEFINED = 0,
_TESSELLATOR_OUTPUT_POINT = 1,
_TESSELLATOR_OUTPUT_LINE = 2,
_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3,
_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4,
// @"11_TESSELLATOR_OUTPUT_UNDEFINED" = 0, this enum value conflicts with _TESSELLATOR_OUTPUT_UNDEFINED
// @"11_TESSELLATOR_OUTPUT_POINT" = 1, this enum value conflicts with _TESSELLATOR_OUTPUT_POINT
// @"11_TESSELLATOR_OUTPUT_LINE" = 2, this enum value conflicts with _TESSELLATOR_OUTPUT_LINE
// @"11_TESSELLATOR_OUTPUT_TRIANGLE_CW" = 3, this enum value conflicts with _TESSELLATOR_OUTPUT_TRIANGLE_CW
// @"11_TESSELLATOR_OUTPUT_TRIANGLE_CCW" = 4, this enum value conflicts with _TESSELLATOR_OUTPUT_TRIANGLE_CCW
};
pub const D3D_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_UNDEFINED;
pub const D3D_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_POINT;
pub const D3D_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_LINE;
pub const D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_TRIANGLE_CW;
pub const D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_TRIANGLE_CCW;
pub const D3D11_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_UNDEFINED;
pub const D3D11_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_POINT;
pub const D3D11_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_LINE;
pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_TRIANGLE_CW;
pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_PRIMITIVE._TESSELLATOR_OUTPUT_TRIANGLE_CCW;
pub const D3D_MIN_PRECISION = enum(i32) {
DEFAULT = 0,
FLOAT_16 = 1,
FLOAT_2_8 = 2,
RESERVED = 3,
SINT_16 = 4,
UINT_16 = 5,
ANY_16 = 240,
ANY_10 = 241,
};
pub const D3D_MIN_PRECISION_DEFAULT = D3D_MIN_PRECISION.DEFAULT;
pub const D3D_MIN_PRECISION_FLOAT_16 = D3D_MIN_PRECISION.FLOAT_16;
pub const D3D_MIN_PRECISION_FLOAT_2_8 = D3D_MIN_PRECISION.FLOAT_2_8;
pub const D3D_MIN_PRECISION_RESERVED = D3D_MIN_PRECISION.RESERVED;
pub const D3D_MIN_PRECISION_SINT_16 = D3D_MIN_PRECISION.SINT_16;
pub const D3D_MIN_PRECISION_UINT_16 = D3D_MIN_PRECISION.UINT_16;
pub const D3D_MIN_PRECISION_ANY_16 = D3D_MIN_PRECISION.ANY_16;
pub const D3D_MIN_PRECISION_ANY_10 = D3D_MIN_PRECISION.ANY_10;
pub const D3D_INTERPOLATION_MODE = enum(i32) {
UNDEFINED = 0,
CONSTANT = 1,
LINEAR = 2,
LINEAR_CENTROID = 3,
LINEAR_NOPERSPECTIVE = 4,
LINEAR_NOPERSPECTIVE_CENTROID = 5,
LINEAR_SAMPLE = 6,
LINEAR_NOPERSPECTIVE_SAMPLE = 7,
};
pub const D3D_INTERPOLATION_UNDEFINED = D3D_INTERPOLATION_MODE.UNDEFINED;
pub const D3D_INTERPOLATION_CONSTANT = D3D_INTERPOLATION_MODE.CONSTANT;
pub const D3D_INTERPOLATION_LINEAR = D3D_INTERPOLATION_MODE.LINEAR;
pub const D3D_INTERPOLATION_LINEAR_CENTROID = D3D_INTERPOLATION_MODE.LINEAR_CENTROID;
pub const D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE = D3D_INTERPOLATION_MODE.LINEAR_NOPERSPECTIVE;
pub const D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = D3D_INTERPOLATION_MODE.LINEAR_NOPERSPECTIVE_CENTROID;
pub const D3D_INTERPOLATION_LINEAR_SAMPLE = D3D_INTERPOLATION_MODE.LINEAR_SAMPLE;
pub const D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = D3D_INTERPOLATION_MODE.LINEAR_NOPERSPECTIVE_SAMPLE;
pub const D3D_PARAMETER_FLAGS = enum(i32) {
NONE = 0,
IN = 1,
OUT = 2,
FORCE_DWORD = 2147483647,
};
pub const D3D_PF_NONE = D3D_PARAMETER_FLAGS.NONE;
pub const D3D_PF_IN = D3D_PARAMETER_FLAGS.IN;
pub const D3D_PF_OUT = D3D_PARAMETER_FLAGS.OUT;
pub const D3D_PF_FORCE_DWORD = D3D_PARAMETER_FLAGS.FORCE_DWORD;
pub const D3DVECTOR = extern struct {
x: f32,
y: f32,
z: f32,
};
pub const D3DMATRIX = extern struct {
Anonymous: extern union {
Anonymous: extern struct {
_11: f32,
_12: f32,
_13: f32,
_14: f32,
_21: f32,
_22: f32,
_23: f32,
_24: f32,
_31: f32,
_32: f32,
_33: f32,
_34: f32,
_41: f32,
_42: f32,
_43: f32,
_44: f32,
},
m: [16]f32,
},
};
//--------------------------------------------------------------------------------
// 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 PSTR = @import("../foundation.zig").PSTR;
test {
// The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
if (@hasDecl(@This(), "PFN_DESTRUCTION_CALLBACK")) { _ = PFN_DESTRUCTION_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 (2)
//--------------------------------------------------------------------------------
pub const dxc = @import("direct3d/dxc.zig");
pub const fxc = @import("direct3d/fxc.zig"); | win32/graphics/direct3d.zig |
const std = @import("std");
const testing = std.testing;
const allocator = std.testing.allocator;
pub const Display = struct {
// digit segments length digits with same length
// ----- -------- ------ -----------------------
// 0 abc.efg 6 0, 6, 9
// 6 ab.defg 6 0, 6, 9
// 9 abcd.fg 6 0, 6, 9
// 1 ..c..f. 2 1
// 2 a.cde.g 5 2, 3, 5
// 3 a.cd.fg 5 2, 3, 5
// 5 ab.d.fg 5 2, 3, 5
// 4 .bcd.f. 4 4
// 7 a.c..f. 3 7
// 8 abcdefg 7 8
const NUM_DIGITS = 10;
const NUM_SEGMENTS = 7;
// Given the length of a set of segments, determine which unique digit
// could be mapped by that segment length. A zero value indicates either
// no digits or more than one digit, so digits are non-unique for that
// length.
//
// Example: a set of 3 segments can only denote a 7 digit.
const digits_for_len = [NUM_SEGMENTS + 1]u8{
0, // 0
0, // 1
1, // 2
7, // 3
4, // 4
0, // 5
0, // 6
8, // 7
};
// Given the length of a set of segments, determine which segments are
// definitely part of all the digits that could be mapped to that segment
// length.
//
// Example: a set of 5 segments could correspond to a 2, 3 or 4 digit; the
// segments that are shared by all of those digits are 'a', 'd' and 'g'.
const segments_for_len = [NUM_SEGMENTS + 1][]const u8{
"", // 0
"", // 1
"cf", // 2
"acf", // 3
"bcdf", // 4
"adg", // 5
"abfg", // 6
"abcdefg", // 7
};
// For each digit, the corresponding mask has a 1 if that digit uses that
// given segment in the display.
// Example: digit 7 uses segments 'a', 'c' & 'f'.
const digit_mask = [NUM_DIGITS]u8{
0b1110111, // 0
0b0010010, // 1
0b1011101, // 2
0b1011011, // 3
0b0111010, // 4
0b1101011, // 5
0b1101111, // 6
0b1010010, // 7
0b1111111, // 8
0b1111011, // 9
};
count_unique: [NUM_DIGITS]usize,
mask: [NUM_SEGMENTS]u8,
total_sum: usize,
pub fn init() Display {
var self = Display{
.count_unique = [_]usize{0} ** NUM_DIGITS,
.mask = [_]u8{0} ** NUM_SEGMENTS,
.total_sum = 0,
};
return self;
}
pub fn deinit(_: *Display) void {}
pub fn process_line(self: *Display, data: []const u8) void {
var pos: usize = 0;
var ita = std.mem.split(u8, data, " | ");
while (ita.next()) |str| : (pos += 1) {
if (pos == 0) {
self.init_masks();
var itd = std.mem.tokenize(u8, str, " ");
while (itd.next()) |segments| {
self.restrict_masks(segments);
}
continue;
}
if (pos == 1) {
self.propagate_masks();
var mapping: [NUM_SEGMENTS]u8 = [_]u8{0} ** NUM_SEGMENTS;
for (self.mask) |m, j| {
// std.debug.warn("MASK {}: {b:0>7}\n", .{ j, m });
const c = @ctz(usize, m);
mapping[NUM_SEGMENTS - 1 - c] = @as(u8, 1) << @intCast(u3, NUM_SEGMENTS - 1 - j);
}
var itd = std.mem.tokenize(u8, str, " ");
var value: usize = 0;
while (itd.next()) |segments| {
self.update_unique_counts(segments);
var mask: u8 = 0;
for (segments) |segment| {
mask |= mapping[segment - 'a'];
}
const digit = self.mask_to_digit(mask);
value = value * NUM_DIGITS + digit;
}
self.total_sum += value;
continue;
}
unreachable;
}
}
pub fn count_unique_digits(self: Display) usize {
var total: usize = 0;
for (self.count_unique) |c| {
total += c;
}
return total;
}
pub fn get_total_sum(self: Display) usize {
return self.total_sum;
}
fn init_masks(self: *Display) void {
const mask = (1 << NUM_SEGMENTS) - 1;
for (self.mask) |_, j| {
self.mask[j] = mask;
}
}
fn build_mask_for_segments(_: Display, segments: []const u8) u8 {
var mask: u8 = 0;
for (segments) |segment| {
const shift = @intCast(u3, NUM_SEGMENTS - 1 - (segment - 'a'));
const bit = @as(u8, 1) << shift;
mask |= bit;
}
return mask;
}
fn restric_single_mask(self: *Display, segment: u8, possible: u8) void {
const pos = segment - 'a';
self.mask[pos] &= possible;
}
fn restrict_masks(self: *Display, segments: []const u8) void {
const possible = self.build_mask_for_segments(segments);
const len = segments.len;
if (len >= 0 and len <= NUM_SEGMENTS) {
for (segments_for_len[len]) |segment| {
self.restric_single_mask(segment, possible);
}
}
}
fn propagate_masks(self: *Display) void {
while (true) {
var changed: usize = 0;
var j: usize = 0;
while (j < NUM_SEGMENTS) : (j += 1) {
const mj = self.mask[j];
if (@popCount(usize, mj) != 1) continue;
var k: usize = 0;
while (k < NUM_SEGMENTS) : (k += 1) {
if (k == j) continue;
const mk = self.mask[k];
if (@popCount(usize, mk) == 1) continue;
self.mask[k] &= ~mj;
changed += 1;
}
}
if (changed == 0) break;
}
}
fn mask_to_digit(_: Display, mask: u8) u8 {
// TODO: this would be better with a hash, but the array only has 10
// entries, so we just do a linear search on it.
for (digit_mask) |m, p| {
if (mask == m) return @intCast(u8, p);
}
unreachable;
}
fn update_unique_counts(self: *Display, segments: []const u8) void {
const len = segments.len;
if (len >= 0 and len <= NUM_SEGMENTS) {
const d = digits_for_len[len];
if (d > 0) {
self.count_unique[d] += 1;
}
}
}
};
test "sample part a" {
const data: []const u8 =
\\be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
\\edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
\\fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg
\\fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb
\\aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea
\\fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb
\\dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe
\\bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef
\\egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb
\\gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce
;
var display = Display.init();
defer display.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
display.process_line(line);
}
const unique = display.count_unique_digits();
try testing.expect(unique == 26);
}
test "sample part b" {
const data: []const u8 =
\\be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
\\edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
\\fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg
\\fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb
\\aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea
\\fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb
\\dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe
\\bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef
\\egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb
\\gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce
;
var display = Display.init();
defer display.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
display.process_line(line);
}
const total_sum = display.get_total_sum();
try testing.expect(total_sum == 61229);
} | 2021/p08/display.zig |
const std = @import("std");
const assert = @import("std").debug.assert;
const time = std.time;
const c = @cImport({
@cInclude("ed25519.h");
@cInclude("ed25519-donna.h");
// @cInclude("sodium.h");
});
const message = [_]u8{ 'h','e','l','l','o' };
// ed25519-donna
var skEd25519: c.ed25519_secret_key = [_]u8{ 'a','b','c','d','e','a','b','c','d','e','a','b','c','d','e','a','b','c','d','e','a','b','c','d','e','a','b','c','d','e','1','2' };
var pkEd25519: c.ed25519_public_key = undefined;
var sigEd25519: c.ed25519_signature = undefined;
// sodium
var skSodium: [c.crypto_sign_SECRETKEYBYTES]u8 = undefined;
var pkSodium: [c.crypto_sign_PUBLICKEYBYTES]u8 = undefined;
var sigSodium: [c.crypto_sign_BYTES]u8 = undefined;
pub fn main() !void {
// bench of ed25519-donna
c.ed25519_publickey(&skEd25519, &pkEd25519);
c.ed25519_sign(&message, 5, &skEd25519, &pkEd25519, &sigEd25519);
const benchtime = time.ns_per_s * 10; // 10s
try bench("BenchmarkVerify-Donna-Zig", verifySigEd25519, benchtime, 10);
try bench("BenchmarkVerify-Donna-Zig", verifySigEd25519, benchtime, 1000);
// if (c.sodium_init() < 0) {
// std.debug.panic("sodium couldn't be initialized, it is not safe to use\n", .{});
// }
// // bench of sodium
// _ = c.crypto_sign_keypair(&pkSodium, &skSodium);
// _ = c.crypto_sign_detached(&sigSodium, null, &message, 5, &skSodium);
// if (c.crypto_sign_verify_detached(&sigSodium, &message, 5, &skSodium) != 0) {
// std.debug.warn("Hello, world!\n", .{});
// }
}
pub fn bench(comptime name: []const u8, F: var, benchtime: comptime_int, count: usize) !void {
var timer = try time.Timer.start();
var loops: usize = 0;
while (timer.read() < benchtime) : (loops += 1) {
_ = F(count);
}
const loopPerS = loops * time.ns_per_s / benchtime;
const timePerOp = benchtime / loops;
std.debug.warn("{}-{}: {} {} loops/s {} ns/op\n", .{ name, count, loops, loopPerS, timePerOp });
}
fn verifySigEd25519(n: usize) void {
var i: usize = 0;
while (i < n) {
i += 1;
const valid = c.ed25519_sign_open(&message, 5, &pkEd25519, &sigEd25519) == 0;
// assert(valid);
}
// assert(i == n);
} | src/main.zig |
pub const FrameBufferType = enum(u8) { ARGB = 0, RGBA = 1, ABGR = 2, BGRA = 3 };
pub const Color = u32;
pub const Position = struct {
x: u32,
y: u32,
pub inline fn offsetX(self: Position, x: u32) Position {
return .{ .x = self.x + x, .y = self.y };
}
pub inline fn offsetY(self: Position, y: u32) Position {
return .{ .x = self.x, .y = self.y + y };
}
pub inline fn offsetXY(self: Position, x: u32, y: u32) Position {
return .{ .x = self.x + x, .y = self.y + y };
}
};
const stdout = @import("std").io.getStdOut().writer();
pub const FrameBuffer = struct {
address: *volatile u32,
size: u32,
width: u32,
height: u32,
scanLine: u32,
colorEncoding: FrameBufferType,
pub inline fn setPixel(self: FrameBuffer, x: u32, y: u32, color: Color) void {
//_ = stdout.print("Set Pixel in Framebuffer {}/{} = {}\n", .{ x, y, color }) catch unreachable;
@intToPtr(*volatile u32, @ptrToInt(self.address) + y * self.scanLine + 4 * x).* = color;
}
pub inline fn getPixel(self: FrameBuffer, x: u32, y: u32) Color {
return @intToPtr(*volatile u32, @ptrToInt(self.address) + y * self.scanLine + 4 * x).*;
}
pub fn reset(self: FrameBuffer) void {
var x: u32 = 0;
var y: u32 = 0;
while (x < self.width) : (x += 1) {
while (y < self.height) : (y += 1) {
@intToPtr(*volatile u32, @ptrToInt(self.address) + y * self.scanLine + 4 * x).* = 0x00000000;
}
y = 0;
}
}
pub fn getColor(self: FrameBuffer, alpha: u8, red: u8, green: u8, blue: u8) Color {
switch (self.colorEncoding) {
.ABGR => {
return @intCast(u32, alpha) << 24 | @intCast(u32, blue) << 16 | @intCast(u32, green) << 8 | @intCast(u32, red);
},
.ARGB => {
return @intCast(u32, alpha) << 24 | @intCast(u32, red) << 16 | @intCast(u32, green) << 8 | @intCast(u32, blue);
},
.RGBA => {
return @intCast(u32, red) << 24 | @intCast(u32, green) << 16 | @intCast(u32, blue) << 8 | @intCast(u32, alpha);
},
.BGRA => {
return @intCast(u32, blue) << 24 | @intCast(u32, green) << 16 | @intCast(u32, red) << 8 | @intCast(u32, alpha);
},
}
}
};
const expect = @import("std").testing.expect;
const TestWidth: u32 = 800;
const TestHeight: u32 = 600;
var TestMemory = [_]u8{0} ** (TestWidth * TestHeight * 4);
pub var TestFrameBuffer = FrameBuffer{
.address = @ptrCast(*u32, &TestMemory),
.width = TestWidth,
.height = TestHeight,
.size = TestWidth * TestHeight * 4,
.scanLine = TestWidth * 4,
.colorEncoding = FrameBufferType.RGBA,
};
test "pixel conversion" {
const width = 320;
const height = 240;
const scanLine = width * 4;
var frameBuffer: [width * height]u32 = undefined;
var fb = FrameBuffer{
.address = @ptrCast(*u32, &frameBuffer),
.width = width,
.height = height,
.scanLine = scanLine,
.size = width * height * 4,
.colorEncoding = FrameBufferType.RGBA,
};
expect(fb.getColor(0, 0xff, 0, 0) == 0xff000000);
expect(fb.getColor(0, 0, 0xff, 0) == 0x00ff0000);
expect(fb.getColor(0, 0, 0, 0xff) == 0x0000ff00);
expect(fb.getColor(0xff, 0, 0, 0xff) == 0x0000ffff);
fb.colorEncoding = FrameBufferType.ABGR;
expect(fb.getColor(0, 0xff, 0, 0) == 0x000000ff);
expect(fb.getColor(0, 0, 0xff, 0) == 0x0000ff00);
expect(fb.getColor(0, 0, 0, 0xff) == 0x00ff0000);
expect(fb.getColor(0xff, 0, 0, 0xff) == 0xffff0000);
}
test "set pixel" {
TestFrameBuffer.setPixel(0, 0, 0xABABABAB);
expect(TestMemory[0] == 0xAB);
expect(TestMemory[1] == 0xAB);
expect(TestMemory[2] == 0xAB);
expect(TestMemory[3] == 0xAB);
expect(TestFrameBuffer.getPixel(0, 0) == 0xABABABAB);
var x: u32 = 1;
var y: u32 = 0;
while (x < TestWidth) : (x += 1) {
while (y < TestHeight) : (y += 1) {
expect(TestFrameBuffer.getPixel(x, y) == 0x0);
}
}
} | kernel/framebuffer.zig |
const std = @import("std");
const util = @import("util.zig");
const data = @embedFile("../data/day14.txt");
/// Represents a polymer pair.
pub const Pair = struct {
pub const Self = @This();
item1: u8,
item2: u8,
pub fn initFromSlice(pair: []const u8) Self {
util.assert(pair.len == 2);
return .{ .item1 = pair[0], .item2 = pair[1] };
}
};
pub const PolymerSequence = struct {
const Self = @This();
polymer_template: []const u8,
insertion_rules: util.Map(Pair, u8),
element_frequency: [26]usize,
allocator: *util.Allocator,
pub fn init(allocator: *util.Allocator, polymer_template: []const u8) Self {
util.assert(polymer_template.len % 2 == 0);
return .{
.polymer_template = polymer_template,
.insertion_rules = util.Map(Pair, u8).init(allocator),
.element_frequency = std.mem.zeroes([26]usize),
.allocator = allocator,
};
}
pub fn deinit(self: *Self) void {
self.insertion_rules.deinit();
}
pub fn addInsertionRule(self: *Self, pair: Pair, value: u8) !void {
try self.insertion_rules.put(pair, value);
}
pub fn polymerize(self: *Self, times: usize) !void {
// Map of each pair to how often that pair occurs
var pair_counts = util.Map(Pair, usize).init(self.allocator);
defer pair_counts.deinit();
// Break initial template down into its pairs
{
var i: usize = 0;
while (i <= self.polymer_template.len - 2) : (i += 1) {
const pair = Pair.initFromSlice(self.polymer_template[i .. i + 2]);
try pair_counts.put(pair, (pair_counts.get(pair) orelse 0) + 1);
}
}
// Perform polymerization via the following steps:
// 1. For each pair, examine its mapping in our rules
// 2. If it maps, add the two resulting pairs to the new map
// 3. If it doesn't map, simply transcribe it over
{
var cur_time: usize = 0;
// Temporary map we will use to keep track of the current set of pairs we're computing
// (since all replacements happen simultaneously, and we cannot modify the original list
// as we are iterating through it).
var new_pair_counts = util.Map(Pair, usize).init(self.allocator);
defer new_pair_counts.deinit();
while (cur_time < times) : (cur_time += 1) {
// Go through each current pair
var pairs_it = pair_counts.iterator();
while (pairs_it.next()) |entry| {
// Get value to be inserted, if any
const inserted_value = self.insertion_rules.get(entry.key_ptr.*);
// Pair translates to something new, so add the two new pairs
if (inserted_value) |value| {
const p1 = Pair{ .item1 = entry.key_ptr.item1, .item2 = value };
const p2 = Pair{ .item1 = value, .item2 = entry.key_ptr.item2 };
try new_pair_counts.put(p1, (new_pair_counts.get(p1) orelse 0) + entry.value_ptr.*);
try new_pair_counts.put(p2, (new_pair_counts.get(p2) orelse 0) + entry.value_ptr.*);
} else { // No translation, just translate over existing pair
try new_pair_counts.put(entry.key_ptr.*, entry.value_ptr.*);
}
}
// Switch new with old and set up to re-use old buffer to save on allocation
var temp = pair_counts;
pair_counts = new_pair_counts;
new_pair_counts = temp;
new_pair_counts.clearRetainingCapacity();
}
}
// Update count of elements in the polymer.
//
// Because pairs overlap in the polymer (eg. the second letter of one pair is the first)
// letter of the next, we'll only look at the first element of the pair when we're counting
// to avoid double counting elements.
self.element_frequency = std.mem.zeroes(@TypeOf(self.element_frequency));
var pairs_it = pair_counts.iterator();
while (pairs_it.next()) |entry| {
self.element_frequency[entry.key_ptr.item1 - 'A'] += entry.value_ptr.*;
}
// Because we only counted the first set in each pair, the only element we missed counting
// is the last element in the resulting polymer chain (because it's the only one that isn't
// part of the first element of _some_ pair). Fortunately, we know what the last one is
// (because it hasn't changed from what it was in the original polymer template), so we'll
// offset the count accordingly.
self.element_frequency[self.polymer_template[self.polymer_template.len - 1] - 'A'] += 1;
}
};
pub fn getScoreForPolymer(polymer: PolymerSequence) usize {
// Find min and max values (the items they correspond to are irrelevant)
const max = util.sliceMax(usize, polymer.element_frequency[0..]);
// The min value must ignore 0, so we'll find it manually
const min: usize = blk: {
var min: usize = std.math.maxInt(usize);
for (polymer.element_frequency[0..]) |elem| {
if (elem != 0 and elem < min) min = elem;
}
break :blk min;
};
// Subtract min from max to get score
return max - min;
}
pub fn main() !void {
defer {
const leaks = util.gpa_impl.deinit();
std.debug.assert(!leaks);
}
// Read in the polymer template (which must be a series of pairs)
var it = util.tokenize(u8, data, "\n");
const polymer_template = it.next() orelse return error.InvalidInput;
if (polymer_template.len % 2 != 0) return error.InvalidInput;
var polymer = PolymerSequence.init(util.gpa, polymer_template);
defer polymer.deinit();
// Read in insertion rules
while (it.next()) |line| {
var rule_it = util.tokenize(u8, line, " ->");
const pair = rule_it.next() orelse return error.InvalidInput;
if (pair.len != 2) return error.InvalidInput;
const insert_value = rule_it.next() orelse return error.InvalidInput;
if (insert_value.len != 1) return error.InvalidInput;
try polymer.addInsertionRule(Pair.initFromSlice(pair), insert_value[0]);
}
// Polymerize x times (change for part 1/part 2 appropriately)
try polymer.polymerize(40);
// Calculate score
const score = getScoreForPolymer(polymer);
util.print("Score is: {d}\n", .{score});
} | src/day14.zig |
const inputFile = @embedFile("./input/day07.txt");
const std = @import("std");
const Allocator = std.mem.Allocator;
// const ArrayList = std.ArrayList;
const assert = std.debug.assert;
/// Part 1
/// Simplest solution, no math knowledge required
/// Brute forces from 0 - max,
/// The distance from the current point to each other point
/// Complexity: O(n2)
fn shortestDistanceBF(numCrabsAtDist: []u32) usize {
var bestPoint: usize = undefined;
var bestPointFuel: usize = std.math.maxInt(usize);
for (numCrabsAtDist) |_, i| {
var dist: usize = 0;
// compute distance
for (numCrabsAtDist) |n, j| {
dist += n * absDiff(i, j);
}
if (dist < bestPointFuel) {
bestPoint = i;
bestPointFuel = dist;
}
}
return bestPointFuel;
}
/// Part 2
/// Simplest solution, no math knowledge required
/// Brute forces from 0 - max,
/// The distance from the current point to each other point
/// Complexity: O(n2)
fn shortestTriangleDistanceBF(numCrabsAtDist: []u32) usize {
var bestPoint: usize = undefined;
var bestPointFuel: usize = std.math.maxInt(usize);
for (numCrabsAtDist) |_, i| {
var dist: usize = 0;
// compute distance
for (numCrabsAtDist) |n, j| {
dist += n * triangleDiff(i, j);
}
if (dist < bestPointFuel) {
bestPoint = i;
bestPointFuel = dist;
}
}
return bestPointFuel;
}
// Absolute difference of two unsigned numbers
// performs branching
fn absDiff(x: usize, y: usize) usize {
if (x > y) return x - y;
return y - x;
}
/// Given two numbers, compute the absolute triangle number diff between them
/// e.g. if abs(x - y) = 3, the triangle number diff is T(3) = 1 + 2 + 3 = 6
fn triangleDiff(x: usize, y: usize) usize {
if (x > y) return triangleDiff(y, x);
if (x == y) return 0;
const d = y - x;
return d * (d + 1) / 2;
}
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var allocator = &gpa.allocator;
defer std.debug.assert(!gpa.deinit()); // no leaks
const numCrabsAtDist = try parseInput(inputFile, allocator);
defer allocator.free(numCrabsAtDist);
try stdout.print("Part 1: {d}\nPart2: {d}\n", .{ shortestDistanceBF(numCrabsAtDist), shortestTriangleDistanceBF(numCrabsAtDist) });
}
/// Given a list of numbers
/// Returns a list of counts of each number in the range 0 - max
/// Where the max is whatever is in the input file
/// Caller is responsible for freeing memory
fn parseInput(input: []const u8, allocator: *Allocator) ![]u32 {
// First pass: find max val
var max: usize = 0;
{
var start: usize = 0;
while (std.mem.indexOfAnyPos(u8, input, start, &.{ ',', '\n' })) |end| : (start = end + 1) {
const val = try std.fmt.parseInt(u32, input[start..end], 10);
if (val > max) max = val;
}
}
// Allocate zeroes from 0 - max
var result = try allocator.alloc(u32, max + 1);
std.mem.set(u32, result, 0);
// Second pass: fill result
{
var start: usize = 0;
while (std.mem.indexOfAnyPos(u8, input, start, &.{ ',', '\n' })) |end| : (start = end + 1) {
const val = try std.fmt.parseInt(u32, input[start..end], 10);
result[val] += 1;
}
}
return result;
} | src/day07.zig |
const std = @import("std");
const alphabet = @import("bio/alphabet.zig");
const Sequence = @import("sequence.zig").Sequence;
const Cigar = @import("cigar.zig").Cigar;
const CigarOp = @import("cigar.zig").CigarOp;
pub const ExtendAlignResult = struct {
score: i32,
pos_one: usize,
pos_two: usize,
};
pub const ExtendAlignDirection = enum {
forward,
backward,
};
pub const ExtendAlignOptions = struct {
x_drop: i32 = 32,
gap_open_score: i32 = -20,
gap_extend_score: i32 = -2,
};
pub fn ExtendAlign(comptime A: type) type {
return struct {
const Self = @This();
const MinScore = -1_000_000;
const Cell = struct {
score: i32,
score_gap: i32,
};
options: ExtendAlignOptions,
allocator: std.mem.Allocator,
row: std.ArrayList(Cell),
ops: std.ArrayList(CigarOp),
pub fn init(allocator: std.mem.Allocator, options: ExtendAlignOptions) Self {
return Self{
.allocator = allocator,
.options = options,
.row = std.ArrayList(Cell).init(allocator),
.ops = std.ArrayList(CigarOp).init(allocator),
};
}
pub fn deinit(self: *Self) void {
self.row.deinit();
self.ops.deinit();
}
pub fn process(self: *Self, seq_one: Sequence(A), seq_two: Sequence(A), dir: ExtendAlignDirection, start_one: usize, start_two: usize, cigar: ?*Cigar) !ExtendAlignResult {
const width = if (dir == .forward) (seq_one.data.len - start_one + 1) else (start_one + 1);
const height = if (dir == .forward) (seq_two.data.len - start_two + 1) else (start_two + 1);
try self.row.resize(@floatToInt(usize, @intToFloat(f32, width) * 1.5));
const row = self.row.items;
try self.ops.resize(@floatToInt(usize, @intToFloat(f32, width * height) * 1.5));
const ops = self.ops.items;
var x_drop = self.options.x_drop;
var gap_open_score = self.options.gap_open_score;
var gap_extend_score = self.options.gap_extend_score;
var best_one: usize = start_one;
var best_two: usize = start_two;
var best_x: usize = 0;
var best_y: usize = 0;
var best_score: i32 = 0;
// init row
row[0].score = 0;
row[0].score_gap = gap_open_score + gap_extend_score;
var score: i32 = 0;
var x: usize = 1;
while (x < width) : (x += 1) {
score = gap_open_score + @intCast(i32, x) * gap_extend_score;
if (score < -x_drop)
break;
ops[x] = CigarOp.insertion;
row[x].score = score;
row[x].score_gap = MinScore;
}
var row_size: usize = x;
var first_x: usize = 0;
// row by row
var y: usize = 1;
while (y < height) : (y += 1) {
var row_gap: i32 = MinScore;
var diag_score: i32 = MinScore;
score = MinScore;
var last_x: usize = first_x;
x = first_x;
while (x < row_size) : (x += 1) {
var col_gap = row[x].score_gap;
_ = col_gap;
var pos_one: usize = 0;
var pos_two: usize = 0;
var match: bool = false;
if (x > 0) {
// diagScore: score at col-1, row-1
pos_one = if (dir == .forward) start_one + x - 1 else start_one - x;
pos_two = if (dir == .forward) start_two + y - 1 else start_two - y;
const letter_one = seq_one.data[pos_one];
const letter_two = seq_two.data[pos_two];
match = A.match(letter_one, letter_two);
score = diag_score + A.score(letter_one, letter_two);
}
// select highest score
// - coming from diag (current),
// - coming from left (row)
// - coming from top (col)
score = std.math.max(score, row_gap);
score = std.math.max(score, col_gap);
// row[x] right now points to the previous row, so use this
// in the next iteration for the diagonal computation of (x, y )
diag_score = row[x].score;
if (best_score - score > x_drop) {
// X-Drop test failed
row[x].score = MinScore;
if (x == first_x) {
// Tighten left bound
first_x += 1;
}
} else {
last_x = x;
// Check if we achieved new highscore
if (score > best_score) {
best_score = score;
best_x = x;
best_y = y;
best_one = pos_one;
best_two = pos_two;
}
// Record new score
var op: CigarOp = undefined;
if (score == row_gap) {
op = CigarOp.insertion;
} else if (score == col_gap) {
op = CigarOp.deletion;
} else if (match) {
op = CigarOp.match;
} else {
op = CigarOp.mismatch;
}
ops[y * width + x] = op;
// update scores
row[x].score = score;
row[x].score_gap = std.math.max(score + gap_open_score + gap_extend_score, col_gap + gap_extend_score);
row_gap = std.math.max(score + gap_open_score + gap_extend_score, row_gap + gap_extend_score);
}
} // while x
if (first_x == row_size) {
// All cells failed the X-Drop test
// We are done 8)
break;
}
if (last_x < row_size - 1) {
// Tighten right bound
row_size = last_x + 1;
} else {
// Extend row, since last checked column didn't fail X-Drop test
while (row_gap >= (best_score - x_drop) and row_size < width) {
row[row_size].score = row_gap;
row[row_size].score_gap = row_gap + gap_open_score + gap_extend_score;
ops[y * width + row_size] = CigarOp.insertion;
row_gap += gap_extend_score;
row_size += 1;
}
}
// Properly reset right bound
if (row_size < width) {
row[row_size].score = MinScore;
row[row_size].score_gap = MinScore;
row_size += 1;
}
} // while y
// backtrack
if (cigar != null) {
var bx = best_x;
var by = best_y;
cigar.?.clear();
while (bx > 0 or by > 0) {
const op = ops[by * width + bx];
try cigar.?.add(op);
// where did we come from?
switch (op) {
CigarOp.insertion => {
bx -= 1;
},
CigarOp.deletion => {
by -= 1;
},
CigarOp.match, CigarOp.mismatch => {
bx -= 1;
by -= 1;
},
}
}
if (dir == .forward) {
cigar.?.reverse();
}
}
return ExtendAlignResult{
.score = best_score,
.pos_one = best_one,
.pos_two = best_two,
};
}
};
}
test "forward" {
const allocator = std.testing.allocator;
var seq_one = try Sequence(alphabet.DNA).init(allocator, "one", "GATTGCGGGG");
defer seq_one.deinit();
var seq_two = try Sequence(alphabet.DNA).init(allocator, "two", "GAGCGGT");
defer seq_two.deinit();
var extend_align = ExtendAlign(alphabet.DNA).init(allocator, ExtendAlignOptions{});
defer extend_align.deinit();
var cigar = Cigar.init(allocator);
defer cigar.deinit();
var result = try extend_align.process(seq_one, seq_two, ExtendAlignDirection.forward, 0, 0, &cigar);
try std.testing.expectEqual(@as(i32, 4), result.score); // 2 matches = +4
// try std.testing.expectEqualSlices(CigarOp, &[_]CigarOp{ CigarOp.match, CigarOp.match }, cigar.ops.items);
}
test "gaps" {
const allocator = std.testing.allocator;
var seq_one = try Sequence(alphabet.DNA).init(allocator, "one", "GATTGCGGGG");
defer seq_one.deinit();
var seq_two = try Sequence(alphabet.DNA).init(allocator, "two", "GAGCGGT");
defer seq_two.deinit();
var extend_align = ExtendAlign(alphabet.DNA).init(allocator, .{ .gap_open_score = -3 });
defer extend_align.deinit();
var cigar = Cigar.init(allocator);
defer cigar.deinit();
var result = try extend_align.process(seq_one, seq_two, .forward, 0, 0, &cigar);
try std.testing.expectEqual(@as(i32, 5), result.score); // 6 matches, 1 gap, gap len = 1 - 3 - *
try std.testing.expectEqualStrings("2=2I4=", cigar.str());
}
test "forward extend" {
const allocator = std.testing.allocator;
var seq_one = try Sequence(alphabet.DNA).init(allocator, "one", "ATCGG");
defer seq_one.deinit();
var seq_two = try Sequence(alphabet.DNA).init(allocator, "two", "ATCGT");
defer seq_two.deinit();
var extend_align = ExtendAlign(alphabet.DNA).init(allocator, .{});
defer extend_align.deinit();
{
var cigar = Cigar.init(allocator);
defer cigar.deinit();
var result = try extend_align.process(seq_one, seq_two, .forward, 0, 0, &cigar);
try std.testing.expectEqual(result.pos_one, 3);
try std.testing.expectEqual(result.pos_two, 3);
try std.testing.expectEqualStrings("4=", cigar.str());
}
{
var cigar = Cigar.init(allocator);
defer cigar.deinit();
var result = try extend_align.process(seq_one, seq_two, .forward, 3, 3, &cigar);
try std.testing.expectEqual(result.pos_one, 3);
try std.testing.expectEqual(result.pos_two, 3);
try std.testing.expectEqualStrings("1=", cigar.str());
}
{
var cigar = Cigar.init(allocator);
defer cigar.deinit();
var result = try extend_align.process(seq_one, seq_two, .forward, 4, 4, &cigar);
try std.testing.expectEqual(result.pos_one, 4);
try std.testing.expectEqual(result.pos_two, 4);
try std.testing.expectEqualStrings("", cigar.str());
}
}
test "backward" {
const allocator = std.testing.allocator;
var seq_one = try Sequence(alphabet.DNA).init(allocator, "one", "ATCGGTTG");
defer seq_one.deinit();
var seq_two = try Sequence(alphabet.DNA).init(allocator, "two", "TCGGTAT");
defer seq_two.deinit();
var extend_align = ExtendAlign(alphabet.DNA).init(allocator, .{});
defer extend_align.deinit();
var result = try extend_align.process(seq_one, seq_two, .backward, 3, 2, null);
try std.testing.expectEqual(@as(usize, 1), result.pos_one);
try std.testing.expectEqual(@as(usize, 0), result.pos_two);
} | src/extend_align.zig |
const std = @import("std");
const io = std.io;
const process = std.process;
const Allocator = std.mem.Allocator;
const VM = @import("./vm.zig").VM;
const debug = @import("./debug.zig");
pub fn main() !void {
var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = init: {
if (comptime debug.TESTING_ALLOCATOR) {
break :init std.testing.allocator;
} else if (comptime std.Target.current.isWasm()) {
break :init &general_purpose_allocator.allocator;
} else {
break :init std.heap.c_allocator;
}
};
if (comptime std.Target.current.isWasm()) {
try repl(allocator);
} else {
const args = try process.argsAlloc(allocator);
defer process.argsFree(allocator, args);
switch (args.len) {
1 => try repl(allocator),
2 => try runFile(allocator, args[1]),
else => {
std.debug.warn("Usage: lox [path]\n", .{});
process.exit(64);
},
}
}
}
fn repl(allocator: *Allocator) !void {
const stderr = io.getStdErr().writer();
const stdin = io.getStdIn();
var vm = VM.create();
try vm.init(allocator, std.io.getStdOut().writer(), std.io.getStdErr().writer());
defer vm.deinit();
var sourceBuf: [256]u8 = undefined;
while (true) {
try stderr.print("> ", .{});
const amt = try stdin.read(&sourceBuf);
if (amt == sourceBuf.len) {
try stderr.print("Input too long.\n", .{});
continue;
}
const source = sourceBuf[0..amt];
vm.interpret(source) catch |err| switch (err) {
error.CompileError, error.RuntimeError => {},
else => return err,
};
}
}
fn runFile(allocator: *Allocator, path: []const u8) !void {
var vm = VM.create();
try vm.init(allocator, std.io.getStdOut().writer(), std.io.getStdErr().writer());
defer vm.deinit();
const source = try std.fs.cwd().readFileAlloc(allocator, path, 1_000_000);
defer allocator.free(source);
vm.interpret(source) catch |err| switch (err) {
error.CompileError => process.exit(65),
error.RuntimeError => process.exit(70),
else => return err,
};
} | src/main.zig |
const std = @import("std.zig");
const assert = std.debug.assert;
const meta = std.meta;
const mem = std.mem;
const Allocator = mem.Allocator;
const testing = std.testing;
/// A MultiArrayList stores a list of a struct type.
/// Instead of storing a single list of items, MultiArrayList
/// stores separate lists for each field of the struct.
/// This allows for memory savings if the struct has padding,
/// and also improves cache usage if only some fields are needed
/// for a computation. The primary API for accessing fields is
/// the `slice()` function, which computes the start pointers
/// for the array of each field. From the slice you can call
/// `.items(.<field_name>)` to obtain a slice of field values.
pub fn MultiArrayList(comptime S: type) type {
return struct {
bytes: [*]align(@alignOf(S)) u8 = undefined,
len: usize = 0,
capacity: usize = 0,
pub const Elem = S;
pub const Field = meta.FieldEnum(S);
/// A MultiArrayList.Slice contains cached start pointers for each field in the list.
/// These pointers are not normally stored to reduce the size of the list in memory.
/// If you are accessing multiple fields, call slice() first to compute the pointers,
/// and then get the field arrays from the slice.
pub const Slice = struct {
/// This array is indexed by the field index which can be obtained
/// by using @enumToInt() on the Field enum
ptrs: [fields.len][*]u8,
len: usize,
capacity: usize,
pub fn items(self: Slice, comptime field: Field) []FieldType(field) {
const F = FieldType(field);
if (self.capacity == 0) {
return &[_]F{};
}
const byte_ptr = self.ptrs[@enumToInt(field)];
const casted_ptr: [*]F = if (@sizeOf([*]F) == 0) undefined
else @ptrCast([*]F, @alignCast(@alignOf(F), byte_ptr));
return casted_ptr[0..self.len];
}
pub fn toMultiArrayList(self: Slice) Self {
if (self.ptrs.len == 0) {
return .{};
}
const unaligned_ptr = self.ptrs[sizes.fields[0]];
const aligned_ptr = @alignCast(@alignOf(S), unaligned_ptr);
const casted_ptr = @ptrCast([*]align(@alignOf(S)) u8, aligned_ptr);
return .{
.bytes = casted_ptr,
.len = self.len,
.capacity = self.capacity,
};
}
pub fn deinit(self: *Slice, gpa: *Allocator) void {
var other = self.toMultiArrayList();
other.deinit(gpa);
self.* = undefined;
}
};
const Self = @This();
const fields = meta.fields(S);
/// `sizes.bytes` is an array of @sizeOf each S field. Sorted by alignment, descending.
/// `sizes.fields` is an array mapping from `sizes.bytes` array index to field index.
const sizes = blk: {
const Data = struct {
size: usize,
size_index: usize,
alignment: usize,
};
var data: [fields.len]Data = undefined;
for (fields) |field_info, i| {
data[i] = .{
.size = @sizeOf(field_info.field_type),
.size_index = i,
.alignment = if (@sizeOf(field_info.field_type) == 0) 1 else field_info.alignment,
};
}
const Sort = struct {
fn lessThan(trash: *i32, lhs: Data, rhs: Data) bool {
return lhs.alignment > rhs.alignment;
}
};
var trash: i32 = undefined; // workaround for stage1 compiler bug
std.sort.sort(Data, &data, &trash, Sort.lessThan);
var sizes_bytes: [fields.len]usize = undefined;
var field_indexes: [fields.len]usize = undefined;
for (data) |elem, i| {
sizes_bytes[i] = elem.size;
field_indexes[i] = elem.size_index;
}
break :blk .{
.bytes = sizes_bytes,
.fields = field_indexes,
};
};
/// Release all allocated memory.
pub fn deinit(self: *Self, gpa: *Allocator) void {
gpa.free(self.allocatedBytes());
self.* = undefined;
}
/// The caller owns the returned memory. Empties this MultiArrayList.
pub fn toOwnedSlice(self: *Self) Slice {
const result = self.slice();
self.* = .{};
return result;
}
/// Compute pointers to the start of each field of the array.
/// If you need to access multiple fields, calling this may
/// be more efficient than calling `items()` multiple times.
pub fn slice(self: Self) Slice {
var result: Slice = .{
.ptrs = undefined,
.len = self.len,
.capacity = self.capacity,
};
var ptr: [*]u8 = self.bytes;
for (sizes.bytes) |field_size, i| {
result.ptrs[sizes.fields[i]] = ptr;
ptr += field_size * self.capacity;
}
return result;
}
/// Get the slice of values for a specified field.
/// If you need multiple fields, consider calling slice()
/// instead.
pub fn items(self: Self, comptime field: Field) []FieldType(field) {
return self.slice().items(field);
}
/// Overwrite one array element with new data.
pub fn set(self: *Self, index: usize, elem: S) void {
const slices = self.slice();
inline for (fields) |field_info, i| {
slices.items(@intToEnum(Field, i))[index] = @field(elem, field_info.name);
}
}
/// Obtain all the data for one array element.
pub fn get(self: *Self, index: usize) S {
const slices = self.slice();
var result: S = undefined;
inline for (fields) |field_info, i| {
@field(result, field_info.name) = slices.items(@intToEnum(Field, i))[index];
}
return result;
}
/// Extend the list by 1 element. Allocates more memory as necessary.
pub fn append(self: *Self, gpa: *Allocator, elem: S) !void {
try self.ensureUnusedCapacity(gpa, 1);
self.appendAssumeCapacity(elem);
}
/// Extend the list by 1 element, but asserting `self.capacity`
/// is sufficient to hold an additional item.
pub fn appendAssumeCapacity(self: *Self, elem: S) void {
assert(self.len < self.capacity);
self.len += 1;
self.set(self.len - 1, elem);
}
/// Extend the list by 1 element, asserting `self.capacity`
/// is sufficient to hold an additional item. Returns the
/// newly reserved index with uninitialized data.
pub fn addOneAssumeCapacity(self: *Self) usize {
assert(self.len < self.capacity);
const index = self.len;
self.len += 1;
return index;
}
/// Inserts an item into an ordered list. Shifts all elements
/// after and including the specified index back by one and
/// sets the given index to the specified element. May reallocate
/// and invalidate iterators.
pub fn insert(self: *Self, gpa: *Allocator, index: usize, elem: S) void {
try self.ensureCapacity(gpa, self.len + 1);
self.insertAssumeCapacity(index, elem);
}
/// Inserts an item into an ordered list which has room for it.
/// Shifts all elements after and including the specified index
/// back by one and sets the given index to the specified element.
/// Will not reallocate the array, does not invalidate iterators.
pub fn insertAssumeCapacity(self: *Self, index: usize, elem: S) void {
assert(self.len < self.capacity);
assert(index <= self.len);
self.len += 1;
const slices = self.slice();
inline for (fields) |field_info, field_index| {
const field_slice = slices.items(@intToEnum(Field, field_index));
var i: usize = self.len-1;
while (i > index) : (i -= 1) {
field_slice[i] = field_slice[i-1];
}
field_slice[index] = @field(elem, field_info.name);
}
}
/// Remove the specified item from the list, swapping the last
/// item in the list into its position. Fast, but does not
/// retain list ordering.
pub fn swapRemove(self: *Self, index: usize) void {
const slices = self.slice();
inline for (fields) |field_info, i| {
const field_slice = slices.items(@intToEnum(Field, i));
field_slice[index] = field_slice[self.len-1];
field_slice[self.len-1] = undefined;
}
self.len -= 1;
}
/// Remove the specified item from the list, shifting items
/// after it to preserve order.
pub fn orderedRemove(self: *Self, index: usize) void {
const slices = self.slice();
inline for (fields) |field_info, field_index| {
const field_slice = slices.items(@intToEnum(Field, field_index));
var i = index;
while (i < self.len-1) : (i += 1) {
field_slice[i] = field_slice[i+1];
}
field_slice[i] = undefined;
}
self.len -= 1;
}
/// Adjust the list's length to `new_len`.
/// Does not initialize added items, if any.
pub fn resize(self: *Self, gpa: *Allocator, new_len: usize) !void {
try self.ensureTotalCapacity(gpa, new_len);
self.len = new_len;
}
/// Attempt to reduce allocated capacity to `new_len`.
/// If `new_len` is greater than zero, this may fail to reduce the capacity,
/// but the data remains intact and the length is updated to new_len.
pub fn shrinkAndFree(self: *Self, gpa: *Allocator, new_len: usize) void {
if (new_len == 0) {
gpa.free(self.allocatedBytes());
self.* = .{};
return;
}
assert(new_len <= self.capacity);
assert(new_len <= self.len);
const other_bytes = gpa.allocAdvanced(
u8,
@alignOf(S),
capacityInBytes(new_len),
.exact,
) catch {
const self_slice = self.slice();
inline for (fields) |field_info, i| {
if (@sizeOf(field_info.field_type) != 0) {
const field = @intToEnum(Field, i);
const dest_slice = self_slice.items(field)[new_len..];
const byte_count = dest_slice.len * @sizeOf(field_info.field_type);
// We use memset here for more efficient codegen in safety-checked,
// valgrind-enabled builds. Otherwise the valgrind client request
// will be repeated for every element.
@memset(@ptrCast([*]u8, dest_slice.ptr), undefined, byte_count);
}
}
self.len = new_len;
return;
};
var other = Self{
.bytes = other_bytes.ptr,
.capacity = new_len,
.len = new_len,
};
self.len = new_len;
const self_slice = self.slice();
const other_slice = other.slice();
inline for (fields) |field_info, i| {
if (@sizeOf(field_info.field_type) != 0) {
const field = @intToEnum(Field, i);
// TODO we should be able to use std.mem.copy here but it causes a
// test failure on aarch64 with -OReleaseFast
const src_slice = mem.sliceAsBytes(self_slice.items(field));
const dst_slice = mem.sliceAsBytes(other_slice.items(field));
@memcpy(dst_slice.ptr, src_slice.ptr, src_slice.len);
}
}
gpa.free(self.allocatedBytes());
self.* = other;
}
/// Reduce length to `new_len`.
/// Invalidates pointers to elements `items[new_len..]`.
/// Keeps capacity the same.
pub fn shrinkRetainingCapacity(self: *Self, new_len: usize) void {
self.len = new_len;
}
/// Deprecated: call `ensureUnusedCapacity` or `ensureTotalCapacity`.
pub const ensureCapacity = ensureTotalCapacity;
/// Modify the array so that it can hold at least `new_capacity` items.
/// Implements super-linear growth to achieve amortized O(1) append operations.
/// Invalidates pointers if additional memory is needed.
pub fn ensureTotalCapacity(self: *Self, gpa: *Allocator, new_capacity: usize) !void {
var better_capacity = self.capacity;
if (better_capacity >= new_capacity) return;
while (true) {
better_capacity += better_capacity / 2 + 8;
if (better_capacity >= new_capacity) break;
}
return self.setCapacity(gpa, better_capacity);
}
/// Modify the array so that it can hold at least `additional_count` **more** items.
/// Invalidates pointers if additional memory is needed.
pub fn ensureUnusedCapacity(self: *Self, gpa: *Allocator, additional_count: usize) !void {
return self.ensureTotalCapacity(gpa, self.len + additional_count);
}
/// Modify the array so that it can hold exactly `new_capacity` items.
/// Invalidates pointers if additional memory is needed.
/// `new_capacity` must be greater or equal to `len`.
pub fn setCapacity(self: *Self, gpa: *Allocator, new_capacity: usize) !void {
assert(new_capacity >= self.len);
const new_bytes = try gpa.allocAdvanced(
u8,
@alignOf(S),
capacityInBytes(new_capacity),
.exact,
);
if (self.len == 0) {
gpa.free(self.allocatedBytes());
self.bytes = new_bytes.ptr;
self.capacity = new_capacity;
return;
}
var other = Self{
.bytes = new_bytes.ptr,
.capacity = new_capacity,
.len = self.len,
};
const self_slice = self.slice();
const other_slice = other.slice();
inline for (fields) |field_info, i| {
if (@sizeOf(field_info.field_type) != 0) {
const field = @intToEnum(Field, i);
// TODO we should be able to use std.mem.copy here but it causes a
// test failure on aarch64 with -OReleaseFast
const src_slice = mem.sliceAsBytes(self_slice.items(field));
const dst_slice = mem.sliceAsBytes(other_slice.items(field));
@memcpy(dst_slice.ptr, src_slice.ptr, src_slice.len);
}
}
gpa.free(self.allocatedBytes());
self.* = other;
}
/// Create a copy of this list with a new backing store,
/// using the specified allocator.
pub fn clone(self: Self, gpa: *Allocator) !Self {
var result = Self{};
errdefer result.deinit(gpa);
try result.ensureCapacity(gpa, self.len);
result.len = self.len;
const self_slice = self.slice();
const result_slice = result.slice();
inline for (fields) |field_info, i| {
if (@sizeOf(field_info.field_type) != 0) {
const field = @intToEnum(Field, i);
// TODO we should be able to use std.mem.copy here but it causes a
// test failure on aarch64 with -OReleaseFast
const src_slice = mem.sliceAsBytes(self_slice.items(field));
const dst_slice = mem.sliceAsBytes(result_slice.items(field));
@memcpy(dst_slice.ptr, src_slice.ptr, src_slice.len);
}
}
return result;
}
fn capacityInBytes(capacity: usize) usize {
const sizes_vector: std.meta.Vector(sizes.bytes.len, usize) = sizes.bytes;
const capacity_vector = @splat(sizes.bytes.len, capacity);
return @reduce(.Add, capacity_vector * sizes_vector);
}
fn allocatedBytes(self: Self) []align(@alignOf(S)) u8 {
return self.bytes[0..capacityInBytes(self.capacity)];
}
fn FieldType(field: Field) type {
return meta.fieldInfo(S, field).field_type;
}
};
}
test "basic usage" {
const ally = testing.allocator;
const Foo = struct {
a: u32,
b: []const u8,
c: u8,
};
var list = MultiArrayList(Foo){};
defer list.deinit(ally);
try testing.expectEqual(@as(usize, 0), list.items(.a).len);
try list.ensureTotalCapacity(ally, 2);
list.appendAssumeCapacity(.{
.a = 1,
.b = "foobar",
.c = 'a',
});
list.appendAssumeCapacity(.{
.a = 2,
.b = "zigzag",
.c = 'b',
});
try testing.expectEqualSlices(u32, list.items(.a), &[_]u32{ 1, 2 });
try testing.expectEqualSlices(u8, list.items(.c), &[_]u8{ 'a', 'b' });
try testing.expectEqual(@as(usize, 2), list.items(.b).len);
try testing.expectEqualStrings("foobar", list.items(.b)[0]);
try testing.expectEqualStrings("zigzag", list.items(.b)[1]);
try list.append(ally, .{
.a = 3,
.b = "fizzbuzz",
.c = 'c',
});
try testing.expectEqualSlices(u32, list.items(.a), &[_]u32{ 1, 2, 3 });
try testing.expectEqualSlices(u8, list.items(.c), &[_]u8{ 'a', 'b', 'c' });
try testing.expectEqual(@as(usize, 3), list.items(.b).len);
try testing.expectEqualStrings("foobar", list.items(.b)[0]);
try testing.expectEqualStrings("zigzag", list.items(.b)[1]);
try testing.expectEqualStrings("fizzbuzz", list.items(.b)[2]);
// Add 6 more things to force a capacity increase.
var i: usize = 0;
while (i < 6) : (i += 1) {
try list.append(ally, .{
.a = @intCast(u32, 4 + i),
.b = "whatever",
.c = @intCast(u8, 'd' + i),
});
}
try testing.expectEqualSlices(
u32,
&[_]u32{ 1, 2, 3, 4, 5, 6, 7, 8, 9 },
list.items(.a),
);
try testing.expectEqualSlices(
u8,
&[_]u8{ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i' },
list.items(.c),
);
list.shrinkAndFree(ally, 3);
try testing.expectEqualSlices(u32, list.items(.a), &[_]u32{ 1, 2, 3 });
try testing.expectEqualSlices(u8, list.items(.c), &[_]u8{ 'a', 'b', 'c' });
try testing.expectEqual(@as(usize, 3), list.items(.b).len);
try testing.expectEqualStrings("foobar", list.items(.b)[0]);
try testing.expectEqualStrings("zigzag", list.items(.b)[1]);
try testing.expectEqualStrings("fizzbuzz", list.items(.b)[2]);
}
// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes
// function used the @reduce code path.
test "regression test for @reduce bug" {
const ally = testing.allocator;
var list = MultiArrayList(struct {
tag: std.zig.Token.Tag,
start: u32,
}){};
defer list.deinit(ally);
try list.ensureTotalCapacity(ally, 20);
try list.append(ally, .{ .tag = .keyword_const, .start = 0 });
try list.append(ally, .{ .tag = .identifier, .start = 6 });
try list.append(ally, .{ .tag = .equal, .start = 10 });
try list.append(ally, .{ .tag = .builtin, .start = 12 });
try list.append(ally, .{ .tag = .l_paren, .start = 19 });
try list.append(ally, .{ .tag = .string_literal, .start = 20 });
try list.append(ally, .{ .tag = .r_paren, .start = 25 });
try list.append(ally, .{ .tag = .semicolon, .start = 26 });
try list.append(ally, .{ .tag = .keyword_pub, .start = 29 });
try list.append(ally, .{ .tag = .keyword_fn, .start = 33 });
try list.append(ally, .{ .tag = .identifier, .start = 36 });
try list.append(ally, .{ .tag = .l_paren, .start = 40 });
try list.append(ally, .{ .tag = .r_paren, .start = 41 });
try list.append(ally, .{ .tag = .identifier, .start = 43 });
try list.append(ally, .{ .tag = .bang, .start = 51 });
try list.append(ally, .{ .tag = .identifier, .start = 52 });
try list.append(ally, .{ .tag = .l_brace, .start = 57 });
try list.append(ally, .{ .tag = .identifier, .start = 63 });
try list.append(ally, .{ .tag = .period, .start = 66 });
try list.append(ally, .{ .tag = .identifier, .start = 67 });
try list.append(ally, .{ .tag = .period, .start = 70 });
try list.append(ally, .{ .tag = .identifier, .start = 71 });
try list.append(ally, .{ .tag = .l_paren, .start = 75 });
try list.append(ally, .{ .tag = .string_literal, .start = 76 });
try list.append(ally, .{ .tag = .comma, .start = 113 });
try list.append(ally, .{ .tag = .period, .start = 115 });
try list.append(ally, .{ .tag = .l_brace, .start = 116 });
try list.append(ally, .{ .tag = .r_brace, .start = 117 });
try list.append(ally, .{ .tag = .r_paren, .start = 118 });
try list.append(ally, .{ .tag = .semicolon, .start = 119 });
try list.append(ally, .{ .tag = .r_brace, .start = 121 });
try list.append(ally, .{ .tag = .eof, .start = 123 });
const tags = list.items(.tag);
try testing.expectEqual(tags[1], .identifier);
try testing.expectEqual(tags[2], .equal);
try testing.expectEqual(tags[3], .builtin);
try testing.expectEqual(tags[4], .l_paren);
try testing.expectEqual(tags[5], .string_literal);
try testing.expectEqual(tags[6], .r_paren);
try testing.expectEqual(tags[7], .semicolon);
try testing.expectEqual(tags[8], .keyword_pub);
try testing.expectEqual(tags[9], .keyword_fn);
try testing.expectEqual(tags[10], .identifier);
try testing.expectEqual(tags[11], .l_paren);
try testing.expectEqual(tags[12], .r_paren);
try testing.expectEqual(tags[13], .identifier);
try testing.expectEqual(tags[14], .bang);
try testing.expectEqual(tags[15], .identifier);
try testing.expectEqual(tags[16], .l_brace);
try testing.expectEqual(tags[17], .identifier);
try testing.expectEqual(tags[18], .period);
try testing.expectEqual(tags[19], .identifier);
try testing.expectEqual(tags[20], .period);
try testing.expectEqual(tags[21], .identifier);
try testing.expectEqual(tags[22], .l_paren);
try testing.expectEqual(tags[23], .string_literal);
try testing.expectEqual(tags[24], .comma);
try testing.expectEqual(tags[25], .period);
try testing.expectEqual(tags[26], .l_brace);
try testing.expectEqual(tags[27], .r_brace);
try testing.expectEqual(tags[28], .r_paren);
try testing.expectEqual(tags[29], .semicolon);
try testing.expectEqual(tags[30], .r_brace);
try testing.expectEqual(tags[31], .eof);
}
test "ensure capacity on empty list" {
const ally = testing.allocator;
const Foo = struct {
a: u32,
b: u8,
};
var list = MultiArrayList(Foo){};
defer list.deinit(ally);
try list.ensureTotalCapacity(ally, 2);
list.appendAssumeCapacity(.{ .a = 1, .b = 2 });
list.appendAssumeCapacity(.{ .a = 3, .b = 4 });
try testing.expectEqualSlices(u32, &[_]u32{ 1, 3 }, list.items(.a));
try testing.expectEqualSlices(u8, &[_]u8{ 2, 4 }, list.items(.b));
list.len = 0;
list.appendAssumeCapacity(.{ .a = 5, .b = 6 });
list.appendAssumeCapacity(.{ .a = 7, .b = 8 });
try testing.expectEqualSlices(u32, &[_]u32{ 5, 7 }, list.items(.a));
try testing.expectEqualSlices(u8, &[_]u8{ 6, 8 }, list.items(.b));
list.len = 0;
try list.ensureTotalCapacity(ally, 16);
list.appendAssumeCapacity(.{ .a = 9, .b = 10 });
list.appendAssumeCapacity(.{ .a = 11, .b = 12 });
try testing.expectEqualSlices(u32, &[_]u32{ 9, 11 }, list.items(.a));
try testing.expectEqualSlices(u8, &[_]u8{ 10, 12 }, list.items(.b));
} | lib/std/multi_array_list.zig |
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const Mir = @This();
const bits = @import("bits.zig");
const Air = @import("../../Air.zig");
const Instruction = bits.Instruction;
const Register = bits.Register;
instructions: std.MultiArrayList(Inst).Slice,
/// The meaning of this data is determined by `Inst.Tag` value.
extra: []const u32,
pub const Inst = struct {
tag: Tag,
/// The meaning of this depends on `tag`.
data: Data,
pub const Tag = enum(u16) {
/// Pseudo-instruction: End of prologue
dbg_prologue_end,
/// Pseudo-instruction: Beginning of epilogue
dbg_epilogue_begin,
/// Pseudo-instruction: Update debug line
dbg_line,
// All the real instructions are ordered by their section number
// in The SPARC Architecture Manual, Version 9.
/// A.2 Add
/// This uses the arithmetic_3op field.
// TODO add other operations.
add,
/// A.7 Branch on Integer Condition Codes with Prediction (BPcc)
/// This uses the branch_predict field.
bpcc,
/// A.8 Call and Link
/// This uses the branch_link field.
call,
/// A.24 Jump and Link
/// This uses the arithmetic_3op field.
jmpl,
/// A.27 Load Integer
/// This uses the arithmetic_3op field.
/// Note that the ldd variant of this instruction is deprecated, so do not emit
/// it unless specifically requested (e.g. by inline assembly).
// TODO add other operations.
ldub,
lduh,
lduw,
ldx,
/// A.31 Logical Operations
/// This uses the arithmetic_3op field.
// TODO add other operations.
@"or",
/// A.40 No Operation
/// This uses the nop field.
nop,
/// A.45 RETURN
/// This uses the arithmetic_2op field.
@"return",
/// A.46 SAVE and RESTORE
/// This uses the arithmetic_3op field.
save,
restore,
/// A.48 SETHI
/// This uses the sethi field.
sethi,
/// A.49 Shift
/// This uses the shift field.
// TODO add other operations.
sllx,
/// A.54 Store Integer
/// This uses the arithmetic_3op field.
/// Note that the std variant of this instruction is deprecated, so do not emit
/// it unless specifically requested (e.g. by inline assembly).
// TODO add other operations.
stb,
sth,
stw,
stx,
/// A.56 Subtract
/// This uses the arithmetic_3op field.
// TODO add other operations.
sub,
/// A.61 Trap on Integer Condition Codes (Tcc)
/// This uses the trap field.
tcc,
};
/// The position of an MIR instruction within the `Mir` instructions array.
pub const Index = u32;
/// All instructions have a 8-byte payload, which is contained within
/// this union. `Tag` determines which union field is active, as well as
/// how to interpret the data within.
// TODO this is a quick-n-dirty solution that needs to be cleaned up.
pub const Data = union {
/// Debug info: line and column
///
/// Used by e.g. dbg_line
dbg_line_column: struct {
line: u32,
column: u32,
},
/// Two operand arithmetic.
/// if is_imm true then it uses the imm field of rs2_or_imm,
/// otherwise it uses rs2 field.
///
/// Used by e.g. return
arithmetic_2op: struct {
is_imm: bool,
rs1: Register,
rs2_or_imm: union {
rs2: Register,
imm: i13,
},
},
/// Three operand arithmetic.
/// if is_imm true then it uses the imm field of rs2_or_imm,
/// otherwise it uses rs2 field.
///
/// Used by e.g. add, sub
arithmetic_3op: struct {
is_imm: bool,
rd: Register,
rs1: Register,
rs2_or_imm: union {
rs2: Register,
imm: i13,
},
},
/// Branch and link (always unconditional).
/// Used by e.g. call
branch_link: struct {
inst: Index,
link: Register = .o7,
},
/// Branch with prediction.
/// Used by e.g. bpcc
branch_predict: struct {
annul: bool = false,
pt: bool = true,
ccr: Instruction.CCR,
cond: Instruction.Condition,
inst: Index,
},
/// No additional data
///
/// Used by e.g. flushw
nop: void,
/// SETHI operands.
///
/// Used by sethi
sethi: struct {
rd: Register,
imm: u22,
},
/// Shift operands.
/// if is_imm true then it uses the imm field of rs2_or_imm,
/// otherwise it uses rs2 field.
///
/// Used by e.g. add, sub
shift: struct {
is_imm: bool,
width: Instruction.ShiftWidth,
rd: Register,
rs1: Register,
rs2_or_imm: union {
rs2: Register,
imm: u6,
},
},
/// Trap.
/// if is_imm true then it uses the imm field of rs2_or_imm,
/// otherwise it uses rs2 field.
///
/// Used by e.g. tcc
trap: struct {
is_imm: bool = true,
cond: Instruction.Condition,
ccr: Instruction.CCR = .icc,
rs1: Register = .g0,
rs2_or_imm: union {
rs2: Register,
imm: u7,
},
},
};
// Make sure we don't accidentally make instructions bigger than expected.
// Note that in Debug builds, Zig is allowed to insert a secret field for safety checks.
comptime {
if (builtin.mode != .Debug) {
assert(@sizeOf(Data) == 8);
}
}
};
pub fn deinit(mir: *Mir, gpa: std.mem.Allocator) void {
mir.instructions.deinit(gpa);
gpa.free(mir.extra);
mir.* = undefined;
}
/// Returns the requested data, as well as the new index which is at the start of the
/// trailers for the object.
pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end: usize } {
const fields = std.meta.fields(T);
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
@field(result, field.name) = switch (field.field_type) {
u32 => mir.extra[i],
i32 => @bitCast(i32, mir.extra[i]),
else => @compileError("bad field type"),
};
i += 1;
}
return .{
.data = result,
.end = i,
};
} | src/arch/sparcv9/Mir.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = mem.Allocator;
const assert = std.debug.assert;
pub fn RingBuffer(comptime T: type, comptime len_opt: ?usize) type {
return struct {
const Self = @This();
const Cond = if (len_opt) |buffer_len| struct {
const Buffer = [buffer_len]T;
const Alloc = void;
const resizeAssumeEmpty = @compileError("this method is only available " ++
"for dynamically sized RingBuffer values");
fn init() Self {
return Self{
.data = undefined,
.alloc = {},
.next = 0,
.last = 0,
};
}
fn deinit(self: *Self) void {
_ = self;
}
} else struct {
const Buffer = []T;
const Alloc = Allocator;
fn init(size: usize, alloc: Allocator) !Self {
const data = try alloc.allocAdvanced(T, null, size, .at_least);
return Self{
.data = data,
.alloc = alloc,
.next = 0,
.last = 0,
};
}
fn deinit(self: *Self) void {
self.alloc.free(self.data);
}
fn resizeAssumeEmpty(self: *Self, new_len: usize) !void {
assert(self.isEmpty());
self.next = 0;
self.last = 0;
if (self.alloc.resize(self.data)) |new_slice| {
self.data = new_slice;
}
// since the container is empty, we can just free previous buffer
self.alloc.free(self.data);
self.data = try self.alloc.allocAdvanced(T, null, new_len, .at_least);
}
};
data: Cond.Buffer,
alloc: Cond.Alloc,
next: usize,
last: usize,
pub const init = Cond.init;
pub const deinit = Cond.deinit;
pub const resizeAssumeEmpty = Cond.resizeAssumeEmpty;
pub fn resetCountersIfEmpty(self: *Self) bool {
if (self.isEmpty()) {
self.next = 0;
self.last = 0;
return true;
}
return false;
}
pub fn isEmpty(self: *const Self) bool {
return self.next == self.last;
}
pub fn len(self: *const Self) usize {
return self.next - self.last;
}
pub fn push(self: *Self, t: T) bool {
return self.pushMany(&.{t}) > 0;
}
pub fn pop(self: *Self) ?T {
var data = [1]T{undefined};
if (self.popMany(&data).len > 0) {
return data[0];
}
return null;
}
pub fn pushMany(self: *Self, data: []const T) usize {
const end = std.math.min(self.last + self.data.len, self.next + data.len);
const allocs = circularIndex(self.next, end, &self.data);
self.next += allocs.len;
const split_point = allocs.first.len;
mem.copy(T, allocs.first, data[0..split_point]);
mem.copy(T, allocs.second, data[split_point..allocs.len]);
return allocs.len;
}
pub fn popMany(self: *Self, data: []T) []T {
const end = std.math.min(self.next, self.last + data.len);
const allocs = circularIndex(self.last, end, &self.data);
self.last += allocs.len;
const split_point = allocs.first.len;
mem.copy(T, data[0..split_point], allocs.first);
mem.copy(T, data[split_point..allocs.len], allocs.second);
return data[0..allocs.len];
}
pub fn allocPush(self: *Self, count: usize) ?[]T {
const end = std.math.min(self.last + self.data.len, self.next + count);
const allocs = circularIndex(self.next, end, &self.data);
if (allocs.len > allocs.first) {
return null;
}
self.next += allocs.len;
return allocs.first;
}
pub const SplitBuffer = struct {
first: []T = &.{},
second: []T = &.{},
len: usize = 0,
};
fn circularIndex(begin: usize, end: usize, data: []T) SplitBuffer {
assert(begin <= end);
var out = SplitBuffer{ .len = end - begin };
assert(out.len <= data.len);
if (begin == end) {
return out;
}
const begin_idx = begin % data.len;
const end_idx = end % data.len;
if (begin_idx < end_idx) {
out.first = data[begin_idx..end_idx];
} else {
out.first = data[begin_idx..data.len];
out.second = data[0..end_idx];
}
assert(out.first.len + out.second.len == out.len);
return out;
}
};
}
test "RingBuffer: capacity safety" {
const TBuffer = RingBuffer(u8, 16);
var messages: TBuffer = TBuffer.init();
var i: u8 = undefined;
var cap: u32 = 0;
i = 0;
while (i < 32) : (i += 1) {
if (messages.push(i)) {
cap += 1;
}
}
var popCap: u32 = 0;
i = 0;
while (i < 32) : (i += 1) {
if (messages.pop()) |c| {
try std.testing.expect(c == i);
popCap += 1;
}
}
try std.testing.expect(popCap == cap);
}
test "RingBuffer: data integrity" {
const TBuffer = RingBuffer(u8, 16);
var messages: TBuffer = TBuffer.init();
var i: u8 = undefined;
i = 0;
while (i < 16) : (i += 1) {
const success = messages.push(i);
assert(success);
}
i = 0;
while (i < 8) : (i += 1) {
if (messages.pop()) |c| {
try std.testing.expect(c == i);
}
}
i = 0;
while (i < 8) : (i += 1) {
const success = messages.push(i + 16);
assert(success);
}
i = 0;
while (i < 16) : (i += 1) {
if (messages.pop()) |c| {
try std.testing.expect(c == i + 8);
}
}
}
const LruConst = struct {
const MAX = std.math.maxInt(u32);
const TOMBSTONE = MAX;
const EMPTY = MAX - 1;
const LNode = struct {
next: u32,
prev: u32,
hash: u64,
fn debug(node: *const LNode, idx: u32) void {
if (node.next == EMPTY) {
std.debug.print("{}: EMPTY\n", .{idx});
} else if (node.next == TOMBSTONE) {
std.debug.print("{}: TOMB \n", .{idx});
} else {
std.debug.print("{}: hash: {} {}<- ->{} \n", .{
idx,
node.hash,
node.prev,
node.next,
});
}
}
};
};
pub fn LRU(comptime V: type) type {
const TOMBSTONE = LruConst.TOMBSTONE;
const EMPTY = LruConst.EMPTY;
const LNode = LruConst.LNode;
// Uses circular doubly linked list to store implicit LRU statuses
return struct {
last: u32 = undefined,
len: u32 = 0,
capacity: u32,
meta: [*]LNode,
values: [*]V,
const Self = @This();
const alignment = std.math.max(@alignOf(V), @alignOf(LNode));
fn allocSize(size: u32) usize {
const unaligned = size * (@sizeOf(V) + @sizeOf(LNode));
return mem.alignForward(unaligned, alignment);
}
pub fn init(alloc: Allocator, size: u32) !Self {
if (size >= EMPTY or size == 0) return error.InvalidParam;
const byte_size = allocSize(size);
const data = try alloc.alignedAlloc(u8, alignment, byte_size);
const unaligned_values = @ptrToInt(data.ptr) + (size * @sizeOf(LNode));
const values = mem.alignForward(unaligned_values, alignment);
var self = Self{
.meta = @ptrCast([*]LNode, data.ptr),
.values = @intToPtr([*]V, values),
.capacity = size,
};
self.clear();
return self;
}
pub fn deinit(self: *Self, alloc: Allocator) void {
var bytes: []u8 = &.{};
bytes.ptr = @ptrCast([*]u8, self.meta);
bytes.len = allocSize(self.capacity);
alloc.free(bytes);
}
pub fn clear(self: *Self) void {
for (self._meta()) |*slot| slot.next = EMPTY;
self.len = 0;
}
fn _meta(self: *const Self) []LNode {
var meta: []LNode = &.{};
meta.ptr = self.meta;
meta.len = self.capacity;
return meta;
}
fn _values(self: *const Self) []V {
var values: []V = &.{};
values.ptr = self.values;
values.len = self.capacity;
return values;
}
fn search(self: *const Self, hash: u64) ?u32 {
if (self.len == 0) return null;
var index = @truncate(u32, hash % self.capacity);
const meta = self._meta();
var count: u32 = 0;
while (count < self.capacity) : (count += 1) {
const node = &meta[index];
if (node.next == EMPTY) return null;
if (node.next != TOMBSTONE and node.hash == hash) return index;
index += 1;
if (index >= self.capacity) index = 0;
}
return null;
}
fn removeNodeFromChain(self: *Self, index: u32) *LNode {
const meta = self._meta();
const node = &meta[index];
const prev = &meta[node.prev];
const next = &meta[node.next];
prev.next = node.next;
next.prev = node.prev;
if (index == self.last) {
self.last = node.prev;
}
return node;
}
fn addNodeToEndOfChain(self: *Self, index: u32) void {
const meta = self._meta();
const slot = &meta[index];
const last = &meta[self.last];
const first = &meta[last.next];
slot.prev = self.last;
slot.next = last.next;
last.next = index;
first.prev = index;
self.last = index;
}
pub fn read(self: *Self, hash: u64) ?*V {
const index = self.search(hash) orelse return null;
_ = self.removeNodeFromChain(index);
self.addNodeToEndOfChain(index);
const values = self._values();
return &values[index];
}
pub fn remove(self: *Self, hash: u64) ?V {
const index = self.search(hash) orelse return null;
const values = self._values();
const node = self.removeNodeFromChain(index);
node.next = TOMBSTONE;
self.len -= 1;
return values[index];
}
pub fn insert(self: *Self, hash: u64, value: V) ?V {
const meta = self._meta();
const values = self._values();
var index = @truncate(u32, hash % self.capacity);
if (self.len == 0) {
const node = &meta[index];
self.last = index;
node.next = index;
node.prev = index;
self.len += 1;
node.hash = hash;
values[index] = value;
return null;
}
var previous: ?V = null;
const slot = slot: {
var count: u32 = 0;
while (count < self.capacity) : (count += 1) {
const node = &meta[index];
const empty_slot = node.next == TOMBSTONE or node.next == EMPTY;
if (empty_slot) {
self.len += 1;
break :slot node;
}
if (node.hash == hash) {
_ = self.removeNodeFromChain(index);
previous = values[index];
break :slot node;
}
index += 1;
if (index >= self.capacity) index = 0;
}
// LRU stuff
const last = &meta[self.last];
index = last.next;
const first = self.removeNodeFromChain(index);
previous = values[index];
break :slot first;
};
self.addNodeToEndOfChain(index);
slot.hash = hash;
values[index] = value;
return previous;
}
};
}
test "LRU: ordering" {
const liu = @import("./lib.zig");
var lru = try LRU(u32).init(liu.Pages, 100);
defer lru.deinit(liu.Pages);
var i: u32 = 0;
while (i < 100) : (i += 1) {
const res = lru.insert(i, i + 1);
try std.testing.expect(res == null);
}
i = 0;
while (i < 100) : (i += 2) {
const res = lru.remove(i);
try std.testing.expect(res == i + 1);
}
i = 0;
while (i < 100) : (i += 1) {
const res = lru.read(i);
if (@mod(i, 2) == 0) {
try std.testing.expect(res == null);
} else if (res) |r| {
try std.testing.expect(r.* == i + 1);
} else {
try std.testing.expect(false);
}
}
i = 0;
while (i < 100) : (i += 2) {
const res = lru.insert(i, i + 1);
try std.testing.expect(res == null);
}
i = 1;
while (i < 100) : (i += 2) {
const res = lru.insert(i + 100, i + 1);
try std.testing.expect(res == i + 1);
}
i = 0;
while (i < 100) : (i += 2) {
const res = lru.insert(i + 100, i + 1);
try std.testing.expect(res == i + 1);
}
try std.testing.expect(lru.len == 100);
i = 1;
while (i < 100) : (i += 2) {
const res = lru.remove(i + 100);
try std.testing.expect(res == i + 1);
}
try std.testing.expect(lru.len == 50);
i = 0;
while (i < 100) : (i += 2) {
const res = lru.remove(i + 100);
try std.testing.expect(res == i + 1);
}
try std.testing.expect(lru.len == 0);
} | src/liu/buffers.zig |
pub fn isNumeric(cp: u21) bool {
if (cp < 0xbc or cp > 0x2f890) return false;
return switch (cp) {
0xbc...0xbe => true,
0x9f4...0x9f9 => true,
0xb72...0xb77 => true,
0xbf0...0xbf2 => true,
0xc78...0xc7e => true,
0xd58...0xd5e => true,
0xd70...0xd78 => true,
0xf2a...0xf33 => true,
0x1372...0x137c => true,
0x16ee...0x16f0 => true,
0x17f0...0x17f9 => true,
0x2150...0x215f => true,
0x2160...0x2182 => true,
0x2185...0x2188 => true,
0x2189 => true,
0x2469...0x2473 => true,
0x247d...0x2487 => true,
0x2491...0x249b => true,
0x24eb...0x24f4 => true,
0x24fe => true,
0x277f => true,
0x2789 => true,
0x2793 => true,
0x2cfd => true,
0x3007 => true,
0x3021...0x3029 => true,
0x3038...0x303a => true,
0x3192...0x3195 => true,
0x3220...0x3229 => true,
0x3248...0x324f => true,
0x3251...0x325f => true,
0x3280...0x3289 => true,
0x32b1...0x32bf => true,
0x3405 => true,
0x3483 => true,
0x382a => true,
0x3b4d => true,
0x4e00 => true,
0x4e03 => true,
0x4e07 => true,
0x4e09 => true,
0x4e5d => true,
0x4e8c => true,
0x4e94 => true,
0x4e96 => true,
0x4ebf...0x4ec0 => true,
0x4edf => true,
0x4ee8 => true,
0x4f0d => true,
0x4f70 => true,
0x5104 => true,
0x5146 => true,
0x5169 => true,
0x516b => true,
0x516d => true,
0x5341 => true,
0x5343...0x5345 => true,
0x534c => true,
0x53c1...0x53c4 => true,
0x56db => true,
0x58f1 => true,
0x58f9 => true,
0x5e7a => true,
0x5efe...0x5eff => true,
0x5f0c...0x5f0e => true,
0x5f10 => true,
0x62fe => true,
0x634c => true,
0x67d2 => true,
0x6f06 => true,
0x7396 => true,
0x767e => true,
0x8086 => true,
0x842c => true,
0x8cae => true,
0x8cb3 => true,
0x8d30 => true,
0x9621 => true,
0x9646 => true,
0x964c => true,
0x9678 => true,
0x96f6 => true,
0xa6e6...0xa6ef => true,
0xa830...0xa835 => true,
0xf96b => true,
0xf973 => true,
0xf978 => true,
0xf9b2 => true,
0xf9d1 => true,
0xf9d3 => true,
0xf9fd => true,
0x10107...0x10133 => true,
0x10140...0x10174 => true,
0x10175...0x10178 => true,
0x1018a...0x1018b => true,
0x102e1...0x102fb => true,
0x10320...0x10323 => true,
0x10341 => true,
0x1034a => true,
0x103d1...0x103d5 => true,
0x10858...0x1085f => true,
0x10879...0x1087f => true,
0x108a7...0x108af => true,
0x108fb...0x108ff => true,
0x10916...0x1091b => true,
0x109bc...0x109bd => true,
0x109c0...0x109cf => true,
0x109d2...0x109ff => true,
0x10a44...0x10a48 => true,
0x10a7d...0x10a7e => true,
0x10a9d...0x10a9f => true,
0x10aeb...0x10aef => true,
0x10b58...0x10b5f => true,
0x10b78...0x10b7f => true,
0x10ba9...0x10baf => true,
0x10cfa...0x10cff => true,
0x10e69...0x10e7e => true,
0x10f1d...0x10f26 => true,
0x10f51...0x10f54 => true,
0x10fc5...0x10fcb => true,
0x1105b...0x11065 => true,
0x111e1...0x111f4 => true,
0x1173a...0x1173b => true,
0x118ea...0x118f2 => true,
0x11c5a...0x11c6c => true,
0x11fc0...0x11fd4 => true,
0x12400...0x1246e => true,
0x16b5b...0x16b61 => true,
0x16e80...0x16e96 => true,
0x1d2e0...0x1d2f3 => true,
0x1d360...0x1d378 => true,
0x1e8c7...0x1e8cf => true,
0x1ec71...0x1ecab => true,
0x1ecad...0x1ecaf => true,
0x1ecb1...0x1ecb4 => true,
0x1ed01...0x1ed2d => true,
0x1ed2f...0x1ed3d => true,
0x1f10b...0x1f10c => true,
0x20001 => true,
0x20064 => true,
0x200e2 => true,
0x20121 => true,
0x2092a => true,
0x20983 => true,
0x2098c => true,
0x2099c => true,
0x20aea => true,
0x20afd => true,
0x20b19 => true,
0x22390 => true,
0x22998 => true,
0x23b1b => true,
0x2626d => true,
0x2f890 => true,
else => false,
};
}
pub fn isDigit(cp: u21) bool {
if (cp < 0xb2 or cp > 0x1f10a) return false;
return switch (cp) {
0xb2...0xb3 => true,
0xb9 => true,
0x1369...0x1371 => true,
0x19da => true,
0x2070 => true,
0x2074...0x2079 => true,
0x2080...0x2089 => true,
0x2460...0x2468 => true,
0x2474...0x247c => true,
0x2488...0x2490 => true,
0x24ea => true,
0x24f5...0x24fd => true,
0x24ff => true,
0x2776...0x277e => true,
0x2780...0x2788 => true,
0x278a...0x2792 => true,
0x10a40...0x10a43 => true,
0x10e60...0x10e68 => true,
0x11052...0x1105a => true,
0x1f100...0x1f10a => true,
else => false,
};
}
pub fn isDecimal(cp: u21) bool {
if (cp < 0x30 or cp > 0x1fbf9) return false;
return switch (cp) {
0x30...0x39 => true,
0x660...0x669 => true,
0x6f0...0x6f9 => true,
0x7c0...0x7c9 => true,
0x966...0x96f => true,
0x9e6...0x9ef => true,
0xa66...0xa6f => true,
0xae6...0xaef => true,
0xb66...0xb6f => true,
0xbe6...0xbef => true,
0xc66...0xc6f => true,
0xce6...0xcef => true,
0xd66...0xd6f => true,
0xde6...0xdef => true,
0xe50...0xe59 => true,
0xed0...0xed9 => true,
0xf20...0xf29 => true,
0x1040...0x1049 => true,
0x1090...0x1099 => true,
0x17e0...0x17e9 => true,
0x1810...0x1819 => true,
0x1946...0x194f => true,
0x19d0...0x19d9 => true,
0x1a80...0x1a89 => true,
0x1a90...0x1a99 => true,
0x1b50...0x1b59 => true,
0x1bb0...0x1bb9 => true,
0x1c40...0x1c49 => true,
0x1c50...0x1c59 => true,
0xa620...0xa629 => true,
0xa8d0...0xa8d9 => true,
0xa900...0xa909 => true,
0xa9d0...0xa9d9 => true,
0xa9f0...0xa9f9 => true,
0xaa50...0xaa59 => true,
0xabf0...0xabf9 => true,
0xff10...0xff19 => true,
0x104a0...0x104a9 => true,
0x10d30...0x10d39 => true,
0x11066...0x1106f => true,
0x110f0...0x110f9 => true,
0x11136...0x1113f => true,
0x111d0...0x111d9 => true,
0x112f0...0x112f9 => true,
0x11450...0x11459 => true,
0x114d0...0x114d9 => true,
0x11650...0x11659 => true,
0x116c0...0x116c9 => true,
0x11730...0x11739 => true,
0x118e0...0x118e9 => true,
0x11950...0x11959 => true,
0x11c50...0x11c59 => true,
0x11d50...0x11d59 => true,
0x11da0...0x11da9 => true,
0x16a60...0x16a69 => true,
0x16ac0...0x16ac9 => true,
0x16b50...0x16b59 => true,
0x1d7ce...0x1d7ff => true,
0x1e140...0x1e149 => true,
0x1e2f0...0x1e2f9 => true,
0x1e950...0x1e959 => true,
0x1fbf0...0x1fbf9 => true,
else => false,
};
} | src/components/autogen/DerivedNumericType.zig |
const std = @import("std");
const tractor = @import("tractor.zig");
const clibs = @import("clibs.zig");
const ray = clibs.ray;
const chip = clibs.chipmunk;
fn makeTexture() ray.RenderTexture2D {
var tex = ray.LoadRenderTexture(8, 8);
ray.BeginTextureMode(tex);
ray.ClearBackground(ray.BLANK);
ray.DrawCircle(4, 4, 4.0, ray.WHITE);
ray.EndTextureMode();
return tex;
}
const bg_png = @embedFile("../resources/bg.png");
const fg_png = @embedFile("../resources/fg.png");
pub fn main() anyerror!void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
var allocator = &arena.allocator;
//try tractor.queryTractor();
//try tractor.runnin();
_ = tractor.tractorLogin(allocator) catch |e| {
switch (e) {
error.FailedToPerformRequest => {
std.debug.print("Could not connect to Tractor\n", .{});
return;
},
else => return e,
}
};
try vis(allocator);
return;
}
fn spawnNewObjects(
space: *chip.cpSpace,
rand: *std.rand.Random,
looks: *Looks,
ctx: *tractor.ThreadContext,
) u32 {
if (!@atomicLoad(bool, &ctx.is_ready, .SeqCst)) {
return 0;
}
var active = @atomicRmw(u32, &ctx.msgs.active, .Xchg, 0, .SeqCst);
var blocked = @atomicRmw(u32, &ctx.msgs.blocked, .Xchg, 0, .SeqCst);
var err = @atomicRmw(u32, &ctx.msgs.err, .Xchg, 0, .SeqCst);
var done = @atomicRmw(u32, &ctx.msgs.done, .Xchg, 0, .SeqCst);
@atomicStore(bool, &ctx.is_ready, false, .SeqCst);
const radius: f64 = 4;
const mass: f64 = 1;
var moment = chip.cpMomentForCircle(mass, 0, radius, chip.cpvzero);
var i: usize = 0;
while (i < active) : (i += 1) {
var x_pos = @intToFloat(f64, rand.intRangeAtMost(u32, 65, 265));
var y_pos = @intToFloat(f64, rand.uintLessThan(u32, 35));
var body = chip.cpSpaceAddBody(space, chip.cpBodyNew(mass, moment)) orelse unreachable;
chip.cpBodySetPosition(body, chip.cpv(x_pos, 610 + y_pos));
chip.cpBodySetUserData(body, @ptrCast(*c_void, &looks.active));
var shape = chip.cpSpaceAddShape(space, chip.cpCircleShapeNew(body, radius, chip.cpvzero));
chip.cpShapeSetFriction(shape, 0.5);
chip.cpShapeSetElasticity(shape, 0.2);
chip.cpShapeSetFilter(shape, active_filter);
}
i = 0;
while (i < blocked) : (i += 1) {
var x_pos = @intToFloat(f64, rand.intRangeAtMost(u32, 65, 265));
var y_pos = @intToFloat(f64, rand.uintLessThan(u32, 35));
var body = chip.cpSpaceAddBody(space, chip.cpBodyNew(mass, moment)) orelse unreachable;
chip.cpBodySetPosition(body, chip.cpv(x_pos, 610 + y_pos));
chip.cpBodySetUserData(body, @ptrCast(*c_void, &looks.blocked));
var shape = chip.cpSpaceAddShape(space, chip.cpCircleShapeNew(body, radius, chip.cpvzero));
chip.cpShapeSetFriction(shape, 0.5);
chip.cpShapeSetElasticity(shape, 0.2);
chip.cpShapeSetFilter(shape, blocked_filter);
}
i = 0;
while (i < done) : (i += 1) {
var x_pos = @intToFloat(f64, rand.intRangeAtMost(u32, 245, 340));
var y_pos = @intToFloat(f64, rand.uintLessThan(u32, 20));
var body = chip.cpSpaceAddBody(space, chip.cpBodyNew(mass, moment)) orelse unreachable;
chip.cpBodySetPosition(body, chip.cpv(x_pos, 600 - 400 + y_pos));
chip.cpBodySetUserData(body, @ptrCast(*c_void, &looks.done));
var shape = chip.cpSpaceAddShape(space, chip.cpCircleShapeNew(body, radius, chip.cpvzero));
chip.cpShapeSetFriction(shape, 0.5);
chip.cpShapeSetElasticity(shape, 0.2);
chip.cpShapeSetFilter(shape, done_filter);
}
i = 0;
while (i < err) : (i += 1) {
var x_pos = @intToFloat(f64, rand.intRangeAtMost(u32, 330, 470));
var y_pos = @intToFloat(f64, rand.uintLessThan(u32, 30));
var body = chip.cpSpaceAddBody(space, chip.cpBodyNew(mass, moment)) orelse unreachable;
chip.cpBodySetPosition(body, chip.cpv(x_pos, 600 - 475 + y_pos));
chip.cpBodySetUserData(body, @ptrCast(*c_void, &looks.err));
var shape = chip.cpSpaceAddShape(space, chip.cpCircleShapeNew(body, radius, chip.cpvzero));
chip.cpShapeSetFriction(shape, 0.5);
chip.cpShapeSetElasticity(shape, 0.2);
chip.cpShapeSetFilter(shape, chip.CP_SHAPE_FILTER_NONE);
}
return active + err + blocked + done;
}
fn cullShape(space: ?*chip.cpSpace, shape: ?*c_void, data: ?*c_void) callconv(.C) void {
_ = data;
chip.cpSpaceRemoveShape(space, @ptrCast(*chip.cpShape, shape));
chip.cpShapeFree(@ptrCast(*chip.cpShape, shape));
}
fn cullBody(space: ?*chip.cpSpace, body: ?*c_void, data: ?*c_void) callconv(.C) void {
_ = data;
chip.cpSpaceRemoveBody(space, @ptrCast(*chip.cpBody, body));
chip.cpBodyFree(@ptrCast(*chip.cpBody, body));
}
fn postCullShapeWrapper(body: ?*chip.cpBody, shape: ?*chip.cpShape, data: ?*c_void) callconv(.C) void {
_ = data;
var space = chip.cpBodyGetSpace(body);
_ = chip.cpSpaceAddPostStepCallback(space, cullShape, shape, null);
}
fn drawShapes(body: ?*chip.cpBody, data: ?*c_void) callconv(.C) void {
var body_data = chip.cpBodyGetUserData(body);
// No color info means not "renderable"
if (body_data == null) return;
var look = @ptrCast(*Look, chip.cpBodyGetUserData(body).?).*;
var pos = chip.cpBodyGetPosition(body);
var space = chip.cpBodyGetSpace(body);
if (pos.y < -10 or (pos.y < (600 - 350) and look.state == 0)) {
chip.cpBodyEachShape(body, postCullShapeWrapper, null);
_ = chip.cpSpaceAddPostStepCallback(space, cullBody, body, null);
}
var tex: *ray.Texture = @ptrCast(*ray.Texture, @alignCast(4, data));
ray.DrawTexture(tex.*, @floatToInt(i32, pos.x), 600 - @floatToInt(i32, pos.y), look.color);
}
const Look = struct {
color: ray.Color,
state: u8,
};
const Looks = struct {
active: Look,
done: Look,
err: Look,
blocked: Look,
};
const active_mask: u32 = 0b1;
const blocked_mask: u32 = 0b10;
const active_ramp_mask: u32 = 0b100;
const blocked_ramp_mask: u32 = 0b1000;
const done_mask: u32 = 0b10000;
const active_ramp_filter = chip.cpShapeFilter{
.group = chip.CP_NO_GROUP,
.categories = active_ramp_mask,
.mask = active_mask,
};
const blocked_ramp_filter = chip.cpShapeFilter{
.group = chip.CP_NO_GROUP,
.categories = blocked_ramp_mask,
.mask = blocked_mask,
};
const active_filter = chip.cpShapeFilter{
.group = chip.CP_NO_GROUP,
.categories = active_mask,
.mask = active_mask | blocked_mask | active_ramp_mask,
};
const blocked_filter = chip.cpShapeFilter{
.group = chip.CP_NO_GROUP,
.categories = blocked_mask,
.mask = active_mask | blocked_mask | blocked_ramp_mask,
};
const done_filter = chip.cpShapeFilter{
.group = chip.CP_NO_GROUP,
.categories = done_mask,
.mask = done_mask,
};
fn vis(allocator: *std.mem.Allocator) !void {
ray.SetTraceLogLevel(ray.LOG_ERROR);
ray.InitWindow(800, 600, "tractorz");
defer ray.CloseWindow();
var tex = makeTexture();
defer ray.UnloadRenderTexture(tex);
//var background = ray.LoadTexture("resources/bg.png");
//defer ray.UnloadTexture(background);
//var foreground = ray.LoadTexture("resources/fg.png");
//defer ray.UnloadTexture(foreground);
var foreground_img = ray.LoadImageFromMemory(".png", fg_png, fg_png.len);
var foreground = ray.LoadTextureFromImage(foreground_img);
var background_img = ray.LoadImageFromMemory(".png", bg_png, bg_png.len);
var background = ray.LoadTextureFromImage(background_img);
var prng = std.rand.DefaultPrng.init(blk: {
var seed: u64 = undefined;
try std.os.getrandom(std.mem.asBytes(&seed));
break :blk seed;
});
const rand = &prng.random;
var looks = Looks{
.active = .{ .color = ray.LIME, .state = 0 },
.done = .{ .color = ray.SKYBLUE, .state = 1 },
.err = .{ .color = ray.RED, .state = 2 },
.blocked = .{ .color = ray.ORANGE, .state = 3 },
};
ray.SetTargetFPS(60);
const gravity = chip.cpv(0, -100);
var space = chip.cpSpaceNew() orelse return;
chip.cpSpaceSetGravity(space, gravity);
//chip.cpSpaceSetDamping(space, 0.9);
var static_body = chip.cpSpaceGetStaticBody(space);
var active_ramp_shape = chip.cpSegmentShapeNew(static_body, chip.cpv(50, 600 - 155), chip.cpv(330, 600 - 200), 10);
chip.cpShapeSetFriction(active_ramp_shape, 0.5);
chip.cpShapeSetElasticity(active_ramp_shape, 0.9);
chip.cpShapeSetFilter(active_ramp_shape, active_ramp_filter);
_ = chip.cpSpaceAddShape(space, active_ramp_shape);
var active_farm_l_shape = chip.cpSegmentShapeNew(static_body, chip.cpv(330, 600 - 280), chip.cpv(370, 600 - 320), 8);
chip.cpShapeSetFriction(active_farm_l_shape, 0.5);
chip.cpShapeSetElasticity(active_farm_l_shape, 1.0);
chip.cpShapeSetFilter(active_farm_l_shape, active_ramp_filter);
_ = chip.cpSpaceAddShape(space, active_farm_l_shape);
var active_farm_r_shape = chip.cpSegmentShapeNew(static_body, chip.cpv(430, 600 - 320), chip.cpv(470, 600 - 280), 8);
chip.cpShapeSetFriction(active_farm_r_shape, 0.5);
chip.cpShapeSetElasticity(active_farm_r_shape, 1.0);
chip.cpShapeSetFilter(active_farm_r_shape, active_ramp_filter);
_ = chip.cpSpaceAddShape(space, active_farm_r_shape);
var ramp_pad_shape = chip.cpSegmentShapeNew(static_body, chip.cpv(50, 600 - 150), chip.cpv(50, 600 - 120), 3);
chip.cpShapeSetFriction(ramp_pad_shape, 0.5);
chip.cpShapeSetElasticity(ramp_pad_shape, 0.9);
chip.cpShapeSetFilter(ramp_pad_shape, .{
.group = chip.CP_NO_GROUP,
.categories = active_ramp_mask | blocked_ramp_mask,
.mask = active_mask | blocked_mask,
});
_ = chip.cpSpaceAddShape(space, ramp_pad_shape);
var blocked_ramp_shape = chip.cpSegmentShapeNew(static_body, chip.cpv(50, 600 - 155), chip.cpv(820, 600 - 278), 10);
chip.cpShapeSetFriction(blocked_ramp_shape, 0.5);
chip.cpShapeSetElasticity(blocked_ramp_shape, 0.9);
chip.cpShapeSetFilter(blocked_ramp_shape, blocked_ramp_filter);
_ = chip.cpSpaceAddShape(space, blocked_ramp_shape);
var done_ramp_shape = chip.cpSegmentShapeNew(static_body, chip.cpv(0, 600 - 490), chip.cpv(380, 600 - 422), 10);
chip.cpShapeSetElasticity(done_ramp_shape, 0.9);
chip.cpShapeSetFriction(done_ramp_shape, 0.3);
chip.cpShapeSetFilter(done_ramp_shape, done_filter);
_ = chip.cpSpaceAddShape(space, done_ramp_shape);
var done_ramp_pad_shape = chip.cpSegmentShapeNew(static_body, chip.cpv(380, 600 - 420), chip.cpv(380, 600 - 360), 10);
chip.cpShapeSetElasticity(done_ramp_pad_shape, 0.9);
chip.cpShapeSetFriction(done_ramp_pad_shape, 0.3);
chip.cpShapeSetFilter(done_ramp_pad_shape, done_filter);
_ = chip.cpSpaceAddShape(space, done_ramp_pad_shape);
const timeStep: f64 = 1.0 / 60.0;
var ctx: tractor.ThreadContext = .{
.allocator = allocator,
.msgs = tractor.Messages{},
.is_ready = false,
};
_ = try tractor.startListener(&ctx);
_ = spawnNewObjects(space, rand, &looks, &ctx);
var show_fps = false;
var hide_fg = false;
while (!ray.WindowShouldClose()) {
_ = spawnNewObjects(space, rand, &looks, &ctx);
chip.cpSpaceStep(space, timeStep);
ray.BeginDrawing();
ray.ClearBackground(ray.BLACK);
ray.DrawTexture(background, 0, 0, ray.WHITE);
chip.cpSpaceEachBody(space, drawShapes, &tex.texture);
if (!hide_fg) {
ray.DrawTexture(foreground, 0, 0, ray.WHITE);
}
if (show_fps) {
ray.DrawFPS(10, 10);
}
ray.EndDrawing();
if (ray.IsKeyPressed(0x46)) show_fps = !show_fps;
if (ray.IsKeyPressed(0x48)) hide_fg = !hide_fg;
}
} | src/main.zig |
const util = @import("../sdf_util.zig");
pub const info: util.SdfInfo = .{
.name = "Displacement Noise",
.data_size = @sizeOf(Data),
.function_definition = function_definition,
.enter_command_fn = enterCommand,
.exit_command_fn = exitCommand,
.sphere_bound_fn = sphereBound,
};
pub const Data = struct {
power: f32,
scale: f32,
};
const function_definition: []const u8 =
// Simplex 2D noise
\\vec3 opDisplaceNoise_permute(vec3 x){
\\ return mod(((x*34.)+1.)*x, 289.);
\\}
\\float opDisplaceNoise_snoise(vec2 v){
\\ const vec4 c = vec4(.211324865405187, .366025403784439, -.577350269189626, .024390243902439);
\\ vec2 i = floor(v + dot(v, c.yy));
\\ vec2 x0 = v - i + dot(i, c.xx);
\\ vec2 i1 = (x0.x > x0.y) ? vec2(1.,0.) : vec2(0.,1.);
\\ vec4 x12 = x0.xyxy + c.xxzz;
\\ x12.xy -= i1;
\\ i = mod(i, 289.);
\\ vec3 p = opDisplaceNoise_permute(opDisplaceNoise_permute(i.y + vec3(0., i1.y, 1.)) + i.x + vec3(0.,i1.x, 1.));
\\ vec3 m = max(.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),dot(x12.zw,x12.zw)), 0.);
\\ m *= m;
\\ m *= m;
\\ vec3 x = 2. * fract(p * c.www) - 1.;
\\ vec3 h = abs(x) - .5;
\\ vec3 ox = floor(x + .5);
\\ vec3 a0 = x - ox;
\\ m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
\\ vec3 g;
\\ g.x = a0.x * x0.x + h.x * x0.y;
\\ g.yz = a0.yz * x12.xz + h.yz * x12.yw;
\\ return 130. * dot(m, g);
\\}
\\vec3 opDisplaceNoise(vec3 p, float power, float scale){
\\ p.y += power * opDisplaceNoise_snoise(p.xz * scale);
\\ return p;
\\}
;
fn enterCommand(ctxt: *util.IterationContext, iter: usize, mat_offset: usize, buffer: *[]u8) []const u8 {
_ = mat_offset;
const data: *Data = @ptrCast(*Data, @alignCast(@alignOf(Data), buffer.ptr));
const next_point: []const u8 = util.std.fmt.allocPrint(ctxt.allocator, "p{d}", .{iter}) catch unreachable;
const format: []const u8 = "vec3 {s} = opDisplaceNoise({s}, {d:.5}, {d:.5});";
const res: []const u8 = util.std.fmt.allocPrint(ctxt.allocator, format, .{ next_point, ctxt.cur_point_name, data.power, data.scale }) catch unreachable;
ctxt.pushPointName(next_point);
return res;
}
fn exitCommand(ctxt: *util.IterationContext, iter: usize, buffer: *[]u8) []const u8 {
_ = iter;
_ = buffer;
ctxt.popPointName();
return util.std.fmt.allocPrint(ctxt.allocator, "", .{}) catch unreachable;
}
fn sphereBound(buffer: *[]u8, bound: *util.math.sphereBound, children: []util.math.sphereBound) void {
const data: *Data = @ptrCast(*Data, @alignCast(@alignOf(Data), buffer.ptr));
bound.* = children[0];
bound.*.r += data.power;
} | src/sdf/modifiers/displacement_noise.zig |
const std = @import("std");
const math = std.math;
const glfw = @import("glfw");
const zgpu = @import("zgpu");
const gpu = zgpu.gpu;
const c = zgpu.cimgui;
const zm = @import("zmath");
const content_dir = @import("build_options").content_dir;
const window_title = "zig-gamedev: triangle (wgpu)";
// zig fmt: off
const wgsl_vs =
\\ @group(0) @binding(0) var<uniform> object_to_clip: mat4x4<f32>;
\\ struct VertexOut {
\\ @builtin(position) position_clip: vec4<f32>,
\\ @location(0) color: vec3<f32>,
\\ }
\\ @stage(vertex) fn main(
\\ @location(0) position: vec3<f32>,
\\ @location(1) color: vec3<f32>,
\\ ) -> VertexOut {
\\ var output: VertexOut;
\\ output.position_clip = vec4(position, 1.0) * object_to_clip;
\\ output.color = color;
\\ return output;
\\ }
;
const wgsl_fs =
\\ @stage(fragment) fn main(
\\ @location(0) color: vec3<f32>,
\\ ) -> @location(0) vec4<f32> {
\\ return vec4(color, 1.0);
\\ }
// zig fmt: on
;
const Vertex = struct {
position: [3]f32,
color: [3]f32,
};
const DemoState = struct {
gctx: *zgpu.GraphicsContext,
pipeline: zgpu.RenderPipelineHandle,
bind_group: zgpu.BindGroupHandle,
vertex_buffer: zgpu.BufferHandle,
index_buffer: zgpu.BufferHandle,
depth_texture: zgpu.TextureHandle,
depth_texture_view: zgpu.TextureViewHandle,
};
fn init(allocator: std.mem.Allocator, window: glfw.Window) !DemoState {
const gctx = try zgpu.GraphicsContext.init(allocator, window);
// Create a bind group layout needed for our render pipeline.
const bind_group_layout = gctx.createBindGroupLayout(&.{
zgpu.bglBuffer(0, .{ .vertex = true }, .uniform, true, 0),
});
defer gctx.destroyResource(bind_group_layout);
const pipeline_layout = gctx.createPipelineLayout(&.{bind_group_layout});
defer gctx.destroyResource(bind_group_layout);
const pipeline = pipline: {
const vs_module = gctx.device.createShaderModule(&.{ .label = "vs", .code = .{ .wgsl = wgsl_vs } });
defer vs_module.release();
const fs_module = gctx.device.createShaderModule(&.{ .label = "fs", .code = .{ .wgsl = wgsl_fs } });
defer fs_module.release();
const color_target = gpu.ColorTargetState{
.format = zgpu.GraphicsContext.swapchain_format,
.blend = &.{ .color = .{}, .alpha = .{} },
};
const vertex_attributes = [_]gpu.VertexAttribute{
.{ .format = .float32x3, .offset = 0, .shader_location = 0 },
.{ .format = .float32x3, .offset = @offsetOf(Vertex, "color"), .shader_location = 1 },
};
const vertex_buffer_layout = gpu.VertexBufferLayout{
.array_stride = @sizeOf(Vertex),
.step_mode = .vertex,
.attribute_count = vertex_attributes.len,
.attributes = &vertex_attributes,
};
const pipeline_descriptor = gpu.RenderPipeline.Descriptor{
.vertex = gpu.VertexState{
.module = vs_module,
.entry_point = "main",
.buffers = &.{vertex_buffer_layout},
},
.primitive = gpu.PrimitiveState{
.front_face = .ccw,
.cull_mode = .none,
.topology = .triangle_list,
},
.depth_stencil = &gpu.DepthStencilState{
.format = .depth32_float,
.depth_write_enabled = true,
.depth_compare = .less,
},
.fragment = &gpu.FragmentState{
.module = fs_module,
.entry_point = "main",
.targets = &.{color_target},
},
};
break :pipline gctx.createRenderPipeline(pipeline_layout, pipeline_descriptor);
};
const bind_group = gctx.createBindGroup(bind_group_layout, &[_]zgpu.BindGroupEntryInfo{
.{ .binding = 0, .buffer_handle = gctx.uniforms.buffer, .offset = 0, .size = @sizeOf(zm.Mat) },
});
// Create a vertex buffer.
const vertex_buffer = gctx.createBuffer(.{
.usage = .{ .copy_dst = true, .vertex = true },
.size = 3 * @sizeOf(Vertex),
});
const vertex_data = [_]Vertex{
.{ .position = [3]f32{ 0.0, 0.5, 0.0 }, .color = [3]f32{ 1.0, 0.0, 0.0 } },
.{ .position = [3]f32{ -0.5, -0.5, 0.0 }, .color = [3]f32{ 0.0, 1.0, 0.0 } },
.{ .position = [3]f32{ 0.5, -0.5, 0.0 }, .color = [3]f32{ 0.0, 0.0, 1.0 } },
};
gctx.queue.writeBuffer(gctx.lookupResource(vertex_buffer).?, 0, Vertex, vertex_data[0..]);
// Create an index buffer.
const index_buffer = gctx.createBuffer(.{
.usage = .{ .copy_dst = true, .index = true },
.size = 3 * @sizeOf(u32),
});
const index_data = [_]u32{ 0, 1, 2 };
gctx.queue.writeBuffer(gctx.lookupResource(index_buffer).?, 0, u32, index_data[0..]);
// Create a depth texture and its 'view'.
const depth = createDepthTexture(gctx);
return DemoState{
.gctx = gctx,
.pipeline = pipeline,
.bind_group = bind_group,
.vertex_buffer = vertex_buffer,
.index_buffer = index_buffer,
.depth_texture = depth.texture,
.depth_texture_view = depth.view,
};
}
fn deinit(allocator: std.mem.Allocator, demo: *DemoState) void {
demo.gctx.deinit(allocator);
demo.* = undefined;
}
fn update(demo: *DemoState) void {
zgpu.gui.newFrame(demo.gctx.swapchain_descriptor.width, demo.gctx.swapchain_descriptor.height);
c.igShowDemoWindow(null);
}
fn draw(demo: *DemoState) void {
const gctx = demo.gctx;
const fb_width = gctx.swapchain_descriptor.width;
const fb_height = gctx.swapchain_descriptor.height;
const t = @floatCast(f32, gctx.stats.time);
const cam_world_to_view = zm.lookAtLh(
zm.f32x4(3.0, 3.0, -3.0, 1.0),
zm.f32x4(0.0, 0.0, 0.0, 1.0),
zm.f32x4(0.0, 1.0, 0.0, 0.0),
);
const cam_view_to_clip = zm.perspectiveFovLh(
0.25 * math.pi,
@intToFloat(f32, fb_width) / @intToFloat(f32, fb_height),
0.01,
200.0,
);
const cam_world_to_clip = zm.mul(cam_world_to_view, cam_view_to_clip);
const back_buffer_view = gctx.swapchain.getCurrentTextureView();
defer back_buffer_view.release();
const commands = commands: {
const encoder = gctx.device.createCommandEncoder(null);
defer encoder.release();
pass: {
const vb_info = gctx.lookupResourceInfo(demo.vertex_buffer) orelse break :pass;
const ib_info = gctx.lookupResourceInfo(demo.index_buffer) orelse break :pass;
const pipeline = gctx.lookupResource(demo.pipeline) orelse break :pass;
const bind_group = gctx.lookupResource(demo.bind_group) orelse break :pass;
const depth_view = gctx.lookupResource(demo.depth_texture_view) orelse break :pass;
const color_attachment = gpu.RenderPassColorAttachment{
.view = back_buffer_view,
.load_op = .clear,
.store_op = .store,
};
const depth_attachment = gpu.RenderPassDepthStencilAttachment{
.view = depth_view,
.depth_load_op = .clear,
.depth_store_op = .store,
.depth_clear_value = 1.0,
};
const render_pass_info = gpu.RenderPassEncoder.Descriptor{
.color_attachments = &.{color_attachment},
.depth_stencil_attachment = &depth_attachment,
};
const pass = encoder.beginRenderPass(&render_pass_info);
defer {
pass.end();
pass.release();
}
pass.setVertexBuffer(0, vb_info.gpuobj.?, 0, vb_info.size);
pass.setIndexBuffer(ib_info.gpuobj.?, .uint32, 0, ib_info.size);
pass.setPipeline(pipeline);
// Draw triangle 1.
{
const object_to_world = zm.mul(zm.rotationY(t), zm.translation(-1.0, 0.0, 0.0));
const object_to_clip = zm.mul(object_to_world, cam_world_to_clip);
const mem = gctx.uniformsAllocate(zm.Mat, 1);
mem.slice[0] = zm.transpose(object_to_clip);
pass.setBindGroup(0, bind_group, &.{mem.offset});
pass.drawIndexed(3, 1, 0, 0, 0);
}
// Draw triangle 2.
{
const object_to_world = zm.mul(zm.rotationY(0.75 * t), zm.translation(1.0, 0.0, 0.0));
const object_to_clip = zm.mul(object_to_world, cam_world_to_clip);
const mem = gctx.uniformsAllocate(zm.Mat, 1);
mem.slice[0] = zm.transpose(object_to_clip);
pass.setBindGroup(0, bind_group, &.{mem.offset});
pass.drawIndexed(3, 1, 0, 0, 0);
}
}
{
const color_attachment = gpu.RenderPassColorAttachment{
.view = back_buffer_view,
.load_op = .load,
.store_op = .store,
};
const render_pass_info = gpu.RenderPassEncoder.Descriptor{
.color_attachments = &.{color_attachment},
};
const pass = encoder.beginRenderPass(&render_pass_info);
defer {
pass.end();
pass.release();
}
zgpu.gui.draw(pass);
}
break :commands encoder.finish(null);
};
defer commands.release();
gctx.submit(&.{commands});
if (gctx.present() == .swap_chain_resized) {
// Release old depth texture.
gctx.destroyResource(demo.depth_texture_view);
gctx.destroyResource(demo.depth_texture);
// Create a new depth texture to match the new window size.
const depth = createDepthTexture(gctx);
demo.depth_texture = depth.texture;
demo.depth_texture_view = depth.view;
}
}
fn createDepthTexture(gctx: *zgpu.GraphicsContext) struct {
texture: zgpu.TextureHandle,
view: zgpu.TextureViewHandle,
} {
const texture = gctx.createTexture(.{
.usage = .{ .render_attachment = true },
.dimension = .dimension_2d,
.size = .{
.width = gctx.swapchain_descriptor.width,
.height = gctx.swapchain_descriptor.height,
.depth_or_array_layers = 1,
},
.format = .depth32_float,
.mip_level_count = 1,
.sample_count = 1,
});
const view = gctx.createTextureView(texture, .{});
return .{ .texture = texture, .view = view };
}
pub fn main() !void {
zgpu.checkContent(content_dir) catch {
// In case of error zgpu.checkContent() will print error message.
return;
};
try glfw.init(.{});
defer glfw.terminate();
const window = try glfw.Window.create(1280, 960, window_title, null, null, .{
.client_api = .no_api,
.cocoa_retina_framebuffer = true,
});
defer window.destroy();
try window.setSizeLimits(.{ .width = 400, .height = 400 }, .{ .width = null, .height = null });
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
var demo = try init(allocator, window);
defer deinit(allocator, &demo);
zgpu.gui.init(window, demo.gctx.device, content_dir, "Roboto-Medium.ttf", 25.0);
defer zgpu.gui.deinit();
while (!window.shouldClose()) {
try glfw.pollEvents();
update(&demo);
draw(&demo);
}
} | samples/triangle_wgpu/src/triangle_wgpu.zig |
const std = @import("std");
const c = @import("../c.zig");
const math = @import("../math/math.zig");
var allocator = std.heap.page_allocator;
pub const Shader = struct {
programId: c.GLuint,
pub fn init(name: []const u8) Shader {
return Shader {
.programId = loadShaderFromRelativePath(name)
};
}
pub fn deinit(self: Shader) void {
c.glDeleteProgram(self.programId);
}
pub fn enable(self: Shader) void {
c.glUseProgram(self.programId);
}
pub fn setUniformMat4(self: Shader, location: [*c]const u8, value: *math.Mat4x4) void {
const uniformLocation = c.glGetUniformLocation(self.programId, location);
c.glUniformMatrix4fv(uniformLocation, 1, c.GL_FALSE, &value.fields[0][0]);
}
pub fn disable(self: Shader) void {
}
};
fn loadShaderFromRelativePath(name: []const u8) c.GLuint {
const vertexShaderPath = std.fmt.allocPrint(allocator, "assets/gfx/{}.vert", .{name}) catch unreachable;
defer allocator.free(vertexShaderPath);
const fragmentShaderPath = std.fmt.allocPrint(allocator, "assets/gfx/{}.frag", .{name}) catch unreachable;
defer allocator.free(fragmentShaderPath);
const cwd = std.fs.cwd();
const vertexId = compileShader(cwd, vertexShaderPath, c.GL_VERTEX_SHADER) catch unreachable;
defer c.glDeleteShader(vertexId);
const fragmentId = compileShader(cwd, fragmentShaderPath, c.GL_FRAGMENT_SHADER) catch unreachable;
defer c.glDeleteShader(fragmentId);
const programId = c.glCreateProgram();
c.glAttachShader(programId, vertexId);
c.glAttachShader(programId, fragmentId);
c.glLinkProgram(programId);
return programId;
}
fn compileShader(cwd: std.fs.Dir, relativePath: []const u8, comptime shaderType: c.GLenum) !c.GLuint {
var compileResult: c.GLint = c.GL_FALSE;
const shaderFile = try cwd.openFile(relativePath, .{});
defer shaderFile.close();
var shaderCode = try allocator.alloc(u8, try shaderFile.getEndPos());
defer allocator.free(shaderCode);
const shaderObject: c.GLuint = c.glCreateShader(shaderType);
_ = try shaderFile.read(shaderCode);
const shaderSrcPtr: ?[*]const u8 = shaderCode.ptr;
c.glShaderSource(shaderObject, 1, &shaderSrcPtr, 0);
c.glCompileShader(shaderObject);
return shaderObject;
} | src/gfx/shader.zig |
const std = @import( "std" );
const Allocator = std.mem.Allocator;
usingnamespace @import( "../core/core.zig" );
usingnamespace @import( "../core/gtkz.zig" );
usingnamespace @import( "../core/support.zig" );
usingnamespace @import( "cursor.zig" );
usingnamespace @import( "curve.zig" );
pub fn TimeView( comptime N: usize, comptime P: usize ) type {
return struct {
const Self = @This();
glArea: *GtkWidget,
axis0: Axis,
axis1: Axis,
bgPaintable: ClearPaintable,
curvePaintable: CurvePaintable(N,P),
cursor: VerticalCursor,
axisUpdatingHandler0: AxisUpdatingHandler(1),
axisUpdatingHandler1: AxisUpdatingHandler(1),
painters: [3]*Painter,
paintingHandler: PaintingHandler,
axisDraggable0: AxisDraggable(1),
draggers: [2]*Dragger,
draggingHandler: DraggingHandler,
// TODO: RLS would be better, but needs https://github.com/ziglang/zig/issues/2765
pub fn init( self: *Self, allocator: *Allocator ) !void {
self.glArea = gtk_gl_area_new( );
gtk_gl_area_set_required_version( @ptrCast( *GtkGLArea, self.glArea ), 3, 2 );
gtk_widget_set_events( self.glArea, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_RELEASE_MASK | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK | GDK_KEY_PRESS_MASK );
gtk_widget_set_can_focus( self.glArea, 1 );
self.axis0 = Axis.initBounds( -0.1, 60.0, 1 );
self.axis1 = Axis.initBounds( 0, 400, 1 );
var _axes = [2]*Axis { &self.axis0, &self.axis1 };
var _axes0 = [1]*Axis { &self.axis0 };
var _axes1 = [1]*Axis { &self.axis1 };
self.bgPaintable = ClearPaintable.init( "TimeView.bgPaintable", GL_COLOR_BUFFER_BIT );
self.bgPaintable.rgba = [4]GLfloat { 0.4, 0.4, 0.4, 1.0 };
self.curvePaintable = try CurvePaintable(N,P).init( "TimeView.curvePaintable", _axes, allocator );
self.curvePaintable.rgbKinetic = [3]GLfloat { 0.0, 0.0, 0.0 };
self.curvePaintable.rgbPotential = [3]GLfloat { 1.0, 0.0, 0.0 };
self.curvePaintable.rgbPotentialA = [3]GLfloat { 1.0, 1.0, 1.0 };
self.cursor = VerticalCursor.init( "TimeView.cursor", &self.axis0 );
self.cursor.cursor = 30.0;
self.axisUpdatingHandler0 = AxisUpdatingHandler(1).init( _axes0, [1]u1 { 0 } );
_ = try gtkzConnectHandler( self.glArea, "render", AxisUpdatingHandler(1).onRender, &self.axisUpdatingHandler0 );
_ = try gtkzConnectHandler( self.glArea, "scroll-event", AxisUpdatingHandler(1).onMouseWheel, &self.axisUpdatingHandler0 );
self.axisUpdatingHandler1 = AxisUpdatingHandler(1).init( _axes1, [1]u1 { 1 } );
_ = try gtkzConnectHandler( self.glArea, "render", AxisUpdatingHandler(1).onRender, &self.axisUpdatingHandler1 );
self.painters = [_]*Painter {
&self.bgPaintable.painter,
&self.curvePaintable.painter,
&self.cursor.painter,
};
self.paintingHandler = PaintingHandler.init( &self.painters );
_ = try gtkzConnectHandler( self.glArea, "render", PaintingHandler.onRender, &self.paintingHandler );
self.axisDraggable0 = AxisDraggable(1).init( _axes0, [1]u1 { 0 } );
self.draggers = [_]*Dragger {
&self.cursor.dragger,
&self.axisDraggable0.dragger,
};
self.draggingHandler = try DraggingHandler.init( self.glArea, &self.draggers );
_ = try gtkzConnectHandler( self.glArea, "button-press-event", DraggingHandler.onMouseDown, &self.draggingHandler );
_ = try gtkzConnectHandler( self.glArea, "motion-notify-event", DraggingHandler.onMouseMove, &self.draggingHandler );
_ = try gtkzConnectHandler( self.glArea, "button-release-event", DraggingHandler.onMouseUp, &self.draggingHandler );
}
pub fn deinit( self: *Self ) void {
// FIXME: gtk_widget_destroy( self.glArea );
self.curvePaintable.deinit( );
// FIXME: Disconnect signal handlers
}
};
} | src/time/view.zig |
const std = @import("std");
const root = @import("main.zig");
const math = std.math;
const testing = std.testing;
pub const Vec2 = Vector2(f32);
pub const Vec2_f64 = Vector2(f64);
pub const Vec2_i32 = Vector2(i32);
/// A 2 dimensional vector.
pub fn Vector2(comptime T: type) type {
if (@typeInfo(T) != .Float and @typeInfo(T) != .Int) {
@compileError("Vector2 not implemented for " ++ @typeName(T));
}
return struct {
x: T = 0,
y: T = 0,
const Self = @This();
/// Construct vector from given 2 components.
pub fn new(x: T, y: T) Self {
return .{ .x = x, .y = y };
}
/// Set all components to the same given value.
pub fn set(val: T) Self {
return Self.new(val, val);
}
pub fn zero() Self {
return Self.new(0, 0);
}
pub fn one() Self {
return Self.new(1, 1);
}
pub fn up() Self {
return Self.new(0, 1);
}
/// Cast a type to another type. Only for integers and floats.
/// It's like builtins: @intCast, @floatCast, @intToFloat, @floatToInt.
pub fn cast(self: Self, dest: anytype) Vector2(dest) {
const source_info = @typeInfo(T);
const dest_info = @typeInfo(dest);
if (source_info == .Float and dest_info == .Int) {
const x = @floatToInt(dest, self.x);
const y = @floatToInt(dest, self.y);
return Vector2(dest).new(x, y);
}
if (source_info == .Int and dest_info == .Float) {
const x = @intToFloat(dest, self.x);
const y = @intToFloat(dest, self.y);
return Vector2(dest).new(x, y);
}
return switch (dest_info) {
.Float => {
const x = @floatCast(dest, self.x);
const y = @floatCast(dest, self.y);
return Vector2(dest).new(x, y);
},
.Int => {
const x = @intCast(dest, self.x);
const y = @intCast(dest, self.y);
return Vector2(dest).new(x, y);
},
else => panic(
"Error, given type should be integer or float.\n",
.{},
),
};
}
/// Construct new vector from slice.
pub fn fromSlice(slice: []const T) Self {
return Self.new(slice[0], slice[1]);
}
/// Transform vector to array.
pub fn toArray(self: Self) [2]T {
return .{ self.x, self.y };
}
/// Return the angle in degrees between two vectors.
pub fn getAngle(left: Self, right: Self) T {
const dot_product = Self.dot(left.norm(), right.norm());
return root.toDegrees(math.acos(dot_product));
}
/// Compute the length (magnitude) of given vector |a|.
pub fn length(self: Self) T {
return math.sqrt((self.x * self.x) + (self.y * self.y));
}
/// Compute the distance between two points.
pub fn distance(a: Self, b: Self) T {
return math.sqrt(
math.pow(T, b.x - a.x, 2) + math.pow(T, b.y - a.y, 2),
);
}
/// Construct new normalized vector from a given vector.
pub fn norm(self: Self) Self {
var l = length(self);
return Self.new(self.x / l, self.y / l);
}
pub fn eql(left: Self, right: Self) bool {
return left.x == right.x and left.y == right.y;
}
/// Substraction between two given vector.
pub fn sub(left: Self, right: Self) Self {
return Self.new(left.x - right.x, left.y - right.y);
}
/// Addition betwen two given vector.
pub fn add(left: Self, right: Self) Self {
return Self.new(left.x + right.x, left.y + right.y);
}
/// Multiply each components by the given scalar.
pub fn scale(v: Self, scalar: T) Self {
return Self.new(v.x * scalar, v.y * scalar);
}
/// Return the dot product between two given vector.
pub fn dot(left: Self, right: Self) T {
return (left.x * right.x) + (left.y * right.y);
}
/// Lerp between two vectors.
pub fn lerp(left: Self, right: Self, t: T) Self {
const x = root.lerp(T, left.x, right.x, t);
const y = root.lerp(T, left.y, right.y, t);
return Self.new(x, y);
}
/// Construct a new vector from the min components between two vectors.
pub fn min(left: Self, right: Self) Self {
return Self.new(
math.min(left.x, right.x),
math.min(left.y, right.y),
);
}
/// Construct a new vector from the max components between two vectors.
pub fn max(left: Self, right: Self) Self {
return Self.new(
math.max(left.x, right.x),
math.max(left.y, right.y),
);
}
};
}
test "zalgebra.Vec2.init" {
var a = Vec2.new(1.5, 2.6);
try testing.expectEqual(a.x, 1.5);
try testing.expectEqual(a.y, 2.6);
}
test "zalgebra.Vec2.set" {
var a = Vec2.new(2.5, 2.5);
var b = Vec2.set(2.5);
try testing.expectEqual(Vec2.eql(a, b), true);
}
test "zalgebra.Vec2.getAngle" {
var a = Vec2.new(1, 0);
var b = Vec2.up();
var c = Vec2.new(-1, 0);
var d = Vec2.new(1, 1);
try testing.expectEqual(Vec2.getAngle(a, b), 90);
try testing.expectEqual(Vec2.getAngle(a, c), 180);
try testing.expectEqual(Vec2.getAngle(a, d), 45);
}
test "zalgebra.Vec2.toArray" {
const a = Vec2.up().toArray();
const b = [_]f32{ 0, 1 };
try testing.expectEqual(std.mem.eql(f32, &a, &b), true);
}
test "zalgebra.Vec2.eql" {
var a = Vec2.new(1, 2);
var b = Vec2.new(1, 2);
var c = Vec2.new(1.5, 2);
try testing.expectEqual(Vec2.eql(a, b), true);
try testing.expectEqual(Vec2.eql(a, c), false);
}
test "zalgebra.Vec2.length" {
var a = Vec2.new(1.5, 2.6);
try testing.expectEqual(a.length(), 3.00166606);
}
test "zalgebra.Vec2.distance" {
var a = Vec2.new(0, 0);
var b = Vec2.new(-1, 0);
var c = Vec2.new(0, 5);
try testing.expectEqual(Vec2.distance(a, b), 1);
try testing.expectEqual(Vec2.distance(a, c), 5);
}
test "zalgebra.Vec2.normalize" {
var a = Vec2.new(1.5, 2.6);
try testing.expectEqual(Vec2.eql(a.norm(), Vec2.new(0.499722480, 0.866185605)), true);
}
test "zalgebra.Vec2.sub" {
var a = Vec2.new(1, 2);
var b = Vec2.new(2, 2);
try testing.expectEqual(Vec2.eql(Vec2.sub(a, b), Vec2.new(-1, 0)), true);
}
test "zalgebra.Vec2.add" {
var a = Vec2.new(1, 2);
var b = Vec2.new(2, 2);
try testing.expectEqual(Vec2.eql(Vec2.add(a, b), Vec2.new(3, 4)), true);
}
test "zalgebra.Vec2.scale" {
var a = Vec2.new(1, 2);
try testing.expectEqual(Vec2.eql(Vec2.scale(a, 5), Vec2.new(5, 10)), true);
}
test "zalgebra.Vec2.dot" {
var a = Vec2.new(1.5, 2.6);
var b = Vec2.new(2.5, 3.45);
try testing.expectEqual(Vec2.dot(a, b), 12.7200002);
}
test "zalgebra.Vec2.lerp" {
var a = Vec2.new(-10.0, 0.0);
var b = Vec2.new(10.0, 10.0);
try testing.expectEqual(Vec2.eql(Vec2.lerp(a, b, 0.5), Vec2.new(0.0, 5.0)), true);
}
test "zalgebra.Vec2.min" {
var a = Vec2.new(10.0, -2.0);
var b = Vec2.new(-10.0, 5.0);
try testing.expectEqual(Vec2.eql(Vec2.min(a, b), Vec2.new(-10.0, -2.0)), true);
}
test "zalgebra.Vec2.max" {
var a = Vec2.new(10.0, -2.0);
var b = Vec2.new(-10.0, 5.0);
try testing.expectEqual(Vec2.eql(Vec2.max(a, b), Vec2.new(10.0, 5.0)), true);
}
test "zalgebra.Vec2.fromSlice" {
const array = [2]f32{ 2, 4 };
try testing.expectEqual(Vec2.eql(Vec2.fromSlice(&array), Vec2.new(2, 4)), true);
}
test "zalgebra.Vec2.cast" {
const a = Vec2_i32.new(3, 6);
const b = Vector2(usize).new(3, 6);
try testing.expectEqual(
Vector2(usize).eql(a.cast(usize), b),
true,
);
const c = Vec2.new(3.5, 6.5);
const d = Vec2_f64.new(3.5, 6.5);
try testing.expectEqual(
Vec2_f64.eql(c.cast(f64), d),
true,
);
const e = Vec2_i32.new(3, 6);
const f = Vec2.new(3.0, 6.0);
try testing.expectEqual(
Vec2.eql(e.cast(f32), f),
true,
);
const g = Vec2.new(3.0, 6.0);
const h = Vec2_i32.new(3, 6);
try testing.expectEqual(
Vec2_i32.eql(g.cast(i32), h),
true,
);
} | src/vec2.zig |
const c = @import("../c_global.zig").c_imp;
const std = @import("std");
// dross-rs
//const Timer = @import("../utils/timer.zig").Timer;
const ResourceHandler = @import("resource_handler.zig").ResourceHandler;
const Renderer = @import("../renderer/renderer.zig").Renderer;
const font = @import("../renderer/font/font.zig");
const Font = font.Font;
const cam = @import("../renderer/cameras/camera_2d.zig");
const Vector2 = @import("../core/vector2.zig").Vector2;
const Vector3 = @import("../core/vector3.zig").Vector3;
const input = @import("input.zig");
const Input = input.Input;
const DrossKey = input.DrossKey;
const DrossMouseButton = input.DrossMouseButton;
const FrameStatistics = @import("../utils/profiling/frame_statistics.zig").FrameStatistics;
// ----------------------------------------------------
/// Error Set for Application-related Errors
pub const ApplicationError = error{
OutOfMemory,
RendererCreation,
WindowCreation,
WindowInit,
};
/// TODO(devon): Remove when shipping
pub var debug_mode = false;
pub var pause = false;
pub var default_font: ?*Font = undefined;
/// Stores the current size of the window
var window_size: Vector2 = undefined;
/// Stores the window to allow other systems
/// to communicate with it without needing a
/// Application instance.
var app_window: *c.GLFWwindow = undefined;
/// Stores the application's viewport size
var viewport_size: Vector2 = undefined;
// -----------------------------------------
// - Application -
// -----------------------------------------
/// Application is the center point of the entire program.
/// Most of the communication from the end-user will come
/// through the application instance.
pub const Application = struct {
allocator: ?*std.mem.Allocator = undefined,
previous_frame_time: f64 = 0,
const Self = @This();
/// Allocates the necessary components to run the application
/// Comments: The caller will be the owner of the returned pointer, but
/// any other required allocated memory will be owned by the engine.
pub fn new(allocator: *std.mem.Allocator, title: [*c]const u8, width: c_int, height: c_int, vp_width: f32, vp_height: f32) anyerror!*Self {
var self = try allocator.create(Application);
// Initialze GLFW, returns GL_FALSE if an error occured.
if (c.glfwInit() == c.GL_FALSE) return ApplicationError.WindowInit;
// GLFW Configuration
c.glfwWindowHint(c.GLFW_CONTEXT_VERSION_MAJOR, 4);
c.glfwWindowHint(c.GLFW_CONTEXT_VERSION_MINOR, 5);
c.glfwWindowHint(c.GLFW_OPENGL_PROFILE, c.GLFW_OPENGL_CORE_PROFILE);
c.glfwWindowHint(c.GLFW_OPENGL_FORWARD_COMPAT, c.GL_TRUE);
// Window Creation
app_window = c.glfwCreateWindow(width, height, title, null, null) orelse return ApplicationError.WindowCreation;
// Set the global variables
window_size = Vector2.new(
@intToFloat(f32, width),
@intToFloat(f32, height),
);
// Set the viewport size
viewport_size = Vector2.new(vp_width, vp_height);
// Make our window the current context
c.glfwMakeContextCurrent(app_window);
// Change the wait time for swapping buffers 0
// TODO(devon): Remove when shipping
c.glfwSwapInterval(0);
// Build the Resource Hanlder
ResourceHandler.new(allocator);
// Build the Renderer
try Renderer.new(allocator);
// Remember to set the app's allocator to the passed allocator
self.allocator = allocator;
_ = c.glfwSetFramebufferSizeCallback(app_window, Renderer.resizeInternal);
// Resize the application's viewport to match that of the window
// self.resize(0, 0, width, height);
// Build the rest of the core components of an application
//
try Input.new(allocator);
try FrameStatistics.new(allocator);
default_font = ResourceHandler.loadFont("Ubuntu Mono", "assets/fonts/ttf/UbuntuMono.ttf") orelse null;
return self;
}
/// Gracefully terminates the Application by cleaning up
/// manually allocated memory as well as some other backend
/// cleanup.
/// Comments: Be sure to call before exiting program!
pub fn free(allocator: *std.mem.Allocator, self: *Self) void {
c.glfwDestroyWindow(app_window);
c.glfwTerminate();
// Manually allocated memory cleanup
FrameStatistics.free(self.allocator.?);
Input.free(self.allocator.?);
Renderer.free(self.allocator.?);
ResourceHandler.free();
allocator.destroy(self);
}
/// Runs the applications main event loop.
pub fn run(
self: *Self,
update_loop: fn (f64) anyerror!void,
render_loop: fn () anyerror!void,
gui_render_loop: fn () anyerror!void,
) void {
// Pre-run checks
if (cam.cameraCount() <= 0) {
std.debug.print("[Application]: No camera could be found in the scene!\n", .{});
@panic("[Application]: Error occurred before starting the application loop!\n");
}
while (c.glfwWindowShouldClose(app_window) == 0) {
// Profiling
var frame_timer = std.time.Timer.start() catch |err| {
std.debug.print("[Application]: Error occurred when creating a timer! {s}\n", .{err});
@panic("[Application]: Error occurred creating a timer!\n");
};
var frame_duration: f64 = -1.0;
var update_duration: f64 = -1.0;
var draw_duration: f64 = -1.0;
// Calculate timestep
const current_time = c.glfwGetTime();
var delta = current_time - self.previous_frame_time;
self.previous_frame_time = current_time;
//// TODO(devon): Remove when shipping
if (debug_mode and pause) delta = 0;
//// Process input
self.processInput(delta);
{ // Update
var update_timer = std.time.Timer.start() catch |err| {
std.debug.print("[Application]: Error occurred when creating a timer! {s}\n", .{err});
@panic("[Application]: Error occurred creating a timer!\n");
};
_ = update_loop(delta) catch |err| {
std.debug.print("[Application]: Update loop encountered an error! {s}\n", .{err});
@panic("[Application]: Error occurred during the update loop!\n");
};
update_duration = @intToFloat(f64, update_timer.read()) / @intToFloat(f64, std.time.ns_per_ms);
}
{ // Render
var draw_timer = std.time.Timer.start() catch |err| {
std.debug.print("[Application]: Error occurred when creating a timer! {s}\n", .{err});
@panic("[Application]: Error occurred creating a timer!\n");
};
Renderer.render(render_loop, gui_render_loop);
draw_duration = @intToFloat(f64, draw_timer.read()) / @intToFloat(f64, std.time.ns_per_ms);
}
// Submit
c.glfwSwapBuffers(app_window);
Input.updateInput();
c.glfwPollEvents();
frame_duration = @intToFloat(f64, frame_timer.read()) / @intToFloat(f64, std.time.ns_per_ms);
FrameStatistics.setFrameTime(frame_duration);
FrameStatistics.setUpdateTime(update_duration);
FrameStatistics.setDrawTime(draw_duration);
FrameStatistics.reset();
}
}
/// Process the application input
pub fn processInput(self: *Self, delta: f64) void {
// TODO(devon): Remove when shipping
var camera = cam.currentCamera().?;
if (Input.keyPressed(DrossKey.KeyEscape)) c.glfwSetWindowShouldClose(app_window, c.GL_TRUE);
if (Input.keyReleased(DrossKey.KeyF1)) {
if (debug_mode) {
debug_mode = false;
pause = false;
self.setWindowTitle("Dross-Zig Application");
} else {
debug_mode = true;
self.setWindowTitle("[DEBUG] Dross-Zig Application");
}
}
if (Input.keyReleased(DrossKey.KeyP)) {
if (debug_mode) {
if (pause) {
pause = false;
self.setWindowTitle("[DEBUG] Dross-Zig Application");
} else {
pause = true;
self.setWindowTitle("[DEBUG][PAUSED] Dross-Zig Application");
}
}
}
if (debug_mode) {
var camera_pos = camera.position();
const camera_zoom = camera.zoom();
var delta_pos = Vector3.zero();
const delta32: f32 = @floatCast(f32, delta);
const camera_speed = camera.speed() * delta32;
// Zoom in
if (Input.keyPressed(DrossKey.KeyU)) {
camera.setZoom(camera_zoom - delta32);
}
// Zoom out
if (Input.keyPressed(DrossKey.KeyI)) {
camera.setZoom(camera_zoom + delta32);
}
// Right
if (Input.keyPressed(DrossKey.KeyL)) {
var dir = Vector3.right().scale(-1.0); //Vector3.forward().scale(-1.0).cross(Vector3.up()).normalize();
delta_pos = delta_pos.add(dir.scale(camera_speed));
}
// Left
if (Input.keyPressed(DrossKey.KeyH)) {
var dir = Vector3.right(); //.scale(1.0).cross(Vector3.up()).normalize();
delta_pos = delta_pos.add(dir.scale(camera_speed));
}
// Up
if (Input.keyPressed(DrossKey.KeyK)) {
var dir = Vector3.up().scale(-1.0); //Vector3.forward().scale(-1.0).cross(Vector3.up()).normalize();
delta_pos = delta_pos.add(dir.scale(camera_speed));
}
// Down
if (Input.keyPressed(DrossKey.KeyJ)) {
var dir = Vector3.up(); //.scale(1.0).cross(Vector3.up()).normalize();
delta_pos = delta_pos.add(dir.scale(camera_speed));
}
// Reset Position and Zoom
if (Input.keyPressed(DrossKey.KeyBackspace)) {
delta_pos = Vector3.zero();
camera_pos = Vector3.zero();
camera.setZoom(1.0);
}
camera_pos = camera_pos.add(delta_pos);
camera.setPosition(camera_pos);
}
}
/// Resize the application
pub fn resize(self: *Self, x: c_int, y: c_int, width: c_int, height: c_int) void {
// Call renderer's resize method
Renderer.resizeViewport(x, y, width, height);
setWindowSize(@intToFloat(f32, width), @intToFloat(f32, height));
}
/// Sets the application's window title
pub fn setWindowTitle(self: *Self, title: [*c]const u8) void {
c.glfwSetWindowTitle(app_window, title);
}
/// Returns the application's window
pub fn window() *c.GLFWwindow {
return app_window;
}
/// Returns the size of the application's window as a Vector2
pub fn windowSize() Vector2 {
return window_size;
}
/// Sets the window size property
pub fn setWindowSize(width: f32, height: f32) void {
window_size = Vector2.new(width, height);
}
/// Sets the viewport size
pub fn setViewport(width: f32, height: f32) void {
viewport_size = Vector2.new(width, height);
}
/// Returns the viewport size
pub fn viewportSize() Vector2 {
return viewport_size;
}
}; | src/core/application.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqualSlices = std.testing.expectEqualSlices;
const expectEqual = std.testing.expectEqual;
const mem = std.mem;
const x = @intToPtr([*]i32, 0x1000)[0..0x500];
const y = x[0x100..];
test "compile time slice of pointer to hard coded address" {
expect(@ptrToInt(x.ptr) == 0x1000);
expect(x.len == 0x500);
expect(@ptrToInt(y.ptr) == 0x1100);
expect(y.len == 0x400);
}
test "runtime safety lets us slice from len..len" {
var an_array = [_]u8{
1,
2,
3,
};
expect(mem.eql(u8, sliceFromLenToLen(an_array[0..], 3, 3), ""));
}
fn sliceFromLenToLen(a_slice: []u8, start: usize, end: usize) []u8 {
return a_slice[start..end];
}
test "implicitly cast array of size 0 to slice" {
var msg = [_]u8{};
assertLenIsZero(&msg);
}
fn assertLenIsZero(msg: []const u8) void {
expect(msg.len == 0);
}
test "C pointer" {
var buf: [*c]const u8 = "kjdhfkjdhfdkjhfkfjhdfkjdhfkdjhfdkjhf";
var len: u32 = 10;
var slice = buf[0..len];
expectEqualSlices(u8, "kjdhfkjdhf", slice);
}
fn sliceSum(comptime q: []const u8) i32 {
comptime var result = 0;
inline for (q) |item| {
result += item;
}
return result;
}
test "comptime slices are disambiguated" {
expect(sliceSum(&[_]u8{ 1, 2 }) == 3);
expect(sliceSum(&[_]u8{ 3, 4 }) == 7);
}
test "slice type with custom alignment" {
const LazilyResolvedType = struct {
anything: i32,
};
var slice: []align(32) LazilyResolvedType = undefined;
var array: [10]LazilyResolvedType align(32) = undefined;
slice = &array;
slice[1].anything = 42;
expect(array[1].anything == 42);
}
test "access len index of sentinel-terminated slice" {
const S = struct {
fn doTheTest() void {
var slice: [:0]const u8 = "hello";
expect(slice.len == 5);
expect(slice[5] == 0);
}
};
S.doTheTest();
comptime S.doTheTest();
}
test "obtaining a null terminated slice" {
// here we have a normal array
var buf: [50]u8 = undefined;
buf[0] = 'a';
buf[1] = 'b';
buf[2] = 'c';
buf[3] = 0;
// now we obtain a null terminated slice:
const ptr = buf[0..3 :0];
var runtime_len: usize = 3;
const ptr2 = buf[0..runtime_len :0];
// ptr2 is a null-terminated slice
comptime expect(@TypeOf(ptr2) == [:0]u8);
comptime expect(@TypeOf(ptr2[0..2]) == []u8);
}
test "empty array to slice" {
const S = struct {
fn doTheTest() void {
const empty: []align(16) u8 = &[_]u8{};
const align_1: []align(1) u8 = empty;
const align_4: []align(4) u8 = empty;
const align_16: []align(16) u8 = empty;
expectEqual(1, @typeInfo(@TypeOf(align_1)).Pointer.alignment);
expectEqual(4, @typeInfo(@TypeOf(align_4)).Pointer.alignment);
expectEqual(16, @typeInfo(@TypeOf(align_16)).Pointer.alignment);
}
};
S.doTheTest();
comptime S.doTheTest();
} | test/stage1/behavior/slice.zig |
usingnamespace @import("root").preamble;
const log = lib.output.log.scoped(.{
.prefix = "Interrupts",
.filter = .info,
}).write;
const platform = os.platform;
const range = lib.util.range;
const scheduler = os.thread.scheduler;
const idt = @import("idt.zig");
const gdt = @import("gdt.zig");
const pic = @import("pic.zig");
const apic = @import("apic.zig");
const thread = @import("thread.zig");
const regs = @import("regs.zig");
pub const num_handlers = 0x100;
pub const InterruptHandler = fn (*InterruptFrame) void;
pub const InterruptState = bool;
export var handlers: [256]InterruptHandler = [_]InterruptHandler{unhandled_interrupt} ** num_handlers;
var itable: *[256]idt.IdtEntry = undefined;
fn generate_callbacks() [256]fn () callconv(.Naked) void {
var result: [256]fn () callconv(.Naked) void = undefined;
inline for (range.range(num_handlers)) |intnum| {
result[intnum] = comptime make_handler(intnum);
}
return result;
}
var raw_callbacks: [256](fn () callconv(.Naked) void) = generate_callbacks();
/// Use ist=2 for scheduler calls and ist=1 for interrupts
pub fn add_handler(idx: u8, f: InterruptHandler, interrupt: bool, priv_level: u2, ist: u3) void {
itable[idx] = idt.entry(raw_callbacks[idx], interrupt, priv_level, ist);
handlers[idx] = f;
}
pub const sched_call_vector: u8 = 0x31;
pub const ring_vector: u8 = 0x32;
var last_vector: u8 = ring_vector;
pub const syscall_vector: u8 = 0x80;
pub const invlpg_vector: u8 = 0xFE;
pub const spurious_vector: u8 = 0xFF;
// TODO: this function **will** cause a mess once it reaches 0x80
pub fn allocate_vector() u8 {
return @atomicRmw(u8, &last_vector, .Add, 1, .AcqRel) + 1;
}
var irq_fns: [256]usize = undefined;
var irq_ctxs: [256]usize = undefined;
fn irq_handler(frame: *InterruptFrame) void {
const fptr = @intToPtr(*fn (usize) void, irq_fns[frame.intnum]);
(fptr.*)(irq_ctxs[frame.intnum]);
apic.eoi();
}
pub fn irq_with_ctx(fun: usize, ctx: usize) u8 {
const vec = allocate_vector();
irq_fns[vec] = fun;
irq_ctxs[vec] = ctx;
add_handler(vec, irq_handler, true, 0, 1);
return vec;
}
pub fn init_interrupts() void {
pic.disable();
itable = &idt.idt;
for (range.rt_range(num_handlers)) |_, intnum| {
add_handler(@intCast(u8, intnum), unhandled_interrupt, true, 0, 0);
}
add_handler(0x0E, page_fault_handler, true, 0, 1);
add_handler(0x80, userspace_syscall_handler, true, 3, 1);
add_handler(ring_vector, ring_handler, true, 0, 1);
add_handler(sched_call_vector, os.platform.thread.sched_call_impl_handler, true, 0, 2);
add_handler(invlpg_vector, invlpg_handler, true, 0, 1);
add_handler(spurious_vector, spurious_handler, true, 0, 1);
}
fn spurious_handler(_: *InterruptFrame) void {}
fn ring_handler(_: *InterruptFrame) void {
apic.eoi();
}
fn invlpg_handler(_: *InterruptFrame) void {
const cr3 = regs.ControlRegister(usize, "cr3");
cr3.write(cr3.read());
_ = @atomicRmw(usize, &os.platform.thread.get_current_cpu().platform_data.invlpg_counter, .Add, 1, .AcqRel);
apic.eoi();
}
fn userspace_syscall_handler(frame: *InterruptFrame) void {
os.kernel.process.currentProcess().?.handleSyscall(frame);
}
fn type_page_fault(error_code: usize) platform.PageFaultAccess {
if ((error_code & 0x10) != 0)
return .InstructionFetch;
if ((error_code & 0x2) != 0)
return .Write;
return .Read;
}
fn page_fault_handler(frame: *InterruptFrame) void {
const page_fault_addr = regs.ControlRegister(usize, "cr2").read();
const page_fault_type = type_page_fault(frame.ec);
const userspace_cs = ((frame.cs & 0x3) == 3);
const userspace_page_fault = ((frame.ec & 0x4) != 0);
std.debug.assert(userspace_cs == userspace_page_fault);
if (userspace_cs) {
os.kernel.process.currentProcess().?.onPageFault(page_fault_addr, (frame.ec & 1) != 0, page_fault_type, frame);
} else {
platform.page_fault(page_fault_addr, (frame.ec & 1) != 0, page_fault_type, frame);
}
}
fn unhandled_interrupt(frame: *InterruptFrame) void {
log(null, "Unhandled interrupt: 0x{X}!", .{frame.intnum});
log(null, "Frame dump:\n{}", .{frame});
frame.trace_stack();
os.platform.hang();
}
fn is_exception(intnum: u64) bool {
return switch (intnum) {
0x00...0x1F => true,
else => false,
};
}
fn name(intnum: u64) []const u8 {
return switch (intnum) {
0x00 => "Divide by zero",
0x01 => "Debug",
0x02 => "Non-maskable interrupt",
0x03 => "Breakpoint",
0x04 => "Overflow",
0x05 => "Bound range exceeded",
0x06 => "Invalid opcode",
0x07 => "Device not available",
0x08 => "Double fault",
0x09 => "Coprocessor Segment Overrun",
0x0A => "Invalid TSS",
0x0B => "Segment Not Present",
0x0C => "Stack-Segment Fault",
0x0D => "General Protection Fault",
0x0E => "Page Fault",
0x0F => unreachable,
0x10 => "x87 Floating-Point Exception",
0x11 => "Alignment Check",
0x12 => "Machine Check",
0x13 => "SIMD Floating-Point Exception",
0x14 => "Virtualization Exception",
0x15...0x1D => unreachable,
0x1E => "Security Exception",
else => unreachable,
};
}
fn has_error_code(intnum: u64) bool {
return switch (intnum) {
// Exceptions
0x00...0x07 => false,
0x08 => true,
0x09 => false,
0x0A...0x0E => true,
0x0F...0x10 => false,
0x11 => true,
0x12...0x14 => false,
//0x15 ... 0x1D => unreachable,
0x1E => true,
//0x1F => unreachable,
// Other interrupts
else => false,
};
}
pub fn make_handler(comptime intnum: u8) idt.InterruptHandler {
return struct {
fn func() callconv(.Naked) void {
const ec = if (comptime (!has_error_code(intnum))) "push $0\n" else "";
asm volatile (ec ++ "push %[intnum]\njmp interrupt_common\n"
:
: [intnum] "i" (@as(u8, intnum))
);
}
}.func;
}
pub const InterruptFrame = packed struct {
es: u64,
ds: u64,
r15: u64,
r14: u64,
r13: u64,
r12: u64,
r11: u64,
r10: u64,
r9: u64,
r8: u64,
rdi: u64,
rsi: u64,
rbp: u64,
rdx: u64,
rcx: u64,
rbx: u64,
rax: u64,
intnum: u64,
ec: u64,
rip: u64,
cs: u64,
eflags: u64,
rsp: u64,
ss: u64,
pub fn format(self: *const @This(), fmt: anytype) void {
fmt(" rax={0X} rbx={0X} rcx={0X} rdx={0X}\n", .{ self.rax, self.rbx, self.rcx, self.rdx });
fmt(" rsi={0X} rdi={0X} rbp={0X} rsp={0X}\n", .{ self.rsi, self.rdi, self.rbp, self.rsp });
fmt(" r8 ={0X} r9 ={0X} r10={0X} r11={0X}\n", .{ self.r8, self.r9, self.r10, self.r11 });
fmt(" r12={0X} r13={0X} r14={0X} r15={0X}\n", .{ self.r12, self.r13, self.r14, self.r15 });
fmt(" rip={0X} int={0X} ec ={0X} cs ={0X}\n", .{ self.rip, self.intnum, self.ec, self.cs });
fmt(" ds ={0X} es ={0X} flg={0X}", .{ self.ds, self.es, self.eflags });
}
pub fn trace_stack(self: *const @This()) void {
os.kernel.debug.dumpFrame(self.rbp, self.rip);
}
};
export fn interrupt_common() callconv(.Naked) void {
asm volatile (
\\push %%rax
\\push %%rbx
\\push %%rcx
\\push %%rdx
\\push %%rbp
\\push %%rsi
\\push %%rdi
\\push %%r8
\\push %%r9
\\push %%r10
\\push %%r11
\\push %%r12
\\push %%r13
\\push %%r14
\\push %%r15
\\mov %%ds, %%rax
\\push %%rax
\\mov %%es, %%rax
\\push %%rax
\\mov %%rsp, %%rdi
\\mov %[dsel], %%ax
\\mov %%ax, %%es
\\mov %%ax, %%ds
\\call interrupt_handler
\\pop %%rax
\\mov %%rax, %%es
\\pop %%rax
\\mov %%rax, %%ds
\\pop %%r15
\\pop %%r14
\\pop %%r13
\\pop %%r12
\\pop %%r11
\\pop %%r10
\\pop %%r9
\\pop %%r8
\\pop %%rdi
\\pop %%rsi
\\pop %%rbp
\\pop %%rdx
\\pop %%rcx
\\pop %%rbx
\\pop %%rax
\\add $16, %%rsp // Pop error code and interrupt number
\\iretq
:
: [dsel] "i" (gdt.selector.data64)
);
unreachable;
}
export fn interrupt_handler(frame: u64) void {
const int_frame = @intToPtr(*InterruptFrame, frame);
int_frame.intnum &= 0xFF;
if (int_frame.intnum < num_handlers) {
handlers[int_frame.intnum](int_frame);
}
}
// Turns out GAS is so terrible we have to write a small assembler ourselves.
const swapgs = [_]u8{ 0x0F, 0x01, 0xF8 };
const sti = [_]u8{0xFB};
const rex = [_]u8{0x41};
fn pack_le(comptime T: type, comptime value: u32) [@sizeOf(T)]u8 {
var result: [@sizeOf(T)]u8 = undefined;
std.mem.writeIntLittle(T, &result, value);
return result;
}
fn mov_gs_offset_rsp(comptime offset: u32) [9]u8 {
return [_]u8{ 0x65, 0x48, 0x89, 0x24, 0x25 } ++ pack_le(u32, offset);
}
fn mov_rsp_gs_offset(comptime offset: u32) [9]u8 {
return [_]u8{ 0x65, 0x48, 0x8B, 0x24, 0x25 } ++ pack_le(u32, offset);
}
fn mov_rsp_rsp_offset(comptime offset: u32) [8]u8 {
return [_]u8{ 0x48, 0x8B, 0xA4, 0x24 } ++ pack_le(u32, offset);
}
fn push_gs_offset(comptime offset: u32) [8]u8 {
return [_]u8{ 0x65, 0xFF, 0x34, 0x25 } ++ pack_le(u32, offset);
}
fn pushi32(comptime value: i32) [5]u8 {
return [_]u8{0x68} ++ pack_le(i32, value);
}
fn pushi8(comptime value: i8) [2]u8 {
return [_]u8{0x6A} ++ pack_le(i8, value);
}
fn push_reg(comptime regnum: u3) [1]u8 {
return [_]u8{0x50 | @as(u8, regnum)};
}
// Assumes IA32_FMASK (0xC0000084) disables interrupts
const rsp_stash_offset =
@offsetOf(os.platform.smp.CoreData, "platform_data") +
@offsetOf(os.platform.thread.CoreData, "rsp_stash");
const task_offset = @offsetOf(os.platform.smp.CoreData, "current_task");
const kernel_stack_offset = @offsetOf(os.thread.Task, "stack");
// zig fmt: off
const syscall_handler_bytes = [0]u8{}
// First make sure we get a proper stack pointer while
// saving away all the userspace registers.
++ swapgs // swapgs
++ mov_gs_offset_rsp(rsp_stash_offset) // mov gs:[rsp_stash_offset], rsp
++ mov_rsp_gs_offset(task_offset) // mov rsp, gs:[task_offset]
++ mov_rsp_rsp_offset(kernel_stack_offset) // mov rsp, [rsp + kernel_stack_offset]
// Now we have a kernel stack in rsp
// Set up an iret frame
++ pushi8(gdt.selector.userdata64) // push user_data_sel // iret ss
++ push_gs_offset(rsp_stash_offset) // push gs:[rsp_stash_offset] // iret rsp
++ rex ++ push_reg(11 - 8) // push r11 // iret rflags
++ pushi8(gdt.selector.usercode64) // push user_code_sel // iret cs
++ push_reg(1) // push rcx // iret rip
++ swapgs ++ sti
// Now let's set up the rest of the interrupt frame
++ pushi8(0) // push 0 // error code
++ pushi32(syscall_vector) // push 0x80 // interrupt vector
;
// zig fmt: on
fn hex_chr(comptime value: u4) u8 {
return "0123456789ABCDEF"[value];
}
fn hex_str(comptime value: u8) [2]u8 {
var buf: [2]u8 = undefined;
buf[0] = hex_chr(@truncate(u4, value >> 4));
buf[1] = hex_chr(@truncate(u4, value));
return buf;
}
pub fn syscall_handler() callconv(.Naked) void {
// https://github.com/ziglang/zig/issues/8644
comptime var syscall_handler_asm: []const u8 = &[_]u8{};
inline for (syscall_handler_bytes) |b|
syscall_handler_asm = syscall_handler_asm ++ [_]u8{ '.', 'b', 'y', 't', 'e', ' ', '0', 'x' } ++ hex_str(b) ++ [_]u8{'\n'};
asm volatile (syscall_handler_asm ++
\\jmp interrupt_common
\\
);
unreachable;
} | subprojects/flork/src/platform/x86_64/interrupts.zig |
const std = @import("std");
const builtin = @import("builtin");
const ArrayList = std.ArrayList;
const Allocator = std.mem.Allocator;
const AutoHashMap = std.AutoHashMap;
const min = std.math.min;
const warn = std.debug.warn;
/// Top Level
pub const Device = struct {
name: ArrayList(u8),
version: ArrayList(u8),
description: ArrayList(u8),
cpu: ?Cpu,
/// Bus Interface Properties
/// Smallest addressable unit in bits
address_unit_bits: ?u32,
/// The Maximum data bit width accessible within a single transfer
max_bit_width: ?u32,
/// Start register default properties
reg_default_size: ?u32,
reg_default_reset_value: ?u32,
reg_default_reset_mask: ?u32,
peripherals: Peripherals,
interrupts: Interrupts,
const Self = @This();
pub fn init(allocator: Allocator) !Self {
var name = ArrayList(u8).init(allocator);
errdefer name.deinit();
var version = ArrayList(u8).init(allocator);
errdefer version.deinit();
var description = ArrayList(u8).init(allocator);
errdefer description.deinit();
var peripherals = Peripherals.init(allocator);
errdefer peripherals.deinit();
var interrupts = Interrupts.init(allocator);
errdefer interrupts.deinit();
return Self{
.name = name,
.version = version,
.description = description,
.cpu = null,
.address_unit_bits = null,
.max_bit_width = null,
.reg_default_size = null,
.reg_default_reset_value = null,
.reg_default_reset_mask = null,
.peripherals = peripherals,
.interrupts = interrupts,
};
}
pub fn deinit(self: *Self) void {
self.name.deinit();
self.version.deinit();
self.description.deinit();
self.peripherals.deinit();
self.interrupts.deinit();
}
pub fn format(self: Self, comptime _: []const u8, _: std.fmt.FormatOptions, out_stream: anytype) !void {
const name = if (self.name.items.len == 0) "unknown" else self.name.items;
const version = if (self.version.items.len == 0) "unknown" else self.version.items;
const description = if (self.description.items.len == 0) "unknown" else self.description.items;
try out_stream.print(
\\pub const device_name = "{s}";
\\pub const device_revision = "{s}";
\\pub const device_description = "{s}";
\\
, .{ name, version, description });
if (self.cpu) |the_cpu| {
try out_stream.print("{}\n", .{the_cpu});
}
// now print peripherals
for (self.peripherals.items) |peripheral| {
try out_stream.print("{}\n", .{peripheral});
}
// now print interrupt table
try out_stream.writeAll("pub const interrupts = struct {\n");
var iter = self.interrupts.iterator();
while (iter.next()) |entry| {
var interrupt = entry.value_ptr.*;
if (interrupt.value) |int_value| {
try out_stream.print(
"pub const {s} = {};\n",
.{ interrupt.name.items, int_value },
);
}
}
try out_stream.writeAll("};");
return;
}
};
pub const Cpu = struct {
name: ArrayList(u8),
revision: ArrayList(u8),
endian: ArrayList(u8),
mpu_present: ?bool,
fpu_present: ?bool,
nvic_prio_bits: ?u32,
vendor_systick_config: ?bool,
const Self = @This();
pub fn init(allocator: Allocator) !Self {
var name = ArrayList(u8).init(allocator);
errdefer name.deinit();
var revision = ArrayList(u8).init(allocator);
errdefer revision.deinit();
var endian = ArrayList(u8).init(allocator);
errdefer endian.deinit();
return Self{
.name = name,
.revision = revision,
.endian = endian,
.mpu_present = null,
.fpu_present = null,
.nvic_prio_bits = null,
.vendor_systick_config = null,
};
}
pub fn deinit(self: *Self) void {
self.name.deinit();
self.revision.deinit();
self.endian.deinit();
}
pub fn format(self: Self, comptime _: []const u8, _: std.fmt.FormatOptions, out_stream: anytype) !void {
try out_stream.writeAll("\n");
const name = if (self.name.items.len == 0) "unknown" else self.name.items;
const revision = if (self.revision.items.len == 0) "unknown" else self.revision.items;
const endian = if (self.endian.items.len == 0) "unknown" else self.endian.items;
const mpu_present = self.mpu_present orelse false;
const fpu_present = self.mpu_present orelse false;
const vendor_systick_config = self.vendor_systick_config orelse false;
try out_stream.print(
\\pub const cpu = struct {{
\\ pub const name = "{s}";
\\ pub const revision = "{s}";
\\ pub const endian = "{s}";
\\ pub const mpu_present = {};
\\ pub const fpu_present = {};
\\ pub const vendor_systick_config = {};
\\
, .{ name, revision, endian, mpu_present, fpu_present, vendor_systick_config });
if (self.nvic_prio_bits) |prio_bits| {
try out_stream.print(
\\ pub const nvic_prio_bits = {};
\\
, .{prio_bits});
}
try out_stream.writeAll("};");
return;
}
};
pub const Peripherals = ArrayList(Peripheral);
pub const Peripheral = struct {
name: ArrayList(u8),
group_name: ArrayList(u8),
description: ArrayList(u8),
base_address: ?u32,
address_block: ?AddressBlock,
registers: Registers,
const Self = @This();
pub fn init(allocator: Allocator) !Self {
var name = ArrayList(u8).init(allocator);
errdefer name.deinit();
var group_name = ArrayList(u8).init(allocator);
errdefer group_name.deinit();
var description = ArrayList(u8).init(allocator);
errdefer description.deinit();
var registers = Registers.init(allocator);
errdefer registers.deinit();
return Self{
.name = name,
.group_name = group_name,
.description = description,
.base_address = null,
.address_block = null,
.registers = registers,
};
}
pub fn copy(self: Self, allocator: Allocator) !Self {
var the_copy = try Self.init(allocator);
errdefer the_copy.deinit();
try the_copy.name.appendSlice(self.name.items);
try the_copy.group_name.appendSlice(self.group_name.items);
try the_copy.description.appendSlice(self.description.items);
the_copy.base_address = self.base_address;
the_copy.address_block = self.address_block;
for (self.registers.items) |self_register| {
try the_copy.registers.append(try self_register.copy(allocator));
}
return the_copy;
}
pub fn deinit(self: *Self) void {
self.name.deinit();
self.group_name.deinit();
self.description.deinit();
self.registers.deinit();
}
pub fn isValid(self: Self) bool {
if (self.name.items.len == 0) {
return false;
}
_ = self.base_address orelse return false;
return true;
}
pub fn format(self: Self, comptime _: []const u8, _: std.fmt.FormatOptions, out_stream: anytype) !void {
try out_stream.writeAll("\n");
if (!self.isValid()) {
try out_stream.writeAll("// Not enough info to print peripheral value\n");
return;
}
const name = self.name.items;
const description = if (self.description.items.len == 0) "No description" else self.description.items;
const base_address = self.base_address.?;
try out_stream.print(
\\/// {s}
\\pub const {s} = struct {{
\\
\\const base_address = 0x{x};
, .{ description, name, base_address });
// now print registers
for (self.registers.items) |register| {
try out_stream.print("{}\n", .{register});
}
// and close the peripheral
try out_stream.print("}};", .{});
return;
}
};
pub const AddressBlock = struct {
offset: ?u32,
size: ?u32,
usage: ArrayList(u8),
const Self = @This();
pub fn init(allocator: Allocator) !Self {
var usage = ArrayList(u8).init(allocator);
errdefer usage.deinit();
return Self{
.offset = null,
.size = null,
.usage = usage,
};
}
pub fn deinit(self: *Self) void {
self.usage.deinit();
}
};
pub const Interrupts = AutoHashMap(u32, Interrupt);
pub const Interrupt = struct {
name: ArrayList(u8),
description: ArrayList(u8),
value: ?u32,
const Self = @This();
pub fn init(allocator: Allocator) !Self {
var name = ArrayList(u8).init(allocator);
errdefer name.deinit();
var description = ArrayList(u8).init(allocator);
errdefer description.deinit();
return Self{
.name = name,
.description = description,
.value = null,
};
}
pub fn copy(self: Self, allocator: Allocator) !Self {
var the_copy = try Self.init(allocator);
try the_copy.name.append(self.name.items);
try the_copy.description.append(self.description.items);
the_copy.value = self.value;
return the_copy;
}
pub fn deinit(self: *Self) void {
self.name.deinit();
self.description.deinit();
}
pub fn isValid(self: Self) bool {
if (self.name.items.len == 0) {
return false;
}
_ = self.value orelse return false;
return true;
}
pub fn format(self: Self, comptime _: []const u8, _: std.fmt.FormatOptions, out_stream: anytype) !void {
try out_stream.writeAll("\n");
if (!self.isValid()) {
try out_stream.writeAll("// Not enough info to print interrupt value\n");
return;
}
const name = self.name.items;
const description = if (self.description.items.len == 0) "No description" else self.description.items;
try out_stream.print(
\\/// {s}
\\pub const {s} = {s};
\\
, .{ description, name, self.value.? });
}
};
const Registers = ArrayList(Register);
pub const Register = struct {
periph_containing: ArrayList(u8),
name: ArrayList(u8),
display_name: ArrayList(u8),
description: ArrayList(u8),
address_offset: ?u32,
size: u32,
reset_value: u32,
fields: Fields,
access: Access = .ReadWrite,
const Self = @This();
pub fn init(allocator: Allocator, periph: []const u8, reset_value: u32, size: u32) !Self {
var prefix = ArrayList(u8).init(allocator);
errdefer prefix.deinit();
try prefix.appendSlice(periph);
var name = ArrayList(u8).init(allocator);
errdefer name.deinit();
var display_name = ArrayList(u8).init(allocator);
errdefer display_name.deinit();
var description = ArrayList(u8).init(allocator);
errdefer description.deinit();
var fields = Fields.init(allocator);
errdefer fields.deinit();
return Self{
.periph_containing = prefix,
.name = name,
.display_name = display_name,
.description = description,
.address_offset = null,
.size = size,
.reset_value = reset_value,
.fields = fields,
};
}
pub fn copy(self: Self, allocator: Allocator) !Self {
var the_copy = try Self.init(allocator, self.periph_containing.items, self.reset_value, self.size);
try the_copy.name.appendSlice(self.name.items);
try the_copy.display_name.appendSlice(self.display_name.items);
try the_copy.description.appendSlice(self.description.items);
the_copy.address_offset = self.address_offset;
the_copy.access = self.access;
for (self.fields.items) |self_field| {
try the_copy.fields.append(try self_field.copy(allocator));
}
return the_copy;
}
pub fn deinit(self: *Self) void {
self.periph_containing.deinit();
self.name.deinit();
self.display_name.deinit();
self.description.deinit();
self.fields.deinit();
}
pub fn isValid(self: Self) bool {
if (self.name.items.len == 0) {
return false;
}
_ = self.address_offset orelse return false;
return true;
}
fn fieldsSortCompare(_: void, left: Field, right: Field) bool {
if (left.bit_offset != null and right.bit_offset != null) {
if (left.bit_offset.? < right.bit_offset.?) {
return true;
}
if (left.bit_offset.? > right.bit_offset.?) {
return false;
}
} else if (left.bit_offset == null) {
return true;
}
return false;
}
fn alignedEndOfUnusedChunk(chunk_start: u32, last_unused: u32) u32 {
// Next multiple of 8 from chunk_start + 1
const next_multiple = (chunk_start + 8) & ~@as(u32, 7);
return min(next_multiple, last_unused);
}
fn writeUnusedField(first_unused: u32, last_unused: u32, reg_reset_value: u32, out_stream: anytype) !void {
// Fill unused bits between two fields
// TODO: right now we have to manually chunk unused bits to 8-bit boundaries as a workaround
// to this bug https://github.com/ziglang/zig/issues/2627
var chunk_start = first_unused;
var chunk_end = alignedEndOfUnusedChunk(chunk_start, last_unused);
try out_stream.print("\n/// unused [{}:{}]", .{ first_unused, last_unused - 1 });
while (chunk_start < last_unused) : ({
chunk_start = chunk_end;
chunk_end = alignedEndOfUnusedChunk(chunk_start, last_unused);
}) {
try out_stream.writeAll("\n");
const chunk_width = chunk_end - chunk_start;
const unused_value = Field.fieldResetValue(chunk_start, chunk_width, reg_reset_value);
try out_stream.print("_unused{}: u{} = {},", .{ chunk_start, chunk_width, unused_value });
}
}
pub fn format(self: Self, comptime _: []const u8, _: std.fmt.FormatOptions, out_stream: anytype) !void {
try out_stream.writeAll("\n");
if (!self.isValid()) {
try out_stream.writeAll("// Not enough info to print register value\n");
return;
}
const name = self.name.items;
// const periph = self.periph_containing.items;
const description = if (self.description.items.len == 0) "No description" else self.description.items;
// print packed struct containing fields
try out_stream.print(
\\/// {s}
\\const {s}_val = packed struct {{
, .{ name, name });
// Sort fields from LSB to MSB for next step
std.sort.sort(Field, self.fields.items, {}, fieldsSortCompare);
var last_uncovered_bit: u32 = 0;
for (self.fields.items) |field| {
if ((field.bit_offset == null) or (field.bit_width == null)) {
try out_stream.writeAll("// Not enough info to print register\n");
return;
}
const bit_offset = field.bit_offset.?;
const bit_width = field.bit_width.?;
if (last_uncovered_bit != bit_offset) {
try writeUnusedField(last_uncovered_bit, bit_offset, self.reset_value, out_stream);
}
try out_stream.print("{}", .{field});
last_uncovered_bit = bit_offset + bit_width;
}
// Check if we need padding at the end
if (last_uncovered_bit != 32) {
try writeUnusedField(last_uncovered_bit, 32, self.reset_value, out_stream);
}
// close the struct and init the register
try out_stream.print(
\\
\\}};
\\/// {s}
\\pub const {s} = Register({s}_val).init(base_address + 0x{x});
, .{ description, name, name, self.address_offset.? });
return;
}
};
pub const Access = enum {
ReadOnly,
WriteOnly,
ReadWrite,
};
pub const Fields = ArrayList(Field);
pub const Field = struct {
periph: ArrayList(u8),
register: ArrayList(u8),
register_reset_value: u32,
name: ArrayList(u8),
description: ArrayList(u8),
bit_offset: ?u32,
bit_width: ?u32,
access: Access = .ReadWrite,
const Self = @This();
pub fn init(allocator: Allocator, periph_containing: []const u8, register_containing: []const u8, register_reset_value: u32) !Self {
var periph = ArrayList(u8).init(allocator);
try periph.appendSlice(periph_containing);
errdefer periph.deinit();
var register = ArrayList(u8).init(allocator);
try register.appendSlice(register_containing);
errdefer register.deinit();
var name = ArrayList(u8).init(allocator);
errdefer name.deinit();
var description = ArrayList(u8).init(allocator);
errdefer description.deinit();
return Self{
.periph = periph,
.register = register,
.register_reset_value = register_reset_value,
.name = name,
.description = description,
.bit_offset = null,
.bit_width = null,
};
}
pub fn copy(self: Self, allocator: Allocator) !Self {
var the_copy = try Self.init(allocator, self.periph.items, self.register.items, self.register_reset_value);
try the_copy.name.appendSlice(self.name.items);
try the_copy.description.appendSlice(self.description.items);
the_copy.bit_offset = self.bit_offset;
the_copy.bit_width = self.bit_width;
the_copy.access = self.access;
return the_copy;
}
pub fn deinit(self: *Self) void {
self.periph.deinit();
self.register.deinit();
self.name.deinit();
self.description.deinit();
}
pub fn fieldResetValue(bit_start: u32, bit_width: u32, reg_reset_value: u32) u32 {
const shifted_reset_value = reg_reset_value >> @intCast(u5, bit_start);
const reset_value_mask = @intCast(u32, (@as(u33, 1) << @intCast(u6, bit_width)) - 1);
return shifted_reset_value & reset_value_mask;
}
pub fn format(self: Self, comptime _: []const u8, _: std.fmt.FormatOptions, out_stream: anytype) !void {
try out_stream.writeAll("\n");
if (self.name.items.len == 0) {
try out_stream.writeAll("// No name to print field value\n");
return;
}
if ((self.bit_offset == null) or (self.bit_width == null)) {
try out_stream.writeAll("// Not enough info to print field\n");
return;
}
const name = self.name.items;
const description = if (self.description.items.len == 0) "No description" else self.description.items;
const start_bit = self.bit_offset.?;
const end_bit = (start_bit + self.bit_width.? - 1);
const bit_width = self.bit_width.?;
const reg_reset_value = self.register_reset_value;
const reset_value = fieldResetValue(start_bit, bit_width, reg_reset_value);
try out_stream.print(
\\/// {s} [{}:{}]
\\/// {s}
\\{s}: u{} = {},
, .{
name,
start_bit,
end_bit,
// description
description,
// val
name,
bit_width,
reset_value,
});
return;
}
};
test "Field print" {
var allocator = std.testing.allocator;
const fieldDesiredPrint =
\\
\\/// RNGEN [2:2]
\\/// RNGEN comment
\\RNGEN: u1 = 1,
\\
;
var output_buffer = ArrayList(u8).init(allocator);
defer output_buffer.deinit();
var buf_stream = output_buffer.writer();
var field = try Field.init(allocator, "PERIPH", "RND", 0b101);
defer field.deinit();
try field.name.appendSlice("RNGEN");
try field.description.appendSlice("RNGEN comment");
field.bit_offset = 2;
field.bit_width = 1;
try buf_stream.print("{}\n", .{field});
std.testing.expect(std.mem.eql(u8, output_buffer.items, fieldDesiredPrint));
}
test "Register Print" {
var allocator = std.testing.allocator;
const registerDesiredPrint =
\\
\\/// RND
\\const RND_val = packed struct {
\\/// unused [0:1]
\\_unused0: u2 = 1,
\\/// RNGEN [2:2]
\\/// RNGEN comment
\\RNGEN: u1 = 1,
\\/// unused [3:9]
\\_unused3: u5 = 0,
\\_unused8: u2 = 0,
\\/// SEED [10:12]
\\/// SEED comment
\\SEED: u3 = 0,
\\/// unused [13:31]
\\_unused13: u3 = 0,
\\_unused16: u8 = 0,
\\_unused24: u8 = 0,
\\};
\\/// RND comment
\\pub const RND = Register(RND_val).init(base_address + 0x100);
\\
;
var output_buffer = ArrayList(u8).init(allocator);
defer output_buffer.deinit();
var buf_stream = output_buffer.writer();
var register = try Register.init(allocator, "PERIPH", 0b101, 0x20);
defer register.deinit();
try register.name.appendSlice("RND");
try register.description.appendSlice("RND comment");
register.address_offset = 0x100;
register.size = 0x20;
var field = try Field.init(allocator, "PERIPH", "RND", 0b101);
defer field.deinit();
try field.name.appendSlice("RNGEN");
try field.description.appendSlice("RNGEN comment");
field.bit_offset = 2;
field.bit_width = 1;
field.access = .ReadWrite; // write field will exist
var field2 = try Field.init(allocator, "PERIPH", "RND", 0b101);
defer field2.deinit();
try field2.name.appendSlice("SEED");
try field2.description.appendSlice("SEED comment");
field2.bit_offset = 10;
field2.bit_width = 3;
field2.access = .ReadWrite;
try register.fields.append(field);
try register.fields.append(field2);
try buf_stream.print("{}\n", .{register});
std.testing.expectEqualSlices(u8, output_buffer.items, registerDesiredPrint);
}
test "Peripheral Print" {
var allocator = std.testing.allocator;
const peripheralDesiredPrint =
\\
\\/// PERIPH comment
\\pub const PERIPH = struct {
\\
\\const base_address = 0x24000;
\\/// RND
\\const RND_val = packed struct {
\\/// unused [0:1]
\\_unused0: u2 = 1,
\\/// RNGEN [2:2]
\\/// RNGEN comment
\\RNGEN: u1 = 1,
\\/// unused [3:9]
\\_unused3: u5 = 0,
\\_unused8: u2 = 0,
\\/// SEED [10:12]
\\/// SEED comment
\\SEED: u3 = 0,
\\/// unused [13:31]
\\_unused13: u3 = 0,
\\_unused16: u8 = 0,
\\_unused24: u8 = 0,
\\};
\\/// RND comment
\\pub const RND = Register(RND_val).init(base_address + 0x100);
\\};
\\
;
var output_buffer = ArrayList(u8).init(allocator);
defer output_buffer.deinit();
var buf_stream = output_buffer.writer();
var peripheral = try Peripheral.init(allocator);
defer peripheral.deinit();
try peripheral.name.appendSlice("PERIPH");
try peripheral.description.appendSlice("PERIPH comment");
peripheral.base_address = 0x24000;
var register = try Register.init(allocator, "PERIPH", 0b101, 0x20);
defer register.deinit();
try register.name.appendSlice("RND");
try register.description.appendSlice("RND comment");
register.address_offset = 0x100;
register.size = 0x20;
var field = try Field.init(allocator, "PERIPH", "RND", 0b101);
defer field.deinit();
try field.name.appendSlice("RNGEN");
try field.description.appendSlice("RNGEN comment");
field.bit_offset = 2;
field.bit_width = 1;
field.access = .ReadOnly; // since only register, write field will not exist
var field2 = try Field.init(allocator, "PERIPH", "RND", 0b101);
defer field2.deinit();
try field2.name.appendSlice("SEED");
try field2.description.appendSlice("SEED comment");
field2.bit_offset = 10;
field2.bit_width = 3;
field2.access = .ReadWrite;
try register.fields.append(field);
try register.fields.append(field2);
try peripheral.registers.append(register);
try buf_stream.print("{}\n", .{peripheral});
std.testing.expectEqualSlices(u8, peripheralDesiredPrint, output_buffer.items);
}
fn bitWidthToMask(width: u32) u32 {
const max_supported_bits = 32;
const width_to_mask = blk: {
comptime var mask_array: [max_supported_bits + 1]u32 = undefined;
inline for (mask_array) |*item, i| {
const i_use = if (i == 0) max_supported_bits else i;
// This is needed to support both Zig 0.7 and 0.8
const int_type_info =
if (@hasField(builtin.TypeInfo.Int, "signedness"))
.{ .signedness = .unsigned, .bits = i_use } else .{ .is_signed = false, .bits = i_use };
item.* = std.math.maxInt(@Type(builtin.TypeInfo{ .Int = int_type_info }));
}
break :blk mask_array;
};
const width_to_mask_slice = width_to_mask[0..];
return width_to_mask_slice[if (width > max_supported_bits) 0 else width];
} | src/svd.zig |
const std = @import("std");
const math = std.math;
const testing = std.testing;
const assert = std.debug.assert;
const cuda = @import("cudaz");
const cu = cuda.cu;
const png = @import("png.zig");
const utils = @import("utils.zig");
const resources_dir = "resources/hw4/";
const log = std.log.scoped(.HW4);
const log_level = std.log.Level.warn;
pub fn main() !void {
try hw4();
}
pub fn hw4() !void {
var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = general_purpose_allocator.allocator();
log.info("***** HW4 ******", .{});
const img = try png.Image.fromFilePath(allocator, resources_dir ++ "/red_eye_effect.png");
const num_rows = img.height;
const num_cols = img.width;
const template = try png.Image.fromFilePath(allocator, resources_dir ++ "/red_eye_effect_template.png");
const num_rows_template = template.height;
const num_cols_template = template.width;
defer img.deinit();
var stream = initStreamWithModule(0);
defer stream.deinit();
const d_img = try cuda.allocAndCopy(cu.uchar3, utils.asUchar3(img));
const d_template = try cuda.allocAndCopy(cu.uchar3, utils.asUchar3(template));
log.info("Loaded image: {}x{}", .{ num_rows, num_cols });
log.info("Loaded template: {}x{}", .{ num_rows_template, num_cols_template });
const d_scores = try cuda.alloc(f32, num_rows * num_cols);
try test_naive_normalized_cross_correlation(&stream, d_template, num_rows_template, num_cols_template);
// Create a 2D grid for the image and use the last dimension for the channel (R, G, B)
const gridWithChannel = cuda.Grid.init3D(num_cols, num_rows, 3, 32, 1, 3);
log.info("crossCorrelation({}, {},)", .{ gridWithChannel, gridWithChannel.sharedMem(f32, 1) });
try k.crossCorrelation.launchWithSharedMem(
&stream,
gridWithChannel,
gridWithChannel.sharedMem(f32, 1),
.{
d_scores.ptr,
d_img.ptr,
d_template.ptr,
@intCast(c_int, num_rows),
@intCast(c_int, num_cols),
@intCast(c_int, num_rows_template),
@intCast(c_int, @divFloor(num_rows_template, 2)),
@intCast(c_int, num_cols_template),
@intCast(c_int, @divFloor(num_cols_template, 2)),
@intCast(c_int, num_rows_template * num_cols_template),
},
);
const min_corr = try reduceMin(&stream, d_scores);
try k.addConstant.launch(
&stream,
cuda.Grid.init1D(d_scores.len, 32),
.{ d_scores.ptr, -min_corr, @intCast(c_uint, d_scores.len) },
);
log.info("min_corr = {}", .{min_corr});
debugDevice("crossCorrelation", d_scores[0..100]);
var timer = cuda.GpuTimer.start(&stream);
var d_permutation = try radixSortAlloc(&stream, bitCastU32(d_scores));
defer cuda.free(d_permutation);
timer.stop();
const d_perm_min = try reduce(&stream, k.minU32, d_permutation);
const d_perm_max = try reduce(&stream, k.maxU32, d_permutation);
log.info("Permutation ranges from {} to {} (expected 0 to {})", .{ d_perm_min, d_perm_max, d_permutation.len - 1 });
stream.synchronize();
std.log.info("Your code ran in: {d:.1} msecs.", .{timer.elapsed() * 1000});
var d_out = try cuda.alloc(cu.uchar3, d_img.len);
debugDevice("d_perm", d_permutation[20000..21000]);
try k.removeRedness.launch(&stream, cuda.Grid.init1D(d_img.len, 64), .{
d_permutation.ptr,
d_img.ptr,
d_out.ptr,
30,
@intCast(c_int, num_rows),
@intCast(c_int, num_cols),
9, // We use something smaller than the full template
9, // to only edit the pupil and not the rest of the eye
});
try cuda.memcpyDtoH(cu.uchar3, utils.asUchar3(img), d_out);
try img.writeToFilePath(resources_dir ++ "output.png");
try utils.validate_output(allocator, resources_dir, 0.1);
}
pub fn range(stream: *const cuda.Stream, len: usize) ![]u32 {
var coords = try cuda.alloc(c_uint, len);
try k.rangeFn.launch(stream, cuda.Grid.init1D(len, 64), .{ coords.ptr, @intCast(c_uint, len) });
return coords;
}
test "range" {
var stream = initStreamWithModule(0);
defer stream.deinit();
var numbers = try range(&stream, 5);
try expectEqualDeviceSlices(u32, &[_]u32{ 0, 1, 2, 3, 4 }, numbers);
}
pub fn reduceMin(stream: *const cuda.Stream, d_data: []const f32) !f32 {
return reduce(stream, k.min, d_data);
}
/// Finds the minimum value of the given input slice.
/// Do several passes until the minimum is found.
/// Each block computes the minimum over 1024 elements.
/// Each pass divides the size of the input array per 1024.
pub fn reduce(stream: *const cuda.Stream, operator: anytype, d_data: anytype) !std.meta.Elem(@TypeOf(d_data)) {
const n_threads = 1024;
const n1 = math.divCeil(usize, d_data.len, n_threads) catch unreachable;
var n2 = math.divCeil(usize, n1, n_threads) catch unreachable;
const DType = std.meta.Elem(@TypeOf(d_data));
const buffer = try cuda.alloc(DType, n1 + n2);
defer cuda.free(buffer);
var d_in = d_data;
var d_out = buffer[0..n1];
var d_next = buffer[n1 .. n1 + n2];
while (d_in.len > 1) {
try operator.launchWithSharedMem(
stream,
cuda.Grid.init1D(d_in.len, n_threads),
n_threads * @sizeOf(DType),
.{ d_in.ptr, d_out.ptr, @intCast(c_int, d_in.len) },
);
d_in = d_out;
d_out = d_next;
n2 = math.divCeil(usize, d_next.len, n_threads) catch unreachable;
d_next = d_out[0..n2];
}
return try cuda.readResult(DType, &d_in[0]);
}
test "reduce min" {
var stream = initStreamWithModule(0);
defer stream.deinit();
const h_x = try testing.allocator.alloc(f32, 2100);
defer testing.allocator.free(h_x);
std.mem.set(f32, h_x, 0.0);
h_x[987] = -5.0;
h_x[1024] = -6.0;
h_x[1479] = -7.0;
const d_x = try cuda.allocAndCopy(f32, h_x);
try testing.expectEqual(try reduceMin(&stream, d_x), -7.0);
}
test "reduce sum" {
var stream = initStreamWithModule(0);
defer stream.deinit();
const d1 = try cuda.allocAndCopy(u32, &[_]u32{ 1, 4, 8, 0, 1 });
try testing.expectEqual(@intCast(u32, 14), try reduce(&stream, k.sumU32, d1));
const h_x = try testing.allocator.alloc(u32, 2100);
defer testing.allocator.free(h_x);
std.mem.set(u32, h_x, 0.0);
h_x[987] = 5;
h_x[1024] = 6;
h_x[1479] = 7;
h_x[14] = 42;
const d_x = try cuda.allocAndCopy(u32, h_x);
try testing.expectEqual(@intCast(u32, 60), try reduce(&stream, k.sumU32, d_x));
}
pub fn sortNetwork(stream: *const cuda.Stream, d_data: []f32, n_threads: usize) !void {
const grid = cuda.Grid.init1D(d_data.len, n_threads);
try k.sortNet.launchWithSharedMem(
stream,
grid,
grid.threads.x * @sizeOf(f32),
.{ d_data.ptr, @intCast(c_uint, d_data.len) },
);
}
test "sorting network" {
var stream = initStreamWithModule(0);
defer stream.deinit();
const h_x = [_]f32{ 2, 3, 1, 0, 7, 9, 6, 5 };
var h_out = [_]f32{0} ** h_x.len;
const d_x = try cuda.alloc(f32, h_x.len);
defer cuda.free(d_x);
try cuda.memcpyHtoD(f32, d_x, &h_x);
try sortNetwork(&stream, d_x, 2);
try cuda.memcpyDtoH(f32, &h_out, d_x);
try testing.expectEqual([_]f32{ 2, 3, 0, 1, 7, 9, 5, 6 }, h_out);
try cuda.memcpyHtoD(f32, d_x, &h_x);
try sortNetwork(&stream, d_x, 4);
try cuda.memcpyDtoH(f32, &h_out, d_x);
try testing.expectEqual([_]f32{ 0, 1, 2, 3, 5, 6, 7, 9 }, h_out);
try cuda.memcpyHtoD(f32, d_x, &h_x);
try sortNetwork(&stream, d_x, 8);
try cuda.memcpyDtoH(f32, &h_out, d_x);
try testing.expectEqual([_]f32{ 0, 1, 2, 3, 5, 6, 7, 9 }, h_out);
try cuda.memcpyHtoD(f32, d_x, &h_x);
try sortNetwork(&stream, d_x, 16);
try cuda.memcpyDtoH(f32, &h_out, d_x);
try testing.expectEqual([_]f32{ 0, 1, 2, 3, 5, 6, 7, 9 }, h_out);
}
pub fn inPlaceCdf(stream: *const cuda.Stream, d_values: []u32, n_threads: u32) cuda.Error!void {
const n = d_values.len;
const grid_N = cuda.Grid.init1D(n, n_threads);
const n_blocks = grid_N.blocks.x;
var d_grid_bins = try cuda.alloc(u32, n_blocks);
defer cuda.free(d_grid_bins);
log.debug("cdf(n={}, n_threads={}, n_blocks={})", .{ n, n_threads, n_blocks });
var n_threads_pow_2 = n_threads;
while (n_threads_pow_2 > 1) {
std.debug.assert(n_threads_pow_2 % 2 == 0);
n_threads_pow_2 /= 2;
}
try k.cdfIncremental.launchWithSharedMem(
stream,
grid_N,
n_threads * @sizeOf(u32),
.{ d_values.ptr, d_grid_bins.ptr, @intCast(c_int, n) },
);
var d_cdf_min = try reduce(stream, k.minU32, d_values);
var d_cdf_max = try reduce(stream, k.maxU32, d_values);
log.info("Cdf ranges from {} to {}", .{ d_cdf_min, d_cdf_max });
if (n_blocks == 1) return;
// log.debug("cdf_shift({}, {})", .{ n, N });
try inPlaceCdf(stream, d_grid_bins, n_threads);
try k.cdfShift.launch(
stream,
grid_N,
.{ d_values.ptr, d_grid_bins.ptr, @intCast(c_int, n) },
);
d_cdf_min = try reduce(stream, k.minU32, d_values);
d_cdf_max = try reduce(stream, k.maxU32, d_values);
log.info("After shift cdf ranges from {} to {}", .{ d_cdf_min, d_cdf_max });
}
test "inPlaceCdf" {
var stream = initStreamWithModule(0);
defer stream.deinit();
const h_x = [_]u32{ 0, 2, 1, 1, 0, 1, 3, 0, 2 };
var h_out = [_]u32{0} ** h_x.len;
const h_cdf = [_]u32{ 0, 0, 2, 3, 4, 4, 5, 8, 8 };
const d_x = try cuda.alloc(u32, h_x.len);
defer cuda.free(d_x);
try cuda.memcpyHtoD(u32, d_x, &h_x);
try inPlaceCdf(&stream, d_x, 16);
try cuda.memcpyDtoH(u32, &h_out, d_x);
try testing.expectEqual(h_cdf, h_out);
try cuda.memcpyHtoD(u32, d_x, &h_x);
try inPlaceCdf(&stream, d_x, 8);
try cuda.memcpyDtoH(u32, &h_out, d_x);
try testing.expectEqual(h_cdf, h_out);
// Try with smaller batch sizes, forcing several passes
try cuda.memcpyHtoD(u32, d_x, &h_x);
try inPlaceCdf(&stream, d_x, 4);
try cuda.memcpyDtoH(u32, &h_out, d_x);
try testing.expectEqual(h_cdf, h_out);
try cuda.memcpyHtoD(u32, d_x, &h_x);
try inPlaceCdf(&stream, d_x, 2);
try expectEqualDeviceSlices(u32, &h_cdf, d_x);
}
pub fn radixSortAlloc(stream: *const cuda.Stream, d_values: []const u32) ![]u32 {
const n = d_values.len;
const mask: u8 = 0b1111;
const mask_bits: u8 = 8 - @clz(u8, mask);
const d_radix = try cuda.alloc(u32, n * (mask + 1));
defer cuda.free(d_radix);
var d_perm0 = try range(stream, n);
errdefer cuda.free(d_perm0);
var d_perm1 = try cuda.alloc(u32, n);
errdefer cuda.free(d_perm1);
// Unroll the loop at compile time.
comptime var shift: u8 = 0;
inline while (shift < 32) {
try _radixSort(stream, d_values, d_perm0, d_perm1, d_radix, shift, mask);
shift += mask_bits;
if (shift >= 32) {
cuda.free(d_perm0);
return d_perm1;
}
try _radixSort(stream, d_values, d_perm1, d_perm0, d_radix, shift, mask);
shift += mask_bits;
}
cuda.free(d_perm1);
return d_perm0;
}
fn _radixSort(
stream: *const cuda.Stream,
d_values: []const u32,
d_perm0: []const u32,
d_perm1: []u32,
d_radix: []u32,
shift: u8,
mask: u8,
) !void {
const n = d_values.len;
try cuda.memset(u32, d_radix, 0);
// debugDevice("d_values", d_values);
// debugDevice("d_perm0", d_perm0);
log.debug("radixSort(n={}, shift={}, mask={})", .{ n, shift, mask });
try k.findRadixSplitted.launch(
stream,
cuda.Grid.init1D(n, 1024),
.{ d_radix.ptr, d_values.ptr, d_perm0.ptr, shift, mask, @intCast(c_int, n) },
);
const radix_sum = try reduce(stream, k.sumU32, d_radix);
log.debug("Radix sums to {}, expected {}", .{ radix_sum, d_values.len });
std.debug.assert(radix_sum == d_values.len);
try inPlaceCdf(stream, d_radix, 1024);
// debugDevice("d_radix + cdf", d_radix);
try k.updatePermutation.launch(
stream,
cuda.Grid.init1D(n, 1024),
.{ d_perm1.ptr, d_radix.ptr, d_values.ptr, d_perm0.ptr, shift, mask, @intCast(c_int, n) },
);
// debugDevice("d_perm1", d_perm1);
}
test "findRadixSplitted" {
var stream = initStreamWithModule(0);
defer stream.deinit();
const h_x0 = [_]u32{ 0b10, 0b01, 0b00 };
const n = h_x0.len;
const d_values = try cuda.allocAndCopy(u32, &h_x0);
defer cuda.free(d_values);
const d_radix = try cuda.alloc(u32, 2 * n);
defer cuda.free(d_radix);
try cuda.memset(u32, d_radix, 0);
const d_perm0 = try range(&stream, n);
defer cuda.free(d_perm0);
try k.findRadixSplitted.launch(
&stream,
cuda.Grid.init1D(n, 1024),
.{ d_radix.ptr, d_values.ptr, d_perm0.ptr, 0, @intCast(c_uint, 0b1), @intCast(c_int, n) },
);
try expectEqualDeviceSlices(u32, &[_]u32{ 1, 0, 1, 0, 1, 0 }, d_radix);
try cuda.memset(u32, d_radix, 0);
try k.findRadixSplitted.launch(
&stream,
cuda.Grid.init1D(n, 1024),
.{ d_radix.ptr, d_values.ptr, d_perm0.ptr, 1, @intCast(c_uint, 0b1), @intCast(c_int, n) },
);
try expectEqualDeviceSlices(u32, &[_]u32{ 0, 1, 1, 1, 0, 0 }, d_radix);
try cuda.memcpyHtoD(u32, d_perm0, &[_]u32{ 0, 2, 1 });
// values: { 0b10, 0b01, 0b00 }; perm: {0, 2, 1}
try cuda.memset(u32, d_radix, 0);
try k.findRadixSplitted.launch(
&stream,
cuda.Grid.init1D(n, 1024),
.{ d_radix.ptr, d_values.ptr, d_perm0.ptr, 0, @intCast(c_uint, 0b1), @intCast(c_int, n) },
);
try expectEqualDeviceSlices(u32, &[_]u32{ 1, 1, 0, 0, 0, 1 }, d_radix);
try cuda.memset(u32, d_radix, 0);
try k.findRadixSplitted.launch(
&stream,
cuda.Grid.init1D(n, 1024),
.{ d_radix.ptr, d_values.ptr, d_perm0.ptr, 1, @intCast(c_uint, 0b1), @intCast(c_int, n) },
);
try expectEqualDeviceSlices(u32, &[_]u32{ 0, 1, 1, 1, 0, 0 }, d_radix);
}
test "_radixSort" {
var stream = initStreamWithModule(0);
defer stream.deinit();
testing.log_level = std.log.Level.debug;
defer testing.log_level = std.log.Level.warn;
const h_x0 = [_]u32{ 0b10, 0b01, 0b00 };
const n = h_x0.len;
const d_values = try cuda.allocAndCopy(u32, &h_x0);
defer cuda.free(d_values);
const d_radix = try cuda.alloc(u32, 2 * n);
defer cuda.free(d_radix);
const d_perm0 = try range(&stream, n);
defer cuda.free(d_perm0);
const d_perm1 = try range(&stream, n);
defer cuda.free(d_perm1);
try _radixSort(&stream, d_values, d_perm0, d_perm1, d_radix, 0, 0b1);
// d_radix before cdf = { 1, 0, 1, 0, 1, 0 }
try expectEqualDeviceSlices(u32, &[_]u32{ 0, 1, 1, 2, 2, 3 }, d_radix);
try expectEqualDeviceSlices(u32, &[_]u32{ 0, 2, 1 }, d_perm1);
try _radixSort(&stream, d_values, d_perm0, d_perm1, d_radix, 1, 0b1);
// d_radix before cdf = { 0, 1, 1, 1, 0, 0 }
try expectEqualDeviceSlices(u32, &[_]u32{ 0, 0, 1, 2, 3, 3 }, d_radix);
try expectEqualDeviceSlices(u32, &[_]u32{ 2, 0, 1 }, d_perm1);
try cuda.memcpyHtoD(u32, d_perm0, &[_]u32{ 0, 2, 1 });
try _radixSort(&stream, d_values, d_perm0, d_perm1, d_radix, 0, 0b1);
// d_radix before cdf = { 1, 1, 0, 0, 0, 1 }
try expectEqualDeviceSlices(u32, &[_]u32{ 0, 1, 2, 2, 2, 2 }, d_radix);
try expectEqualDeviceSlices(u32, &[_]u32{ 0, 2, 1 }, d_perm1);
try _radixSort(&stream, d_values, d_perm0, d_perm1, d_radix, 1, 0b1);
// d_radix before cdf = { 0, 1, 1, 1, 0, 0 }
try expectEqualDeviceSlices(u32, &[6]u32{ 0, 0, 1, 2, 3, 3 }, d_radix);
try expectEqualDeviceSlices(u32, &[_]u32{ 2, 1, 0 }, d_perm1);
}
test "updatePermutation" {
var stream = initStreamWithModule(0);
defer stream.deinit();
const h_x0 = [_]u32{ 0b1000, 0b0001 };
const n = h_x0.len;
const d_values = try cuda.allocAndCopy(u32, &h_x0);
defer cuda.free(d_values);
var d_radix = try cuda.allocAndCopy(u32, &[_]u32{ 0, 1, 1, 1, 2, 2, 2, 2 });
defer cuda.free(d_radix);
var d_perm0 = try range(&stream, n);
defer cuda.free(d_perm0);
const d_perm1 = try range(&stream, n);
defer cuda.free(d_perm1);
try k.updatePermutation.launch(
&stream,
cuda.Grid.init1D(n, 1024),
.{
d_perm1.ptr,
d_radix.ptr,
d_values.ptr,
d_perm0.ptr,
0,
@intCast(c_uint, 0b11),
@intCast(c_int, n),
},
);
}
test "radixSort" {
var stream = initStreamWithModule(0);
defer stream.deinit();
const h_x0 = [_]u32{ 2, 3, 1, 0, 6, 7, 5, 4 };
// h_x should be it's own permutation, since there is only consecutive integers
const expected = [_]u32{ 2, 3, 1, 0, 6, 7, 5, 4 };
const d_x = try cuda.allocAndCopy(u32, &h_x0);
defer cuda.free(d_x);
var d_perm0 = try radixSortAlloc(&stream, d_x);
defer cuda.free(d_perm0);
try expectEqualDeviceSlices(u32, &expected, d_perm0);
const h_x1 = [_]u32{ 1073741824, 1077936128, 1065353216, 0, 1088421888, 1091567616, 1086324736, 1084227584 };
try cuda.memcpyHtoD(u32, d_x, &h_x1);
var d_perm1 = try radixSortAlloc(&stream, d_x);
try expectEqualDeviceSlices(u32, &expected, d_perm1);
// With floats !
const h_x2 = [_]f32{ 2.0, 3.0, 1.0, 0.0, 6.0, 7.0, 5.0, 4.0 };
try cuda.memcpyHtoD(u32, d_x, bitCastU32(&h_x2));
var d_perm2 = try radixSortAlloc(&stream, d_x);
try expectEqualDeviceSlices(u32, &expected, d_perm2);
}
fn test_naive_normalized_cross_correlation(
stream: *const cuda.Stream,
d_template: []const cu.uchar3,
num_rows: usize,
num_cols: usize,
) !void {
try testing.expectEqual(num_rows, num_cols);
const half_height = @divFloor(num_rows, 2);
log.info("Loaded template: {}x{}", .{ num_rows, num_rows });
const d_scores = try cuda.alloc(f32, num_rows * num_rows);
defer cuda.free(d_scores);
const gridWithChannel = cuda.Grid.init3D(num_rows, num_rows, 3, 32, 1, 3);
// Auto cross-correlation
log.info("crossCorrelation({}, {},)", .{ gridWithChannel, gridWithChannel.sharedMem(f32, 1) });
try k.crossCorrelation.launchWithSharedMem(
stream,
gridWithChannel,
gridWithChannel.sharedMem(f32, 1),
.{
d_scores.ptr,
d_template.ptr,
d_template.ptr,
@intCast(c_int, num_rows),
@intCast(c_int, num_rows),
@intCast(c_int, num_rows),
@intCast(c_int, half_height),
@intCast(c_int, num_rows),
@intCast(c_int, half_height),
@intCast(c_int, num_rows * num_rows),
},
);
debugDevice("auto_corr", d_scores);
// Should be maximal at the center
const center_corr = try cuda.readResult(f32, &d_scores[num_rows * half_height + half_height]);
const max_corr = try reduce(stream, k.max, d_scores);
try testing.expectEqual(max_corr, center_corr);
}
fn bitCastU32(data: anytype) []const u32 {
return @ptrCast([*]const u32, data)[0..data.len];
}
fn expectEqualDeviceSlices(
comptime DType: type,
h_expected: []const DType,
d_values: []const DType,
) !void {
const allocator = std.testing.allocator;
const h_values = try cuda.allocAndCopyResult(DType, allocator, d_values);
defer allocator.free(h_values);
testing.expectEqualSlices(DType, h_expected, h_values) catch |err| {
log.err("Expected: {any}, got: {any}", .{ h_expected, h_values });
return err;
};
}
fn debugDevice(
name: []const u8,
d_values: anytype,
) void {
const DType = std.meta.Elem(@TypeOf(d_values));
var h = cuda.allocAndCopyResult(DType, testing.allocator, d_values) catch unreachable;
defer testing.allocator.free(h);
log.debug("{s} -> {any}", .{ name, h });
}
// TODO: generate this when the kernel is written in Zig.
const Kernels = struct {
addConstant: cuda.Function("add_constant"),
cdfIncremental: cuda.Function("cdf_incremental"),
cdfShift: cuda.Function("cdf_incremental_shift"),
crossCorrelation: cuda.Function("naive_normalized_cross_correlation"),
findRadixSplitted: cuda.Function("find_radix_splitted"),
rangeFn: cuda.Function("range"),
min: cuda.Function("reduce_min"),
max: cuda.Function("reduce_max"),
minU32: cuda.Function("reduce_min_u32"),
maxU32: cuda.Function("reduce_max_u32"),
removeRedness: cuda.Function("remove_redness"),
sortNet: cuda.Function("sort_network"),
sumU32: cuda.Function("reduce_sum_u32"),
updatePermutation: cuda.Function("update_permutation"),
};
var k: Kernels = undefined;
fn initStreamWithModule(device: u3) cuda.Stream {
const stream = cuda.Stream.init(device) catch unreachable;
// Panic if we can't load the module.
k = Kernels{
.addConstant = @TypeOf(k.addConstant).init() catch unreachable,
.cdfIncremental = @TypeOf(k.cdfIncremental).init() catch unreachable,
.cdfShift = @TypeOf(k.cdfShift).init() catch unreachable,
.crossCorrelation = @TypeOf(k.crossCorrelation).init() catch unreachable,
.findRadixSplitted = @TypeOf(k.findRadixSplitted).init() catch unreachable,
.rangeFn = @TypeOf(k.rangeFn).init() catch unreachable,
.min = @TypeOf(k.min).init() catch unreachable,
.max = @TypeOf(k.max).init() catch unreachable,
.minU32 = @TypeOf(k.minU32).init() catch unreachable,
.maxU32 = @TypeOf(k.maxU32).init() catch unreachable,
.removeRedness = @TypeOf(k.removeRedness).init() catch unreachable,
.sortNet = @TypeOf(k.sortNet).init() catch unreachable,
.sumU32 = @TypeOf(k.sumU32).init() catch unreachable,
.updatePermutation = @TypeOf(k.updatePermutation).init() catch unreachable,
};
return stream;
} | CS344/src/hw4.zig |
const std = @import("std");
const zap = @import("zap");
const hyperia = @import("hyperia");
const picohttp = @import("picohttp");
const Timer = hyperia.Timer;
const Reactor = hyperia.Reactor;
const SpinLock = hyperia.sync.SpinLock;
const AsyncSocket = hyperia.AsyncSocket;
const CircuitBreaker = hyperia.CircuitBreaker;
const AsyncWaitGroupAllocator = hyperia.AsyncWaitGroupAllocator;
const os = std.os;
const mem = std.mem;
const net = std.net;
const meta = std.meta;
const time = std.time;
const mpsc = hyperia.mpsc;
const mpmc = hyperia.mpmc;
const log = std.log.scoped(.client);
const assert = std.debug.assert;
usingnamespace hyperia.select;
pub const log_level = .debug;
const ConnectCircuitBreaker = CircuitBreaker(.{ .failure_threshold = 10, .reset_timeout = 1000 });
var stopped: bool = false;
var clock: time.Timer = undefined;
var reactor_event: Reactor.AutoResetEvent = undefined;
var timer: Timer = undefined;
pub const Frame = struct {
runnable: zap.Pool.Runnable = .{ .runFn = run },
frame: anyframe,
fn run(runnable: *zap.Pool.Runnable) void {
const self = @fieldParentPtr(Frame, "runnable", runnable);
resume self.frame;
}
pub fn yield() void {
var frame: Frame = .{ .frame = @frame() };
suspend hyperia.pool.schedule(.{}, &frame.runnable);
}
};
pub const Item = struct {
req: picohttp.Request,
body: []const u8 = &[_]u8{},
res: []const u8 = undefined,
event: mpsc.AsyncAutoResetEvent(void) = .{},
next: ?*Item = null,
};
pub const Client = struct {
pub const WriteQueue = mpmc.AsyncQueue(*Item, 4096);
pub const capacity = 4;
pub const Waiter = struct {
runnable: zap.Pool.Runnable = .{ .runFn = run },
frame: anyframe,
result: Connection.Error!void = undefined,
next: ?*Waiter = undefined,
pub fn run(runnable: *zap.Pool.Runnable) void {
const self = @fieldParentPtr(Waiter, "runnable", runnable);
resume self.frame;
}
};
pub const Connection = struct {
pub const Error = os.SocketError || AsyncSocket.ConnectError || os.EpollCtlError || os.SetSockOptError;
client: *Client,
socket: AsyncSocket,
connected: bool = false,
frame: @Frame(Connection.run),
pub fn deinit(self: *Connection) void {
self.client.wga.allocator.destroy(self);
}
pub fn run(self: *Connection) !void {
defer {
suspend self.deinit();
}
var num_attempts: usize = 0;
while (true) : (num_attempts += 1) {
Frame.yield();
if (self.client.connect_circuit.query(@intCast(usize, time.milliTimestamp())) == .open) {
assert(!self.client.reportConnectError(self, true, error.NetworkUnreachable));
return;
}
if (num_attempts > 0) {
log.info("{*} reconnection attempt {}", .{ self, num_attempts });
}
self.connect() catch |err| {
if (!self.client.reportConnectError(self, false, err)) {
return;
}
continue;
};
defer self.socket.deinit();
if (!self.client.reportConnected(self)) {
return;
}
num_attempts = 0;
var popper = self.client.queue.popper();
var read_frame = async self.readLoop();
var write_frame = async self.writeLoop(&popper);
_ = await read_frame;
hyperia.pool.schedule(.{}, popper.cancel());
_ = await write_frame;
if (self.client.reportDisconnected(self)) {
return;
}
}
}
fn readLoop(self: *Connection) !void {
defer log.info("{*} read loop ended", .{self});
var buf: [1024]u8 = undefined;
while (true) {
const num_bytes = try self.socket.read(&buf);
if (num_bytes == 0) return;
}
}
fn writeLoop(self: *Connection, popper: *WriteQueue.Popper) !void {
defer log.info("{*} write loop ended", .{self});
while (true) {
const item: *Item = popper.pop() orelse return;
// errdefer ...
const sender = self.socket.sender(os.MSG_NOSIGNAL);
try sender.print("{s} {s} HTTP/1.{d}\r\n", .{
item.req.method,
item.req.path,
item.req.minor_version,
});
for (item.req.headers) |header| {
if (header.isMultiline()) {
try sender.print(" {s}\r\n", .{header.value});
} else {
try sender.print("{s}: {s}\r\n", .{ header.name, header.value });
}
}
try sender.print("\r\n{s}", .{item.body});
Frame.yield();
}
}
fn connect(self: *Connection) Error!void {
self.socket = try AsyncSocket.init(os.AF_INET, os.SOCK_STREAM | os.SOCK_CLOEXEC, os.IPPROTO_TCP);
errdefer self.socket.deinit();
try self.socket.setNoDelay(true);
try self.client.reactor.add(self.socket.socket.fd, &self.socket.handle, Reactor.Interest{
.readable = true,
.writable = true,
});
try self.socket.connect(self.client.address);
}
};
lock: SpinLock = .{},
address: net.Address,
reactor: Reactor,
pool: [*]*Connection,
len: usize = 0,
queue: WriteQueue,
wga: AsyncWaitGroupAllocator,
waiters: ?*Waiter = null,
closed: bool = false,
connect_circuit: ConnectCircuitBreaker = ConnectCircuitBreaker.init(.half_open),
pub fn init(allocator: *mem.Allocator, reactor: Reactor, address: net.Address) !Client {
const pool = try allocator.create([capacity]*Connection);
errdefer allocator.destroy(pool);
const queue = try WriteQueue.init(allocator);
errdefer queue.deinit(allocator);
return Client{
.address = address,
.reactor = reactor,
.pool = pool,
.queue = queue,
.wga = .{ .backing_allocator = allocator },
};
}
pub fn deinit(self: *Client, allocator: *mem.Allocator) void {
self.wga.wait();
self.queue.deinit(allocator);
allocator.destroy(@ptrCast(*const [capacity]*Connection, self.pool));
}
pub fn close(self: *Client) void {
self.queue.close();
const held = self.lock.acquire();
defer held.release();
self.closed = true;
for (self.pool[0..self.len]) |conn| {
if (conn.connected) {
conn.socket.shutdown(.both) catch {};
log.info("{*} signalled to shutdown", .{conn});
}
}
}
pub fn request(self: *Client, req: picohttp.Request, body: []const u8) !void {
try self.ensureConnectionAvailable();
var item: Item = .{ .req = req, .body = body };
if (!self.queue.pusher().push(&item)) return error.Closed;
item.event.wait();
// TODO(kenta): parse response here
}
/// Lock must be held. Allocates a new connection and registers it
/// to this clients' pool of connections.
fn spawn(self: *Client) !*Connection {
const conn = try self.wga.allocator.create(Connection);
errdefer self.wga.allocator.destroy(conn);
conn.* = .{
.client = self,
.socket = undefined,
.frame = undefined,
};
self.pool[self.len] = conn;
self.len += 1;
log.info("{*} got spawned", .{conn});
return conn;
}
pub const PoolResult = union(enum) {
available: void,
spawned_pending: *Connection,
spawned_available: *Connection,
pending: void,
};
fn queryPool(self: *Client) !PoolResult {
if (self.len == 0) {
return PoolResult{ .spawned_pending = try self.spawn() };
}
const pool = self.pool[0..self.len];
const any_connected = for (pool) |conn| {
if (conn.connected) break true;
} else false;
if (self.queue.count() == 0 or pool.len == capacity) {
return if (any_connected) PoolResult.available else PoolResult.pending;
}
if (any_connected) {
return PoolResult{ .spawned_available = try self.spawn() };
}
return PoolResult{ .spawned_pending = try self.spawn() };
}
pub fn ensureConnectionAvailable(self: *Client) !void {
const held = self.lock.acquire();
if (self.closed) {
held.release();
return error.Closed;
}
const result = self.queryPool() catch |err| {
held.release();
return err;
};
if (result == .available) {
held.release();
return;
}
if (result == .spawned_available) {
held.release();
result.spawned_available.frame = async result.spawned_available.run();
return;
}
var waiter: Waiter = .{ .frame = @frame() };
suspend {
waiter.next = self.waiters;
self.waiters = &waiter;
held.release();
if (result == .spawned_pending) {
result.spawned_pending.frame = async result.spawned_pending.run();
}
}
return waiter.result;
}
/// Lock must be held, and connection must exist in the pool.
fn deregister(self: *Client, conn: *Connection) void {
const pool = self.pool[0..self.len];
const i = mem.indexOfScalar(*Connection, pool, conn) orelse unreachable;
log.info("connection {*} was released", .{conn});
if (i == self.len - 1) {
pool[i] = undefined;
self.len -= 1;
return;
}
pool[i] = pool[self.len - 1];
self.len -= 1;
}
fn reportConnected(self: *Client, conn: *Connection) bool {
log.info("{*} successfully connected", .{conn});
const batch = collected: {
var batch: zap.Pool.Batch = .{};
const held = self.lock.acquire();
defer held.release();
assert(!conn.connected);
if (self.closed) {
self.deregister(conn);
return false;
}
conn.connected = true;
self.connect_circuit.reportSuccess();
while (self.waiters) |waiter| : (self.waiters = waiter.next) {
waiter.result = {};
batch.push(&waiter.runnable);
}
break :collected batch;
};
hyperia.pool.schedule(.{}, batch);
return true;
}
fn reportConnectError(
self: *Client,
conn: *Connection,
unrecoverable: bool,
err: Connection.Error,
) bool {
const batch = collect: {
var batch: zap.Pool.Batch = .{};
const held = self.lock.acquire();
defer held.release();
assert(!conn.connected);
if (!unrecoverable) {
log.info("{*} got an error while connecting: {}", .{ conn, err });
}
self.connect_circuit.reportFailure(@intCast(usize, time.milliTimestamp()));
if (self.len > 1) {
self.deregister(conn);
return false;
}
if (unrecoverable) {
self.deregister(conn);
}
while (self.waiters) |waiter| : (self.waiters = waiter.next) {
waiter.result = err;
batch.push(&waiter.runnable);
}
break :collect batch;
};
hyperia.pool.schedule(.{}, batch);
return !unrecoverable;
}
fn reportDisconnected(self: *Client, conn: *Connection) bool {
const held = self.lock.acquire();
defer held.release();
assert(conn.connected);
conn.connected = false;
log.info("{*} disconnected", .{conn});
if (self.closed or self.len > 1) {
self.deregister(conn);
return true;
}
return false;
}
};
fn runBenchmark(client: *Client) !void {
defer log.info("done", .{});
var i: usize = 0;
while (true) : (i +%= 1) {
// await async client.write("message\n") catch |err| switch (err) {
// error.Closed => return,
// else => return err,
// };
if (i % 50 == 0) Frame.yield();
}
}
fn runApp(reactor: Reactor) !void {
defer {
@atomicStore(bool, &stopped, true, .Release);
reactor_event.post();
}
const address = net.Address.initIp4(.{ 0, 0, 0, 0 }, 9000);
var client = try Client.init(hyperia.allocator, reactor, address);
defer client.deinit(hyperia.allocator);
const Cases = struct {
benchmark: struct {
run: Case(runBenchmark),
cancel: Case(Client.close),
},
ctrl_c: struct {
run: Case(hyperia.ctrl_c.wait),
cancel: Case(hyperia.ctrl_c.cancel),
},
};
switch (select(
Cases{
.benchmark = .{
.run = call(runBenchmark, .{&client}),
.cancel = call(Client.close, .{&client}),
},
.ctrl_c = .{
.run = call(hyperia.ctrl_c.wait, .{}),
.cancel = call(hyperia.ctrl_c.cancel, .{}),
},
},
)) {
.benchmark => |result| return result,
.ctrl_c => return log.info("got ctrl+c", .{}),
}
}
pub fn main() !void {
hyperia.init();
defer hyperia.deinit();
hyperia.ctrl_c.init();
defer hyperia.ctrl_c.deinit();
clock = try time.Timer.start();
timer = Timer.init(hyperia.allocator);
defer timer.deinit(hyperia.allocator);
const reactor = try Reactor.init(os.EPOLL_CLOEXEC);
defer reactor.deinit();
reactor_event = try Reactor.AutoResetEvent.init(os.EFD_CLOEXEC, reactor);
defer reactor_event.deinit();
try reactor.add(reactor_event.fd, &reactor_event.handle, .{});
var frame = async runApp(reactor);
while (!@atomicLoad(bool, &stopped, .Acquire)) {
var batch: zap.Pool.Batch = .{};
defer hyperia.pool.schedule(.{}, batch);
try reactor.poll(128, struct {
batch: *zap.Pool.Batch,
pub fn call(self: @This(), event: Reactor.Event) void {
const handle = @intToPtr(*Reactor.Handle, event.data);
handle.call(self.batch, event);
}
}{ .batch = &batch }, if (timer.delay(clock.read())) |delay| @intCast(u64, delay) else null);
timer.update(clock.read(), struct {
batch: *zap.Pool.Batch,
pub fn call(self: @This(), handle: *Timer.Handle) void {
self.batch.push(handle.set());
}
}{ .batch = &batch });
}
try nosuspend await frame;
log.info("good bye!", .{});
} | example_http_client.zig |
pub const ID_DOCUMENTPACKAGETARGET_MSXPS = Guid.initString("9cae40a8-ded1-41c9-a9fd-d735ef33aeda");
pub const ID_DOCUMENTPACKAGETARGET_OPENXPS = Guid.initString("0056bb72-8c9c-4612-bd0f-93012a87099d");
pub const ID_DOCUMENTPACKAGETARGET_OPENXPS_WITH_3D = Guid.initString("63dbd720-8b14-4577-b074-7bb11b596d28");
//--------------------------------------------------------------------------------
// Section: Types (11)
//--------------------------------------------------------------------------------
pub const XPS_JOB_COMPLETION = enum(i32) {
IN_PROGRESS = 0,
COMPLETED = 1,
CANCELLED = 2,
FAILED = 3,
};
pub const XPS_JOB_IN_PROGRESS = XPS_JOB_COMPLETION.IN_PROGRESS;
pub const XPS_JOB_COMPLETED = XPS_JOB_COMPLETION.COMPLETED;
pub const XPS_JOB_CANCELLED = XPS_JOB_COMPLETION.CANCELLED;
pub const XPS_JOB_FAILED = XPS_JOB_COMPLETION.FAILED;
pub const XPS_JOB_STATUS = extern struct {
jobId: u32,
currentDocument: i32,
currentPage: i32,
currentPageTotal: i32,
completion: XPS_JOB_COMPLETION,
jobStatus: HRESULT,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_IXpsPrintJobStream_Value = @import("../../zig.zig").Guid.initString("7a77dc5f-45d6-4dff-9307-d8cb846347ca");
pub const IID_IXpsPrintJobStream = &IID_IXpsPrintJobStream_Value;
pub const IXpsPrintJobStream = extern struct {
pub const VTable = extern struct {
base: ISequentialStream.VTable,
Close: fn(
self: *const IXpsPrintJobStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISequentialStream.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IXpsPrintJobStream_Close(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IXpsPrintJobStream.VTable, self.vtable).Close(@ptrCast(*const IXpsPrintJobStream, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_IXpsPrintJob_Value = @import("../../zig.zig").Guid.initString("5ab89b06-8194-425f-ab3b-d7a96e350161");
pub const IID_IXpsPrintJob = &IID_IXpsPrintJob_Value;
pub const IXpsPrintJob = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Cancel: fn(
self: *const IXpsPrintJob,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetJobStatus: fn(
self: *const IXpsPrintJob,
jobStatus: ?*XPS_JOB_STATUS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IXpsPrintJob_Cancel(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IXpsPrintJob.VTable, self.vtable).Cancel(@ptrCast(*const IXpsPrintJob, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IXpsPrintJob_GetJobStatus(self: *const T, jobStatus: ?*XPS_JOB_STATUS) callconv(.Inline) HRESULT {
return @ptrCast(*const IXpsPrintJob.VTable, self.vtable).GetJobStatus(@ptrCast(*const IXpsPrintJob, self), jobStatus);
}
};}
pub usingnamespace MethodMixin(@This());
};
const CLSID_PrintDocumentPackageTarget_Value = @import("../../zig.zig").Guid.initString("4842669e-9947-46ea-8ba2-d8cce432c2ca");
pub const CLSID_PrintDocumentPackageTarget = &CLSID_PrintDocumentPackageTarget_Value;
const CLSID_PrintDocumentPackageTargetFactory_Value = @import("../../zig.zig").Guid.initString("348ef17d-6c81-4982-92b4-ee188a43867a");
pub const CLSID_PrintDocumentPackageTargetFactory = &CLSID_PrintDocumentPackageTargetFactory_Value;
// TODO: this type is limited to platform 'windows8.0'
const IID_IPrintDocumentPackageTarget_Value = @import("../../zig.zig").Guid.initString("1b8efec4-3019-4c27-964e-367202156906");
pub const IID_IPrintDocumentPackageTarget = &IID_IPrintDocumentPackageTarget_Value;
pub const IPrintDocumentPackageTarget = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetPackageTargetTypes: fn(
self: *const IPrintDocumentPackageTarget,
targetCount: ?*u32,
targetTypes: [*]?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPackageTarget: fn(
self: *const IPrintDocumentPackageTarget,
guidTargetType: ?*const Guid,
riid: ?*const Guid,
ppvTarget: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Cancel: fn(
self: *const IPrintDocumentPackageTarget,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPrintDocumentPackageTarget_GetPackageTargetTypes(self: *const T, targetCount: ?*u32, targetTypes: [*]?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IPrintDocumentPackageTarget.VTable, self.vtable).GetPackageTargetTypes(@ptrCast(*const IPrintDocumentPackageTarget, self), targetCount, targetTypes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPrintDocumentPackageTarget_GetPackageTarget(self: *const T, guidTargetType: ?*const Guid, riid: ?*const Guid, ppvTarget: ?*?*c_void) callconv(.Inline) HRESULT {
return @ptrCast(*const IPrintDocumentPackageTarget.VTable, self.vtable).GetPackageTarget(@ptrCast(*const IPrintDocumentPackageTarget, self), guidTargetType, riid, ppvTarget);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPrintDocumentPackageTarget_Cancel(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IPrintDocumentPackageTarget.VTable, self.vtable).Cancel(@ptrCast(*const IPrintDocumentPackageTarget, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const PrintDocumentPackageCompletion = enum(i32) {
InProgress = 0,
Completed = 1,
Canceled = 2,
Failed = 3,
};
pub const PrintDocumentPackageCompletion_InProgress = PrintDocumentPackageCompletion.InProgress;
pub const PrintDocumentPackageCompletion_Completed = PrintDocumentPackageCompletion.Completed;
pub const PrintDocumentPackageCompletion_Canceled = PrintDocumentPackageCompletion.Canceled;
pub const PrintDocumentPackageCompletion_Failed = PrintDocumentPackageCompletion.Failed;
pub const PrintDocumentPackageStatus = extern struct {
JobId: u32,
CurrentDocument: i32,
CurrentPage: i32,
CurrentPageTotal: i32,
Completion: PrintDocumentPackageCompletion,
PackageStatus: HRESULT,
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IPrintDocumentPackageStatusEvent_Value = @import("../../zig.zig").Guid.initString("ed90c8ad-5c34-4d05-a1ec-0e8a9b3ad7af");
pub const IID_IPrintDocumentPackageStatusEvent = &IID_IPrintDocumentPackageStatusEvent_Value;
pub const IPrintDocumentPackageStatusEvent = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
PackageStatusUpdated: fn(
self: *const IPrintDocumentPackageStatusEvent,
packageStatus: ?*PrintDocumentPackageStatus,
) 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 IPrintDocumentPackageStatusEvent_PackageStatusUpdated(self: *const T, packageStatus: ?*PrintDocumentPackageStatus) callconv(.Inline) HRESULT {
return @ptrCast(*const IPrintDocumentPackageStatusEvent.VTable, self.vtable).PackageStatusUpdated(@ptrCast(*const IPrintDocumentPackageStatusEvent, self), packageStatus);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IPrintDocumentPackageTargetFactory_Value = @import("../../zig.zig").Guid.initString("d2959bf7-b31b-4a3d-9600-712eb1335ba4");
pub const IID_IPrintDocumentPackageTargetFactory = &IID_IPrintDocumentPackageTargetFactory_Value;
pub const IPrintDocumentPackageTargetFactory = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateDocumentPackageTargetForPrintJob: fn(
self: *const IPrintDocumentPackageTargetFactory,
printerName: ?[*:0]const u16,
jobName: ?[*:0]const u16,
jobOutputStream: ?*IStream,
jobPrintTicketStream: ?*IStream,
docPackageTarget: ?*?*IPrintDocumentPackageTarget,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPrintDocumentPackageTargetFactory_CreateDocumentPackageTargetForPrintJob(self: *const T, printerName: ?[*:0]const u16, jobName: ?[*:0]const u16, jobOutputStream: ?*IStream, jobPrintTicketStream: ?*IStream, docPackageTarget: ?*?*IPrintDocumentPackageTarget) callconv(.Inline) HRESULT {
return @ptrCast(*const IPrintDocumentPackageTargetFactory.VTable, self.vtable).CreateDocumentPackageTargetForPrintJob(@ptrCast(*const IPrintDocumentPackageTargetFactory, self), printerName, jobName, jobOutputStream, jobPrintTicketStream, docPackageTarget);
}
};}
pub usingnamespace MethodMixin(@This());
};
//--------------------------------------------------------------------------------
// Section: Functions (2)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows6.1'
pub extern "XPSPRINT" fn StartXpsPrintJob(
printerName: ?[*:0]const u16,
jobName: ?[*:0]const u16,
outputFileName: ?[*:0]const u16,
progressEvent: ?HANDLE,
completionEvent: ?HANDLE,
printablePagesOn: [*:0]u8,
printablePagesOnCount: u32,
xpsPrintJob: ?*?*IXpsPrintJob,
documentStream: ?*?*IXpsPrintJobStream,
printTicketStream: ?*?*IXpsPrintJobStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows6.1'
pub extern "XPSPRINT" fn StartXpsPrintJob1(
printerName: ?[*:0]const u16,
jobName: ?[*:0]const u16,
outputFileName: ?[*:0]const u16,
progressEvent: ?HANDLE,
completionEvent: ?HANDLE,
xpsPrintJob: ?*?*IXpsPrintJob,
printContentReceiver: ?*?*IXpsOMPackageTarget,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (0)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../../zig.zig").unicode_mode) {
.ansi => struct {
},
.wide => struct {
},
.unspecified => if (@import("builtin").is_test) struct {
} else struct {
},
};
//--------------------------------------------------------------------------------
// Section: Imports (9)
//--------------------------------------------------------------------------------
const Guid = @import("../../zig.zig").Guid;
const HANDLE = @import("../../foundation.zig").HANDLE;
const HRESULT = @import("../../foundation.zig").HRESULT;
const IDispatch = @import("../../system/ole_automation.zig").IDispatch;
const ISequentialStream = @import("../../storage/structured_storage.zig").ISequentialStream;
const IStream = @import("../../storage/structured_storage.zig").IStream;
const IUnknown = @import("../../system/com.zig").IUnknown;
const IXpsOMPackageTarget = @import("../../storage/xps.zig").IXpsOMPackageTarget;
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;
}
}
} | deps/zigwin32/win32/storage/xps/printing.zig |
const std = @import("std");
const assert = std.debug.assert;
pub const Cancellation = error{
GeneratorCancelled,
};
pub const State = enum { Initialized, Started, Error, Returned, Cancelled };
/// Generator handle, to be used in Handle's Ctx type
///
/// `T` is the type that the generator yields
/// `Return` is generator's return type
pub fn Handle(comptime T: type) type {
return struct {
const Self = @This();
const HandleState = enum { Working, Yielded, Cancel };
const Suspension = enum(u8) { Unsuspended, Suspended, Yielded };
frame: *@Frame(yield) = undefined,
gen_frame: anyframe = undefined,
gen_frame_suspended: std.atomic.Atomic(Suspension) = std.atomic.Atomic(Suspension).init(.Unsuspended),
state: union(HandleState) {
Working: void,
Yielded: T,
Cancel: void,
} = .Working,
/// Yields a value
pub fn yield(self: *Self, t: T) error{GeneratorCancelled}!void {
if (self.state == .Cancel) return error.GeneratorCancelled;
suspend {
self.state = .{ .Yielded = t };
self.frame = @frame();
if (self.gen_frame_suspended.swap(.Yielded, .SeqCst) == .Suspended) {
resume self.gen_frame;
}
}
if (self.state == .Cancel) return error.GeneratorCancelled;
self.state = .Working;
}
};
}
/// Generator type allows an async function to yield multiple
/// values, and return an error or a result.
///
/// Ctx type must be a struct and it must have the following function:
///
/// * `generate(self: *@This(), handle: *generator.Handle(T)) !Return`
///
/// where `T` is the type of value yielded by the generator and `Return` is
/// the type of the return value.
///
/// NOTE: In many cases it may be advisable to have `T` be a pointer to a type,
/// particularly if the the yielded type is larger than a machine word.
/// This will eliminate the unnecessary copying of the value and may have a positive
/// impact on performance.
/// This is also a critical consideration if the generator needs to be able to
/// observe changes that occurred to the value during suspension.
pub fn Generator(comptime Ctx: type, comptime T: type) type {
const ty = @typeInfo(Ctx);
comptime {
assert(ty == .Struct);
assert(@hasDecl(Ctx, "generate"));
}
const generate_fn = Ctx.generate;
const generate_fn_info = @typeInfo(@TypeOf(generate_fn));
assert(generate_fn_info == .Fn);
assert(generate_fn_info.Fn.args.len == 2);
const arg1_tinfo = @typeInfo(generate_fn_info.Fn.args[0].arg_type.?);
const arg2_tinfo = @typeInfo(generate_fn_info.Fn.args[1].arg_type.?);
const ret_tinfo = @typeInfo(generate_fn_info.Fn.return_type.?);
// context
assert(arg1_tinfo == .Pointer);
assert(arg1_tinfo.Pointer.child == Ctx);
// Handle
assert(arg2_tinfo == .Pointer);
assert(arg2_tinfo.Pointer.child == Handle(T));
assert(ret_tinfo == .ErrorUnion);
return struct {
const Self = @This();
const Err = ret_tinfo.ErrorUnion.error_set;
const CompleteErrorSet = Err || Cancellation;
pub const Return = ret_tinfo.ErrorUnion.payload;
pub const Context = Ctx;
pub const GeneratorState = union(State) {
Initialized: void,
Started: void,
Error: Err,
Returned: Return,
Cancelled: void,
};
handle: Handle(T) = Handle(T){},
/// Generator's state
///
/// * `.Initialized` -- it hasn't been started yet
/// * `.Started` -- it has been started
/// * `.Returned` -- it has returned a value
/// * `.Error` -- it has returned an error
/// * `.Cancelled` -- it has been cancelled
state: GeneratorState = .Initialized,
/// Generator's own structure
context: Context,
generator_frame: @Frame(generator) = undefined,
/// Initializes a generator
pub fn init(ctx: Ctx) Self {
return Self{
.context = ctx,
};
}
fn generator(self: *Self) void {
if (generate_fn(&self.context, &self.handle)) |val| {
self.state = .{ .Returned = val };
} else |err| {
switch (err) {
error.GeneratorCancelled => {
self.state = .Cancelled;
},
else => |e| {
self.state = .{ .Error = e };
},
}
}
if (self.handle.gen_frame_suspended.swap(.Unsuspended, .SeqCst) == .Suspended) {
resume self.handle.gen_frame;
}
suspend {}
unreachable;
}
/// Returns the next yielded value, or `null` if the generator returned or was cancelled.
/// `next()` propagates errors returned by the generator function.
///
/// .state.Returned union variant can be used to retrieve the return value of the generator
/// .state.Cancelled indicates that the generator was cancelled
/// .state.Error union variant can be used to retrieve the error
///
pub fn next(self: *Self) Err!?T {
switch (self.state) {
.Initialized => {
self.state = .Started;
self.handle.gen_frame = @frame();
self.generator_frame = async self.generator();
},
.Started => {
resume self.handle.frame;
},
else => return null,
}
while (self.state == .Started and self.handle.state == .Working) {
suspend {
if (self.handle.gen_frame_suspended.swap(.Suspended, .SeqCst) == .Yielded) {
resume @frame();
}
}
}
self.handle.gen_frame_suspended.store(.Unsuspended, .SeqCst);
switch (self.state) {
.Started => {
return self.handle.state.Yielded;
},
.Error => |e| return e,
else => return null,
}
}
/// Drains the generator until it is done
pub fn drain(self: *Self) !void {
while (try self.next()) |_| {}
}
/// Cancels the generator
///
/// It won't yield any more values and will run its deferred code.
///
/// However, it may still continue working until it attempts to yield.
/// This is possible if the generator is an async function using other async functions.
///
/// NOTE that the generator must cooperate (or at least, not get in the way) with its cancellation.
/// An uncooperative generator can catch `GeneratorCancelled` error and refuse to be terminated.
/// In such case, the generator will be effectively drained upon an attempt to cancel it.
pub fn cancel(self: *Self) void {
self.handle.state = .Cancel;
}
};
}
test "basic generator" {
const expect = std.testing.expect;
const ty = struct {
pub fn generate(_: *@This(), handle: *Handle(u8)) !void {
try handle.yield(0);
try handle.yield(1);
try handle.yield(2);
}
};
const G = Generator(ty, u8);
var g = G.init(ty{});
try expect((try g.next()).? == 0);
try expect((try g.next()).? == 1);
try expect((try g.next()).? == 2);
try expect((try g.next()) == null);
try expect(g.state == .Returned);
try expect((try g.next()) == null);
}
test "generator with async i/o" {
const expect = std.testing.expect;
const ty = struct {
pub fn generate(_: *@This(), handle: *Handle(u8)) !void {
const file = try std.fs.cwd()
.openFile("README.md", std.fs.File.OpenFlags{ .read = true, .write = false });
const reader = file.reader();
while (true) {
const byte = reader.readByte() catch return;
try handle.yield(byte);
}
}
};
const G = Generator(ty, u8);
var g = G.init(ty{});
var bytes: usize = 0;
while (try g.next()) |_| {
bytes += 1;
}
try expect(bytes > 0);
}
test "generator with async await" {
const expect = std.testing.expect;
const ty = struct {
fn doAsync() callconv(.Async) u8 {
suspend {
resume @frame();
}
return 1;
}
pub fn generate(_: *@This(), handle: *Handle(u8)) !void {
try handle.yield(await async doAsync());
}
};
const G = Generator(ty, u8);
var g = G.init(ty{});
try expect((try g.next()).? == 1);
}
test "context" {
const expect = std.testing.expect;
const ty = struct {
a: u8 = 1,
pub fn generate(_: *@This(), handle: *Handle(u8)) !void {
try handle.yield(0);
try handle.yield(1);
try handle.yield(2);
}
};
const G = Generator(ty, u8);
var g = G.init(ty{});
try expect(g.context.a == 1);
}
test "errors in generators" {
const expect = std.testing.expect;
const ty = struct {
pub fn generate(_: *@This(), handle: *Handle(u8)) !void {
try handle.yield(0);
try handle.yield(1);
return error.SomeError;
}
};
const G = Generator(ty, u8);
var g = G.init(ty{});
try expect((try g.next()).? == 0);
try expect((try g.next()).? == 1);
_ = g.next() catch |err| {
try expect(g.state == .Error);
try expect((try g.next()) == null);
switch (err) {
error.SomeError => {
return;
},
else => {
@panic("incorrect error has been captured");
},
}
return;
};
@panic("error should have been generated");
}
test "return value in generator" {
const expect = std.testing.expect;
const ty = struct {
complete: bool = false,
pub fn generate(self: *@This(), handle: *Handle(u8)) !u8 {
defer {
self.complete = true;
}
try handle.yield(0);
try handle.yield(1);
try handle.yield(2);
return 3;
}
};
const G = Generator(ty, u8);
var g = G.init(ty{});
try expect((try g.next()).? == 0);
try expect((try g.next()).? == 1);
try expect((try g.next()).? == 2);
try expect((try g.next()) == null);
try expect(g.state == .Returned);
try expect(g.state.Returned == 3);
try expect(g.context.complete);
}
test "drain" {
const expect = std.testing.expect;
const ty = struct {
pub fn generate(_: *@This(), handle: *Handle(u8)) !u8 {
try handle.yield(0);
try handle.yield(1);
try handle.yield(2);
return 3;
}
};
const G = Generator(ty, u8);
var g = G.init(ty{});
try g.drain();
try expect(g.state.Returned == 3);
}
test "cancel" {
const expect = std.testing.expect;
const ty = struct {
drained: bool = false,
cancelled: bool = false,
pub fn generate(self: *@This(), handle: *Handle(u8)) !u8 {
errdefer |e| {
if (e == error.GeneratorCancelled) {
self.cancelled = true;
}
}
try handle.yield(0);
try handle.yield(1);
try handle.yield(2);
self.drained = true;
return 3;
}
};
const G = Generator(ty, u8);
// cancel before yielding
var g = G.init(ty{});
g.cancel();
try expect((try g.next()) == null);
try expect(g.state == .Cancelled);
try expect(!g.context.drained);
try expect(g.context.cancelled);
// cancel after yielding
g = G.init(ty{});
try expect((try g.next()).? == 0);
g.cancel();
try expect((try g.next()) == null);
try expect(g.state == .Cancelled);
try expect(!g.context.drained);
try expect(g.context.cancelled);
}
test "uncooperative cancellation" {
const expect = std.testing.expect;
const ty = struct {
drained: bool = false,
ignored_termination_0: bool = false,
ignored_termination_1: bool = false,
pub fn generate(self: *@This(), handle: *Handle(u8)) !void {
handle.yield(0) catch {
self.ignored_termination_0 = true;
};
handle.yield(1) catch {
self.ignored_termination_1 = true;
};
self.drained = true;
}
};
const G = Generator(ty, u8);
// Cancel before yielding
var g = G.init(ty{});
g.cancel();
try expect((try g.next()) == null);
try expect(g.state == .Returned);
try expect(g.context.drained);
try expect(g.context.ignored_termination_0);
try expect(g.context.ignored_termination_1);
// Cancel after yielding
g = G.init(ty{});
try expect((try g.next()).? == 0);
g.cancel();
try expect((try g.next()) == null);
try expect(g.state == .Returned);
try expect(g.context.drained);
try expect(g.context.ignored_termination_0);
try expect(g.context.ignored_termination_1);
} | src/generator.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");
const network = @import("net_blocking_network.zig");
// Simple TCP echo server:
// Accepts a single incoming connection and will echo any received data back to the
// client. Increasing the buffer size might improve throughput.
// using 1000 here yields roughly 54 MBit/s
// using 100_00 yields 150 MB/s
const buffer_size = 1000;
pub fn main() !void {
try network.init();
defer network.deinit();
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = &gpa.allocator;
var args_iter = std.process.args();
const exe_name = try (args_iter.next(allocator) orelse return error.MissingArgument);
defer allocator.free(exe_name);
const port_name = try (args_iter.next(allocator) orelse return error.MissingArgument);
defer allocator.free(port_name);
const port_number = try std.fmt.parseInt(u16, port_name, 10);
var sock = try network.Socket.create(.ipv4, .tcp);
defer sock.close();
try sock.enablePortReuse(true);
try sock.bindToPort(port_number);
try sock.listen();
while (true) {
var client = try sock.accept();
defer client.close();
std.debug.print("Client connected from {}.\n", .{
try client.getLocalEndPoint(),
});
runEchoClient(client) catch |err| {
std.debug.print("Client disconnected with msg {}.\n", .{
@errorName(err),
});
continue;
};
std.debug.print("Client disconnected.\n", .{});
}
}
fn runEchoClient(client: network.Socket) !void {
while (true) {
var buffer: [buffer_size]u8 = undefined;
const len = try client.receive(&buffer);
if (len == 0)
break;
// we ignore the amount of data sent.
_ = try client.send(buffer[0..len]);
}
} | demos/io_uring/net_blocking.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const testing = std.testing;
const assert = std.debug.assert;
const mustache = @import("mustache.zig");
const TemplateOptions = mustache.options.TemplateOptions;
const TemplateSource = mustache.options.TemplateSource;
const TemplateLoadMode = mustache.options.TemplateLoadMode;
const Features = mustache.options.Features;
const parsing = @import("parsing/parsing.zig");
pub const Delimiters = parsing.Delimiters;
pub const ParseError = error{
UnexpectedEof,
UnexpectedCloseSection,
InvalidDelimiters,
InvalidIdentifier,
ClosingTagMismatch,
};
pub const ParseErrorDetail = struct {
parse_error: ParseError,
lin: u32 = 0,
col: u32 = 0,
};
pub const ParseResult = union(enum) {
parse_error: ParseErrorDetail,
success: Template,
};
pub const Element = union(Element.Type) {
static_text: []const u8,
interpolation: Path,
unescaped_interpolation: Path,
section: Section,
inverted_section: InvertedSection,
partial: Partial,
parent: Parent,
block: Block,
pub const Path = []const []const u8;
pub const Type = enum {
/// Static text
static_text,
/// Interpolation tags are used to integrate dynamic content into the template.
///
/// The tag's content MUST be a non-whitespace character sequence NOT containing
/// the current closing delimiter.
///
/// This tag's content names the data to replace the tag.
/// A single period (`.`) indicates that the item currently sitting atop the context stack should be
/// used; otherwise, name resolution is as follows:
///
/// 1) Split the name on periods; the first part is the name to resolve, any
/// remaining parts should be retained.
///
/// 2) Walk the context stack from top to bottom, finding the first context
/// that is a) a hash containing the name as a key OR b) an object responding
/// to a method with the given name.
///
/// 3) If the context is a hash, the data is the value associated with the
/// name.
///
/// 4) If the context is an object, the data is the value returned by the
/// method with the given name.
///
/// 5) If any name parts were retained in step 1, each should be resolved
/// against a context stack containing only the result from the former
/// resolution. If any part fails resolution, the result should be considered
/// falsey, and should interpolate as the empty string.
///
/// Data should be coerced into a string (and escaped, if appropriate) before
/// interpolation.
///
/// The Interpolation tags MUST NOT be treated as standalone.
interpolation,
unescaped_interpolation,
/// Section tags and End Section tags are used in combination to wrap a section
/// of the template for iteration
///
/// These tags' content MUST be a non-whitespace character sequence NOT
/// containing the current closing delimiter; each Section tag MUST be followed
/// by an End Section tag with the same content within the same section.
///
/// This tag's content names the data to replace the tag.
/// Name resolution is as follows:
///
/// 1) Split the name on periods; the first part is the name to resolve, any
/// remaining parts should be retained.
///
/// 2) Walk the context stack from top to bottom, finding the first context
/// that is a) a hash containing the name as a key OR b) an object responding
/// to a method with the given name.
///
/// 3) If the context is a hash, the data is the value associated with the
/// name.
///
/// 4) If the context is an object and the method with the given name has an
/// arity of 1, the method SHOULD be called with a String containing the
/// unprocessed contents of the sections; the data is the value returned.
///
/// 5) Otherwise, the data is the value returned by calling the method with
/// the given name.
///
/// 6) If any name parts were retained in step 1, each should be resolved
/// against a context stack containing only the result from the former
/// resolution. If any part fails resolution, the result should be considered
/// falsey, and should interpolate as the empty string.
///
/// If the data is not of a list type, it is coerced into a list as follows: if
/// the data is truthy (e.g. `!!data == true`), use a single-element list
/// containing the data, otherwise use an empty list.
///
/// For each element in the data list, the element MUST be pushed onto the
/// context stack, the section MUST be rendered, and the element MUST be popped
/// off the context stack.
///
/// Section and End Section tags SHOULD be treated as standalone when appropriate.
section,
inverted_section,
/// Partial tags are used to expand an external template into the current
/// template.
///
/// The tag's content MUST be a non-whitespace character sequence NOT containing
/// the current closing delimiter.
///
/// This tag's content names the partial to inject. Set Delimiter tags MUST NOT
/// affect the parsing of a partial.
/// The partial MUST be rendered against the context stack local to the tag.
/// If the named partial cannot be found, the empty string SHOULD be used instead, as in interpolations.
///
/// Partial tags SHOULD be treated as standalone when appropriate.
/// If this tag is used standalone, any whitespace preceding the tag should treated as
/// indentation, and prepended to each line of the partial before rendering.
partial,
/// Like partials, Parent tags are used to expand an external template into the
/// current template. Unlike partials, Parent tags may contain optional
/// arguments delimited by Block tags. For this reason, Parent tags may also be
/// referred to as Parametric Partials.
///
/// The Parent tags' content MUST be a non-whitespace character sequence NOT
/// containing the current closing delimiter; each Parent tag MUST be followed by
/// an End Section tag with the same content within the matching Parent tag.
///
/// This tag's content names the Parent template to inject.
/// Set Delimiter tags Preceding a Parent tag MUST NOT affect the parsing of the injected external
/// template. The Parent MUST be rendered against the context stack local to the tag.
///
/// If the named Parent cannot be found, the empty string SHOULD be used instead, as in interpolations.
///
/// Parent tags SHOULD be treated as standalone when appropriate.
/// If this tag is used standalone, any whitespace preceding the tag should be treated as
/// indentation, and prepended to each line of the Parent before rendering.
parent,
/// The Block tags' content MUST be a non-whitespace character sequence NOT
/// containing the current closing delimiter.
///
/// Each Block tag MUST be followed by an End Section tag with the same content within the matching Block tag.
/// This tag's content determines the parameter or argument name.
///
/// Block tags may appear both inside and outside of Parent tags. In both cases,
/// they specify a position within the template that can be overridden; it is a
/// parameter of the containing template.
///
/// The template text between the Block tag and its matching End Section tag
/// defines the default content to render when the parameter is not overridden from outside.
///
/// In addition, when used inside of a Parent tag,
/// the template text between a Block tag and its matching End Section tag defines
/// content that replaces the default defined in the Parent template.
///
/// This content is the argument passed to the Parent template.
block,
};
pub const Section = struct {
path: Path,
children_count: u32,
inner_text: ?[]const u8,
delimiters: ?Delimiters,
};
pub const InvertedSection = struct {
path: Path,
children_count: u32,
};
pub const Partial = struct {
key: []const u8,
indentation: ?[]const u8,
};
pub const Parent = struct {
key: []const u8,
children_count: u32,
indentation: ?[]const u8,
};
pub const Block = struct {
key: []const u8,
children_count: u32,
};
pub fn deinit(self: Element, allocator: Allocator, owns_string: bool) void {
switch (self) {
.static_text => |content| if (owns_string) allocator.free(content),
.interpolation => |path| destroyPath(allocator, owns_string, path),
.unescaped_interpolation => |path| destroyPath(allocator, owns_string, path),
.section => |section| {
destroyPath(allocator, owns_string, section.path);
if (owns_string) {
if (section.inner_text) |inner_text| allocator.free(inner_text);
}
},
.inverted_section => |section| {
destroyPath(allocator, owns_string, section.path);
},
.partial => |partial| {
if (owns_string) {
allocator.free(partial.key);
if (partial.indentation) |indentation| allocator.free(indentation);
}
},
.parent => |parent| {
if (owns_string) allocator.free(parent.key);
},
.block => |block| {
if (owns_string) allocator.free(block.key);
},
}
}
pub fn deinitMany(allocator: Allocator, owns_string: bool, items: []const Element) void {
for (items) |item| {
item.deinit(allocator, owns_string);
}
}
pub inline fn destroyPath(allocator: Allocator, owns_string: bool, path: Path) void {
if (path.len > 0) {
if (owns_string) {
for (path) |part| allocator.free(part);
}
allocator.free(path);
}
}
};
pub const Template = struct {
elements: []const Element,
options: *const TemplateOptions,
pub fn deinit(self: Template, allocator: Allocator) void {
if (self.options.load_mode == .runtime_loaded) {
Element.deinitMany(allocator, self.options.copyStrings(), self.elements);
allocator.free(self.elements);
}
}
};
/// Parses a string and returns an union containing either a `ParseError` or a `Template`
/// parameters:
/// `allocator` used to all temporary and permanent allocations.
/// Use this same allocator to deinit the returned template
/// `template_text`: utf-8 encoded template text to be parsed
/// `default_delimiters`: define custom delimiters, or use .{} for the default
/// `options`: comptime options.
pub fn parseText(
allocator: Allocator,
template_text: []const u8,
default_delimiters: Delimiters,
comptime options: mustache.options.ParseTextOptions,
) Allocator.Error!ParseResult {
const source = TemplateSource{ .String = .{ .copy_strings = options.copy_strings } };
return try parseSource(
source,
options.features,
allocator,
template_text,
default_delimiters,
.runtime_loaded,
);
}
/// Parses a comptime string a `Template`
pub fn parseComptime(
comptime template_text: []const u8,
comptime default_delimiters: Delimiters,
comptime features: mustache.options.Features,
) Template {
comptime {
@setEvalBranchQuota(999999);
const source = TemplateSource{ .String = .{ .copy_strings = false } };
const unused: Allocator = undefined;
const parse_result = parseSource(
source,
features,
unused,
template_text,
default_delimiters,
.{
.comptime_loaded = .{
.template_text = template_text,
.default_delimiters = default_delimiters,
},
},
) catch unreachable;
return switch (parse_result) {
.success => |template| template,
.parse_error => |detail| {
const message = std.fmt.comptimePrint("Parse error {s} at lin {}, col {}", .{ @errorName(detail.parse_error), detail.lin, detail.col });
@compileError(message);
},
};
}
}
/// Parses a file and returns an union containing either a `ParseError` or a `Template`
/// parameters:
/// `allocator` used to all temporary and permanent allocations.
/// Use this same allocator to deinit the returned template
/// `template_text`: utf-8 encoded template text to be parsed
/// `default_delimiters`: define custom delimiters, or use .{} for the default
/// `options`: comptime options.
pub fn parseFile(
allocator: Allocator,
template_absolute_path: []const u8,
default_delimiters: Delimiters,
comptime options: mustache.options.ParseFileOptions,
) (Allocator.Error || std.fs.File.OpenError || std.fs.File.ReadError)!ParseResult {
const source = TemplateSource{ .Stream = .{ .read_buffer_size = options.read_buffer_size } };
return try parseSource(
source,
options.features,
allocator,
template_absolute_path,
default_delimiters,
.runtime_loaded,
);
}
fn parseSource(
comptime source: TemplateSource,
comptime features: Features,
allocator: Allocator,
source_content: []const u8,
delimiters: Delimiters,
comptime load_mode: TemplateLoadMode,
) !ParseResult {
const options = TemplateOptions{
.source = source,
.output = .Parse,
.features = features,
.load_mode = load_mode,
};
var template = TemplateLoader(options){
.allocator = allocator,
.delimiters = delimiters,
};
errdefer template.deinit();
try template.load(source_content);
switch (template.result) {
.elements => |elements| return ParseResult{ .success = .{ .elements = elements, .options = &options } },
.parser_error => |last_error| return ParseResult{ .parse_error = last_error },
.not_loaded => unreachable,
}
}
pub fn TemplateLoader(comptime options: TemplateOptions) type {
return struct {
const Self = @This();
const Parser = parsing.Parser(options);
const Node = Parser.Node;
const Collector = struct {
pub const Error = error{};
elements: []Element = &.{},
pub inline fn render(ctx: *@This(), elements: []Element) Error!void {
ctx.elements = elements;
}
};
allocator: Allocator,
delimiters: Delimiters = .{},
result: union(enum) {
not_loaded,
elements: []const Element,
parser_error: ParseErrorDetail,
} = .not_loaded,
pub fn load(self: *Self, template: []const u8) Parser.LoadError!void {
var parser = try Parser.init(self.allocator, template, self.delimiters);
defer parser.deinit();
var collector = Collector{};
var success = try parser.parse(&collector);
self.result = if (success) .{
.elements = collector.elements,
} else .{
.parser_error = parser.last_error.?,
};
}
pub fn collectElements(self: *Self, template_text: []const u8, render: anytype) ErrorSet(Parser, @TypeOf(render))!void {
var parser = try Parser.init(self.allocator, template_text, self.delimiters);
defer parser.deinit();
_ = try parser.parse(render);
}
pub fn deinit(self: *Self) void {
if (options.load_mode == .runtime_loaded) {
switch (self.result) {
.elements => |elements| {
Element.deinitMany(self.allocator, options.copyStrings(), elements);
self.allocator.free(elements);
},
.parser_error, .not_loaded => {},
}
}
}
fn ErrorSet(comptime TParser: type, comptime TRender: type) type {
const parserInfo = @typeInfo(TParser);
const renderInfo = @typeInfo(TRender);
const ParserError = switch (parserInfo) {
.Struct => TParser.LoadError,
.Pointer => |info| if (info.size == .One) info.child.LoadError else @compileError("expected a reference to a parser, found " ++ @typeName(TParser)),
else => @compileError("expected a parser, found " ++ @typeName(TParser)),
};
const RenderError = switch (renderInfo) {
.Struct => TRender.Error,
.Pointer => |info| if (info.size == .One) info.child.Error else @compileError("expected a reference to a render, found " ++ @typeName(TParser)),
else => @compileError("expected a render, found " ++ @typeName(TParser)),
};
return ParserError || RenderError;
}
};
}
test {
_ = tests;
_ = parsing;
}
const tests = struct {
test {
_ = comments;
_ = delimiters;
_ = interpolation;
_ = sections;
_ = inverted;
_ = partials_section;
_ = lambdas;
_ = extra;
_ = api;
}
fn TesterTemplateLoader(comptime load_mode: TemplateLoadMode) type {
const options = TemplateOptions{
.source = .{ .String = .{ .copy_strings = false } },
.output = .Parse,
.load_mode = load_mode,
};
return TemplateLoader(options);
}
pub fn getTemplate(template_text: []const u8, comptime load_mode: TemplateLoadMode) !TesterTemplateLoader(load_mode) {
const allocator = testing.allocator;
var template_loader = TesterTemplateLoader(load_mode){
.allocator = allocator,
};
errdefer template_loader.deinit();
try template_loader.load(template_text);
if (template_loader.result == .parser_error) {
const detail = template_loader.result.parser_error;
if (load_mode == .runtime_loaded) {
std.log.err("{s} row {}, col {}", .{ @errorName(detail.parse_error), detail.lin, detail.col });
}
return detail.parse_error;
}
return template_loader;
}
pub fn expectPath(expected: []const u8, path: Element.Path) !void {
const TestParser = TesterTemplateLoader(.runtime_loaded).Parser;
var parser = try TestParser.init(testing.allocator, "", .{});
defer parser.deinit();
const expected_path = try parser.parsePath(expected);
defer Element.destroyPath(testing.allocator, false, expected_path);
try testing.expectEqual(expected_path.len, path.len);
for (expected_path) |expected_part, i| {
try testing.expectEqualStrings(expected_part, path[i]);
}
}
const comments = struct {
//
// Comment blocks should be removed from the template.
test "Inline" {
const template_text = "12345{{! Comment Block! }}67890";
const runTheTest = struct {
pub fn action(comptime load_mode: TemplateLoadMode) !void {
var template = try getTemplate(template_text, load_mode);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("12345", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("67890", elements[1].static_text);
}
}.action;
try runTheTest(.runtime_loaded);
comptime {
try runTheTest(.{
.comptime_loaded = .{
.template_text = template_text,
.default_delimiters = .{},
},
});
}
}
//
// Multiline comments should be permitted.
test "Multiline" {
const template_text =
\\12345{{!
\\ This is a
\\ multi-line comment...
\\}}67890
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("12345", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("67890", elements[1].static_text);
}
//
// All standalone comment lines should be removed.
test "Standalone" {
const template_text =
\\Begin.
\\{{! Comment Block! }}
\\End.
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("Begin.\n", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("End.", elements[1].static_text);
}
//
// All standalone comment lines should be removed.
test "Indented Standalone" {
const template_text =
\\Begin.
\\ {{! Indented Comment Block! }}
\\End.
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("Begin.\n", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("End.", elements[1].static_text);
}
//
// "\r\n" should be considered a newline for standalone tags.
test "Standalone Line Endings" {
const template_text = "|\r\n{{! Standalone Comment }}\r\n|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|\r\n", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("|", elements[1].static_text);
}
//
// Standalone tags should not require a newline to precede them.
test "Standalone Without Previous Line" {
const template_text = "!\n {{! I'm Still Standalone }}";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 1), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("!\n", elements[0].static_text);
}
//
// All standalone comment lines should be removed.
test "Multiline Standalone" {
const template_text =
\\Begin.
\\{{!
\\Something's going on here...
\\}}
\\End.
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("Begin.\n", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("End.", elements[1].static_text);
}
//
// All standalone comment lines should be removed.
test "Indented Multiline Standalone" {
const template_text =
\\Begin.
\\ {{!
\\ Something's going on here...
\\ }}
\\End.
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("Begin.\n", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("End.", elements[1].static_text);
}
//
// Inline comments should not strip whitespace.
test "Indented Inline" {
const template_text = " 12 {{! 34 }}\n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" 12 ", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("\n", elements[1].static_text);
}
//
// Comment removal should preserve surrounding whitespace.
test "Surrounding Whitespace" {
const template_text = "12345 {{! Comment Block! }} 67890";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("12345 ", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings(" 67890", elements[1].static_text);
}
};
const delimiters = struct {
//
// The equals sign (used on both sides) should permit delimiter changes.
test "Pair Behavior" {
const template_text = "{{=<% %>=}}(<%text%>)";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("(", elements[0].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[1]);
try expectPath("text", elements[1].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(")", elements[2].static_text);
}
//
// Characters with special meaning regexen should be valid delimiters.
test "Special Characters" {
const template_text = "({{=[ ]=}}[text])";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("(", elements[0].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[1]);
try expectPath("text", elements[1].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(")", elements[2].static_text);
}
//
// Delimiters set outside sections should persist.
test "Sections" {
const template_text =
\\[
\\{{#section}}
\\ {{data}}
\\ |data|
\\{{/section}}
\\{{= | | =}}
\\|#section|
\\ {{data}}
\\ |data|
\\|/section|
\\]
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 10), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("[\n", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("section", elements[1].section.path);
try testing.expectEqual(@as(usize, 3), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" ", elements[2].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[3]);
try expectPath("data", elements[3].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[4]);
try testing.expectEqualStrings("\n |data|\n", elements[4].static_text);
// Delimiters changed
try testing.expectEqual(Element.Type.section, elements[5]);
try expectPath("section", elements[5].section.path);
try testing.expectEqual(@as(usize, 3), elements[5].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[6]);
try testing.expectEqualStrings(" {{data}}\n ", elements[6].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[7]);
try expectPath("data", elements[7].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[8]);
try testing.expectEqualStrings("\n", elements[8].static_text);
try testing.expectEqual(Element.Type.static_text, elements[9]);
try testing.expectEqualStrings("]", elements[9].static_text);
}
//
// Delimiters set outside inverted sections should persist.
test "Inverted Sections" {
const template_text =
\\[
\\{{^section}}
\\ {{data}}
\\ |data|
\\{{/section}}
\\{{= | | =}}
\\|^section|
\\ {{data}}
\\ |data|
\\|/section|
\\]
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 10), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("[\n", elements[0].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[1]);
try expectPath("section", elements[1].inverted_section.path);
try testing.expectEqual(@as(usize, 3), elements[1].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" ", elements[2].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[3]);
try expectPath("data", elements[3].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[4]);
try testing.expectEqualStrings("\n |data|\n", elements[4].static_text);
// Delimiters changed
try testing.expectEqual(Element.Type.inverted_section, elements[5]);
try expectPath("section", elements[5].inverted_section.path);
try testing.expectEqual(@as(usize, 3), elements[5].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[6]);
try testing.expectEqualStrings(" {{data}}\n ", elements[6].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[7]);
try expectPath("data", elements[7].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[8]);
try testing.expectEqualStrings("\n", elements[8].static_text);
try testing.expectEqual(Element.Type.static_text, elements[9]);
try testing.expectEqualStrings("]", elements[9].static_text);
}
//
// Surrounding whitespace should be left untouched.
test "Surrounding Whitespace" {
const template_text = "| {{=@ @=}} |";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("| ", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings(" |", elements[1].static_text);
}
//
// Whitespace should be left untouched.
test "Outlying Whitespace (Inline)" {
const template_text = " | {{=@ @=}}\n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" | ", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("\n", elements[1].static_text);
}
//
// Standalone lines should be removed from the template.
test "Standalone Tag" {
const template_text =
\\Begin.
\\{{=@ @=}}
\\End.
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("Begin.\n", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("End.", elements[1].static_text);
}
//
// Indented standalone lines should be removed from the template.
test "Indented Standalone Tag" {
const template_text =
\\Begin.
\\{{=@ @=}}
\\End.
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("Begin.\n", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("End.", elements[1].static_text);
}
//
// "\r\n" should be considered a newline for standalone tags.
test "Standalone Line Endings" {
const template_text = "|\r\n{{= @ @ =}}\r\n|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|\r\n", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("|", elements[1].static_text);
}
//
// Standalone tags should not require a newline to precede them.
test "Standalone Without Previous Line" {
const template_text = " {{=@ @=}}\n=";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 1), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("=", elements[0].static_text);
}
//
// Standalone tags should not require a newline to follow them.
test "Standalone Without Newline" {
const template_text = "=\n {{=@ @=}}";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 1), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("=\n", elements[0].static_text);
}
//
// Superfluous in-tag whitespace should be ignored.
test "Pair with Padding" {
const template_text = "|{{= @ @ =}}|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|", elements[0].static_text);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("|", elements[1].static_text);
}
};
const interpolation = struct {
// Mustache-free templates should render as-is.
test "No Interpolation" {
const template_text = "Hello from {Mustache}!";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 1), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("Hello from {Mustache}!", elements[0].static_text);
}
// Unadorned tags should interpolate content into the template.
test "Basic Interpolation" {
const template_text = "Hello, {{subject}}!";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("Hello, ", elements[0].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[1]);
try expectPath("subject", elements[1].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("!", elements[2].static_text);
}
// Basic interpolation should be HTML escaped.
test "HTML Escaping" {
const template_text = "These characters should be HTML escaped: {{forbidden}}";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("These characters should be HTML escaped: ", elements[0].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[1]);
try expectPath("forbidden", elements[1].interpolation);
}
// Triple mustaches should interpolate without HTML escaping.
test "Triple Mustache" {
const template_text = "These characters should not be HTML escaped: {{{forbidden}}}";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("These characters should not be HTML escaped: ", elements[0].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[1]);
try expectPath("forbidden", elements[1].unescaped_interpolation);
}
// Ampersand should interpolate without HTML escaping.
test "Ampersand" {
const template_text = "These characters should not be HTML escaped: {{&forbidden}}";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("These characters should not be HTML escaped: ", elements[0].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[1]);
try expectPath("forbidden", elements[1].unescaped_interpolation);
}
// Interpolation should not alter surrounding whitespace.
test "Interpolation - Surrounding Whitespace" {
const template_text = "| {{string}} |";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("| ", elements[0].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[1]);
try expectPath("string", elements[1].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" |", elements[2].static_text);
}
// Interpolation should not alter surrounding whitespace.
test "Triple Mustache - Surrounding Whitespace" {
const template_text = "| {{{string}}} |";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("| ", elements[0].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[1]);
try expectPath("string", elements[1].unescaped_interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" |", elements[2].static_text);
}
// Interpolation should not alter surrounding whitespace.
test "Ampersand - Surrounding Whitespace" {
const template_text = "| {{&string}} |";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("| ", elements[0].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[1]);
try expectPath("string", elements[1].unescaped_interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" |", elements[2].static_text);
}
// Standalone interpolation should not alter surrounding whitespace.
test "Interpolation - Standalone" {
const template_text = " {{string}}\n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" ", elements[0].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[1]);
try expectPath("string", elements[1].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\n", elements[2].static_text);
}
// Standalone interpolation should not alter surrounding whitespace.
test "Triple Mustache - Standalone" {
const template_text = " {{{string}}}\n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" ", elements[0].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[1]);
try expectPath("string", elements[1].unescaped_interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\n", elements[2].static_text);
}
// Standalone interpolation should not alter surrounding whitespace.
test "Ampersand - Standalone" {
const template_text = " {{&string}}\n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" ", elements[0].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[1]);
try expectPath("string", elements[1].unescaped_interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\n", elements[2].static_text);
}
// Superfluous in-tag whitespace should be ignored.
test "Interpolation With Padding" {
const template_text = "|{{ string }}|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|", elements[0].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[1]);
try expectPath("string", elements[1].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|", elements[2].static_text);
}
// Superfluous in-tag whitespace should be ignored.
test "Triple Mustache With Padding" {
const template_text = "|{{{ string }}}|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|", elements[0].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[1]);
try expectPath("string", elements[1].unescaped_interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|", elements[2].static_text);
}
// Superfluous in-tag whitespace should be ignored.
test "Ampersand With Padding" {
const template_text = "|{{& string }}|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|", elements[0].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[1]);
try expectPath("string", elements[1].unescaped_interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|", elements[2].static_text);
}
};
const sections = struct {
// Sections should not alter surrounding whitespace.
test "Surrounding Whitespace" {
const template_text = " | {{#boolean}}\t|\t{{/boolean}} | \n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 4), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" | ", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("boolean", elements[1].section.path);
try testing.expectEqual(@as(usize, 1), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\t|\t", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings(" | \n", elements[3].static_text);
}
// Sections should not alter internal whitespace.
test "Internal Whitespace" {
const template_text = " | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 5), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" | ", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("boolean", elements[1].section.path);
try testing.expectEqual(@as(usize, 2), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" ", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("\n ", elements[3].static_text);
try testing.expectEqual(Element.Type.static_text, elements[4]);
try testing.expectEqualStrings(" | \n", elements[4].static_text);
}
// Single-line sections should not alter surrounding whitespace.
test "Indented Inline Sections" {
const template_text = " {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 7), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" ", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("boolean", elements[1].section.path);
try testing.expectEqual(@as(usize, 1), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("YES", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("\n ", elements[3].static_text);
try testing.expectEqual(Element.Type.section, elements[4]);
try expectPath("boolean", elements[4].section.path);
try testing.expectEqual(@as(usize, 1), elements[4].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[5]);
try testing.expectEqualStrings("GOOD", elements[5].static_text);
try testing.expectEqual(Element.Type.static_text, elements[6]);
try testing.expectEqualStrings("\n", elements[6].static_text);
}
// Standalone lines should be removed from the template.
test "Standalone Lines" {
const template_text =
\\| This Is
\\{{#boolean}}
\\|
\\{{/boolean}}
\\| A Line
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 4), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("| This Is\n", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("boolean", elements[1].section.path);
try testing.expectEqual(@as(usize, 1), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|\n", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("| A Line", elements[3].static_text);
}
// Indented standalone lines should be removed from the template.
test "Indented Standalone Lines" {
const template_text = "|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|\r\n", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("boolean", elements[1].section.path);
try testing.expectEqual(@as(usize, 0), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|", elements[2].static_text);
}
// Standalone tags should not require a newline to precede them.
test "Standalone Without Previous Line" {
const template_text = " {{#boolean}}\n#{{/boolean}}\n/";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.section, elements[0]);
try expectPath("boolean", elements[0].section.path);
try testing.expectEqual(@as(usize, 1), elements[0].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("#", elements[1].static_text);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\n/", elements[2].static_text);
}
// Standalone tags should not require a newline to follow them.
test "Standalone Without Newline" {
const template_text = "#{{#boolean}}\n/\n {{/boolean}}";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("#", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("boolean", elements[1].section.path);
try testing.expectEqual(@as(usize, 1), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\n/\n", elements[2].static_text);
}
// "\r\n" should be considered a newline for standalone tags.
test "Standalone Line Endings" {
const template_text =
\\| This Is
\\ {{#boolean}}
\\|
\\ {{/boolean}}
\\| A Line
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 4), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("| This Is\n", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("boolean", elements[1].section.path);
try testing.expectEqual(@as(usize, 1), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|\n", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("| A Line", elements[3].static_text);
}
// Superfluous in-tag whitespace should be ignored.
test "Padding" {
const template_text = "|{{# boolean }}={{/ boolean }}|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 4), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("boolean", elements[1].section.path);
try testing.expectEqual(@as(usize, 1), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("=", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("|", elements[3].static_text);
}
test "Deeply Nested Contexts" {
const template_text =
\\{{#a}}
\\{{one}}
\\{{#b}}
\\{{one}}{{two}}{{one}}
\\{{#c}}
\\{{one}}{{two}}{{three}}{{two}}{{one}}
\\{{#d}}
\\{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}
\\{{#five}}
\\{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}
\\{{one}}{{two}}{{three}}{{four}}{{.}}6{{.}}{{four}}{{three}}{{two}}{{one}}
\\{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}
\\{{/five}}
\\{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}
\\{{/d}}
\\{{one}}{{two}}{{three}}{{two}}{{one}}
\\{{/c}}
\\{{one}}{{two}}{{one}}
\\{{/b}}
\\{{one}}
\\{{/a}}
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 77), elements.len);
try testing.expectEqual(Element.Type.section, elements[0]);
try expectPath("a", elements[0].section.path);
{
try testing.expectEqual(@as(usize, 76), elements[0].section.children_count);
try testing.expectEqual(Element.Type.interpolation, elements[1]);
try expectPath("one", elements[1].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\n", elements[2].static_text);
try testing.expectEqual(Element.Type.section, elements[3]);
try expectPath("b", elements[3].section.path);
{
try testing.expectEqual(@as(usize, 71), elements[3].section.children_count);
try testing.expectEqual(Element.Type.interpolation, elements[4]);
try expectPath("one", elements[4].interpolation);
try testing.expectEqual(Element.Type.interpolation, elements[5]);
try expectPath("two", elements[5].interpolation);
try testing.expectEqual(Element.Type.interpolation, elements[6]);
try expectPath("one", elements[6].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[7]);
try testing.expectEqualStrings("\n", elements[7].static_text);
try testing.expectEqual(Element.Type.section, elements[8]);
try expectPath("c", elements[8].section.path);
{
try testing.expectEqual(@as(usize, 62), elements[8].section.children_count);
// Too lazy to do the rest ... 🙃
}
try testing.expectEqual(Element.Type.interpolation, elements[71]);
try expectPath("one", elements[71].interpolation);
try testing.expectEqual(Element.Type.interpolation, elements[72]);
try expectPath("two", elements[72].interpolation);
try testing.expectEqual(Element.Type.interpolation, elements[73]);
try expectPath("one", elements[73].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[74]);
try testing.expectEqualStrings("\n", elements[74].static_text);
}
try testing.expectEqual(Element.Type.interpolation, elements[75]);
try expectPath("one", elements[75].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[76]);
try testing.expectEqualStrings("\n", elements[76].static_text);
}
}
};
const inverted = struct {
// Sections should not alter surrounding whitespace.
test "Surrounding Whitespace" {
const template_text = " | {{^boolean}}\t|\t{{/boolean}} | \n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 4), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" | ", elements[0].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[1]);
try expectPath("boolean", elements[1].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[1].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\t|\t", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings(" | \n", elements[3].static_text);
}
// Sections should not alter internal whitespace.
test "Internal Whitespace" {
const template_text = " | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 5), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" | ", elements[0].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[1]);
try expectPath("boolean", elements[1].inverted_section.path);
try testing.expectEqual(@as(usize, 2), elements[1].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" ", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("\n ", elements[3].static_text);
try testing.expectEqual(Element.Type.static_text, elements[4]);
try testing.expectEqualStrings(" | \n", elements[4].static_text);
}
// Single-line sections should not alter surrounding whitespace.
test "Indented Inline Sections" {
const template_text = " {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 7), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" ", elements[0].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[1]);
try expectPath("boolean", elements[1].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[1].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("NO", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("\n ", elements[3].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[4]);
try expectPath("boolean", elements[4].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[4].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[5]);
try testing.expectEqualStrings("WAY", elements[5].static_text);
try testing.expectEqual(Element.Type.static_text, elements[6]);
try testing.expectEqualStrings("\n", elements[6].static_text);
}
// Standalone lines should be removed from the template.
test "Standalone Lines" {
const template_text =
\\| This Is
\\{{^boolean}}
\\|
\\{{/boolean}}
\\| A Line
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 4), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("| This Is\n", elements[0].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[1]);
try expectPath("boolean", elements[1].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[1].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|\n", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("| A Line", elements[3].static_text);
}
// Indented standalone lines should be removed from the template.
test "Indented Standalone Lines" {
const template_text = "|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|\r\n", elements[0].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[1]);
try expectPath("boolean", elements[1].inverted_section.path);
try testing.expectEqual(@as(usize, 0), elements[1].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|", elements[2].static_text);
}
// Standalone tags should not require a newline to precede them.
test "Standalone Without Previous Line" {
const template_text = " {{^boolean}}\n^{{/boolean}}\n/";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.inverted_section, elements[0]);
try expectPath("boolean", elements[0].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[0].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings("^", elements[1].static_text);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\n/", elements[2].static_text);
}
// Standalone tags should not require a newline to follow them.
test "Standalone Without Newline" {
const template_text = "^{{^boolean}}\n/\n {{/boolean}}";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("^", elements[0].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[1]);
try expectPath("boolean", elements[1].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[1].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("\n/\n", elements[2].static_text);
}
// Standalone indented lines should be removed from the template.
test "Standalone Indented Lines" {
const template_text =
\\| This Is
\\ {{^boolean}}
\\|
\\ {{/boolean}}
\\| A Line
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 4), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("| This Is\n", elements[0].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[1]);
try expectPath("boolean", elements[1].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[1].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|\n", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("| A Line", elements[3].static_text);
}
// Superfluous in-tag whitespace should be ignored.
test "Padding" {
const template_text = "|{{^ boolean }}={{/ boolean }}|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 4), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|", elements[0].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[1]);
try expectPath("boolean", elements[1].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[1].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("=", elements[2].static_text);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings("|", elements[3].static_text);
}
};
const partials_section = struct {
// The greater-than operator should not alter surrounding whitespace.
test "Surrounding Whitespace" {
const template_text = "| {{>partial}} |";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("| ", elements[0].static_text);
try testing.expectEqual(Element.Type.partial, elements[1]);
try testing.expectEqualStrings("partial", elements[1].partial.key);
try testing.expect(elements[1].partial.indentation == null);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" |", elements[2].static_text);
}
// Whitespace should be left untouched.
test "Inline Indentation" {
const template_text = " {{data}} {{> partial}}\n";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 5), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" ", elements[0].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[1]);
try expectPath("data", elements[1].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" ", elements[2].static_text);
try testing.expectEqual(Element.Type.partial, elements[3]);
try testing.expectEqualStrings("partial", elements[3].partial.key);
try testing.expect(elements[3].partial.indentation == null);
try testing.expectEqual(Element.Type.static_text, elements[4]);
try testing.expectEqualStrings("\n", elements[4].static_text);
}
// "\r\n" should be considered a newline for standalone tags.
test "Standalone Line Endings" {
const template_text = "|\r\n{{>partial}}\r\n|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|\r\n", elements[0].static_text);
try testing.expectEqual(Element.Type.partial, elements[1]);
try testing.expectEqualStrings("partial", elements[1].partial.key);
try testing.expect(elements[1].partial.indentation == null);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|", elements[2].static_text);
}
// Standalone tags should not require a newline to precede them.
test "Standalone Without Previous Line" {
const template_text = " {{>partial}}\n>";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.partial, elements[0]);
try testing.expectEqualStrings("partial", elements[0].partial.key);
try testing.expect(elements[0].partial.indentation != null);
try testing.expectEqualStrings(" ", elements[0].partial.indentation.?);
try testing.expectEqual(Element.Type.static_text, elements[1]);
try testing.expectEqualStrings(">", elements[1].static_text);
}
// Standalone tags should not require a newline to follow them.
test "Standalone Without Newline" {
const template_text = ">\n {{>partial}}";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 2), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(">\n", elements[0].static_text);
try testing.expectEqual(Element.Type.partial, elements[1]);
try testing.expectEqualStrings("partial", elements[1].partial.key);
try testing.expect(elements[1].partial.indentation != null);
try testing.expectEqualStrings(" ", elements[1].partial.indentation.?);
}
// Each line of the partial should be indented before rendering.
test "Standalone Indentation" {
const template_text =
\\ \
\\ {{>partial}}
\\ /
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" \\\n", elements[0].static_text);
try testing.expectEqual(Element.Type.partial, elements[1]);
try testing.expectEqualStrings("partial", elements[1].partial.key);
try testing.expect(elements[1].partial.indentation != null);
try testing.expectEqualStrings(" ", elements[1].partial.indentation.?);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings(" /", elements[2].static_text);
}
// Superfluous in-tag whitespace should be ignored.
test "Padding" {
const template_text = "|{{> partial }}|";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 3), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("|", elements[0].static_text);
try testing.expectEqual(Element.Type.partial, elements[1]);
try testing.expectEqualStrings("partial", elements[1].partial.key);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("|", elements[2].static_text);
}
};
const lambdas = struct {
// Lambdas used for sections should receive the raw section string.
test "Sections" {
const template_text = "<{{#lambda}}{{x}}{{/lambda}}>";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 4), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("<", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("lambda", elements[1].section.path);
try testing.expect(elements[1].section.inner_text != null);
try testing.expectEqualStrings("{{x}}", elements[1].section.inner_text.?);
try testing.expectEqual(@as(usize, 1), elements[1].section.children_count);
try testing.expectEqual(Element.Type.interpolation, elements[2]);
try expectPath("x", elements[2].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[3]);
try testing.expectEqualStrings(">", elements[3].static_text);
}
// Lambdas used for sections should receive the raw section string.
test "Nested Sections" {
const template_text = "<{{#lambda}}{{#lambda2}}{{x}}{{/lambda2}}{{/lambda}}>";
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 5), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings("<", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
const section = elements[1].section;
try expectPath("lambda", section.path);
try testing.expect(section.inner_text != null);
try testing.expectEqualStrings("{{#lambda2}}{{x}}{{/lambda2}}", section.inner_text.?);
try testing.expectEqual(@as(usize, 2), section.children_count);
try testing.expectEqual(Element.Type.section, elements[2]);
const sub_section = elements[2].section;
try expectPath("lambda2", sub_section.path);
try testing.expect(sub_section.inner_text != null);
try testing.expectEqualStrings("{{x}}", sub_section.inner_text.?);
try testing.expectEqual(@as(usize, 1), sub_section.children_count);
try testing.expectEqual(Element.Type.interpolation, elements[3]);
try expectPath("x", elements[3].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[4]);
try testing.expectEqualStrings(">", elements[4].static_text);
}
};
const extra = struct {
test "Basic DOM test" {
const template_text =
\\{{! Comments block }}
\\ Hello
\\ {{#section}}
\\Name: {{name}}
\\Comments: {{&comments}}
\\{{^inverted}}Inverted text{{/inverted}}
\\{{/section}}
\\World
;
var template = try getTemplate(template_text, .runtime_loaded);
defer template.deinit();
try testing.expect(template.result == .elements);
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 11), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" Hello\n", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("section", elements[1].section.path);
try testing.expectEqual(@as(usize, 8), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("Name: ", elements[2].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[3]);
try expectPath("name", elements[3].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[4]);
try testing.expectEqualStrings("\nComments: ", elements[4].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[5]);
try expectPath("comments", elements[5].unescaped_interpolation);
try testing.expectEqual(Element.Type.static_text, elements[6]);
try testing.expectEqualStrings("\n", elements[6].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[7]);
try expectPath("inverted", elements[7].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[7].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[8]);
try testing.expectEqualStrings("Inverted text", elements[8].static_text);
try testing.expectEqual(Element.Type.static_text, elements[9]);
try testing.expectEqualStrings("\n", elements[9].static_text);
try testing.expectEqual(Element.Type.static_text, elements[10]);
try testing.expectEqualStrings("World", elements[10].static_text);
}
test "Basic DOM File test" {
const template_text =
\\{{! Comments block }}
\\ Hello
\\ {{#section}}
\\Name: {{name}}
\\Comments: {{&comments}}
\\{{^inverted}}Inverted text{{/inverted}}
\\{{/section}}
\\World
;
const allocator = testing.allocator;
const path = try std.fs.selfExeDirPathAlloc(allocator);
defer allocator.free(path);
// Creating a temp file
const absolute_file_path = try std.fs.path.join(allocator, &.{ path, "temp.mustache" });
defer allocator.free(absolute_file_path);
var file = try std.fs.createFileAbsolute(absolute_file_path, .{ .truncate = true });
try file.writeAll(template_text);
file.close();
defer std.fs.deleteFileAbsolute(absolute_file_path) catch {};
// Read from a file, assuring that this text should read four times from the buffer
const read_buffer_size = (template_text.len / 4);
const SmallBufferTemplateloader = TemplateLoader(.{
.source = .{ .Stream = .{ .read_buffer_size = read_buffer_size } },
.output = .Parse,
});
var template = SmallBufferTemplateloader{
.allocator = allocator,
};
defer template.deinit();
try template.load(absolute_file_path);
try testing.expect(template.result == .elements);
const elements = template.result.elements;
try testing.expectEqual(@as(usize, 11), elements.len);
try testing.expectEqual(Element.Type.static_text, elements[0]);
try testing.expectEqualStrings(" Hello\n", elements[0].static_text);
try testing.expectEqual(Element.Type.section, elements[1]);
try expectPath("section", elements[1].section.path);
try testing.expectEqual(@as(usize, 8), elements[1].section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[2]);
try testing.expectEqualStrings("Name: ", elements[2].static_text);
try testing.expectEqual(Element.Type.interpolation, elements[3]);
try expectPath("name", elements[3].interpolation);
try testing.expectEqual(Element.Type.static_text, elements[4]);
try testing.expectEqualStrings("\nComments: ", elements[4].static_text);
try testing.expectEqual(Element.Type.unescaped_interpolation, elements[5]);
try expectPath("comments", elements[5].unescaped_interpolation);
try testing.expectEqual(Element.Type.static_text, elements[6]);
try testing.expectEqualStrings("\n", elements[6].static_text);
try testing.expectEqual(Element.Type.inverted_section, elements[7]);
try expectPath("inverted", elements[7].inverted_section.path);
try testing.expectEqual(@as(usize, 1), elements[7].inverted_section.children_count);
try testing.expectEqual(Element.Type.static_text, elements[8]);
try testing.expectEqualStrings("Inverted text", elements[8].static_text);
try testing.expectEqual(Element.Type.static_text, elements[9]);
try testing.expectEqualStrings("\n", elements[9].static_text);
try testing.expectEqual(Element.Type.static_text, elements[10]);
try testing.expectEqualStrings("World", elements[10].static_text);
}
test "Large DOM File test" {
const template_text =
\\{{! Comments block }}
\\ Hello
\\ {{#section}}
\\Name: {{name}}
\\Comments: {{&comments}}
\\{{^inverted}}Inverted text{{/inverted}}
\\{{/section}}
\\World
;
const allocator = testing.allocator;
const path = try std.fs.selfExeDirPathAlloc(allocator);
defer allocator.free(path);
// Creating a temp file
const test_10MB_file = try std.fs.path.join(allocator, &.{ path, "10MB_file.mustache" });
defer allocator.free(test_10MB_file);
var file = try std.fs.createFileAbsolute(test_10MB_file, .{ .truncate = true });
defer std.fs.deleteFileAbsolute(test_10MB_file) catch {};
// Writes the same template many times on a file
const REPEAT = 100_000;
var step: usize = 0;
while (step < REPEAT) : (step += 1) {
try file.writeAll(template_text);
}
const file_size = try file.getEndPos();
file.close();
// Must be at least 10MB big
try testing.expect(file_size > 10 * 1024 * 1024);
// 32KB should be enough memory for this job
// 16KB if we don't need to support lambdas 😅
var plenty_of_memory = std.heap.GeneralPurposeAllocator(.{ .enable_memory_limit = true }){
.requested_memory_limit = 32 * 1024,
};
defer _ = plenty_of_memory.deinit();
// Strings are not ownned by the template,
// Use this option when creating templates from a static string or when rendering direct to a stream
const RefStringsTemplate = TemplateLoader(.{
.source = .{ .Stream = .{} },
.output = .Render,
});
// Create a template to parse and render this 10MB file, with only 16KB of memory
var template = RefStringsTemplate{
.allocator = plenty_of_memory.allocator(),
};
defer template.deinit();
// A dummy render, just count the produced elements
const DummyRender = struct {
pub const Error = error{};
count: usize = 0,
pub fn render(ctx: *@This(), elements: []Element) Error!void {
ctx.count += elements.len;
checkStrings(elements);
}
// Check if all strings are valid
// As long we are running with own_string = false,
// Those strings must be valid during the render process
fn checkStrings(elements: []const Element) void {
for (elements) |element| {
switch (element) {
.static_text => |item| scan(item),
.interpolation => |item| scanPath(item),
.unescaped_interpolation => |item| scanPath(item),
.section => |item| scanPath(item.path),
.inverted_section => |item| scanPath(item.path),
.partial => |item| scan(item.key),
.parent => |item| scan(item.key),
.block => |item| scan(item.key),
}
}
}
// Just scans the whole slice, hopping for no segfault
fn scan(string: []const u8) void {
var prev_char: u8 = 0;
for (string) |char| {
prev_char = prev_char +% char;
}
_ = prev_char;
}
fn scanPath(value: Element.Path) void {
for (value) |part| scan(part);
}
};
var dummy_render = DummyRender{};
try template.collectElements(test_10MB_file, &dummy_render);
try testing.expectEqual(@as(usize, 11 * REPEAT), dummy_render.count);
}
};
const api = struct {
test "parseText API" {
var result = try parseText(testing.allocator, "{{hello}}world", .{}, .{ .copy_strings = true });
switch (result) {
.parse_error => {
try testing.expect(false);
},
.success => |template| {
template.deinit(testing.allocator);
},
}
}
test "parseFile API" {
var file_name = file_name: {
var tmp = testing.tmpDir(.{});
var file = try tmp.dir.createFile("parseFile.mustache", .{ .truncate = true });
defer file.close();
try file.writeAll("{{hello}}world");
break :file_name try tmp.dir.realpathAlloc(testing.allocator, "parseFile.mustache");
};
defer testing.allocator.free(file_name);
var result = try parseFile(testing.allocator, file_name, .{}, .{});
switch (result) {
.parse_error => {
try testing.expect(false);
},
.success => |template| {
template.deinit(testing.allocator);
},
}
}
};
}; | src/template.zig |
const std = @import("std");
pub const instructions = struct {
pub const CallBreak = packed struct {
pub const Mode = packed enum(u12) { ecall, ebreak };
opcode: u7 = 0b1110011,
unused1: u5 = 0,
unused2: u3 = 0,
unused3: u5 = 0,
mode: u12, //: Mode
};
// I-type
pub const Addi = packed struct {
pub const Mode = packed enum(u3) { addi = 0b000, slti = 0b010, sltiu = 0b011, xori = 0b100, ori = 0b110, andi = 0b111 };
opcode: u7 = 0b0010011,
rd: u5,
mode: u3, //: Mode
rs1: u5,
imm: i12,
};
pub const Lui = packed struct {
opcode: u7 = 0b0110111,
rd: u5,
imm: i20,
};
// I_type
pub const Load = packed struct {
pub const Mode = packed enum(u3) { ld = 0b011, lwu = 0b110 };
opcode: u7 = 0b0000011,
rd: u5,
mode: u3, //: Mode
rs1: u5,
offset: i12,
};
// I-type
pub const Jalr = packed struct {
opcode: u7 = 0b1100111,
rd: u5,
mode: u3 = 0,
rs1: u5,
offset: i12,
};
};
// zig fmt: off
pub const RawRegister = enum(u8) {
x0, x1, x2, x3, x4, x5, x6, x7,
x8, x9, x10, x11, x12, x13, x14, x15,
x16, x17, x18, x19, x20, x21, x22, x23,
x24, x25, x26, x27, x28, x29, x30, x31,
};
pub const Register = enum(u8) {
// 64 bit registers
zero, // zero
ra, // return address. caller saved
sp, // stack pointer. callee saved.
gp, // global pointer
tp, // thread pointer
t0, t1, t2, // temporaries. caller saved.
s0, // s0/fp, callee saved.
s1, // callee saved.
a0, a1, // fn args/return values. caller saved.
a2, a3, a4, a5, a6, a7, // fn args. caller saved.
s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, // saved registers. callee saved.
t3, t4, t5, t6, // caller saved
pub fn parseRegName(name: []const u8) ?Register {
if(std.meta.stringToEnum(Register, name)) |reg| return reg;
if(std.meta.stringToEnum(RawRegister, name)) |rawreg| return @intToEnum(Register, @enumToInt(rawreg));
return null;
}
/// Returns the register's id.
pub fn id(self: @This()) u5 {
return @truncate(u5, @enumToInt(self));
}
/// Returns the index into `callee_preserved_regs`.
pub fn allocIndex(self: Register) ?u4 {
inline for(callee_preserved_regs) |cpreg, i| {
if(self == cpreg) return i;
}
return null;
}
};
// zig fmt: on
pub const callee_preserved_regs = [_]Register{
.s0, .s1, .s2, .s3, .s4, .s5, .s6, .s7, .s8, .s9, .s10, .s11,
}; | src-self-hosted/codegen/riscv64.zig |
const kernel = @import("kernel.zig");
const Virtual = @This();
const Physical = kernel.Physical;
const log = kernel.log.scoped(.Virtual);
pub const Memory = @import("virtual_memory.zig");
pub const Address = @import("virtual_address.zig");
pub var initialized = false;
pub const AddressSpace = struct {
arch: kernel.arch.AddressSpace,
free_regions_by_address: kernel.AVL.Tree(Virtual.Memory.Region) = .{},
free_regions_by_size: kernel.AVL.Tree(Virtual.Memory.Region) = .{},
used_regions: kernel.AVL.Tree(Virtual.Memory.Region) = .{},
pub inline fn new() ?AddressSpace {
return from_context(kernel.arch.AddressSpace.new() orelse return null);
}
pub inline fn from_current() ?AddressSpace {
return from_context(kernel.arch.AddressSpace.from_current());
}
pub inline fn from_context(context: anytype) AddressSpace {
return AddressSpace{
.arch = context,
};
}
// TODO: handle free in error case
pub inline fn new_for_user() ?*AddressSpace {
const address_space = kernel.core_heap.allocate(AddressSpace) orelse return null;
address_space.* = new() orelse return null;
address_space.arch.map_kernel_address_space_higher_half();
return address_space;
}
// TODO: manage virtual memory
pub inline fn allocate(address_space: *AddressSpace, size: u64) ?Virtual.Address {
_ = address_space;
const page_count = kernel.bytes_to_pages(size, true);
const physical_address = kernel.Physical.Memory.allocate_pages(page_count) orelse return null;
return physical_address.to_higher_half_virtual_address();
}
pub inline fn allocate_and_map(address_space: *AddressSpace, size: u64, flags: Flags) ?Virtual.Address {
_ = address_space;
const page_count = kernel.bytes_to_pages(size, true);
const physical_address = kernel.Physical.Memory.allocate_pages(page_count) orelse return null;
const virtual_address = physical_address.to_higher_half_virtual_address();
const physical_region = kernel.Physical.Memory.Region.new(physical_address, size);
physical_region.map(address_space, virtual_address, flags);
return virtual_address;
}
pub inline fn translate_address(address_space: *AddressSpace, virtual_address: Virtual.Address) ?Physical.Address {
return address_space.arch.translate_address(virtual_address);
}
pub inline fn map(address_space: *AddressSpace, physical_address: Physical.Address, virtual_address: Virtual.Address, flags: Flags) void {
address_space.arch.map(physical_address, virtual_address, flags);
const checked_physical_address = address_space.translate_address(virtual_address) orelse @panic("mapping failed");
kernel.assert(@src(), checked_physical_address.value == physical_address.value);
}
pub const Flags = kernel.Bitflag(true, enum(u64) {
read_write = 1,
user = 2,
write_through = 3,
cache_disable = 4,
accessed = 5,
dirty = 6,
pat = 7, // must be 0
global = 8,
execute_disable = 63,
});
pub inline fn make_current(address_space: *AddressSpace) void {
address_space.arch.make_current();
}
const IntegrationError = error{
region_allocation_failed,
};
pub fn integrate_mapped_physical_entry(address_space: *AddressSpace, entry: kernel.Physical.Memory.Map.Entry, base_virtual_address: Virtual.Address) !void {
kernel.assert(@src(), entry.descriptor.size != 0);
//log.debug("Integrating (0x{x}, {}) into 0x{x}", .{ entry.descriptor.address.value, entry.descriptor.size, base_virtual_address.value });
if (entry.descriptor.size != entry.allocated_size) {
const free_region_offset = base_virtual_address.value + entry.allocated_size;
const free_region_size = entry.descriptor.size - entry.allocated_size;
//log.debug("Allocating free region", .{});
const free_region = kernel.core_heap.allocate(Virtual.Memory.Region) orelse return IntegrationError.region_allocation_failed;
//log.debug("Allocated free region", .{});
free_region.* = Virtual.Memory.Region.new(Virtual.Address.new(free_region_offset), free_region_size);
//log.debug("Free region: (0x{x}, {})", .{ free_region.address.value, free_region.size });
var result = address_space.free_regions_by_address.insert(&free_region.item_address, free_region, free_region.address.value, .panic);
kernel.assert(@src(), result);
result = address_space.free_regions_by_size.insert(&free_region.item_size, free_region, free_region.size, .allow);
kernel.assert(@src(), result);
}
if (entry.allocated_size > 0) {
//log.debug("allocating region", .{});
const used_region = kernel.core_heap.allocate(Virtual.Memory.Region) orelse return IntegrationError.region_allocation_failed;
//log.debug("allocated region", .{});
used_region.* = Virtual.Memory.Region.new(base_virtual_address, entry.allocated_size);
used_region.used = true;
//log.debug("Used region: (0x{x}, {})", .{ used_region.address.value, used_region.size });
kernel.assert(@src(), used_region.address.value != 0);
const result = address_space.used_regions.insert(&used_region.item_address, used_region, used_region.address.value, .panic);
kernel.assert(@src(), result);
}
}
pub fn integrate_mapped_physical_region(address_space: *AddressSpace, region: kernel.Physical.Memory.Region, base_virtual_address: Virtual.Address) !void {
kernel.assert(@src(), region.size != 0);
log.debug("region size: {}", .{region.size});
const used_region = kernel.core_heap.allocate(Virtual.Memory.Region) orelse return IntegrationError.region_allocation_failed;
used_region.* = Virtual.Memory.Region.new(base_virtual_address, region.size);
used_region.used = true;
log.debug("Used region: (0x{x}, {})", .{ used_region.address.value, used_region.size });
kernel.assert(@src(), used_region.address.value != 0);
const result = address_space.used_regions.insert(&used_region.item_address, used_region, used_region.address.value, .panic);
kernel.assert(@src(), result);
}
}; | src/kernel/virtual.zig |
const std = @import("std");
const expect = std.testing.expect;
const Route = @import("router.zig").Route;
const router = @import("router.zig");
const http = @import("http.zig");
const Router = router.Router;
const HandlerFn = router.HandlerFn;
const Request = http.Request;
const Response = http.Response;
const Headers = http.Headers;
const Method = http.Method;
pub fn all(path: []const u8, handler: anytype) Route {
return createRoute(null, path, handler);
}
pub fn get(path: []const u8, handler: anytype) Route {
return createRoute(Method.Get, path, handler);
}
pub fn head(path: []const u8, handler: anytype) Route {
return createRoute(Method.Head, path, handler);
}
pub fn post(path: []const u8, handler: anytype) Route {
return createRoute(Method.Post, path, handler);
}
pub fn put(path: []const u8, handler: anytype) Route {
return createRoute(Method.Put, path, handler);
}
pub fn delete(path: []const u8, handler: anytype) Route {
return createRoute(Method.Delete, path, handler);
}
pub fn connect(path: []const u8, handler: anytype) Route {
return createRoute(Method.Connect, path, handler);
}
pub fn options(path: []const u8, handler: anytype) Route {
return createRoute(Method.Options, path, handler);
}
pub fn trace(path: []const u8, handler: anytype) Route {
return createRoute(Method.Trace, path, handler);
}
pub fn patch(path: []const u8, handler: anytype) Route {
return createRoute(Method.Patch, path, handler);
}
pub fn custom(method: []const u8, path: []const u8, handler: anytype) Route {
return createRoute(method, path, handler);
}
/// add route with given method
fn createRoute(method: ?[]const u8, path: []const u8, handler: anytype) Route {
const t = @typeInfo(@TypeOf(handler));
if (t != .Fn) {
@compileError("handler must be a function");
}
const f = t.Fn;
if (f.args.len != 2 and f.args.len != 3) {
@compileError("handler must take 2 or 3 arguments");
}
if (f.args[0].arg_type orelse void != Request) {
@compileError("first argument of a handler must be a HTTP Request");
}
if (f.args[1].arg_type orelse void != Response) {
@compileError("second argument of a handler must be a HTTP Response");
}
if (f.args.len == 3) {
const arg_type = f.args[2].arg_type orelse void;
if (@typeInfo(arg_type) != .Pointer or blk: {
const ptr = @typeInfo(arg_type).Pointer;
break :blk !ptr.is_const or ptr.size != .One or @typeInfo(ptr.child) != .Struct;
}) {
@compileError("third argument of a handler must be a const pointer to a struct containing all path arguments it takes");
}
}
const ret = f.return_type.?;
if (ret != void and (@typeInfo(ret) != .ErrorUnion or @typeInfo(ret).ErrorUnion.payload != void)) {
@compileError("handler must return void which may be in an error union");
}
return Route{
.path = path,
.method = method,
.handler = handler,
};
}
pub fn subRoute(route: []const u8, handlers: anytype) Route {
const h = Router(handlers);
const handler = struct {
fn handle(req: Request, res: Response, args: *const struct {
path: []const u8,
}) !void {
return h(req, res, args.path);
}
}.handle;
const path = (if (route[route.len - 1] == '/') route[0 .. route.len - 2] else route) ++ "{path;}";
return createRoute(Method.Get, path, handler);
}
// todo static cofig
// todo uri decode path
pub fn static(local_path: []const u8, remote_path: ?[]const u8) Route {
const handler = struct {
fn staticHandler(_: Request, res: Response, args: *const struct {
path: []const u8,
}) !void {
const allocator = res.allocator;
const path = if (local_path[local_path.len - 1] == '/') local_path else local_path ++ "/";
const full_path = try std.fs.path.join(allocator, &[_][]const u8{ path, args.path });
try res.sendFile(full_path);
}
}.staticHandler;
var path = if (remote_path) |r| if (r[r.len - 1] == '/') r ++ "{path;}" else r ++ "/{path;}" else "/{path;}";
return createRoute(Method.Get, path, handler);
}
// for tests
const request = @import("http/request.zig").Request;
const response = @import("http/response.zig").Response;
const alloc = std.heap.page_allocator;
test "index" {
const handler = comptime Router(.{get("/", indexHandler)});
var req = request{
.method = Method.Get,
.headers = undefined,
.path = "/",
.query = undefined,
.body = undefined,
.version = .Http11,
};
var res: response = undefined;
try nosuspend handler(&req, &res, req.path);
try expect(res.status_code.? == .Ok);
}
fn indexHandler(_: Request, res: Response) void {
res.status_code = .Ok;
}
test "custom status code" {
const handler = comptime Router(.{get("/", customStatusCode)});
var req = request{
.method = Method.Get,
.headers = undefined,
.path = "/",
.query = undefined,
.body = undefined,
.version = .Http11,
};
var res: response = undefined;
try nosuspend handler(&req, &res, req.path);
try expect(res.status_code.? == .BadRequest);
}
fn customStatusCode(_: Request, res: Response) void {
res.status_code = .BadRequest;
}
test "args" {
const handler = comptime Router(.{get("/a/{num}", argHandler)});
var req = request{
.method = Method.Get,
.headers = undefined,
.path = "/a/14",
.query = undefined,
.body = undefined,
.version = .Http11,
};
var res: response = undefined;
try nosuspend handler(&req, &res, req.path);
}
fn argHandler(_: Request, _: Response, args: *const struct {
num: u32,
}) !void {
try expect(args.num == 14);
}
test "delim string" {
const handler = comptime Router(.{get("/{str;}", delimHandler)});
var req = request{
.method = Method.Get,
.headers = undefined,
.path = "/all/of/this.html",
.query = undefined,
.body = undefined,
.version = .Http11,
};
var res: response = undefined;
try nosuspend handler(&req, &res, req.path);
}
fn delimHandler(_: Request, _: Response, args: *const struct {
str: []const u8,
}) !void {
try expect(std.mem.eql(u8, args.str, "all/of/this.html"));
}
test "subRoute" {
const handler = comptime Router(.{subRoute("/sub", .{get("/other", indexHandler)})});
var req = request{
.method = Method.Get,
.path = "/sub/other",
.query = undefined,
.body = undefined,
.version = .Http11,
.headers = undefined,
};
var res: response = undefined;
try nosuspend handler(&req, &res, req.path);
try expect(res.status_code.? == .Ok);
}
test "static files" {
const handler = comptime Router(.{static(
"assets",
"/static",
)});
var req = request{
.method = Method.Get,
.path = "/static/example-file.txt",
.query = undefined,
.body = undefined,
.version = .Http11,
.headers = undefined,
};
var buf = std.ArrayList(u8).init(alloc);
defer buf.deinit();
var res = response{
.status_code = .Processing,
.headers = Headers.init(alloc),
.body = .{ .context = &buf },
.allocator = alloc,
};
// ignore file not found error
nosuspend handler(&req, &res, req.path) catch |e| switch (e) {
error.FileNotFound => return,
else => return e,
};
try expect(std.mem.eql(u8, (try res.headers.get(alloc, "content-type")).?[0].value, "text/plain;charset=UTF-8"));
try expect(std.mem.eql(u8, res.body.context.items, "Some text\n"));
}
test "optional char" {
const handler = comptime Router(.{get("/about/?", indexHandler)});
var req = request{
.method = Method.Get,
.headers = undefined,
.path = "/about",
.query = undefined,
.body = undefined,
.version = .Http11,
};
var res: response = undefined;
try nosuspend handler(&req, &res, req.path);
try expect(res.status_code.? == .Ok);
} | src/routez/routes.zig |
//--------------------------------------------------------------------------------
// Section: Types (8)
//--------------------------------------------------------------------------------
const IID_IProtectionPolicyManagerInterop_Value = Guid.initString("4652651d-c1fe-4ba1-9f0a-c0f56596f721");
pub const IID_IProtectionPolicyManagerInterop = &IID_IProtectionPolicyManagerInterop_Value;
pub const IProtectionPolicyManagerInterop = extern struct {
pub const VTable = extern struct {
base: IInspectable.VTable,
RequestAccessForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop,
appWindow: ?HWND,
sourceIdentity: ?HSTRING,
targetIdentity: ?HSTRING,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetForWindow: fn(
self: *const IProtectionPolicyManagerInterop,
appWindow: ?HWND,
riid: ?*const Guid,
result: ?*?*anyopaque,
) 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 IProtectionPolicyManagerInterop_RequestAccessForWindowAsync(self: *const T, appWindow: ?HWND, sourceIdentity: ?HSTRING, targetIdentity: ?HSTRING, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop.VTable, self.vtable).RequestAccessForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop, self), appWindow, sourceIdentity, targetIdentity, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop_GetForWindow(self: *const T, appWindow: ?HWND, riid: ?*const Guid, result: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop.VTable, self.vtable).GetForWindow(@ptrCast(*const IProtectionPolicyManagerInterop, self), appWindow, riid, result);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IProtectionPolicyManagerInterop2_Value = Guid.initString("157cfbe4-a78d-4156-b384-61fdac41e686");
pub const IID_IProtectionPolicyManagerInterop2 = &IID_IProtectionPolicyManagerInterop2_Value;
pub const IProtectionPolicyManagerInterop2 = extern struct {
pub const VTable = extern struct {
base: IInspectable.VTable,
RequestAccessForAppWithWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop2,
appWindow: ?HWND,
sourceIdentity: ?HSTRING,
appPackageFamilyName: ?HSTRING,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RequestAccessWithAuditingInfoForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop2,
appWindow: ?HWND,
sourceIdentity: ?HSTRING,
targetIdentity: ?HSTRING,
auditInfoUnk: ?*IUnknown,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RequestAccessWithMessageForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop2,
appWindow: ?HWND,
sourceIdentity: ?HSTRING,
targetIdentity: ?HSTRING,
auditInfoUnk: ?*IUnknown,
messageFromApp: ?HSTRING,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RequestAccessForAppWithAuditingInfoForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop2,
appWindow: ?HWND,
sourceIdentity: ?HSTRING,
appPackageFamilyName: ?HSTRING,
auditInfoUnk: ?*IUnknown,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RequestAccessForAppWithMessageForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop2,
appWindow: ?HWND,
sourceIdentity: ?HSTRING,
appPackageFamilyName: ?HSTRING,
auditInfoUnk: ?*IUnknown,
messageFromApp: ?HSTRING,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) 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 IProtectionPolicyManagerInterop2_RequestAccessForAppWithWindowAsync(self: *const T, appWindow: ?HWND, sourceIdentity: ?HSTRING, appPackageFamilyName: ?HSTRING, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop2.VTable, self.vtable).RequestAccessForAppWithWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop2, self), appWindow, sourceIdentity, appPackageFamilyName, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop2_RequestAccessWithAuditingInfoForWindowAsync(self: *const T, appWindow: ?HWND, sourceIdentity: ?HSTRING, targetIdentity: ?HSTRING, auditInfoUnk: ?*IUnknown, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop2.VTable, self.vtable).RequestAccessWithAuditingInfoForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop2, self), appWindow, sourceIdentity, targetIdentity, auditInfoUnk, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop2_RequestAccessWithMessageForWindowAsync(self: *const T, appWindow: ?HWND, sourceIdentity: ?HSTRING, targetIdentity: ?HSTRING, auditInfoUnk: ?*IUnknown, messageFromApp: ?HSTRING, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop2.VTable, self.vtable).RequestAccessWithMessageForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop2, self), appWindow, sourceIdentity, targetIdentity, auditInfoUnk, messageFromApp, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop2_RequestAccessForAppWithAuditingInfoForWindowAsync(self: *const T, appWindow: ?HWND, sourceIdentity: ?HSTRING, appPackageFamilyName: ?HSTRING, auditInfoUnk: ?*IUnknown, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop2.VTable, self.vtable).RequestAccessForAppWithAuditingInfoForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop2, self), appWindow, sourceIdentity, appPackageFamilyName, auditInfoUnk, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop2_RequestAccessForAppWithMessageForWindowAsync(self: *const T, appWindow: ?HWND, sourceIdentity: ?HSTRING, appPackageFamilyName: ?HSTRING, auditInfoUnk: ?*IUnknown, messageFromApp: ?HSTRING, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop2.VTable, self.vtable).RequestAccessForAppWithMessageForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop2, self), appWindow, sourceIdentity, appPackageFamilyName, auditInfoUnk, messageFromApp, riid, asyncOperation);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IProtectionPolicyManagerInterop3_Value = Guid.initString("c1c03933-b398-4d93-b0fd-2972adf802c2");
pub const IID_IProtectionPolicyManagerInterop3 = &IID_IProtectionPolicyManagerInterop3_Value;
pub const IProtectionPolicyManagerInterop3 = extern struct {
pub const VTable = extern struct {
base: IInspectable.VTable,
RequestAccessWithBehaviorForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop3,
appWindow: ?HWND,
sourceIdentity: ?HSTRING,
targetIdentity: ?HSTRING,
auditInfoUnk: ?*IUnknown,
messageFromApp: ?HSTRING,
behavior: u32,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RequestAccessForAppWithBehaviorForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop3,
appWindow: ?HWND,
sourceIdentity: ?HSTRING,
appPackageFamilyName: ?HSTRING,
auditInfoUnk: ?*IUnknown,
messageFromApp: ?HSTRING,
behavior: u32,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RequestAccessToFilesForAppForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop3,
appWindow: ?HWND,
sourceItemListUnk: ?*IUnknown,
appPackageFamilyName: ?HSTRING,
auditInfoUnk: ?*IUnknown,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RequestAccessToFilesForAppWithMessageAndBehaviorForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop3,
appWindow: ?HWND,
sourceItemListUnk: ?*IUnknown,
appPackageFamilyName: ?HSTRING,
auditInfoUnk: ?*IUnknown,
messageFromApp: ?HSTRING,
behavior: u32,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RequestAccessToFilesForProcessForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop3,
appWindow: ?HWND,
sourceItemListUnk: ?*IUnknown,
processId: u32,
auditInfoUnk: ?*IUnknown,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RequestAccessToFilesForProcessWithMessageAndBehaviorForWindowAsync: fn(
self: *const IProtectionPolicyManagerInterop3,
appWindow: ?HWND,
sourceItemListUnk: ?*IUnknown,
processId: u32,
auditInfoUnk: ?*IUnknown,
messageFromApp: ?HSTRING,
behavior: u32,
riid: ?*const Guid,
asyncOperation: ?*?*anyopaque,
) 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 IProtectionPolicyManagerInterop3_RequestAccessWithBehaviorForWindowAsync(self: *const T, appWindow: ?HWND, sourceIdentity: ?HSTRING, targetIdentity: ?HSTRING, auditInfoUnk: ?*IUnknown, messageFromApp: ?HSTRING, behavior: u32, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop3.VTable, self.vtable).RequestAccessWithBehaviorForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop3, self), appWindow, sourceIdentity, targetIdentity, auditInfoUnk, messageFromApp, behavior, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop3_RequestAccessForAppWithBehaviorForWindowAsync(self: *const T, appWindow: ?HWND, sourceIdentity: ?HSTRING, appPackageFamilyName: ?HSTRING, auditInfoUnk: ?*IUnknown, messageFromApp: ?HSTRING, behavior: u32, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop3.VTable, self.vtable).RequestAccessForAppWithBehaviorForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop3, self), appWindow, sourceIdentity, appPackageFamilyName, auditInfoUnk, messageFromApp, behavior, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop3_RequestAccessToFilesForAppForWindowAsync(self: *const T, appWindow: ?HWND, sourceItemListUnk: ?*IUnknown, appPackageFamilyName: ?HSTRING, auditInfoUnk: ?*IUnknown, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop3.VTable, self.vtable).RequestAccessToFilesForAppForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop3, self), appWindow, sourceItemListUnk, appPackageFamilyName, auditInfoUnk, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop3_RequestAccessToFilesForAppWithMessageAndBehaviorForWindowAsync(self: *const T, appWindow: ?HWND, sourceItemListUnk: ?*IUnknown, appPackageFamilyName: ?HSTRING, auditInfoUnk: ?*IUnknown, messageFromApp: ?HSTRING, behavior: u32, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop3.VTable, self.vtable).RequestAccessToFilesForAppWithMessageAndBehaviorForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop3, self), appWindow, sourceItemListUnk, appPackageFamilyName, auditInfoUnk, messageFromApp, behavior, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop3_RequestAccessToFilesForProcessForWindowAsync(self: *const T, appWindow: ?HWND, sourceItemListUnk: ?*IUnknown, processId: u32, auditInfoUnk: ?*IUnknown, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop3.VTable, self.vtable).RequestAccessToFilesForProcessForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop3, self), appWindow, sourceItemListUnk, processId, auditInfoUnk, riid, asyncOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtectionPolicyManagerInterop3_RequestAccessToFilesForProcessWithMessageAndBehaviorForWindowAsync(self: *const T, appWindow: ?HWND, sourceItemListUnk: ?*IUnknown, processId: u32, auditInfoUnk: ?*IUnknown, messageFromApp: ?HSTRING, behavior: u32, riid: ?*const Guid, asyncOperation: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtectionPolicyManagerInterop3.VTable, self.vtable).RequestAccessToFilesForProcessWithMessageAndBehaviorForWindowAsync(@ptrCast(*const IProtectionPolicyManagerInterop3, self), appWindow, sourceItemListUnk, processId, auditInfoUnk, messageFromApp, behavior, riid, asyncOperation);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const HTHREAD_NETWORK_CONTEXT = extern struct {
ThreadId: u32,
ThreadContext: ?HANDLE,
};
pub const ENTERPRISE_DATA_POLICIES = enum(u32) {
NONE = 0,
ALLOWED = 1,
ENLIGHTENED = 2,
EXEMPT = 4,
_,
pub fn initFlags(o: struct {
NONE: u1 = 0,
ALLOWED: u1 = 0,
ENLIGHTENED: u1 = 0,
EXEMPT: u1 = 0,
}) ENTERPRISE_DATA_POLICIES {
return @intToEnum(ENTERPRISE_DATA_POLICIES,
(if (o.NONE == 1) @enumToInt(ENTERPRISE_DATA_POLICIES.NONE) else 0)
| (if (o.ALLOWED == 1) @enumToInt(ENTERPRISE_DATA_POLICIES.ALLOWED) else 0)
| (if (o.ENLIGHTENED == 1) @enumToInt(ENTERPRISE_DATA_POLICIES.ENLIGHTENED) else 0)
| (if (o.EXEMPT == 1) @enumToInt(ENTERPRISE_DATA_POLICIES.EXEMPT) else 0)
);
}
};
pub const ENTERPRISE_POLICY_NONE = ENTERPRISE_DATA_POLICIES.NONE;
pub const ENTERPRISE_POLICY_ALLOWED = ENTERPRISE_DATA_POLICIES.ALLOWED;
pub const ENTERPRISE_POLICY_ENLIGHTENED = ENTERPRISE_DATA_POLICIES.ENLIGHTENED;
pub const ENTERPRISE_POLICY_EXEMPT = ENTERPRISE_DATA_POLICIES.EXEMPT;
pub const SRPHOSTING_TYPE = enum(i32) {
NONE = 0,
WINHTTP = 1,
WININET = 2,
};
pub const SRPHOSTING_TYPE_NONE = SRPHOSTING_TYPE.NONE;
pub const SRPHOSTING_TYPE_WINHTTP = SRPHOSTING_TYPE.WINHTTP;
pub const SRPHOSTING_TYPE_WININET = SRPHOSTING_TYPE.WININET;
pub const SRPHOSTING_VERSION = enum(i32) {
@"1" = 1,
};
pub const SRPHOSTING_VERSION1 = SRPHOSTING_VERSION.@"1";
pub const FILE_UNPROTECT_OPTIONS = extern struct {
audit: bool,
};
//--------------------------------------------------------------------------------
// Section: Functions (13)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "srpapi" fn SrpCreateThreadNetworkContext(
enterpriseId: ?[*:0]const u16,
threadNetworkContext: ?*HTHREAD_NETWORK_CONTEXT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "srpapi" fn SrpCloseThreadNetworkContext(
threadNetworkContext: ?*HTHREAD_NETWORK_CONTEXT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "srpapi" fn SrpSetTokenEnterpriseId(
tokenHandle: ?HANDLE,
enterpriseId: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "srpapi" fn SrpGetEnterpriseIds(
tokenHandle: ?HANDLE,
numberOfBytes: ?*u32,
// TODO: what to do with BytesParamIndex 1?
enterpriseIds: ?*?PWSTR,
enterpriseIdCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "srpapi" fn SrpEnablePermissiveModeFileEncryption(
enterpriseId: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "srpapi" fn SrpDisablePermissiveModeFileEncryption(
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "srpapi" fn SrpGetEnterprisePolicy(
tokenHandle: ?HANDLE,
policyFlags: ?*ENTERPRISE_DATA_POLICIES,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "srpapi" fn SrpIsTokenService(
TokenHandle: ?HANDLE,
IsTokenService: ?*u8,
) callconv(@import("std").os.windows.WINAPI) NTSTATUS;
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "srpapi" fn SrpDoesPolicyAllowAppExecution(
packageId: ?*const PACKAGE_ID,
isAllowed: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "srpapi" fn SrpHostingInitialize(
Version: SRPHOSTING_VERSION,
Type: SRPHOSTING_TYPE,
pvData: ?*anyopaque,
cbData: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "srpapi" fn SrpHostingTerminate(
Type: SRPHOSTING_TYPE,
) callconv(@import("std").os.windows.WINAPI) void;
// TODO: this type is limited to platform 'windows10.0.10240'
pub extern "efswrt" fn ProtectFileToEnterpriseIdentity(
fileOrFolderPath: ?[*:0]const u16,
identity: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "efswrt" fn UnprotectFile(
fileOrFolderPath: ?[*:0]const u16,
options: ?*const FILE_UNPROTECT_OPTIONS,
) 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 (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 HSTRING = @import("../system/win_rt.zig").HSTRING;
const HWND = @import("../foundation.zig").HWND;
const IInspectable = @import("../system/win_rt.zig").IInspectable;
const IUnknown = @import("../system/com.zig").IUnknown;
const NTSTATUS = @import("../foundation.zig").NTSTATUS;
const PACKAGE_ID = @import("../storage/packaging/appx.zig").PACKAGE_ID;
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/security/enterprise_data.zig |
const std = @import("std");
const builtin = @import("builtin");
const ingble = @import("ingble.zig");
const gatt = @import("gatt_client_async.zig");
const print = ingble.platform_printf;
const enable_print = ingble.print_info == 1;
const rom_crc: ingble.f_crc_t = @intToPtr(ingble.f_crc_t, 0x00000f79);
fn same_version(a: *const ingble.prog_ver_t, b: * const ingble.prog_ver_t) bool {
return (a.*.major == b.*.major) and (a.*.minor == b.*.minor) and (a.*.patch == b.*.patch);
}
const PAGE_SIZE = @intCast(u32, ingble.EFLASH_PAGE_SIZE);
const HASH_SIZE = 32;
const PK_SIZE = 64;
const SK_SIZE = 32;
const FullSigMeta = packed struct {
cmd_id: u8,
sig: [64]u8,
crc_value: u16,
entry: u32,
blocks: [ingble.MAX_UPDATE_BLOCKS]ingble.fota_update_block_t,
};
const EccKeys = struct {
// externally provided buffer
peer_pk: [64]u8,
dh_sk: [32]u8,
xor_sk: [32]u8,
page_buffer: [ingble.EFLASH_PAGE_SIZE]u8,
page_end_cmd: [5 + 64]u8,
};
const Client = struct {
status: u8 = 0,
conn_handle: u16,
handle_ver: u16,
handle_ctrl: u16,
handle_data: u16,
handle_pk: u16,
mtu: u16,
sig_meta: FullSigMeta = undefined,
ecc_driver: ?*ingble.ecc_driver_t,
ecc_keys: ?*EccKeys = null,
fn fota_make_bitmap(self: *Client, optional_latest: ?*const ingble.ota_ver_t) ?u16 {
var bitmap: u16 = 0xffff;
if (optional_latest) |latest| {
var value_size: u16 = undefined;
if (gatt.value_of_characteristic_reader.read(self.conn_handle, self.handle_ver, &value_size)) |value| {
if (value_size != @sizeOf(ingble.ota_ver_t)) {
return null;
}
const local = @ptrCast(*const ingble.ota_ver_t, @alignCast(2, value));
if (enable_print) {
print("device version:\n");
print("platform: %d.%d.%d\n", local.*.platform.major, local.*.platform.minor, local.*.platform.patch);
print(" app: %d.%d.%d\n", local.*.app.major, local.*.app.minor, local.*.app.patch);
}
if (same_version(&local.*.platform, &latest.*.platform)) {
bitmap &= ~@as(u16, 0b01);
if (same_version(&local.*.app, &latest.*.app))
bitmap &= ~@as(u16, 0b10);
}
}
else
return null;
}
return bitmap;
}
fn write_cmd2(self: *Client, len: usize, data: [*c] const u8) u8 {
return ingble.gatt_client_write_value_of_characteristic_without_response(self.conn_handle, self.handle_ctrl, @intCast(u16, len), data);
}
fn read_status(self: *Client) u8 {
var value_size: u16 = undefined;
return (gatt.value_of_characteristic_reader.read(self.conn_handle, self.handle_ctrl, &value_size) orelse return 0xff).*;
}
fn check_status(self: *Client) bool {
return self.read_status() == ingble.OTA_STATUS_OK;
}
fn enable_fota(self: *Client) bool {
const cmd = [_]u8{ingble.OTA_CTRL_START, 0, 0, 0, 0};
_ = self.write_cmd2(cmd.len, &cmd[0]);
return self.check_status();
}
fn reboot(self: *Client) bool {
const cmd = [_]u8{ingble.OTA_CTRL_REBOOT};
_ = self.write_cmd2(cmd.len, &cmd[0]);
return true;
}
fn burn_page(self: *Client, data: [*c] u8, target_addr: u32, size: usize,
page_end_cmd: [*c]u8, cmd_size: usize) bool {
if (enable_print) {
print("burn_page: %p, %08x, %d\n", data, target_addr, size);
}
var cmd = page_end_cmd;
cmd[0] = ingble.OTA_CTRL_PAGE_BEGIN;
@memcpy(@ptrCast([*]u8, &cmd[1]), @ptrCast([*]const u8, &target_addr), 4);
_ = self.write_cmd2(5, &cmd[0]);
if (!self.check_status()) return false;
var remain = size;
var read = data;
while (remain > 0) {
const block = if (remain >= self.mtu) self.mtu else remain;
if (ingble.gatt_client_write_value_of_characteristic_without_response(self.conn_handle,
self.handle_data, @intCast(u16, block), read) != 0) {
if (!self.check_status())
return false;
continue;
}
read = read + block;
remain -= block;
}
var crc_value = rom_crc.?(data, @intCast(u16, size));
cmd[0] = ingble.OTA_CTRL_PAGE_END;
cmd[1] = @intCast(u8, size & 0xff);
cmd[2] = @intCast(u8, size >> 8);
cmd[3] = @intCast(u8, crc_value & 0xff);
cmd[4] = @intCast(u8, crc_value >> 8);
_ = self.write_cmd2(cmd_size, &cmd[0]);
if (!self.check_status()) return false;
return true;
}
fn encrypt(self: *Client, buff: [*c]u8, len: usize) void {
var i: usize = 0;
while (i < len) : (i += 1) {
buff[i] ^= self.ecc_keys.?.xor_sk[i & 0x1f];
}
}
fn burn_item(self: *Client, local_storage_addr: u32,
target_storage_addr: u32,
size0: u32,) bool {
var local = local_storage_addr;
var target = target_storage_addr;
var size = size0;
var cmd = [_]u8{0, 0, 0, 0, 0 };
while (size > 0) {
const block = if (size >= PAGE_SIZE) PAGE_SIZE else size;
if (self.ecc_keys) |keys| {
@memcpy(@ptrCast([*c] u8, &keys.page_buffer[0]), @intToPtr([*c] u8, local), block);
self.ecc_driver.?.sign.?(&self.ecc_driver.?.session_sk[0], &keys.page_buffer[0], @intCast(c_int, block), &keys.page_end_cmd[5]);
self.encrypt(&keys.page_buffer[0], block);
if (!self.burn_page(&keys.page_buffer[0], target, block, &keys.page_end_cmd[0], @sizeOf(@TypeOf(keys.page_end_cmd)))) return false;
} else {
if (!self.burn_page(@intToPtr([*c] u8, local), target, block, &cmd[0], @sizeOf(@TypeOf(cmd)))) return false;
}
local += block;
target += block;
size -= block;
}
return true;
}
fn burn_items(self: *Client, bitmap: u16, item_cnt: c_int, items: [*c] const ingble.ota_item_t) bool {
var index: usize = 0;
while (index < item_cnt) : (index += 1) {
if ((bitmap & (@as(u16, 1) << @intCast(u4, index))) == 0) continue;
if (enable_print) {
print("start new item: %d\n", index);
}
if (!self.burn_item(items[index].local_storage_addr,
items[index].target_storage_addr,
items[index].size)) return false;
}
return true;
}
fn prepare_meta_info(self: *Client, bitmap: u16, item_cnt: c_int, items: [*c] const ingble.ota_item_t, entry: u32,
data: *FullSigMeta) c_int {
_ = self;
var index: usize = 0;
var cnt: usize = 0;
data.entry = entry;
while (index < item_cnt) : (index += 1) {
if ((bitmap & (@as(u16, 1) << @intCast(u4, index))) == 0) continue;
data.blocks[cnt].src = items[index].target_storage_addr;
data.blocks[cnt].src = items[index].target_storage_addr;
data.blocks[cnt].dest = items[index].target_load_addr;
data.blocks[cnt].size = items[index].size;
cnt += 1;
}
return @intCast(c_int, cnt);
}
fn burn_meta(self: *Client, bitmap: u16, item_cnt: c_int, items: [*c] const ingble.ota_item_t, entry: u32) bool {
const cnt = self.prepare_meta_info(bitmap, item_cnt, items, entry, &self.sig_meta);
var total: c_int = undefined;
var p: [*c]u8 = undefined;
if (self.ecc_driver) |driver| {
driver.sign.?(&self.ecc_driver.?.session_sk[0], @ptrCast([*c] u8, &self.sig_meta.entry), @intCast(u16, cnt * 12 + 4),
&self.sig_meta.sig[0]);
self.encrypt(@ptrCast([*c] u8, &self.sig_meta.entry), @intCast(usize, cnt * 12 + 4));
total = @sizeOf(FullSigMeta) - ingble.MAX_UPDATE_BLOCKS * @sizeOf(ingble.fota_update_block_t) +cnt * 12;
p = @ptrCast([*c] u8, &self.sig_meta);
} else {
p = &self.sig_meta.sig[63];
total = cnt * 12 + 4 + 2 + 1;
}
p[0] = ingble.OTA_CTRL_METADATA;
self.sig_meta.crc_value = rom_crc.?(@ptrCast([*c] u8, &self.sig_meta.entry), @intCast(u16, cnt * 12 + 4));
_ = self.write_cmd2(@intCast(usize, total), p);
return self.check_status();
}
pub fn update(self: *Client, optional_latest: ?*const ingble.ota_ver_t,
conn_handle: u16,
handle_ver: u16, handle_ctrl: u16, handle_data: u16, handle_pk: u16,
item_cnt: c_int, items: [*c] const ingble.ota_item_t,
entry: u32,
driver: ?*ingble.ecc_driver_t) c_int {
self.conn_handle = conn_handle;
self.handle_ver = handle_ver;
self.handle_ctrl = handle_ctrl;
self.handle_data = handle_data;
self.handle_pk = handle_pk;
self.ecc_driver = driver;
if (item_cnt > ingble.MAX_UPDATE_BLOCKS) return -127;
_ = ingble.gatt_client_get_mtu(conn_handle, &self.mtu);
self.mtu -= 3;
defer {
if (self.ecc_keys) |keys| self.ecc_driver.?.free.?(keys);
}
if (self.ecc_driver) |a_driver| {
var value_size: u16 = 0;
const value = gatt.value_of_characteristic_reader.read(conn_handle, handle_pk, &value_size) orelse return -20;
if (value_size != PK_SIZE) return -21;
self.ecc_keys = @ptrCast(*EccKeys, a_driver.alloc.?(@sizeOf(EccKeys)) orelse return -22);
@memcpy(@ptrCast([*]u8, &self.ecc_keys.?.peer_pk[0]), value, PK_SIZE);
var buf = @ptrCast([*c]u8, a_driver.alloc.?(PK_SIZE * 2));
defer self.ecc_driver.?.free.?(buf);
@memcpy(@ptrCast([*]u8, &buf[0]), a_driver.session_pk, PK_SIZE);
a_driver.sign.?(a_driver.root_sk, a_driver.session_pk, PK_SIZE, &buf[PK_SIZE]);
if (0 != ingble.gatt_client_write_value_of_characteristic_without_response(conn_handle, handle_pk, PK_SIZE * 2, &buf[0])) return -24;
if (self.read_status() == ingble.OTA_STATUS_ERROR)
return -25;
a_driver.shared_secret.?(&a_driver.session_sk[0], &self.ecc_keys.?.peer_pk[0], &self.ecc_keys.?.dh_sk[0]);
a_driver.sha_256.?(&self.ecc_keys.?.xor_sk[0], &self.ecc_keys.?.dh_sk[0], @sizeOf(@TypeOf(self.ecc_keys.?.dh_sk)));
}
const bitmap = ((@intCast(u16, 1) << @intCast(u4, item_cnt)) - 1) & (fota_make_bitmap(self, optional_latest) orelse return -1);
if (bitmap == 0) return 1;
if (enable_print) {
print("update bitmap: %02x\n", bitmap);
}
if (!self.enable_fota()) return -2;
if (!self.burn_items(bitmap, item_cnt, items)) return -3;
if (!self.burn_meta(bitmap, item_cnt, items, entry)) return -4;
if (!self.reboot()) return -5;
return 0;
}
};
fn fota_client_do_update_async(optional_latest: ?*const ingble.ota_ver_t,
conn_handle: u16,
handle_ver: u16, handle_ctrl: u16, handle_data: u16,
handle_pk: u16,
item_cnt: c_int, items: [*c] const ingble.ota_item_t,
entry: u32,
on_done: fn (err_code: c_int) callconv(.C) void,
driver: ?*ingble.ecc_driver_t) void {
var client: Client = undefined;
on_done(client.update(optional_latest, conn_handle, handle_ver, handle_ctrl, handle_data, handle_pk,
item_cnt, items, entry, driver));
}
var fota_frame: @Frame(fota_client_do_update_async) = undefined;
export fn fota_client_do_update(optional_latest: ?*const ingble.ota_ver_t,
conn_handle: u16,
handle_ver: u16, handle_ctrl: u16, handle_data: u16,
item_cnt: c_int, items: [*c] const ingble.ota_item_t,
entry: u32,
on_done: fn (err_code: c_int) callconv(.C) void) void {
fota_frame = async fota_client_do_update_async(optional_latest, conn_handle,
handle_ver, handle_ctrl, handle_data, 0xffff,
item_cnt, items, entry, on_done,
null);
}
export fn secure_fota_client_do_update(optional_latest: ?*const ingble.ota_ver_t,
conn_handle: u16,
handle_ver: u16, handle_ctrl: u16, handle_data: u16, handle_pk: u16,
item_cnt: c_int, items: [*c] const ingble.ota_item_t,
entry: u32,
on_done: fn (err_code: c_int) callconv(.C) void,
driver: *ingble.ecc_driver_t) void {
fota_frame = async fota_client_do_update_async(optional_latest, conn_handle,
handle_ver, handle_ctrl, handle_data, handle_pk,
item_cnt, items, entry, on_done,
driver);
}
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn {
_ = stack_trace;
print("\n!KERNEL PANIC!\n");
for (message) |value| {
print("%c", value);
}
ingble.platform_raise_assertion("panic", 0);
while (true) {}
} | examples-gcc/central_fota/src/fota_client.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = true;
const assert = std.debug.assert;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
pub fn main() anyerror!void {
const stdout = std.io.getStdOut().writer();
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
const limit = 1 * 1024 * 1024 * 1024;
const text = try std.fs.cwd().readFileAlloc(allocator, "day16.txt", limit);
defer allocator.free(text);
const Move = union(enum) {
s: u4,
x: struct {
a: u4,
b: u4,
},
p: struct {
a: u8,
b: u8,
},
};
var dance0: [10000]Move = undefined;
const dance = blk: {
var len: usize = 0;
var it = std.mem.tokenize(u8, text, ", \n\r");
while (it.next()) |move| {
if (tools.match_pattern("s{}", move)) |vals| {
const a = @intCast(u4, vals[0].imm);
dance0[len] = Move{ .s = a };
len += 1;
} else if (tools.match_pattern("x{}/{}", move)) |vals| {
const a = @intCast(u4, vals[0].imm);
const b = @intCast(u4, vals[1].imm);
dance0[len] = Move{ .x = .{ .a = a, .b = b } };
len += 1;
} else if (tools.match_pattern("p{}/{}", move)) |vals| {
const d1 = vals[0].name[0];
const d2 = vals[1].name[0];
dance0[len] = Move{ .p = .{ .a = d1, .b = d2 } };
len += 1;
} else {
unreachable;
}
}
break :blk dance0[0..len];
};
trace("the dance is {} moves long\n", .{dance.len});
var dancers: [16]u8 = undefined;
std.mem.copy(u8, &dancers, "abcdefghijklmnop");
var positions = [16]u4{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
var positions1 = [16]u4{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
var prevmap = std.AutoHashMap([16]u8, usize).init(arena.allocator());
_ = try prevmap.put(dancers, 0);
var round: usize = 1;
while (round < 1000000000) : (round += 1) {
for (dance) |m| {
switch (m) {
.s => |s| {
std.mem.rotate(u8, &dancers, dancers.len - s);
{
for (positions) |*pos| {
pos.* +%= s;
}
}
},
.x => |x| {
const a = dancers[x.a];
const b = dancers[x.b];
dancers[x.b] = a;
dancers[x.a] = b;
{
for (positions) |*p| {
if (p.* == x.a) {
p.* = x.b;
} else if (p.* == x.b) {
p.* = x.a;
}
}
}
},
.p => |p| {
for (dancers) |*d| {
if (d.* == p.a) {
d.* = p.b;
} else if (d.* == p.b) {
d.* = p.a;
}
}
{
const p1 = positions[p.a - 'a'];
const p2 = positions[p.b - 'a'];
positions[p.a - 'a'] = p2;
positions[p.b - 'a'] = p1;
}
},
}
if (round == 1) {
std.mem.copy(u4, &positions1, &positions);
}
assert(dancers[positions['a' - 'a']] == 'a' and dancers[positions['b' - 'a']] == 'b');
}
if (false) {
assert(dancers[positions['a' - 'a']] == 'a' and dancers[positions['b' - 'a']] == 'b');
trace("postions^{}= [", .{round});
for (positions) |pos| {
trace("{}, ", .{pos});
}
trace("]\n", .{});
}
if (false) {
var composed = [16]u4{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
var i: usize = 0;
while (i < round) : (i += 1) {
for (composed) |*c| {
c.* = positions1[c.*];
}
}
trace("composed^{}= [", .{round});
for (composed) |pos| {
trace("{}, ", .{pos});
}
trace("]\n", .{});
assert(dancers[composed['a' - 'a']] == 'a' and dancers[composed['b' - 'a']] == 'b');
}
if (try prevmap.put(dancers, round)) |kv| {
const perdiod = round - kv.value;
trace("period={}\n", .{perdiod});
if (1000000000 % perdiod == round % perdiod) {
break;
}
}
trace("order={}\n", .{dancers});
}
try stdout.print("order={}\n", .{dancers});
} | 2017/day16.zig |
const clap = @import("clap");
const format = @import("format");
const std = @import("std");
const ston = @import("ston");
const util = @import("util");
const debug = std.debug;
const fmt = std.fmt;
const fs = std.fs;
const heap = std.heap;
const io = std.io;
const log = std.log;
const math = std.math;
const mem = std.mem;
const os = std.os;
const rand = std.rand;
const testing = std.testing;
const Program = @This();
allocator: mem.Allocator,
options: struct {
seed: u64,
evolutions: usize,
pick_lowest: bool,
},
pokedex: Set = Set{},
starters: Starters = Starters{},
pokemons: Pokemons = Pokemons{},
evolves_from: Evolutions = Evolutions{},
evolves_to: Evolutions = Evolutions{},
pub const main = util.generateMain(Program);
pub const version = "0.0.0";
pub const description =
\\Randomizes starter Pokémons.
\\
;
pub const params = &[_]clap.Param(clap.Help){
clap.parseParam("-e, --evolutions <INT> Only pick starters with NUM or more evolutions. (default: 0) ") catch unreachable,
clap.parseParam("-h, --help Display this help text and exit. ") catch unreachable,
clap.parseParam("-l, --pick-lowest-evolution Always pick the lowest evolution of a starter. ") catch unreachable,
clap.parseParam("-s, --seed <INT> The seed to use for random numbers. A random seed will be picked if this is not specified.") catch unreachable,
clap.parseParam("-v, --version Output version information and exit. ") catch unreachable,
};
pub fn init(allocator: mem.Allocator, args: anytype) !Program {
const evolutions = if (args.option("--evolutions")) |evos|
fmt.parseUnsigned(usize, evos, 10) catch |err| {
log.err("'{s}' could not be parsed as a number to --evolutions: {}", .{ evos, err });
return error.InvalidArgument;
}
else
0;
return Program{
.allocator = allocator,
.options = .{
.seed = try util.args.seed(args),
.pick_lowest = args.flag("--pick-lowest-evolution"),
.evolutions = evolutions,
},
};
}
pub fn run(
program: *Program,
comptime Reader: type,
comptime Writer: type,
stdio: util.CustomStdIoStreams(Reader, Writer),
) anyerror!void {
try format.io(program.allocator, stdio.in, stdio.out, program, useGame);
try program.randomize();
try program.output(stdio.out);
}
fn output(program: *Program, writer: anytype) !void {
try ston.serialize(writer, .{ .starters = program.starters });
}
fn randomize(program: *Program) !void {
const random = rand.DefaultPrng.init(program.options.seed).random();
const pick_from = try program.getStartersToPickFrom();
const starters = program.starters.values();
for (starters) |*starter, i| while (true) {
starter.* = util.random.item(random, pick_from.keys()).?.*;
// Prevent duplicates if possible. We cannot prevent it if we have less pokemon to pick
// from than there is starters
if (pick_from.count() < starters.len)
break;
if (mem.indexOfScalar(u16, starters[0..i], starter.*) == null)
break;
};
}
fn getStartersToPickFrom(program: *Program) !Set {
const allocator = program.allocator;
const dex_mons = try pokedexPokemons(allocator, program.pokemons, program.pokedex);
var res = Set{};
for (dex_mons.keys()) |species| {
// Only pick lowest evo species if pick_lowest is true
if (program.options.pick_lowest and program.evolves_from.get(species) != null)
continue;
if (countEvos(program.evolves_to, species) < program.options.evolutions)
continue;
_ = try res.put(allocator, species, {});
}
if (res.count() == 0)
_ = try res.put(allocator, 0, {});
return res;
}
fn useGame(program: *Program, parsed: format.Game) !void {
const allocator = program.allocator;
switch (parsed) {
.pokedex => |pokedex| {
_ = try program.pokedex.put(allocator, pokedex.index, {});
return error.DidNotConsumeData;
},
.starters => |starters| {
_ = try program.starters.put(allocator, starters.index, starters.value);
return;
},
.pokemons => |pokemons| {
const evolves_from = pokemons.index;
const pokemon = (try program.pokemons.getOrPutValue(allocator, evolves_from, .{}))
.value_ptr;
switch (pokemons.value) {
.catch_rate => |catch_rate| pokemon.catch_rate = catch_rate,
.pokedex_entry => |pokedex_entry| pokemon.pokedex_entry = pokedex_entry,
.evos => |evos| switch (evos.value) {
.target => |evolves_to| {
const from_set = (try program.evolves_from.getOrPutValue(
allocator,
evolves_to,
.{},
)).value_ptr;
const to_set = (try program.evolves_to.getOrPutValue(
allocator,
evolves_from,
.{},
)).value_ptr;
_ = try program.pokemons.getOrPutValue(allocator, evolves_to, .{});
_ = try from_set.put(allocator, evolves_from, {});
_ = try to_set.put(allocator, evolves_to, {});
},
.param,
.method,
=> return error.DidNotConsumeData,
},
.stats,
.types,
.base_exp_yield,
.ev_yield,
.items,
.gender_ratio,
.egg_cycles,
.base_friendship,
.growth_rate,
.egg_groups,
.abilities,
.color,
.moves,
.tms,
.hms,
.name,
=> return error.DidNotConsumeData,
}
return error.DidNotConsumeData;
},
.version,
.game_title,
.gamecode,
.instant_text,
.text_delays,
.trainers,
.moves,
.abilities,
.types,
.tms,
.hms,
.items,
.maps,
.wild_pokemons,
.static_pokemons,
.given_pokemons,
.pokeball_items,
.hidden_hollows,
.text,
=> return error.DidNotConsumeData,
}
unreachable;
}
fn countEvos(evolves_to: Evolutions, pokemon: u16) usize {
var res: usize = 0;
const evolutions = evolves_to.get(pokemon) orelse return 0;
// TODO: We don't handle cycles here.
for (evolutions.keys()) |evo| {
const evos = countEvos(evolves_to, evo) + 1;
res = math.max(res, evos);
}
return res;
}
const Evolutions = std.AutoArrayHashMapUnmanaged(u16, Set);
const Pokemons = std.AutoArrayHashMapUnmanaged(u16, Pokemon);
const Set = std.AutoArrayHashMapUnmanaged(u16, void);
const Starters = std.AutoArrayHashMapUnmanaged(u16, u16);
fn pokedexPokemons(allocator: mem.Allocator, pokemons: Pokemons, pokedex: Set) !Set {
var res = Set{};
errdefer res.deinit(allocator);
for (pokemons.values()) |pokemon, i| {
const species = pokemons.keys()[i];
if (pokemon.catch_rate == 0)
continue;
if (pokedex.get(pokemon.pokedex_entry) == null)
continue;
_ = try res.put(allocator, species, {});
}
return res;
}
const Pokemon = struct {
pokedex_entry: u16 = math.maxInt(u16),
catch_rate: usize = 1,
};
test "tm35-rand-starters" {
const result_prefix =
\\.pokemons[0].pokedex_entry=0
\\.pokemons[0].evos[0].target=1
\\.pokemons[1].pokedex_entry=1
\\.pokemons[1].evos[0].target=2
\\.pokemons[2].pokedex_entry=2
\\.pokemons[3].pokedex_entry=3
\\.pokemons[3].evos[0].target=4
\\.pokemons[4].pokedex_entry=4
\\.pokemons[5].pokedex_entry=5
\\.pokedex[0].height=0
\\.pokedex[1].height=0
\\.pokedex[2].height=0
\\.pokedex[3].height=0
\\.pokedex[4].height=0
\\.pokedex[5].height=0
\\
;
const test_string = result_prefix ++
\\.starters[0]=0
\\.starters[1]=0
\\.starters[2]=0
\\
;
try util.testing.testProgram(Program, &[_][]const u8{"--seed=1"}, test_string, result_prefix ++
\\.starters[0]=4
\\.starters[1]=0
\\.starters[2]=1
\\
);
try util.testing.testProgram(Program, &[_][]const u8{ "--seed=1", "--pick-lowest-evolution" }, test_string, result_prefix ++
\\.starters[0]=5
\\.starters[1]=0
\\.starters[2]=3
\\
);
try util.testing.testProgram(Program, &[_][]const u8{ "--seed=1", "--evolutions=1" }, test_string, result_prefix ++
\\.starters[0]=3
\\.starters[1]=0
\\.starters[2]=1
\\
);
try util.testing.testProgram(Program, &[_][]const u8{ "--seed=1", "--evolutions=2" }, test_string, result_prefix ++
\\.starters[0]=0
\\.starters[1]=0
\\.starters[2]=0
\\
);
} | src/randomizers/tm35-rand-starters.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const Connection = @import("connection.zig").Connection;
const c = @import("c.zig");
const unionInitEnum = @import("util.zig").unionInitEnum;
const odbc = @import("types.zig");
const SqlReturn = odbc.SqlReturn;
const odbc_error = @import("error.zig");
const SqlState = odbc_error.SqlState;
const ReturnError = odbc_error.ReturnError;
const LastError = odbc_error.LastError;
pub const StatementInitError = LastError || error{InvalidHandle};
pub const Statement = struct {
pub const Attribute = odbc.StatementAttribute;
pub const AttributeValue = odbc.StatementAttributeValue;
handle: *anyopaque,
/// Allocate a new statement handle, using the provided connection as the parent.
pub fn init(connection: Connection) StatementInitError!Statement {
var result: Statement = undefined;
const alloc_result = c.SQLAllocHandle(@enumToInt(odbc.HandleType.Statement), connection.handle, @ptrCast([*c]?*anyopaque, &result.handle));
return switch (@intToEnum(SqlReturn, alloc_result)) {
.Success, .SuccessWithInfo => result,
.InvalidHandle => StatementInitError.InvalidHandle,
else => connection.getLastError(),
};
}
/// Free this statement handle. If this is successful then the statement object becomes invalidated and
/// should no longer be used.
pub fn deinit(self: *Statement) LastError!void {
const result = c.SQLFreeHandle(@enumToInt(odbc.HandleType.Statement), self.handle);
return switch (@intToEnum(SqlReturn, result)) {
.Success => {},
.InvalidHandle => @panic("Statement.deinit passed invalid handle"),
else => self.getLastError(),
};
}
/// Bind a buffer to a column in the statement result set. Once columns have been bound and a result set created by calling `execute`, `executeDirect`, or any
/// other function that creates a result set, `fetch` or `fetchDirect` can be used to put data into the bound buffers.
/// * column_number - The column to bind. Column numbers start at 1
/// * target_type - The C data type of the buffer.
/// * target_buffer - The buffer that data will be put into.
/// * str_len_or_ind_ptr - An indicator value that will later be used to determine the length of data put into `target_buffer`.
pub fn bindColumn(self: *Statement, column_number: u16, target_type: odbc.CType, target_buffer: anytype, str_len_or_ind_ptr: [*]c_longlong, column_size: ?usize) LastError!void {
const BufferInfo = @typeInfo(@TypeOf(target_buffer));
comptime {
switch (BufferInfo) {
.Pointer => switch (BufferInfo.Pointer.size) {
.Slice => {},
else => @compileError("Expected a slice for parameter target_buffer, got " ++ @typeName(@TypeOf(target_buffer))),
},
else => @compileError("Expected a slice for parameter target_buffer, got " ++ @typeName(@TypeOf(target_buffer))),
}
}
const result = c.SQLBindCol(self.handle, column_number, @enumToInt(target_type), @ptrCast(?*anyopaque, target_buffer.ptr), @intCast(c_longlong, column_size orelse target_buffer.len * @sizeOf(BufferInfo.Pointer.child)), str_len_or_ind_ptr);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.bindColumn passed invalid handle"),
else => self.getLastError(),
};
}
/// Bind a value to a parameter marker in a SQL statement.
/// * parameter_number: The parameter to bind. Parameter numbers start at 1
/// * io_type: The parameter type. Roughly speaking, parameters can be **input** params, where the application puts data into the parameter, or **output** params,
/// where the driver will put data into the buffer after evaluated the statement.
/// * value_type: The C type of the parameter data.
/// * parameter_type: The SQL type of the parameter in the statement
/// * value: A pointer to a value to bind. If `io_type` is an output type, this pointer will contain the result of getting param data after execution.
/// * decimal_digits: The number of digits to use for floating point numbers. `null` for other data types.
/// * str_len_or_ind_ptr: A pointer to a value describing the parameter's length.
// pub fn bindParameter(self: *Statement, parameter_number: u16, io_type: odbc.InputOutputType, comptime value_type: odbc.CType, parameter_type: odbc.SqlType, value: *value_type.toType(), decimal_digits: ?u16, str_len_or_ind_ptr: *c.SQLLEN) ReturnError!void {
pub fn bindParameter(self: *Statement, parameter_number: u16, io_type: odbc.InputOutputType, value_type: odbc.CType, parameter_type: odbc.SqlType, value: *anyopaque, decimal_digits: ?u16, str_len_or_ind_ptr: *c.SQLLEN) LastError!void {
const result = c.SQLBindParameter(self.handle, parameter_number, @enumToInt(io_type), @enumToInt(value_type), @enumToInt(parameter_type), @sizeOf(@TypeOf(value)), @intCast(c.SQLSMALLINT, decimal_digits orelse 0), value, @sizeOf(@TypeOf(value)), str_len_or_ind_ptr);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.bindParameter passed invalid handle"),
else => self.getLastError(),
};
}
pub fn bulkOperations(self: *Statement, operation: odbc.BulkOperation) LastError!void {
const result = c.SQLBulkOperations(self.handle, @enumToInt(operation));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.bulkOperations passed invalid handle"),
else => self.getLastError(),
};
}
pub fn cancel(self: *Statement) LastError!void {
const result = c.SQLCancel(self.handle);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.cancel passed invalid handle"),
else => self.getLastError(),
};
}
pub fn closeCursor(self: *Statement) LastError!void {
const result = c.SQLCloseCursor(self.handle);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.closeCursor passed invalid handle"),
else => self.getLastError(),
};
}
pub fn columnPrivileges(self: *Statement, catalog_name: []const u8, schema_name: []const u8, table_name: []const u8, column_name: []const u8) !void {
const result = c.SQLColumnPrivileges(self.handle, catalog_name.ptr, @intCast(u16, catalog_name.len), schema_name.ptr, @intCast(u16, schema_name.len), table_name.ptr, @intCast(u16, table_name.len), column_name.ptr, @intCast(u16, column_name.len));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.columnPrivileges returned invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn columns(self: *Statement, catalog_name: ?[]const u8, schema_name: ?[]const u8, table_name: []const u8, column_name: ?[]const u8) !void {
const result = c.SQLColumns(self.handle, if (catalog_name) |cn| @intToPtr([*c]u8, @ptrToInt(cn.ptr)) else null, if (catalog_name) |cn| @intCast(c_short, cn.len) else 0, if (schema_name) |sn| @intToPtr([*c]u8, @ptrToInt(sn.ptr)) else null, if (schema_name) |sn| @intCast(c_short, sn.len) else 0, @intToPtr([*c]u8, @ptrToInt(table_name.ptr)), @intCast(c_short, table_name.len), if (column_name) |cn| @intToPtr([*c]u8, @ptrToInt(cn.ptr)) else null, if (column_name) |cn| @intCast(c_short, cn.len) else 0);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.columns passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn getColumnAttribute(self: *Statement, allocator: Allocator, column_number: usize, comptime attr: odbc.ColumnAttribute) !odbc.ColumnAttributeValue {
var string_attr_length: c_short = 0;
// First call to get the length of the string required to hold the string attribute value, if applicable
_ = c.SQLColAttribute(self.handle, @intCast(c_ushort, column_number), @enumToInt(attr), null, 0, &string_attr_length, null);
var string_attr: [:0]u8 = try allocator.allocSentinel(u8, @intCast(usize, string_attr_length), 0);
errdefer allocator.free(string_attr);
var numeric_attribute: c_longlong = 0;
const result = c.SQLColAttribute(self.handle, @intCast(c_ushort, column_number), @enumToInt(attr), string_attr.ptr, string_attr_length + 1, &string_attr_length, &numeric_attribute);
if (string_attr_length == 0) {
allocator.free(string_attr);
}
switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {
return unionInitEnum(odbc.ColumnAttributeValue, attr, switch (attr) {
.AutoUniqueValue => numeric_attribute == c.SQL_TRUE,
.BaseColumnName => string_attr[0..@intCast(usize, string_attr_length)],
.BaseTableName => string_attr,
.CaseSensitive => numeric_attribute == c.SQL_TRUE,
.CatalogName => string_attr,
.ConciseType => @intToEnum(odbc.SqlType, numeric_attribute),
.Count => numeric_attribute,
.DisplaySize => numeric_attribute,
.FixedPrecisionScale => numeric_attribute,
.Label => string_attr,
.Length => numeric_attribute,
.LiteralPrefix => string_attr,
.LiteralSuffix => string_attr,
.LocalTypeName => string_attr,
.Name => string_attr,
.Nullable => @intToEnum(odbc.ColumnAttributeValue.Nullable, numeric_attribute),
.NumericPrecisionRadix => numeric_attribute,
.OctetLength => numeric_attribute,
.Precision => numeric_attribute,
.Scale => numeric_attribute,
.SchemaName => string_attr,
.Searchable => @intToEnum(odbc.ColumnAttributeValue.Searchable, numeric_attribute),
.TableName => string_attr,
.Type => @intToEnum(odbc.SqlType, @intCast(c_short, numeric_attribute)),
.TypeName => string_attr,
.Unnamed => numeric_attribute == c.SQL_NAMED,
.Unsigned => numeric_attribute == c.SQL_TRUE,
.Updatable => @intToEnum(odbc.ColumnAttributeValue.Updatable, numeric_attribute),
});
},
.InvalidHandle => @panic("Statement.getColumnAttribute passed invalid handle"),
.StillExecuting => return ReturnError.StillExecuting,
else => return ReturnError.Error,
}
}
pub fn describeColumn(self: *Statement, allocator: Allocator, column_number: c_ushort) !odbc.ColumnDescriptor {
var column_desc: odbc.ColumnDescriptor = undefined;
var name_length: c_short = 0;
_ = c.SQLDescribeCol(self.handle, column_number, null, 0, &name_length, null, null, null, null);
column_desc.name = try allocator.allocSentinel(u8, name_length, 0);
const result = c.SQLDescribeCol(self.handle, column_number, column_desc.name.ptr, name_length + 1, &name_length, @ptrCast(*odbc.SQLSMALLINT, &column_desc.data_type), &column_desc.size, &column_desc.decimal_digits, @ptrCast(*odbc.SQLSMALLINT, &column_desc.nullable));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => column_desc,
.InvalidHandle => @panic("Statement.describeColumn passed invalid handle"),
.StillExecuting => ReturnError.StillExecuting,
else => ReturnError.Error,
};
}
pub fn describeParameter(self: *Statement, parameter_number: c_ushort) ReturnError!odbc.ParameterDescriptor {
var param_desc: odbc.ParameterDescriptor = undefined;
const result = c.SQLDescribeParam(self.handle, parameter_number, @ptrCast(*odbc.SQLSMALLINT, ¶m_desc.data_type), ¶m_desc.size, ¶m_desc.decimal_digits, @ptrCast(*odbc.SQLSMALLINT, ¶m_desc.nullable));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => param_desc,
.InvalidHandle => @panic("Statement.describeColumn passed invalid handle"),
.StillExecuting => ReturnError.StillExecuting,
else => ReturnError.Error,
};
}
/// Prepare a SQL statement for execution.
pub fn prepare(self: *Statement, sql_statement: []const u8) !void {
const result = c.SQLPrepare(self.handle, @intToPtr([*]u8, @ptrToInt(sql_statement.ptr)), @intCast(c.SQLINTEGER, sql_statement.len));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.prepare passed invalid handle"),
else => self.getLastError(),
};
}
/// Execute a prepared SQL statement.
pub fn execute(self: *Statement) odbc_error.LastError!void {
const result = c.SQLExecute(self.handle);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.execute passed invalid handle"),
else => self.getLastError(),
};
}
/// Execute a SQL statement directly. This is the fastest way to execute a SQL statement once.
pub fn executeDirect(self: *Statement, statement_text: []const u8) !void {
const result = c.SQLExecDirect(self.handle, @intToPtr([*c]u8, @ptrToInt(statement_text.ptr)), @intCast(c.SQLINTEGER, statement_text.len));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.executeDirect passed invalid handle"),
else => self.getLastError(),
};
}
/// Fetch the next rowset of data from the result set and return data in all bound columns.
pub fn fetch(self: *Statement) !bool {
const result = c.SQLFetch(self.handle);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => true,
.InvalidHandle => @panic("Statement.fetch passed invalid handle"),
.StillExecuting => ReturnError.StillExecuting,
.NoData => false,
else => self.getLastError(),
};
}
/// Fetch a specified rowset of data from the result set and return data in all bound columns. Rowsets
/// can be specified at an absolute position, relative position, or by bookmark.
pub fn fetchScroll(self: *Statement, orientation: odbc.FetchOrientation, offset: usize) !bool {
const result = c.SQLFetchScroll(self.handle, @enumToInt(orientation), @intCast(c_longlong, offset));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => true,
.InvalidHandle => @panic("Statement.fetchScroll passed invalid handle"),
.StillExecuting => ReturnError.StillExecuting,
.NoData => false,
else => self.getLastError(),
};
}
pub fn primaryKeys(self: *Statement, catalog_name: ?[]const u8, schema_name: ?[]const u8, table_name: []const u8) !void {
const result = c.SQLPrimaryKeys(self.handle, if (catalog_name) |cn| cn.ptr else null, if (catalog_name) |cn| cn.len else 0, if (schema_name) |sn| sn.ptr else null, if (schema_name) |sn| sn.len else 0, table_name.ptr, table_name.len);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.primaryKeys passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn foreignKeys(self: *Statement, pk_catalog_name: ?[]const u8, pk_schema_name: ?[]const u8, pk_table_name: ?[]const u8, fk_catalog_name: ?[]const u8, fk_schema_name: ?[]const u8, fk_table_name: ?[]const u8) !void {
const result = c.SQLForeignKeys(
self.handle,
if (pk_catalog_name) |cn| cn.ptr else null,
if (pk_catalog_name) |cn| cn.len else 0,
if (pk_schema_name) |sn| sn.ptr else null,
if (pk_schema_name) |sn| sn.len else 0,
if (pk_table_name) |tn| tn.ptr else null,
if (pk_table_name) |tn| tn.len else 0,
if (fk_catalog_name) |cn| cn.ptr else null,
if (fk_catalog_name) |cn| cn.len else 0,
if (fk_schema_name) |sn| sn.ptr else null,
if (fk_schema_name) |sn| sn.len else 0,
if (fk_table_name) |tn| tn.ptr else null,
if (fk_table_name) |tn| tn.len else 0,
);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.foreignKeys passed invalid handle"),
.StillExecuting => ReturnError.StillExecuting,
else => self.getLastError(),
};
}
pub fn getCursorName(self: *Statement, allocator: Allocator) ![]const u8 {
var name_length: c_short = 0;
_ = c.SQLGetCursorName(self.handle, null, 0, &name_length);
var name_buffer = try allocator.allocSentinel(u8, name_length, 0);
errdefer allocator.free(name_buffer);
const result = c.SQLGetCursorName(self.handle, name_buffer.ptr, @intCast(c_short, name_buffer.len), &name_length);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => name_buffer,
.InvalidHandle => @panic("Statement.getCursorName passed invalid handle"),
else => self.getLastError(),
};
}
pub fn getData(self: *Statement, allocator: Allocator, column_number: usize, comptime target_type: odbc.CType) !?target_type.toType() {
var result_data = try std.ArrayList(u8).initCapacity(allocator, 500);
errdefer result_data.deinit();
var target_buffer: [500]u8 = undefined;
var bytes_retrieved: c_longlong = 0;
fetch_loop: while (true) {
const result = c.SQLGetData(self.handle, @intCast(c_ushort, column_number), @enumToInt(target_type), @ptrCast([*c]anyopaque, target_buffer.ptr), @intCast(c_longlong, target_buffer.len), &bytes_retrieved);
const result_type = @intToEnum(SqlReturn, result);
switch (result_type) {
.Success, .SuccessWithInfo, .NoData => {
switch (bytes_retrieved) {
c.SQL_NULL_DATA, c.SQL_NO_TOTAL => return null,
else => {
try result_data.appendSlice(target_buffer[0..bytes_retrieved]);
if (result_type == .SuccessWithInfo) {
// SuccessWithInfo might indicate that only part of the column was retrieved, and in that case we need to
// continue fetching the rest of it. If we're getting long data, SQLGetData will return NoData
var error_buffer: [@sizeOf(odbc_error.SqlState) * 3]u8 = undefined;
var fba = std.heap.FixedBufferAllocator.init(error_buffer);
const errors = try self.getErrors(&fba.allocator);
for (errors) |err| if (err == .StringRightTrunc) {
// SQLGetData will terminate long data with a null byte, so we have to remove it before the next fetch
_ = result_data.pop();
continue :fetch_loop;
};
// If the error wasn't StringRightTrunc then it's not something that needs to be handled differently than
// Success
}
const data = result_data.toOwnedSlice();
defer if (!target_type.isSlice()) allocator.free(data);
return std.mem.bytesToValue(target_type.toType(), data);
},
}
},
.InvalidHandle => @panic("Statement.getData passed invalid handle"),
.StillExecuting => return ReturnError.StillExecuting,
else => return self.getLastError(),
}
}
}
pub fn getAttribute(self: *Statement, attr: Attribute) !AttributeValue {
var result_buffer: [100]u8 = undefined;
var string_length_result: u32 = 0;
const result = c.SQLGetStmtAttr(self.handle, @enumToInt(attr), @ptrCast(*anyopaque, &result_buffer), @intCast(u32, result_buffer.len), @ptrCast([*c]c_long, &string_length_result));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => attr.getValue(result_buffer[0..]),
.InvalidHandle => @panic("Statement.getAttribute passed invalid handle"),
else => self.getLastError(),
};
}
pub fn setAttribute(self: *Statement, attr_value: AttributeValue) !void {
const result = switch (attr_value) {
.ParamOperationPointer => |v| c.SQLSetStmtAttr(self.handle, @enumToInt(Attribute.ParamOperationPointer), @ptrCast([*]std.meta.Tag(AttributeValue.ParamOperation), v), 0),
.ParamStatusPointer => |v| c.SQLSetStmtAttr(self.handle, @enumToInt(Attribute.ParamStatusPointer), @ptrCast([*]std.meta.Tag(AttributeValue.ParamStatus), v), 0),
.RowOperationPointer => |v| c.SQLSetStmtAttr(self.handle, @enumToInt(Attribute.RowOperationPointer), @ptrCast([*]std.meta.Tag(AttributeValue.RowOperation), v), 0),
.RowStatusPointer => |v| c.SQLSetStmtAttr(self.handle, @enumToInt(Attribute.RowStatusPointer), @ptrCast([*]std.meta.Tag(AttributeValue.RowStatus), v), 0),
else => blk: {
var buffer: [100]u8 = undefined;
var fba = std.heap.FixedBufferAllocator.init(buffer[0..]);
_ = try attr_value.valueAsBytes(fba.allocator());
const int_value = std.mem.bytesAsValue(u64, buffer[0..@sizeOf(u64)]);
break :blk c.SQLSetStmtAttr(self.handle, @enumToInt(std.meta.activeTag(attr_value)), @intToPtr(?*anyopaque, @intCast(usize, int_value.*)), 0);
},
};
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.setAttribute passed invalid handle"),
else => self.getLastError(),
};
}
pub fn getTypeInfo(self: *Statement, data_type: odbc.SqlType) !void {
const result = c.SQLGetTypeInfo(self.handle, @enumToInt(data_type));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.getTypeInfo passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn moreResults(self: *Statement) !void {
const result = c.SQLMoreResults(self.handle);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.moreResults passed invalid handle"),
else => self.getLastError(),
};
}
pub fn numParams(self: *Statement) !usize {
var num_params: c.SQLSMALLINT = 0;
const result = c.SQLNumParams(self.handle, &num_params);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => @intCast(usize, num_params),
.InvalidHandle => @panic("Statement.numParams passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
/// Get the number of columns in the current result set. If no result set was created, returns 0.
pub fn numResultColumns(self: *Statement) !usize {
var num_result_columns: c.SQLSMALLINT = 0;
const result = c.SQLNumResultCols(self.handle, &num_result_columns);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => @intCast(usize, num_result_columns),
.InvalidHandle => @panic("Statement.numResultColumns passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn paramData(self: *Statement, value_ptr: *anyopaque) !void {
const result = c.SQLParamData(self.handle, &value_ptr);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.paramData passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn procedureColumns(self: *Statement, catalog_name: ?[]const u8, schema_name: ?[]const u8, procedure_name: []const u8, column_name: []const u8) !void {
const result = c.SQLProcedureColumns(self.handle, if (catalog_name) |cn| cn.ptr else null, if (catalog_name) |cn| @intCast(c.SQLSMALLINT, cn.len) else 0, if (schema_name) |sn| sn.ptr else null, if (schema_name) |sn| @intCast(c.SQLSMALLINT, sn.len) else 0, procedure_name.ptr, @intCast(c.SQLSMALLINT, procedure_name.len), column_name.ptr, @intCast(c.SQLSMALLINT, column_name.len));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.procedureColumns passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
/// Return the list of procedure names in a data source.
pub fn procedures(self: *Statement, catalog_name: ?[]const u8, schema_name: ?[]const u8, procedure_name: []const u8) !void {
const result = c.SQLProcedures(self.handle, if (catalog_name) |cn| cn.ptr else null, if (catalog_name) |cn| @intCast(c.SQLSMALLINT, cn.len) else 0, if (schema_name) |sn| sn.ptr else null, if (schema_name) |sn| @intCast(c.SQLSMALLINT, sn.len) else 0, procedure_name.ptr, @intCast(c.SQLSMALLINT, procedure_name.len));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.procedures passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn putData(self: *Statement, data: anytype, str_len_or_ind_ptr: c_longlong) !void {
const result = c.SQLPutData(self.handle, @ptrCast([*c]anyopaque, &data), str_len_or_ind_ptr);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.putData passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
/// Get the number of rows affected by an UPDATE, INSERT, or DELETE statement.
pub fn rowCount(self: *Statement) !usize {
var row_count: c.SQLLEN = 0;
const result = c.SQLRowCount(self.handle, &row_count);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => @intCast(usize, row_count),
.InvalidHandle => @panic("Statement.rowCount passed invalid handle"),
else => self.getLastError(),
};
}
pub fn setCursorName(self: *Statement, cursor_name: []const u8) !void {
const result = c.SQLSetCursorName(self.handle, cursor_name.ptr, @intCast(c.SQLSMALLINT, cursor_name.len));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.setCursorName passed invalid handle"),
else => self.getLastError(),
};
}
pub fn setPos(self: *Statement, row_number: usize, operation: odbc.CursorOperation, lock_type: odbc.LockType) !void {
const result = c.SQLSetPos(self.handle, @intCast(c.SQLSETPOSIROW, row_number), @enumToInt(operation), @enumToInt(lock_type));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.setPos passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn specialColumns(self: *Statement, identifier_type: odbc.ColumnIdentifierType, catalog_name: ?[]const u8, schema_name: ?[]const u8, table_name: []const u8, row_id_scope: odbc.RowIdScope, nullable: odbc.Nullable) !void {
const result = c.SQLSpecialColumns(self.handle, @enumToInt(identifier_type), if (catalog_name) |cn| cn.ptr else null, if (catalog_name) |cn| @intCast(c.SQLSMALLINT, cn.len) else 0, if (schema_name) |sn| sn.ptr else null, if (schema_name) |sn| @intCast(c.SQLSMALLINT, sn.len) else 0, table_name.ptr, @intCast(c.SQLSMALLINT, table_name.len), @enumToInt(row_id_scope), @enumToInt(nullable));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.specialColumns passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn statistics(self: *Statement, catalog_name: ?[]const u8, schema_name: ?[]const u8, table_name: []const u8, unique: bool, reserved: odbc.Reserved) !void {
const result = c.SQLStatistics(self.handle, if (catalog_name) |cn| cn.ptr else null, if (catalog_name) |cn| @intCast(c.SQLSMALLINT, cn.len) else 0, if (schema_name) |sn| sn.ptr else null, if (schema_name) |sn| @intCast(c.SQLSMALLINT, sn.len) else 0, table_name.ptr, @intCast(c.SQLSMALLINT, table_name.len), if (unique) c.SQL_INDEX_UNIQUE else c.SQL_INDEX_ALL, @enumToInt(reserved));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.statistics passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn tablePrivileges(self: *Statement, catalog_name: ?[]const u8, schema_name: ?[]const u8, table_name: []const u8) !void {
const result = c.SQLTablePrivileges(self.handle, if (catalog_name) |cn| @intToPtr([*c]u8, @ptrToInt(cn.ptr)) else null, if (catalog_name) |cn| @intCast(c.SQLSMALLINT, cn.len) else 0, if (schema_name) |sn| @intToPtr([*c]u8, @ptrToInt(sn.ptr)) else null, if (schema_name) |sn| @intCast(c.SQLSMALLINT, sn.len) else 0, @intToPtr([*c]u8, @ptrToInt(table_name.ptr)), @intCast(c.SQLSMALLINT, table_name.len));
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.tablePrivileges passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn tables(self: *Statement, catalog_name: ?[]const u8, schema_name: ?[]const u8, table_name: ?[]const u8, table_type: ?[]const u8) !void {
const result = c.SQLTables(
self.handle,
if (catalog_name) |cn| @intToPtr([*c]u8, @ptrToInt(cn.ptr)) else null,
if (catalog_name) |cn| @intCast(c.SQLSMALLINT, cn.len) else 0,
if (schema_name) |sn| @intToPtr([*c]u8, @ptrToInt(sn.ptr)) else null,
if (schema_name) |sn| @intCast(c.SQLSMALLINT, sn.len) else 0,
if (table_name) |tn| @intToPtr([*c]u8, @ptrToInt(tn.ptr)) else null,
if (table_name) |tn| @intCast(c.SQLSMALLINT, tn.len) else 0,
if (table_type) |tt| @intToPtr([*c]u8, @ptrToInt(tt.ptr)) else null,
if (table_type) |tt| @intCast(c.SQLSMALLINT, tt.len) else 0,
);
return switch (@intToEnum(SqlReturn, result)) {
.Success, .SuccessWithInfo => {},
.InvalidHandle => @panic("Statement.tables passed invalid handle"),
.StillExecuting => error.StillExecuting,
else => self.getLastError(),
};
}
pub fn getAllCatalogs(self: *Statement) !void {
return try self.tables(c.SQL_ALL_CATALOGS, "", "", "");
}
pub fn getAllSchemas(self: *Statement) !void {
return try self.tables("", c.SQL_ALL_SCHEMAS, "", "");
}
pub fn getAllTableTypes(self: *Statement) !void {
return try self.tables("", "", "", c.SQL_ALL_TABLE_TYPES);
}
pub fn getLastError(self: *const Statement) odbc_error.LastError {
return odbc_error.getLastError(odbc.HandleType.Statement, self.handle);
}
pub fn getErrors(self: *Statement, allocator: Allocator) ![]odbc_error.SqlState {
return try odbc_error.getErrors(allocator, odbc.HandleType.Statement, self.handle);
}
pub fn getDiagnosticRecords(self: *Statement, allocator: Allocator) ![]odbc_error.DiagnosticRecord {
return try odbc_error.getDiagnosticRecords(allocator, odbc.HandleType.Statement, self.handle);
}
}; | src/statement.zig |
const assert = @import("std").debug.assert;
pub const DrawListSharedData = opaque {};
pub const Context = opaque {};
pub const DrawCallback = ?fn (parent_list: ?*const DrawList, cmd: ?*const DrawCmd) callconv(.C) void;
pub const DrawIdx = u16;
pub const ID = u32;
pub const InputTextCallback = ?fn (data: ?*InputTextCallbackData) callconv(.C) i32;
pub const SizeCallback = ?fn (data: ?*SizeCallbackData) callconv(.C) void;
pub const TextureID = ?*c_void;
pub const Wchar = u16;
pub const DrawCallback_ResetRenderState = @intToPtr(DrawCallback, ~@as(usize, 0));
pub const VERSION = "1.75";
pub fn CHECKVERSION() void {
if (@import("builtin").mode != .ReleaseFast) {
@import("std").debug.assert(raw.igDebugCheckVersionAndDataLayout(VERSION, @sizeOf(IO), @sizeOf(Style), @sizeOf(Vec2), @sizeOf(Vec4), @sizeOf(DrawVert), @sizeOf(DrawIdx)));
}
}
pub const FLT_MAX = @import("std").math.f32_max;
pub const FlagsInt = u32;
pub fn FlagsMixin(comptime FlagType: type) type {
comptime assert(@sizeOf(FlagType) == 4);
return struct {
pub fn toInt(self: FlagType) FlagsInt {
return @bitCast(FlagsInt, self);
}
pub fn fromInt(value: FlagsInt) FlagType {
return @bitCast(FlagType, value);
}
pub fn with(a: FlagType, b: FlagType) FlagType {
return fromInt(toInt(a) | toInt(b));
}
pub fn only(a: FlagType, b: FlagType) FlagType {
return fromInt(toInt(a) & toInt(b));
}
pub fn without(a: FlagType, b: FlagType) FlagType {
return fromInt(toInt(a) & ~toInt(b));
}
pub fn hasAllSet(a: FlagType, b: FlagType) bool {
return (toInt(a) & toInt(b)) == toInt(b);
}
pub fn hasAnySet(a: FlagType, b: FlagType) bool {
return (toInt(a) & toInt(b)) != 0;
}
pub fn isEmpty(a: FlagType) bool {
return toInt(a) == 0;
}
};
}
pub const DrawCornerFlagsInt = FlagsInt;
pub const DrawCornerFlags = packed struct {
TopLeft: bool = false,
TopRight: bool = false,
BotLeft: bool = false,
BotRight: bool = false,
__reserved_bit_04: bool = false,
__reserved_bit_05: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub const Top = Self{ .TopLeft = true, .TopRight = true };
pub const Bot = Self{ .BotLeft = true, .BotRight = true };
pub const Left = Self{ .TopLeft = true, .BotLeft = true };
pub const Right = Self{ .TopRight = true, .BotRight = true };
pub const All = Self{ .TopLeft = true, .TopRight = true, .BotLeft = true, .BotRight = true };
pub usingnamespace FlagsMixin(Self);
};
pub const DrawListFlagsInt = FlagsInt;
pub const DrawListFlags = packed struct {
AntiAliasedLines: bool = false,
AntiAliasedFill: bool = false,
AllowVtxOffset: bool = false,
__reserved_bit_03: bool = false,
__reserved_bit_04: bool = false,
__reserved_bit_05: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub usingnamespace FlagsMixin(Self);
};
pub const FontAtlasFlagsInt = FlagsInt;
pub const FontAtlasFlags = packed struct {
NoPowerOfTwoHeight: bool = false,
NoMouseCursors: bool = false,
__reserved_bit_02: bool = false,
__reserved_bit_03: bool = false,
__reserved_bit_04: bool = false,
__reserved_bit_05: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub usingnamespace FlagsMixin(Self);
};
pub const BackendFlagsInt = FlagsInt;
pub const BackendFlags = packed struct {
HasGamepad: bool = false,
HasMouseCursors: bool = false,
HasSetMousePos: bool = false,
RendererHasVtxOffset: bool = false,
__reserved_bit_04: bool = false,
__reserved_bit_05: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub usingnamespace FlagsMixin(Self);
};
pub const ColorEditFlagsInt = FlagsInt;
pub const ColorEditFlags = packed struct {
__reserved_bit_00: bool = false,
NoAlpha: bool = false,
NoPicker: bool = false,
NoOptions: bool = false,
NoSmallPreview: bool = false,
NoInputs: bool = false,
NoTooltip: bool = false,
NoLabel: bool = false,
NoSidePreview: bool = false,
NoDragDrop: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
AlphaBar: bool = false,
AlphaPreview: bool = false,
AlphaPreviewHalf: bool = false,
HDR: bool = false,
DisplayRGB: bool = false,
DisplayHSV: bool = false,
DisplayHex: bool = false,
Uint8: bool = false,
Float: bool = false,
PickerHueBar: bool = false,
PickerHueWheel: bool = false,
InputRGB: bool = false,
InputHSV: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub const _OptionsDefault = Self{ .DisplayRGB = true, .Uint8 = true, .PickerHueBar = true, .InputRGB = true };
pub const _DisplayMask = Self{ .DisplayRGB = true, .DisplayHSV = true, .DisplayHex = true };
pub const _DataTypeMask = Self{ .Uint8 = true, .Float = true };
pub const _PickerMask = Self{ .PickerHueBar = true, .PickerHueWheel = true };
pub const _InputMask = Self{ .InputRGB = true, .InputHSV = true };
pub usingnamespace FlagsMixin(Self);
};
pub const ComboFlagsInt = FlagsInt;
pub const ComboFlags = packed struct {
PopupAlignLeft: bool = false,
HeightSmall: bool = false,
HeightRegular: bool = false,
HeightLarge: bool = false,
HeightLargest: bool = false,
NoArrowButton: bool = false,
NoPreview: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub const HeightMask_ = Self{ .HeightSmall = true, .HeightRegular = true, .HeightLarge = true, .HeightLargest = true };
pub usingnamespace FlagsMixin(Self);
};
pub const CondFlagsInt = FlagsInt;
pub const CondFlags = packed struct {
Always: bool = false,
Once: bool = false,
FirstUseEver: bool = false,
Appearing: bool = false,
__reserved_bit_04: bool = false,
__reserved_bit_05: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
pub usingnamespace FlagsMixin(@This());
};
pub const ConfigFlagsInt = FlagsInt;
pub const ConfigFlags = packed struct {
NavEnableKeyboard: bool = false,
NavEnableGamepad: bool = false,
NavEnableSetMousePos: bool = false,
NavNoCaptureKeyboard: bool = false,
NoMouse: bool = false,
NoMouseCursorChange: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
IsSRGB: bool = false,
IsTouchScreen: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub usingnamespace FlagsMixin(Self);
};
pub const DragDropFlagsInt = FlagsInt;
pub const DragDropFlags = packed struct {
SourceNoPreviewTooltip: bool = false,
SourceNoDisableHover: bool = false,
SourceNoHoldToOpenOthers: bool = false,
SourceAllowNullID: bool = false,
SourceExtern: bool = false,
SourceAutoExpirePayload: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
AcceptBeforeDelivery: bool = false,
AcceptNoDrawDefaultRect: bool = false,
AcceptNoPreviewTooltip: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub const AcceptPeekOnly = Self{ .AcceptBeforeDelivery = true, .AcceptNoDrawDefaultRect = true };
pub usingnamespace FlagsMixin(Self);
};
pub const FocusedFlagsInt = FlagsInt;
pub const FocusedFlags = packed struct {
ChildWindows: bool = false,
RootWindow: bool = false,
AnyWindow: bool = false,
__reserved_bit_03: bool = false,
__reserved_bit_04: bool = false,
__reserved_bit_05: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub const RootAndChildWindows = Self{ .ChildWindows = true, .RootWindow = true };
pub usingnamespace FlagsMixin(Self);
};
pub const HoveredFlagsInt = FlagsInt;
pub const HoveredFlags = packed struct {
ChildWindows: bool = false,
RootWindow: bool = false,
AnyWindow: bool = false,
AllowWhenBlockedByPopup: bool = false,
__reserved_bit_04: bool = false,
AllowWhenBlockedByActiveItem: bool = false,
AllowWhenOverlapped: bool = false,
AllowWhenDisabled: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub const RectOnly = Self{ .AllowWhenBlockedByPopup = true, .AllowWhenBlockedByActiveItem = true, .AllowWhenOverlapped = true };
pub const RootAndChildWindows = Self{ .ChildWindows = true, .RootWindow = true };
pub usingnamespace FlagsMixin(Self);
};
pub const InputTextFlagsInt = FlagsInt;
pub const InputTextFlags = packed struct {
CharsDecimal: bool = false,
CharsHexadecimal: bool = false,
CharsUppercase: bool = false,
CharsNoBlank: bool = false,
AutoSelectAll: bool = false,
EnterReturnsTrue: bool = false,
CallbackCompletion: bool = false,
CallbackHistory: bool = false,
CallbackAlways: bool = false,
CallbackCharFilter: bool = false,
AllowTabInput: bool = false,
CtrlEnterForNewLine: bool = false,
NoHorizontalScroll: bool = false,
AlwaysInsertMode: bool = false,
ReadOnly: bool = false,
Password: bool = false,
NoUndoRedo: bool = false,
CharsScientific: bool = false,
CallbackResize: bool = false,
__reserved_bit_19: bool = false,
Multiline: bool = false,
NoMarkEdited: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub usingnamespace FlagsMixin(Self);
};
pub const SelectableFlagsInt = FlagsInt;
pub const SelectableFlags = packed struct {
DontClosePopups: bool = false,
SpanAllColumns: bool = false,
AllowDoubleClick: bool = false,
Disabled: bool = false,
AllowItemOverlap: bool = false,
__reserved_bit_05: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub usingnamespace FlagsMixin(Self);
};
pub const TabBarFlagsInt = FlagsInt;
pub const TabBarFlags = packed struct {
Reorderable: bool = false,
AutoSelectNewTabs: bool = false,
TabListPopupButton: bool = false,
NoCloseWithMiddleMouseButton: bool = false,
NoTabListScrollingButtons: bool = false,
NoTooltip: bool = false,
FittingPolicyResizeDown: bool = false,
FittingPolicyScroll: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub const FittingPolicyMask_ = Self{ .FittingPolicyResizeDown = true, .FittingPolicyScroll = true };
pub const FittingPolicyDefault_ = Self{ .FittingPolicyResizeDown = true };
pub usingnamespace FlagsMixin(Self);
};
pub const TabItemFlagsInt = FlagsInt;
pub const TabItemFlags = packed struct {
UnsavedDocument: bool = false,
SetSelected: bool = false,
NoCloseWithMiddleMouseButton: bool = false,
NoPushId: bool = false,
__reserved_bit_04: bool = false,
__reserved_bit_05: bool = false,
__reserved_bit_06: bool = false,
__reserved_bit_07: bool = false,
__reserved_bit_08: bool = false,
__reserved_bit_09: bool = false,
__reserved_bit_10: bool = false,
__reserved_bit_11: bool = false,
__reserved_bit_12: bool = false,
__reserved_bit_13: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub usingnamespace FlagsMixin(Self);
};
pub const TreeNodeFlagsInt = FlagsInt;
pub const TreeNodeFlags = packed struct {
Selected: bool = false,
Framed: bool = false,
AllowItemOverlap: bool = false,
NoTreePushOnOpen: bool = false,
NoAutoOpenOnLog: bool = false,
DefaultOpen: bool = false,
OpenOnDoubleClick: bool = false,
OpenOnArrow: bool = false,
Leaf: bool = false,
Bullet: bool = false,
FramePadding: bool = false,
SpanAvailWidth: bool = false,
SpanFullWidth: bool = false,
NavLeftJumpsBackHere: bool = false,
__reserved_bit_14: bool = false,
__reserved_bit_15: bool = false,
__reserved_bit_16: bool = false,
__reserved_bit_17: bool = false,
__reserved_bit_18: bool = false,
__reserved_bit_19: bool = false,
__reserved_bit_20: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
__reserved_bit_23: bool = false,
__reserved_bit_24: bool = false,
__reserved_bit_25: bool = false,
__reserved_bit_26: bool = false,
__reserved_bit_27: bool = false,
__reserved_bit_28: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub const CollapsingHeader = Self{ .Framed = true, .NoTreePushOnOpen = true, .NoAutoOpenOnLog = true };
pub usingnamespace FlagsMixin(Self);
};
pub const WindowFlagsInt = FlagsInt;
pub const WindowFlags = packed struct {
NoTitleBar: bool = false,
NoResize: bool = false,
NoMove: bool = false,
NoScrollbar: bool = false,
NoScrollWithMouse: bool = false,
NoCollapse: bool = false,
AlwaysAutoResize: bool = false,
NoBackground: bool = false,
NoSavedSettings: bool = false,
NoMouseInputs: bool = false,
MenuBar: bool = false,
HorizontalScrollbar: bool = false,
NoFocusOnAppearing: bool = false,
NoBringToFrontOnFocus: bool = false,
AlwaysVerticalScrollbar: bool = false,
AlwaysHorizontalScrollbar: bool = false,
AlwaysUseWindowPadding: bool = false,
__reserved_bit_17: bool = false,
NoNavInputs: bool = false,
NoNavFocus: bool = false,
UnsavedDocument: bool = false,
__reserved_bit_21: bool = false,
__reserved_bit_22: bool = false,
NavFlattened: bool = false,
ChildWindow: bool = false,
Tooltip: bool = false,
Popup: bool = false,
Modal: bool = false,
ChildMenu: bool = false,
__reserved_bit_29: bool = false,
__reserved_bit_30: bool = false,
__reserved_bit_31: bool = false,
const Self = @This();
pub const None = Self{};
pub const NoNav = Self{ .NoNavInputs = true, .NoNavFocus = true };
pub const NoDecoration = Self{ .NoTitleBar = true, .NoResize = true, .NoScrollbar = true, .NoCollapse = true };
pub const NoInputs = Self{ .NoMouseInputs = true, .NoNavInputs = true, .NoNavFocus = true };
pub usingnamespace FlagsMixin(Self);
};
pub const Col = extern enum {
Text = 0,
TextDisabled = 1,
WindowBg = 2,
ChildBg = 3,
PopupBg = 4,
Border = 5,
BorderShadow = 6,
FrameBg = 7,
FrameBgHovered = 8,
FrameBgActive = 9,
TitleBg = 10,
TitleBgActive = 11,
TitleBgCollapsed = 12,
MenuBarBg = 13,
ScrollbarBg = 14,
ScrollbarGrab = 15,
ScrollbarGrabHovered = 16,
ScrollbarGrabActive = 17,
CheckMark = 18,
SliderGrab = 19,
SliderGrabActive = 20,
Button = 21,
ButtonHovered = 22,
ButtonActive = 23,
Header = 24,
HeaderHovered = 25,
HeaderActive = 26,
Separator = 27,
SeparatorHovered = 28,
SeparatorActive = 29,
ResizeGrip = 30,
ResizeGripHovered = 31,
ResizeGripActive = 32,
Tab = 33,
TabHovered = 34,
TabActive = 35,
TabUnfocused = 36,
TabUnfocusedActive = 37,
PlotLines = 38,
PlotLinesHovered = 39,
PlotHistogram = 40,
PlotHistogramHovered = 41,
TextSelectedBg = 42,
DragDropTarget = 43,
NavHighlight = 44,
NavWindowingHighlight = 45,
NavWindowingDimBg = 46,
ModalWindowDimBg = 47,
pub const COUNT = 48;
};
pub const DataType = extern enum {
S8 = 0,
U8 = 1,
S16 = 2,
U16 = 3,
S32 = 4,
U32 = 5,
S64 = 6,
U64 = 7,
Float = 8,
Double = 9,
pub const COUNT = 10;
};
pub const Dir = extern enum {
None = -1,
Left = 0,
Right = 1,
Up = 2,
Down = 3,
pub const COUNT = 4;
};
pub const Key = extern enum {
Tab = 0,
LeftArrow = 1,
RightArrow = 2,
UpArrow = 3,
DownArrow = 4,
PageUp = 5,
PageDown = 6,
Home = 7,
End = 8,
Insert = 9,
Delete = 10,
Backspace = 11,
Space = 12,
Enter = 13,
Escape = 14,
KeyPadEnter = 15,
A = 16,
C = 17,
V = 18,
X = 19,
Y = 20,
Z = 21,
pub const COUNT = 22;
};
pub const MouseButton = extern enum {
Left = 0,
Right = 1,
Middle = 2,
pub const COUNT = 5;
};
pub const MouseCursor = extern enum {
None = -1,
Arrow = 0,
TextInput = 1,
ResizeAll = 2,
ResizeNS = 3,
ResizeEW = 4,
ResizeNESW = 5,
ResizeNWSE = 6,
Hand = 7,
NotAllowed = 8,
pub const COUNT = 9;
};
pub const NavInput = extern enum {
Activate = 0,
Cancel = 1,
Input = 2,
Menu = 3,
DpadLeft = 4,
DpadRight = 5,
DpadUp = 6,
DpadDown = 7,
LStickLeft = 8,
LStickRight = 9,
LStickUp = 10,
LStickDown = 11,
FocusPrev = 12,
FocusNext = 13,
TweakSlow = 14,
TweakFast = 15,
KeyMenu_ = 16,
KeyLeft_ = 17,
KeyRight_ = 18,
KeyUp_ = 19,
KeyDown_ = 20,
pub const COUNT = 21;
pub const Self = @This();
pub const InternalStart_ = Self.KeyMenu_;
};
pub const StyleVar = extern enum {
Alpha = 0,
WindowPadding = 1,
WindowRounding = 2,
WindowBorderSize = 3,
WindowMinSize = 4,
WindowTitleAlign = 5,
ChildRounding = 6,
ChildBorderSize = 7,
PopupRounding = 8,
PopupBorderSize = 9,
FramePadding = 10,
FrameRounding = 11,
FrameBorderSize = 12,
ItemSpacing = 13,
ItemInnerSpacing = 14,
IndentSpacing = 15,
ScrollbarSize = 16,
ScrollbarRounding = 17,
GrabMinSize = 18,
GrabRounding = 19,
TabRounding = 20,
ButtonTextAlign = 21,
SelectableTextAlign = 22,
pub const COUNT = 23;
};
pub const Color = extern struct {
Value: Vec4,
pub fn HSVExt(self: *Color, h: f32, s: f32, v: f32, a: f32) callconv(.Inline) Color {
var out: Color = undefined;
raw.ImColor_HSV_nonUDT(&out, self, h, s, v, a);
return out;
}
pub fn HSV(self: *Color, h: f32, s: f32, v: f32) callconv(.Inline) Color {
return HSVExt(self, h, s, v, 1.0);
}
/// init(self: *Color) void
pub const init = raw.ImColor_ImColor;
/// initIntExt(self: *Color, r: i32, g: i32, b: i32, a: i32) void
pub const initIntExt = raw.ImColor_ImColorInt;
pub fn initInt(self: *Color, r: i32, g: i32, b: i32) callconv(.Inline) void {
return initIntExt(self, r, g, b, 255);
}
/// initU32(self: *Color, rgba: u32) void
pub const initU32 = raw.ImColor_ImColorU32;
/// initFloatExt(self: *Color, r: f32, g: f32, b: f32, a: f32) void
pub const initFloatExt = raw.ImColor_ImColorFloat;
pub fn initFloat(self: *Color, r: f32, g: f32, b: f32) callconv(.Inline) void {
return initFloatExt(self, r, g, b, 1.0);
}
/// initVec4(self: *Color, col: Vec4) void
pub const initVec4 = raw.ImColor_ImColorVec4;
/// SetHSVExt(self: *Color, h: f32, s: f32, v: f32, a: f32) void
pub const SetHSVExt = raw.ImColor_SetHSV;
pub fn SetHSV(self: *Color, h: f32, s: f32, v: f32) callconv(.Inline) void {
return SetHSVExt(self, h, s, v, 1.0);
}
/// deinit(self: *Color) void
pub const deinit = raw.ImColor_destroy;
};
pub const DrawChannel = extern struct {
_CmdBuffer: Vector(DrawCmd),
_IdxBuffer: Vector(DrawIdx),
};
pub const DrawCmd = extern struct {
ElemCount: u32,
ClipRect: Vec4,
TextureId: TextureID,
VtxOffset: u32,
IdxOffset: u32,
UserCallback: DrawCallback,
UserCallbackData: ?*c_void,
/// init(self: *DrawCmd) void
pub const init = raw.ImDrawCmd_ImDrawCmd;
/// deinit(self: *DrawCmd) void
pub const deinit = raw.ImDrawCmd_destroy;
};
pub const DrawData = extern struct {
Valid: bool,
CmdLists: ?[*]*DrawList,
CmdListsCount: i32,
TotalIdxCount: i32,
TotalVtxCount: i32,
DisplayPos: Vec2,
DisplaySize: Vec2,
FramebufferScale: Vec2,
/// Clear(self: *DrawData) void
pub const Clear = raw.ImDrawData_Clear;
/// DeIndexAllBuffers(self: *DrawData) void
pub const DeIndexAllBuffers = raw.ImDrawData_DeIndexAllBuffers;
/// init(self: *DrawData) void
pub const init = raw.ImDrawData_ImDrawData;
/// ScaleClipRects(self: *DrawData, fb_scale: Vec2) void
pub const ScaleClipRects = raw.ImDrawData_ScaleClipRects;
/// deinit(self: *DrawData) void
pub const deinit = raw.ImDrawData_destroy;
};
pub const DrawList = extern struct {
CmdBuffer: Vector(DrawCmd),
IdxBuffer: Vector(DrawIdx),
VtxBuffer: Vector(DrawVert),
Flags: DrawListFlags align(4),
_Data: ?*const DrawListSharedData,
_OwnerName: ?[*:0]const u8,
_VtxCurrentOffset: u32,
_VtxCurrentIdx: u32,
_VtxWritePtr: ?[*]DrawVert,
_IdxWritePtr: ?[*]DrawIdx,
_ClipRectStack: Vector(Vec4),
_TextureIdStack: Vector(TextureID),
_Path: Vector(Vec2),
_Splitter: DrawListSplitter,
/// AddBezierCurveExt(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, col: u32, thickness: f32, num_segments: i32) void
pub const AddBezierCurveExt = raw.ImDrawList_AddBezierCurve;
pub fn AddBezierCurve(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, col: u32, thickness: f32) callconv(.Inline) void {
return AddBezierCurveExt(self, p1, p2, p3, p4, col, thickness, 0);
}
/// AddCallback(self: *DrawList, callback: DrawCallback, callback_data: ?*c_void) void
pub const AddCallback = raw.ImDrawList_AddCallback;
/// AddCircleExt(self: *DrawList, center: Vec2, radius: f32, col: u32, num_segments: i32, thickness: f32) void
pub const AddCircleExt = raw.ImDrawList_AddCircle;
pub fn AddCircle(self: *DrawList, center: Vec2, radius: f32, col: u32) callconv(.Inline) void {
return AddCircleExt(self, center, radius, col, 12, 1.0);
}
/// AddCircleFilledExt(self: *DrawList, center: Vec2, radius: f32, col: u32, num_segments: i32) void
pub const AddCircleFilledExt = raw.ImDrawList_AddCircleFilled;
pub fn AddCircleFilled(self: *DrawList, center: Vec2, radius: f32, col: u32) callconv(.Inline) void {
return AddCircleFilledExt(self, center, radius, col, 12);
}
/// AddConvexPolyFilled(self: *DrawList, points: ?[*]const Vec2, num_points: i32, col: u32) void
pub const AddConvexPolyFilled = raw.ImDrawList_AddConvexPolyFilled;
/// AddDrawCmd(self: *DrawList) void
pub const AddDrawCmd = raw.ImDrawList_AddDrawCmd;
/// AddImageExt(self: *DrawList, user_texture_id: TextureID, p_min: Vec2, p_max: Vec2, uv_min: Vec2, uv_max: Vec2, col: u32) void
pub const AddImageExt = raw.ImDrawList_AddImage;
pub fn AddImage(self: *DrawList, user_texture_id: TextureID, p_min: Vec2, p_max: Vec2) callconv(.Inline) void {
return AddImageExt(self, user_texture_id, p_min, p_max, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 1 }, 0xFFFFFFFF);
}
/// AddImageQuadExt(self: *DrawList, user_texture_id: TextureID, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, uv1: Vec2, uv2: Vec2, uv3: Vec2, uv4: Vec2, col: u32) void
pub const AddImageQuadExt = raw.ImDrawList_AddImageQuad;
pub fn AddImageQuad(self: *DrawList, user_texture_id: TextureID, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2) callconv(.Inline) void {
return AddImageQuadExt(self, user_texture_id, p1, p2, p3, p4, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 0 }, .{ .x = 1, .y = 1 }, .{ .x = 0, .y = 1 }, 0xFFFFFFFF);
}
pub fn AddImageRoundedExt(self: *DrawList, user_texture_id: TextureID, p_min: Vec2, p_max: Vec2, uv_min: Vec2, uv_max: Vec2, col: u32, rounding: f32, rounding_corners: DrawCornerFlags) callconv(.Inline) void {
return raw.ImDrawList_AddImageRounded(self, user_texture_id, p_min, p_max, uv_min, uv_max, col, rounding, rounding_corners.toInt());
}
pub fn AddImageRounded(self: *DrawList, user_texture_id: TextureID, p_min: Vec2, p_max: Vec2, uv_min: Vec2, uv_max: Vec2, col: u32, rounding: f32) callconv(.Inline) void {
return AddImageRoundedExt(self, user_texture_id, p_min, p_max, uv_min, uv_max, col, rounding, DrawCornerFlags.All);
}
/// AddLineExt(self: *DrawList, p1: Vec2, p2: Vec2, col: u32, thickness: f32) void
pub const AddLineExt = raw.ImDrawList_AddLine;
pub fn AddLine(self: *DrawList, p1: Vec2, p2: Vec2, col: u32) callconv(.Inline) void {
return AddLineExt(self, p1, p2, col, 1.0);
}
/// AddNgonExt(self: *DrawList, center: Vec2, radius: f32, col: u32, num_segments: i32, thickness: f32) void
pub const AddNgonExt = raw.ImDrawList_AddNgon;
pub fn AddNgon(self: *DrawList, center: Vec2, radius: f32, col: u32, num_segments: i32) callconv(.Inline) void {
return AddNgonExt(self, center, radius, col, num_segments, 1.0);
}
/// AddNgonFilled(self: *DrawList, center: Vec2, radius: f32, col: u32, num_segments: i32) void
pub const AddNgonFilled = raw.ImDrawList_AddNgonFilled;
/// AddPolyline(self: *DrawList, points: ?[*]const Vec2, num_points: i32, col: u32, closed: bool, thickness: f32) void
pub const AddPolyline = raw.ImDrawList_AddPolyline;
/// AddQuadExt(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, col: u32, thickness: f32) void
pub const AddQuadExt = raw.ImDrawList_AddQuad;
pub fn AddQuad(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, col: u32) callconv(.Inline) void {
return AddQuadExt(self, p1, p2, p3, p4, col, 1.0);
}
/// AddQuadFilled(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, col: u32) void
pub const AddQuadFilled = raw.ImDrawList_AddQuadFilled;
pub fn AddRectExt(self: *DrawList, p_min: Vec2, p_max: Vec2, col: u32, rounding: f32, rounding_corners: DrawCornerFlags, thickness: f32) callconv(.Inline) void {
return raw.ImDrawList_AddRect(self, p_min, p_max, col, rounding, rounding_corners.toInt(), thickness);
}
pub fn AddRect(self: *DrawList, p_min: Vec2, p_max: Vec2, col: u32) callconv(.Inline) void {
return AddRectExt(self, p_min, p_max, col, 0.0, DrawCornerFlags.All, 1.0);
}
pub fn AddRectFilledExt(self: *DrawList, p_min: Vec2, p_max: Vec2, col: u32, rounding: f32, rounding_corners: DrawCornerFlags) callconv(.Inline) void {
return raw.ImDrawList_AddRectFilled(self, p_min, p_max, col, rounding, rounding_corners.toInt());
}
pub fn AddRectFilled(self: *DrawList, p_min: Vec2, p_max: Vec2, col: u32) callconv(.Inline) void {
return AddRectFilledExt(self, p_min, p_max, col, 0.0, DrawCornerFlags.All);
}
/// AddRectFilledMultiColor(self: *DrawList, p_min: Vec2, p_max: Vec2, col_upr_left: u32, col_upr_right: u32, col_bot_right: u32, col_bot_left: u32) void
pub const AddRectFilledMultiColor = raw.ImDrawList_AddRectFilledMultiColor;
/// AddTextVec2Ext(self: *DrawList, pos: Vec2, col: u32, text_begin: ?[*]const u8, text_end: ?[*]const u8) void
pub const AddTextVec2Ext = raw.ImDrawList_AddTextVec2;
pub fn AddTextVec2(self: *DrawList, pos: Vec2, col: u32, text_begin: ?[*]const u8) callconv(.Inline) void {
return AddTextVec2Ext(self, pos, col, text_begin, null);
}
/// AddTextFontPtrExt(self: *DrawList, font: ?*const Font, font_size: f32, pos: Vec2, col: u32, text_begin: ?[*]const u8, text_end: ?[*]const u8, wrap_width: f32, cpu_fine_clip_rect: ?*const Vec4) void
pub const AddTextFontPtrExt = raw.ImDrawList_AddTextFontPtr;
pub fn AddTextFontPtr(self: *DrawList, font: ?*const Font, font_size: f32, pos: Vec2, col: u32, text_begin: ?[*]const u8) callconv(.Inline) void {
return AddTextFontPtrExt(self, font, font_size, pos, col, text_begin, null, 0.0, null);
}
/// AddTriangleExt(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, col: u32, thickness: f32) void
pub const AddTriangleExt = raw.ImDrawList_AddTriangle;
pub fn AddTriangle(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, col: u32) callconv(.Inline) void {
return AddTriangleExt(self, p1, p2, p3, col, 1.0);
}
/// AddTriangleFilled(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, col: u32) void
pub const AddTriangleFilled = raw.ImDrawList_AddTriangleFilled;
/// ChannelsMerge(self: *DrawList) void
pub const ChannelsMerge = raw.ImDrawList_ChannelsMerge;
/// ChannelsSetCurrent(self: *DrawList, n: i32) void
pub const ChannelsSetCurrent = raw.ImDrawList_ChannelsSetCurrent;
/// ChannelsSplit(self: *DrawList, count: i32) void
pub const ChannelsSplit = raw.ImDrawList_ChannelsSplit;
/// Clear(self: *DrawList) void
pub const Clear = raw.ImDrawList_Clear;
/// ClearFreeMemory(self: *DrawList) void
pub const ClearFreeMemory = raw.ImDrawList_ClearFreeMemory;
/// CloneOutput(self: *const DrawList) ?*DrawList
pub const CloneOutput = raw.ImDrawList_CloneOutput;
pub fn GetClipRectMax(self: *const DrawList) callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.ImDrawList_GetClipRectMax_nonUDT(&out, self);
return out;
}
pub fn GetClipRectMin(self: *const DrawList) callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.ImDrawList_GetClipRectMin_nonUDT(&out, self);
return out;
}
/// init(self: *DrawList, shared_data: ?*const DrawListSharedData) void
pub const init = raw.ImDrawList_ImDrawList;
/// PathArcToExt(self: *DrawList, center: Vec2, radius: f32, a_min: f32, a_max: f32, num_segments: i32) void
pub const PathArcToExt = raw.ImDrawList_PathArcTo;
pub fn PathArcTo(self: *DrawList, center: Vec2, radius: f32, a_min: f32, a_max: f32) callconv(.Inline) void {
return PathArcToExt(self, center, radius, a_min, a_max, 10);
}
/// PathArcToFast(self: *DrawList, center: Vec2, radius: f32, a_min_of_12: i32, a_max_of_12: i32) void
pub const PathArcToFast = raw.ImDrawList_PathArcToFast;
/// PathBezierCurveToExt(self: *DrawList, p2: Vec2, p3: Vec2, p4: Vec2, num_segments: i32) void
pub const PathBezierCurveToExt = raw.ImDrawList_PathBezierCurveTo;
pub fn PathBezierCurveTo(self: *DrawList, p2: Vec2, p3: Vec2, p4: Vec2) callconv(.Inline) void {
return PathBezierCurveToExt(self, p2, p3, p4, 0);
}
/// PathClear(self: *DrawList) void
pub const PathClear = raw.ImDrawList_PathClear;
/// PathFillConvex(self: *DrawList, col: u32) void
pub const PathFillConvex = raw.ImDrawList_PathFillConvex;
/// PathLineTo(self: *DrawList, pos: Vec2) void
pub const PathLineTo = raw.ImDrawList_PathLineTo;
/// PathLineToMergeDuplicate(self: *DrawList, pos: Vec2) void
pub const PathLineToMergeDuplicate = raw.ImDrawList_PathLineToMergeDuplicate;
pub fn PathRectExt(self: *DrawList, rect_min: Vec2, rect_max: Vec2, rounding: f32, rounding_corners: DrawCornerFlags) callconv(.Inline) void {
return raw.ImDrawList_PathRect(self, rect_min, rect_max, rounding, rounding_corners.toInt());
}
pub fn PathRect(self: *DrawList, rect_min: Vec2, rect_max: Vec2) callconv(.Inline) void {
return PathRectExt(self, rect_min, rect_max, 0.0, DrawCornerFlags.All);
}
/// PathStrokeExt(self: *DrawList, col: u32, closed: bool, thickness: f32) void
pub const PathStrokeExt = raw.ImDrawList_PathStroke;
pub fn PathStroke(self: *DrawList, col: u32, closed: bool) callconv(.Inline) void {
return PathStrokeExt(self, col, closed, 1.0);
}
/// PopClipRect(self: *DrawList) void
pub const PopClipRect = raw.ImDrawList_PopClipRect;
/// PopTextureID(self: *DrawList) void
pub const PopTextureID = raw.ImDrawList_PopTextureID;
/// PrimQuadUV(self: *DrawList, a: Vec2, b: Vec2, c: Vec2, d: Vec2, uv_a: Vec2, uv_b: Vec2, uv_c: Vec2, uv_d: Vec2, col: u32) void
pub const PrimQuadUV = raw.ImDrawList_PrimQuadUV;
/// PrimRect(self: *DrawList, a: Vec2, b: Vec2, col: u32) void
pub const PrimRect = raw.ImDrawList_PrimRect;
/// PrimRectUV(self: *DrawList, a: Vec2, b: Vec2, uv_a: Vec2, uv_b: Vec2, col: u32) void
pub const PrimRectUV = raw.ImDrawList_PrimRectUV;
/// PrimReserve(self: *DrawList, idx_count: i32, vtx_count: i32) void
pub const PrimReserve = raw.ImDrawList_PrimReserve;
/// PrimUnreserve(self: *DrawList, idx_count: i32, vtx_count: i32) void
pub const PrimUnreserve = raw.ImDrawList_PrimUnreserve;
/// PrimVtx(self: *DrawList, pos: Vec2, uv: Vec2, col: u32) void
pub const PrimVtx = raw.ImDrawList_PrimVtx;
/// PrimWriteIdx(self: *DrawList, idx: DrawIdx) void
pub const PrimWriteIdx = raw.ImDrawList_PrimWriteIdx;
/// PrimWriteVtx(self: *DrawList, pos: Vec2, uv: Vec2, col: u32) void
pub const PrimWriteVtx = raw.ImDrawList_PrimWriteVtx;
/// PushClipRectExt(self: *DrawList, clip_rect_min: Vec2, clip_rect_max: Vec2, intersect_with_current_clip_rect: bool) void
pub const PushClipRectExt = raw.ImDrawList_PushClipRect;
pub fn PushClipRect(self: *DrawList, clip_rect_min: Vec2, clip_rect_max: Vec2) callconv(.Inline) void {
return PushClipRectExt(self, clip_rect_min, clip_rect_max, false);
}
/// PushClipRectFullScreen(self: *DrawList) void
pub const PushClipRectFullScreen = raw.ImDrawList_PushClipRectFullScreen;
/// PushTextureID(self: *DrawList, texture_id: TextureID) void
pub const PushTextureID = raw.ImDrawList_PushTextureID;
/// UpdateClipRect(self: *DrawList) void
pub const UpdateClipRect = raw.ImDrawList_UpdateClipRect;
/// UpdateTextureID(self: *DrawList) void
pub const UpdateTextureID = raw.ImDrawList_UpdateTextureID;
/// deinit(self: *DrawList) void
pub const deinit = raw.ImDrawList_destroy;
};
pub const DrawListSplitter = extern struct {
_Current: i32,
_Count: i32,
_Channels: Vector(DrawChannel),
/// Clear(self: *DrawListSplitter) void
pub const Clear = raw.ImDrawListSplitter_Clear;
/// ClearFreeMemory(self: *DrawListSplitter) void
pub const ClearFreeMemory = raw.ImDrawListSplitter_ClearFreeMemory;
/// init(self: *DrawListSplitter) void
pub const init = raw.ImDrawListSplitter_ImDrawListSplitter;
/// Merge(self: *DrawListSplitter, draw_list: ?*DrawList) void
pub const Merge = raw.ImDrawListSplitter_Merge;
/// SetCurrentChannel(self: *DrawListSplitter, draw_list: ?*DrawList, channel_idx: i32) void
pub const SetCurrentChannel = raw.ImDrawListSplitter_SetCurrentChannel;
/// Split(self: *DrawListSplitter, draw_list: ?*DrawList, count: i32) void
pub const Split = raw.ImDrawListSplitter_Split;
/// deinit(self: *DrawListSplitter) void
pub const deinit = raw.ImDrawListSplitter_destroy;
};
pub const DrawVert = extern struct {
pos: Vec2,
uv: Vec2,
col: u32,
};
pub const Font = extern struct {
IndexAdvanceX: Vector(f32),
FallbackAdvanceX: f32,
FontSize: f32,
IndexLookup: Vector(Wchar),
Glyphs: Vector(FontGlyph),
FallbackGlyph: ?*const FontGlyph,
DisplayOffset: Vec2,
ContainerAtlas: ?*FontAtlas,
ConfigData: ?*const FontConfig,
ConfigDataCount: i16,
FallbackChar: Wchar,
EllipsisChar: Wchar,
DirtyLookupTables: bool,
Scale: f32,
Ascent: f32,
Descent: f32,
MetricsTotalSurface: i32,
/// AddGlyph(self: *Font, c: Wchar, x0: f32, y0: f32, x1: f32, y1: f32, u0: f32, v0: f32, u1: f32, v1: f32, advance_x: f32) void
pub const AddGlyph = raw.ImFont_AddGlyph;
/// AddRemapCharExt(self: *Font, dst: Wchar, src: Wchar, overwrite_dst: bool) void
pub const AddRemapCharExt = raw.ImFont_AddRemapChar;
pub fn AddRemapChar(self: *Font, dst: Wchar, src: Wchar) callconv(.Inline) void {
return AddRemapCharExt(self, dst, src, true);
}
/// BuildLookupTable(self: *Font) void
pub const BuildLookupTable = raw.ImFont_BuildLookupTable;
pub fn CalcTextSizeAExt(self: *const Font, size: f32, max_width: f32, wrap_width: f32, text_begin: ?[*]const u8, text_end: ?[*]const u8, remaining: ?*?[*:0]const u8) callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.ImFont_CalcTextSizeA_nonUDT(&out, self, size, max_width, wrap_width, text_begin, text_end, remaining);
return out;
}
pub fn CalcTextSizeA(self: *const Font, size: f32, max_width: f32, wrap_width: f32, text_begin: ?[*]const u8) callconv(.Inline) Vec2 {
return CalcTextSizeAExt(self, size, max_width, wrap_width, text_begin, null, null);
}
/// CalcWordWrapPositionA(self: *const Font, scale: f32, text: ?[*]const u8, text_end: ?[*]const u8, wrap_width: f32) ?[*]const u8
pub const CalcWordWrapPositionA = raw.ImFont_CalcWordWrapPositionA;
/// ClearOutputData(self: *Font) void
pub const ClearOutputData = raw.ImFont_ClearOutputData;
/// FindGlyph(self: *const Font, c: Wchar) ?*const FontGlyph
pub const FindGlyph = raw.ImFont_FindGlyph;
/// FindGlyphNoFallback(self: *const Font, c: Wchar) ?*const FontGlyph
pub const FindGlyphNoFallback = raw.ImFont_FindGlyphNoFallback;
/// GetCharAdvance(self: *const Font, c: Wchar) f32
pub const GetCharAdvance = raw.ImFont_GetCharAdvance;
/// GetDebugName(self: *const Font) ?[*:0]const u8
pub const GetDebugName = raw.ImFont_GetDebugName;
/// GrowIndex(self: *Font, new_size: i32) void
pub const GrowIndex = raw.ImFont_GrowIndex;
/// init(self: *Font) void
pub const init = raw.ImFont_ImFont;
/// IsLoaded(self: *const Font) bool
pub const IsLoaded = raw.ImFont_IsLoaded;
/// RenderChar(self: *const Font, draw_list: ?*DrawList, size: f32, pos: Vec2, col: u32, c: Wchar) void
pub const RenderChar = raw.ImFont_RenderChar;
/// RenderTextExt(self: *const Font, draw_list: ?*DrawList, size: f32, pos: Vec2, col: u32, clip_rect: Vec4, text_begin: ?[*]const u8, text_end: ?[*]const u8, wrap_width: f32, cpu_fine_clip: bool) void
pub const RenderTextExt = raw.ImFont_RenderText;
pub fn RenderText(self: *const Font, draw_list: ?*DrawList, size: f32, pos: Vec2, col: u32, clip_rect: Vec4, text_begin: ?[*]const u8, text_end: ?[*]const u8) callconv(.Inline) void {
return RenderTextExt(self, draw_list, size, pos, col, clip_rect, text_begin, text_end, 0.0, false);
}
/// SetFallbackChar(self: *Font, c: Wchar) void
pub const SetFallbackChar = raw.ImFont_SetFallbackChar;
/// deinit(self: *Font) void
pub const deinit = raw.ImFont_destroy;
};
pub const FontAtlas = extern struct {
Locked: bool,
Flags: FontAtlasFlags align(4),
TexID: TextureID,
TexDesiredWidth: i32,
TexGlyphPadding: i32,
TexPixelsAlpha8: ?[*]u8,
TexPixelsRGBA32: ?[*]u32,
TexWidth: i32,
TexHeight: i32,
TexUvScale: Vec2,
TexUvWhitePixel: Vec2,
Fonts: Vector(*Font),
CustomRects: Vector(FontAtlasCustomRect),
ConfigData: Vector(FontConfig),
CustomRectIds: [1]i32,
/// AddCustomRectFontGlyphExt(self: *FontAtlas, font: ?*Font, id: Wchar, width: i32, height: i32, advance_x: f32, offset: Vec2) i32
pub const AddCustomRectFontGlyphExt = raw.ImFontAtlas_AddCustomRectFontGlyph;
pub fn AddCustomRectFontGlyph(self: *FontAtlas, font: ?*Font, id: Wchar, width: i32, height: i32, advance_x: f32) callconv(.Inline) i32 {
return AddCustomRectFontGlyphExt(self, font, id, width, height, advance_x, .{ .x = 0, .y = 0 });
}
/// AddCustomRectRegular(self: *FontAtlas, id: u32, width: i32, height: i32) i32
pub const AddCustomRectRegular = raw.ImFontAtlas_AddCustomRectRegular;
/// AddFont(self: *FontAtlas, font_cfg: ?*const FontConfig) ?*Font
pub const AddFont = raw.ImFontAtlas_AddFont;
/// AddFontDefaultExt(self: *FontAtlas, font_cfg: ?*const FontConfig) ?*Font
pub const AddFontDefaultExt = raw.ImFontAtlas_AddFontDefault;
pub fn AddFontDefault(self: *FontAtlas) callconv(.Inline) ?*Font {
return AddFontDefaultExt(self, null);
}
/// AddFontFromFileTTFExt(self: *FontAtlas, filename: ?[*:0]const u8, size_pixels: f32, font_cfg: ?*const FontConfig, glyph_ranges: ?[*:0]const Wchar) ?*Font
pub const AddFontFromFileTTFExt = raw.ImFontAtlas_AddFontFromFileTTF;
pub fn AddFontFromFileTTF(self: *FontAtlas, filename: ?[*:0]const u8, size_pixels: f32) callconv(.Inline) ?*Font {
return AddFontFromFileTTFExt(self, filename, size_pixels, null, null);
}
/// AddFontFromMemoryCompressedBase85TTFExt(self: *FontAtlas, compressed_font_data_base85: ?[*]const u8, size_pixels: f32, font_cfg: ?*const FontConfig, glyph_ranges: ?[*:0]const Wchar) ?*Font
pub const AddFontFromMemoryCompressedBase85TTFExt = raw.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF;
pub fn AddFontFromMemoryCompressedBase85TTF(self: *FontAtlas, compressed_font_data_base85: ?[*]const u8, size_pixels: f32) callconv(.Inline) ?*Font {
return AddFontFromMemoryCompressedBase85TTFExt(self, compressed_font_data_base85, size_pixels, null, null);
}
/// AddFontFromMemoryCompressedTTFExt(self: *FontAtlas, compressed_font_data: ?*const c_void, compressed_font_size: i32, size_pixels: f32, font_cfg: ?*const FontConfig, glyph_ranges: ?[*:0]const Wchar) ?*Font
pub const AddFontFromMemoryCompressedTTFExt = raw.ImFontAtlas_AddFontFromMemoryCompressedTTF;
pub fn AddFontFromMemoryCompressedTTF(self: *FontAtlas, compressed_font_data: ?*const c_void, compressed_font_size: i32, size_pixels: f32) callconv(.Inline) ?*Font {
return AddFontFromMemoryCompressedTTFExt(self, compressed_font_data, compressed_font_size, size_pixels, null, null);
}
/// AddFontFromMemoryTTFExt(self: *FontAtlas, font_data: ?*c_void, font_size: i32, size_pixels: f32, font_cfg: ?*const FontConfig, glyph_ranges: ?[*:0]const Wchar) ?*Font
pub const AddFontFromMemoryTTFExt = raw.ImFontAtlas_AddFontFromMemoryTTF;
pub fn AddFontFromMemoryTTF(self: *FontAtlas, font_data: ?*c_void, font_size: i32, size_pixels: f32) callconv(.Inline) ?*Font {
return AddFontFromMemoryTTFExt(self, font_data, font_size, size_pixels, null, null);
}
/// Build(self: *FontAtlas) bool
pub const Build = raw.ImFontAtlas_Build;
/// CalcCustomRectUV(self: *const FontAtlas, rect: ?*const FontAtlasCustomRect, out_uv_min: ?*Vec2, out_uv_max: ?*Vec2) void
pub const CalcCustomRectUV = raw.ImFontAtlas_CalcCustomRectUV;
/// Clear(self: *FontAtlas) void
pub const Clear = raw.ImFontAtlas_Clear;
/// ClearFonts(self: *FontAtlas) void
pub const ClearFonts = raw.ImFontAtlas_ClearFonts;
/// ClearInputData(self: *FontAtlas) void
pub const ClearInputData = raw.ImFontAtlas_ClearInputData;
/// ClearTexData(self: *FontAtlas) void
pub const ClearTexData = raw.ImFontAtlas_ClearTexData;
/// GetCustomRectByIndex(self: *const FontAtlas, index: i32) ?*const FontAtlasCustomRect
pub const GetCustomRectByIndex = raw.ImFontAtlas_GetCustomRectByIndex;
/// GetGlyphRangesChineseFull(self: *FontAtlas) ?*const Wchar
pub const GetGlyphRangesChineseFull = raw.ImFontAtlas_GetGlyphRangesChineseFull;
/// GetGlyphRangesChineseSimplifiedCommon(self: *FontAtlas) ?*const Wchar
pub const GetGlyphRangesChineseSimplifiedCommon = raw.ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon;
/// GetGlyphRangesCyrillic(self: *FontAtlas) ?*const Wchar
pub const GetGlyphRangesCyrillic = raw.ImFontAtlas_GetGlyphRangesCyrillic;
/// GetGlyphRangesDefault(self: *FontAtlas) ?*const Wchar
pub const GetGlyphRangesDefault = raw.ImFontAtlas_GetGlyphRangesDefault;
/// GetGlyphRangesJapanese(self: *FontAtlas) ?*const Wchar
pub const GetGlyphRangesJapanese = raw.ImFontAtlas_GetGlyphRangesJapanese;
/// GetGlyphRangesKorean(self: *FontAtlas) ?*const Wchar
pub const GetGlyphRangesKorean = raw.ImFontAtlas_GetGlyphRangesKorean;
/// GetGlyphRangesThai(self: *FontAtlas) ?*const Wchar
pub const GetGlyphRangesThai = raw.ImFontAtlas_GetGlyphRangesThai;
/// GetGlyphRangesVietnamese(self: *FontAtlas) ?*const Wchar
pub const GetGlyphRangesVietnamese = raw.ImFontAtlas_GetGlyphRangesVietnamese;
/// GetMouseCursorTexData(self: *FontAtlas, cursor: MouseCursor, out_offset: ?*Vec2, out_size: ?*Vec2, out_uv_border: *[2]Vec2, out_uv_fill: *[2]Vec2) bool
pub const GetMouseCursorTexData = raw.ImFontAtlas_GetMouseCursorTexData;
/// GetTexDataAsAlpha8Ext(self: *FontAtlas, out_pixels: *?[*]u8, out_width: *i32, out_height: *i32, out_bytes_per_pixel: ?*i32) void
pub const GetTexDataAsAlpha8Ext = raw.ImFontAtlas_GetTexDataAsAlpha8;
pub fn GetTexDataAsAlpha8(self: *FontAtlas, out_pixels: *?[*]u8, out_width: *i32, out_height: *i32) callconv(.Inline) void {
return GetTexDataAsAlpha8Ext(self, out_pixels, out_width, out_height, null);
}
/// GetTexDataAsRGBA32Ext(self: *FontAtlas, out_pixels: *?[*]u8, out_width: *i32, out_height: *i32, out_bytes_per_pixel: ?*i32) void
pub const GetTexDataAsRGBA32Ext = raw.ImFontAtlas_GetTexDataAsRGBA32;
pub fn GetTexDataAsRGBA32(self: *FontAtlas, out_pixels: *?[*]u8, out_width: *i32, out_height: *i32) callconv(.Inline) void {
return GetTexDataAsRGBA32Ext(self, out_pixels, out_width, out_height, null);
}
/// init(self: *FontAtlas) void
pub const init = raw.ImFontAtlas_ImFontAtlas;
/// IsBuilt(self: *const FontAtlas) bool
pub const IsBuilt = raw.ImFontAtlas_IsBuilt;
/// SetTexID(self: *FontAtlas, id: TextureID) void
pub const SetTexID = raw.ImFontAtlas_SetTexID;
/// deinit(self: *FontAtlas) void
pub const deinit = raw.ImFontAtlas_destroy;
};
pub const FontAtlasCustomRect = extern struct {
ID: u32,
Width: u16,
Height: u16,
X: u16,
Y: u16,
GlyphAdvanceX: f32,
GlyphOffset: Vec2,
Font: ?*Font,
/// init(self: *FontAtlasCustomRect) void
pub const init = raw.ImFontAtlasCustomRect_ImFontAtlasCustomRect;
/// IsPacked(self: *const FontAtlasCustomRect) bool
pub const IsPacked = raw.ImFontAtlasCustomRect_IsPacked;
/// deinit(self: *FontAtlasCustomRect) void
pub const deinit = raw.ImFontAtlasCustomRect_destroy;
};
pub const FontConfig = extern struct {
FontData: ?*c_void,
FontDataSize: i32,
FontDataOwnedByAtlas: bool,
FontNo: i32,
SizePixels: f32,
OversampleH: i32,
OversampleV: i32,
PixelSnapH: bool,
GlyphExtraSpacing: Vec2,
GlyphOffset: Vec2,
GlyphRanges: ?[*:0]const Wchar,
GlyphMinAdvanceX: f32,
GlyphMaxAdvanceX: f32,
MergeMode: bool,
RasterizerFlags: u32,
RasterizerMultiply: f32,
EllipsisChar: Wchar,
Name: [40]u8,
DstFont: ?*Font,
/// init(self: *FontConfig) void
pub const init = raw.ImFontConfig_ImFontConfig;
/// deinit(self: *FontConfig) void
pub const deinit = raw.ImFontConfig_destroy;
};
pub const FontGlyph = extern struct {
Codepoint: Wchar,
AdvanceX: f32,
X0: f32,
Y0: f32,
X1: f32,
Y1: f32,
U0: f32,
V0: f32,
U1: f32,
V1: f32,
};
pub const FontGlyphRangesBuilder = extern struct {
UsedChars: Vector(u32),
/// AddChar(self: *FontGlyphRangesBuilder, c: Wchar) void
pub const AddChar = raw.ImFontGlyphRangesBuilder_AddChar;
/// AddRanges(self: *FontGlyphRangesBuilder, ranges: ?[*:0]const Wchar) void
pub const AddRanges = raw.ImFontGlyphRangesBuilder_AddRanges;
/// AddTextExt(self: *FontGlyphRangesBuilder, text: ?[*]const u8, text_end: ?[*]const u8) void
pub const AddTextExt = raw.ImFontGlyphRangesBuilder_AddText;
pub fn AddText(self: *FontGlyphRangesBuilder, text: ?[*]const u8) callconv(.Inline) void {
return AddTextExt(self, text, null);
}
/// BuildRanges(self: *FontGlyphRangesBuilder, out_ranges: *Vector(Wchar)) void
pub const BuildRanges = raw.ImFontGlyphRangesBuilder_BuildRanges;
/// Clear(self: *FontGlyphRangesBuilder) void
pub const Clear = raw.ImFontGlyphRangesBuilder_Clear;
/// GetBit(self: *const FontGlyphRangesBuilder, n: i32) bool
pub const GetBit = raw.ImFontGlyphRangesBuilder_GetBit;
/// init(self: *FontGlyphRangesBuilder) void
pub const init = raw.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder;
/// SetBit(self: *FontGlyphRangesBuilder, n: i32) void
pub const SetBit = raw.ImFontGlyphRangesBuilder_SetBit;
/// deinit(self: *FontGlyphRangesBuilder) void
pub const deinit = raw.ImFontGlyphRangesBuilder_destroy;
};
pub const IO = extern struct {
ConfigFlags: ConfigFlags align(4),
BackendFlags: BackendFlags align(4),
DisplaySize: Vec2,
DeltaTime: f32,
IniSavingRate: f32,
IniFilename: ?[*:0]const u8,
LogFilename: ?[*:0]const u8,
MouseDoubleClickTime: f32,
MouseDoubleClickMaxDist: f32,
MouseDragThreshold: f32,
KeyMap: [Key.COUNT]i32,
KeyRepeatDelay: f32,
KeyRepeatRate: f32,
UserData: ?*c_void,
Fonts: ?*FontAtlas,
FontGlobalScale: f32,
FontAllowUserScaling: bool,
FontDefault: ?*Font,
DisplayFramebufferScale: Vec2,
MouseDrawCursor: bool,
ConfigMacOSXBehaviors: bool,
ConfigInputTextCursorBlink: bool,
ConfigWindowsResizeFromEdges: bool,
ConfigWindowsMoveFromTitleBarOnly: bool,
ConfigWindowsMemoryCompactTimer: f32,
BackendPlatformName: ?[*:0]const u8,
BackendRendererName: ?[*:0]const u8,
BackendPlatformUserData: ?*c_void,
BackendRendererUserData: ?*c_void,
BackendLanguageUserData: ?*c_void,
GetClipboardTextFn: ?fn (user_data: ?*c_void) callconv(.C) ?[*:0]const u8,
SetClipboardTextFn: ?fn (user_data: ?*c_void, text: ?[*:0]const u8) callconv(.C) void,
ClipboardUserData: ?*c_void,
ImeSetInputScreenPosFn: ?fn (x: i32, y: i32) callconv(.C) void,
ImeWindowHandle: ?*c_void,
RenderDrawListsFnUnused: ?*c_void,
MousePos: Vec2,
MouseDown: [5]bool,
MouseWheel: f32,
MouseWheelH: f32,
KeyCtrl: bool,
KeyShift: bool,
KeyAlt: bool,
KeySuper: bool,
KeysDown: [512]bool,
NavInputs: [NavInput.COUNT]f32,
WantCaptureMouse: bool,
WantCaptureKeyboard: bool,
WantTextInput: bool,
WantSetMousePos: bool,
WantSaveIniSettings: bool,
NavActive: bool,
NavVisible: bool,
Framerate: f32,
MetricsRenderVertices: i32,
MetricsRenderIndices: i32,
MetricsRenderWindows: i32,
MetricsActiveWindows: i32,
MetricsActiveAllocations: i32,
MouseDelta: Vec2,
MousePosPrev: Vec2,
MouseClickedPos: [5]Vec2,
MouseClickedTime: [5]f64,
MouseClicked: [5]bool,
MouseDoubleClicked: [5]bool,
MouseReleased: [5]bool,
MouseDownOwned: [5]bool,
MouseDownWasDoubleClick: [5]bool,
MouseDownDuration: [5]f32,
MouseDownDurationPrev: [5]f32,
MouseDragMaxDistanceAbs: [5]Vec2,
MouseDragMaxDistanceSqr: [5]f32,
KeysDownDuration: [512]f32,
KeysDownDurationPrev: [512]f32,
NavInputsDownDuration: [NavInput.COUNT]f32,
NavInputsDownDurationPrev: [NavInput.COUNT]f32,
InputQueueCharacters: Vector(Wchar),
/// AddInputCharacter(self: *IO, c: u32) void
pub const AddInputCharacter = raw.ImGuiIO_AddInputCharacter;
/// AddInputCharactersUTF8(self: *IO, str: ?[*:0]const u8) void
pub const AddInputCharactersUTF8 = raw.ImGuiIO_AddInputCharactersUTF8;
/// ClearInputCharacters(self: *IO) void
pub const ClearInputCharacters = raw.ImGuiIO_ClearInputCharacters;
/// init(self: *IO) void
pub const init = raw.ImGuiIO_ImGuiIO;
/// deinit(self: *IO) void
pub const deinit = raw.ImGuiIO_destroy;
};
pub const InputTextCallbackData = extern struct {
EventFlag: InputTextFlags align(4),
Flags: InputTextFlags align(4),
UserData: ?*c_void,
EventChar: Wchar,
EventKey: Key,
Buf: ?[*]u8,
BufTextLen: i32,
BufSize: i32,
BufDirty: bool,
CursorPos: i32,
SelectionStart: i32,
SelectionEnd: i32,
/// DeleteChars(self: *InputTextCallbackData, pos: i32, bytes_count: i32) void
pub const DeleteChars = raw.ImGuiInputTextCallbackData_DeleteChars;
/// HasSelection(self: *const InputTextCallbackData) bool
pub const HasSelection = raw.ImGuiInputTextCallbackData_HasSelection;
/// init(self: *InputTextCallbackData) void
pub const init = raw.ImGuiInputTextCallbackData_ImGuiInputTextCallbackData;
/// InsertCharsExt(self: *InputTextCallbackData, pos: i32, text: ?[*]const u8, text_end: ?[*]const u8) void
pub const InsertCharsExt = raw.ImGuiInputTextCallbackData_InsertChars;
pub fn InsertChars(self: *InputTextCallbackData, pos: i32, text: ?[*]const u8) callconv(.Inline) void {
return InsertCharsExt(self, pos, text, null);
}
/// deinit(self: *InputTextCallbackData) void
pub const deinit = raw.ImGuiInputTextCallbackData_destroy;
};
pub const ListClipper = extern struct {
DisplayStart: i32,
DisplayEnd: i32,
ItemsCount: i32,
StepNo: i32,
ItemsHeight: f32,
StartPosY: f32,
/// BeginExt(self: *ListClipper, items_count: i32, items_height: f32) void
pub const BeginExt = raw.ImGuiListClipper_Begin;
pub fn Begin(self: *ListClipper, items_count: i32) callconv(.Inline) void {
return BeginExt(self, items_count, -1.0);
}
/// End(self: *ListClipper) void
pub const End = raw.ImGuiListClipper_End;
/// initExt(self: *ListClipper, items_count: i32, items_height: f32) void
pub const initExt = raw.ImGuiListClipper_ImGuiListClipper;
pub fn init(self: *ListClipper) callconv(.Inline) void {
return initExt(self, -1, -1.0);
}
/// Step(self: *ListClipper) bool
pub const Step = raw.ImGuiListClipper_Step;
/// deinit(self: *ListClipper) void
pub const deinit = raw.ImGuiListClipper_destroy;
};
pub const OnceUponAFrame = extern struct {
RefFrame: i32,
/// init(self: *OnceUponAFrame) void
pub const init = raw.ImGuiOnceUponAFrame_ImGuiOnceUponAFrame;
/// deinit(self: *OnceUponAFrame) void
pub const deinit = raw.ImGuiOnceUponAFrame_destroy;
};
pub const Payload = extern struct {
Data: ?*c_void,
DataSize: i32,
SourceId: ID,
SourceParentId: ID,
DataFrameCount: i32,
DataType: [32 + 1]u8,
Preview: bool,
Delivery: bool,
/// Clear(self: *Payload) void
pub const Clear = raw.ImGuiPayload_Clear;
/// init(self: *Payload) void
pub const init = raw.ImGuiPayload_ImGuiPayload;
/// IsDataType(self: *const Payload, kind: ?[*:0]const u8) bool
pub const IsDataType = raw.ImGuiPayload_IsDataType;
/// IsDelivery(self: *const Payload) bool
pub const IsDelivery = raw.ImGuiPayload_IsDelivery;
/// IsPreview(self: *const Payload) bool
pub const IsPreview = raw.ImGuiPayload_IsPreview;
/// deinit(self: *Payload) void
pub const deinit = raw.ImGuiPayload_destroy;
};
pub const SizeCallbackData = extern struct {
UserData: ?*c_void,
Pos: Vec2,
CurrentSize: Vec2,
DesiredSize: Vec2,
};
pub const Storage = extern struct {
Data: Vector(StoragePair),
/// BuildSortByKey(self: *Storage) void
pub const BuildSortByKey = raw.ImGuiStorage_BuildSortByKey;
/// Clear(self: *Storage) void
pub const Clear = raw.ImGuiStorage_Clear;
/// GetBoolExt(self: *const Storage, key: ID, default_val: bool) bool
pub const GetBoolExt = raw.ImGuiStorage_GetBool;
pub fn GetBool(self: *const Storage, key: ID) callconv(.Inline) bool {
return GetBoolExt(self, key, false);
}
/// GetBoolRefExt(self: *Storage, key: ID, default_val: bool) ?*bool
pub const GetBoolRefExt = raw.ImGuiStorage_GetBoolRef;
pub fn GetBoolRef(self: *Storage, key: ID) callconv(.Inline) ?*bool {
return GetBoolRefExt(self, key, false);
}
/// GetFloatExt(self: *const Storage, key: ID, default_val: f32) f32
pub const GetFloatExt = raw.ImGuiStorage_GetFloat;
pub fn GetFloat(self: *const Storage, key: ID) callconv(.Inline) f32 {
return GetFloatExt(self, key, 0.0);
}
/// GetFloatRefExt(self: *Storage, key: ID, default_val: f32) ?*f32
pub const GetFloatRefExt = raw.ImGuiStorage_GetFloatRef;
pub fn GetFloatRef(self: *Storage, key: ID) callconv(.Inline) ?*f32 {
return GetFloatRefExt(self, key, 0.0);
}
/// GetIntExt(self: *const Storage, key: ID, default_val: i32) i32
pub const GetIntExt = raw.ImGuiStorage_GetInt;
pub fn GetInt(self: *const Storage, key: ID) callconv(.Inline) i32 {
return GetIntExt(self, key, 0);
}
/// GetIntRefExt(self: *Storage, key: ID, default_val: i32) ?*i32
pub const GetIntRefExt = raw.ImGuiStorage_GetIntRef;
pub fn GetIntRef(self: *Storage, key: ID) callconv(.Inline) ?*i32 {
return GetIntRefExt(self, key, 0);
}
/// GetVoidPtr(self: *const Storage, key: ID) ?*c_void
pub const GetVoidPtr = raw.ImGuiStorage_GetVoidPtr;
/// GetVoidPtrRefExt(self: *Storage, key: ID, default_val: ?*c_void) ?*?*c_void
pub const GetVoidPtrRefExt = raw.ImGuiStorage_GetVoidPtrRef;
pub fn GetVoidPtrRef(self: *Storage, key: ID) callconv(.Inline) ?*?*c_void {
return GetVoidPtrRefExt(self, key, null);
}
/// SetAllInt(self: *Storage, val: i32) void
pub const SetAllInt = raw.ImGuiStorage_SetAllInt;
/// SetBool(self: *Storage, key: ID, val: bool) void
pub const SetBool = raw.ImGuiStorage_SetBool;
/// SetFloat(self: *Storage, key: ID, val: f32) void
pub const SetFloat = raw.ImGuiStorage_SetFloat;
/// SetInt(self: *Storage, key: ID, val: i32) void
pub const SetInt = raw.ImGuiStorage_SetInt;
/// SetVoidPtr(self: *Storage, key: ID, val: ?*c_void) void
pub const SetVoidPtr = raw.ImGuiStorage_SetVoidPtr;
};
pub const StoragePair = extern struct {
key: ID,
value: extern union { val_i: i32, val_f: f32, val_p: ?*c_void },
/// initInt(self: *StoragePair, _key: ID, _val_i: i32) void
pub const initInt = raw.ImGuiStoragePair_ImGuiStoragePairInt;
/// initFloat(self: *StoragePair, _key: ID, _val_f: f32) void
pub const initFloat = raw.ImGuiStoragePair_ImGuiStoragePairFloat;
/// initPtr(self: *StoragePair, _key: ID, _val_p: ?*c_void) void
pub const initPtr = raw.ImGuiStoragePair_ImGuiStoragePairPtr;
/// deinit(self: *StoragePair) void
pub const deinit = raw.ImGuiStoragePair_destroy;
};
pub const Style = extern struct {
Alpha: f32,
WindowPadding: Vec2,
WindowRounding: f32,
WindowBorderSize: f32,
WindowMinSize: Vec2,
WindowTitleAlign: Vec2,
WindowMenuButtonPosition: Dir,
ChildRounding: f32,
ChildBorderSize: f32,
PopupRounding: f32,
PopupBorderSize: f32,
FramePadding: Vec2,
FrameRounding: f32,
FrameBorderSize: f32,
ItemSpacing: Vec2,
ItemInnerSpacing: Vec2,
TouchExtraPadding: Vec2,
IndentSpacing: f32,
ColumnsMinSpacing: f32,
ScrollbarSize: f32,
ScrollbarRounding: f32,
GrabMinSize: f32,
GrabRounding: f32,
TabRounding: f32,
TabBorderSize: f32,
ColorButtonPosition: Dir,
ButtonTextAlign: Vec2,
SelectableTextAlign: Vec2,
DisplayWindowPadding: Vec2,
DisplaySafeAreaPadding: Vec2,
MouseCursorScale: f32,
AntiAliasedLines: bool,
AntiAliasedFill: bool,
CurveTessellationTol: f32,
CircleSegmentMaxError: f32,
Colors: [Col.COUNT]Vec4,
/// init(self: *Style) void
pub const init = raw.ImGuiStyle_ImGuiStyle;
/// ScaleAllSizes(self: *Style, scale_factor: f32) void
pub const ScaleAllSizes = raw.ImGuiStyle_ScaleAllSizes;
/// deinit(self: *Style) void
pub const deinit = raw.ImGuiStyle_destroy;
};
pub const TextBuffer = extern struct {
Buf: Vector(u8),
/// init(self: *TextBuffer) void
pub const init = raw.ImGuiTextBuffer_ImGuiTextBuffer;
/// appendExt(self: *TextBuffer, str: ?[*]const u8, str_end: ?[*]const u8) void
pub const appendExt = raw.ImGuiTextBuffer_append;
pub fn append(self: *TextBuffer, str: ?[*]const u8) callconv(.Inline) void {
return appendExt(self, str, null);
}
/// appendf(self: *TextBuffer, fmt: ?[*:0]const u8, ...: ...) void
pub const appendf = raw.ImGuiTextBuffer_appendf;
/// begin(self: *const TextBuffer) [*]const u8
pub const begin = raw.ImGuiTextBuffer_begin;
/// c_str(self: *const TextBuffer) [*:0]const u8
pub const c_str = raw.ImGuiTextBuffer_c_str;
/// clear(self: *TextBuffer) void
pub const clear = raw.ImGuiTextBuffer_clear;
/// deinit(self: *TextBuffer) void
pub const deinit = raw.ImGuiTextBuffer_destroy;
/// empty(self: *const TextBuffer) bool
pub const empty = raw.ImGuiTextBuffer_empty;
/// end(self: *const TextBuffer) [*]const u8
pub const end = raw.ImGuiTextBuffer_end;
/// reserve(self: *TextBuffer, capacity: i32) void
pub const reserve = raw.ImGuiTextBuffer_reserve;
/// size(self: *const TextBuffer) i32
pub const size = raw.ImGuiTextBuffer_size;
};
pub const TextFilter = extern struct {
InputBuf: [256]u8,
Filters: Vector(TextRange),
CountGrep: i32,
/// Build(self: *TextFilter) void
pub const Build = raw.ImGuiTextFilter_Build;
/// Clear(self: *TextFilter) void
pub const Clear = raw.ImGuiTextFilter_Clear;
/// DrawExt(self: *TextFilter, label: ?[*:0]const u8, width: f32) bool
pub const DrawExt = raw.ImGuiTextFilter_Draw;
pub fn Draw(self: *TextFilter) callconv(.Inline) bool {
return DrawExt(self, "Filter(inc,-exc)", 0.0);
}
/// initExt(self: *TextFilter, default_filter: ?[*:0]const u8) void
pub const initExt = raw.ImGuiTextFilter_ImGuiTextFilter;
pub fn init(self: *TextFilter) callconv(.Inline) void {
return initExt(self, "");
}
/// IsActive(self: *const TextFilter) bool
pub const IsActive = raw.ImGuiTextFilter_IsActive;
/// PassFilterExt(self: *const TextFilter, text: ?[*]const u8, text_end: ?[*]const u8) bool
pub const PassFilterExt = raw.ImGuiTextFilter_PassFilter;
pub fn PassFilter(self: *const TextFilter, text: ?[*]const u8) callconv(.Inline) bool {
return PassFilterExt(self, text, null);
}
/// deinit(self: *TextFilter) void
pub const deinit = raw.ImGuiTextFilter_destroy;
};
pub const TextRange = extern struct {
b: ?[*]const u8,
e: ?[*]const u8,
/// init(self: *TextRange) void
pub const init = raw.ImGuiTextRange_ImGuiTextRange;
/// initStr(self: *TextRange, _b: ?[*]const u8, _e: ?[*]const u8) void
pub const initStr = raw.ImGuiTextRange_ImGuiTextRangeStr;
/// deinit(self: *TextRange) void
pub const deinit = raw.ImGuiTextRange_destroy;
/// empty(self: *const TextRange) bool
pub const empty = raw.ImGuiTextRange_empty;
/// split(self: *const TextRange, separator: u8, out: ?*Vector(TextRange)) void
pub const split = raw.ImGuiTextRange_split;
};
pub const Vec2 = extern struct {
x: f32,
y: f32,
/// init(self: *Vec2) void
pub const init = raw.ImVec2_ImVec2;
/// initFloat(self: *Vec2, _x: f32, _y: f32) void
pub const initFloat = raw.ImVec2_ImVec2Float;
/// deinit(self: *Vec2) void
pub const deinit = raw.ImVec2_destroy;
};
pub const Vec4 = extern struct {
x: f32,
y: f32,
z: f32,
w: f32,
/// init(self: *Vec4) void
pub const init = raw.ImVec4_ImVec4;
/// initFloat(self: *Vec4, _x: f32, _y: f32, _z: f32, _w: f32) void
pub const initFloat = raw.ImVec4_ImVec4Float;
/// deinit(self: *Vec4) void
pub const deinit = raw.ImVec4_destroy;
};
const FTABLE_ImVector_ImDrawChannel = struct {
/// init(self: *Vector(DrawChannel)) void
pub const init = raw.ImVector_ImDrawChannel_ImVector_ImDrawChannel;
/// initVector(self: *Vector(DrawChannel), src: Vector(DrawChannel)) void
pub const initVector = raw.ImVector_ImDrawChannel_ImVector_ImDrawChannelVector;
/// _grow_capacity(self: *const Vector(DrawChannel), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImDrawChannel__grow_capacity;
/// back(self: *Vector(DrawChannel)) *DrawChannel
pub const back = raw.ImVector_ImDrawChannel_back;
/// back_const(self: *const Vector(DrawChannel)) *const DrawChannel
pub const back_const = raw.ImVector_ImDrawChannel_back_const;
/// begin(self: *Vector(DrawChannel)) [*]DrawChannel
pub const begin = raw.ImVector_ImDrawChannel_begin;
/// begin_const(self: *const Vector(DrawChannel)) [*]const DrawChannel
pub const begin_const = raw.ImVector_ImDrawChannel_begin_const;
/// capacity(self: *const Vector(DrawChannel)) i32
pub const capacity = raw.ImVector_ImDrawChannel_capacity;
/// clear(self: *Vector(DrawChannel)) void
pub const clear = raw.ImVector_ImDrawChannel_clear;
/// deinit(self: *Vector(DrawChannel)) void
pub const deinit = raw.ImVector_ImDrawChannel_destroy;
/// empty(self: *const Vector(DrawChannel)) bool
pub const empty = raw.ImVector_ImDrawChannel_empty;
/// end(self: *Vector(DrawChannel)) [*]DrawChannel
pub const end = raw.ImVector_ImDrawChannel_end;
/// end_const(self: *const Vector(DrawChannel)) [*]const DrawChannel
pub const end_const = raw.ImVector_ImDrawChannel_end_const;
/// erase(self: *Vector(DrawChannel), it: [*]const DrawChannel) [*]DrawChannel
pub const erase = raw.ImVector_ImDrawChannel_erase;
/// eraseTPtr(self: *Vector(DrawChannel), it: [*]const DrawChannel, it_last: [*]const DrawChannel) [*]DrawChannel
pub const eraseTPtr = raw.ImVector_ImDrawChannel_eraseTPtr;
/// erase_unsorted(self: *Vector(DrawChannel), it: [*]const DrawChannel) [*]DrawChannel
pub const erase_unsorted = raw.ImVector_ImDrawChannel_erase_unsorted;
/// front(self: *Vector(DrawChannel)) *DrawChannel
pub const front = raw.ImVector_ImDrawChannel_front;
/// front_const(self: *const Vector(DrawChannel)) *const DrawChannel
pub const front_const = raw.ImVector_ImDrawChannel_front_const;
/// index_from_ptr(self: *const Vector(DrawChannel), it: [*]const DrawChannel) i32
pub const index_from_ptr = raw.ImVector_ImDrawChannel_index_from_ptr;
/// insert(self: *Vector(DrawChannel), it: [*]const DrawChannel, v: DrawChannel) [*]DrawChannel
pub const insert = raw.ImVector_ImDrawChannel_insert;
/// pop_back(self: *Vector(DrawChannel)) void
pub const pop_back = raw.ImVector_ImDrawChannel_pop_back;
/// push_back(self: *Vector(DrawChannel), v: DrawChannel) void
pub const push_back = raw.ImVector_ImDrawChannel_push_back;
/// push_front(self: *Vector(DrawChannel), v: DrawChannel) void
pub const push_front = raw.ImVector_ImDrawChannel_push_front;
/// reserve(self: *Vector(DrawChannel), new_capacity: i32) void
pub const reserve = raw.ImVector_ImDrawChannel_reserve;
/// resize(self: *Vector(DrawChannel), new_size: i32) void
pub const resize = raw.ImVector_ImDrawChannel_resize;
/// resizeT(self: *Vector(DrawChannel), new_size: i32, v: DrawChannel) void
pub const resizeT = raw.ImVector_ImDrawChannel_resizeT;
/// shrink(self: *Vector(DrawChannel), new_size: i32) void
pub const shrink = raw.ImVector_ImDrawChannel_shrink;
/// size(self: *const Vector(DrawChannel)) i32
pub const size = raw.ImVector_ImDrawChannel_size;
/// size_in_bytes(self: *const Vector(DrawChannel)) i32
pub const size_in_bytes = raw.ImVector_ImDrawChannel_size_in_bytes;
/// swap(self: *Vector(DrawChannel), rhs: *Vector(DrawChannel)) void
pub const swap = raw.ImVector_ImDrawChannel_swap;
};
const FTABLE_ImVector_ImDrawCmd = struct {
/// init(self: *Vector(DrawCmd)) void
pub const init = raw.ImVector_ImDrawCmd_ImVector_ImDrawCmd;
/// initVector(self: *Vector(DrawCmd), src: Vector(DrawCmd)) void
pub const initVector = raw.ImVector_ImDrawCmd_ImVector_ImDrawCmdVector;
/// _grow_capacity(self: *const Vector(DrawCmd), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImDrawCmd__grow_capacity;
/// back(self: *Vector(DrawCmd)) *DrawCmd
pub const back = raw.ImVector_ImDrawCmd_back;
/// back_const(self: *const Vector(DrawCmd)) *const DrawCmd
pub const back_const = raw.ImVector_ImDrawCmd_back_const;
/// begin(self: *Vector(DrawCmd)) [*]DrawCmd
pub const begin = raw.ImVector_ImDrawCmd_begin;
/// begin_const(self: *const Vector(DrawCmd)) [*]const DrawCmd
pub const begin_const = raw.ImVector_ImDrawCmd_begin_const;
/// capacity(self: *const Vector(DrawCmd)) i32
pub const capacity = raw.ImVector_ImDrawCmd_capacity;
/// clear(self: *Vector(DrawCmd)) void
pub const clear = raw.ImVector_ImDrawCmd_clear;
/// deinit(self: *Vector(DrawCmd)) void
pub const deinit = raw.ImVector_ImDrawCmd_destroy;
/// empty(self: *const Vector(DrawCmd)) bool
pub const empty = raw.ImVector_ImDrawCmd_empty;
/// end(self: *Vector(DrawCmd)) [*]DrawCmd
pub const end = raw.ImVector_ImDrawCmd_end;
/// end_const(self: *const Vector(DrawCmd)) [*]const DrawCmd
pub const end_const = raw.ImVector_ImDrawCmd_end_const;
/// erase(self: *Vector(DrawCmd), it: [*]const DrawCmd) [*]DrawCmd
pub const erase = raw.ImVector_ImDrawCmd_erase;
/// eraseTPtr(self: *Vector(DrawCmd), it: [*]const DrawCmd, it_last: [*]const DrawCmd) [*]DrawCmd
pub const eraseTPtr = raw.ImVector_ImDrawCmd_eraseTPtr;
/// erase_unsorted(self: *Vector(DrawCmd), it: [*]const DrawCmd) [*]DrawCmd
pub const erase_unsorted = raw.ImVector_ImDrawCmd_erase_unsorted;
/// front(self: *Vector(DrawCmd)) *DrawCmd
pub const front = raw.ImVector_ImDrawCmd_front;
/// front_const(self: *const Vector(DrawCmd)) *const DrawCmd
pub const front_const = raw.ImVector_ImDrawCmd_front_const;
/// index_from_ptr(self: *const Vector(DrawCmd), it: [*]const DrawCmd) i32
pub const index_from_ptr = raw.ImVector_ImDrawCmd_index_from_ptr;
/// insert(self: *Vector(DrawCmd), it: [*]const DrawCmd, v: DrawCmd) [*]DrawCmd
pub const insert = raw.ImVector_ImDrawCmd_insert;
/// pop_back(self: *Vector(DrawCmd)) void
pub const pop_back = raw.ImVector_ImDrawCmd_pop_back;
/// push_back(self: *Vector(DrawCmd), v: DrawCmd) void
pub const push_back = raw.ImVector_ImDrawCmd_push_back;
/// push_front(self: *Vector(DrawCmd), v: DrawCmd) void
pub const push_front = raw.ImVector_ImDrawCmd_push_front;
/// reserve(self: *Vector(DrawCmd), new_capacity: i32) void
pub const reserve = raw.ImVector_ImDrawCmd_reserve;
/// resize(self: *Vector(DrawCmd), new_size: i32) void
pub const resize = raw.ImVector_ImDrawCmd_resize;
/// resizeT(self: *Vector(DrawCmd), new_size: i32, v: DrawCmd) void
pub const resizeT = raw.ImVector_ImDrawCmd_resizeT;
/// shrink(self: *Vector(DrawCmd), new_size: i32) void
pub const shrink = raw.ImVector_ImDrawCmd_shrink;
/// size(self: *const Vector(DrawCmd)) i32
pub const size = raw.ImVector_ImDrawCmd_size;
/// size_in_bytes(self: *const Vector(DrawCmd)) i32
pub const size_in_bytes = raw.ImVector_ImDrawCmd_size_in_bytes;
/// swap(self: *Vector(DrawCmd), rhs: *Vector(DrawCmd)) void
pub const swap = raw.ImVector_ImDrawCmd_swap;
};
const FTABLE_ImVector_ImDrawIdx = struct {
/// init(self: *Vector(DrawIdx)) void
pub const init = raw.ImVector_ImDrawIdx_ImVector_ImDrawIdx;
/// initVector(self: *Vector(DrawIdx), src: Vector(DrawIdx)) void
pub const initVector = raw.ImVector_ImDrawIdx_ImVector_ImDrawIdxVector;
/// _grow_capacity(self: *const Vector(DrawIdx), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImDrawIdx__grow_capacity;
/// back(self: *Vector(DrawIdx)) *DrawIdx
pub const back = raw.ImVector_ImDrawIdx_back;
/// back_const(self: *const Vector(DrawIdx)) *const DrawIdx
pub const back_const = raw.ImVector_ImDrawIdx_back_const;
/// begin(self: *Vector(DrawIdx)) [*]DrawIdx
pub const begin = raw.ImVector_ImDrawIdx_begin;
/// begin_const(self: *const Vector(DrawIdx)) [*]const DrawIdx
pub const begin_const = raw.ImVector_ImDrawIdx_begin_const;
/// capacity(self: *const Vector(DrawIdx)) i32
pub const capacity = raw.ImVector_ImDrawIdx_capacity;
/// clear(self: *Vector(DrawIdx)) void
pub const clear = raw.ImVector_ImDrawIdx_clear;
/// contains(self: *const Vector(DrawIdx), v: DrawIdx) bool
pub const contains = raw.ImVector_ImDrawIdx_contains;
/// deinit(self: *Vector(DrawIdx)) void
pub const deinit = raw.ImVector_ImDrawIdx_destroy;
/// empty(self: *const Vector(DrawIdx)) bool
pub const empty = raw.ImVector_ImDrawIdx_empty;
/// end(self: *Vector(DrawIdx)) [*]DrawIdx
pub const end = raw.ImVector_ImDrawIdx_end;
/// end_const(self: *const Vector(DrawIdx)) [*]const DrawIdx
pub const end_const = raw.ImVector_ImDrawIdx_end_const;
/// erase(self: *Vector(DrawIdx), it: [*]const DrawIdx) [*]DrawIdx
pub const erase = raw.ImVector_ImDrawIdx_erase;
/// eraseTPtr(self: *Vector(DrawIdx), it: [*]const DrawIdx, it_last: [*]const DrawIdx) [*]DrawIdx
pub const eraseTPtr = raw.ImVector_ImDrawIdx_eraseTPtr;
/// erase_unsorted(self: *Vector(DrawIdx), it: [*]const DrawIdx) [*]DrawIdx
pub const erase_unsorted = raw.ImVector_ImDrawIdx_erase_unsorted;
/// find(self: *Vector(DrawIdx), v: DrawIdx) [*]DrawIdx
pub const find = raw.ImVector_ImDrawIdx_find;
/// find_const(self: *const Vector(DrawIdx), v: DrawIdx) [*]const DrawIdx
pub const find_const = raw.ImVector_ImDrawIdx_find_const;
/// find_erase(self: *Vector(DrawIdx), v: DrawIdx) bool
pub const find_erase = raw.ImVector_ImDrawIdx_find_erase;
/// find_erase_unsorted(self: *Vector(DrawIdx), v: DrawIdx) bool
pub const find_erase_unsorted = raw.ImVector_ImDrawIdx_find_erase_unsorted;
/// front(self: *Vector(DrawIdx)) *DrawIdx
pub const front = raw.ImVector_ImDrawIdx_front;
/// front_const(self: *const Vector(DrawIdx)) *const DrawIdx
pub const front_const = raw.ImVector_ImDrawIdx_front_const;
/// index_from_ptr(self: *const Vector(DrawIdx), it: [*]const DrawIdx) i32
pub const index_from_ptr = raw.ImVector_ImDrawIdx_index_from_ptr;
/// insert(self: *Vector(DrawIdx), it: [*]const DrawIdx, v: DrawIdx) [*]DrawIdx
pub const insert = raw.ImVector_ImDrawIdx_insert;
/// pop_back(self: *Vector(DrawIdx)) void
pub const pop_back = raw.ImVector_ImDrawIdx_pop_back;
/// push_back(self: *Vector(DrawIdx), v: DrawIdx) void
pub const push_back = raw.ImVector_ImDrawIdx_push_back;
/// push_front(self: *Vector(DrawIdx), v: DrawIdx) void
pub const push_front = raw.ImVector_ImDrawIdx_push_front;
/// reserve(self: *Vector(DrawIdx), new_capacity: i32) void
pub const reserve = raw.ImVector_ImDrawIdx_reserve;
/// resize(self: *Vector(DrawIdx), new_size: i32) void
pub const resize = raw.ImVector_ImDrawIdx_resize;
/// resizeT(self: *Vector(DrawIdx), new_size: i32, v: DrawIdx) void
pub const resizeT = raw.ImVector_ImDrawIdx_resizeT;
/// shrink(self: *Vector(DrawIdx), new_size: i32) void
pub const shrink = raw.ImVector_ImDrawIdx_shrink;
/// size(self: *const Vector(DrawIdx)) i32
pub const size = raw.ImVector_ImDrawIdx_size;
/// size_in_bytes(self: *const Vector(DrawIdx)) i32
pub const size_in_bytes = raw.ImVector_ImDrawIdx_size_in_bytes;
/// swap(self: *Vector(DrawIdx), rhs: *Vector(DrawIdx)) void
pub const swap = raw.ImVector_ImDrawIdx_swap;
};
const FTABLE_ImVector_ImDrawVert = struct {
/// init(self: *Vector(DrawVert)) void
pub const init = raw.ImVector_ImDrawVert_ImVector_ImDrawVert;
/// initVector(self: *Vector(DrawVert), src: Vector(DrawVert)) void
pub const initVector = raw.ImVector_ImDrawVert_ImVector_ImDrawVertVector;
/// _grow_capacity(self: *const Vector(DrawVert), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImDrawVert__grow_capacity;
/// back(self: *Vector(DrawVert)) *DrawVert
pub const back = raw.ImVector_ImDrawVert_back;
/// back_const(self: *const Vector(DrawVert)) *const DrawVert
pub const back_const = raw.ImVector_ImDrawVert_back_const;
/// begin(self: *Vector(DrawVert)) [*]DrawVert
pub const begin = raw.ImVector_ImDrawVert_begin;
/// begin_const(self: *const Vector(DrawVert)) [*]const DrawVert
pub const begin_const = raw.ImVector_ImDrawVert_begin_const;
/// capacity(self: *const Vector(DrawVert)) i32
pub const capacity = raw.ImVector_ImDrawVert_capacity;
/// clear(self: *Vector(DrawVert)) void
pub const clear = raw.ImVector_ImDrawVert_clear;
/// deinit(self: *Vector(DrawVert)) void
pub const deinit = raw.ImVector_ImDrawVert_destroy;
/// empty(self: *const Vector(DrawVert)) bool
pub const empty = raw.ImVector_ImDrawVert_empty;
/// end(self: *Vector(DrawVert)) [*]DrawVert
pub const end = raw.ImVector_ImDrawVert_end;
/// end_const(self: *const Vector(DrawVert)) [*]const DrawVert
pub const end_const = raw.ImVector_ImDrawVert_end_const;
/// erase(self: *Vector(DrawVert), it: [*]const DrawVert) [*]DrawVert
pub const erase = raw.ImVector_ImDrawVert_erase;
/// eraseTPtr(self: *Vector(DrawVert), it: [*]const DrawVert, it_last: [*]const DrawVert) [*]DrawVert
pub const eraseTPtr = raw.ImVector_ImDrawVert_eraseTPtr;
/// erase_unsorted(self: *Vector(DrawVert), it: [*]const DrawVert) [*]DrawVert
pub const erase_unsorted = raw.ImVector_ImDrawVert_erase_unsorted;
/// front(self: *Vector(DrawVert)) *DrawVert
pub const front = raw.ImVector_ImDrawVert_front;
/// front_const(self: *const Vector(DrawVert)) *const DrawVert
pub const front_const = raw.ImVector_ImDrawVert_front_const;
/// index_from_ptr(self: *const Vector(DrawVert), it: [*]const DrawVert) i32
pub const index_from_ptr = raw.ImVector_ImDrawVert_index_from_ptr;
/// insert(self: *Vector(DrawVert), it: [*]const DrawVert, v: DrawVert) [*]DrawVert
pub const insert = raw.ImVector_ImDrawVert_insert;
/// pop_back(self: *Vector(DrawVert)) void
pub const pop_back = raw.ImVector_ImDrawVert_pop_back;
/// push_back(self: *Vector(DrawVert), v: DrawVert) void
pub const push_back = raw.ImVector_ImDrawVert_push_back;
/// push_front(self: *Vector(DrawVert), v: DrawVert) void
pub const push_front = raw.ImVector_ImDrawVert_push_front;
/// reserve(self: *Vector(DrawVert), new_capacity: i32) void
pub const reserve = raw.ImVector_ImDrawVert_reserve;
/// resize(self: *Vector(DrawVert), new_size: i32) void
pub const resize = raw.ImVector_ImDrawVert_resize;
/// resizeT(self: *Vector(DrawVert), new_size: i32, v: DrawVert) void
pub const resizeT = raw.ImVector_ImDrawVert_resizeT;
/// shrink(self: *Vector(DrawVert), new_size: i32) void
pub const shrink = raw.ImVector_ImDrawVert_shrink;
/// size(self: *const Vector(DrawVert)) i32
pub const size = raw.ImVector_ImDrawVert_size;
/// size_in_bytes(self: *const Vector(DrawVert)) i32
pub const size_in_bytes = raw.ImVector_ImDrawVert_size_in_bytes;
/// swap(self: *Vector(DrawVert), rhs: *Vector(DrawVert)) void
pub const swap = raw.ImVector_ImDrawVert_swap;
};
const FTABLE_ImVector_ImFontPtr = struct {
/// init(self: *Vector(*Font)) void
pub const init = raw.ImVector_ImFontPtr_ImVector_ImFontPtr;
/// initVector(self: *Vector(*Font), src: Vector(*Font)) void
pub const initVector = raw.ImVector_ImFontPtr_ImVector_ImFontPtrVector;
/// _grow_capacity(self: *const Vector(*Font), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImFontPtr__grow_capacity;
/// back(self: *Vector(*Font)) **Font
pub const back = raw.ImVector_ImFontPtr_back;
/// back_const(self: *const Vector(*Font)) *const *Font
pub const back_const = raw.ImVector_ImFontPtr_back_const;
/// begin(self: *Vector(*Font)) [*]*Font
pub const begin = raw.ImVector_ImFontPtr_begin;
/// begin_const(self: *const Vector(*Font)) [*]const *Font
pub const begin_const = raw.ImVector_ImFontPtr_begin_const;
/// capacity(self: *const Vector(*Font)) i32
pub const capacity = raw.ImVector_ImFontPtr_capacity;
/// clear(self: *Vector(*Font)) void
pub const clear = raw.ImVector_ImFontPtr_clear;
/// contains(self: *const Vector(*Font), v: *Font) bool
pub const contains = raw.ImVector_ImFontPtr_contains;
/// deinit(self: *Vector(*Font)) void
pub const deinit = raw.ImVector_ImFontPtr_destroy;
/// empty(self: *const Vector(*Font)) bool
pub const empty = raw.ImVector_ImFontPtr_empty;
/// end(self: *Vector(*Font)) [*]*Font
pub const end = raw.ImVector_ImFontPtr_end;
/// end_const(self: *const Vector(*Font)) [*]const *Font
pub const end_const = raw.ImVector_ImFontPtr_end_const;
/// erase(self: *Vector(*Font), it: [*]const *Font) [*]*Font
pub const erase = raw.ImVector_ImFontPtr_erase;
/// eraseTPtr(self: *Vector(*Font), it: [*]const *Font, it_last: [*]const *Font) [*]*Font
pub const eraseTPtr = raw.ImVector_ImFontPtr_eraseTPtr;
/// erase_unsorted(self: *Vector(*Font), it: [*]const *Font) [*]*Font
pub const erase_unsorted = raw.ImVector_ImFontPtr_erase_unsorted;
/// find(self: *Vector(*Font), v: *Font) [*]*Font
pub const find = raw.ImVector_ImFontPtr_find;
/// find_const(self: *const Vector(*Font), v: *Font) [*]const *Font
pub const find_const = raw.ImVector_ImFontPtr_find_const;
/// find_erase(self: *Vector(*Font), v: *Font) bool
pub const find_erase = raw.ImVector_ImFontPtr_find_erase;
/// find_erase_unsorted(self: *Vector(*Font), v: *Font) bool
pub const find_erase_unsorted = raw.ImVector_ImFontPtr_find_erase_unsorted;
/// front(self: *Vector(*Font)) **Font
pub const front = raw.ImVector_ImFontPtr_front;
/// front_const(self: *const Vector(*Font)) *const *Font
pub const front_const = raw.ImVector_ImFontPtr_front_const;
/// index_from_ptr(self: *const Vector(*Font), it: [*]const *Font) i32
pub const index_from_ptr = raw.ImVector_ImFontPtr_index_from_ptr;
/// insert(self: *Vector(*Font), it: [*]const *Font, v: *Font) [*]*Font
pub const insert = raw.ImVector_ImFontPtr_insert;
/// pop_back(self: *Vector(*Font)) void
pub const pop_back = raw.ImVector_ImFontPtr_pop_back;
/// push_back(self: *Vector(*Font), v: *Font) void
pub const push_back = raw.ImVector_ImFontPtr_push_back;
/// push_front(self: *Vector(*Font), v: *Font) void
pub const push_front = raw.ImVector_ImFontPtr_push_front;
/// reserve(self: *Vector(*Font), new_capacity: i32) void
pub const reserve = raw.ImVector_ImFontPtr_reserve;
/// resize(self: *Vector(*Font), new_size: i32) void
pub const resize = raw.ImVector_ImFontPtr_resize;
/// resizeT(self: *Vector(*Font), new_size: i32, v: *Font) void
pub const resizeT = raw.ImVector_ImFontPtr_resizeT;
/// shrink(self: *Vector(*Font), new_size: i32) void
pub const shrink = raw.ImVector_ImFontPtr_shrink;
/// size(self: *const Vector(*Font)) i32
pub const size = raw.ImVector_ImFontPtr_size;
/// size_in_bytes(self: *const Vector(*Font)) i32
pub const size_in_bytes = raw.ImVector_ImFontPtr_size_in_bytes;
/// swap(self: *Vector(*Font), rhs: *Vector(*Font)) void
pub const swap = raw.ImVector_ImFontPtr_swap;
};
const FTABLE_ImVector_ImFontAtlasCustomRect = struct {
/// init(self: *Vector(FontAtlasCustomRect)) void
pub const init = raw.ImVector_ImFontAtlasCustomRect_ImVector_ImFontAtlasCustomRect;
/// initVector(self: *Vector(FontAtlasCustomRect), src: Vector(FontAtlasCustomRect)) void
pub const initVector = raw.ImVector_ImFontAtlasCustomRect_ImVector_ImFontAtlasCustomRectVector;
/// _grow_capacity(self: *const Vector(FontAtlasCustomRect), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImFontAtlasCustomRect__grow_capacity;
/// back(self: *Vector(FontAtlasCustomRect)) *FontAtlasCustomRect
pub const back = raw.ImVector_ImFontAtlasCustomRect_back;
/// back_const(self: *const Vector(FontAtlasCustomRect)) *const FontAtlasCustomRect
pub const back_const = raw.ImVector_ImFontAtlasCustomRect_back_const;
/// begin(self: *Vector(FontAtlasCustomRect)) [*]FontAtlasCustomRect
pub const begin = raw.ImVector_ImFontAtlasCustomRect_begin;
/// begin_const(self: *const Vector(FontAtlasCustomRect)) [*]const FontAtlasCustomRect
pub const begin_const = raw.ImVector_ImFontAtlasCustomRect_begin_const;
/// capacity(self: *const Vector(FontAtlasCustomRect)) i32
pub const capacity = raw.ImVector_ImFontAtlasCustomRect_capacity;
/// clear(self: *Vector(FontAtlasCustomRect)) void
pub const clear = raw.ImVector_ImFontAtlasCustomRect_clear;
/// deinit(self: *Vector(FontAtlasCustomRect)) void
pub const deinit = raw.ImVector_ImFontAtlasCustomRect_destroy;
/// empty(self: *const Vector(FontAtlasCustomRect)) bool
pub const empty = raw.ImVector_ImFontAtlasCustomRect_empty;
/// end(self: *Vector(FontAtlasCustomRect)) [*]FontAtlasCustomRect
pub const end = raw.ImVector_ImFontAtlasCustomRect_end;
/// end_const(self: *const Vector(FontAtlasCustomRect)) [*]const FontAtlasCustomRect
pub const end_const = raw.ImVector_ImFontAtlasCustomRect_end_const;
/// erase(self: *Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect) [*]FontAtlasCustomRect
pub const erase = raw.ImVector_ImFontAtlasCustomRect_erase;
/// eraseTPtr(self: *Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect, it_last: [*]const FontAtlasCustomRect) [*]FontAtlasCustomRect
pub const eraseTPtr = raw.ImVector_ImFontAtlasCustomRect_eraseTPtr;
/// erase_unsorted(self: *Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect) [*]FontAtlasCustomRect
pub const erase_unsorted = raw.ImVector_ImFontAtlasCustomRect_erase_unsorted;
/// front(self: *Vector(FontAtlasCustomRect)) *FontAtlasCustomRect
pub const front = raw.ImVector_ImFontAtlasCustomRect_front;
/// front_const(self: *const Vector(FontAtlasCustomRect)) *const FontAtlasCustomRect
pub const front_const = raw.ImVector_ImFontAtlasCustomRect_front_const;
/// index_from_ptr(self: *const Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect) i32
pub const index_from_ptr = raw.ImVector_ImFontAtlasCustomRect_index_from_ptr;
/// insert(self: *Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect, v: FontAtlasCustomRect) [*]FontAtlasCustomRect
pub const insert = raw.ImVector_ImFontAtlasCustomRect_insert;
/// pop_back(self: *Vector(FontAtlasCustomRect)) void
pub const pop_back = raw.ImVector_ImFontAtlasCustomRect_pop_back;
/// push_back(self: *Vector(FontAtlasCustomRect), v: FontAtlasCustomRect) void
pub const push_back = raw.ImVector_ImFontAtlasCustomRect_push_back;
/// push_front(self: *Vector(FontAtlasCustomRect), v: FontAtlasCustomRect) void
pub const push_front = raw.ImVector_ImFontAtlasCustomRect_push_front;
/// reserve(self: *Vector(FontAtlasCustomRect), new_capacity: i32) void
pub const reserve = raw.ImVector_ImFontAtlasCustomRect_reserve;
/// resize(self: *Vector(FontAtlasCustomRect), new_size: i32) void
pub const resize = raw.ImVector_ImFontAtlasCustomRect_resize;
/// resizeT(self: *Vector(FontAtlasCustomRect), new_size: i32, v: FontAtlasCustomRect) void
pub const resizeT = raw.ImVector_ImFontAtlasCustomRect_resizeT;
/// shrink(self: *Vector(FontAtlasCustomRect), new_size: i32) void
pub const shrink = raw.ImVector_ImFontAtlasCustomRect_shrink;
/// size(self: *const Vector(FontAtlasCustomRect)) i32
pub const size = raw.ImVector_ImFontAtlasCustomRect_size;
/// size_in_bytes(self: *const Vector(FontAtlasCustomRect)) i32
pub const size_in_bytes = raw.ImVector_ImFontAtlasCustomRect_size_in_bytes;
/// swap(self: *Vector(FontAtlasCustomRect), rhs: *Vector(FontAtlasCustomRect)) void
pub const swap = raw.ImVector_ImFontAtlasCustomRect_swap;
};
const FTABLE_ImVector_ImFontConfig = struct {
/// init(self: *Vector(FontConfig)) void
pub const init = raw.ImVector_ImFontConfig_ImVector_ImFontConfig;
/// initVector(self: *Vector(FontConfig), src: Vector(FontConfig)) void
pub const initVector = raw.ImVector_ImFontConfig_ImVector_ImFontConfigVector;
/// _grow_capacity(self: *const Vector(FontConfig), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImFontConfig__grow_capacity;
/// back(self: *Vector(FontConfig)) *FontConfig
pub const back = raw.ImVector_ImFontConfig_back;
/// back_const(self: *const Vector(FontConfig)) *const FontConfig
pub const back_const = raw.ImVector_ImFontConfig_back_const;
/// begin(self: *Vector(FontConfig)) [*]FontConfig
pub const begin = raw.ImVector_ImFontConfig_begin;
/// begin_const(self: *const Vector(FontConfig)) [*]const FontConfig
pub const begin_const = raw.ImVector_ImFontConfig_begin_const;
/// capacity(self: *const Vector(FontConfig)) i32
pub const capacity = raw.ImVector_ImFontConfig_capacity;
/// clear(self: *Vector(FontConfig)) void
pub const clear = raw.ImVector_ImFontConfig_clear;
/// deinit(self: *Vector(FontConfig)) void
pub const deinit = raw.ImVector_ImFontConfig_destroy;
/// empty(self: *const Vector(FontConfig)) bool
pub const empty = raw.ImVector_ImFontConfig_empty;
/// end(self: *Vector(FontConfig)) [*]FontConfig
pub const end = raw.ImVector_ImFontConfig_end;
/// end_const(self: *const Vector(FontConfig)) [*]const FontConfig
pub const end_const = raw.ImVector_ImFontConfig_end_const;
/// erase(self: *Vector(FontConfig), it: [*]const FontConfig) [*]FontConfig
pub const erase = raw.ImVector_ImFontConfig_erase;
/// eraseTPtr(self: *Vector(FontConfig), it: [*]const FontConfig, it_last: [*]const FontConfig) [*]FontConfig
pub const eraseTPtr = raw.ImVector_ImFontConfig_eraseTPtr;
/// erase_unsorted(self: *Vector(FontConfig), it: [*]const FontConfig) [*]FontConfig
pub const erase_unsorted = raw.ImVector_ImFontConfig_erase_unsorted;
/// front(self: *Vector(FontConfig)) *FontConfig
pub const front = raw.ImVector_ImFontConfig_front;
/// front_const(self: *const Vector(FontConfig)) *const FontConfig
pub const front_const = raw.ImVector_ImFontConfig_front_const;
/// index_from_ptr(self: *const Vector(FontConfig), it: [*]const FontConfig) i32
pub const index_from_ptr = raw.ImVector_ImFontConfig_index_from_ptr;
/// insert(self: *Vector(FontConfig), it: [*]const FontConfig, v: FontConfig) [*]FontConfig
pub const insert = raw.ImVector_ImFontConfig_insert;
/// pop_back(self: *Vector(FontConfig)) void
pub const pop_back = raw.ImVector_ImFontConfig_pop_back;
/// push_back(self: *Vector(FontConfig), v: FontConfig) void
pub const push_back = raw.ImVector_ImFontConfig_push_back;
/// push_front(self: *Vector(FontConfig), v: FontConfig) void
pub const push_front = raw.ImVector_ImFontConfig_push_front;
/// reserve(self: *Vector(FontConfig), new_capacity: i32) void
pub const reserve = raw.ImVector_ImFontConfig_reserve;
/// resize(self: *Vector(FontConfig), new_size: i32) void
pub const resize = raw.ImVector_ImFontConfig_resize;
/// resizeT(self: *Vector(FontConfig), new_size: i32, v: FontConfig) void
pub const resizeT = raw.ImVector_ImFontConfig_resizeT;
/// shrink(self: *Vector(FontConfig), new_size: i32) void
pub const shrink = raw.ImVector_ImFontConfig_shrink;
/// size(self: *const Vector(FontConfig)) i32
pub const size = raw.ImVector_ImFontConfig_size;
/// size_in_bytes(self: *const Vector(FontConfig)) i32
pub const size_in_bytes = raw.ImVector_ImFontConfig_size_in_bytes;
/// swap(self: *Vector(FontConfig), rhs: *Vector(FontConfig)) void
pub const swap = raw.ImVector_ImFontConfig_swap;
};
const FTABLE_ImVector_ImFontGlyph = struct {
/// init(self: *Vector(FontGlyph)) void
pub const init = raw.ImVector_ImFontGlyph_ImVector_ImFontGlyph;
/// initVector(self: *Vector(FontGlyph), src: Vector(FontGlyph)) void
pub const initVector = raw.ImVector_ImFontGlyph_ImVector_ImFontGlyphVector;
/// _grow_capacity(self: *const Vector(FontGlyph), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImFontGlyph__grow_capacity;
/// back(self: *Vector(FontGlyph)) *FontGlyph
pub const back = raw.ImVector_ImFontGlyph_back;
/// back_const(self: *const Vector(FontGlyph)) *const FontGlyph
pub const back_const = raw.ImVector_ImFontGlyph_back_const;
/// begin(self: *Vector(FontGlyph)) [*]FontGlyph
pub const begin = raw.ImVector_ImFontGlyph_begin;
/// begin_const(self: *const Vector(FontGlyph)) [*]const FontGlyph
pub const begin_const = raw.ImVector_ImFontGlyph_begin_const;
/// capacity(self: *const Vector(FontGlyph)) i32
pub const capacity = raw.ImVector_ImFontGlyph_capacity;
/// clear(self: *Vector(FontGlyph)) void
pub const clear = raw.ImVector_ImFontGlyph_clear;
/// deinit(self: *Vector(FontGlyph)) void
pub const deinit = raw.ImVector_ImFontGlyph_destroy;
/// empty(self: *const Vector(FontGlyph)) bool
pub const empty = raw.ImVector_ImFontGlyph_empty;
/// end(self: *Vector(FontGlyph)) [*]FontGlyph
pub const end = raw.ImVector_ImFontGlyph_end;
/// end_const(self: *const Vector(FontGlyph)) [*]const FontGlyph
pub const end_const = raw.ImVector_ImFontGlyph_end_const;
/// erase(self: *Vector(FontGlyph), it: [*]const FontGlyph) [*]FontGlyph
pub const erase = raw.ImVector_ImFontGlyph_erase;
/// eraseTPtr(self: *Vector(FontGlyph), it: [*]const FontGlyph, it_last: [*]const FontGlyph) [*]FontGlyph
pub const eraseTPtr = raw.ImVector_ImFontGlyph_eraseTPtr;
/// erase_unsorted(self: *Vector(FontGlyph), it: [*]const FontGlyph) [*]FontGlyph
pub const erase_unsorted = raw.ImVector_ImFontGlyph_erase_unsorted;
/// front(self: *Vector(FontGlyph)) *FontGlyph
pub const front = raw.ImVector_ImFontGlyph_front;
/// front_const(self: *const Vector(FontGlyph)) *const FontGlyph
pub const front_const = raw.ImVector_ImFontGlyph_front_const;
/// index_from_ptr(self: *const Vector(FontGlyph), it: [*]const FontGlyph) i32
pub const index_from_ptr = raw.ImVector_ImFontGlyph_index_from_ptr;
/// insert(self: *Vector(FontGlyph), it: [*]const FontGlyph, v: FontGlyph) [*]FontGlyph
pub const insert = raw.ImVector_ImFontGlyph_insert;
/// pop_back(self: *Vector(FontGlyph)) void
pub const pop_back = raw.ImVector_ImFontGlyph_pop_back;
/// push_back(self: *Vector(FontGlyph), v: FontGlyph) void
pub const push_back = raw.ImVector_ImFontGlyph_push_back;
/// push_front(self: *Vector(FontGlyph), v: FontGlyph) void
pub const push_front = raw.ImVector_ImFontGlyph_push_front;
/// reserve(self: *Vector(FontGlyph), new_capacity: i32) void
pub const reserve = raw.ImVector_ImFontGlyph_reserve;
/// resize(self: *Vector(FontGlyph), new_size: i32) void
pub const resize = raw.ImVector_ImFontGlyph_resize;
/// resizeT(self: *Vector(FontGlyph), new_size: i32, v: FontGlyph) void
pub const resizeT = raw.ImVector_ImFontGlyph_resizeT;
/// shrink(self: *Vector(FontGlyph), new_size: i32) void
pub const shrink = raw.ImVector_ImFontGlyph_shrink;
/// size(self: *const Vector(FontGlyph)) i32
pub const size = raw.ImVector_ImFontGlyph_size;
/// size_in_bytes(self: *const Vector(FontGlyph)) i32
pub const size_in_bytes = raw.ImVector_ImFontGlyph_size_in_bytes;
/// swap(self: *Vector(FontGlyph), rhs: *Vector(FontGlyph)) void
pub const swap = raw.ImVector_ImFontGlyph_swap;
};
const FTABLE_ImVector_ImGuiStoragePair = struct {
/// init(self: *Vector(StoragePair)) void
pub const init = raw.ImVector_ImGuiStoragePair_ImVector_ImGuiStoragePair;
/// initVector(self: *Vector(StoragePair), src: Vector(StoragePair)) void
pub const initVector = raw.ImVector_ImGuiStoragePair_ImVector_ImGuiStoragePairVector;
/// _grow_capacity(self: *const Vector(StoragePair), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImGuiStoragePair__grow_capacity;
/// back(self: *Vector(StoragePair)) *StoragePair
pub const back = raw.ImVector_ImGuiStoragePair_back;
/// back_const(self: *const Vector(StoragePair)) *const StoragePair
pub const back_const = raw.ImVector_ImGuiStoragePair_back_const;
/// begin(self: *Vector(StoragePair)) [*]StoragePair
pub const begin = raw.ImVector_ImGuiStoragePair_begin;
/// begin_const(self: *const Vector(StoragePair)) [*]const StoragePair
pub const begin_const = raw.ImVector_ImGuiStoragePair_begin_const;
/// capacity(self: *const Vector(StoragePair)) i32
pub const capacity = raw.ImVector_ImGuiStoragePair_capacity;
/// clear(self: *Vector(StoragePair)) void
pub const clear = raw.ImVector_ImGuiStoragePair_clear;
/// deinit(self: *Vector(StoragePair)) void
pub const deinit = raw.ImVector_ImGuiStoragePair_destroy;
/// empty(self: *const Vector(StoragePair)) bool
pub const empty = raw.ImVector_ImGuiStoragePair_empty;
/// end(self: *Vector(StoragePair)) [*]StoragePair
pub const end = raw.ImVector_ImGuiStoragePair_end;
/// end_const(self: *const Vector(StoragePair)) [*]const StoragePair
pub const end_const = raw.ImVector_ImGuiStoragePair_end_const;
/// erase(self: *Vector(StoragePair), it: [*]const StoragePair) [*]StoragePair
pub const erase = raw.ImVector_ImGuiStoragePair_erase;
/// eraseTPtr(self: *Vector(StoragePair), it: [*]const StoragePair, it_last: [*]const StoragePair) [*]StoragePair
pub const eraseTPtr = raw.ImVector_ImGuiStoragePair_eraseTPtr;
/// erase_unsorted(self: *Vector(StoragePair), it: [*]const StoragePair) [*]StoragePair
pub const erase_unsorted = raw.ImVector_ImGuiStoragePair_erase_unsorted;
/// front(self: *Vector(StoragePair)) *StoragePair
pub const front = raw.ImVector_ImGuiStoragePair_front;
/// front_const(self: *const Vector(StoragePair)) *const StoragePair
pub const front_const = raw.ImVector_ImGuiStoragePair_front_const;
/// index_from_ptr(self: *const Vector(StoragePair), it: [*]const StoragePair) i32
pub const index_from_ptr = raw.ImVector_ImGuiStoragePair_index_from_ptr;
/// insert(self: *Vector(StoragePair), it: [*]const StoragePair, v: StoragePair) [*]StoragePair
pub const insert = raw.ImVector_ImGuiStoragePair_insert;
/// pop_back(self: *Vector(StoragePair)) void
pub const pop_back = raw.ImVector_ImGuiStoragePair_pop_back;
/// push_back(self: *Vector(StoragePair), v: StoragePair) void
pub const push_back = raw.ImVector_ImGuiStoragePair_push_back;
/// push_front(self: *Vector(StoragePair), v: StoragePair) void
pub const push_front = raw.ImVector_ImGuiStoragePair_push_front;
/// reserve(self: *Vector(StoragePair), new_capacity: i32) void
pub const reserve = raw.ImVector_ImGuiStoragePair_reserve;
/// resize(self: *Vector(StoragePair), new_size: i32) void
pub const resize = raw.ImVector_ImGuiStoragePair_resize;
/// resizeT(self: *Vector(StoragePair), new_size: i32, v: StoragePair) void
pub const resizeT = raw.ImVector_ImGuiStoragePair_resizeT;
/// shrink(self: *Vector(StoragePair), new_size: i32) void
pub const shrink = raw.ImVector_ImGuiStoragePair_shrink;
/// size(self: *const Vector(StoragePair)) i32
pub const size = raw.ImVector_ImGuiStoragePair_size;
/// size_in_bytes(self: *const Vector(StoragePair)) i32
pub const size_in_bytes = raw.ImVector_ImGuiStoragePair_size_in_bytes;
/// swap(self: *Vector(StoragePair), rhs: *Vector(StoragePair)) void
pub const swap = raw.ImVector_ImGuiStoragePair_swap;
};
const FTABLE_ImVector_ImGuiTextRange = struct {
/// init(self: *Vector(TextRange)) void
pub const init = raw.ImVector_ImGuiTextRange_ImVector_ImGuiTextRange;
/// initVector(self: *Vector(TextRange), src: Vector(TextRange)) void
pub const initVector = raw.ImVector_ImGuiTextRange_ImVector_ImGuiTextRangeVector;
/// _grow_capacity(self: *const Vector(TextRange), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImGuiTextRange__grow_capacity;
/// back(self: *Vector(TextRange)) *TextRange
pub const back = raw.ImVector_ImGuiTextRange_back;
/// back_const(self: *const Vector(TextRange)) *const TextRange
pub const back_const = raw.ImVector_ImGuiTextRange_back_const;
/// begin(self: *Vector(TextRange)) [*]TextRange
pub const begin = raw.ImVector_ImGuiTextRange_begin;
/// begin_const(self: *const Vector(TextRange)) [*]const TextRange
pub const begin_const = raw.ImVector_ImGuiTextRange_begin_const;
/// capacity(self: *const Vector(TextRange)) i32
pub const capacity = raw.ImVector_ImGuiTextRange_capacity;
/// clear(self: *Vector(TextRange)) void
pub const clear = raw.ImVector_ImGuiTextRange_clear;
/// deinit(self: *Vector(TextRange)) void
pub const deinit = raw.ImVector_ImGuiTextRange_destroy;
/// empty(self: *const Vector(TextRange)) bool
pub const empty = raw.ImVector_ImGuiTextRange_empty;
/// end(self: *Vector(TextRange)) [*]TextRange
pub const end = raw.ImVector_ImGuiTextRange_end;
/// end_const(self: *const Vector(TextRange)) [*]const TextRange
pub const end_const = raw.ImVector_ImGuiTextRange_end_const;
/// erase(self: *Vector(TextRange), it: [*]const TextRange) [*]TextRange
pub const erase = raw.ImVector_ImGuiTextRange_erase;
/// eraseTPtr(self: *Vector(TextRange), it: [*]const TextRange, it_last: [*]const TextRange) [*]TextRange
pub const eraseTPtr = raw.ImVector_ImGuiTextRange_eraseTPtr;
/// erase_unsorted(self: *Vector(TextRange), it: [*]const TextRange) [*]TextRange
pub const erase_unsorted = raw.ImVector_ImGuiTextRange_erase_unsorted;
/// front(self: *Vector(TextRange)) *TextRange
pub const front = raw.ImVector_ImGuiTextRange_front;
/// front_const(self: *const Vector(TextRange)) *const TextRange
pub const front_const = raw.ImVector_ImGuiTextRange_front_const;
/// index_from_ptr(self: *const Vector(TextRange), it: [*]const TextRange) i32
pub const index_from_ptr = raw.ImVector_ImGuiTextRange_index_from_ptr;
/// insert(self: *Vector(TextRange), it: [*]const TextRange, v: TextRange) [*]TextRange
pub const insert = raw.ImVector_ImGuiTextRange_insert;
/// pop_back(self: *Vector(TextRange)) void
pub const pop_back = raw.ImVector_ImGuiTextRange_pop_back;
/// push_back(self: *Vector(TextRange), v: TextRange) void
pub const push_back = raw.ImVector_ImGuiTextRange_push_back;
/// push_front(self: *Vector(TextRange), v: TextRange) void
pub const push_front = raw.ImVector_ImGuiTextRange_push_front;
/// reserve(self: *Vector(TextRange), new_capacity: i32) void
pub const reserve = raw.ImVector_ImGuiTextRange_reserve;
/// resize(self: *Vector(TextRange), new_size: i32) void
pub const resize = raw.ImVector_ImGuiTextRange_resize;
/// resizeT(self: *Vector(TextRange), new_size: i32, v: TextRange) void
pub const resizeT = raw.ImVector_ImGuiTextRange_resizeT;
/// shrink(self: *Vector(TextRange), new_size: i32) void
pub const shrink = raw.ImVector_ImGuiTextRange_shrink;
/// size(self: *const Vector(TextRange)) i32
pub const size = raw.ImVector_ImGuiTextRange_size;
/// size_in_bytes(self: *const Vector(TextRange)) i32
pub const size_in_bytes = raw.ImVector_ImGuiTextRange_size_in_bytes;
/// swap(self: *Vector(TextRange), rhs: *Vector(TextRange)) void
pub const swap = raw.ImVector_ImGuiTextRange_swap;
};
const FTABLE_ImVector_ImTextureID = struct {
/// init(self: *Vector(TextureID)) void
pub const init = raw.ImVector_ImTextureID_ImVector_ImTextureID;
/// initVector(self: *Vector(TextureID), src: Vector(TextureID)) void
pub const initVector = raw.ImVector_ImTextureID_ImVector_ImTextureIDVector;
/// _grow_capacity(self: *const Vector(TextureID), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImTextureID__grow_capacity;
/// back(self: *Vector(TextureID)) *TextureID
pub const back = raw.ImVector_ImTextureID_back;
/// back_const(self: *const Vector(TextureID)) *const TextureID
pub const back_const = raw.ImVector_ImTextureID_back_const;
/// begin(self: *Vector(TextureID)) [*]TextureID
pub const begin = raw.ImVector_ImTextureID_begin;
/// begin_const(self: *const Vector(TextureID)) [*]const TextureID
pub const begin_const = raw.ImVector_ImTextureID_begin_const;
/// capacity(self: *const Vector(TextureID)) i32
pub const capacity = raw.ImVector_ImTextureID_capacity;
/// clear(self: *Vector(TextureID)) void
pub const clear = raw.ImVector_ImTextureID_clear;
/// contains(self: *const Vector(TextureID), v: TextureID) bool
pub const contains = raw.ImVector_ImTextureID_contains;
/// deinit(self: *Vector(TextureID)) void
pub const deinit = raw.ImVector_ImTextureID_destroy;
/// empty(self: *const Vector(TextureID)) bool
pub const empty = raw.ImVector_ImTextureID_empty;
/// end(self: *Vector(TextureID)) [*]TextureID
pub const end = raw.ImVector_ImTextureID_end;
/// end_const(self: *const Vector(TextureID)) [*]const TextureID
pub const end_const = raw.ImVector_ImTextureID_end_const;
/// erase(self: *Vector(TextureID), it: [*]const TextureID) [*]TextureID
pub const erase = raw.ImVector_ImTextureID_erase;
/// eraseTPtr(self: *Vector(TextureID), it: [*]const TextureID, it_last: [*]const TextureID) [*]TextureID
pub const eraseTPtr = raw.ImVector_ImTextureID_eraseTPtr;
/// erase_unsorted(self: *Vector(TextureID), it: [*]const TextureID) [*]TextureID
pub const erase_unsorted = raw.ImVector_ImTextureID_erase_unsorted;
/// find(self: *Vector(TextureID), v: TextureID) [*]TextureID
pub const find = raw.ImVector_ImTextureID_find;
/// find_const(self: *const Vector(TextureID), v: TextureID) [*]const TextureID
pub const find_const = raw.ImVector_ImTextureID_find_const;
/// find_erase(self: *Vector(TextureID), v: TextureID) bool
pub const find_erase = raw.ImVector_ImTextureID_find_erase;
/// find_erase_unsorted(self: *Vector(TextureID), v: TextureID) bool
pub const find_erase_unsorted = raw.ImVector_ImTextureID_find_erase_unsorted;
/// front(self: *Vector(TextureID)) *TextureID
pub const front = raw.ImVector_ImTextureID_front;
/// front_const(self: *const Vector(TextureID)) *const TextureID
pub const front_const = raw.ImVector_ImTextureID_front_const;
/// index_from_ptr(self: *const Vector(TextureID), it: [*]const TextureID) i32
pub const index_from_ptr = raw.ImVector_ImTextureID_index_from_ptr;
/// insert(self: *Vector(TextureID), it: [*]const TextureID, v: TextureID) [*]TextureID
pub const insert = raw.ImVector_ImTextureID_insert;
/// pop_back(self: *Vector(TextureID)) void
pub const pop_back = raw.ImVector_ImTextureID_pop_back;
/// push_back(self: *Vector(TextureID), v: TextureID) void
pub const push_back = raw.ImVector_ImTextureID_push_back;
/// push_front(self: *Vector(TextureID), v: TextureID) void
pub const push_front = raw.ImVector_ImTextureID_push_front;
/// reserve(self: *Vector(TextureID), new_capacity: i32) void
pub const reserve = raw.ImVector_ImTextureID_reserve;
/// resize(self: *Vector(TextureID), new_size: i32) void
pub const resize = raw.ImVector_ImTextureID_resize;
/// resizeT(self: *Vector(TextureID), new_size: i32, v: TextureID) void
pub const resizeT = raw.ImVector_ImTextureID_resizeT;
/// shrink(self: *Vector(TextureID), new_size: i32) void
pub const shrink = raw.ImVector_ImTextureID_shrink;
/// size(self: *const Vector(TextureID)) i32
pub const size = raw.ImVector_ImTextureID_size;
/// size_in_bytes(self: *const Vector(TextureID)) i32
pub const size_in_bytes = raw.ImVector_ImTextureID_size_in_bytes;
/// swap(self: *Vector(TextureID), rhs: *Vector(TextureID)) void
pub const swap = raw.ImVector_ImTextureID_swap;
};
const FTABLE_ImVector_ImU32 = struct {
/// init(self: *Vector(u32)) void
pub const init = raw.ImVector_ImU32_ImVector_ImU32;
/// initVector(self: *Vector(u32), src: Vector(u32)) void
pub const initVector = raw.ImVector_ImU32_ImVector_ImU32Vector;
/// _grow_capacity(self: *const Vector(u32), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImU32__grow_capacity;
/// back(self: *Vector(u32)) *u32
pub const back = raw.ImVector_ImU32_back;
/// back_const(self: *const Vector(u32)) *const u32
pub const back_const = raw.ImVector_ImU32_back_const;
/// begin(self: *Vector(u32)) [*]u32
pub const begin = raw.ImVector_ImU32_begin;
/// begin_const(self: *const Vector(u32)) [*]const u32
pub const begin_const = raw.ImVector_ImU32_begin_const;
/// capacity(self: *const Vector(u32)) i32
pub const capacity = raw.ImVector_ImU32_capacity;
/// clear(self: *Vector(u32)) void
pub const clear = raw.ImVector_ImU32_clear;
/// contains(self: *const Vector(u32), v: u32) bool
pub const contains = raw.ImVector_ImU32_contains;
/// deinit(self: *Vector(u32)) void
pub const deinit = raw.ImVector_ImU32_destroy;
/// empty(self: *const Vector(u32)) bool
pub const empty = raw.ImVector_ImU32_empty;
/// end(self: *Vector(u32)) [*]u32
pub const end = raw.ImVector_ImU32_end;
/// end_const(self: *const Vector(u32)) [*]const u32
pub const end_const = raw.ImVector_ImU32_end_const;
/// erase(self: *Vector(u32), it: [*]const u32) [*]u32
pub const erase = raw.ImVector_ImU32_erase;
/// eraseTPtr(self: *Vector(u32), it: [*]const u32, it_last: [*]const u32) [*]u32
pub const eraseTPtr = raw.ImVector_ImU32_eraseTPtr;
/// erase_unsorted(self: *Vector(u32), it: [*]const u32) [*]u32
pub const erase_unsorted = raw.ImVector_ImU32_erase_unsorted;
/// find(self: *Vector(u32), v: u32) [*]u32
pub const find = raw.ImVector_ImU32_find;
/// find_const(self: *const Vector(u32), v: u32) [*]const u32
pub const find_const = raw.ImVector_ImU32_find_const;
/// find_erase(self: *Vector(u32), v: u32) bool
pub const find_erase = raw.ImVector_ImU32_find_erase;
/// find_erase_unsorted(self: *Vector(u32), v: u32) bool
pub const find_erase_unsorted = raw.ImVector_ImU32_find_erase_unsorted;
/// front(self: *Vector(u32)) *u32
pub const front = raw.ImVector_ImU32_front;
/// front_const(self: *const Vector(u32)) *const u32
pub const front_const = raw.ImVector_ImU32_front_const;
/// index_from_ptr(self: *const Vector(u32), it: [*]const u32) i32
pub const index_from_ptr = raw.ImVector_ImU32_index_from_ptr;
/// insert(self: *Vector(u32), it: [*]const u32, v: u32) [*]u32
pub const insert = raw.ImVector_ImU32_insert;
/// pop_back(self: *Vector(u32)) void
pub const pop_back = raw.ImVector_ImU32_pop_back;
/// push_back(self: *Vector(u32), v: u32) void
pub const push_back = raw.ImVector_ImU32_push_back;
/// push_front(self: *Vector(u32), v: u32) void
pub const push_front = raw.ImVector_ImU32_push_front;
/// reserve(self: *Vector(u32), new_capacity: i32) void
pub const reserve = raw.ImVector_ImU32_reserve;
/// resize(self: *Vector(u32), new_size: i32) void
pub const resize = raw.ImVector_ImU32_resize;
/// resizeT(self: *Vector(u32), new_size: i32, v: u32) void
pub const resizeT = raw.ImVector_ImU32_resizeT;
/// shrink(self: *Vector(u32), new_size: i32) void
pub const shrink = raw.ImVector_ImU32_shrink;
/// size(self: *const Vector(u32)) i32
pub const size = raw.ImVector_ImU32_size;
/// size_in_bytes(self: *const Vector(u32)) i32
pub const size_in_bytes = raw.ImVector_ImU32_size_in_bytes;
/// swap(self: *Vector(u32), rhs: *Vector(u32)) void
pub const swap = raw.ImVector_ImU32_swap;
};
const FTABLE_ImVector_ImVec2 = struct {
/// init(self: *Vector(Vec2)) void
pub const init = raw.ImVector_ImVec2_ImVector_ImVec2;
/// initVector(self: *Vector(Vec2), src: Vector(Vec2)) void
pub const initVector = raw.ImVector_ImVec2_ImVector_ImVec2Vector;
/// _grow_capacity(self: *const Vector(Vec2), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImVec2__grow_capacity;
/// back(self: *Vector(Vec2)) *Vec2
pub const back = raw.ImVector_ImVec2_back;
/// back_const(self: *const Vector(Vec2)) *const Vec2
pub const back_const = raw.ImVector_ImVec2_back_const;
/// begin(self: *Vector(Vec2)) [*]Vec2
pub const begin = raw.ImVector_ImVec2_begin;
/// begin_const(self: *const Vector(Vec2)) [*]const Vec2
pub const begin_const = raw.ImVector_ImVec2_begin_const;
/// capacity(self: *const Vector(Vec2)) i32
pub const capacity = raw.ImVector_ImVec2_capacity;
/// clear(self: *Vector(Vec2)) void
pub const clear = raw.ImVector_ImVec2_clear;
/// deinit(self: *Vector(Vec2)) void
pub const deinit = raw.ImVector_ImVec2_destroy;
/// empty(self: *const Vector(Vec2)) bool
pub const empty = raw.ImVector_ImVec2_empty;
/// end(self: *Vector(Vec2)) [*]Vec2
pub const end = raw.ImVector_ImVec2_end;
/// end_const(self: *const Vector(Vec2)) [*]const Vec2
pub const end_const = raw.ImVector_ImVec2_end_const;
/// erase(self: *Vector(Vec2), it: [*]const Vec2) [*]Vec2
pub const erase = raw.ImVector_ImVec2_erase;
/// eraseTPtr(self: *Vector(Vec2), it: [*]const Vec2, it_last: [*]const Vec2) [*]Vec2
pub const eraseTPtr = raw.ImVector_ImVec2_eraseTPtr;
/// erase_unsorted(self: *Vector(Vec2), it: [*]const Vec2) [*]Vec2
pub const erase_unsorted = raw.ImVector_ImVec2_erase_unsorted;
/// front(self: *Vector(Vec2)) *Vec2
pub const front = raw.ImVector_ImVec2_front;
/// front_const(self: *const Vector(Vec2)) *const Vec2
pub const front_const = raw.ImVector_ImVec2_front_const;
/// index_from_ptr(self: *const Vector(Vec2), it: [*]const Vec2) i32
pub const index_from_ptr = raw.ImVector_ImVec2_index_from_ptr;
/// insert(self: *Vector(Vec2), it: [*]const Vec2, v: Vec2) [*]Vec2
pub const insert = raw.ImVector_ImVec2_insert;
/// pop_back(self: *Vector(Vec2)) void
pub const pop_back = raw.ImVector_ImVec2_pop_back;
/// push_back(self: *Vector(Vec2), v: Vec2) void
pub const push_back = raw.ImVector_ImVec2_push_back;
/// push_front(self: *Vector(Vec2), v: Vec2) void
pub const push_front = raw.ImVector_ImVec2_push_front;
/// reserve(self: *Vector(Vec2), new_capacity: i32) void
pub const reserve = raw.ImVector_ImVec2_reserve;
/// resize(self: *Vector(Vec2), new_size: i32) void
pub const resize = raw.ImVector_ImVec2_resize;
/// resizeT(self: *Vector(Vec2), new_size: i32, v: Vec2) void
pub const resizeT = raw.ImVector_ImVec2_resizeT;
/// shrink(self: *Vector(Vec2), new_size: i32) void
pub const shrink = raw.ImVector_ImVec2_shrink;
/// size(self: *const Vector(Vec2)) i32
pub const size = raw.ImVector_ImVec2_size;
/// size_in_bytes(self: *const Vector(Vec2)) i32
pub const size_in_bytes = raw.ImVector_ImVec2_size_in_bytes;
/// swap(self: *Vector(Vec2), rhs: *Vector(Vec2)) void
pub const swap = raw.ImVector_ImVec2_swap;
};
const FTABLE_ImVector_ImVec4 = struct {
/// init(self: *Vector(Vec4)) void
pub const init = raw.ImVector_ImVec4_ImVector_ImVec4;
/// initVector(self: *Vector(Vec4), src: Vector(Vec4)) void
pub const initVector = raw.ImVector_ImVec4_ImVector_ImVec4Vector;
/// _grow_capacity(self: *const Vector(Vec4), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImVec4__grow_capacity;
/// back(self: *Vector(Vec4)) *Vec4
pub const back = raw.ImVector_ImVec4_back;
/// back_const(self: *const Vector(Vec4)) *const Vec4
pub const back_const = raw.ImVector_ImVec4_back_const;
/// begin(self: *Vector(Vec4)) [*]Vec4
pub const begin = raw.ImVector_ImVec4_begin;
/// begin_const(self: *const Vector(Vec4)) [*]const Vec4
pub const begin_const = raw.ImVector_ImVec4_begin_const;
/// capacity(self: *const Vector(Vec4)) i32
pub const capacity = raw.ImVector_ImVec4_capacity;
/// clear(self: *Vector(Vec4)) void
pub const clear = raw.ImVector_ImVec4_clear;
/// deinit(self: *Vector(Vec4)) void
pub const deinit = raw.ImVector_ImVec4_destroy;
/// empty(self: *const Vector(Vec4)) bool
pub const empty = raw.ImVector_ImVec4_empty;
/// end(self: *Vector(Vec4)) [*]Vec4
pub const end = raw.ImVector_ImVec4_end;
/// end_const(self: *const Vector(Vec4)) [*]const Vec4
pub const end_const = raw.ImVector_ImVec4_end_const;
/// erase(self: *Vector(Vec4), it: [*]const Vec4) [*]Vec4
pub const erase = raw.ImVector_ImVec4_erase;
/// eraseTPtr(self: *Vector(Vec4), it: [*]const Vec4, it_last: [*]const Vec4) [*]Vec4
pub const eraseTPtr = raw.ImVector_ImVec4_eraseTPtr;
/// erase_unsorted(self: *Vector(Vec4), it: [*]const Vec4) [*]Vec4
pub const erase_unsorted = raw.ImVector_ImVec4_erase_unsorted;
/// front(self: *Vector(Vec4)) *Vec4
pub const front = raw.ImVector_ImVec4_front;
/// front_const(self: *const Vector(Vec4)) *const Vec4
pub const front_const = raw.ImVector_ImVec4_front_const;
/// index_from_ptr(self: *const Vector(Vec4), it: [*]const Vec4) i32
pub const index_from_ptr = raw.ImVector_ImVec4_index_from_ptr;
/// insert(self: *Vector(Vec4), it: [*]const Vec4, v: Vec4) [*]Vec4
pub const insert = raw.ImVector_ImVec4_insert;
/// pop_back(self: *Vector(Vec4)) void
pub const pop_back = raw.ImVector_ImVec4_pop_back;
/// push_back(self: *Vector(Vec4), v: Vec4) void
pub const push_back = raw.ImVector_ImVec4_push_back;
/// push_front(self: *Vector(Vec4), v: Vec4) void
pub const push_front = raw.ImVector_ImVec4_push_front;
/// reserve(self: *Vector(Vec4), new_capacity: i32) void
pub const reserve = raw.ImVector_ImVec4_reserve;
/// resize(self: *Vector(Vec4), new_size: i32) void
pub const resize = raw.ImVector_ImVec4_resize;
/// resizeT(self: *Vector(Vec4), new_size: i32, v: Vec4) void
pub const resizeT = raw.ImVector_ImVec4_resizeT;
/// shrink(self: *Vector(Vec4), new_size: i32) void
pub const shrink = raw.ImVector_ImVec4_shrink;
/// size(self: *const Vector(Vec4)) i32
pub const size = raw.ImVector_ImVec4_size;
/// size_in_bytes(self: *const Vector(Vec4)) i32
pub const size_in_bytes = raw.ImVector_ImVec4_size_in_bytes;
/// swap(self: *Vector(Vec4), rhs: *Vector(Vec4)) void
pub const swap = raw.ImVector_ImVec4_swap;
};
const FTABLE_ImVector_ImWchar = struct {
/// init(self: *Vector(Wchar)) void
pub const init = raw.ImVector_ImWchar_ImVector_ImWchar;
/// initVector(self: *Vector(Wchar), src: Vector(Wchar)) void
pub const initVector = raw.ImVector_ImWchar_ImVector_ImWcharVector;
/// _grow_capacity(self: *const Vector(Wchar), sz: i32) i32
pub const _grow_capacity = raw.ImVector_ImWchar__grow_capacity;
/// back(self: *Vector(Wchar)) *Wchar
pub const back = raw.ImVector_ImWchar_back;
/// back_const(self: *const Vector(Wchar)) *const Wchar
pub const back_const = raw.ImVector_ImWchar_back_const;
/// begin(self: *Vector(Wchar)) [*]Wchar
pub const begin = raw.ImVector_ImWchar_begin;
/// begin_const(self: *const Vector(Wchar)) [*]const Wchar
pub const begin_const = raw.ImVector_ImWchar_begin_const;
/// capacity(self: *const Vector(Wchar)) i32
pub const capacity = raw.ImVector_ImWchar_capacity;
/// clear(self: *Vector(Wchar)) void
pub const clear = raw.ImVector_ImWchar_clear;
/// contains(self: *const Vector(Wchar), v: Wchar) bool
pub const contains = raw.ImVector_ImWchar_contains;
/// deinit(self: *Vector(Wchar)) void
pub const deinit = raw.ImVector_ImWchar_destroy;
/// empty(self: *const Vector(Wchar)) bool
pub const empty = raw.ImVector_ImWchar_empty;
/// end(self: *Vector(Wchar)) [*]Wchar
pub const end = raw.ImVector_ImWchar_end;
/// end_const(self: *const Vector(Wchar)) [*]const Wchar
pub const end_const = raw.ImVector_ImWchar_end_const;
/// erase(self: *Vector(Wchar), it: [*]const Wchar) [*]Wchar
pub const erase = raw.ImVector_ImWchar_erase;
/// eraseTPtr(self: *Vector(Wchar), it: [*]const Wchar, it_last: [*]const Wchar) [*]Wchar
pub const eraseTPtr = raw.ImVector_ImWchar_eraseTPtr;
/// erase_unsorted(self: *Vector(Wchar), it: [*]const Wchar) [*]Wchar
pub const erase_unsorted = raw.ImVector_ImWchar_erase_unsorted;
/// find(self: *Vector(Wchar), v: Wchar) [*]Wchar
pub const find = raw.ImVector_ImWchar_find;
/// find_const(self: *const Vector(Wchar), v: Wchar) [*]const Wchar
pub const find_const = raw.ImVector_ImWchar_find_const;
/// find_erase(self: *Vector(Wchar), v: Wchar) bool
pub const find_erase = raw.ImVector_ImWchar_find_erase;
/// find_erase_unsorted(self: *Vector(Wchar), v: Wchar) bool
pub const find_erase_unsorted = raw.ImVector_ImWchar_find_erase_unsorted;
/// front(self: *Vector(Wchar)) *Wchar
pub const front = raw.ImVector_ImWchar_front;
/// front_const(self: *const Vector(Wchar)) *const Wchar
pub const front_const = raw.ImVector_ImWchar_front_const;
/// index_from_ptr(self: *const Vector(Wchar), it: [*]const Wchar) i32
pub const index_from_ptr = raw.ImVector_ImWchar_index_from_ptr;
/// insert(self: *Vector(Wchar), it: [*]const Wchar, v: Wchar) [*]Wchar
pub const insert = raw.ImVector_ImWchar_insert;
/// pop_back(self: *Vector(Wchar)) void
pub const pop_back = raw.ImVector_ImWchar_pop_back;
/// push_back(self: *Vector(Wchar), v: Wchar) void
pub const push_back = raw.ImVector_ImWchar_push_back;
/// push_front(self: *Vector(Wchar), v: Wchar) void
pub const push_front = raw.ImVector_ImWchar_push_front;
/// reserve(self: *Vector(Wchar), new_capacity: i32) void
pub const reserve = raw.ImVector_ImWchar_reserve;
/// resize(self: *Vector(Wchar), new_size: i32) void
pub const resize = raw.ImVector_ImWchar_resize;
/// resizeT(self: *Vector(Wchar), new_size: i32, v: Wchar) void
pub const resizeT = raw.ImVector_ImWchar_resizeT;
/// shrink(self: *Vector(Wchar), new_size: i32) void
pub const shrink = raw.ImVector_ImWchar_shrink;
/// size(self: *const Vector(Wchar)) i32
pub const size = raw.ImVector_ImWchar_size;
/// size_in_bytes(self: *const Vector(Wchar)) i32
pub const size_in_bytes = raw.ImVector_ImWchar_size_in_bytes;
/// swap(self: *Vector(Wchar), rhs: *Vector(Wchar)) void
pub const swap = raw.ImVector_ImWchar_swap;
};
const FTABLE_ImVector_char = struct {
/// init(self: *Vector(u8)) void
pub const init = raw.ImVector_char_ImVector_char;
/// initVector(self: *Vector(u8), src: Vector(u8)) void
pub const initVector = raw.ImVector_char_ImVector_charVector;
/// _grow_capacity(self: *const Vector(u8), sz: i32) i32
pub const _grow_capacity = raw.ImVector_char__grow_capacity;
/// back(self: *Vector(u8)) *u8
pub const back = raw.ImVector_char_back;
/// back_const(self: *const Vector(u8)) *const u8
pub const back_const = raw.ImVector_char_back_const;
/// begin(self: *Vector(u8)) [*]u8
pub const begin = raw.ImVector_char_begin;
/// begin_const(self: *const Vector(u8)) [*]const u8
pub const begin_const = raw.ImVector_char_begin_const;
/// capacity(self: *const Vector(u8)) i32
pub const capacity = raw.ImVector_char_capacity;
/// clear(self: *Vector(u8)) void
pub const clear = raw.ImVector_char_clear;
/// contains(self: *const Vector(u8), v: u8) bool
pub const contains = raw.ImVector_char_contains;
/// deinit(self: *Vector(u8)) void
pub const deinit = raw.ImVector_char_destroy;
/// empty(self: *const Vector(u8)) bool
pub const empty = raw.ImVector_char_empty;
/// end(self: *Vector(u8)) [*]u8
pub const end = raw.ImVector_char_end;
/// end_const(self: *const Vector(u8)) [*]const u8
pub const end_const = raw.ImVector_char_end_const;
/// erase(self: *Vector(u8), it: [*]const u8) [*]u8
pub const erase = raw.ImVector_char_erase;
/// eraseTPtr(self: *Vector(u8), it: [*]const u8, it_last: [*]const u8) [*]u8
pub const eraseTPtr = raw.ImVector_char_eraseTPtr;
/// erase_unsorted(self: *Vector(u8), it: [*]const u8) [*]u8
pub const erase_unsorted = raw.ImVector_char_erase_unsorted;
/// find(self: *Vector(u8), v: u8) [*]u8
pub const find = raw.ImVector_char_find;
/// find_const(self: *const Vector(u8), v: u8) [*]const u8
pub const find_const = raw.ImVector_char_find_const;
/// find_erase(self: *Vector(u8), v: u8) bool
pub const find_erase = raw.ImVector_char_find_erase;
/// find_erase_unsorted(self: *Vector(u8), v: u8) bool
pub const find_erase_unsorted = raw.ImVector_char_find_erase_unsorted;
/// front(self: *Vector(u8)) *u8
pub const front = raw.ImVector_char_front;
/// front_const(self: *const Vector(u8)) *const u8
pub const front_const = raw.ImVector_char_front_const;
/// index_from_ptr(self: *const Vector(u8), it: [*]const u8) i32
pub const index_from_ptr = raw.ImVector_char_index_from_ptr;
/// insert(self: *Vector(u8), it: [*]const u8, v: u8) [*]u8
pub const insert = raw.ImVector_char_insert;
/// pop_back(self: *Vector(u8)) void
pub const pop_back = raw.ImVector_char_pop_back;
/// push_back(self: *Vector(u8), v: u8) void
pub const push_back = raw.ImVector_char_push_back;
/// push_front(self: *Vector(u8), v: u8) void
pub const push_front = raw.ImVector_char_push_front;
/// reserve(self: *Vector(u8), new_capacity: i32) void
pub const reserve = raw.ImVector_char_reserve;
/// resize(self: *Vector(u8), new_size: i32) void
pub const resize = raw.ImVector_char_resize;
/// resizeT(self: *Vector(u8), new_size: i32, v: u8) void
pub const resizeT = raw.ImVector_char_resizeT;
/// shrink(self: *Vector(u8), new_size: i32) void
pub const shrink = raw.ImVector_char_shrink;
/// size(self: *const Vector(u8)) i32
pub const size = raw.ImVector_char_size;
/// size_in_bytes(self: *const Vector(u8)) i32
pub const size_in_bytes = raw.ImVector_char_size_in_bytes;
/// swap(self: *Vector(u8), rhs: *Vector(u8)) void
pub const swap = raw.ImVector_char_swap;
};
const FTABLE_ImVector_float = struct {
/// init(self: *Vector(f32)) void
pub const init = raw.ImVector_float_ImVector_float;
/// initVector(self: *Vector(f32), src: Vector(f32)) void
pub const initVector = raw.ImVector_float_ImVector_floatVector;
/// _grow_capacity(self: *const Vector(f32), sz: i32) i32
pub const _grow_capacity = raw.ImVector_float__grow_capacity;
/// back(self: *Vector(f32)) *f32
pub const back = raw.ImVector_float_back;
/// back_const(self: *const Vector(f32)) *const f32
pub const back_const = raw.ImVector_float_back_const;
/// begin(self: *Vector(f32)) [*]f32
pub const begin = raw.ImVector_float_begin;
/// begin_const(self: *const Vector(f32)) [*]const f32
pub const begin_const = raw.ImVector_float_begin_const;
/// capacity(self: *const Vector(f32)) i32
pub const capacity = raw.ImVector_float_capacity;
/// clear(self: *Vector(f32)) void
pub const clear = raw.ImVector_float_clear;
/// contains(self: *const Vector(f32), v: f32) bool
pub const contains = raw.ImVector_float_contains;
/// deinit(self: *Vector(f32)) void
pub const deinit = raw.ImVector_float_destroy;
/// empty(self: *const Vector(f32)) bool
pub const empty = raw.ImVector_float_empty;
/// end(self: *Vector(f32)) [*]f32
pub const end = raw.ImVector_float_end;
/// end_const(self: *const Vector(f32)) [*]const f32
pub const end_const = raw.ImVector_float_end_const;
/// erase(self: *Vector(f32), it: [*]const f32) [*]f32
pub const erase = raw.ImVector_float_erase;
/// eraseTPtr(self: *Vector(f32), it: [*]const f32, it_last: [*]const f32) [*]f32
pub const eraseTPtr = raw.ImVector_float_eraseTPtr;
/// erase_unsorted(self: *Vector(f32), it: [*]const f32) [*]f32
pub const erase_unsorted = raw.ImVector_float_erase_unsorted;
/// find(self: *Vector(f32), v: f32) [*]f32
pub const find = raw.ImVector_float_find;
/// find_const(self: *const Vector(f32), v: f32) [*]const f32
pub const find_const = raw.ImVector_float_find_const;
/// find_erase(self: *Vector(f32), v: f32) bool
pub const find_erase = raw.ImVector_float_find_erase;
/// find_erase_unsorted(self: *Vector(f32), v: f32) bool
pub const find_erase_unsorted = raw.ImVector_float_find_erase_unsorted;
/// front(self: *Vector(f32)) *f32
pub const front = raw.ImVector_float_front;
/// front_const(self: *const Vector(f32)) *const f32
pub const front_const = raw.ImVector_float_front_const;
/// index_from_ptr(self: *const Vector(f32), it: [*]const f32) i32
pub const index_from_ptr = raw.ImVector_float_index_from_ptr;
/// insert(self: *Vector(f32), it: [*]const f32, v: f32) [*]f32
pub const insert = raw.ImVector_float_insert;
/// pop_back(self: *Vector(f32)) void
pub const pop_back = raw.ImVector_float_pop_back;
/// push_back(self: *Vector(f32), v: f32) void
pub const push_back = raw.ImVector_float_push_back;
/// push_front(self: *Vector(f32), v: f32) void
pub const push_front = raw.ImVector_float_push_front;
/// reserve(self: *Vector(f32), new_capacity: i32) void
pub const reserve = raw.ImVector_float_reserve;
/// resize(self: *Vector(f32), new_size: i32) void
pub const resize = raw.ImVector_float_resize;
/// resizeT(self: *Vector(f32), new_size: i32, v: f32) void
pub const resizeT = raw.ImVector_float_resizeT;
/// shrink(self: *Vector(f32), new_size: i32) void
pub const shrink = raw.ImVector_float_shrink;
/// size(self: *const Vector(f32)) i32
pub const size = raw.ImVector_float_size;
/// size_in_bytes(self: *const Vector(f32)) i32
pub const size_in_bytes = raw.ImVector_float_size_in_bytes;
/// swap(self: *Vector(f32), rhs: *Vector(f32)) void
pub const swap = raw.ImVector_float_swap;
};
fn getFTABLE_ImVector(comptime T: type) type {
if (T == DrawChannel) return FTABLE_ImVector_ImDrawChannel;
if (T == DrawCmd) return FTABLE_ImVector_ImDrawCmd;
if (T == DrawIdx) return FTABLE_ImVector_ImDrawIdx;
if (T == DrawVert) return FTABLE_ImVector_ImDrawVert;
if (T == *Font) return FTABLE_ImVector_ImFontPtr;
if (T == FontAtlasCustomRect) return FTABLE_ImVector_ImFontAtlasCustomRect;
if (T == FontConfig) return FTABLE_ImVector_ImFontConfig;
if (T == FontGlyph) return FTABLE_ImVector_ImFontGlyph;
if (T == StoragePair) return FTABLE_ImVector_ImGuiStoragePair;
if (T == TextRange) return FTABLE_ImVector_ImGuiTextRange;
if (T == TextureID) return FTABLE_ImVector_ImTextureID;
if (T == u32) return FTABLE_ImVector_ImU32;
if (T == Vec2) return FTABLE_ImVector_ImVec2;
if (T == Vec4) return FTABLE_ImVector_ImVec4;
if (T == Wchar) return FTABLE_ImVector_ImWchar;
if (T == u8) return FTABLE_ImVector_char;
if (T == f32) return FTABLE_ImVector_float;
@compileError("Invalid Vector type");
}
pub fn Vector(comptime T: type) type {
return extern struct {
len: i32,
capacity: i32,
items: [*]T,
pub usingnamespace getFTABLE_ImVector(T);
};
}
pub fn AcceptDragDropPayloadExt(kind: ?[*:0]const u8, flags: DragDropFlags) callconv(.Inline) ?*const Payload {
return raw.igAcceptDragDropPayload(kind, flags.toInt());
}
pub fn AcceptDragDropPayload(kind: ?[*:0]const u8) callconv(.Inline) ?*const Payload {
return AcceptDragDropPayloadExt(kind, .{});
}
/// AlignTextToFramePadding() void
pub const AlignTextToFramePadding = raw.igAlignTextToFramePadding;
/// ArrowButton(str_id: ?[*:0]const u8, dir: Dir) bool
pub const ArrowButton = raw.igArrowButton;
pub fn BeginExt(name: ?[*:0]const u8, p_open: ?*bool, flags: WindowFlags) callconv(.Inline) bool {
return raw.igBegin(name, p_open, flags.toInt());
}
pub fn Begin(name: ?[*:0]const u8) callconv(.Inline) bool {
return BeginExt(name, null, .{});
}
pub fn BeginChildStrExt(str_id: ?[*:0]const u8, size: Vec2, border: bool, flags: WindowFlags) callconv(.Inline) bool {
return raw.igBeginChildStr(str_id, size, border, flags.toInt());
}
pub fn BeginChildStr(str_id: ?[*:0]const u8) callconv(.Inline) bool {
return BeginChildStrExt(str_id, .{ .x = 0, .y = 0 }, false, .{});
}
pub fn BeginChildIDExt(id: ID, size: Vec2, border: bool, flags: WindowFlags) callconv(.Inline) bool {
return raw.igBeginChildID(id, size, border, flags.toInt());
}
pub fn BeginChildID(id: ID) callconv(.Inline) bool {
return BeginChildIDExt(id, .{ .x = 0, .y = 0 }, false, .{});
}
pub fn BeginChildFrameExt(id: ID, size: Vec2, flags: WindowFlags) callconv(.Inline) bool {
return raw.igBeginChildFrame(id, size, flags.toInt());
}
pub fn BeginChildFrame(id: ID, size: Vec2) callconv(.Inline) bool {
return BeginChildFrameExt(id, size, .{});
}
pub fn BeginComboExt(label: ?[*:0]const u8, preview_value: ?[*:0]const u8, flags: ComboFlags) callconv(.Inline) bool {
return raw.igBeginCombo(label, preview_value, flags.toInt());
}
pub fn BeginCombo(label: ?[*:0]const u8, preview_value: ?[*:0]const u8) callconv(.Inline) bool {
return BeginComboExt(label, preview_value, .{});
}
pub fn BeginDragDropSourceExt(flags: DragDropFlags) callconv(.Inline) bool {
return raw.igBeginDragDropSource(flags.toInt());
}
pub fn BeginDragDropSource() callconv(.Inline) bool {
return BeginDragDropSourceExt(.{});
}
/// BeginDragDropTarget() bool
pub const BeginDragDropTarget = raw.igBeginDragDropTarget;
/// BeginGroup() void
pub const BeginGroup = raw.igBeginGroup;
/// BeginMainMenuBar() bool
pub const BeginMainMenuBar = raw.igBeginMainMenuBar;
/// BeginMenuExt(label: ?[*:0]const u8, enabled: bool) bool
pub const BeginMenuExt = raw.igBeginMenu;
pub fn BeginMenu(label: ?[*:0]const u8) callconv(.Inline) bool {
return BeginMenuExt(label, true);
}
/// BeginMenuBar() bool
pub const BeginMenuBar = raw.igBeginMenuBar;
pub fn BeginPopupExt(str_id: ?[*:0]const u8, flags: WindowFlags) callconv(.Inline) bool {
return raw.igBeginPopup(str_id, flags.toInt());
}
pub fn BeginPopup(str_id: ?[*:0]const u8) callconv(.Inline) bool {
return BeginPopupExt(str_id, .{});
}
/// BeginPopupContextItemExt(str_id: ?[*:0]const u8, mouse_button: MouseButton) bool
pub const BeginPopupContextItemExt = raw.igBeginPopupContextItem;
pub fn BeginPopupContextItem() callconv(.Inline) bool {
return BeginPopupContextItemExt(null, .Right);
}
/// BeginPopupContextVoidExt(str_id: ?[*:0]const u8, mouse_button: MouseButton) bool
pub const BeginPopupContextVoidExt = raw.igBeginPopupContextVoid;
pub fn BeginPopupContextVoid() callconv(.Inline) bool {
return BeginPopupContextVoidExt(null, .Right);
}
/// BeginPopupContextWindowExt(str_id: ?[*:0]const u8, mouse_button: MouseButton, also_over_items: bool) bool
pub const BeginPopupContextWindowExt = raw.igBeginPopupContextWindow;
pub fn BeginPopupContextWindow() callconv(.Inline) bool {
return BeginPopupContextWindowExt(null, .Right, true);
}
pub fn BeginPopupModalExt(name: ?[*:0]const u8, p_open: ?*bool, flags: WindowFlags) callconv(.Inline) bool {
return raw.igBeginPopupModal(name, p_open, flags.toInt());
}
pub fn BeginPopupModal(name: ?[*:0]const u8) callconv(.Inline) bool {
return BeginPopupModalExt(name, null, .{});
}
pub fn BeginTabBarExt(str_id: ?[*:0]const u8, flags: TabBarFlags) callconv(.Inline) bool {
return raw.igBeginTabBar(str_id, flags.toInt());
}
pub fn BeginTabBar(str_id: ?[*:0]const u8) callconv(.Inline) bool {
return BeginTabBarExt(str_id, .{});
}
pub fn BeginTabItemExt(label: ?[*:0]const u8, p_open: ?*bool, flags: TabItemFlags) callconv(.Inline) bool {
return raw.igBeginTabItem(label, p_open, flags.toInt());
}
pub fn BeginTabItem(label: ?[*:0]const u8) callconv(.Inline) bool {
return BeginTabItemExt(label, null, .{});
}
/// BeginTooltip() void
pub const BeginTooltip = raw.igBeginTooltip;
/// Bullet() void
pub const Bullet = raw.igBullet;
/// BulletText(fmt: ?[*:0]const u8, ...: ...) void
pub const BulletText = raw.igBulletText;
/// ButtonExt(label: ?[*:0]const u8, size: Vec2) bool
pub const ButtonExt = raw.igButton;
pub fn Button(label: ?[*:0]const u8) callconv(.Inline) bool {
return ButtonExt(label, .{ .x = 0, .y = 0 });
}
/// CalcItemWidth() f32
pub const CalcItemWidth = raw.igCalcItemWidth;
/// CalcListClipping(items_count: i32, items_height: f32, out_items_display_start: *i32, out_items_display_end: *i32) void
pub const CalcListClipping = raw.igCalcListClipping;
pub fn CalcTextSizeExt(text: ?[*]const u8, text_end: ?[*]const u8, hide_text_after_double_hash: bool, wrap_width: f32) callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igCalcTextSize_nonUDT(&out, text, text_end, hide_text_after_double_hash, wrap_width);
return out;
}
pub fn CalcTextSize(text: ?[*]const u8) callconv(.Inline) Vec2 {
return CalcTextSizeExt(text, null, false, -1.0);
}
/// CaptureKeyboardFromAppExt(want_capture_keyboard_value: bool) void
pub const CaptureKeyboardFromAppExt = raw.igCaptureKeyboardFromApp;
pub fn CaptureKeyboardFromApp() callconv(.Inline) void {
return CaptureKeyboardFromAppExt(true);
}
/// CaptureMouseFromAppExt(want_capture_mouse_value: bool) void
pub const CaptureMouseFromAppExt = raw.igCaptureMouseFromApp;
pub fn CaptureMouseFromApp() callconv(.Inline) void {
return CaptureMouseFromAppExt(true);
}
/// Checkbox(label: ?[*:0]const u8, v: *bool) bool
pub const Checkbox = raw.igCheckbox;
/// CheckboxFlags(label: ?[*:0]const u8, flags: ?*u32, flags_value: u32) bool
pub const CheckboxFlags = raw.igCheckboxFlags;
/// CloseCurrentPopup() void
pub const CloseCurrentPopup = raw.igCloseCurrentPopup;
pub fn CollapsingHeaderExt(label: ?[*:0]const u8, flags: TreeNodeFlags) callconv(.Inline) bool {
return raw.igCollapsingHeader(label, flags.toInt());
}
pub fn CollapsingHeader(label: ?[*:0]const u8) callconv(.Inline) bool {
return CollapsingHeaderExt(label, .{});
}
pub fn CollapsingHeaderBoolPtrExt(label: ?[*:0]const u8, p_open: ?*bool, flags: TreeNodeFlags) callconv(.Inline) bool {
return raw.igCollapsingHeaderBoolPtr(label, p_open, flags.toInt());
}
pub fn CollapsingHeaderBoolPtr(label: ?[*:0]const u8, p_open: ?*bool) callconv(.Inline) bool {
return CollapsingHeaderBoolPtrExt(label, p_open, .{});
}
pub fn ColorButtonExt(desc_id: ?[*:0]const u8, col: Vec4, flags: ColorEditFlags, size: Vec2) callconv(.Inline) bool {
return raw.igColorButton(desc_id, col, flags.toInt(), size);
}
pub fn ColorButton(desc_id: ?[*:0]const u8, col: Vec4) callconv(.Inline) bool {
return ColorButtonExt(desc_id, col, .{}, .{ .x = 0, .y = 0 });
}
/// ColorConvertFloat4ToU32(in: Vec4) u32
pub const ColorConvertFloat4ToU32 = raw.igColorConvertFloat4ToU32;
/// ColorConvertHSVtoRGB(h: f32, s: f32, v: f32, out_r: *f32, out_g: *f32, out_b: *f32) void
pub const ColorConvertHSVtoRGB = raw.igColorConvertHSVtoRGB;
/// ColorConvertRGBtoHSV(r: f32, g: f32, b: f32, out_h: *f32, out_s: *f32, out_v: *f32) void
pub const ColorConvertRGBtoHSV = raw.igColorConvertRGBtoHSV;
pub fn ColorConvertU32ToFloat4(in: u32) callconv(.Inline) Vec4 {
var out: Vec4 = undefined;
raw.igColorConvertU32ToFloat4_nonUDT(&out, in);
return out;
}
pub fn ColorEdit3Ext(label: ?[*:0]const u8, col: *[3]f32, flags: ColorEditFlags) callconv(.Inline) bool {
return raw.igColorEdit3(label, col, flags.toInt());
}
pub fn ColorEdit3(label: ?[*:0]const u8, col: *[3]f32) callconv(.Inline) bool {
return ColorEdit3Ext(label, col, .{});
}
pub fn ColorEdit4Ext(label: ?[*:0]const u8, col: *[4]f32, flags: ColorEditFlags) callconv(.Inline) bool {
return raw.igColorEdit4(label, col, flags.toInt());
}
pub fn ColorEdit4(label: ?[*:0]const u8, col: *[4]f32) callconv(.Inline) bool {
return ColorEdit4Ext(label, col, .{});
}
pub fn ColorPicker3Ext(label: ?[*:0]const u8, col: *[3]f32, flags: ColorEditFlags) callconv(.Inline) bool {
return raw.igColorPicker3(label, col, flags.toInt());
}
pub fn ColorPicker3(label: ?[*:0]const u8, col: *[3]f32) callconv(.Inline) bool {
return ColorPicker3Ext(label, col, .{});
}
pub fn ColorPicker4Ext(label: ?[*:0]const u8, col: *[4]f32, flags: ColorEditFlags, ref_col: ?*const [4]f32) callconv(.Inline) bool {
return raw.igColorPicker4(label, col, flags.toInt(), ref_col);
}
pub fn ColorPicker4(label: ?[*:0]const u8, col: *[4]f32) callconv(.Inline) bool {
return ColorPicker4Ext(label, col, .{}, null);
}
/// ColumnsExt(count: i32, id: ?[*:0]const u8, border: bool) void
pub const ColumnsExt = raw.igColumns;
pub fn Columns(count: i32) callconv(.Inline) void {
return ColumnsExt(count, null, true);
}
/// ComboExt(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const[*:0]const u8, items_count: i32, popup_max_height_in_items: i32) bool
pub const ComboExt = raw.igCombo;
pub fn Combo(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const [*:0]const u8, items_count: i32) callconv(.Inline) bool {
return ComboExt(label, current_item, items, items_count, -1);
}
/// ComboStrExt(label: ?[*:0]const u8, current_item: ?*i32, items_separated_by_zeros: ?[*]const u8, popup_max_height_in_items: i32) bool
pub const ComboStrExt = raw.igComboStr;
pub fn ComboStr(label: ?[*:0]const u8, current_item: ?*i32, items_separated_by_zeros: ?[*]const u8) callconv(.Inline) bool {
return ComboStrExt(label, current_item, items_separated_by_zeros, -1);
}
/// ComboFnPtrExt(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*c_void, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*c_void, items_count: i32, popup_max_height_in_items: i32) bool
pub const ComboFnPtrExt = raw.igComboFnPtr;
pub fn ComboFnPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*c_void, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*c_void, items_count: i32) callconv(.Inline) bool {
return ComboFnPtrExt(label, current_item, items_getter, data, items_count, -1);
}
/// CreateContextExt(shared_font_atlas: ?*FontAtlas) ?*Context
pub const CreateContextExt = raw.igCreateContext;
pub fn CreateContext() callconv(.Inline) ?*Context {
return CreateContextExt(null);
}
/// DebugCheckVersionAndDataLayout(version_str: ?[*:0]const u8, sz_io: usize, sz_style: usize, sz_vec2: usize, sz_vec4: usize, sz_drawvert: usize, sz_drawidx: usize) bool
pub const DebugCheckVersionAndDataLayout = raw.igDebugCheckVersionAndDataLayout;
/// DestroyContextExt(ctx: ?*Context) void
pub const DestroyContextExt = raw.igDestroyContext;
pub fn DestroyContext() callconv(.Inline) void {
return DestroyContextExt(null);
}
/// DragFloatExt(label: ?[*:0]const u8, v: *f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) bool
pub const DragFloatExt = raw.igDragFloat;
pub fn DragFloat(label: ?[*:0]const u8, v: *f32) callconv(.Inline) bool {
return DragFloatExt(label, v, 1.0, 0.0, 0.0, "%.3f", 1.0);
}
/// DragFloat2Ext(label: ?[*:0]const u8, v: *[2]f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) bool
pub const DragFloat2Ext = raw.igDragFloat2;
pub fn DragFloat2(label: ?[*:0]const u8, v: *[2]f32) callconv(.Inline) bool {
return DragFloat2Ext(label, v, 1.0, 0.0, 0.0, "%.3f", 1.0);
}
/// DragFloat3Ext(label: ?[*:0]const u8, v: *[3]f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) bool
pub const DragFloat3Ext = raw.igDragFloat3;
pub fn DragFloat3(label: ?[*:0]const u8, v: *[3]f32) callconv(.Inline) bool {
return DragFloat3Ext(label, v, 1.0, 0.0, 0.0, "%.3f", 1.0);
}
/// DragFloat4Ext(label: ?[*:0]const u8, v: *[4]f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) bool
pub const DragFloat4Ext = raw.igDragFloat4;
pub fn DragFloat4(label: ?[*:0]const u8, v: *[4]f32) callconv(.Inline) bool {
return DragFloat4Ext(label, v, 1.0, 0.0, 0.0, "%.3f", 1.0);
}
/// DragFloatRange2Ext(label: ?[*:0]const u8, v_current_min: *f32, v_current_max: *f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, format_max: ?[*:0]const u8, power: f32) bool
pub const DragFloatRange2Ext = raw.igDragFloatRange2;
pub fn DragFloatRange2(label: ?[*:0]const u8, v_current_min: *f32, v_current_max: *f32) callconv(.Inline) bool {
return DragFloatRange2Ext(label, v_current_min, v_current_max, 1.0, 0.0, 0.0, "%.3f", null, 1.0);
}
/// DragIntExt(label: ?[*:0]const u8, v: *i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8) bool
pub const DragIntExt = raw.igDragInt;
pub fn DragInt(label: ?[*:0]const u8, v: *i32) callconv(.Inline) bool {
return DragIntExt(label, v, 1.0, 0, 0, "%d");
}
/// DragInt2Ext(label: ?[*:0]const u8, v: *[2]i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8) bool
pub const DragInt2Ext = raw.igDragInt2;
pub fn DragInt2(label: ?[*:0]const u8, v: *[2]i32) callconv(.Inline) bool {
return DragInt2Ext(label, v, 1.0, 0, 0, "%d");
}
/// DragInt3Ext(label: ?[*:0]const u8, v: *[3]i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8) bool
pub const DragInt3Ext = raw.igDragInt3;
pub fn DragInt3(label: ?[*:0]const u8, v: *[3]i32) callconv(.Inline) bool {
return DragInt3Ext(label, v, 1.0, 0, 0, "%d");
}
/// DragInt4Ext(label: ?[*:0]const u8, v: *[4]i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8) bool
pub const DragInt4Ext = raw.igDragInt4;
pub fn DragInt4(label: ?[*:0]const u8, v: *[4]i32) callconv(.Inline) bool {
return DragInt4Ext(label, v, 1.0, 0, 0, "%d");
}
/// DragIntRange2Ext(label: ?[*:0]const u8, v_current_min: *i32, v_current_max: *i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8, format_max: ?[*:0]const u8) bool
pub const DragIntRange2Ext = raw.igDragIntRange2;
pub fn DragIntRange2(label: ?[*:0]const u8, v_current_min: *i32, v_current_max: *i32) callconv(.Inline) bool {
return DragIntRange2Ext(label, v_current_min, v_current_max, 1.0, 0, 0, "%d", null);
}
/// DragScalarExt(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, v_speed: f32, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) bool
pub const DragScalarExt = raw.igDragScalar;
pub fn DragScalar(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, v_speed: f32) callconv(.Inline) bool {
return DragScalarExt(label, data_type, p_data, v_speed, null, null, null, 1.0);
}
/// DragScalarNExt(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, components: i32, v_speed: f32, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) bool
pub const DragScalarNExt = raw.igDragScalarN;
pub fn DragScalarN(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, components: i32, v_speed: f32) callconv(.Inline) bool {
return DragScalarNExt(label, data_type, p_data, components, v_speed, null, null, null, 1.0);
}
/// Dummy(size: Vec2) void
pub const Dummy = raw.igDummy;
/// End() void
pub const End = raw.igEnd;
/// EndChild() void
pub const EndChild = raw.igEndChild;
/// EndChildFrame() void
pub const EndChildFrame = raw.igEndChildFrame;
/// EndCombo() void
pub const EndCombo = raw.igEndCombo;
/// EndDragDropSource() void
pub const EndDragDropSource = raw.igEndDragDropSource;
/// EndDragDropTarget() void
pub const EndDragDropTarget = raw.igEndDragDropTarget;
/// EndFrame() void
pub const EndFrame = raw.igEndFrame;
/// EndGroup() void
pub const EndGroup = raw.igEndGroup;
/// EndMainMenuBar() void
pub const EndMainMenuBar = raw.igEndMainMenuBar;
/// EndMenu() void
pub const EndMenu = raw.igEndMenu;
/// EndMenuBar() void
pub const EndMenuBar = raw.igEndMenuBar;
/// EndPopup() void
pub const EndPopup = raw.igEndPopup;
/// EndTabBar() void
pub const EndTabBar = raw.igEndTabBar;
/// EndTabItem() void
pub const EndTabItem = raw.igEndTabItem;
/// EndTooltip() void
pub const EndTooltip = raw.igEndTooltip;
/// GetBackgroundDrawList() ?*DrawList
pub const GetBackgroundDrawList = raw.igGetBackgroundDrawList;
/// GetClipboardText() ?[*:0]const u8
pub const GetClipboardText = raw.igGetClipboardText;
/// GetColorU32Ext(idx: Col, alpha_mul: f32) u32
pub const GetColorU32Ext = raw.igGetColorU32;
pub fn GetColorU32(idx: Col) callconv(.Inline) u32 {
return GetColorU32Ext(idx, 1.0);
}
/// GetColorU32Vec4(col: Vec4) u32
pub const GetColorU32Vec4 = raw.igGetColorU32Vec4;
/// GetColorU32U32(col: u32) u32
pub const GetColorU32U32 = raw.igGetColorU32U32;
/// GetColumnIndex() i32
pub const GetColumnIndex = raw.igGetColumnIndex;
/// GetColumnOffsetExt(column_index: i32) f32
pub const GetColumnOffsetExt = raw.igGetColumnOffset;
pub fn GetColumnOffset() callconv(.Inline) f32 {
return GetColumnOffsetExt(-1);
}
/// GetColumnWidthExt(column_index: i32) f32
pub const GetColumnWidthExt = raw.igGetColumnWidth;
pub fn GetColumnWidth() callconv(.Inline) f32 {
return GetColumnWidthExt(-1);
}
/// GetColumnsCount() i32
pub const GetColumnsCount = raw.igGetColumnsCount;
pub fn GetContentRegionAvail() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetContentRegionAvail_nonUDT(&out);
return out;
}
pub fn GetContentRegionMax() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetContentRegionMax_nonUDT(&out);
return out;
}
/// GetCurrentContext() ?*Context
pub const GetCurrentContext = raw.igGetCurrentContext;
pub fn GetCursorPos() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetCursorPos_nonUDT(&out);
return out;
}
/// GetCursorPosX() f32
pub const GetCursorPosX = raw.igGetCursorPosX;
/// GetCursorPosY() f32
pub const GetCursorPosY = raw.igGetCursorPosY;
pub fn GetCursorScreenPos() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetCursorScreenPos_nonUDT(&out);
return out;
}
pub fn GetCursorStartPos() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetCursorStartPos_nonUDT(&out);
return out;
}
/// GetDragDropPayload() ?*const Payload
pub const GetDragDropPayload = raw.igGetDragDropPayload;
/// GetDrawData() *DrawData
pub const GetDrawData = raw.igGetDrawData;
/// GetDrawListSharedData() ?*DrawListSharedData
pub const GetDrawListSharedData = raw.igGetDrawListSharedData;
/// GetFont() ?*Font
pub const GetFont = raw.igGetFont;
/// GetFontSize() f32
pub const GetFontSize = raw.igGetFontSize;
pub fn GetFontTexUvWhitePixel() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetFontTexUvWhitePixel_nonUDT(&out);
return out;
}
/// GetForegroundDrawList() ?*DrawList
pub const GetForegroundDrawList = raw.igGetForegroundDrawList;
/// GetFrameCount() i32
pub const GetFrameCount = raw.igGetFrameCount;
/// GetFrameHeight() f32
pub const GetFrameHeight = raw.igGetFrameHeight;
/// GetFrameHeightWithSpacing() f32
pub const GetFrameHeightWithSpacing = raw.igGetFrameHeightWithSpacing;
/// GetIDStr(str_id: ?[*:0]const u8) ID
pub const GetIDStr = raw.igGetIDStr;
/// GetIDRange(str_id_begin: ?[*]const u8, str_id_end: ?[*]const u8) ID
pub const GetIDRange = raw.igGetIDRange;
/// GetIDPtr(ptr_id: ?*const c_void) ID
pub const GetIDPtr = raw.igGetIDPtr;
/// GetIO() *IO
pub const GetIO = raw.igGetIO;
pub fn GetItemRectMax() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetItemRectMax_nonUDT(&out);
return out;
}
pub fn GetItemRectMin() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetItemRectMin_nonUDT(&out);
return out;
}
pub fn GetItemRectSize() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetItemRectSize_nonUDT(&out);
return out;
}
/// GetKeyIndex(imgui_key: Key) i32
pub const GetKeyIndex = raw.igGetKeyIndex;
/// GetKeyPressedAmount(key_index: i32, repeat_delay: f32, rate: f32) i32
pub const GetKeyPressedAmount = raw.igGetKeyPressedAmount;
/// GetMouseCursor() MouseCursor
pub const GetMouseCursor = raw.igGetMouseCursor;
pub fn GetMouseDragDeltaExt(button: MouseButton, lock_threshold: f32) callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetMouseDragDelta_nonUDT(&out, button, lock_threshold);
return out;
}
pub fn GetMouseDragDelta() callconv(.Inline) Vec2 {
return GetMouseDragDeltaExt(.Left, -1.0);
}
pub fn GetMousePos() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetMousePos_nonUDT(&out);
return out;
}
pub fn GetMousePosOnOpeningCurrentPopup() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetMousePosOnOpeningCurrentPopup_nonUDT(&out);
return out;
}
/// GetScrollMaxX() f32
pub const GetScrollMaxX = raw.igGetScrollMaxX;
/// GetScrollMaxY() f32
pub const GetScrollMaxY = raw.igGetScrollMaxY;
/// GetScrollX() f32
pub const GetScrollX = raw.igGetScrollX;
/// GetScrollY() f32
pub const GetScrollY = raw.igGetScrollY;
/// GetStateStorage() ?*Storage
pub const GetStateStorage = raw.igGetStateStorage;
/// GetStyle() ?*Style
pub const GetStyle = raw.igGetStyle;
/// GetStyleColorName(idx: Col) ?[*:0]const u8
pub const GetStyleColorName = raw.igGetStyleColorName;
/// GetStyleColorVec4(idx: Col) ?*const Vec4
pub const GetStyleColorVec4 = raw.igGetStyleColorVec4;
/// GetTextLineHeight() f32
pub const GetTextLineHeight = raw.igGetTextLineHeight;
/// GetTextLineHeightWithSpacing() f32
pub const GetTextLineHeightWithSpacing = raw.igGetTextLineHeightWithSpacing;
/// GetTime() f64
pub const GetTime = raw.igGetTime;
/// GetTreeNodeToLabelSpacing() f32
pub const GetTreeNodeToLabelSpacing = raw.igGetTreeNodeToLabelSpacing;
/// GetVersion() ?[*:0]const u8
pub const GetVersion = raw.igGetVersion;
pub fn GetWindowContentRegionMax() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetWindowContentRegionMax_nonUDT(&out);
return out;
}
pub fn GetWindowContentRegionMin() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetWindowContentRegionMin_nonUDT(&out);
return out;
}
/// GetWindowContentRegionWidth() f32
pub const GetWindowContentRegionWidth = raw.igGetWindowContentRegionWidth;
/// GetWindowDrawList() ?*DrawList
pub const GetWindowDrawList = raw.igGetWindowDrawList;
/// GetWindowHeight() f32
pub const GetWindowHeight = raw.igGetWindowHeight;
pub fn GetWindowPos() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetWindowPos_nonUDT(&out);
return out;
}
pub fn GetWindowSize() callconv(.Inline) Vec2 {
var out: Vec2 = undefined;
raw.igGetWindowSize_nonUDT(&out);
return out;
}
/// GetWindowWidth() f32
pub const GetWindowWidth = raw.igGetWindowWidth;
/// ImageExt(user_texture_id: TextureID, size: Vec2, uv0: Vec2, uv1: Vec2, tint_col: Vec4, border_col: Vec4) void
pub const ImageExt = raw.igImage;
pub fn Image(user_texture_id: TextureID, size: Vec2) callconv(.Inline) void {
return ImageExt(user_texture_id, size, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 1 }, .{ .x = 1, .y = 1, .z = 1, .w = 1 }, .{ .x = 0, .y = 0, .z = 0, .w = 0 });
}
/// ImageButtonExt(user_texture_id: TextureID, size: Vec2, uv0: Vec2, uv1: Vec2, frame_padding: i32, bg_col: Vec4, tint_col: Vec4) bool
pub const ImageButtonExt = raw.igImageButton;
pub fn ImageButton(user_texture_id: TextureID, size: Vec2) callconv(.Inline) bool {
return ImageButtonExt(user_texture_id, size, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 1 }, -1, .{ .x = 0, .y = 0, .z = 0, .w = 0 }, .{ .x = 1, .y = 1, .z = 1, .w = 1 });
}
/// IndentExt(indent_w: f32) void
pub const IndentExt = raw.igIndent;
pub fn Indent() callconv(.Inline) void {
return IndentExt(0.0);
}
pub fn InputDoubleExt(label: ?[*:0]const u8, v: *f64, step: f64, step_fast: f64, format: ?[*:0]const u8, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputDouble(label, v, step, step_fast, format, flags.toInt());
}
pub fn InputDouble(label: ?[*:0]const u8, v: *f64) callconv(.Inline) bool {
return InputDoubleExt(label, v, 0.0, 0.0, "%.6f", .{});
}
pub fn InputFloatExt(label: ?[*:0]const u8, v: *f32, step: f32, step_fast: f32, format: ?[*:0]const u8, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputFloat(label, v, step, step_fast, format, flags.toInt());
}
pub fn InputFloat(label: ?[*:0]const u8, v: *f32) callconv(.Inline) bool {
return InputFloatExt(label, v, 0.0, 0.0, "%.3f", .{});
}
pub fn InputFloat2Ext(label: ?[*:0]const u8, v: *[2]f32, format: ?[*:0]const u8, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputFloat2(label, v, format, flags.toInt());
}
pub fn InputFloat2(label: ?[*:0]const u8, v: *[2]f32) callconv(.Inline) bool {
return InputFloat2Ext(label, v, "%.3f", .{});
}
pub fn InputFloat3Ext(label: ?[*:0]const u8, v: *[3]f32, format: ?[*:0]const u8, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputFloat3(label, v, format, flags.toInt());
}
pub fn InputFloat3(label: ?[*:0]const u8, v: *[3]f32) callconv(.Inline) bool {
return InputFloat3Ext(label, v, "%.3f", .{});
}
pub fn InputFloat4Ext(label: ?[*:0]const u8, v: *[4]f32, format: ?[*:0]const u8, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputFloat4(label, v, format, flags.toInt());
}
pub fn InputFloat4(label: ?[*:0]const u8, v: *[4]f32) callconv(.Inline) bool {
return InputFloat4Ext(label, v, "%.3f", .{});
}
pub fn InputIntExt(label: ?[*:0]const u8, v: *i32, step: i32, step_fast: i32, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputInt(label, v, step, step_fast, flags.toInt());
}
pub fn InputInt(label: ?[*:0]const u8, v: *i32) callconv(.Inline) bool {
return InputIntExt(label, v, 1, 100, .{});
}
pub fn InputInt2Ext(label: ?[*:0]const u8, v: *[2]i32, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputInt2(label, v, flags.toInt());
}
pub fn InputInt2(label: ?[*:0]const u8, v: *[2]i32) callconv(.Inline) bool {
return InputInt2Ext(label, v, .{});
}
pub fn InputInt3Ext(label: ?[*:0]const u8, v: *[3]i32, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputInt3(label, v, flags.toInt());
}
pub fn InputInt3(label: ?[*:0]const u8, v: *[3]i32) callconv(.Inline) bool {
return InputInt3Ext(label, v, .{});
}
pub fn InputInt4Ext(label: ?[*:0]const u8, v: *[4]i32, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputInt4(label, v, flags.toInt());
}
pub fn InputInt4(label: ?[*:0]const u8, v: *[4]i32) callconv(.Inline) bool {
return InputInt4Ext(label, v, .{});
}
pub fn InputScalarExt(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, p_step: ?*const c_void, p_step_fast: ?*const c_void, format: ?[*:0]const u8, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputScalar(label, data_type, p_data, p_step, p_step_fast, format, flags.toInt());
}
pub fn InputScalar(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void) callconv(.Inline) bool {
return InputScalarExt(label, data_type, p_data, null, null, null, .{});
}
pub fn InputScalarNExt(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, components: i32, p_step: ?*const c_void, p_step_fast: ?*const c_void, format: ?[*:0]const u8, flags: InputTextFlags) callconv(.Inline) bool {
return raw.igInputScalarN(label, data_type, p_data, components, p_step, p_step_fast, format, flags.toInt());
}
pub fn InputScalarN(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, components: i32) callconv(.Inline) bool {
return InputScalarNExt(label, data_type, p_data, components, null, null, null, .{});
}
pub fn InputTextExt(label: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize, flags: InputTextFlags, callback: InputTextCallback, user_data: ?*c_void) callconv(.Inline) bool {
return raw.igInputText(label, buf, buf_size, flags.toInt(), callback, user_data);
}
pub fn InputText(label: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize) callconv(.Inline) bool {
return InputTextExt(label, buf, buf_size, .{}, null, null);
}
pub fn InputTextMultilineExt(label: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize, size: Vec2, flags: InputTextFlags, callback: InputTextCallback, user_data: ?*c_void) callconv(.Inline) bool {
return raw.igInputTextMultiline(label, buf, buf_size, size, flags.toInt(), callback, user_data);
}
pub fn InputTextMultiline(label: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize) callconv(.Inline) bool {
return InputTextMultilineExt(label, buf, buf_size, .{ .x = 0, .y = 0 }, .{}, null, null);
}
pub fn InputTextWithHintExt(label: ?[*:0]const u8, hint: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize, flags: InputTextFlags, callback: InputTextCallback, user_data: ?*c_void) callconv(.Inline) bool {
return raw.igInputTextWithHint(label, hint, buf, buf_size, flags.toInt(), callback, user_data);
}
pub fn InputTextWithHint(label: ?[*:0]const u8, hint: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize) callconv(.Inline) bool {
return InputTextWithHintExt(label, hint, buf, buf_size, .{}, null, null);
}
/// InvisibleButton(str_id: ?[*:0]const u8, size: Vec2) bool
pub const InvisibleButton = raw.igInvisibleButton;
/// IsAnyItemActive() bool
pub const IsAnyItemActive = raw.igIsAnyItemActive;
/// IsAnyItemFocused() bool
pub const IsAnyItemFocused = raw.igIsAnyItemFocused;
/// IsAnyItemHovered() bool
pub const IsAnyItemHovered = raw.igIsAnyItemHovered;
/// IsAnyMouseDown() bool
pub const IsAnyMouseDown = raw.igIsAnyMouseDown;
/// IsItemActivated() bool
pub const IsItemActivated = raw.igIsItemActivated;
/// IsItemActive() bool
pub const IsItemActive = raw.igIsItemActive;
/// IsItemClickedExt(mouse_button: MouseButton) bool
pub const IsItemClickedExt = raw.igIsItemClicked;
pub fn IsItemClicked() callconv(.Inline) bool {
return IsItemClickedExt(.Left);
}
/// IsItemDeactivated() bool
pub const IsItemDeactivated = raw.igIsItemDeactivated;
/// IsItemDeactivatedAfterEdit() bool
pub const IsItemDeactivatedAfterEdit = raw.igIsItemDeactivatedAfterEdit;
/// IsItemEdited() bool
pub const IsItemEdited = raw.igIsItemEdited;
/// IsItemFocused() bool
pub const IsItemFocused = raw.igIsItemFocused;
pub fn IsItemHoveredExt(flags: HoveredFlags) callconv(.Inline) bool {
return raw.igIsItemHovered(flags.toInt());
}
pub fn IsItemHovered() callconv(.Inline) bool {
return IsItemHoveredExt(.{});
}
/// IsItemToggledOpen() bool
pub const IsItemToggledOpen = raw.igIsItemToggledOpen;
/// IsItemVisible() bool
pub const IsItemVisible = raw.igIsItemVisible;
/// IsKeyDown(user_key_index: i32) bool
pub const IsKeyDown = raw.igIsKeyDown;
/// IsKeyPressedExt(user_key_index: i32, repeat: bool) bool
pub const IsKeyPressedExt = raw.igIsKeyPressed;
pub fn IsKeyPressed(user_key_index: i32) callconv(.Inline) bool {
return IsKeyPressedExt(user_key_index, true);
}
/// IsKeyReleased(user_key_index: i32) bool
pub const IsKeyReleased = raw.igIsKeyReleased;
/// IsMouseClickedExt(button: MouseButton, repeat: bool) bool
pub const IsMouseClickedExt = raw.igIsMouseClicked;
pub fn IsMouseClicked(button: MouseButton) callconv(.Inline) bool {
return IsMouseClickedExt(button, false);
}
/// IsMouseDoubleClicked(button: MouseButton) bool
pub const IsMouseDoubleClicked = raw.igIsMouseDoubleClicked;
/// IsMouseDown(button: MouseButton) bool
pub const IsMouseDown = raw.igIsMouseDown;
/// IsMouseDraggingExt(button: MouseButton, lock_threshold: f32) bool
pub const IsMouseDraggingExt = raw.igIsMouseDragging;
pub fn IsMouseDragging(button: MouseButton) callconv(.Inline) bool {
return IsMouseDraggingExt(button, -1.0);
}
/// IsMouseHoveringRectExt(r_min: Vec2, r_max: Vec2, clip: bool) bool
pub const IsMouseHoveringRectExt = raw.igIsMouseHoveringRect;
pub fn IsMouseHoveringRect(r_min: Vec2, r_max: Vec2) callconv(.Inline) bool {
return IsMouseHoveringRectExt(r_min, r_max, true);
}
/// IsMousePosValidExt(mouse_pos: ?*const Vec2) bool
pub const IsMousePosValidExt = raw.igIsMousePosValid;
pub fn IsMousePosValid() callconv(.Inline) bool {
return IsMousePosValidExt(null);
}
/// IsMouseReleased(button: MouseButton) bool
pub const IsMouseReleased = raw.igIsMouseReleased;
/// IsPopupOpen(str_id: ?[*:0]const u8) bool
pub const IsPopupOpen = raw.igIsPopupOpen;
/// IsRectVisible(size: Vec2) bool
pub const IsRectVisible = raw.igIsRectVisible;
/// IsRectVisibleVec2(rect_min: Vec2, rect_max: Vec2) bool
pub const IsRectVisibleVec2 = raw.igIsRectVisibleVec2;
/// IsWindowAppearing() bool
pub const IsWindowAppearing = raw.igIsWindowAppearing;
/// IsWindowCollapsed() bool
pub const IsWindowCollapsed = raw.igIsWindowCollapsed;
pub fn IsWindowFocusedExt(flags: FocusedFlags) callconv(.Inline) bool {
return raw.igIsWindowFocused(flags.toInt());
}
pub fn IsWindowFocused() callconv(.Inline) bool {
return IsWindowFocusedExt(.{});
}
pub fn IsWindowHoveredExt(flags: HoveredFlags) callconv(.Inline) bool {
return raw.igIsWindowHovered(flags.toInt());
}
pub fn IsWindowHovered() callconv(.Inline) bool {
return IsWindowHoveredExt(.{});
}
/// LabelText(label: ?[*:0]const u8, fmt: ?[*:0]const u8, ...: ...) void
pub const LabelText = raw.igLabelText;
/// ListBoxStr_arrExt(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const[*:0]const u8, items_count: i32, height_in_items: i32) bool
pub const ListBoxStr_arrExt = raw.igListBoxStr_arr;
pub fn ListBoxStr_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const [*:0]const u8, items_count: i32) callconv(.Inline) bool {
return ListBoxStr_arrExt(label, current_item, items, items_count, -1);
}
/// ListBoxFnPtrExt(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*c_void, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*c_void, items_count: i32, height_in_items: i32) bool
pub const ListBoxFnPtrExt = raw.igListBoxFnPtr;
pub fn ListBoxFnPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*c_void, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*c_void, items_count: i32) callconv(.Inline) bool {
return ListBoxFnPtrExt(label, current_item, items_getter, data, items_count, -1);
}
/// ListBoxFooter() void
pub const ListBoxFooter = raw.igListBoxFooter;
/// ListBoxHeaderVec2Ext(label: ?[*:0]const u8, size: Vec2) bool
pub const ListBoxHeaderVec2Ext = raw.igListBoxHeaderVec2;
pub fn ListBoxHeaderVec2(label: ?[*:0]const u8) callconv(.Inline) bool {
return ListBoxHeaderVec2Ext(label, .{ .x = 0, .y = 0 });
}
/// ListBoxHeaderIntExt(label: ?[*:0]const u8, items_count: i32, height_in_items: i32) bool
pub const ListBoxHeaderIntExt = raw.igListBoxHeaderInt;
pub fn ListBoxHeaderInt(label: ?[*:0]const u8, items_count: i32) callconv(.Inline) bool {
return ListBoxHeaderIntExt(label, items_count, -1);
}
/// LoadIniSettingsFromDisk(ini_filename: ?[*:0]const u8) void
pub const LoadIniSettingsFromDisk = raw.igLoadIniSettingsFromDisk;
/// LoadIniSettingsFromMemoryExt(ini_data: ?[*]const u8, ini_size: usize) void
pub const LoadIniSettingsFromMemoryExt = raw.igLoadIniSettingsFromMemory;
pub fn LoadIniSettingsFromMemory(ini_data: ?[*]const u8) callconv(.Inline) void {
return LoadIniSettingsFromMemoryExt(ini_data, 0);
}
/// LogButtons() void
pub const LogButtons = raw.igLogButtons;
/// LogFinish() void
pub const LogFinish = raw.igLogFinish;
/// LogText(fmt: ?[*:0]const u8, ...: ...) void
pub const LogText = raw.igLogText;
/// LogToClipboardExt(auto_open_depth: i32) void
pub const LogToClipboardExt = raw.igLogToClipboard;
pub fn LogToClipboard() callconv(.Inline) void {
return LogToClipboardExt(-1);
}
/// LogToFileExt(auto_open_depth: i32, filename: ?[*:0]const u8) void
pub const LogToFileExt = raw.igLogToFile;
pub fn LogToFile() callconv(.Inline) void {
return LogToFileExt(-1, null);
}
/// LogToTTYExt(auto_open_depth: i32) void
pub const LogToTTYExt = raw.igLogToTTY;
pub fn LogToTTY() callconv(.Inline) void {
return LogToTTYExt(-1);
}
/// MemAlloc(size: usize) ?*c_void
pub const MemAlloc = raw.igMemAlloc;
/// MemFree(ptr: ?*c_void) void
pub const MemFree = raw.igMemFree;
/// MenuItemBoolExt(label: ?[*:0]const u8, shortcut: ?[*:0]const u8, selected: bool, enabled: bool) bool
pub const MenuItemBoolExt = raw.igMenuItemBool;
pub fn MenuItemBool(label: ?[*:0]const u8) callconv(.Inline) bool {
return MenuItemBoolExt(label, null, false, true);
}
/// MenuItemBoolPtrExt(label: ?[*:0]const u8, shortcut: ?[*:0]const u8, p_selected: ?*bool, enabled: bool) bool
pub const MenuItemBoolPtrExt = raw.igMenuItemBoolPtr;
pub fn MenuItemBoolPtr(label: ?[*:0]const u8, shortcut: ?[*:0]const u8, p_selected: ?*bool) callconv(.Inline) bool {
return MenuItemBoolPtrExt(label, shortcut, p_selected, true);
}
/// NewFrame() void
pub const NewFrame = raw.igNewFrame;
/// NewLine() void
pub const NewLine = raw.igNewLine;
/// NextColumn() void
pub const NextColumn = raw.igNextColumn;
/// OpenPopup(str_id: ?[*:0]const u8) void
pub const OpenPopup = raw.igOpenPopup;
/// OpenPopupOnItemClickExt(str_id: ?[*:0]const u8, mouse_button: MouseButton) bool
pub const OpenPopupOnItemClickExt = raw.igOpenPopupOnItemClick;
pub fn OpenPopupOnItemClick() callconv(.Inline) bool {
return OpenPopupOnItemClickExt(null, .Right);
}
/// PlotHistogramFloatPtrExt(label: ?[*:0]const u8, values: *const f32, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2, stride: i32) void
pub const PlotHistogramFloatPtrExt = raw.igPlotHistogramFloatPtr;
pub fn PlotHistogramFloatPtr(label: ?[*:0]const u8, values: *const f32, values_count: i32) callconv(.Inline) void {
return PlotHistogramFloatPtrExt(label, values, values_count, 0, null, FLT_MAX, FLT_MAX, .{ .x = 0, .y = 0 }, @sizeOf(f32));
}
/// PlotHistogramFnPtrExt(label: ?[*:0]const u8, values_getter: ?fn (data: ?*c_void, idx: i32) callconv(.C) f32, data: ?*c_void, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2) void
pub const PlotHistogramFnPtrExt = raw.igPlotHistogramFnPtr;
pub fn PlotHistogramFnPtr(label: ?[*:0]const u8, values_getter: ?fn (data: ?*c_void, idx: i32) callconv(.C) f32, data: ?*c_void, values_count: i32) callconv(.Inline) void {
return PlotHistogramFnPtrExt(label, values_getter, data, values_count, 0, null, FLT_MAX, FLT_MAX, .{ .x = 0, .y = 0 });
}
/// PlotLinesExt(label: ?[*:0]const u8, values: *const f32, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2, stride: i32) void
pub const PlotLinesExt = raw.igPlotLines;
pub fn PlotLines(label: ?[*:0]const u8, values: *const f32, values_count: i32) callconv(.Inline) void {
return PlotLinesExt(label, values, values_count, 0, null, FLT_MAX, FLT_MAX, .{ .x = 0, .y = 0 }, @sizeOf(f32));
}
/// PlotLinesFnPtrExt(label: ?[*:0]const u8, values_getter: ?fn (data: ?*c_void, idx: i32) callconv(.C) f32, data: ?*c_void, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2) void
pub const PlotLinesFnPtrExt = raw.igPlotLinesFnPtr;
pub fn PlotLinesFnPtr(label: ?[*:0]const u8, values_getter: ?fn (data: ?*c_void, idx: i32) callconv(.C) f32, data: ?*c_void, values_count: i32) callconv(.Inline) void {
return PlotLinesFnPtrExt(label, values_getter, data, values_count, 0, null, FLT_MAX, FLT_MAX, .{ .x = 0, .y = 0 });
}
/// PopAllowKeyboardFocus() void
pub const PopAllowKeyboardFocus = raw.igPopAllowKeyboardFocus;
/// PopButtonRepeat() void
pub const PopButtonRepeat = raw.igPopButtonRepeat;
/// PopClipRect() void
pub const PopClipRect = raw.igPopClipRect;
/// PopFont() void
pub const PopFont = raw.igPopFont;
/// PopID() void
pub const PopID = raw.igPopID;
/// PopItemWidth() void
pub const PopItemWidth = raw.igPopItemWidth;
/// PopStyleColorExt(count: i32) void
pub const PopStyleColorExt = raw.igPopStyleColor;
pub fn PopStyleColor() callconv(.Inline) void {
return PopStyleColorExt(1);
}
/// PopStyleVarExt(count: i32) void
pub const PopStyleVarExt = raw.igPopStyleVar;
pub fn PopStyleVar() callconv(.Inline) void {
return PopStyleVarExt(1);
}
/// PopTextWrapPos() void
pub const PopTextWrapPos = raw.igPopTextWrapPos;
/// ProgressBarExt(fraction: f32, size_arg: Vec2, overlay: ?[*:0]const u8) void
pub const ProgressBarExt = raw.igProgressBar;
pub fn ProgressBar(fraction: f32) callconv(.Inline) void {
return ProgressBarExt(fraction, .{ .x = -1, .y = 0 }, null);
}
/// PushAllowKeyboardFocus(allow_keyboard_focus: bool) void
pub const PushAllowKeyboardFocus = raw.igPushAllowKeyboardFocus;
/// PushButtonRepeat(repeat: bool) void
pub const PushButtonRepeat = raw.igPushButtonRepeat;
/// PushClipRect(clip_rect_min: Vec2, clip_rect_max: Vec2, intersect_with_current_clip_rect: bool) void
pub const PushClipRect = raw.igPushClipRect;
/// PushFont(font: ?*Font) void
pub const PushFont = raw.igPushFont;
/// PushIDStr(str_id: ?[*:0]const u8) void
pub const PushIDStr = raw.igPushIDStr;
/// PushIDRange(str_id_begin: ?[*]const u8, str_id_end: ?[*]const u8) void
pub const PushIDRange = raw.igPushIDRange;
/// PushIDPtr(ptr_id: ?*const c_void) void
pub const PushIDPtr = raw.igPushIDPtr;
/// PushIDInt(int_id: i32) void
pub const PushIDInt = raw.igPushIDInt;
/// PushItemWidth(item_width: f32) void
pub const PushItemWidth = raw.igPushItemWidth;
/// PushStyleColorU32(idx: Col, col: u32) void
pub const PushStyleColorU32 = raw.igPushStyleColorU32;
/// PushStyleColorVec4(idx: Col, col: Vec4) void
pub const PushStyleColorVec4 = raw.igPushStyleColorVec4;
/// PushStyleVarFloat(idx: StyleVar, val: f32) void
pub const PushStyleVarFloat = raw.igPushStyleVarFloat;
/// PushStyleVarVec2(idx: StyleVar, val: Vec2) void
pub const PushStyleVarVec2 = raw.igPushStyleVarVec2;
/// PushTextWrapPosExt(wrap_local_pos_x: f32) void
pub const PushTextWrapPosExt = raw.igPushTextWrapPos;
pub fn PushTextWrapPos() callconv(.Inline) void {
return PushTextWrapPosExt(0.0);
}
/// RadioButtonBool(label: ?[*:0]const u8, active: bool) bool
pub const RadioButtonBool = raw.igRadioButtonBool;
/// RadioButtonIntPtr(label: ?[*:0]const u8, v: *i32, v_button: i32) bool
pub const RadioButtonIntPtr = raw.igRadioButtonIntPtr;
/// Render() void
pub const Render = raw.igRender;
/// ResetMouseDragDeltaExt(button: MouseButton) void
pub const ResetMouseDragDeltaExt = raw.igResetMouseDragDelta;
pub fn ResetMouseDragDelta() callconv(.Inline) void {
return ResetMouseDragDeltaExt(.Left);
}
/// SameLineExt(offset_from_start_x: f32, spacing: f32) void
pub const SameLineExt = raw.igSameLine;
pub fn SameLine() callconv(.Inline) void {
return SameLineExt(0.0, -1.0);
}
/// SaveIniSettingsToDisk(ini_filename: ?[*:0]const u8) void
pub const SaveIniSettingsToDisk = raw.igSaveIniSettingsToDisk;
/// SaveIniSettingsToMemoryExt(out_ini_size: ?*usize) ?[*:0]const u8
pub const SaveIniSettingsToMemoryExt = raw.igSaveIniSettingsToMemory;
pub fn SaveIniSettingsToMemory() callconv(.Inline) ?[*:0]const u8 {
return SaveIniSettingsToMemoryExt(null);
}
pub fn SelectableBoolExt(label: ?[*:0]const u8, selected: bool, flags: SelectableFlags, size: Vec2) callconv(.Inline) bool {
return raw.igSelectableBool(label, selected, flags.toInt(), size);
}
pub fn SelectableBool(label: ?[*:0]const u8) callconv(.Inline) bool {
return SelectableBoolExt(label, false, .{}, .{ .x = 0, .y = 0 });
}
pub fn SelectableBoolPtrExt(label: ?[*:0]const u8, p_selected: ?*bool, flags: SelectableFlags, size: Vec2) callconv(.Inline) bool {
return raw.igSelectableBoolPtr(label, p_selected, flags.toInt(), size);
}
pub fn SelectableBoolPtr(label: ?[*:0]const u8, p_selected: ?*bool) callconv(.Inline) bool {
return SelectableBoolPtrExt(label, p_selected, .{}, .{ .x = 0, .y = 0 });
}
/// Separator() void
pub const Separator = raw.igSeparator;
/// SetAllocatorFunctionsExt(alloc_func: ?fn (sz: usize, user_data: ?*c_void) callconv(.C) ?*c_void, free_func: ?fn (ptr: ?*c_void, user_data: ?*c_void) callconv(.C) void, user_data: ?*c_void) void
pub const SetAllocatorFunctionsExt = raw.igSetAllocatorFunctions;
pub fn SetAllocatorFunctions(alloc_func: ?fn (sz: usize, user_data: ?*c_void) callconv(.C) ?*c_void, free_func: ?fn (ptr: ?*c_void, user_data: ?*c_void) callconv(.C) void) callconv(.Inline) void {
return SetAllocatorFunctionsExt(alloc_func, free_func, null);
}
/// SetClipboardText(text: ?[*:0]const u8) void
pub const SetClipboardText = raw.igSetClipboardText;
pub fn SetColorEditOptions(flags: ColorEditFlags) callconv(.Inline) void {
return raw.igSetColorEditOptions(flags.toInt());
}
/// SetColumnOffset(column_index: i32, offset_x: f32) void
pub const SetColumnOffset = raw.igSetColumnOffset;
/// SetColumnWidth(column_index: i32, width: f32) void
pub const SetColumnWidth = raw.igSetColumnWidth;
/// SetCurrentContext(ctx: ?*Context) void
pub const SetCurrentContext = raw.igSetCurrentContext;
/// SetCursorPos(local_pos: Vec2) void
pub const SetCursorPos = raw.igSetCursorPos;
/// SetCursorPosX(local_x: f32) void
pub const SetCursorPosX = raw.igSetCursorPosX;
/// SetCursorPosY(local_y: f32) void
pub const SetCursorPosY = raw.igSetCursorPosY;
/// SetCursorScreenPos(pos: Vec2) void
pub const SetCursorScreenPos = raw.igSetCursorScreenPos;
pub fn SetDragDropPayloadExt(kind: ?[*:0]const u8, data: ?*const c_void, sz: usize, cond: CondFlags) callconv(.Inline) bool {
return raw.igSetDragDropPayload(kind, data, sz, cond.toInt());
}
pub fn SetDragDropPayload(kind: ?[*:0]const u8, data: ?*const c_void, sz: usize) callconv(.Inline) bool {
return SetDragDropPayloadExt(kind, data, sz, .{});
}
/// SetItemAllowOverlap() void
pub const SetItemAllowOverlap = raw.igSetItemAllowOverlap;
/// SetItemDefaultFocus() void
pub const SetItemDefaultFocus = raw.igSetItemDefaultFocus;
/// SetKeyboardFocusHereExt(offset: i32) void
pub const SetKeyboardFocusHereExt = raw.igSetKeyboardFocusHere;
pub fn SetKeyboardFocusHere() callconv(.Inline) void {
return SetKeyboardFocusHereExt(0);
}
/// SetMouseCursor(cursor_type: MouseCursor) void
pub const SetMouseCursor = raw.igSetMouseCursor;
pub fn SetNextItemOpenExt(is_open: bool, cond: CondFlags) callconv(.Inline) void {
return raw.igSetNextItemOpen(is_open, cond.toInt());
}
pub fn SetNextItemOpen(is_open: bool) callconv(.Inline) void {
return SetNextItemOpenExt(is_open, .{});
}
/// SetNextItemWidth(item_width: f32) void
pub const SetNextItemWidth = raw.igSetNextItemWidth;
/// SetNextWindowBgAlpha(alpha: f32) void
pub const SetNextWindowBgAlpha = raw.igSetNextWindowBgAlpha;
pub fn SetNextWindowCollapsedExt(collapsed: bool, cond: CondFlags) callconv(.Inline) void {
return raw.igSetNextWindowCollapsed(collapsed, cond.toInt());
}
pub fn SetNextWindowCollapsed(collapsed: bool) callconv(.Inline) void {
return SetNextWindowCollapsedExt(collapsed, .{});
}
/// SetNextWindowContentSize(size: Vec2) void
pub const SetNextWindowContentSize = raw.igSetNextWindowContentSize;
/// SetNextWindowFocus() void
pub const SetNextWindowFocus = raw.igSetNextWindowFocus;
pub fn SetNextWindowPosExt(pos: Vec2, cond: CondFlags, pivot: Vec2) callconv(.Inline) void {
return raw.igSetNextWindowPos(pos, cond.toInt(), pivot);
}
pub fn SetNextWindowPos(pos: Vec2) callconv(.Inline) void {
return SetNextWindowPosExt(pos, .{}, .{ .x = 0, .y = 0 });
}
pub fn SetNextWindowSizeExt(size: Vec2, cond: CondFlags) callconv(.Inline) void {
return raw.igSetNextWindowSize(size, cond.toInt());
}
pub fn SetNextWindowSize(size: Vec2) callconv(.Inline) void {
return SetNextWindowSizeExt(size, .{});
}
/// SetNextWindowSizeConstraintsExt(size_min: Vec2, size_max: Vec2, custom_callback: SizeCallback, custom_callback_data: ?*c_void) void
pub const SetNextWindowSizeConstraintsExt = raw.igSetNextWindowSizeConstraints;
pub fn SetNextWindowSizeConstraints(size_min: Vec2, size_max: Vec2) callconv(.Inline) void {
return SetNextWindowSizeConstraintsExt(size_min, size_max, null, null);
}
/// SetScrollFromPosXExt(local_x: f32, center_x_ratio: f32) void
pub const SetScrollFromPosXExt = raw.igSetScrollFromPosX;
pub fn SetScrollFromPosX(local_x: f32) callconv(.Inline) void {
return SetScrollFromPosXExt(local_x, 0.5);
}
/// SetScrollFromPosYExt(local_y: f32, center_y_ratio: f32) void
pub const SetScrollFromPosYExt = raw.igSetScrollFromPosY;
pub fn SetScrollFromPosY(local_y: f32) callconv(.Inline) void {
return SetScrollFromPosYExt(local_y, 0.5);
}
/// SetScrollHereXExt(center_x_ratio: f32) void
pub const SetScrollHereXExt = raw.igSetScrollHereX;
pub fn SetScrollHereX() callconv(.Inline) void {
return SetScrollHereXExt(0.5);
}
/// SetScrollHereYExt(center_y_ratio: f32) void
pub const SetScrollHereYExt = raw.igSetScrollHereY;
pub fn SetScrollHereY() callconv(.Inline) void {
return SetScrollHereYExt(0.5);
}
/// SetScrollX(scroll_x: f32) void
pub const SetScrollX = raw.igSetScrollX;
/// SetScrollY(scroll_y: f32) void
pub const SetScrollY = raw.igSetScrollY;
/// SetStateStorage(storage: ?*Storage) void
pub const SetStateStorage = raw.igSetStateStorage;
/// SetTabItemClosed(tab_or_docked_window_label: ?[*:0]const u8) void
pub const SetTabItemClosed = raw.igSetTabItemClosed;
/// SetTooltip(fmt: ?[*:0]const u8, ...: ...) void
pub const SetTooltip = raw.igSetTooltip;
pub fn SetWindowCollapsedBoolExt(collapsed: bool, cond: CondFlags) callconv(.Inline) void {
return raw.igSetWindowCollapsedBool(collapsed, cond.toInt());
}
pub fn SetWindowCollapsedBool(collapsed: bool) callconv(.Inline) void {
return SetWindowCollapsedBoolExt(collapsed, .{});
}
pub fn SetWindowCollapsedStrExt(name: ?[*:0]const u8, collapsed: bool, cond: CondFlags) callconv(.Inline) void {
return raw.igSetWindowCollapsedStr(name, collapsed, cond.toInt());
}
pub fn SetWindowCollapsedStr(name: ?[*:0]const u8, collapsed: bool) callconv(.Inline) void {
return SetWindowCollapsedStrExt(name, collapsed, .{});
}
/// SetWindowFocus() void
pub const SetWindowFocus = raw.igSetWindowFocus;
/// SetWindowFocusStr(name: ?[*:0]const u8) void
pub const SetWindowFocusStr = raw.igSetWindowFocusStr;
/// SetWindowFontScale(scale: f32) void
pub const SetWindowFontScale = raw.igSetWindowFontScale;
pub fn SetWindowPosVec2Ext(pos: Vec2, cond: CondFlags) callconv(.Inline) void {
return raw.igSetWindowPosVec2(pos, cond.toInt());
}
pub fn SetWindowPosVec2(pos: Vec2) callconv(.Inline) void {
return SetWindowPosVec2Ext(pos, .{});
}
pub fn SetWindowPosStrExt(name: ?[*:0]const u8, pos: Vec2, cond: CondFlags) callconv(.Inline) void {
return raw.igSetWindowPosStr(name, pos, cond.toInt());
}
pub fn SetWindowPosStr(name: ?[*:0]const u8, pos: Vec2) callconv(.Inline) void {
return SetWindowPosStrExt(name, pos, .{});
}
pub fn SetWindowSizeVec2Ext(size: Vec2, cond: CondFlags) callconv(.Inline) void {
return raw.igSetWindowSizeVec2(size, cond.toInt());
}
pub fn SetWindowSizeVec2(size: Vec2) callconv(.Inline) void {
return SetWindowSizeVec2Ext(size, .{});
}
pub fn SetWindowSizeStrExt(name: ?[*:0]const u8, size: Vec2, cond: CondFlags) callconv(.Inline) void {
return raw.igSetWindowSizeStr(name, size, cond.toInt());
}
pub fn SetWindowSizeStr(name: ?[*:0]const u8, size: Vec2) callconv(.Inline) void {
return SetWindowSizeStrExt(name, size, .{});
}
/// ShowAboutWindowExt(p_open: ?*bool) void
pub const ShowAboutWindowExt = raw.igShowAboutWindow;
pub fn ShowAboutWindow() callconv(.Inline) void {
return ShowAboutWindowExt(null);
}
/// ShowDemoWindowExt(p_open: ?*bool) void
pub const ShowDemoWindowExt = raw.igShowDemoWindow;
pub fn ShowDemoWindow() callconv(.Inline) void {
return ShowDemoWindowExt(null);
}
/// ShowFontSelector(label: ?[*:0]const u8) void
pub const ShowFontSelector = raw.igShowFontSelector;
/// ShowMetricsWindowExt(p_open: ?*bool) void
pub const ShowMetricsWindowExt = raw.igShowMetricsWindow;
pub fn ShowMetricsWindow() callconv(.Inline) void {
return ShowMetricsWindowExt(null);
}
/// ShowStyleEditorExt(ref: ?*Style) void
pub const ShowStyleEditorExt = raw.igShowStyleEditor;
pub fn ShowStyleEditor() callconv(.Inline) void {
return ShowStyleEditorExt(null);
}
/// ShowStyleSelector(label: ?[*:0]const u8) bool
pub const ShowStyleSelector = raw.igShowStyleSelector;
/// ShowUserGuide() void
pub const ShowUserGuide = raw.igShowUserGuide;
/// SliderAngleExt(label: ?[*:0]const u8, v_rad: *f32, v_degrees_min: f32, v_degrees_max: f32, format: ?[*:0]const u8) bool
pub const SliderAngleExt = raw.igSliderAngle;
pub fn SliderAngle(label: ?[*:0]const u8, v_rad: *f32) callconv(.Inline) bool {
return SliderAngleExt(label, v_rad, -360.0, 360.0, "%.0f deg");
}
/// SliderFloatExt(label: ?[*:0]const u8, v: *f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) bool
pub const SliderFloatExt = raw.igSliderFloat;
pub fn SliderFloat(label: ?[*:0]const u8, v: *f32, v_min: f32, v_max: f32) callconv(.Inline) bool {
return SliderFloatExt(label, v, v_min, v_max, "%.3f", 1.0);
}
/// SliderFloat2Ext(label: ?[*:0]const u8, v: *[2]f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) bool
pub const SliderFloat2Ext = raw.igSliderFloat2;
pub fn SliderFloat2(label: ?[*:0]const u8, v: *[2]f32, v_min: f32, v_max: f32) callconv(.Inline) bool {
return SliderFloat2Ext(label, v, v_min, v_max, "%.3f", 1.0);
}
/// SliderFloat3Ext(label: ?[*:0]const u8, v: *[3]f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) bool
pub const SliderFloat3Ext = raw.igSliderFloat3;
pub fn SliderFloat3(label: ?[*:0]const u8, v: *[3]f32, v_min: f32, v_max: f32) callconv(.Inline) bool {
return SliderFloat3Ext(label, v, v_min, v_max, "%.3f", 1.0);
}
/// SliderFloat4Ext(label: ?[*:0]const u8, v: *[4]f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) bool
pub const SliderFloat4Ext = raw.igSliderFloat4;
pub fn SliderFloat4(label: ?[*:0]const u8, v: *[4]f32, v_min: f32, v_max: f32) callconv(.Inline) bool {
return SliderFloat4Ext(label, v, v_min, v_max, "%.3f", 1.0);
}
/// SliderIntExt(label: ?[*:0]const u8, v: *i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) bool
pub const SliderIntExt = raw.igSliderInt;
pub fn SliderInt(label: ?[*:0]const u8, v: *i32, v_min: i32, v_max: i32) callconv(.Inline) bool {
return SliderIntExt(label, v, v_min, v_max, "%d");
}
/// SliderInt2Ext(label: ?[*:0]const u8, v: *[2]i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) bool
pub const SliderInt2Ext = raw.igSliderInt2;
pub fn SliderInt2(label: ?[*:0]const u8, v: *[2]i32, v_min: i32, v_max: i32) callconv(.Inline) bool {
return SliderInt2Ext(label, v, v_min, v_max, "%d");
}
/// SliderInt3Ext(label: ?[*:0]const u8, v: *[3]i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) bool
pub const SliderInt3Ext = raw.igSliderInt3;
pub fn SliderInt3(label: ?[*:0]const u8, v: *[3]i32, v_min: i32, v_max: i32) callconv(.Inline) bool {
return SliderInt3Ext(label, v, v_min, v_max, "%d");
}
/// SliderInt4Ext(label: ?[*:0]const u8, v: *[4]i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) bool
pub const SliderInt4Ext = raw.igSliderInt4;
pub fn SliderInt4(label: ?[*:0]const u8, v: *[4]i32, v_min: i32, v_max: i32) callconv(.Inline) bool {
return SliderInt4Ext(label, v, v_min, v_max, "%d");
}
/// SliderScalarExt(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) bool
pub const SliderScalarExt = raw.igSliderScalar;
pub fn SliderScalar(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void) callconv(.Inline) bool {
return SliderScalarExt(label, data_type, p_data, p_min, p_max, null, 1.0);
}
/// SliderScalarNExt(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, components: i32, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) bool
pub const SliderScalarNExt = raw.igSliderScalarN;
pub fn SliderScalarN(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, components: i32, p_min: ?*const c_void, p_max: ?*const c_void) callconv(.Inline) bool {
return SliderScalarNExt(label, data_type, p_data, components, p_min, p_max, null, 1.0);
}
/// SmallButton(label: ?[*:0]const u8) bool
pub const SmallButton = raw.igSmallButton;
/// Spacing() void
pub const Spacing = raw.igSpacing;
/// StyleColorsClassicExt(dst: ?*Style) void
pub const StyleColorsClassicExt = raw.igStyleColorsClassic;
pub fn StyleColorsClassic() callconv(.Inline) void {
return StyleColorsClassicExt(null);
}
/// StyleColorsDarkExt(dst: ?*Style) void
pub const StyleColorsDarkExt = raw.igStyleColorsDark;
pub fn StyleColorsDark() callconv(.Inline) void {
return StyleColorsDarkExt(null);
}
/// StyleColorsLightExt(dst: ?*Style) void
pub const StyleColorsLightExt = raw.igStyleColorsLight;
pub fn StyleColorsLight() callconv(.Inline) void {
return StyleColorsLightExt(null);
}
/// Text(fmt: ?[*:0]const u8, ...: ...) void
pub const Text = raw.igText;
/// TextColored(col: Vec4, fmt: ?[*:0]const u8, ...: ...) void
pub const TextColored = raw.igTextColored;
/// TextDisabled(fmt: ?[*:0]const u8, ...: ...) void
pub const TextDisabled = raw.igTextDisabled;
/// TextUnformattedExt(text: ?[*]const u8, text_end: ?[*]const u8) void
pub const TextUnformattedExt = raw.igTextUnformatted;
pub fn TextUnformatted(text: ?[*]const u8) callconv(.Inline) void {
return TextUnformattedExt(text, null);
}
/// TextWrapped(fmt: ?[*:0]const u8, ...: ...) void
pub const TextWrapped = raw.igTextWrapped;
/// TreeNodeStr(label: ?[*:0]const u8) bool
pub const TreeNodeStr = raw.igTreeNodeStr;
/// TreeNodeStrStr(str_id: ?[*:0]const u8, fmt: ?[*:0]const u8, ...: ...) bool
pub const TreeNodeStrStr = raw.igTreeNodeStrStr;
/// TreeNodePtr(ptr_id: ?*const c_void, fmt: ?[*:0]const u8, ...: ...) bool
pub const TreeNodePtr = raw.igTreeNodePtr;
pub fn TreeNodeExStrExt(label: ?[*:0]const u8, flags: TreeNodeFlags) callconv(.Inline) bool {
return raw.igTreeNodeExStr(label, flags.toInt());
}
pub fn TreeNodeExStr(label: ?[*:0]const u8) callconv(.Inline) bool {
return TreeNodeExStrExt(label, .{});
}
/// TreeNodeExStrStr(str_id: ?[*:0]const u8, flags: TreeNodeFlags, fmt: ?[*:0]const u8, ...: ...) bool
pub const TreeNodeExStrStr = raw.igTreeNodeExStrStr;
/// TreeNodeExPtr(ptr_id: ?*const c_void, flags: TreeNodeFlags, fmt: ?[*:0]const u8, ...: ...) bool
pub const TreeNodeExPtr = raw.igTreeNodeExPtr;
/// TreePop() void
pub const TreePop = raw.igTreePop;
/// TreePushStr(str_id: ?[*:0]const u8) void
pub const TreePushStr = raw.igTreePushStr;
/// TreePushPtrExt(ptr_id: ?*const c_void) void
pub const TreePushPtrExt = raw.igTreePushPtr;
pub fn TreePushPtr() callconv(.Inline) void {
return TreePushPtrExt(null);
}
/// UnindentExt(indent_w: f32) void
pub const UnindentExt = raw.igUnindent;
pub fn Unindent() callconv(.Inline) void {
return UnindentExt(0.0);
}
/// VSliderFloatExt(label: ?[*:0]const u8, size: Vec2, v: *f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) bool
pub const VSliderFloatExt = raw.igVSliderFloat;
pub fn VSliderFloat(label: ?[*:0]const u8, size: Vec2, v: *f32, v_min: f32, v_max: f32) callconv(.Inline) bool {
return VSliderFloatExt(label, size, v, v_min, v_max, "%.3f", 1.0);
}
/// VSliderIntExt(label: ?[*:0]const u8, size: Vec2, v: *i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) bool
pub const VSliderIntExt = raw.igVSliderInt;
pub fn VSliderInt(label: ?[*:0]const u8, size: Vec2, v: *i32, v_min: i32, v_max: i32) callconv(.Inline) bool {
return VSliderIntExt(label, size, v, v_min, v_max, "%d");
}
/// VSliderScalarExt(label: ?[*:0]const u8, size: Vec2, data_type: DataType, p_data: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) bool
pub const VSliderScalarExt = raw.igVSliderScalar;
pub fn VSliderScalar(label: ?[*:0]const u8, size: Vec2, data_type: DataType, p_data: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void) callconv(.Inline) bool {
return VSliderScalarExt(label, size, data_type, p_data, p_min, p_max, null, 1.0);
}
/// ValueBool(prefix: ?[*:0]const u8, b: bool) void
pub const ValueBool = raw.igValueBool;
/// ValueInt(prefix: ?[*:0]const u8, v: i32) void
pub const ValueInt = raw.igValueInt;
/// ValueUint(prefix: ?[*:0]const u8, v: u32) void
pub const ValueUint = raw.igValueUint;
/// ValueFloatExt(prefix: ?[*:0]const u8, v: f32, float_format: ?[*:0]const u8) void
pub const ValueFloatExt = raw.igValueFloat;
pub fn ValueFloat(prefix: ?[*:0]const u8, v: f32) callconv(.Inline) void {
return ValueFloatExt(prefix, v, null);
}
pub const raw = struct {
pub extern fn ImColor_HSV_nonUDT(pOut: *Color, self: *Color, h: f32, s: f32, v: f32, a: f32) callconv(.C) void;
pub extern fn ImColor_ImColor(self: *Color) callconv(.C) void;
pub extern fn ImColor_ImColorInt(self: *Color, r: i32, g: i32, b: i32, a: i32) callconv(.C) void;
pub extern fn ImColor_ImColorU32(self: *Color, rgba: u32) callconv(.C) void;
pub extern fn ImColor_ImColorFloat(self: *Color, r: f32, g: f32, b: f32, a: f32) callconv(.C) void;
pub extern fn ImColor_ImColorVec4(self: *Color, col: Vec4) callconv(.C) void;
pub extern fn ImColor_SetHSV(self: *Color, h: f32, s: f32, v: f32, a: f32) callconv(.C) void;
pub extern fn ImColor_destroy(self: *Color) callconv(.C) void;
pub extern fn ImDrawCmd_ImDrawCmd(self: *DrawCmd) callconv(.C) void;
pub extern fn ImDrawCmd_destroy(self: *DrawCmd) callconv(.C) void;
pub extern fn ImDrawData_Clear(self: *DrawData) callconv(.C) void;
pub extern fn ImDrawData_DeIndexAllBuffers(self: *DrawData) callconv(.C) void;
pub extern fn ImDrawData_ImDrawData(self: *DrawData) callconv(.C) void;
pub extern fn ImDrawData_ScaleClipRects(self: *DrawData, fb_scale: Vec2) callconv(.C) void;
pub extern fn ImDrawData_destroy(self: *DrawData) callconv(.C) void;
pub extern fn ImDrawListSplitter_Clear(self: *DrawListSplitter) callconv(.C) void;
pub extern fn ImDrawListSplitter_ClearFreeMemory(self: *DrawListSplitter) callconv(.C) void;
pub extern fn ImDrawListSplitter_ImDrawListSplitter(self: *DrawListSplitter) callconv(.C) void;
pub extern fn ImDrawListSplitter_Merge(self: *DrawListSplitter, draw_list: ?*DrawList) callconv(.C) void;
pub extern fn ImDrawListSplitter_SetCurrentChannel(self: *DrawListSplitter, draw_list: ?*DrawList, channel_idx: i32) callconv(.C) void;
pub extern fn ImDrawListSplitter_Split(self: *DrawListSplitter, draw_list: ?*DrawList, count: i32) callconv(.C) void;
pub extern fn ImDrawListSplitter_destroy(self: *DrawListSplitter) callconv(.C) void;
pub extern fn ImDrawList_AddBezierCurve(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, col: u32, thickness: f32, num_segments: i32) callconv(.C) void;
pub extern fn ImDrawList_AddCallback(self: *DrawList, callback: DrawCallback, callback_data: ?*c_void) callconv(.C) void;
pub extern fn ImDrawList_AddCircle(self: *DrawList, center: Vec2, radius: f32, col: u32, num_segments: i32, thickness: f32) callconv(.C) void;
pub extern fn ImDrawList_AddCircleFilled(self: *DrawList, center: Vec2, radius: f32, col: u32, num_segments: i32) callconv(.C) void;
pub extern fn ImDrawList_AddConvexPolyFilled(self: *DrawList, points: ?[*]const Vec2, num_points: i32, col: u32) callconv(.C) void;
pub extern fn ImDrawList_AddDrawCmd(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_AddImage(self: *DrawList, user_texture_id: TextureID, p_min: Vec2, p_max: Vec2, uv_min: Vec2, uv_max: Vec2, col: u32) callconv(.C) void;
pub extern fn ImDrawList_AddImageQuad(self: *DrawList, user_texture_id: TextureID, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, uv1: Vec2, uv2: Vec2, uv3: Vec2, uv4: Vec2, col: u32) callconv(.C) void;
pub extern fn ImDrawList_AddImageRounded(self: *DrawList, user_texture_id: TextureID, p_min: Vec2, p_max: Vec2, uv_min: Vec2, uv_max: Vec2, col: u32, rounding: f32, rounding_corners: DrawCornerFlagsInt) callconv(.C) void;
pub extern fn ImDrawList_AddLine(self: *DrawList, p1: Vec2, p2: Vec2, col: u32, thickness: f32) callconv(.C) void;
pub extern fn ImDrawList_AddNgon(self: *DrawList, center: Vec2, radius: f32, col: u32, num_segments: i32, thickness: f32) callconv(.C) void;
pub extern fn ImDrawList_AddNgonFilled(self: *DrawList, center: Vec2, radius: f32, col: u32, num_segments: i32) callconv(.C) void;
pub extern fn ImDrawList_AddPolyline(self: *DrawList, points: ?[*]const Vec2, num_points: i32, col: u32, closed: bool, thickness: f32) callconv(.C) void;
pub extern fn ImDrawList_AddQuad(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, col: u32, thickness: f32) callconv(.C) void;
pub extern fn ImDrawList_AddQuadFilled(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, col: u32) callconv(.C) void;
pub extern fn ImDrawList_AddRect(self: *DrawList, p_min: Vec2, p_max: Vec2, col: u32, rounding: f32, rounding_corners: DrawCornerFlagsInt, thickness: f32) callconv(.C) void;
pub extern fn ImDrawList_AddRectFilled(self: *DrawList, p_min: Vec2, p_max: Vec2, col: u32, rounding: f32, rounding_corners: DrawCornerFlagsInt) callconv(.C) void;
pub extern fn ImDrawList_AddRectFilledMultiColor(self: *DrawList, p_min: Vec2, p_max: Vec2, col_upr_left: u32, col_upr_right: u32, col_bot_right: u32, col_bot_left: u32) callconv(.C) void;
pub extern fn ImDrawList_AddTextVec2(self: *DrawList, pos: Vec2, col: u32, text_begin: ?[*]const u8, text_end: ?[*]const u8) callconv(.C) void;
pub extern fn ImDrawList_AddTextFontPtr(self: *DrawList, font: ?*const Font, font_size: f32, pos: Vec2, col: u32, text_begin: ?[*]const u8, text_end: ?[*]const u8, wrap_width: f32, cpu_fine_clip_rect: ?*const Vec4) callconv(.C) void;
pub extern fn ImDrawList_AddTriangle(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, col: u32, thickness: f32) callconv(.C) void;
pub extern fn ImDrawList_AddTriangleFilled(self: *DrawList, p1: Vec2, p2: Vec2, p3: Vec2, col: u32) callconv(.C) void;
pub extern fn ImDrawList_ChannelsMerge(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_ChannelsSetCurrent(self: *DrawList, n: i32) callconv(.C) void;
pub extern fn ImDrawList_ChannelsSplit(self: *DrawList, count: i32) callconv(.C) void;
pub extern fn ImDrawList_Clear(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_ClearFreeMemory(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_CloneOutput(self: *const DrawList) callconv(.C) ?*DrawList;
pub extern fn ImDrawList_GetClipRectMax_nonUDT(pOut: *Vec2, self: *const DrawList) callconv(.C) void;
pub extern fn ImDrawList_GetClipRectMin_nonUDT(pOut: *Vec2, self: *const DrawList) callconv(.C) void;
pub extern fn ImDrawList_ImDrawList(self: *DrawList, shared_data: ?*const DrawListSharedData) callconv(.C) void;
pub extern fn ImDrawList_PathArcTo(self: *DrawList, center: Vec2, radius: f32, a_min: f32, a_max: f32, num_segments: i32) callconv(.C) void;
pub extern fn ImDrawList_PathArcToFast(self: *DrawList, center: Vec2, radius: f32, a_min_of_12: i32, a_max_of_12: i32) callconv(.C) void;
pub extern fn ImDrawList_PathBezierCurveTo(self: *DrawList, p2: Vec2, p3: Vec2, p4: Vec2, num_segments: i32) callconv(.C) void;
pub extern fn ImDrawList_PathClear(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_PathFillConvex(self: *DrawList, col: u32) callconv(.C) void;
pub extern fn ImDrawList_PathLineTo(self: *DrawList, pos: Vec2) callconv(.C) void;
pub extern fn ImDrawList_PathLineToMergeDuplicate(self: *DrawList, pos: Vec2) callconv(.C) void;
pub extern fn ImDrawList_PathRect(self: *DrawList, rect_min: Vec2, rect_max: Vec2, rounding: f32, rounding_corners: DrawCornerFlagsInt) callconv(.C) void;
pub extern fn ImDrawList_PathStroke(self: *DrawList, col: u32, closed: bool, thickness: f32) callconv(.C) void;
pub extern fn ImDrawList_PopClipRect(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_PopTextureID(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_PrimQuadUV(self: *DrawList, a: Vec2, b: Vec2, c: Vec2, d: Vec2, uv_a: Vec2, uv_b: Vec2, uv_c: Vec2, uv_d: Vec2, col: u32) callconv(.C) void;
pub extern fn ImDrawList_PrimRect(self: *DrawList, a: Vec2, b: Vec2, col: u32) callconv(.C) void;
pub extern fn ImDrawList_PrimRectUV(self: *DrawList, a: Vec2, b: Vec2, uv_a: Vec2, uv_b: Vec2, col: u32) callconv(.C) void;
pub extern fn ImDrawList_PrimReserve(self: *DrawList, idx_count: i32, vtx_count: i32) callconv(.C) void;
pub extern fn ImDrawList_PrimUnreserve(self: *DrawList, idx_count: i32, vtx_count: i32) callconv(.C) void;
pub extern fn ImDrawList_PrimVtx(self: *DrawList, pos: Vec2, uv: Vec2, col: u32) callconv(.C) void;
pub extern fn ImDrawList_PrimWriteIdx(self: *DrawList, idx: DrawIdx) callconv(.C) void;
pub extern fn ImDrawList_PrimWriteVtx(self: *DrawList, pos: Vec2, uv: Vec2, col: u32) callconv(.C) void;
pub extern fn ImDrawList_PushClipRect(self: *DrawList, clip_rect_min: Vec2, clip_rect_max: Vec2, intersect_with_current_clip_rect: bool) callconv(.C) void;
pub extern fn ImDrawList_PushClipRectFullScreen(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_PushTextureID(self: *DrawList, texture_id: TextureID) callconv(.C) void;
pub extern fn ImDrawList_UpdateClipRect(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_UpdateTextureID(self: *DrawList) callconv(.C) void;
pub extern fn ImDrawList_destroy(self: *DrawList) callconv(.C) void;
pub extern fn ImFontAtlasCustomRect_ImFontAtlasCustomRect(self: *FontAtlasCustomRect) callconv(.C) void;
pub extern fn ImFontAtlasCustomRect_IsPacked(self: *const FontAtlasCustomRect) callconv(.C) bool;
pub extern fn ImFontAtlasCustomRect_destroy(self: *FontAtlasCustomRect) callconv(.C) void;
pub extern fn ImFontAtlas_AddCustomRectFontGlyph(self: *FontAtlas, font: ?*Font, id: Wchar, width: i32, height: i32, advance_x: f32, offset: Vec2) callconv(.C) i32;
pub extern fn ImFontAtlas_AddCustomRectRegular(self: *FontAtlas, id: u32, width: i32, height: i32) callconv(.C) i32;
pub extern fn ImFontAtlas_AddFont(self: *FontAtlas, font_cfg: ?*const FontConfig) callconv(.C) ?*Font;
pub extern fn ImFontAtlas_AddFontDefault(self: *FontAtlas, font_cfg: ?*const FontConfig) callconv(.C) ?*Font;
pub extern fn ImFontAtlas_AddFontFromFileTTF(self: *FontAtlas, filename: ?[*:0]const u8, size_pixels: f32, font_cfg: ?*const FontConfig, glyph_ranges: ?[*:0]const Wchar) callconv(.C) ?*Font;
pub extern fn ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(self: *FontAtlas, compressed_font_data_base85: ?[*]const u8, size_pixels: f32, font_cfg: ?*const FontConfig, glyph_ranges: ?[*:0]const Wchar) callconv(.C) ?*Font;
pub extern fn ImFontAtlas_AddFontFromMemoryCompressedTTF(self: *FontAtlas, compressed_font_data: ?*const c_void, compressed_font_size: i32, size_pixels: f32, font_cfg: ?*const FontConfig, glyph_ranges: ?[*:0]const Wchar) callconv(.C) ?*Font;
pub extern fn ImFontAtlas_AddFontFromMemoryTTF(self: *FontAtlas, font_data: ?*c_void, font_size: i32, size_pixels: f32, font_cfg: ?*const FontConfig, glyph_ranges: ?[*:0]const Wchar) callconv(.C) ?*Font;
pub extern fn ImFontAtlas_Build(self: *FontAtlas) callconv(.C) bool;
pub extern fn ImFontAtlas_CalcCustomRectUV(self: *const FontAtlas, rect: ?*const FontAtlasCustomRect, out_uv_min: ?*Vec2, out_uv_max: ?*Vec2) callconv(.C) void;
pub extern fn ImFontAtlas_Clear(self: *FontAtlas) callconv(.C) void;
pub extern fn ImFontAtlas_ClearFonts(self: *FontAtlas) callconv(.C) void;
pub extern fn ImFontAtlas_ClearInputData(self: *FontAtlas) callconv(.C) void;
pub extern fn ImFontAtlas_ClearTexData(self: *FontAtlas) callconv(.C) void;
pub extern fn ImFontAtlas_GetCustomRectByIndex(self: *const FontAtlas, index: i32) callconv(.C) ?*const FontAtlasCustomRect;
pub extern fn ImFontAtlas_GetGlyphRangesChineseFull(self: *FontAtlas) callconv(.C) ?*const Wchar;
pub extern fn ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon(self: *FontAtlas) callconv(.C) ?*const Wchar;
pub extern fn ImFontAtlas_GetGlyphRangesCyrillic(self: *FontAtlas) callconv(.C) ?*const Wchar;
pub extern fn ImFontAtlas_GetGlyphRangesDefault(self: *FontAtlas) callconv(.C) ?*const Wchar;
pub extern fn ImFontAtlas_GetGlyphRangesJapanese(self: *FontAtlas) callconv(.C) ?*const Wchar;
pub extern fn ImFontAtlas_GetGlyphRangesKorean(self: *FontAtlas) callconv(.C) ?*const Wchar;
pub extern fn ImFontAtlas_GetGlyphRangesThai(self: *FontAtlas) callconv(.C) ?*const Wchar;
pub extern fn ImFontAtlas_GetGlyphRangesVietnamese(self: *FontAtlas) callconv(.C) ?*const Wchar;
pub extern fn ImFontAtlas_GetMouseCursorTexData(self: *FontAtlas, cursor: MouseCursor, out_offset: ?*Vec2, out_size: ?*Vec2, out_uv_border: *[2]Vec2, out_uv_fill: *[2]Vec2) callconv(.C) bool;
pub extern fn ImFontAtlas_GetTexDataAsAlpha8(self: *FontAtlas, out_pixels: *?[*]u8, out_width: *i32, out_height: *i32, out_bytes_per_pixel: ?*i32) callconv(.C) void;
pub extern fn ImFontAtlas_GetTexDataAsRGBA32(self: *FontAtlas, out_pixels: *?[*]u8, out_width: *i32, out_height: *i32, out_bytes_per_pixel: ?*i32) callconv(.C) void;
pub extern fn ImFontAtlas_ImFontAtlas(self: *FontAtlas) callconv(.C) void;
pub extern fn ImFontAtlas_IsBuilt(self: *const FontAtlas) callconv(.C) bool;
pub extern fn ImFontAtlas_SetTexID(self: *FontAtlas, id: TextureID) callconv(.C) void;
pub extern fn ImFontAtlas_destroy(self: *FontAtlas) callconv(.C) void;
pub extern fn ImFontConfig_ImFontConfig(self: *FontConfig) callconv(.C) void;
pub extern fn ImFontConfig_destroy(self: *FontConfig) callconv(.C) void;
pub extern fn ImFontGlyphRangesBuilder_AddChar(self: *FontGlyphRangesBuilder, c: Wchar) callconv(.C) void;
pub extern fn ImFontGlyphRangesBuilder_AddRanges(self: *FontGlyphRangesBuilder, ranges: ?[*:0]const Wchar) callconv(.C) void;
pub extern fn ImFontGlyphRangesBuilder_AddText(self: *FontGlyphRangesBuilder, text: ?[*]const u8, text_end: ?[*]const u8) callconv(.C) void;
pub extern fn ImFontGlyphRangesBuilder_BuildRanges(self: *FontGlyphRangesBuilder, out_ranges: *Vector(Wchar)) callconv(.C) void;
pub extern fn ImFontGlyphRangesBuilder_Clear(self: *FontGlyphRangesBuilder) callconv(.C) void;
pub extern fn ImFontGlyphRangesBuilder_GetBit(self: *const FontGlyphRangesBuilder, n: i32) callconv(.C) bool;
pub extern fn ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder(self: *FontGlyphRangesBuilder) callconv(.C) void;
pub extern fn ImFontGlyphRangesBuilder_SetBit(self: *FontGlyphRangesBuilder, n: i32) callconv(.C) void;
pub extern fn ImFontGlyphRangesBuilder_destroy(self: *FontGlyphRangesBuilder) callconv(.C) void;
pub extern fn ImFont_AddGlyph(self: *Font, c: Wchar, x0: f32, y0: f32, x1: f32, y1: f32, u0: f32, v0: f32, u1: f32, v1: f32, advance_x: f32) callconv(.C) void;
pub extern fn ImFont_AddRemapChar(self: *Font, dst: Wchar, src: Wchar, overwrite_dst: bool) callconv(.C) void;
pub extern fn ImFont_BuildLookupTable(self: *Font) callconv(.C) void;
pub extern fn ImFont_CalcTextSizeA_nonUDT(pOut: *Vec2, self: *const Font, size: f32, max_width: f32, wrap_width: f32, text_begin: ?[*]const u8, text_end: ?[*]const u8, remaining: ?*?[*:0]const u8) callconv(.C) void;
pub extern fn ImFont_CalcWordWrapPositionA(self: *const Font, scale: f32, text: ?[*]const u8, text_end: ?[*]const u8, wrap_width: f32) callconv(.C) ?[*]const u8;
pub extern fn ImFont_ClearOutputData(self: *Font) callconv(.C) void;
pub extern fn ImFont_FindGlyph(self: *const Font, c: Wchar) callconv(.C) ?*const FontGlyph;
pub extern fn ImFont_FindGlyphNoFallback(self: *const Font, c: Wchar) callconv(.C) ?*const FontGlyph;
pub extern fn ImFont_GetCharAdvance(self: *const Font, c: Wchar) callconv(.C) f32;
pub extern fn ImFont_GetDebugName(self: *const Font) callconv(.C) ?[*:0]const u8;
pub extern fn ImFont_GrowIndex(self: *Font, new_size: i32) callconv(.C) void;
pub extern fn ImFont_ImFont(self: *Font) callconv(.C) void;
pub extern fn ImFont_IsLoaded(self: *const Font) callconv(.C) bool;
pub extern fn ImFont_RenderChar(self: *const Font, draw_list: ?*DrawList, size: f32, pos: Vec2, col: u32, c: Wchar) callconv(.C) void;
pub extern fn ImFont_RenderText(self: *const Font, draw_list: ?*DrawList, size: f32, pos: Vec2, col: u32, clip_rect: Vec4, text_begin: ?[*]const u8, text_end: ?[*]const u8, wrap_width: f32, cpu_fine_clip: bool) callconv(.C) void;
pub extern fn ImFont_SetFallbackChar(self: *Font, c: Wchar) callconv(.C) void;
pub extern fn ImFont_destroy(self: *Font) callconv(.C) void;
pub extern fn ImGuiIO_AddInputCharacter(self: *IO, c: u32) callconv(.C) void;
pub extern fn ImGuiIO_AddInputCharactersUTF8(self: *IO, str: ?[*:0]const u8) callconv(.C) void;
pub extern fn ImGuiIO_ClearInputCharacters(self: *IO) callconv(.C) void;
pub extern fn ImGuiIO_ImGuiIO(self: *IO) callconv(.C) void;
pub extern fn ImGuiIO_destroy(self: *IO) callconv(.C) void;
pub extern fn ImGuiInputTextCallbackData_DeleteChars(self: *InputTextCallbackData, pos: i32, bytes_count: i32) callconv(.C) void;
pub extern fn ImGuiInputTextCallbackData_HasSelection(self: *const InputTextCallbackData) callconv(.C) bool;
pub extern fn ImGuiInputTextCallbackData_ImGuiInputTextCallbackData(self: *InputTextCallbackData) callconv(.C) void;
pub extern fn ImGuiInputTextCallbackData_InsertChars(self: *InputTextCallbackData, pos: i32, text: ?[*]const u8, text_end: ?[*]const u8) callconv(.C) void;
pub extern fn ImGuiInputTextCallbackData_destroy(self: *InputTextCallbackData) callconv(.C) void;
pub extern fn ImGuiListClipper_Begin(self: *ListClipper, items_count: i32, items_height: f32) callconv(.C) void;
pub extern fn ImGuiListClipper_End(self: *ListClipper) callconv(.C) void;
pub extern fn ImGuiListClipper_ImGuiListClipper(self: *ListClipper, items_count: i32, items_height: f32) callconv(.C) void;
pub extern fn ImGuiListClipper_Step(self: *ListClipper) callconv(.C) bool;
pub extern fn ImGuiListClipper_destroy(self: *ListClipper) callconv(.C) void;
pub extern fn ImGuiOnceUponAFrame_ImGuiOnceUponAFrame(self: *OnceUponAFrame) callconv(.C) void;
pub extern fn ImGuiOnceUponAFrame_destroy(self: *OnceUponAFrame) callconv(.C) void;
pub extern fn ImGuiPayload_Clear(self: *Payload) callconv(.C) void;
pub extern fn ImGuiPayload_ImGuiPayload(self: *Payload) callconv(.C) void;
pub extern fn ImGuiPayload_IsDataType(self: *const Payload, kind: ?[*:0]const u8) callconv(.C) bool;
pub extern fn ImGuiPayload_IsDelivery(self: *const Payload) callconv(.C) bool;
pub extern fn ImGuiPayload_IsPreview(self: *const Payload) callconv(.C) bool;
pub extern fn ImGuiPayload_destroy(self: *Payload) callconv(.C) void;
pub extern fn ImGuiStoragePair_ImGuiStoragePairInt(self: *StoragePair, _key: ID, _val_i: i32) callconv(.C) void;
pub extern fn ImGuiStoragePair_ImGuiStoragePairFloat(self: *StoragePair, _key: ID, _val_f: f32) callconv(.C) void;
pub extern fn ImGuiStoragePair_ImGuiStoragePairPtr(self: *StoragePair, _key: ID, _val_p: ?*c_void) callconv(.C) void;
pub extern fn ImGuiStoragePair_destroy(self: *StoragePair) callconv(.C) void;
pub extern fn ImGuiStorage_BuildSortByKey(self: *Storage) callconv(.C) void;
pub extern fn ImGuiStorage_Clear(self: *Storage) callconv(.C) void;
pub extern fn ImGuiStorage_GetBool(self: *const Storage, key: ID, default_val: bool) callconv(.C) bool;
pub extern fn ImGuiStorage_GetBoolRef(self: *Storage, key: ID, default_val: bool) callconv(.C) ?*bool;
pub extern fn ImGuiStorage_GetFloat(self: *const Storage, key: ID, default_val: f32) callconv(.C) f32;
pub extern fn ImGuiStorage_GetFloatRef(self: *Storage, key: ID, default_val: f32) callconv(.C) ?*f32;
pub extern fn ImGuiStorage_GetInt(self: *const Storage, key: ID, default_val: i32) callconv(.C) i32;
pub extern fn ImGuiStorage_GetIntRef(self: *Storage, key: ID, default_val: i32) callconv(.C) ?*i32;
pub extern fn ImGuiStorage_GetVoidPtr(self: *const Storage, key: ID) callconv(.C) ?*c_void;
pub extern fn ImGuiStorage_GetVoidPtrRef(self: *Storage, key: ID, default_val: ?*c_void) callconv(.C) ?*?*c_void;
pub extern fn ImGuiStorage_SetAllInt(self: *Storage, val: i32) callconv(.C) void;
pub extern fn ImGuiStorage_SetBool(self: *Storage, key: ID, val: bool) callconv(.C) void;
pub extern fn ImGuiStorage_SetFloat(self: *Storage, key: ID, val: f32) callconv(.C) void;
pub extern fn ImGuiStorage_SetInt(self: *Storage, key: ID, val: i32) callconv(.C) void;
pub extern fn ImGuiStorage_SetVoidPtr(self: *Storage, key: ID, val: ?*c_void) callconv(.C) void;
pub extern fn ImGuiStyle_ImGuiStyle(self: *Style) callconv(.C) void;
pub extern fn ImGuiStyle_ScaleAllSizes(self: *Style, scale_factor: f32) callconv(.C) void;
pub extern fn ImGuiStyle_destroy(self: *Style) callconv(.C) void;
pub extern fn ImGuiTextBuffer_ImGuiTextBuffer(self: *TextBuffer) callconv(.C) void;
pub extern fn ImGuiTextBuffer_append(self: *TextBuffer, str: ?[*]const u8, str_end: ?[*]const u8) callconv(.C) void;
pub extern fn ImGuiTextBuffer_appendf(self: *TextBuffer, fmt: ?[*:0]const u8, ...) callconv(.C) void;
pub extern fn ImGuiTextBuffer_begin(self: *const TextBuffer) callconv(.C) [*]const u8;
pub extern fn ImGuiTextBuffer_c_str(self: *const TextBuffer) callconv(.C) [*:0]const u8;
pub extern fn ImGuiTextBuffer_clear(self: *TextBuffer) callconv(.C) void;
pub extern fn ImGuiTextBuffer_destroy(self: *TextBuffer) callconv(.C) void;
pub extern fn ImGuiTextBuffer_empty(self: *const TextBuffer) callconv(.C) bool;
pub extern fn ImGuiTextBuffer_end(self: *const TextBuffer) callconv(.C) [*]const u8;
pub extern fn ImGuiTextBuffer_reserve(self: *TextBuffer, capacity: i32) callconv(.C) void;
pub extern fn ImGuiTextBuffer_size(self: *const TextBuffer) callconv(.C) i32;
pub extern fn ImGuiTextFilter_Build(self: *TextFilter) callconv(.C) void;
pub extern fn ImGuiTextFilter_Clear(self: *TextFilter) callconv(.C) void;
pub extern fn ImGuiTextFilter_Draw(self: *TextFilter, label: ?[*:0]const u8, width: f32) callconv(.C) bool;
pub extern fn ImGuiTextFilter_ImGuiTextFilter(self: *TextFilter, default_filter: ?[*:0]const u8) callconv(.C) void;
pub extern fn ImGuiTextFilter_IsActive(self: *const TextFilter) callconv(.C) bool;
pub extern fn ImGuiTextFilter_PassFilter(self: *const TextFilter, text: ?[*]const u8, text_end: ?[*]const u8) callconv(.C) bool;
pub extern fn ImGuiTextFilter_destroy(self: *TextFilter) callconv(.C) void;
pub extern fn ImGuiTextRange_ImGuiTextRange(self: *TextRange) callconv(.C) void;
pub extern fn ImGuiTextRange_ImGuiTextRangeStr(self: *TextRange, _b: ?[*]const u8, _e: ?[*]const u8) callconv(.C) void;
pub extern fn ImGuiTextRange_destroy(self: *TextRange) callconv(.C) void;
pub extern fn ImGuiTextRange_empty(self: *const TextRange) callconv(.C) bool;
pub extern fn ImGuiTextRange_split(self: *const TextRange, separator: u8, out: ?*Vector(TextRange)) callconv(.C) void;
pub extern fn ImVec2_ImVec2(self: *Vec2) callconv(.C) void;
pub extern fn ImVec2_ImVec2Float(self: *Vec2, _x: f32, _y: f32) callconv(.C) void;
pub extern fn ImVec2_destroy(self: *Vec2) callconv(.C) void;
pub extern fn ImVec4_ImVec4(self: *Vec4) callconv(.C) void;
pub extern fn ImVec4_ImVec4Float(self: *Vec4, _x: f32, _y: f32, _z: f32, _w: f32) callconv(.C) void;
pub extern fn ImVec4_destroy(self: *Vec4) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_ImVector_ImDrawChannel(self: *Vector(DrawChannel)) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_ImVector_ImDrawCmd(self: *Vector(DrawCmd)) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_ImVector_ImDrawIdx(self: *Vector(DrawIdx)) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_ImVector_ImDrawVert(self: *Vector(DrawVert)) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_ImVector_ImFontPtr(self: *Vector(*Font)) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_ImVector_ImFontAtlasCustomRect(self: *Vector(FontAtlasCustomRect)) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_ImVector_ImFontConfig(self: *Vector(FontConfig)) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_ImVector_ImFontGlyph(self: *Vector(FontGlyph)) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_ImVector_ImGuiStoragePair(self: *Vector(StoragePair)) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_ImVector_ImGuiTextRange(self: *Vector(TextRange)) callconv(.C) void;
pub extern fn ImVector_ImTextureID_ImVector_ImTextureID(self: *Vector(TextureID)) callconv(.C) void;
pub extern fn ImVector_ImU32_ImVector_ImU32(self: *Vector(u32)) callconv(.C) void;
pub extern fn ImVector_ImVec2_ImVector_ImVec2(self: *Vector(Vec2)) callconv(.C) void;
pub extern fn ImVector_ImVec4_ImVector_ImVec4(self: *Vector(Vec4)) callconv(.C) void;
pub extern fn ImVector_ImWchar_ImVector_ImWchar(self: *Vector(Wchar)) callconv(.C) void;
pub extern fn ImVector_char_ImVector_char(self: *Vector(u8)) callconv(.C) void;
pub extern fn ImVector_float_ImVector_float(self: *Vector(f32)) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_ImVector_ImDrawChannelVector(self: *Vector(DrawChannel), src: Vector(DrawChannel)) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_ImVector_ImDrawCmdVector(self: *Vector(DrawCmd), src: Vector(DrawCmd)) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_ImVector_ImDrawIdxVector(self: *Vector(DrawIdx), src: Vector(DrawIdx)) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_ImVector_ImDrawVertVector(self: *Vector(DrawVert), src: Vector(DrawVert)) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_ImVector_ImFontPtrVector(self: *Vector(*Font), src: Vector(*Font)) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_ImVector_ImFontAtlasCustomRectVector(self: *Vector(FontAtlasCustomRect), src: Vector(FontAtlasCustomRect)) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_ImVector_ImFontConfigVector(self: *Vector(FontConfig), src: Vector(FontConfig)) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_ImVector_ImFontGlyphVector(self: *Vector(FontGlyph), src: Vector(FontGlyph)) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_ImVector_ImGuiStoragePairVector(self: *Vector(StoragePair), src: Vector(StoragePair)) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_ImVector_ImGuiTextRangeVector(self: *Vector(TextRange), src: Vector(TextRange)) callconv(.C) void;
pub extern fn ImVector_ImTextureID_ImVector_ImTextureIDVector(self: *Vector(TextureID), src: Vector(TextureID)) callconv(.C) void;
pub extern fn ImVector_ImU32_ImVector_ImU32Vector(self: *Vector(u32), src: Vector(u32)) callconv(.C) void;
pub extern fn ImVector_ImVec2_ImVector_ImVec2Vector(self: *Vector(Vec2), src: Vector(Vec2)) callconv(.C) void;
pub extern fn ImVector_ImVec4_ImVector_ImVec4Vector(self: *Vector(Vec4), src: Vector(Vec4)) callconv(.C) void;
pub extern fn ImVector_ImWchar_ImVector_ImWcharVector(self: *Vector(Wchar), src: Vector(Wchar)) callconv(.C) void;
pub extern fn ImVector_char_ImVector_charVector(self: *Vector(u8), src: Vector(u8)) callconv(.C) void;
pub extern fn ImVector_float_ImVector_floatVector(self: *Vector(f32), src: Vector(f32)) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel__grow_capacity(self: *const Vector(DrawChannel), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImDrawCmd__grow_capacity(self: *const Vector(DrawCmd), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImDrawIdx__grow_capacity(self: *const Vector(DrawIdx), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImDrawVert__grow_capacity(self: *const Vector(DrawVert), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImFontPtr__grow_capacity(self: *const Vector(*Font), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImFontAtlasCustomRect__grow_capacity(self: *const Vector(FontAtlasCustomRect), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImFontConfig__grow_capacity(self: *const Vector(FontConfig), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImFontGlyph__grow_capacity(self: *const Vector(FontGlyph), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImGuiStoragePair__grow_capacity(self: *const Vector(StoragePair), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImGuiTextRange__grow_capacity(self: *const Vector(TextRange), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImTextureID__grow_capacity(self: *const Vector(TextureID), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImU32__grow_capacity(self: *const Vector(u32), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImVec2__grow_capacity(self: *const Vector(Vec2), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImVec4__grow_capacity(self: *const Vector(Vec4), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImWchar__grow_capacity(self: *const Vector(Wchar), sz: i32) callconv(.C) i32;
pub extern fn ImVector_char__grow_capacity(self: *const Vector(u8), sz: i32) callconv(.C) i32;
pub extern fn ImVector_float__grow_capacity(self: *const Vector(f32), sz: i32) callconv(.C) i32;
pub extern fn ImVector_ImDrawChannel_back(self: *Vector(DrawChannel)) callconv(.C) *DrawChannel;
pub extern fn ImVector_ImDrawCmd_back(self: *Vector(DrawCmd)) callconv(.C) *DrawCmd;
pub extern fn ImVector_ImDrawIdx_back(self: *Vector(DrawIdx)) callconv(.C) *DrawIdx;
pub extern fn ImVector_ImDrawVert_back(self: *Vector(DrawVert)) callconv(.C) *DrawVert;
pub extern fn ImVector_ImFontPtr_back(self: *Vector(*Font)) callconv(.C) **Font;
pub extern fn ImVector_ImFontAtlasCustomRect_back(self: *Vector(FontAtlasCustomRect)) callconv(.C) *FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_back(self: *Vector(FontConfig)) callconv(.C) *FontConfig;
pub extern fn ImVector_ImFontGlyph_back(self: *Vector(FontGlyph)) callconv(.C) *FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_back(self: *Vector(StoragePair)) callconv(.C) *StoragePair;
pub extern fn ImVector_ImGuiTextRange_back(self: *Vector(TextRange)) callconv(.C) *TextRange;
pub extern fn ImVector_ImTextureID_back(self: *Vector(TextureID)) callconv(.C) *TextureID;
pub extern fn ImVector_ImU32_back(self: *Vector(u32)) callconv(.C) *u32;
pub extern fn ImVector_ImVec2_back(self: *Vector(Vec2)) callconv(.C) *Vec2;
pub extern fn ImVector_ImVec4_back(self: *Vector(Vec4)) callconv(.C) *Vec4;
pub extern fn ImVector_ImWchar_back(self: *Vector(Wchar)) callconv(.C) *Wchar;
pub extern fn ImVector_char_back(self: *Vector(u8)) callconv(.C) *u8;
pub extern fn ImVector_float_back(self: *Vector(f32)) callconv(.C) *f32;
pub extern fn ImVector_ImDrawChannel_back_const(self: *const Vector(DrawChannel)) callconv(.C) *const DrawChannel;
pub extern fn ImVector_ImDrawCmd_back_const(self: *const Vector(DrawCmd)) callconv(.C) *const DrawCmd;
pub extern fn ImVector_ImDrawIdx_back_const(self: *const Vector(DrawIdx)) callconv(.C) *const DrawIdx;
pub extern fn ImVector_ImDrawVert_back_const(self: *const Vector(DrawVert)) callconv(.C) *const DrawVert;
pub extern fn ImVector_ImFontPtr_back_const(self: *const Vector(*Font)) callconv(.C) *const *Font;
pub extern fn ImVector_ImFontAtlasCustomRect_back_const(self: *const Vector(FontAtlasCustomRect)) callconv(.C) *const FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_back_const(self: *const Vector(FontConfig)) callconv(.C) *const FontConfig;
pub extern fn ImVector_ImFontGlyph_back_const(self: *const Vector(FontGlyph)) callconv(.C) *const FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_back_const(self: *const Vector(StoragePair)) callconv(.C) *const StoragePair;
pub extern fn ImVector_ImGuiTextRange_back_const(self: *const Vector(TextRange)) callconv(.C) *const TextRange;
pub extern fn ImVector_ImTextureID_back_const(self: *const Vector(TextureID)) callconv(.C) *const TextureID;
pub extern fn ImVector_ImU32_back_const(self: *const Vector(u32)) callconv(.C) *const u32;
pub extern fn ImVector_ImVec2_back_const(self: *const Vector(Vec2)) callconv(.C) *const Vec2;
pub extern fn ImVector_ImVec4_back_const(self: *const Vector(Vec4)) callconv(.C) *const Vec4;
pub extern fn ImVector_ImWchar_back_const(self: *const Vector(Wchar)) callconv(.C) *const Wchar;
pub extern fn ImVector_char_back_const(self: *const Vector(u8)) callconv(.C) *const u8;
pub extern fn ImVector_float_back_const(self: *const Vector(f32)) callconv(.C) *const f32;
pub extern fn ImVector_ImDrawChannel_begin(self: *Vector(DrawChannel)) callconv(.C) [*]DrawChannel;
pub extern fn ImVector_ImDrawCmd_begin(self: *Vector(DrawCmd)) callconv(.C) [*]DrawCmd;
pub extern fn ImVector_ImDrawIdx_begin(self: *Vector(DrawIdx)) callconv(.C) [*]DrawIdx;
pub extern fn ImVector_ImDrawVert_begin(self: *Vector(DrawVert)) callconv(.C) [*]DrawVert;
pub extern fn ImVector_ImFontPtr_begin(self: *Vector(*Font)) callconv(.C) [*]*Font;
pub extern fn ImVector_ImFontAtlasCustomRect_begin(self: *Vector(FontAtlasCustomRect)) callconv(.C) [*]FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_begin(self: *Vector(FontConfig)) callconv(.C) [*]FontConfig;
pub extern fn ImVector_ImFontGlyph_begin(self: *Vector(FontGlyph)) callconv(.C) [*]FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_begin(self: *Vector(StoragePair)) callconv(.C) [*]StoragePair;
pub extern fn ImVector_ImGuiTextRange_begin(self: *Vector(TextRange)) callconv(.C) [*]TextRange;
pub extern fn ImVector_ImTextureID_begin(self: *Vector(TextureID)) callconv(.C) [*]TextureID;
pub extern fn ImVector_ImU32_begin(self: *Vector(u32)) callconv(.C) [*]u32;
pub extern fn ImVector_ImVec2_begin(self: *Vector(Vec2)) callconv(.C) [*]Vec2;
pub extern fn ImVector_ImVec4_begin(self: *Vector(Vec4)) callconv(.C) [*]Vec4;
pub extern fn ImVector_ImWchar_begin(self: *Vector(Wchar)) callconv(.C) [*]Wchar;
pub extern fn ImVector_char_begin(self: *Vector(u8)) callconv(.C) [*]u8;
pub extern fn ImVector_float_begin(self: *Vector(f32)) callconv(.C) [*]f32;
pub extern fn ImVector_ImDrawChannel_begin_const(self: *const Vector(DrawChannel)) callconv(.C) [*]const DrawChannel;
pub extern fn ImVector_ImDrawCmd_begin_const(self: *const Vector(DrawCmd)) callconv(.C) [*]const DrawCmd;
pub extern fn ImVector_ImDrawIdx_begin_const(self: *const Vector(DrawIdx)) callconv(.C) [*]const DrawIdx;
pub extern fn ImVector_ImDrawVert_begin_const(self: *const Vector(DrawVert)) callconv(.C) [*]const DrawVert;
pub extern fn ImVector_ImFontPtr_begin_const(self: *const Vector(*Font)) callconv(.C) [*]const *Font;
pub extern fn ImVector_ImFontAtlasCustomRect_begin_const(self: *const Vector(FontAtlasCustomRect)) callconv(.C) [*]const FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_begin_const(self: *const Vector(FontConfig)) callconv(.C) [*]const FontConfig;
pub extern fn ImVector_ImFontGlyph_begin_const(self: *const Vector(FontGlyph)) callconv(.C) [*]const FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_begin_const(self: *const Vector(StoragePair)) callconv(.C) [*]const StoragePair;
pub extern fn ImVector_ImGuiTextRange_begin_const(self: *const Vector(TextRange)) callconv(.C) [*]const TextRange;
pub extern fn ImVector_ImTextureID_begin_const(self: *const Vector(TextureID)) callconv(.C) [*]const TextureID;
pub extern fn ImVector_ImU32_begin_const(self: *const Vector(u32)) callconv(.C) [*]const u32;
pub extern fn ImVector_ImVec2_begin_const(self: *const Vector(Vec2)) callconv(.C) [*]const Vec2;
pub extern fn ImVector_ImVec4_begin_const(self: *const Vector(Vec4)) callconv(.C) [*]const Vec4;
pub extern fn ImVector_ImWchar_begin_const(self: *const Vector(Wchar)) callconv(.C) [*]const Wchar;
pub extern fn ImVector_char_begin_const(self: *const Vector(u8)) callconv(.C) [*]const u8;
pub extern fn ImVector_float_begin_const(self: *const Vector(f32)) callconv(.C) [*]const f32;
pub extern fn ImVector_ImDrawChannel_capacity(self: *const Vector(DrawChannel)) callconv(.C) i32;
pub extern fn ImVector_ImDrawCmd_capacity(self: *const Vector(DrawCmd)) callconv(.C) i32;
pub extern fn ImVector_ImDrawIdx_capacity(self: *const Vector(DrawIdx)) callconv(.C) i32;
pub extern fn ImVector_ImDrawVert_capacity(self: *const Vector(DrawVert)) callconv(.C) i32;
pub extern fn ImVector_ImFontPtr_capacity(self: *const Vector(*Font)) callconv(.C) i32;
pub extern fn ImVector_ImFontAtlasCustomRect_capacity(self: *const Vector(FontAtlasCustomRect)) callconv(.C) i32;
pub extern fn ImVector_ImFontConfig_capacity(self: *const Vector(FontConfig)) callconv(.C) i32;
pub extern fn ImVector_ImFontGlyph_capacity(self: *const Vector(FontGlyph)) callconv(.C) i32;
pub extern fn ImVector_ImGuiStoragePair_capacity(self: *const Vector(StoragePair)) callconv(.C) i32;
pub extern fn ImVector_ImGuiTextRange_capacity(self: *const Vector(TextRange)) callconv(.C) i32;
pub extern fn ImVector_ImTextureID_capacity(self: *const Vector(TextureID)) callconv(.C) i32;
pub extern fn ImVector_ImU32_capacity(self: *const Vector(u32)) callconv(.C) i32;
pub extern fn ImVector_ImVec2_capacity(self: *const Vector(Vec2)) callconv(.C) i32;
pub extern fn ImVector_ImVec4_capacity(self: *const Vector(Vec4)) callconv(.C) i32;
pub extern fn ImVector_ImWchar_capacity(self: *const Vector(Wchar)) callconv(.C) i32;
pub extern fn ImVector_char_capacity(self: *const Vector(u8)) callconv(.C) i32;
pub extern fn ImVector_float_capacity(self: *const Vector(f32)) callconv(.C) i32;
pub extern fn ImVector_ImDrawChannel_clear(self: *Vector(DrawChannel)) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_clear(self: *Vector(DrawCmd)) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_clear(self: *Vector(DrawIdx)) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_clear(self: *Vector(DrawVert)) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_clear(self: *Vector(*Font)) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_clear(self: *Vector(FontAtlasCustomRect)) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_clear(self: *Vector(FontConfig)) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_clear(self: *Vector(FontGlyph)) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_clear(self: *Vector(StoragePair)) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_clear(self: *Vector(TextRange)) callconv(.C) void;
pub extern fn ImVector_ImTextureID_clear(self: *Vector(TextureID)) callconv(.C) void;
pub extern fn ImVector_ImU32_clear(self: *Vector(u32)) callconv(.C) void;
pub extern fn ImVector_ImVec2_clear(self: *Vector(Vec2)) callconv(.C) void;
pub extern fn ImVector_ImVec4_clear(self: *Vector(Vec4)) callconv(.C) void;
pub extern fn ImVector_ImWchar_clear(self: *Vector(Wchar)) callconv(.C) void;
pub extern fn ImVector_char_clear(self: *Vector(u8)) callconv(.C) void;
pub extern fn ImVector_float_clear(self: *Vector(f32)) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_contains(self: *const Vector(DrawIdx), v: DrawIdx) callconv(.C) bool;
pub extern fn ImVector_ImFontPtr_contains(self: *const Vector(*Font), v: *Font) callconv(.C) bool;
pub extern fn ImVector_ImTextureID_contains(self: *const Vector(TextureID), v: TextureID) callconv(.C) bool;
pub extern fn ImVector_ImU32_contains(self: *const Vector(u32), v: u32) callconv(.C) bool;
pub extern fn ImVector_ImWchar_contains(self: *const Vector(Wchar), v: Wchar) callconv(.C) bool;
pub extern fn ImVector_char_contains(self: *const Vector(u8), v: u8) callconv(.C) bool;
pub extern fn ImVector_float_contains(self: *const Vector(f32), v: f32) callconv(.C) bool;
pub extern fn ImVector_ImDrawChannel_destroy(self: *Vector(DrawChannel)) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_destroy(self: *Vector(DrawCmd)) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_destroy(self: *Vector(DrawIdx)) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_destroy(self: *Vector(DrawVert)) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_destroy(self: *Vector(*Font)) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_destroy(self: *Vector(FontAtlasCustomRect)) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_destroy(self: *Vector(FontConfig)) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_destroy(self: *Vector(FontGlyph)) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_destroy(self: *Vector(StoragePair)) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_destroy(self: *Vector(TextRange)) callconv(.C) void;
pub extern fn ImVector_ImTextureID_destroy(self: *Vector(TextureID)) callconv(.C) void;
pub extern fn ImVector_ImU32_destroy(self: *Vector(u32)) callconv(.C) void;
pub extern fn ImVector_ImVec2_destroy(self: *Vector(Vec2)) callconv(.C) void;
pub extern fn ImVector_ImVec4_destroy(self: *Vector(Vec4)) callconv(.C) void;
pub extern fn ImVector_ImWchar_destroy(self: *Vector(Wchar)) callconv(.C) void;
pub extern fn ImVector_char_destroy(self: *Vector(u8)) callconv(.C) void;
pub extern fn ImVector_float_destroy(self: *Vector(f32)) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_empty(self: *const Vector(DrawChannel)) callconv(.C) bool;
pub extern fn ImVector_ImDrawCmd_empty(self: *const Vector(DrawCmd)) callconv(.C) bool;
pub extern fn ImVector_ImDrawIdx_empty(self: *const Vector(DrawIdx)) callconv(.C) bool;
pub extern fn ImVector_ImDrawVert_empty(self: *const Vector(DrawVert)) callconv(.C) bool;
pub extern fn ImVector_ImFontPtr_empty(self: *const Vector(*Font)) callconv(.C) bool;
pub extern fn ImVector_ImFontAtlasCustomRect_empty(self: *const Vector(FontAtlasCustomRect)) callconv(.C) bool;
pub extern fn ImVector_ImFontConfig_empty(self: *const Vector(FontConfig)) callconv(.C) bool;
pub extern fn ImVector_ImFontGlyph_empty(self: *const Vector(FontGlyph)) callconv(.C) bool;
pub extern fn ImVector_ImGuiStoragePair_empty(self: *const Vector(StoragePair)) callconv(.C) bool;
pub extern fn ImVector_ImGuiTextRange_empty(self: *const Vector(TextRange)) callconv(.C) bool;
pub extern fn ImVector_ImTextureID_empty(self: *const Vector(TextureID)) callconv(.C) bool;
pub extern fn ImVector_ImU32_empty(self: *const Vector(u32)) callconv(.C) bool;
pub extern fn ImVector_ImVec2_empty(self: *const Vector(Vec2)) callconv(.C) bool;
pub extern fn ImVector_ImVec4_empty(self: *const Vector(Vec4)) callconv(.C) bool;
pub extern fn ImVector_ImWchar_empty(self: *const Vector(Wchar)) callconv(.C) bool;
pub extern fn ImVector_char_empty(self: *const Vector(u8)) callconv(.C) bool;
pub extern fn ImVector_float_empty(self: *const Vector(f32)) callconv(.C) bool;
pub extern fn ImVector_ImDrawChannel_end(self: *Vector(DrawChannel)) callconv(.C) [*]DrawChannel;
pub extern fn ImVector_ImDrawCmd_end(self: *Vector(DrawCmd)) callconv(.C) [*]DrawCmd;
pub extern fn ImVector_ImDrawIdx_end(self: *Vector(DrawIdx)) callconv(.C) [*]DrawIdx;
pub extern fn ImVector_ImDrawVert_end(self: *Vector(DrawVert)) callconv(.C) [*]DrawVert;
pub extern fn ImVector_ImFontPtr_end(self: *Vector(*Font)) callconv(.C) [*]*Font;
pub extern fn ImVector_ImFontAtlasCustomRect_end(self: *Vector(FontAtlasCustomRect)) callconv(.C) [*]FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_end(self: *Vector(FontConfig)) callconv(.C) [*]FontConfig;
pub extern fn ImVector_ImFontGlyph_end(self: *Vector(FontGlyph)) callconv(.C) [*]FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_end(self: *Vector(StoragePair)) callconv(.C) [*]StoragePair;
pub extern fn ImVector_ImGuiTextRange_end(self: *Vector(TextRange)) callconv(.C) [*]TextRange;
pub extern fn ImVector_ImTextureID_end(self: *Vector(TextureID)) callconv(.C) [*]TextureID;
pub extern fn ImVector_ImU32_end(self: *Vector(u32)) callconv(.C) [*]u32;
pub extern fn ImVector_ImVec2_end(self: *Vector(Vec2)) callconv(.C) [*]Vec2;
pub extern fn ImVector_ImVec4_end(self: *Vector(Vec4)) callconv(.C) [*]Vec4;
pub extern fn ImVector_ImWchar_end(self: *Vector(Wchar)) callconv(.C) [*]Wchar;
pub extern fn ImVector_char_end(self: *Vector(u8)) callconv(.C) [*]u8;
pub extern fn ImVector_float_end(self: *Vector(f32)) callconv(.C) [*]f32;
pub extern fn ImVector_ImDrawChannel_end_const(self: *const Vector(DrawChannel)) callconv(.C) [*]const DrawChannel;
pub extern fn ImVector_ImDrawCmd_end_const(self: *const Vector(DrawCmd)) callconv(.C) [*]const DrawCmd;
pub extern fn ImVector_ImDrawIdx_end_const(self: *const Vector(DrawIdx)) callconv(.C) [*]const DrawIdx;
pub extern fn ImVector_ImDrawVert_end_const(self: *const Vector(DrawVert)) callconv(.C) [*]const DrawVert;
pub extern fn ImVector_ImFontPtr_end_const(self: *const Vector(*Font)) callconv(.C) [*]const *Font;
pub extern fn ImVector_ImFontAtlasCustomRect_end_const(self: *const Vector(FontAtlasCustomRect)) callconv(.C) [*]const FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_end_const(self: *const Vector(FontConfig)) callconv(.C) [*]const FontConfig;
pub extern fn ImVector_ImFontGlyph_end_const(self: *const Vector(FontGlyph)) callconv(.C) [*]const FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_end_const(self: *const Vector(StoragePair)) callconv(.C) [*]const StoragePair;
pub extern fn ImVector_ImGuiTextRange_end_const(self: *const Vector(TextRange)) callconv(.C) [*]const TextRange;
pub extern fn ImVector_ImTextureID_end_const(self: *const Vector(TextureID)) callconv(.C) [*]const TextureID;
pub extern fn ImVector_ImU32_end_const(self: *const Vector(u32)) callconv(.C) [*]const u32;
pub extern fn ImVector_ImVec2_end_const(self: *const Vector(Vec2)) callconv(.C) [*]const Vec2;
pub extern fn ImVector_ImVec4_end_const(self: *const Vector(Vec4)) callconv(.C) [*]const Vec4;
pub extern fn ImVector_ImWchar_end_const(self: *const Vector(Wchar)) callconv(.C) [*]const Wchar;
pub extern fn ImVector_char_end_const(self: *const Vector(u8)) callconv(.C) [*]const u8;
pub extern fn ImVector_float_end_const(self: *const Vector(f32)) callconv(.C) [*]const f32;
pub extern fn ImVector_ImDrawChannel_erase(self: *Vector(DrawChannel), it: [*]const DrawChannel) callconv(.C) [*]DrawChannel;
pub extern fn ImVector_ImDrawCmd_erase(self: *Vector(DrawCmd), it: [*]const DrawCmd) callconv(.C) [*]DrawCmd;
pub extern fn ImVector_ImDrawIdx_erase(self: *Vector(DrawIdx), it: [*]const DrawIdx) callconv(.C) [*]DrawIdx;
pub extern fn ImVector_ImDrawVert_erase(self: *Vector(DrawVert), it: [*]const DrawVert) callconv(.C) [*]DrawVert;
pub extern fn ImVector_ImFontPtr_erase(self: *Vector(*Font), it: [*]const *Font) callconv(.C) [*]*Font;
pub extern fn ImVector_ImFontAtlasCustomRect_erase(self: *Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect) callconv(.C) [*]FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_erase(self: *Vector(FontConfig), it: [*]const FontConfig) callconv(.C) [*]FontConfig;
pub extern fn ImVector_ImFontGlyph_erase(self: *Vector(FontGlyph), it: [*]const FontGlyph) callconv(.C) [*]FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_erase(self: *Vector(StoragePair), it: [*]const StoragePair) callconv(.C) [*]StoragePair;
pub extern fn ImVector_ImGuiTextRange_erase(self: *Vector(TextRange), it: [*]const TextRange) callconv(.C) [*]TextRange;
pub extern fn ImVector_ImTextureID_erase(self: *Vector(TextureID), it: [*]const TextureID) callconv(.C) [*]TextureID;
pub extern fn ImVector_ImU32_erase(self: *Vector(u32), it: [*]const u32) callconv(.C) [*]u32;
pub extern fn ImVector_ImVec2_erase(self: *Vector(Vec2), it: [*]const Vec2) callconv(.C) [*]Vec2;
pub extern fn ImVector_ImVec4_erase(self: *Vector(Vec4), it: [*]const Vec4) callconv(.C) [*]Vec4;
pub extern fn ImVector_ImWchar_erase(self: *Vector(Wchar), it: [*]const Wchar) callconv(.C) [*]Wchar;
pub extern fn ImVector_char_erase(self: *Vector(u8), it: [*]const u8) callconv(.C) [*]u8;
pub extern fn ImVector_float_erase(self: *Vector(f32), it: [*]const f32) callconv(.C) [*]f32;
pub extern fn ImVector_ImDrawChannel_eraseTPtr(self: *Vector(DrawChannel), it: [*]const DrawChannel, it_last: [*]const DrawChannel) callconv(.C) [*]DrawChannel;
pub extern fn ImVector_ImDrawCmd_eraseTPtr(self: *Vector(DrawCmd), it: [*]const DrawCmd, it_last: [*]const DrawCmd) callconv(.C) [*]DrawCmd;
pub extern fn ImVector_ImDrawIdx_eraseTPtr(self: *Vector(DrawIdx), it: [*]const DrawIdx, it_last: [*]const DrawIdx) callconv(.C) [*]DrawIdx;
pub extern fn ImVector_ImDrawVert_eraseTPtr(self: *Vector(DrawVert), it: [*]const DrawVert, it_last: [*]const DrawVert) callconv(.C) [*]DrawVert;
pub extern fn ImVector_ImFontPtr_eraseTPtr(self: *Vector(*Font), it: [*]const *Font, it_last: [*]const *Font) callconv(.C) [*]*Font;
pub extern fn ImVector_ImFontAtlasCustomRect_eraseTPtr(self: *Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect, it_last: [*]const FontAtlasCustomRect) callconv(.C) [*]FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_eraseTPtr(self: *Vector(FontConfig), it: [*]const FontConfig, it_last: [*]const FontConfig) callconv(.C) [*]FontConfig;
pub extern fn ImVector_ImFontGlyph_eraseTPtr(self: *Vector(FontGlyph), it: [*]const FontGlyph, it_last: [*]const FontGlyph) callconv(.C) [*]FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_eraseTPtr(self: *Vector(StoragePair), it: [*]const StoragePair, it_last: [*]const StoragePair) callconv(.C) [*]StoragePair;
pub extern fn ImVector_ImGuiTextRange_eraseTPtr(self: *Vector(TextRange), it: [*]const TextRange, it_last: [*]const TextRange) callconv(.C) [*]TextRange;
pub extern fn ImVector_ImTextureID_eraseTPtr(self: *Vector(TextureID), it: [*]const TextureID, it_last: [*]const TextureID) callconv(.C) [*]TextureID;
pub extern fn ImVector_ImU32_eraseTPtr(self: *Vector(u32), it: [*]const u32, it_last: [*]const u32) callconv(.C) [*]u32;
pub extern fn ImVector_ImVec2_eraseTPtr(self: *Vector(Vec2), it: [*]const Vec2, it_last: [*]const Vec2) callconv(.C) [*]Vec2;
pub extern fn ImVector_ImVec4_eraseTPtr(self: *Vector(Vec4), it: [*]const Vec4, it_last: [*]const Vec4) callconv(.C) [*]Vec4;
pub extern fn ImVector_ImWchar_eraseTPtr(self: *Vector(Wchar), it: [*]const Wchar, it_last: [*]const Wchar) callconv(.C) [*]Wchar;
pub extern fn ImVector_char_eraseTPtr(self: *Vector(u8), it: [*]const u8, it_last: [*]const u8) callconv(.C) [*]u8;
pub extern fn ImVector_float_eraseTPtr(self: *Vector(f32), it: [*]const f32, it_last: [*]const f32) callconv(.C) [*]f32;
pub extern fn ImVector_ImDrawChannel_erase_unsorted(self: *Vector(DrawChannel), it: [*]const DrawChannel) callconv(.C) [*]DrawChannel;
pub extern fn ImVector_ImDrawCmd_erase_unsorted(self: *Vector(DrawCmd), it: [*]const DrawCmd) callconv(.C) [*]DrawCmd;
pub extern fn ImVector_ImDrawIdx_erase_unsorted(self: *Vector(DrawIdx), it: [*]const DrawIdx) callconv(.C) [*]DrawIdx;
pub extern fn ImVector_ImDrawVert_erase_unsorted(self: *Vector(DrawVert), it: [*]const DrawVert) callconv(.C) [*]DrawVert;
pub extern fn ImVector_ImFontPtr_erase_unsorted(self: *Vector(*Font), it: [*]const *Font) callconv(.C) [*]*Font;
pub extern fn ImVector_ImFontAtlasCustomRect_erase_unsorted(self: *Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect) callconv(.C) [*]FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_erase_unsorted(self: *Vector(FontConfig), it: [*]const FontConfig) callconv(.C) [*]FontConfig;
pub extern fn ImVector_ImFontGlyph_erase_unsorted(self: *Vector(FontGlyph), it: [*]const FontGlyph) callconv(.C) [*]FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_erase_unsorted(self: *Vector(StoragePair), it: [*]const StoragePair) callconv(.C) [*]StoragePair;
pub extern fn ImVector_ImGuiTextRange_erase_unsorted(self: *Vector(TextRange), it: [*]const TextRange) callconv(.C) [*]TextRange;
pub extern fn ImVector_ImTextureID_erase_unsorted(self: *Vector(TextureID), it: [*]const TextureID) callconv(.C) [*]TextureID;
pub extern fn ImVector_ImU32_erase_unsorted(self: *Vector(u32), it: [*]const u32) callconv(.C) [*]u32;
pub extern fn ImVector_ImVec2_erase_unsorted(self: *Vector(Vec2), it: [*]const Vec2) callconv(.C) [*]Vec2;
pub extern fn ImVector_ImVec4_erase_unsorted(self: *Vector(Vec4), it: [*]const Vec4) callconv(.C) [*]Vec4;
pub extern fn ImVector_ImWchar_erase_unsorted(self: *Vector(Wchar), it: [*]const Wchar) callconv(.C) [*]Wchar;
pub extern fn ImVector_char_erase_unsorted(self: *Vector(u8), it: [*]const u8) callconv(.C) [*]u8;
pub extern fn ImVector_float_erase_unsorted(self: *Vector(f32), it: [*]const f32) callconv(.C) [*]f32;
pub extern fn ImVector_ImDrawIdx_find(self: *Vector(DrawIdx), v: DrawIdx) callconv(.C) [*]DrawIdx;
pub extern fn ImVector_ImFontPtr_find(self: *Vector(*Font), v: *Font) callconv(.C) [*]*Font;
pub extern fn ImVector_ImTextureID_find(self: *Vector(TextureID), v: TextureID) callconv(.C) [*]TextureID;
pub extern fn ImVector_ImU32_find(self: *Vector(u32), v: u32) callconv(.C) [*]u32;
pub extern fn ImVector_ImWchar_find(self: *Vector(Wchar), v: Wchar) callconv(.C) [*]Wchar;
pub extern fn ImVector_char_find(self: *Vector(u8), v: u8) callconv(.C) [*]u8;
pub extern fn ImVector_float_find(self: *Vector(f32), v: f32) callconv(.C) [*]f32;
pub extern fn ImVector_ImDrawIdx_find_const(self: *const Vector(DrawIdx), v: DrawIdx) callconv(.C) [*]const DrawIdx;
pub extern fn ImVector_ImFontPtr_find_const(self: *const Vector(*Font), v: *Font) callconv(.C) [*]const *Font;
pub extern fn ImVector_ImTextureID_find_const(self: *const Vector(TextureID), v: TextureID) callconv(.C) [*]const TextureID;
pub extern fn ImVector_ImU32_find_const(self: *const Vector(u32), v: u32) callconv(.C) [*]const u32;
pub extern fn ImVector_ImWchar_find_const(self: *const Vector(Wchar), v: Wchar) callconv(.C) [*]const Wchar;
pub extern fn ImVector_char_find_const(self: *const Vector(u8), v: u8) callconv(.C) [*]const u8;
pub extern fn ImVector_float_find_const(self: *const Vector(f32), v: f32) callconv(.C) [*]const f32;
pub extern fn ImVector_ImDrawIdx_find_erase(self: *Vector(DrawIdx), v: DrawIdx) callconv(.C) bool;
pub extern fn ImVector_ImFontPtr_find_erase(self: *Vector(*Font), v: *Font) callconv(.C) bool;
pub extern fn ImVector_ImTextureID_find_erase(self: *Vector(TextureID), v: TextureID) callconv(.C) bool;
pub extern fn ImVector_ImU32_find_erase(self: *Vector(u32), v: u32) callconv(.C) bool;
pub extern fn ImVector_ImWchar_find_erase(self: *Vector(Wchar), v: Wchar) callconv(.C) bool;
pub extern fn ImVector_char_find_erase(self: *Vector(u8), v: u8) callconv(.C) bool;
pub extern fn ImVector_float_find_erase(self: *Vector(f32), v: f32) callconv(.C) bool;
pub extern fn ImVector_ImDrawIdx_find_erase_unsorted(self: *Vector(DrawIdx), v: DrawIdx) callconv(.C) bool;
pub extern fn ImVector_ImFontPtr_find_erase_unsorted(self: *Vector(*Font), v: *Font) callconv(.C) bool;
pub extern fn ImVector_ImTextureID_find_erase_unsorted(self: *Vector(TextureID), v: TextureID) callconv(.C) bool;
pub extern fn ImVector_ImU32_find_erase_unsorted(self: *Vector(u32), v: u32) callconv(.C) bool;
pub extern fn ImVector_ImWchar_find_erase_unsorted(self: *Vector(Wchar), v: Wchar) callconv(.C) bool;
pub extern fn ImVector_char_find_erase_unsorted(self: *Vector(u8), v: u8) callconv(.C) bool;
pub extern fn ImVector_float_find_erase_unsorted(self: *Vector(f32), v: f32) callconv(.C) bool;
pub extern fn ImVector_ImDrawChannel_front(self: *Vector(DrawChannel)) callconv(.C) *DrawChannel;
pub extern fn ImVector_ImDrawCmd_front(self: *Vector(DrawCmd)) callconv(.C) *DrawCmd;
pub extern fn ImVector_ImDrawIdx_front(self: *Vector(DrawIdx)) callconv(.C) *DrawIdx;
pub extern fn ImVector_ImDrawVert_front(self: *Vector(DrawVert)) callconv(.C) *DrawVert;
pub extern fn ImVector_ImFontPtr_front(self: *Vector(*Font)) callconv(.C) **Font;
pub extern fn ImVector_ImFontAtlasCustomRect_front(self: *Vector(FontAtlasCustomRect)) callconv(.C) *FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_front(self: *Vector(FontConfig)) callconv(.C) *FontConfig;
pub extern fn ImVector_ImFontGlyph_front(self: *Vector(FontGlyph)) callconv(.C) *FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_front(self: *Vector(StoragePair)) callconv(.C) *StoragePair;
pub extern fn ImVector_ImGuiTextRange_front(self: *Vector(TextRange)) callconv(.C) *TextRange;
pub extern fn ImVector_ImTextureID_front(self: *Vector(TextureID)) callconv(.C) *TextureID;
pub extern fn ImVector_ImU32_front(self: *Vector(u32)) callconv(.C) *u32;
pub extern fn ImVector_ImVec2_front(self: *Vector(Vec2)) callconv(.C) *Vec2;
pub extern fn ImVector_ImVec4_front(self: *Vector(Vec4)) callconv(.C) *Vec4;
pub extern fn ImVector_ImWchar_front(self: *Vector(Wchar)) callconv(.C) *Wchar;
pub extern fn ImVector_char_front(self: *Vector(u8)) callconv(.C) *u8;
pub extern fn ImVector_float_front(self: *Vector(f32)) callconv(.C) *f32;
pub extern fn ImVector_ImDrawChannel_front_const(self: *const Vector(DrawChannel)) callconv(.C) *const DrawChannel;
pub extern fn ImVector_ImDrawCmd_front_const(self: *const Vector(DrawCmd)) callconv(.C) *const DrawCmd;
pub extern fn ImVector_ImDrawIdx_front_const(self: *const Vector(DrawIdx)) callconv(.C) *const DrawIdx;
pub extern fn ImVector_ImDrawVert_front_const(self: *const Vector(DrawVert)) callconv(.C) *const DrawVert;
pub extern fn ImVector_ImFontPtr_front_const(self: *const Vector(*Font)) callconv(.C) *const *Font;
pub extern fn ImVector_ImFontAtlasCustomRect_front_const(self: *const Vector(FontAtlasCustomRect)) callconv(.C) *const FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_front_const(self: *const Vector(FontConfig)) callconv(.C) *const FontConfig;
pub extern fn ImVector_ImFontGlyph_front_const(self: *const Vector(FontGlyph)) callconv(.C) *const FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_front_const(self: *const Vector(StoragePair)) callconv(.C) *const StoragePair;
pub extern fn ImVector_ImGuiTextRange_front_const(self: *const Vector(TextRange)) callconv(.C) *const TextRange;
pub extern fn ImVector_ImTextureID_front_const(self: *const Vector(TextureID)) callconv(.C) *const TextureID;
pub extern fn ImVector_ImU32_front_const(self: *const Vector(u32)) callconv(.C) *const u32;
pub extern fn ImVector_ImVec2_front_const(self: *const Vector(Vec2)) callconv(.C) *const Vec2;
pub extern fn ImVector_ImVec4_front_const(self: *const Vector(Vec4)) callconv(.C) *const Vec4;
pub extern fn ImVector_ImWchar_front_const(self: *const Vector(Wchar)) callconv(.C) *const Wchar;
pub extern fn ImVector_char_front_const(self: *const Vector(u8)) callconv(.C) *const u8;
pub extern fn ImVector_float_front_const(self: *const Vector(f32)) callconv(.C) *const f32;
pub extern fn ImVector_ImDrawChannel_index_from_ptr(self: *const Vector(DrawChannel), it: [*]const DrawChannel) callconv(.C) i32;
pub extern fn ImVector_ImDrawCmd_index_from_ptr(self: *const Vector(DrawCmd), it: [*]const DrawCmd) callconv(.C) i32;
pub extern fn ImVector_ImDrawIdx_index_from_ptr(self: *const Vector(DrawIdx), it: [*]const DrawIdx) callconv(.C) i32;
pub extern fn ImVector_ImDrawVert_index_from_ptr(self: *const Vector(DrawVert), it: [*]const DrawVert) callconv(.C) i32;
pub extern fn ImVector_ImFontPtr_index_from_ptr(self: *const Vector(*Font), it: [*]const *Font) callconv(.C) i32;
pub extern fn ImVector_ImFontAtlasCustomRect_index_from_ptr(self: *const Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect) callconv(.C) i32;
pub extern fn ImVector_ImFontConfig_index_from_ptr(self: *const Vector(FontConfig), it: [*]const FontConfig) callconv(.C) i32;
pub extern fn ImVector_ImFontGlyph_index_from_ptr(self: *const Vector(FontGlyph), it: [*]const FontGlyph) callconv(.C) i32;
pub extern fn ImVector_ImGuiStoragePair_index_from_ptr(self: *const Vector(StoragePair), it: [*]const StoragePair) callconv(.C) i32;
pub extern fn ImVector_ImGuiTextRange_index_from_ptr(self: *const Vector(TextRange), it: [*]const TextRange) callconv(.C) i32;
pub extern fn ImVector_ImTextureID_index_from_ptr(self: *const Vector(TextureID), it: [*]const TextureID) callconv(.C) i32;
pub extern fn ImVector_ImU32_index_from_ptr(self: *const Vector(u32), it: [*]const u32) callconv(.C) i32;
pub extern fn ImVector_ImVec2_index_from_ptr(self: *const Vector(Vec2), it: [*]const Vec2) callconv(.C) i32;
pub extern fn ImVector_ImVec4_index_from_ptr(self: *const Vector(Vec4), it: [*]const Vec4) callconv(.C) i32;
pub extern fn ImVector_ImWchar_index_from_ptr(self: *const Vector(Wchar), it: [*]const Wchar) callconv(.C) i32;
pub extern fn ImVector_char_index_from_ptr(self: *const Vector(u8), it: [*]const u8) callconv(.C) i32;
pub extern fn ImVector_float_index_from_ptr(self: *const Vector(f32), it: [*]const f32) callconv(.C) i32;
pub extern fn ImVector_ImDrawChannel_insert(self: *Vector(DrawChannel), it: [*]const DrawChannel, v: DrawChannel) callconv(.C) [*]DrawChannel;
pub extern fn ImVector_ImDrawCmd_insert(self: *Vector(DrawCmd), it: [*]const DrawCmd, v: DrawCmd) callconv(.C) [*]DrawCmd;
pub extern fn ImVector_ImDrawIdx_insert(self: *Vector(DrawIdx), it: [*]const DrawIdx, v: DrawIdx) callconv(.C) [*]DrawIdx;
pub extern fn ImVector_ImDrawVert_insert(self: *Vector(DrawVert), it: [*]const DrawVert, v: DrawVert) callconv(.C) [*]DrawVert;
pub extern fn ImVector_ImFontPtr_insert(self: *Vector(*Font), it: [*]const *Font, v: *Font) callconv(.C) [*]*Font;
pub extern fn ImVector_ImFontAtlasCustomRect_insert(self: *Vector(FontAtlasCustomRect), it: [*]const FontAtlasCustomRect, v: FontAtlasCustomRect) callconv(.C) [*]FontAtlasCustomRect;
pub extern fn ImVector_ImFontConfig_insert(self: *Vector(FontConfig), it: [*]const FontConfig, v: FontConfig) callconv(.C) [*]FontConfig;
pub extern fn ImVector_ImFontGlyph_insert(self: *Vector(FontGlyph), it: [*]const FontGlyph, v: FontGlyph) callconv(.C) [*]FontGlyph;
pub extern fn ImVector_ImGuiStoragePair_insert(self: *Vector(StoragePair), it: [*]const StoragePair, v: StoragePair) callconv(.C) [*]StoragePair;
pub extern fn ImVector_ImGuiTextRange_insert(self: *Vector(TextRange), it: [*]const TextRange, v: TextRange) callconv(.C) [*]TextRange;
pub extern fn ImVector_ImTextureID_insert(self: *Vector(TextureID), it: [*]const TextureID, v: TextureID) callconv(.C) [*]TextureID;
pub extern fn ImVector_ImU32_insert(self: *Vector(u32), it: [*]const u32, v: u32) callconv(.C) [*]u32;
pub extern fn ImVector_ImVec2_insert(self: *Vector(Vec2), it: [*]const Vec2, v: Vec2) callconv(.C) [*]Vec2;
pub extern fn ImVector_ImVec4_insert(self: *Vector(Vec4), it: [*]const Vec4, v: Vec4) callconv(.C) [*]Vec4;
pub extern fn ImVector_ImWchar_insert(self: *Vector(Wchar), it: [*]const Wchar, v: Wchar) callconv(.C) [*]Wchar;
pub extern fn ImVector_char_insert(self: *Vector(u8), it: [*]const u8, v: u8) callconv(.C) [*]u8;
pub extern fn ImVector_float_insert(self: *Vector(f32), it: [*]const f32, v: f32) callconv(.C) [*]f32;
pub extern fn ImVector_ImDrawChannel_pop_back(self: *Vector(DrawChannel)) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_pop_back(self: *Vector(DrawCmd)) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_pop_back(self: *Vector(DrawIdx)) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_pop_back(self: *Vector(DrawVert)) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_pop_back(self: *Vector(*Font)) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_pop_back(self: *Vector(FontAtlasCustomRect)) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_pop_back(self: *Vector(FontConfig)) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_pop_back(self: *Vector(FontGlyph)) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_pop_back(self: *Vector(StoragePair)) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_pop_back(self: *Vector(TextRange)) callconv(.C) void;
pub extern fn ImVector_ImTextureID_pop_back(self: *Vector(TextureID)) callconv(.C) void;
pub extern fn ImVector_ImU32_pop_back(self: *Vector(u32)) callconv(.C) void;
pub extern fn ImVector_ImVec2_pop_back(self: *Vector(Vec2)) callconv(.C) void;
pub extern fn ImVector_ImVec4_pop_back(self: *Vector(Vec4)) callconv(.C) void;
pub extern fn ImVector_ImWchar_pop_back(self: *Vector(Wchar)) callconv(.C) void;
pub extern fn ImVector_char_pop_back(self: *Vector(u8)) callconv(.C) void;
pub extern fn ImVector_float_pop_back(self: *Vector(f32)) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_push_back(self: *Vector(DrawChannel), v: DrawChannel) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_push_back(self: *Vector(DrawCmd), v: DrawCmd) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_push_back(self: *Vector(DrawIdx), v: DrawIdx) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_push_back(self: *Vector(DrawVert), v: DrawVert) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_push_back(self: *Vector(*Font), v: *Font) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_push_back(self: *Vector(FontAtlasCustomRect), v: FontAtlasCustomRect) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_push_back(self: *Vector(FontConfig), v: FontConfig) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_push_back(self: *Vector(FontGlyph), v: FontGlyph) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_push_back(self: *Vector(StoragePair), v: StoragePair) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_push_back(self: *Vector(TextRange), v: TextRange) callconv(.C) void;
pub extern fn ImVector_ImTextureID_push_back(self: *Vector(TextureID), v: TextureID) callconv(.C) void;
pub extern fn ImVector_ImU32_push_back(self: *Vector(u32), v: u32) callconv(.C) void;
pub extern fn ImVector_ImVec2_push_back(self: *Vector(Vec2), v: Vec2) callconv(.C) void;
pub extern fn ImVector_ImVec4_push_back(self: *Vector(Vec4), v: Vec4) callconv(.C) void;
pub extern fn ImVector_ImWchar_push_back(self: *Vector(Wchar), v: Wchar) callconv(.C) void;
pub extern fn ImVector_char_push_back(self: *Vector(u8), v: u8) callconv(.C) void;
pub extern fn ImVector_float_push_back(self: *Vector(f32), v: f32) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_push_front(self: *Vector(DrawChannel), v: DrawChannel) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_push_front(self: *Vector(DrawCmd), v: DrawCmd) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_push_front(self: *Vector(DrawIdx), v: DrawIdx) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_push_front(self: *Vector(DrawVert), v: DrawVert) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_push_front(self: *Vector(*Font), v: *Font) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_push_front(self: *Vector(FontAtlasCustomRect), v: FontAtlasCustomRect) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_push_front(self: *Vector(FontConfig), v: FontConfig) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_push_front(self: *Vector(FontGlyph), v: FontGlyph) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_push_front(self: *Vector(StoragePair), v: StoragePair) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_push_front(self: *Vector(TextRange), v: TextRange) callconv(.C) void;
pub extern fn ImVector_ImTextureID_push_front(self: *Vector(TextureID), v: TextureID) callconv(.C) void;
pub extern fn ImVector_ImU32_push_front(self: *Vector(u32), v: u32) callconv(.C) void;
pub extern fn ImVector_ImVec2_push_front(self: *Vector(Vec2), v: Vec2) callconv(.C) void;
pub extern fn ImVector_ImVec4_push_front(self: *Vector(Vec4), v: Vec4) callconv(.C) void;
pub extern fn ImVector_ImWchar_push_front(self: *Vector(Wchar), v: Wchar) callconv(.C) void;
pub extern fn ImVector_char_push_front(self: *Vector(u8), v: u8) callconv(.C) void;
pub extern fn ImVector_float_push_front(self: *Vector(f32), v: f32) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_reserve(self: *Vector(DrawChannel), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_reserve(self: *Vector(DrawCmd), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_reserve(self: *Vector(DrawIdx), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_reserve(self: *Vector(DrawVert), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_reserve(self: *Vector(*Font), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_reserve(self: *Vector(FontAtlasCustomRect), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_reserve(self: *Vector(FontConfig), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_reserve(self: *Vector(FontGlyph), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_reserve(self: *Vector(StoragePair), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_reserve(self: *Vector(TextRange), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImTextureID_reserve(self: *Vector(TextureID), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImU32_reserve(self: *Vector(u32), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImVec2_reserve(self: *Vector(Vec2), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImVec4_reserve(self: *Vector(Vec4), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImWchar_reserve(self: *Vector(Wchar), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_char_reserve(self: *Vector(u8), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_float_reserve(self: *Vector(f32), new_capacity: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_resize(self: *Vector(DrawChannel), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_resize(self: *Vector(DrawCmd), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_resize(self: *Vector(DrawIdx), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_resize(self: *Vector(DrawVert), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_resize(self: *Vector(*Font), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_resize(self: *Vector(FontAtlasCustomRect), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_resize(self: *Vector(FontConfig), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_resize(self: *Vector(FontGlyph), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_resize(self: *Vector(StoragePair), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_resize(self: *Vector(TextRange), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImTextureID_resize(self: *Vector(TextureID), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImU32_resize(self: *Vector(u32), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImVec2_resize(self: *Vector(Vec2), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImVec4_resize(self: *Vector(Vec4), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImWchar_resize(self: *Vector(Wchar), new_size: i32) callconv(.C) void;
pub extern fn ImVector_char_resize(self: *Vector(u8), new_size: i32) callconv(.C) void;
pub extern fn ImVector_float_resize(self: *Vector(f32), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_resizeT(self: *Vector(DrawChannel), new_size: i32, v: DrawChannel) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_resizeT(self: *Vector(DrawCmd), new_size: i32, v: DrawCmd) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_resizeT(self: *Vector(DrawIdx), new_size: i32, v: DrawIdx) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_resizeT(self: *Vector(DrawVert), new_size: i32, v: DrawVert) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_resizeT(self: *Vector(*Font), new_size: i32, v: *Font) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_resizeT(self: *Vector(FontAtlasCustomRect), new_size: i32, v: FontAtlasCustomRect) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_resizeT(self: *Vector(FontConfig), new_size: i32, v: FontConfig) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_resizeT(self: *Vector(FontGlyph), new_size: i32, v: FontGlyph) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_resizeT(self: *Vector(StoragePair), new_size: i32, v: StoragePair) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_resizeT(self: *Vector(TextRange), new_size: i32, v: TextRange) callconv(.C) void;
pub extern fn ImVector_ImTextureID_resizeT(self: *Vector(TextureID), new_size: i32, v: TextureID) callconv(.C) void;
pub extern fn ImVector_ImU32_resizeT(self: *Vector(u32), new_size: i32, v: u32) callconv(.C) void;
pub extern fn ImVector_ImVec2_resizeT(self: *Vector(Vec2), new_size: i32, v: Vec2) callconv(.C) void;
pub extern fn ImVector_ImVec4_resizeT(self: *Vector(Vec4), new_size: i32, v: Vec4) callconv(.C) void;
pub extern fn ImVector_ImWchar_resizeT(self: *Vector(Wchar), new_size: i32, v: Wchar) callconv(.C) void;
pub extern fn ImVector_char_resizeT(self: *Vector(u8), new_size: i32, v: u8) callconv(.C) void;
pub extern fn ImVector_float_resizeT(self: *Vector(f32), new_size: i32, v: f32) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_shrink(self: *Vector(DrawChannel), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_shrink(self: *Vector(DrawCmd), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_shrink(self: *Vector(DrawIdx), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_shrink(self: *Vector(DrawVert), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_shrink(self: *Vector(*Font), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_shrink(self: *Vector(FontAtlasCustomRect), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_shrink(self: *Vector(FontConfig), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_shrink(self: *Vector(FontGlyph), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_shrink(self: *Vector(StoragePair), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_shrink(self: *Vector(TextRange), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImTextureID_shrink(self: *Vector(TextureID), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImU32_shrink(self: *Vector(u32), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImVec2_shrink(self: *Vector(Vec2), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImVec4_shrink(self: *Vector(Vec4), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImWchar_shrink(self: *Vector(Wchar), new_size: i32) callconv(.C) void;
pub extern fn ImVector_char_shrink(self: *Vector(u8), new_size: i32) callconv(.C) void;
pub extern fn ImVector_float_shrink(self: *Vector(f32), new_size: i32) callconv(.C) void;
pub extern fn ImVector_ImDrawChannel_size(self: *const Vector(DrawChannel)) callconv(.C) i32;
pub extern fn ImVector_ImDrawCmd_size(self: *const Vector(DrawCmd)) callconv(.C) i32;
pub extern fn ImVector_ImDrawIdx_size(self: *const Vector(DrawIdx)) callconv(.C) i32;
pub extern fn ImVector_ImDrawVert_size(self: *const Vector(DrawVert)) callconv(.C) i32;
pub extern fn ImVector_ImFontPtr_size(self: *const Vector(*Font)) callconv(.C) i32;
pub extern fn ImVector_ImFontAtlasCustomRect_size(self: *const Vector(FontAtlasCustomRect)) callconv(.C) i32;
pub extern fn ImVector_ImFontConfig_size(self: *const Vector(FontConfig)) callconv(.C) i32;
pub extern fn ImVector_ImFontGlyph_size(self: *const Vector(FontGlyph)) callconv(.C) i32;
pub extern fn ImVector_ImGuiStoragePair_size(self: *const Vector(StoragePair)) callconv(.C) i32;
pub extern fn ImVector_ImGuiTextRange_size(self: *const Vector(TextRange)) callconv(.C) i32;
pub extern fn ImVector_ImTextureID_size(self: *const Vector(TextureID)) callconv(.C) i32;
pub extern fn ImVector_ImU32_size(self: *const Vector(u32)) callconv(.C) i32;
pub extern fn ImVector_ImVec2_size(self: *const Vector(Vec2)) callconv(.C) i32;
pub extern fn ImVector_ImVec4_size(self: *const Vector(Vec4)) callconv(.C) i32;
pub extern fn ImVector_ImWchar_size(self: *const Vector(Wchar)) callconv(.C) i32;
pub extern fn ImVector_char_size(self: *const Vector(u8)) callconv(.C) i32;
pub extern fn ImVector_float_size(self: *const Vector(f32)) callconv(.C) i32;
pub extern fn ImVector_ImDrawChannel_size_in_bytes(self: *const Vector(DrawChannel)) callconv(.C) i32;
pub extern fn ImVector_ImDrawCmd_size_in_bytes(self: *const Vector(DrawCmd)) callconv(.C) i32;
pub extern fn ImVector_ImDrawIdx_size_in_bytes(self: *const Vector(DrawIdx)) callconv(.C) i32;
pub extern fn ImVector_ImDrawVert_size_in_bytes(self: *const Vector(DrawVert)) callconv(.C) i32;
pub extern fn ImVector_ImFontPtr_size_in_bytes(self: *const Vector(*Font)) callconv(.C) i32;
pub extern fn ImVector_ImFontAtlasCustomRect_size_in_bytes(self: *const Vector(FontAtlasCustomRect)) callconv(.C) i32;
pub extern fn ImVector_ImFontConfig_size_in_bytes(self: *const Vector(FontConfig)) callconv(.C) i32;
pub extern fn ImVector_ImFontGlyph_size_in_bytes(self: *const Vector(FontGlyph)) callconv(.C) i32;
pub extern fn ImVector_ImGuiStoragePair_size_in_bytes(self: *const Vector(StoragePair)) callconv(.C) i32;
pub extern fn ImVector_ImGuiTextRange_size_in_bytes(self: *const Vector(TextRange)) callconv(.C) i32;
pub extern fn ImVector_ImTextureID_size_in_bytes(self: *const Vector(TextureID)) callconv(.C) i32;
pub extern fn ImVector_ImU32_size_in_bytes(self: *const Vector(u32)) callconv(.C) i32;
pub extern fn ImVector_ImVec2_size_in_bytes(self: *const Vector(Vec2)) callconv(.C) i32;
pub extern fn ImVector_ImVec4_size_in_bytes(self: *const Vector(Vec4)) callconv(.C) i32;
pub extern fn ImVector_ImWchar_size_in_bytes(self: *const Vector(Wchar)) callconv(.C) i32;
pub extern fn ImVector_char_size_in_bytes(self: *const Vector(u8)) callconv(.C) i32;
pub extern fn ImVector_float_size_in_bytes(self: *const Vector(f32)) callconv(.C) i32;
pub extern fn ImVector_ImDrawChannel_swap(self: *Vector(DrawChannel), rhs: *Vector(DrawChannel)) callconv(.C) void;
pub extern fn ImVector_ImDrawCmd_swap(self: *Vector(DrawCmd), rhs: *Vector(DrawCmd)) callconv(.C) void;
pub extern fn ImVector_ImDrawIdx_swap(self: *Vector(DrawIdx), rhs: *Vector(DrawIdx)) callconv(.C) void;
pub extern fn ImVector_ImDrawVert_swap(self: *Vector(DrawVert), rhs: *Vector(DrawVert)) callconv(.C) void;
pub extern fn ImVector_ImFontPtr_swap(self: *Vector(*Font), rhs: *Vector(*Font)) callconv(.C) void;
pub extern fn ImVector_ImFontAtlasCustomRect_swap(self: *Vector(FontAtlasCustomRect), rhs: *Vector(FontAtlasCustomRect)) callconv(.C) void;
pub extern fn ImVector_ImFontConfig_swap(self: *Vector(FontConfig), rhs: *Vector(FontConfig)) callconv(.C) void;
pub extern fn ImVector_ImFontGlyph_swap(self: *Vector(FontGlyph), rhs: *Vector(FontGlyph)) callconv(.C) void;
pub extern fn ImVector_ImGuiStoragePair_swap(self: *Vector(StoragePair), rhs: *Vector(StoragePair)) callconv(.C) void;
pub extern fn ImVector_ImGuiTextRange_swap(self: *Vector(TextRange), rhs: *Vector(TextRange)) callconv(.C) void;
pub extern fn ImVector_ImTextureID_swap(self: *Vector(TextureID), rhs: *Vector(TextureID)) callconv(.C) void;
pub extern fn ImVector_ImU32_swap(self: *Vector(u32), rhs: *Vector(u32)) callconv(.C) void;
pub extern fn ImVector_ImVec2_swap(self: *Vector(Vec2), rhs: *Vector(Vec2)) callconv(.C) void;
pub extern fn ImVector_ImVec4_swap(self: *Vector(Vec4), rhs: *Vector(Vec4)) callconv(.C) void;
pub extern fn ImVector_ImWchar_swap(self: *Vector(Wchar), rhs: *Vector(Wchar)) callconv(.C) void;
pub extern fn ImVector_char_swap(self: *Vector(u8), rhs: *Vector(u8)) callconv(.C) void;
pub extern fn ImVector_float_swap(self: *Vector(f32), rhs: *Vector(f32)) callconv(.C) void;
pub extern fn igAcceptDragDropPayload(kind: ?[*:0]const u8, flags: DragDropFlagsInt) callconv(.C) ?*const Payload;
pub extern fn igAlignTextToFramePadding() callconv(.C) void;
pub extern fn igArrowButton(str_id: ?[*:0]const u8, dir: Dir) callconv(.C) bool;
pub extern fn igBegin(name: ?[*:0]const u8, p_open: ?*bool, flags: WindowFlagsInt) callconv(.C) bool;
pub extern fn igBeginChildStr(str_id: ?[*:0]const u8, size: Vec2, border: bool, flags: WindowFlagsInt) callconv(.C) bool;
pub extern fn igBeginChildID(id: ID, size: Vec2, border: bool, flags: WindowFlagsInt) callconv(.C) bool;
pub extern fn igBeginChildFrame(id: ID, size: Vec2, flags: WindowFlagsInt) callconv(.C) bool;
pub extern fn igBeginCombo(label: ?[*:0]const u8, preview_value: ?[*:0]const u8, flags: ComboFlagsInt) callconv(.C) bool;
pub extern fn igBeginDragDropSource(flags: DragDropFlagsInt) callconv(.C) bool;
pub extern fn igBeginDragDropTarget() callconv(.C) bool;
pub extern fn igBeginGroup() callconv(.C) void;
pub extern fn igBeginMainMenuBar() callconv(.C) bool;
pub extern fn igBeginMenu(label: ?[*:0]const u8, enabled: bool) callconv(.C) bool;
pub extern fn igBeginMenuBar() callconv(.C) bool;
pub extern fn igBeginPopup(str_id: ?[*:0]const u8, flags: WindowFlagsInt) callconv(.C) bool;
pub extern fn igBeginPopupContextItem(str_id: ?[*:0]const u8, mouse_button: MouseButton) callconv(.C) bool;
pub extern fn igBeginPopupContextVoid(str_id: ?[*:0]const u8, mouse_button: MouseButton) callconv(.C) bool;
pub extern fn igBeginPopupContextWindow(str_id: ?[*:0]const u8, mouse_button: MouseButton, also_over_items: bool) callconv(.C) bool;
pub extern fn igBeginPopupModal(name: ?[*:0]const u8, p_open: ?*bool, flags: WindowFlagsInt) callconv(.C) bool;
pub extern fn igBeginTabBar(str_id: ?[*:0]const u8, flags: TabBarFlagsInt) callconv(.C) bool;
pub extern fn igBeginTabItem(label: ?[*:0]const u8, p_open: ?*bool, flags: TabItemFlagsInt) callconv(.C) bool;
pub extern fn igBeginTooltip() callconv(.C) void;
pub extern fn igBullet() callconv(.C) void;
pub extern fn igBulletText(fmt: ?[*:0]const u8, ...) callconv(.C) void;
pub extern fn igButton(label: ?[*:0]const u8, size: Vec2) callconv(.C) bool;
pub extern fn igCalcItemWidth() callconv(.C) f32;
pub extern fn igCalcListClipping(items_count: i32, items_height: f32, out_items_display_start: *i32, out_items_display_end: *i32) callconv(.C) void;
pub extern fn igCalcTextSize_nonUDT(pOut: *Vec2, text: ?[*]const u8, text_end: ?[*]const u8, hide_text_after_double_hash: bool, wrap_width: f32) callconv(.C) void;
pub extern fn igCaptureKeyboardFromApp(want_capture_keyboard_value: bool) callconv(.C) void;
pub extern fn igCaptureMouseFromApp(want_capture_mouse_value: bool) callconv(.C) void;
pub extern fn igCheckbox(label: ?[*:0]const u8, v: *bool) callconv(.C) bool;
pub extern fn igCheckboxFlags(label: ?[*:0]const u8, flags: ?*u32, flags_value: u32) callconv(.C) bool;
pub extern fn igCloseCurrentPopup() callconv(.C) void;
pub extern fn igCollapsingHeader(label: ?[*:0]const u8, flags: TreeNodeFlagsInt) callconv(.C) bool;
pub extern fn igCollapsingHeaderBoolPtr(label: ?[*:0]const u8, p_open: ?*bool, flags: TreeNodeFlagsInt) callconv(.C) bool;
pub extern fn igColorButton(desc_id: ?[*:0]const u8, col: Vec4, flags: ColorEditFlagsInt, size: Vec2) callconv(.C) bool;
pub extern fn igColorConvertFloat4ToU32(in: Vec4) callconv(.C) u32;
pub extern fn igColorConvertHSVtoRGB(h: f32, s: f32, v: f32, out_r: *f32, out_g: *f32, out_b: *f32) callconv(.C) void;
pub extern fn igColorConvertRGBtoHSV(r: f32, g: f32, b: f32, out_h: *f32, out_s: *f32, out_v: *f32) callconv(.C) void;
pub extern fn igColorConvertU32ToFloat4_nonUDT(pOut: *Vec4, in: u32) callconv(.C) void;
pub extern fn igColorEdit3(label: ?[*:0]const u8, col: *[3]f32, flags: ColorEditFlagsInt) callconv(.C) bool;
pub extern fn igColorEdit4(label: ?[*:0]const u8, col: *[4]f32, flags: ColorEditFlagsInt) callconv(.C) bool;
pub extern fn igColorPicker3(label: ?[*:0]const u8, col: *[3]f32, flags: ColorEditFlagsInt) callconv(.C) bool;
pub extern fn igColorPicker4(label: ?[*:0]const u8, col: *[4]f32, flags: ColorEditFlagsInt, ref_col: ?*const [4]f32) callconv(.C) bool;
pub extern fn igColumns(count: i32, id: ?[*:0]const u8, border: bool) callconv(.C) void;
pub extern fn igCombo(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const [*:0]const u8, items_count: i32, popup_max_height_in_items: i32) callconv(.C) bool;
pub extern fn igComboStr(label: ?[*:0]const u8, current_item: ?*i32, items_separated_by_zeros: ?[*]const u8, popup_max_height_in_items: i32) callconv(.C) bool;
pub extern fn igComboFnPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*c_void, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*c_void, items_count: i32, popup_max_height_in_items: i32) callconv(.C) bool;
pub extern fn igCreateContext(shared_font_atlas: ?*FontAtlas) callconv(.C) ?*Context;
pub extern fn igDebugCheckVersionAndDataLayout(version_str: ?[*:0]const u8, sz_io: usize, sz_style: usize, sz_vec2: usize, sz_vec4: usize, sz_drawvert: usize, sz_drawidx: usize) callconv(.C) bool;
pub extern fn igDestroyContext(ctx: ?*Context) callconv(.C) void;
pub extern fn igDragFloat(label: ?[*:0]const u8, v: *f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igDragFloat2(label: ?[*:0]const u8, v: *[2]f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igDragFloat3(label: ?[*:0]const u8, v: *[3]f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igDragFloat4(label: ?[*:0]const u8, v: *[4]f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igDragFloatRange2(label: ?[*:0]const u8, v_current_min: *f32, v_current_max: *f32, v_speed: f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, format_max: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igDragInt(label: ?[*:0]const u8, v: *i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igDragInt2(label: ?[*:0]const u8, v: *[2]i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igDragInt3(label: ?[*:0]const u8, v: *[3]i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igDragInt4(label: ?[*:0]const u8, v: *[4]i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igDragIntRange2(label: ?[*:0]const u8, v_current_min: *i32, v_current_max: *i32, v_speed: f32, v_min: i32, v_max: i32, format: ?[*:0]const u8, format_max: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igDragScalar(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, v_speed: f32, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igDragScalarN(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, components: i32, v_speed: f32, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igDummy(size: Vec2) callconv(.C) void;
pub extern fn igEnd() callconv(.C) void;
pub extern fn igEndChild() callconv(.C) void;
pub extern fn igEndChildFrame() callconv(.C) void;
pub extern fn igEndCombo() callconv(.C) void;
pub extern fn igEndDragDropSource() callconv(.C) void;
pub extern fn igEndDragDropTarget() callconv(.C) void;
pub extern fn igEndFrame() callconv(.C) void;
pub extern fn igEndGroup() callconv(.C) void;
pub extern fn igEndMainMenuBar() callconv(.C) void;
pub extern fn igEndMenu() callconv(.C) void;
pub extern fn igEndMenuBar() callconv(.C) void;
pub extern fn igEndPopup() callconv(.C) void;
pub extern fn igEndTabBar() callconv(.C) void;
pub extern fn igEndTabItem() callconv(.C) void;
pub extern fn igEndTooltip() callconv(.C) void;
pub extern fn igGetBackgroundDrawList() callconv(.C) ?*DrawList;
pub extern fn igGetClipboardText() callconv(.C) ?[*:0]const u8;
pub extern fn igGetColorU32(idx: Col, alpha_mul: f32) callconv(.C) u32;
pub extern fn igGetColorU32Vec4(col: Vec4) callconv(.C) u32;
pub extern fn igGetColorU32U32(col: u32) callconv(.C) u32;
pub extern fn igGetColumnIndex() callconv(.C) i32;
pub extern fn igGetColumnOffset(column_index: i32) callconv(.C) f32;
pub extern fn igGetColumnWidth(column_index: i32) callconv(.C) f32;
pub extern fn igGetColumnsCount() callconv(.C) i32;
pub extern fn igGetContentRegionAvail_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetContentRegionMax_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetCurrentContext() callconv(.C) ?*Context;
pub extern fn igGetCursorPos_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetCursorPosX() callconv(.C) f32;
pub extern fn igGetCursorPosY() callconv(.C) f32;
pub extern fn igGetCursorScreenPos_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetCursorStartPos_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetDragDropPayload() callconv(.C) ?*const Payload;
pub extern fn igGetDrawData() callconv(.C) *DrawData;
pub extern fn igGetDrawListSharedData() callconv(.C) ?*DrawListSharedData;
pub extern fn igGetFont() callconv(.C) ?*Font;
pub extern fn igGetFontSize() callconv(.C) f32;
pub extern fn igGetFontTexUvWhitePixel_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetForegroundDrawList() callconv(.C) ?*DrawList;
pub extern fn igGetFrameCount() callconv(.C) i32;
pub extern fn igGetFrameHeight() callconv(.C) f32;
pub extern fn igGetFrameHeightWithSpacing() callconv(.C) f32;
pub extern fn igGetIDStr(str_id: ?[*:0]const u8) callconv(.C) ID;
pub extern fn igGetIDRange(str_id_begin: ?[*]const u8, str_id_end: ?[*]const u8) callconv(.C) ID;
pub extern fn igGetIDPtr(ptr_id: ?*const c_void) callconv(.C) ID;
pub extern fn igGetIO() callconv(.C) *IO;
pub extern fn igGetItemRectMax_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetItemRectMin_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetItemRectSize_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetKeyIndex(imgui_key: Key) callconv(.C) i32;
pub extern fn igGetKeyPressedAmount(key_index: i32, repeat_delay: f32, rate: f32) callconv(.C) i32;
pub extern fn igGetMouseCursor() callconv(.C) MouseCursor;
pub extern fn igGetMouseDragDelta_nonUDT(pOut: *Vec2, button: MouseButton, lock_threshold: f32) callconv(.C) void;
pub extern fn igGetMousePos_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetMousePosOnOpeningCurrentPopup_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetScrollMaxX() callconv(.C) f32;
pub extern fn igGetScrollMaxY() callconv(.C) f32;
pub extern fn igGetScrollX() callconv(.C) f32;
pub extern fn igGetScrollY() callconv(.C) f32;
pub extern fn igGetStateStorage() callconv(.C) ?*Storage;
pub extern fn igGetStyle() callconv(.C) ?*Style;
pub extern fn igGetStyleColorName(idx: Col) callconv(.C) ?[*:0]const u8;
pub extern fn igGetStyleColorVec4(idx: Col) callconv(.C) ?*const Vec4;
pub extern fn igGetTextLineHeight() callconv(.C) f32;
pub extern fn igGetTextLineHeightWithSpacing() callconv(.C) f32;
pub extern fn igGetTime() callconv(.C) f64;
pub extern fn igGetTreeNodeToLabelSpacing() callconv(.C) f32;
pub extern fn igGetVersion() callconv(.C) ?[*:0]const u8;
pub extern fn igGetWindowContentRegionMax_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetWindowContentRegionMin_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetWindowContentRegionWidth() callconv(.C) f32;
pub extern fn igGetWindowDrawList() callconv(.C) ?*DrawList;
pub extern fn igGetWindowHeight() callconv(.C) f32;
pub extern fn igGetWindowPos_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetWindowSize_nonUDT(pOut: *Vec2) callconv(.C) void;
pub extern fn igGetWindowWidth() callconv(.C) f32;
pub extern fn igImage(user_texture_id: TextureID, size: Vec2, uv0: Vec2, uv1: Vec2, tint_col: Vec4, border_col: Vec4) callconv(.C) void;
pub extern fn igImageButton(user_texture_id: TextureID, size: Vec2, uv0: Vec2, uv1: Vec2, frame_padding: i32, bg_col: Vec4, tint_col: Vec4) callconv(.C) bool;
pub extern fn igIndent(indent_w: f32) callconv(.C) void;
pub extern fn igInputDouble(label: ?[*:0]const u8, v: *f64, step: f64, step_fast: f64, format: ?[*:0]const u8, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputFloat(label: ?[*:0]const u8, v: *f32, step: f32, step_fast: f32, format: ?[*:0]const u8, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputFloat2(label: ?[*:0]const u8, v: *[2]f32, format: ?[*:0]const u8, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputFloat3(label: ?[*:0]const u8, v: *[3]f32, format: ?[*:0]const u8, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputFloat4(label: ?[*:0]const u8, v: *[4]f32, format: ?[*:0]const u8, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputInt(label: ?[*:0]const u8, v: *i32, step: i32, step_fast: i32, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputInt2(label: ?[*:0]const u8, v: *[2]i32, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputInt3(label: ?[*:0]const u8, v: *[3]i32, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputInt4(label: ?[*:0]const u8, v: *[4]i32, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputScalar(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, p_step: ?*const c_void, p_step_fast: ?*const c_void, format: ?[*:0]const u8, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputScalarN(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, components: i32, p_step: ?*const c_void, p_step_fast: ?*const c_void, format: ?[*:0]const u8, flags: InputTextFlagsInt) callconv(.C) bool;
pub extern fn igInputText(label: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize, flags: InputTextFlagsInt, callback: InputTextCallback, user_data: ?*c_void) callconv(.C) bool;
pub extern fn igInputTextMultiline(label: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize, size: Vec2, flags: InputTextFlagsInt, callback: InputTextCallback, user_data: ?*c_void) callconv(.C) bool;
pub extern fn igInputTextWithHint(label: ?[*:0]const u8, hint: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize, flags: InputTextFlagsInt, callback: InputTextCallback, user_data: ?*c_void) callconv(.C) bool;
pub extern fn igInvisibleButton(str_id: ?[*:0]const u8, size: Vec2) callconv(.C) bool;
pub extern fn igIsAnyItemActive() callconv(.C) bool;
pub extern fn igIsAnyItemFocused() callconv(.C) bool;
pub extern fn igIsAnyItemHovered() callconv(.C) bool;
pub extern fn igIsAnyMouseDown() callconv(.C) bool;
pub extern fn igIsItemActivated() callconv(.C) bool;
pub extern fn igIsItemActive() callconv(.C) bool;
pub extern fn igIsItemClicked(mouse_button: MouseButton) callconv(.C) bool;
pub extern fn igIsItemDeactivated() callconv(.C) bool;
pub extern fn igIsItemDeactivatedAfterEdit() callconv(.C) bool;
pub extern fn igIsItemEdited() callconv(.C) bool;
pub extern fn igIsItemFocused() callconv(.C) bool;
pub extern fn igIsItemHovered(flags: HoveredFlagsInt) callconv(.C) bool;
pub extern fn igIsItemToggledOpen() callconv(.C) bool;
pub extern fn igIsItemVisible() callconv(.C) bool;
pub extern fn igIsKeyDown(user_key_index: i32) callconv(.C) bool;
pub extern fn igIsKeyPressed(user_key_index: i32, repeat: bool) callconv(.C) bool;
pub extern fn igIsKeyReleased(user_key_index: i32) callconv(.C) bool;
pub extern fn igIsMouseClicked(button: MouseButton, repeat: bool) callconv(.C) bool;
pub extern fn igIsMouseDoubleClicked(button: MouseButton) callconv(.C) bool;
pub extern fn igIsMouseDown(button: MouseButton) callconv(.C) bool;
pub extern fn igIsMouseDragging(button: MouseButton, lock_threshold: f32) callconv(.C) bool;
pub extern fn igIsMouseHoveringRect(r_min: Vec2, r_max: Vec2, clip: bool) callconv(.C) bool;
pub extern fn igIsMousePosValid(mouse_pos: ?*const Vec2) callconv(.C) bool;
pub extern fn igIsMouseReleased(button: MouseButton) callconv(.C) bool;
pub extern fn igIsPopupOpen(str_id: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igIsRectVisible(size: Vec2) callconv(.C) bool;
pub extern fn igIsRectVisibleVec2(rect_min: Vec2, rect_max: Vec2) callconv(.C) bool;
pub extern fn igIsWindowAppearing() callconv(.C) bool;
pub extern fn igIsWindowCollapsed() callconv(.C) bool;
pub extern fn igIsWindowFocused(flags: FocusedFlagsInt) callconv(.C) bool;
pub extern fn igIsWindowHovered(flags: HoveredFlagsInt) callconv(.C) bool;
pub extern fn igLabelText(label: ?[*:0]const u8, fmt: ?[*:0]const u8, ...) callconv(.C) void;
pub extern fn igListBoxStr_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const [*:0]const u8, items_count: i32, height_in_items: i32) callconv(.C) bool;
pub extern fn igListBoxFnPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*c_void, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*c_void, items_count: i32, height_in_items: i32) callconv(.C) bool;
pub extern fn igListBoxFooter() callconv(.C) void;
pub extern fn igListBoxHeaderVec2(label: ?[*:0]const u8, size: Vec2) callconv(.C) bool;
pub extern fn igListBoxHeaderInt(label: ?[*:0]const u8, items_count: i32, height_in_items: i32) callconv(.C) bool;
pub extern fn igLoadIniSettingsFromDisk(ini_filename: ?[*:0]const u8) callconv(.C) void;
pub extern fn igLoadIniSettingsFromMemory(ini_data: ?[*]const u8, ini_size: usize) callconv(.C) void;
pub extern fn igLogButtons() callconv(.C) void;
pub extern fn igLogFinish() callconv(.C) void;
pub extern fn igLogText(fmt: ?[*:0]const u8, ...) callconv(.C) void;
pub extern fn igLogToClipboard(auto_open_depth: i32) callconv(.C) void;
pub extern fn igLogToFile(auto_open_depth: i32, filename: ?[*:0]const u8) callconv(.C) void;
pub extern fn igLogToTTY(auto_open_depth: i32) callconv(.C) void;
pub extern fn igMemAlloc(size: usize) callconv(.C) ?*c_void;
pub extern fn igMemFree(ptr: ?*c_void) callconv(.C) void;
pub extern fn igMenuItemBool(label: ?[*:0]const u8, shortcut: ?[*:0]const u8, selected: bool, enabled: bool) callconv(.C) bool;
pub extern fn igMenuItemBoolPtr(label: ?[*:0]const u8, shortcut: ?[*:0]const u8, p_selected: ?*bool, enabled: bool) callconv(.C) bool;
pub extern fn igNewFrame() callconv(.C) void;
pub extern fn igNewLine() callconv(.C) void;
pub extern fn igNextColumn() callconv(.C) void;
pub extern fn igOpenPopup(str_id: ?[*:0]const u8) callconv(.C) void;
pub extern fn igOpenPopupOnItemClick(str_id: ?[*:0]const u8, mouse_button: MouseButton) callconv(.C) bool;
pub extern fn igPlotHistogramFloatPtr(label: ?[*:0]const u8, values: *const f32, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2, stride: i32) callconv(.C) void;
pub extern fn igPlotHistogramFnPtr(label: ?[*:0]const u8, values_getter: ?fn (data: ?*c_void, idx: i32) callconv(.C) f32, data: ?*c_void, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2) callconv(.C) void;
pub extern fn igPlotLines(label: ?[*:0]const u8, values: *const f32, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2, stride: i32) callconv(.C) void;
pub extern fn igPlotLinesFnPtr(label: ?[*:0]const u8, values_getter: ?fn (data: ?*c_void, idx: i32) callconv(.C) f32, data: ?*c_void, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2) callconv(.C) void;
pub extern fn igPopAllowKeyboardFocus() callconv(.C) void;
pub extern fn igPopButtonRepeat() callconv(.C) void;
pub extern fn igPopClipRect() callconv(.C) void;
pub extern fn igPopFont() callconv(.C) void;
pub extern fn igPopID() callconv(.C) void;
pub extern fn igPopItemWidth() callconv(.C) void;
pub extern fn igPopStyleColor(count: i32) callconv(.C) void;
pub extern fn igPopStyleVar(count: i32) callconv(.C) void;
pub extern fn igPopTextWrapPos() callconv(.C) void;
pub extern fn igProgressBar(fraction: f32, size_arg: Vec2, overlay: ?[*:0]const u8) callconv(.C) void;
pub extern fn igPushAllowKeyboardFocus(allow_keyboard_focus: bool) callconv(.C) void;
pub extern fn igPushButtonRepeat(repeat: bool) callconv(.C) void;
pub extern fn igPushClipRect(clip_rect_min: Vec2, clip_rect_max: Vec2, intersect_with_current_clip_rect: bool) callconv(.C) void;
pub extern fn igPushFont(font: ?*Font) callconv(.C) void;
pub extern fn igPushIDStr(str_id: ?[*:0]const u8) callconv(.C) void;
pub extern fn igPushIDRange(str_id_begin: ?[*]const u8, str_id_end: ?[*]const u8) callconv(.C) void;
pub extern fn igPushIDPtr(ptr_id: ?*const c_void) callconv(.C) void;
pub extern fn igPushIDInt(int_id: i32) callconv(.C) void;
pub extern fn igPushItemWidth(item_width: f32) callconv(.C) void;
pub extern fn igPushStyleColorU32(idx: Col, col: u32) callconv(.C) void;
pub extern fn igPushStyleColorVec4(idx: Col, col: Vec4) callconv(.C) void;
pub extern fn igPushStyleVarFloat(idx: StyleVar, val: f32) callconv(.C) void;
pub extern fn igPushStyleVarVec2(idx: StyleVar, val: Vec2) callconv(.C) void;
pub extern fn igPushTextWrapPos(wrap_local_pos_x: f32) callconv(.C) void;
pub extern fn igRadioButtonBool(label: ?[*:0]const u8, active: bool) callconv(.C) bool;
pub extern fn igRadioButtonIntPtr(label: ?[*:0]const u8, v: *i32, v_button: i32) callconv(.C) bool;
pub extern fn igRender() callconv(.C) void;
pub extern fn igResetMouseDragDelta(button: MouseButton) callconv(.C) void;
pub extern fn igSameLine(offset_from_start_x: f32, spacing: f32) callconv(.C) void;
pub extern fn igSaveIniSettingsToDisk(ini_filename: ?[*:0]const u8) callconv(.C) void;
pub extern fn igSaveIniSettingsToMemory(out_ini_size: ?*usize) callconv(.C) ?[*:0]const u8;
pub extern fn igSelectableBool(label: ?[*:0]const u8, selected: bool, flags: SelectableFlagsInt, size: Vec2) callconv(.C) bool;
pub extern fn igSelectableBoolPtr(label: ?[*:0]const u8, p_selected: ?*bool, flags: SelectableFlagsInt, size: Vec2) callconv(.C) bool;
pub extern fn igSeparator() callconv(.C) void;
pub extern fn igSetAllocatorFunctions(alloc_func: ?fn (sz: usize, user_data: ?*c_void) callconv(.C) ?*c_void, free_func: ?fn (ptr: ?*c_void, user_data: ?*c_void) callconv(.C) void, user_data: ?*c_void) callconv(.C) void;
pub extern fn igSetClipboardText(text: ?[*:0]const u8) callconv(.C) void;
pub extern fn igSetColorEditOptions(flags: ColorEditFlagsInt) callconv(.C) void;
pub extern fn igSetColumnOffset(column_index: i32, offset_x: f32) callconv(.C) void;
pub extern fn igSetColumnWidth(column_index: i32, width: f32) callconv(.C) void;
pub extern fn igSetCurrentContext(ctx: ?*Context) callconv(.C) void;
pub extern fn igSetCursorPos(local_pos: Vec2) callconv(.C) void;
pub extern fn igSetCursorPosX(local_x: f32) callconv(.C) void;
pub extern fn igSetCursorPosY(local_y: f32) callconv(.C) void;
pub extern fn igSetCursorScreenPos(pos: Vec2) callconv(.C) void;
pub extern fn igSetDragDropPayload(kind: ?[*:0]const u8, data: ?*const c_void, sz: usize, cond: CondFlagsInt) callconv(.C) bool;
pub extern fn igSetItemAllowOverlap() callconv(.C) void;
pub extern fn igSetItemDefaultFocus() callconv(.C) void;
pub extern fn igSetKeyboardFocusHere(offset: i32) callconv(.C) void;
pub extern fn igSetMouseCursor(cursor_type: MouseCursor) callconv(.C) void;
pub extern fn igSetNextItemOpen(is_open: bool, cond: CondFlagsInt) callconv(.C) void;
pub extern fn igSetNextItemWidth(item_width: f32) callconv(.C) void;
pub extern fn igSetNextWindowBgAlpha(alpha: f32) callconv(.C) void;
pub extern fn igSetNextWindowCollapsed(collapsed: bool, cond: CondFlagsInt) callconv(.C) void;
pub extern fn igSetNextWindowContentSize(size: Vec2) callconv(.C) void;
pub extern fn igSetNextWindowFocus() callconv(.C) void;
pub extern fn igSetNextWindowPos(pos: Vec2, cond: CondFlagsInt, pivot: Vec2) callconv(.C) void;
pub extern fn igSetNextWindowSize(size: Vec2, cond: CondFlagsInt) callconv(.C) void;
pub extern fn igSetNextWindowSizeConstraints(size_min: Vec2, size_max: Vec2, custom_callback: SizeCallback, custom_callback_data: ?*c_void) callconv(.C) void;
pub extern fn igSetScrollFromPosX(local_x: f32, center_x_ratio: f32) callconv(.C) void;
pub extern fn igSetScrollFromPosY(local_y: f32, center_y_ratio: f32) callconv(.C) void;
pub extern fn igSetScrollHereX(center_x_ratio: f32) callconv(.C) void;
pub extern fn igSetScrollHereY(center_y_ratio: f32) callconv(.C) void;
pub extern fn igSetScrollX(scroll_x: f32) callconv(.C) void;
pub extern fn igSetScrollY(scroll_y: f32) callconv(.C) void;
pub extern fn igSetStateStorage(storage: ?*Storage) callconv(.C) void;
pub extern fn igSetTabItemClosed(tab_or_docked_window_label: ?[*:0]const u8) callconv(.C) void;
pub extern fn igSetTooltip(fmt: ?[*:0]const u8, ...) callconv(.C) void;
pub extern fn igSetWindowCollapsedBool(collapsed: bool, cond: CondFlagsInt) callconv(.C) void;
pub extern fn igSetWindowCollapsedStr(name: ?[*:0]const u8, collapsed: bool, cond: CondFlagsInt) callconv(.C) void;
pub extern fn igSetWindowFocus() callconv(.C) void;
pub extern fn igSetWindowFocusStr(name: ?[*:0]const u8) callconv(.C) void;
pub extern fn igSetWindowFontScale(scale: f32) callconv(.C) void;
pub extern fn igSetWindowPosVec2(pos: Vec2, cond: CondFlagsInt) callconv(.C) void;
pub extern fn igSetWindowPosStr(name: ?[*:0]const u8, pos: Vec2, cond: CondFlagsInt) callconv(.C) void;
pub extern fn igSetWindowSizeVec2(size: Vec2, cond: CondFlagsInt) callconv(.C) void;
pub extern fn igSetWindowSizeStr(name: ?[*:0]const u8, size: Vec2, cond: CondFlagsInt) callconv(.C) void;
pub extern fn igShowAboutWindow(p_open: ?*bool) callconv(.C) void;
pub extern fn igShowDemoWindow(p_open: ?*bool) callconv(.C) void;
pub extern fn igShowFontSelector(label: ?[*:0]const u8) callconv(.C) void;
pub extern fn igShowMetricsWindow(p_open: ?*bool) callconv(.C) void;
pub extern fn igShowStyleEditor(ref: ?*Style) callconv(.C) void;
pub extern fn igShowStyleSelector(label: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igShowUserGuide() callconv(.C) void;
pub extern fn igSliderAngle(label: ?[*:0]const u8, v_rad: *f32, v_degrees_min: f32, v_degrees_max: f32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igSliderFloat(label: ?[*:0]const u8, v: *f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igSliderFloat2(label: ?[*:0]const u8, v: *[2]f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igSliderFloat3(label: ?[*:0]const u8, v: *[3]f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igSliderFloat4(label: ?[*:0]const u8, v: *[4]f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igSliderInt(label: ?[*:0]const u8, v: *i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igSliderInt2(label: ?[*:0]const u8, v: *[2]i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igSliderInt3(label: ?[*:0]const u8, v: *[3]i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igSliderInt4(label: ?[*:0]const u8, v: *[4]i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igSliderScalar(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igSliderScalarN(label: ?[*:0]const u8, data_type: DataType, p_data: ?*c_void, components: i32, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igSmallButton(label: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igSpacing() callconv(.C) void;
pub extern fn igStyleColorsClassic(dst: ?*Style) callconv(.C) void;
pub extern fn igStyleColorsDark(dst: ?*Style) callconv(.C) void;
pub extern fn igStyleColorsLight(dst: ?*Style) callconv(.C) void;
pub extern fn igText(fmt: ?[*:0]const u8, ...) callconv(.C) void;
pub extern fn igTextColored(col: Vec4, fmt: ?[*:0]const u8, ...) callconv(.C) void;
pub extern fn igTextDisabled(fmt: ?[*:0]const u8, ...) callconv(.C) void;
pub extern fn igTextUnformatted(text: ?[*]const u8, text_end: ?[*]const u8) callconv(.C) void;
pub extern fn igTextWrapped(fmt: ?[*:0]const u8, ...) callconv(.C) void;
pub extern fn igTreeNodeStr(label: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igTreeNodeStrStr(str_id: ?[*:0]const u8, fmt: ?[*:0]const u8, ...) callconv(.C) bool;
pub extern fn igTreeNodePtr(ptr_id: ?*const c_void, fmt: ?[*:0]const u8, ...) callconv(.C) bool;
pub extern fn igTreeNodeExStr(label: ?[*:0]const u8, flags: TreeNodeFlagsInt) callconv(.C) bool;
pub extern fn igTreeNodeExStrStr(str_id: ?[*:0]const u8, flags: TreeNodeFlagsInt, fmt: ?[*:0]const u8, ...) callconv(.C) bool;
pub extern fn igTreeNodeExPtr(ptr_id: ?*const c_void, flags: TreeNodeFlagsInt, fmt: ?[*:0]const u8, ...) callconv(.C) bool;
pub extern fn igTreePop() callconv(.C) void;
pub extern fn igTreePushStr(str_id: ?[*:0]const u8) callconv(.C) void;
pub extern fn igTreePushPtr(ptr_id: ?*const c_void) callconv(.C) void;
pub extern fn igUnindent(indent_w: f32) callconv(.C) void;
pub extern fn igVSliderFloat(label: ?[*:0]const u8, size: Vec2, v: *f32, v_min: f32, v_max: f32, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igVSliderInt(label: ?[*:0]const u8, size: Vec2, v: *i32, v_min: i32, v_max: i32, format: ?[*:0]const u8) callconv(.C) bool;
pub extern fn igVSliderScalar(label: ?[*:0]const u8, size: Vec2, data_type: DataType, p_data: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void, format: ?[*:0]const u8, power: f32) callconv(.C) bool;
pub extern fn igValueBool(prefix: ?[*:0]const u8, b: bool) callconv(.C) void;
pub extern fn igValueInt(prefix: ?[*:0]const u8, v: i32) callconv(.C) void;
pub extern fn igValueUint(prefix: ?[*:0]const u8, v: u32) callconv(.C) void;
pub extern fn igValueFloat(prefix: ?[*:0]const u8, v: f32, float_format: ?[*:0]const u8) callconv(.C) void;
}; | include/imgui.zig |
const std = @import("std");
const testing = std.testing;
pub const TokenKind = enum {
inline_whitespace,
builtin_id,
user_id,
arg,
newline,
assign_op,
double_quoted_string,
comment,
open_paren,
close_paren,
single_quoted_string,
escape_sequence,
};
pub const token0 = @intToEnum(TokenKind, 0);
const token_count = @typeInfo(TokenKind).Enum.fields.len;
pub fn lexInlineWhitespace(text: [*]const u8, limit: [*]const u8) [*]const u8 {
std.debug.assert(@ptrToInt(limit) > @ptrToInt(text));
var next = text;
while (true) {
if (next[0] != ' ' and next[0] != '\t')
return next;
next += 1;
if (next == limit)
return next;
}
}
// [a-zA-Z0-9_\.]
fn isIdChar(c: u8) bool {
if (c >= 'a') return c <= 'z';
if (c >= 'A') return c <= 'Z' or c == '_';
if (c >= '0') return c <= '9';
return c == '.';
}
// BUILTIN_ID: @[a-zA-Z0-9_\.]+@?
fn lexBuiltinId(text: [*]const u8, limit: [*]const u8) [*]const u8 {
return lexId(text, limit, '@');
}
// USER_ID: \$[a-zA-Z0-9_\.]+\$?
fn lexUserId(text: [*]const u8, limit: [*]const u8) [*]const u8 {
return lexId(text, limit, '$');
}
fn lexId(text: [*]const u8, limit: [*]const u8, delimiter: u8) [*]const u8 {
std.debug.assert(@ptrToInt(limit) > @ptrToInt(text));
if (text[0] != delimiter)
return text;
var next = text + 1;
if (next == limit or !isIdChar(next[0]))
return text;
while (true) {
next += 1;
if (next == limit)
return next;
const c = next[0];
if (c == delimiter)
return next + 1;
if (!isIdChar(c))
return next;
}
}
//ARG: [^ \t\n#()@$"=']+
fn lexArg(text: [*]const u8, limit: [*]const u8) [*]const u8 {
std.debug.assert(@ptrToInt(limit) > @ptrToInt(text));
var next = text;
while (true) {
const c = next[0];
if (
c == '\''
or c == '@'
or c == '='
or c == ')'
or c == '('
or c == '$'
or c == '#'
or c == '"'
or c == ' '
or c == '\t'
or c == '\n'
)
return next;
next += 1;
if (next == limit)
return next;
}
}
fn lexOneChar(text: [*]const u8, limit: [*]const u8, c: u8) [*]const u8 {
std.debug.assert(@ptrToInt(limit) > @ptrToInt(text));
return text + @as(u1, if (text[0] == c) 1 else 0);
}
// DOUBLE_QUOTED_STRING "[^"\n]*"
fn lexDoubleQuotedString(text: [*]const u8, limit: [*]const u8) [*]const u8 {
std.debug.assert(@ptrToInt(limit) > @ptrToInt(text));
if (text[0] != '"')
return text;
var next = text + 1;
while (true) : (next += 1) {
if (next == limit)
return text;
const c = next[0];
if (c == '"')
return next + 1;
if (c == '\n')
return text;
}
}
// COMMENT: #[^\n]*
fn lexComment(text: [*]const u8, limit: [*]const u8) [*]const u8 {
std.debug.assert(@ptrToInt(limit) > @ptrToInt(text));
if (text[0] != '#')
return text;
var next = text + 1;
while (true) : (next += 1) {
if (next == limit)
return next;
if (next[0] == '\n')
return next + 1;
}
}
// SINGLE_QUOTED_STRING1 '[^'\n]+'
// SINGLE_QUOTED_STRING2 ''[^'\n][^\n]*?'''*
// SINGLE_QUOTED_STRING3 '''[^'].*?''''*
// SINGLE_QUOTED_STRING4 ''''[^'].*?'''''*
// SINGLE_QUOTED_STRING5 '''''[^'].*?''''''*
// SINGLE_QUOTED_STRING6 ''''''[^'].*?'''''''*
fn lexSingleQuotedString(text: [*]const u8, limit: [*]const u8) [*]const u8 {
std.debug.assert(@ptrToInt(limit) > @ptrToInt(text));
if (text[0] != '\'')
return text;
var next = text + 1;
while (true) : (next += 1) {
if (next == limit)
return text;
if (next[0] != '\'')
break;
}
const count = @ptrToInt(next) - @ptrToInt(text);
if (count <= 2) {
if (next[0] == '\n')
return text;
}
next += 1;
while (true) {
if (next == limit)
return text;
if (next[0] == '\'') {
var end_count: usize = 1;
while (true) : (end_count += 1) {
next += 1;
if (next == limit or next[0] != '\'') break;
}
if (end_count >= count)
return next;
} else {
if (count <= 2 and next[0] == '\n')
return text;
next += 1;
}
}
}
// ESCAPE_SEQUENCE: @[@#$"')(=]
fn lexEscape(text: [*]const u8, limit: [*]const u8) [*]const u8 {
std.debug.assert(@ptrToInt(limit) > @ptrToInt(text));
if (text[0] == '@') {
const next = text + 1;
if (next != limit) {
const c = next[0];
if ( c == '@'
or c == '#'
or c == '$'
or c == '"'
or c == '\''
or c == '('
or c == ')'
or c == '='
)
return next + 1;
}
}
return text;
}
pub fn lex(text: [*]const u8, limit: [*]const u8, inout_kind: *TokenKind) [*]const u8 {
std.debug.assert(@ptrToInt(limit) > @ptrToInt(text));
var i = @enumToInt(inout_kind.*);
while (i < token_count) : (i += 1) {
const end = switch (@intToEnum(TokenKind, i)) {
.inline_whitespace => lexInlineWhitespace(text, limit),
.builtin_id => lexBuiltinId(text, limit),
.user_id => lexUserId(text, limit),
.arg => lexArg(text, limit),
.newline => lexOneChar(text, limit, '\n'),
.assign_op => lexOneChar(text, limit, '='),
.double_quoted_string => lexDoubleQuotedString(text, limit),
.comment => lexComment(text, limit),
.open_paren => lexOneChar(text, limit, '('),
.close_paren => lexOneChar(text, limit, ')'),
.single_quoted_string => lexSingleQuotedString(text, limit),
.escape_sequence => lexEscape(text, limit),
};
if (@ptrToInt(end) > @ptrToInt(text)) {
inout_kind.* = @intToEnum(TokenKind, i);
return end;
}
}
return text; // no match
}
pub fn assertNoMatchAfter(src: [*]const u8, limit: [*]const u8, kind: TokenKind) void {
const next_kind = @enumToInt(kind) + 1;
if (next_kind < token_count) {
var kind_for_lex = @intToEnum(TokenKind, next_kind);
std.debug.assert(src == lex(src, limit, &kind_for_lex));
}
}
fn testLex(src: []const u8, expected_len: usize, expected_kind: TokenKind) !void {
var kind: TokenKind = @intToEnum(TokenKind, 0);
const end = lex(src.ptr, src.ptr + src.len, &kind);
const len = @ptrToInt(end) - @ptrToInt(src.ptr);
try testing.expectEqual(expected_len, len);
if (len > 0) {
try testing.expectEqual(expected_kind, kind);
assertNoMatchAfter(src.ptr, src.ptr + src.len, kind);
}
}
fn testId(comptime delim: []const u8, kind: TokenKind) !void {
try testLex(delim, 0, @intToEnum(TokenKind, 0));
try testLex(delim ++ "a", 2, kind);
try testLex(delim ++ "a ", 2, kind);
try testLex(delim ++ "abcd ", 5, kind);
try testLex(delim ++ "a" ++ delim ++ "a", 3, kind);
}
test "lex basics" {
try testLex(" ", 1, .inline_whitespace);
try testLex("\t", 1, .inline_whitespace);
try testLex("\t \t \t", 6, .inline_whitespace);
try testLex("\t \t \ta", 6, .inline_whitespace);
try testId("@", .builtin_id);
try testId("$", .user_id);
try testLex("a", 1, .arg);
try testLex("abcd ", 4, .arg);
try testLex("!%&`*+,-./09:;<>?^_`", 20, .arg);
try testLex("\n", 1, .newline);
try testLex("=", 1, .assign_op);
try testLex("\"\"", 2, .double_quoted_string);
try testLex("\"abcd\"", 6, .double_quoted_string);
try testLex("#", 1, .comment);
try testLex("#\n", 2, .comment);
try testLex("#!\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\n", 40, .comment);
try testLex("(", 1, .open_paren);
try testLex(")", 1, .close_paren);
try testLex("''", 0, undefined);
try testLex("'\n'", 0, undefined);
try testLex("''\n''", 0, undefined);
try testLex("'''\n'''", 7, .single_quoted_string);
try testLex("'''\n''''", 8, .single_quoted_string);
try testLex("'a'", 3, .single_quoted_string);
try testLex("''a''", 5, .single_quoted_string);
try testLex("'\"hello\"'", 9, .single_quoted_string);
try testLex("''hello 'there' \"again\"''", 25, .single_quoted_string);
try testLex("@@", 2, .escape_sequence);
try testLex("@#", 2, .escape_sequence);
try testLex("@$", 2, .escape_sequence);
try testLex("@\"", 2, .escape_sequence);
try testLex("@'", 2, .escape_sequence);
try testLex("@(", 2, .escape_sequence);
try testLex("@)", 2, .escape_sequence);
try testLex("@=", 2, .escape_sequence);
}
test "ensure all 1-char strings match single token" {
// verify that all 1-character strings only lex as 1 kind of token
{
var c: u8 = 0;
while (true) : (c += 1) {
const buf = [1]u8 {c};
if (c == '"' or c == '$' or c == '\'' or c == '@') {
try testLex(&buf, 0, undefined);
} else {
try testLex(&buf, 1, switch (c) {
'\t', ' ' => .inline_whitespace,
'\n' => .newline,
'#' => .comment,
'(' => .open_paren,
')' => .close_paren,
'=' => .assign_op,
else => .arg,
});
}
if (c == 255) break;
}
}
// TODO: should we go through all 2 or 3 character strings?
} | src/lex.zig |
pub const Opcode = enum(u8) {
nop = 0x00,
aconst_null = 0x01,
iconst_m1 = 0x02,
iconst_0 = 0x03,
iconst_1 = 0x04,
iconst_2 = 0x05,
iconst_3 = 0x06,
iconst_4 = 0x07,
iconst_5 = 0x08,
lconst_0 = 0x09,
lconst_1 = 0x0a,
fconst_0 = 0x0b,
fconst_1 = 0x0c,
fconst_2 = 0x0d,
dconst_0 = 0x0e,
dconst_1 = 0x0f,
bipush = 0x10,
sipush = 0x11,
ldc = 0x12,
ldc_w = 0x13,
ldc2_w = 0x14,
iload = 0x15,
lload = 0x16,
fload = 0x17,
dload = 0x18,
aload = 0x19,
iload_0 = 0x1a,
iload_1 = 0x1b,
iload_2 = 0x1c,
iload_3 = 0x1d,
lload_0 = 0x1e,
lload_1 = 0x1f,
lload_2 = 0x20,
lload_3 = 0x21,
fload_0 = 0x22,
fload_1 = 0x23,
fload_2 = 0x24,
fload_3 = 0x25,
dload_0 = 0x26,
dload_1 = 0x27,
dload_2 = 0x28,
dload_3 = 0x29,
aload_0 = 0x2a,
aload_1 = 0x2b,
aload_2 = 0x2c,
aload_3 = 0x2d,
iaload = 0x2e,
laload = 0x2f,
faload = 0x30,
daload = 0x31,
aaload = 0x32,
baload = 0x33,
caload = 0x34,
saload = 0x35,
istore = 0x36,
lstore = 0x37,
fstore = 0x38,
dstore = 0x39,
astore = 0x3a,
istore_0 = 0x3b,
istore_1 = 0x3c,
istore_2 = 0x3d,
istore_3 = 0x3e,
lstore_0 = 0x3f,
lstore_1 = 0x40,
lstore_2 = 0x41,
lstore_3 = 0x42,
fstore_0 = 0x43,
fstore_1 = 0x44,
fstore_2 = 0x45,
fstore_3 = 0x46,
dstore_0 = 0x47,
dstore_1 = 0x48,
dstore_2 = 0x49,
dstore_3 = 0x4a,
astore_0 = 0x4b,
astore_1 = 0x4c,
astore_2 = 0x4d,
astore_3 = 0x4e,
iastore = 0x4f,
lastore = 0x50,
fastore = 0x51,
dastore = 0x52,
aastore = 0x53,
bastore = 0x54,
castore = 0x55,
sastore = 0x56,
pop = 0x57,
pop2 = 0x58,
dup = 0x59,
dup_x1 = 0x5a,
dup_x2 = 0x5b,
dup2 = 0x5c,
dup2_x1 = 0x5d,
dup2_x2 = 0x5e,
swap = 0x5f,
iadd = 0x60,
ladd = 0x61,
fadd = 0x62,
dadd = 0x63,
isub = 0x64,
lsub = 0x65,
fsub = 0x66,
dsub = 0x67,
imul = 0x68,
lmul = 0x69,
fmul = 0x6a,
dmul = 0x6b,
idiv = 0x6c,
ldiv = 0x6d,
fdiv = 0x6e,
ddiv = 0x6f,
irem = 0x70,
lrem = 0x71,
frem = 0x72,
drem = 0x73,
ineg = 0x74,
lneg = 0x75,
fneg = 0x76,
dneg = 0x77,
ishl = 0x78,
lshl = 0x79,
ishr = 0x7a,
lshr = 0x7b,
iushr = 0x7c,
lushr = 0x7d,
iand = 0x7e,
land = 0x7f,
ior = 0x80,
lor = 0x81,
ixor = 0x82,
lxor = 0x83,
iinc = 0x84,
i2l = 0x85,
i2f = 0x86,
i2d = 0x87,
l2i = 0x88,
l2f = 0x89,
l2d = 0x8a,
f2i = 0x8b,
f2l = 0x8c,
f2d = 0x8d,
d2i = 0x8e,
d2l = 0x8f,
d2f = 0x90,
i2b = 0x91,
i2c = 0x92,
i2s = 0x93,
lcmp = 0x94,
fcmpl = 0x95,
fcmpg = 0x96,
dcmpl = 0x97,
dcmpg = 0x98,
ifeq = 0x99,
ifne = 0x9a,
iflt = 0x9b,
ifge = 0x9c,
ifgt = 0x9d,
ifle = 0x9e,
if_icmpeq = 0x9f,
if_icmpne = 0xa0,
if_icmplt = 0xa1,
if_icmpge = 0xa2,
if_icmpgt = 0xa3,
if_icmple = 0xa4,
if_acmpeq = 0xa5,
if_acmpne = 0xa6,
goto = 0xa7,
jsr = 0xa8,
ret = 0xa9,
tableswitch = 0xaa,
lookupswitch = 0xab,
ireturn = 0xac,
lreturn = 0xad,
freturn = 0xae,
dreturn = 0xaf,
areturn = 0xb0,
@"return" = 0xb1,
getstatic = 0xb2,
putstatic = 0xb3,
getfield = 0xb4,
putfield = 0xb5,
invokevirtual = 0xb6,
invokespecial = 0xb7,
invokestatic = 0xb8,
invokeinterface = 0xb9,
invokedynamic = 0xba,
new = 0xbb,
newarray = 0xbc,
anewarray = 0xbd,
arraylength = 0xbe,
athrow = 0xbf,
checkcast = 0xc0,
instanceof = 0xc1,
monitorenter = 0xc2,
monitorexit = 0xc3,
wide = 0xc4,
multianewarray = 0xc5,
ifnull = 0xc6,
ifnonnull = 0xc7,
goto_w = 0xc8,
jsr_w = 0xc9,
breakpoint = 0xca,
impdep1 = 0xfe,
impdep2 = 0xff,
pub fn resolve(op: u8) Opcode {
return @intToEnum(Opcode, op);
}
};
pub const LocalIndexOperation = u16; // u16 instead of u8 to account for wide
pub const ConstantPoolRefOperation = u16;
pub const BranchToOffsetOperation = i16;
pub const BranchToOffsetWideOperation = i32;
pub const BipushParams = i8;
pub const SipushParams = i16;
pub const IincParams = struct {
const Self = @This();
index: LocalIndexOperation,
@"const": i16,
};
pub const InvokeDynamicParams = struct {
const Self = @This();
indexbyte1: u8,
indexbyte2: u8,
pad: u16,
pub fn decode(allocator: std.mem.Allocator, reader: anytype) !Self {
_ = allocator;
return Self{
.indexbyte1 = try reader.readByte(),
.indexbyte2 = try reader.readByte(),
.pad = try reader.readIntBig(u16),
};
}
pub fn encode(self: Self, writer: anytype) !void {
try writer.writeByte(self.indexbyte1);
try writer.writeByte(self.indexbyte2);
try writer.writeIntBig(u16, self.pad);
}
};
pub const InvokeInterfaceParams = struct {
const Self = @This();
indexbyte1: u8,
indexbyte2: u8,
count: u8,
pad: u8,
pub fn decode(allocator: std.mem.Allocator, reader: anytype) !Self {
_ = allocator;
return Self{
.indexbyte1 = try reader.readByte(),
.indexbyte2 = try reader.readByte(),
.count = try reader.readByte(),
.pad = try reader.readByte(),
};
}
pub fn encode(self: Self, writer: anytype) !void {
try writer.writeByte(self.indexbyte1);
try writer.writeByte(self.indexbyte2);
try writer.writeByte(self.count);
try writer.writeByte(self.pad);
}
};
pub const LookupPair = struct {
match: i32,
offset: i32,
};
pub const LookupSwitchParams = struct {
const Self = @This();
skipped_bytes: usize,
default_offset: i32,
pairs: []LookupPair,
pub fn decode(allocator: std.mem.Allocator, reader: anytype) !Self {
var skipped_bytes = std.mem.alignForward(reader.context.pos, 4) - reader.context.pos;
try reader.skipBytes(skipped_bytes, .{});
const default_offset = try reader.readIntBig(i32);
const npairs = try reader.readIntBig(i32);
var pairs = try allocator.alloc(LookupPair, @intCast(usize, npairs));
for (pairs) |*pair|
pair.* = LookupPair{
.match = try reader.readIntBig(i32),
.offset = try reader.readIntBig(i32),
};
return Self{
.skipped_bytes = skipped_bytes,
.default_offset = default_offset,
.pairs = pairs,
};
}
pub fn encode(self: Self, writer: anytype) !void {
_ = self;
_ = writer;
// TODO: Encode
}
};
pub const TableSwitchParams = struct {
const Self = @This();
skipped_bytes: usize,
default_offset: i32,
low: i32,
high: i32,
jumps: []i32,
pub fn decode(allocator: std.mem.Allocator, reader: anytype) !Self {
var skipped_bytes = std.mem.alignForward(reader.context.pos, 4) - reader.context.pos;
try reader.skipBytes(skipped_bytes, .{});
const default_offset = try reader.readIntBig(i32);
const low = try reader.readIntBig(i32);
const high = try reader.readIntBig(i32);
var jumps = try allocator.alloc(i32, @intCast(usize, high - low + 1));
for (jumps) |*jump|
jump.* = try reader.readIntBig(i32);
return Self{
.skipped_bytes = skipped_bytes,
.default_offset = default_offset,
.low = low,
.high = high,
.jumps = jumps,
};
}
pub fn encode(self: Self, writer: anytype) !void {
_ = self;
_ = writer;
// TODO: Encode
}
};
pub const MultiANewArrayParams = struct {
const Self = @This();
index: ConstantPoolRefOperation,
dimensions: u8,
pub fn decode(allocator: std.mem.Allocator, reader: anytype) !Self {
_ = allocator;
return Self{
.index = try reader.readIntBig(u16),
.dimensions = try reader.readByte(),
};
}
pub fn encode(self: Self, writer: anytype) !void {
_ = self;
_ = writer;
// TODO: Encode
}
};
pub const NewArrayParams = enum(u8) {
boolean = 4,
char = 5,
float = 6,
double = 7,
byte = 8,
short = 9,
int = 10,
long = 11,
};
pub const Operation = union(Opcode) {
aload: LocalIndexOperation,
anewarray: ConstantPoolRefOperation,
astore: LocalIndexOperation,
bipush: BipushParams,
checkcast: ConstantPoolRefOperation,
dload: LocalIndexOperation,
dstore: LocalIndexOperation,
fload: LocalIndexOperation,
fstore: LocalIndexOperation,
getfield: ConstantPoolRefOperation,
getstatic: ConstantPoolRefOperation,
goto: BranchToOffsetOperation,
if_acmpeq: BranchToOffsetOperation,
if_acmpne: BranchToOffsetOperation,
if_icmpeq: BranchToOffsetOperation,
if_icmpge: BranchToOffsetOperation,
if_icmpgt: BranchToOffsetOperation,
if_icmple: BranchToOffsetOperation,
if_icmplt: BranchToOffsetOperation,
if_icmpne: BranchToOffsetOperation,
ifeq: BranchToOffsetOperation,
ifge: BranchToOffsetOperation,
ifgt: BranchToOffsetOperation,
ifle: BranchToOffsetOperation,
iflt: BranchToOffsetOperation,
ifne: BranchToOffsetOperation,
ifnonnull: BranchToOffsetOperation,
ifnull: BranchToOffsetOperation,
jsr: BranchToOffsetOperation,
goto_w: BranchToOffsetWideOperation,
jsr_w: BranchToOffsetWideOperation,
iinc: IincParams,
iload: LocalIndexOperation,
instanceof: ConstantPoolRefOperation,
invokedynamic: InvokeDynamicParams,
invokeinterface: InvokeInterfaceParams,
invokespecial: ConstantPoolRefOperation,
invokestatic: ConstantPoolRefOperation,
invokevirtual: ConstantPoolRefOperation,
istore: LocalIndexOperation,
ldc: u8, // NOTE: This is not a local variable! It's probably for compat
ldc_w: ConstantPoolRefOperation,
ldc2_w: ConstantPoolRefOperation,
lookupswitch: LookupSwitchParams,
tableswitch: TableSwitchParams,
new: ConstantPoolRefOperation,
multianewarray: MultiANewArrayParams,
lload: LocalIndexOperation,
lstore: LocalIndexOperation,
sipush: SipushParams,
putstatic: ConstantPoolRefOperation,
putfield: ConstantPoolRefOperation,
newarray: NewArrayParams,
nop: void,
aconst_null: void,
iconst_m1: void,
iconst_0: void,
iconst_1: void,
iconst_2: void,
iconst_3: void,
iconst_4: void,
iconst_5: void,
lconst_0: void,
lconst_1: void,
fconst_0: void,
fconst_1: void,
fconst_2: void,
dconst_0: void,
dconst_1: void,
iload_0: void,
iload_1: void,
iload_2: void,
iload_3: void,
lload_0: void,
lload_1: void,
lload_2: void,
lload_3: void,
fload_0: void,
fload_1: void,
fload_2: void,
fload_3: void,
dload_0: void,
dload_1: void,
dload_2: void,
dload_3: void,
aload_0: void,
aload_1: void,
aload_2: void,
aload_3: void,
iaload: void,
laload: void,
faload: void,
daload: void,
aaload: void,
baload: void,
caload: void,
saload: void,
istore_0: void,
istore_1: void,
istore_2: void,
istore_3: void,
lstore_0: void,
lstore_1: void,
lstore_2: void,
lstore_3: void,
fstore_0: void,
fstore_1: void,
fstore_2: void,
fstore_3: void,
dstore_0: void,
dstore_1: void,
dstore_2: void,
dstore_3: void,
astore_0: void,
astore_1: void,
astore_2: void,
astore_3: void,
iastore: void,
lastore: void,
fastore: void,
dastore: void,
aastore: void,
bastore: void,
castore: void,
sastore: void,
pop: void,
pop2: void,
dup: void,
dup_x1: void,
dup_x2: void,
dup2: void,
dup2_x1: void,
dup2_x2: void,
swap: void,
iadd: void,
ladd: void,
fadd: void,
dadd: void,
isub: void,
lsub: void,
fsub: void,
dsub: void,
imul: void,
lmul: void,
fmul: void,
dmul: void,
idiv: void,
ldiv: void,
fdiv: void,
ddiv: void,
irem: void,
lrem: void,
frem: void,
drem: void,
ineg: void,
lneg: void,
fneg: void,
dneg: void,
ishl: void,
lshl: void,
ishr: void,
lshr: void,
iushr: void,
lushr: void,
iand: void,
land: void,
ior: void,
lor: void,
ixor: void,
lxor: void,
i2l: void,
i2f: void,
i2d: void,
l2i: void,
l2f: void,
l2d: void,
f2i: void,
f2l: void,
f2d: void,
d2i: void,
d2l: void,
d2f: void,
i2b: void,
i2c: void,
i2s: void,
lcmp: void,
fcmpl: void,
fcmpg: void,
dcmpl: void,
dcmpg: void,
ret: void,
ireturn: void,
lreturn: void,
freturn: void,
dreturn: void,
areturn: void,
@"return": void,
arraylength: void,
athrow: void,
monitorenter: void,
monitorexit: void,
wide: void,
breakpoint: void,
impdep1: void,
impdep2: void,
pub fn sizeOf(self: Operation) usize {
inline for (std.meta.fields(Operation)) |op| {
if (@enumToInt(std.meta.stringToEnum(Opcode, op.name).?) == @enumToInt(self)) {
return 1 + if (op.field_type == void) 0 else @sizeOf(op.field_type);
}
}
unreachable;
}
// TODO: Implement wide iirc
const widenable = &[_]Opcode{
.iload,
.fload,
.aload,
.lload,
.dload,
.istore,
.fstore,
.astore,
.lstore,
.dstore,
};
pub fn decode(allocator: std.mem.Allocator, reader: anytype) !Operation {
var opcode = try reader.readIntBig(u8);
if (opcode == @enumToInt(Opcode.wide)) {
var widened_opcode = try reader.readIntBig(u8);
if (widened_opcode == @enumToInt(Opcode.iinc)) {
return Operation{ .iinc = .{ .index = try reader.readIntBig(u16), .@"const" = try reader.readIntBig(i16) } };
}
inline for (widenable) |op| {
if (@enumToInt(op) == widened_opcode) {
return @unionInit(Operation, @tagName(op), try reader.readIntBig(u16));
}
}
} else {
if (opcode == @enumToInt(Opcode.iinc)) {
return Operation{ .iinc = .{ .index = try reader.readIntBig(u8), .@"const" = try reader.readIntBig(i8) } };
}
inline for (widenable) |op| {
if (@enumToInt(op) == opcode) {
return @unionInit(Operation, @tagName(op), try reader.readIntBig(u8));
}
}
inline for (std.meta.fields(Operation)) |op| {
if (@enumToInt(std.meta.stringToEnum(Opcode, op.name).?) == opcode) {
return @unionInit(Operation, op.name, if (op.field_type == void) {} else if (@typeInfo(op.field_type) == .Struct) z: {
break :z if (@hasDecl(op.field_type, "decode")) try @field(op.field_type, "decode")(allocator, reader) else unreachable;
} else if (@typeInfo(op.field_type) == .Enum) try reader.readEnum(op.field_type, .Big) else if (@typeInfo(op.field_type) == .Int) try reader.readIntBig(op.field_type) else unreachable);
}
}
}
unreachable;
}
pub fn encode(self: Operation, writer: anytype) !void {
if (self == .iinc) {
var iinc = self.iinc;
if (iinc.index > std.math.maxInt(u8) or iinc.@"const" > std.math.maxInt(i8) or iinc.@"const" < std.math.minInt(i8)) {
try writer.writeByte(@enumToInt(Opcode.wide));
try writer.writeByte(@enumToInt(Opcode.iinc));
try writer.writeIntBig(u16, iinc.index);
try writer.writeIntBig(i16, iinc.@"const");
return;
} else {
try writer.writeByte(@enumToInt(Opcode.iinc));
try writer.writeByte(@intCast(u8, iinc.index));
try writer.writeIntBig(i8, @intCast(i8, iinc.@"const"));
return;
}
}
inline for (widenable) |op| {
if (@enumToInt(op) == @enumToInt(self)) {
var v = @field(self, @tagName(op));
if (v > std.math.maxInt(u8)) {
try writer.writeByte(@enumToInt(Opcode.wide));
try writer.writeByte(@enumToInt(self));
try writer.writeIntBig(u16, v);
return;
} else {
try writer.writeByte(@enumToInt(self));
try writer.writeIntBig(u8, @intCast(u8, v));
return;
}
}
}
try writer.writeByte(@enumToInt(self));
inline for (std.meta.fields(Operation)) |op| {
if (@enumToInt(std.meta.stringToEnum(Opcode, op.name).?) == @enumToInt(self)) {
switch (op.field_type) {
void => {},
else => switch (@typeInfo(op.field_type)) {
.Struct => if (@hasDecl(op.field_type, "encode")) try @field(@field(self, op.name), "encode")(writer) else unreachable,
.Enum => try writer.writeIntBig(@typeInfo(op.field_type).Enum.tag_type, @enumToInt(@field(self, op.name))),
.Int => try writer.writeIntBig(op.field_type, @field(self, op.name)),
else => unreachable,
},
}
}
}
}
};
const std = @import("std");
/// Get the index specified by an operation, if possible
pub fn getIndex(inst: anytype) u16 {
if (!@hasField(@TypeOf(inst), "indexbyte1")) @compileError("This instruction does not have an index!");
return @intCast(u16, @field(inst, "indexbyte1")) << @intCast(u16, 8) | @intCast(u16, @field(inst, "indexbyte2"));
}
test "Decode and encode opcodes including wides" {
const ClassFile = @import("../ClassFile.zig");
const harness = @import("../../test/harness.zig");
var reader = harness.wide.fbs().reader();
var cf = try ClassFile.decode(std.testing.allocator, reader);
defer cf.deinit();
for (cf.methods.items) |method| {
if (std.mem.eql(u8, "main", method.getName().bytes)) {
for (method.attributes.items) |attr| {
if (attr == .code) {
var final = try std.testing.allocator.alloc(u8, attr.code.code.items.len);
defer std.testing.allocator.free(final);
var fbs = std.io.fixedBufferStream(attr.code.code.items);
var final_fbs = std.io.fixedBufferStream(final);
while (true) {
var op = try Operation.decode(std.testing.allocator, fbs.reader());
try op.encode(final_fbs.writer());
if (op == .@"return") break;
}
try std.testing.expectEqualSlices(u8, attr.code.code.items, final);
}
}
}
}
} | src/bytecode/ops.zig |
const sf = struct {
pub usingnamespace @import("../sfml.zig");
pub usingnamespace sf.network;
};
const SocketSelector = @This();
// Constructor/destructor
/// Creates a new socket selector
pub fn create() SocketSelector {
var sock = sf.c.sfSocketSelector_create();
if (sock) |s| {
return SocketSelector{ ._ptr = s };
} else
return sf.Error.nullptrUnknownReason;
}
/// Destroys this socket selector
pub fn destroy(self: *SocketSelector) void {
sf.c.sfSocketSelector_destroy(self._ptr);
}
/// Copies this socket selector
pub fn copy(self: SocketSelector) SocketSelector {
var sock = sf.c.sfSocketSelector_copy(self._ptr);
if (sock) |s| {
return SocketSelector{ ._ptr = s };
} else
return sf.Error.nullptrUnknownReason;
}
// Methods
/// Adds a socket to the selector
pub fn addSocket(self: *SocketSelector, socket: anytype) void {
switch (@TypeOf(socket)) {
sf.UdpSocket => sf.c.sfSocketSelector_addUdpSocket(self._ptr, socket._ptr),
sf.TcpSocket => sf.c.sfSocketSelector_addTcpSocket(self._ptr, socket._ptr),
sf.TcpListener => sf.c.sfSocketSelector_addTcpListener(self._ptr, socket._ptr),
else => @compileError("Socket has to be a tcp socket, tcp listener or udp socket")
}
}
/// Removes a socket from the selector
pub fn removeSocket(self: *SocketSelector, socket: anytype) void {
switch (@TypeOf(socket)) {
sf.UdpSocket => sf.c.sfSocketSelector_removeUdpSocket(self._ptr, socket._ptr),
sf.TcpSocket => sf.c.sfSocketSelector_removeTcpSocket(self._ptr, socket._ptr),
sf.TcpListener => sf.c.sfSocketSelector_removeTcpListener(self._ptr, socket._ptr),
else => @compileError("Socket has to be a tcp socket, tcp listener or udp socket")
}
}
/// Removes all sockets from the selector
pub fn clear(self: *SocketSelector) void {
sf.c.sfSocketSelector_clear(self._ptr);
}
/// Wait until one of the sockets is ready to receive something (or timeout)
/// Returns true if one of the sockets is ready and false if timeout
pub fn wait(self: SocketSelector, timeout: sf.system.Time) bool {
const time = timeout orelse sf.system.Time{ .us = 0 };
const ret = sf.c.sfSocketSelector_wait(self._ptr, time._toCSFML());
return ret != 0;
}
/// Checks one socket to know if it's ready to read data
pub fn isSocketReady(self: SocketSelector, socket: anytype) bool {
switch (@TypeOf(socket)) {
sf.UdpSocket => sf.c.sfSocketSelector_isUdpSocketReady(self._ptr, socket._ptr),
sf.TcpSocket => sf.c.sfSocketSelector_isTcpSocketReady(self._ptr, socket._ptr),
sf.TcpListener => sf.c.sfSocketSelector_isTcpListenerReady(self._ptr, socket._ptr),
else => @compileError("Socket has to be a tcp socket, tcp listener or udp socket")
}
}
/// Pointer to the csfml structure
_ptr: *sf.c.sfSocketSelector, | src/sfml/network/SocketSelector.zig |
const std = @import("std");
const fs = std.fs;
const mem = std.mem;
const os = std.os;
const testing = std.testing;
const aur = @import("aur.zig");
const color = @import("color.zig");
const curl = @import("curl.zig");
const Pkgbuild = @import("pkgbuild.zig").Pkgbuild;
const Version = @import("version.zig").Version;
pub const Package = struct {
const Self = @This();
base_name: ?[]const u8 = null,
version: []const u8,
aur_version: ?[]const u8 = null,
requires_update: bool = false,
// allocator.create does not respect default values so safeguard via an init() call
pub fn init(allocator: mem.Allocator, version: []const u8) !*Self {
var new_pkg = try allocator.create(Self);
new_pkg.base_name = null;
new_pkg.version = version;
new_pkg.aur_version = null;
new_pkg.requires_update = false;
return new_pkg;
}
};
// TODO: maybe handle <pkg>-git packages like yay
pub const Pacman = struct {
const Self = @This();
allocator: mem.Allocator,
pkgs: std.StringHashMap(*Package),
aur_resp: ?aur.RPCRespV5,
pacman_output: ?[]u8,
zur_path: []const u8,
zur_pkg_dir: []const u8,
updates: usize = 0,
stdin_has_input: bool = false,
pub fn init(allocator: mem.Allocator) !Self {
const home = os.getenv("HOME") orelse return error.NoHomeEnvVarFound;
const zur_dir = ".zur";
const zur_path = try fs.path.join(allocator, &[_][]const u8{ home, zur_dir });
const pkg_dir = try fs.path.join(allocator, &[_][]const u8{ zur_path, ".pkg" });
try fs.cwd().makePath(pkg_dir);
return Self{
.allocator = allocator,
.pkgs = std.StringHashMap(*Package).init(allocator),
.zur_path = zur_path,
.zur_pkg_dir = pkg_dir,
.aur_resp = null,
.pacman_output = null,
.updates = 0,
.stdin_has_input = false,
};
}
// TODO: use libalpm once this issue is fixed:
// https://github.com/ziglang/zig/issues/1499
pub fn fetchLocalPackages(self: *Self) !void {
if (self.pkgs.count() != 0) {
return error.BadInitialPkgsState;
}
const result = try std.ChildProcess.exec(.{
.allocator = self.allocator,
.argv = &[_][]const u8{ "pacman", "-Qm" },
});
self.pacman_output = result.stdout;
var lines = mem.split(u8, result.stdout, "\n");
while (lines.next()) |line| {
// ignore empty lines if they exist
if (line.len <= 1) {
continue;
}
var line_iter = mem.split(u8, line, " ");
const name = line_iter.next() orelse return error.UnknownPacmanQmOutputFormat;
const version = line_iter.next() orelse return error.UnknownPacmanQmOutputFormat;
var new_pkg = try Package.init(self.allocator, version);
try self.pkgs.putNoClobber(name, new_pkg);
}
}
pub fn setInstallPackages(self: *Self, pkg_list: std.ArrayList([]const u8)) !void {
if (self.pkgs.count() != 0) {
return error.BadInitialPkgsState;
}
for (pkg_list.items) |pkg_name| {
// This is the hack:
// We're setting an impossible version to initialize the packages to install.
var new_pkg = try Package.init(self.allocator, "0-0");
try self.pkgs.putNoClobber(pkg_name, new_pkg);
}
}
pub fn fetchRemoteAurVersions(self: *Self) !void {
self.aur_resp = try aur.queryAll(self.allocator, self.pkgs);
if (self.aur_resp.?.resultcount == 0) {
return error.ZeroResultsFromAurQuery;
}
for (self.aur_resp.?.results) |result| {
var curr_pkg = self.pkgs.get(result.Name).?;
curr_pkg.aur_version = result.Version;
// Only store Package.base_name if the name doesn't match base name.
// We use the null state to see if they defer.
// TODO: Actually, PKGBUILDs with multiple pkgnames' install multiple packages;
// zur currently duplicates these package installs because of this.
if (!mem.eql(u8, result.Name, result.PackageBase)) {
curr_pkg.base_name = result.PackageBase;
}
}
}
// TODO: maybe use libalpm once this issue is fixed:
// https://github.com/ziglang/zig/issues/1499
pub fn compareVersions(self: *Self) !void {
var pkgs_iter = self.pkgs.iterator();
while (pkgs_iter.next()) |pkg| {
const local_version = try Version.init(pkg.value_ptr.*.version);
if (pkg.value_ptr.*.aur_version == null) {
print("{s}warning:{s} {s}{s}{s} was orphaned or non-existant in AUR, skipping\n", .{
color.BoldForegroundYellow,
color.Reset,
color.Bold,
pkg.key_ptr.*,
color.Reset,
});
continue;
}
const remote_version = try Version.init(pkg.value_ptr.*.aur_version.?);
if (local_version.olderThan(remote_version)) {
pkg.value_ptr.*.requires_update = true;
self.updates += 1;
}
}
if (self.updates == 0) {
return;
}
pkgs_iter = self.pkgs.iterator();
print("{s}::{s} Packages to be installed or updated:\n", .{ color.BoldForegroundBlue, color.Reset });
while (pkgs_iter.next()) |pkg| {
if (pkg.value_ptr.*.requires_update) {
print(" {s}\n", .{pkg.key_ptr.*});
}
}
}
pub fn processOutOfDate(self: *Self) !void {
if (self.updates == 0) {
print("{s}::{s} {s}All AUR packages are up-to-date.{s}\n", .{
color.BoldForegroundBlue,
color.Reset,
color.Bold,
color.Reset,
});
return;
}
try fs.cwd().makePath(self.zur_path);
var pkgs_iter = self.pkgs.iterator();
while (pkgs_iter.next()) |pkg| {
if (pkg.value_ptr.*.requires_update) {
if (try self.localPackageExists(pkg.key_ptr.*, pkg.value_ptr.*.aur_version.?)) {
print("{s}warning:{s} Found existing up-to-date package: {s}{s}-{s}{s}, deferring to pacman -U...\n", .{
color.BoldForegroundYellow,
color.Reset,
color.Bold,
pkg.key_ptr.*,
pkg.value_ptr.*.aur_version.?,
color.Reset,
});
try self.installExistingPackage(pkg.key_ptr.*, pkg.value_ptr.*);
return;
}
// The install hack is bleeding into here.
if (!mem.eql(u8, pkg.value_ptr.*.version, "0-0")) {
print("{s}::{s} Updating {s}{s}{s}: {s}{s}{s} -> {s}{s}{s}\n", .{
color.BoldForegroundBlue,
color.Reset,
color.Bold,
pkg.key_ptr.*,
color.Reset,
color.ForegroundRed,
pkg.value_ptr.*.version,
color.Reset,
color.ForegroundGreen,
pkg.value_ptr.*.aur_version.?,
color.Reset,
});
} else {
print("{s}::{s} Installing {s}{s}{s} {s}{s}{s}\n", .{
color.BoldForegroundBlue,
color.Reset,
color.Bold,
pkg.key_ptr.*,
color.Reset,
color.ForegroundGreen,
pkg.value_ptr.*.aur_version.?,
color.Reset,
});
}
try self.downloadAndExtractPackage(pkg.key_ptr.*, pkg.value_ptr.*);
try self.compareUpdateAndInstall(pkg.key_ptr.*, pkg.value_ptr.*);
}
}
}
fn localPackageExists(self: *Self, pkg_name: []const u8, new_ver: []const u8) !bool {
// TODO: Handle "any" arch package names.
const full_pkg_name = try mem.join(self.allocator, "-", &[_][]const u8{ pkg_name, new_ver, "x86_64.pkg.tar.zst" });
// TODO: maybe we want to be like yay and also find some VCS info to do this correctly.
// For -git packages, we need to force zur to always install because we don't know if there's been an update or not.
var dir = try fs.openDirAbsolute(self.zur_pkg_dir, .{ .access_sub_paths = false, .iterate = true, .no_follow = true });
var dir_iter = dir.iterate();
while (try dir_iter.next()) |node| {
if (mem.eql(u8, node.name, full_pkg_name) and !mem.containsAtLeast(u8, node.name, 1, "-git")) {
return true;
}
}
return false;
}
fn downloadAndExtractPackage(self: *Self, pkg_name: []const u8, pkg: *Package) !void {
const file_name = try mem.join(self.allocator, ".", &[_][]const u8{ pkg_name, "tar.gz" });
const dir_name = try mem.join(self.allocator, "-", &[_][]const u8{ pkg_name, pkg.aur_version.? });
const full_dir = try fs.path.join(self.allocator, &[_][]const u8{ self.zur_path, dir_name });
const full_file_path = try fs.path.join(self.allocator, &[_][]const u8{ full_dir, file_name });
// TODO: There must be a more idiomatic way of doing this
var url: [:0]const u8 = undefined;
if (pkg.base_name) |base_name| {
const name = try mem.join(self.allocator, ".", &[_][]const u8{ base_name, "tar.gz" });
url = try mem.joinZ(self.allocator, "/", &[_][]const u8{ aur.Snapshot, name });
} else {
url = try mem.joinZ(self.allocator, "/", &[_][]const u8{ aur.Snapshot, file_name });
}
// This is not perfect (not robust against manual changes), but it's sufficient for it's purpose (short-circuiting)
var dir = fs.cwd().openDir(full_dir, .{}) catch |err| switch (err) {
error.FileNotFound => null,
else => unreachable,
};
if (dir != null) {
dir.?.close();
print(" skipping download, {s}{s}{s} already exists...\n", .{ color.Bold, full_dir, color.Reset });
return;
}
print(" downloading from: {s}{s}{s}\n", .{ color.Bold, url, color.Reset });
const snapshot = try curl.get(self.allocator, url);
print(" downloaded to: {s}{s}{s}\n", .{ color.Bold, full_file_path, color.Reset });
try fs.cwd().makePath(full_dir);
const snapshot_file = try fs.cwd().createFile(full_file_path, .{});
defer snapshot_file.close();
try snapshot_file.writeAll(snapshot.items);
try self.extractPackage(full_dir, pkg_name);
return;
}
// TODO: Maybe one day if there's and easy way to extract tar.gz archives in Zig (be it stdlib or 3rd party), we can replace this.
fn extractPackage(self: *Self, snapshot_path: []const u8, pkg_name: []const u8) !void {
const file_name = try mem.join(self.allocator, ".", &[_][]const u8{ pkg_name, "tar.gz" });
const file_path = try fs.path.join(self.allocator, &[_][]const u8{ snapshot_path, file_name });
_ = try std.ChildProcess.exec(.{
.allocator = self.allocator,
.argv = &[_][]const u8{ "tar", "-xf", file_path, "-C", snapshot_path, "--strip-components=1" },
});
try fs.cwd().deleteFile(file_path);
}
fn compareUpdateAndInstall(self: *Self, pkg_name: []const u8, pkg: *Package) !void {
var old_files_maybe = try self.snapshotFiles(pkg_name, pkg.version);
if (old_files_maybe == null) {
// We have no older version in stored in the filesystem.
// Fallback to just installing
return self.bareInstall(pkg_name, pkg);
}
var old_files = old_files_maybe.?;
var new_files_maybe = try self.snapshotFiles(pkg_name, pkg.aur_version.?);
var new_files = new_files_maybe.?;
var old_pkgbuild = Pkgbuild.init(self.allocator, old_files.get("PKGBUILD").?);
try old_pkgbuild.readLines();
var new_pkgbuild = Pkgbuild.init(self.allocator, new_files.get("PKGBUILD").?);
try new_pkgbuild.readLines();
var at_least_one_diff = false;
try new_pkgbuild.comparePrev(old_pkgbuild);
try new_pkgbuild.indentValues(2);
var new_pkgbuild_iter = new_pkgbuild.fields.iterator();
while (new_pkgbuild_iter.next()) |field| {
if (field.value_ptr.*.updated) {
at_least_one_diff = true;
print("{s}::{s} {s}{s}{s} was updated: {s}\n", .{
color.BoldForegroundBlue,
color.Reset,
color.Bold,
field.key_ptr.*,
color.Reset,
field.value_ptr.*.value,
});
}
}
var new_iter = new_files.iterator();
while (new_iter.next()) |file| {
if (mem.endsWith(u8, file.key_ptr.*, ".install") or mem.endsWith(u8, file.key_ptr.*, ".sh")) {
const old_content_maybe = old_files.get(file.key_ptr.*);
const new_content_maybe = new_files.get(file.key_ptr.*);
if (old_content_maybe == null or new_content_maybe == null) {
// TODO: print something!
continue;
}
const old_content = old_content_maybe.?;
const new_content = new_content_maybe.?;
if (!mem.eql(u8, old_content, new_content)) {
at_least_one_diff = true;
// TODO: would be cool to show a real diff here
print("{s}::{s} {s}{s}{s} was updated:\n{s}\n", .{
color.BoldForegroundBlue,
color.Reset,
color.Bold,
file.key_ptr.*,
color.Reset,
// new_files.get(file.key).?,
self.printDiff(old_content, new_content),
});
}
}
}
if (at_least_one_diff) {
print("\nContinue? [Y/n]: ", .{});
const input = try self.stdinReadByte();
if (input != 'y' and input != 'Y') {
return;
} else {
try self.stdinClearByte();
print("\n", .{});
}
} else {
print("{s}::{s} No meaningful diff's found\n", .{ color.ForegroundBlue, color.Reset });
}
try self.install(pkg_name, pkg);
}
fn printDiff(self: *Self, old: []const u8, new: []const u8) !void {
var old_stream = std.io.fixedBufferStream(old).reader();
var new_stream = std.io.fixedBufferStream(new).reader();
while (true) {
const old_line_maybe = try old_stream.readUntilDelimiterOrEofAlloc(self.allocator, '\n', 4096);
const old_line = if (old_line_maybe == null) break else old_line_maybe.?;
if (old_line.len == 0) break;
const new_line_maybe = try new_stream.readUntilDelimiterOrEofAlloc(self.allocator, '\n', 4096);
const new_line = if (new_line_maybe == null) break else new_line_maybe.?;
if (new_line.len == 0) break;
// if (!mem.eql(u8, old_line, new_line)) {
std.debug.print("line: {s} {s}\n", .{ old_line, new_line });
// }
}
}
// TODO: handle recursively installing dependencies from AUR
// 0. Parse the dep list from .SRCINFO
// 1. We need a strategy to split official/AUR deps
// 2. Install official deps
// 3. Install AUR deps
// 4. Then install the package
fn bareInstall(self: *Self, pkg_name: []const u8, pkg: *Package) !void {
// TODO: Rethink the optional here.
var pkg_files = try self.snapshotFiles(pkg_name, pkg.aur_version.?);
var pkg_files_iter = pkg_files.?.iterator();
while (pkg_files_iter.next()) |pkg_file| {
if (mem.eql(u8, pkg_file.key_ptr.*, "PKGBUILD")) {
var pkgbuild = Pkgbuild.init(self.allocator, pkg_file.value_ptr.*);
try pkgbuild.readLines();
const format = "\n{s}::{s} File: {s}PKGBUILD{s} {s}===================={s}\n";
print(format, .{
color.BoldForegroundBlue,
color.Reset,
color.Bold,
color.Reset,
color.BoldForegroundBlue,
color.Reset,
});
try pkgbuild.indentValues(2);
var fields_iter = pkgbuild.fields.iterator();
while (fields_iter.next()) |field| {
if (!mem.containsAtLeast(u8, field.key_ptr.*, 1, "()")) continue;
print(" {s} {s}\n", .{ field.key_ptr.*, field.value_ptr.*.value });
}
} else {
const format = "\n{s}::{s} File: {s}{s}{s} {s}===================={s}\n{s}";
print(format, .{
color.BoldForegroundBlue,
color.Reset,
color.Bold,
pkg_file.key_ptr.*,
color.Reset,
color.BoldForegroundBlue,
color.Reset,
pkg_file.value_ptr.*,
});
}
}
print("Install? [Y/n]: ", .{});
const input = try self.stdinReadByte();
if (input == 'y' or input == 'Y') {
try self.install(pkg_name, pkg);
} else {
print("\n", .{});
try self.stdinClearByte();
}
}
fn install(self: *Self, pkg_name: []const u8, pkg: *Package) !void {
const pkg_dir = try mem.join(self.allocator, "-", &[_][]const u8{ pkg_name, pkg.aur_version.? });
const full_pkg_dir = try fs.path.join(self.allocator, &[_][]const u8{ self.zur_path, pkg_dir });
try os.chdir(full_pkg_dir);
const argv = &[_][]const u8{ "makepkg", "-sicC" };
try self.execCommand(argv);
try self.removeStaleArtifacts(pkg_name, self.zur_pkg_dir);
try self.moveBuiltPackages(pkg_name, pkg);
}
fn installExistingPackage(self: *Self, pkg_name: []const u8, pkg: *Package) !void {
try os.chdir(self.zur_pkg_dir);
// TODO: Dynamically get the right arch
const full_pkg_name = try mem.join(self.allocator, "-", &[_][]const u8{ pkg_name, pkg.aur_version.?, "x86_64.pkg.tar.zst" });
const argv = &[_][]const u8{ "sudo", "pacman", "-U", full_pkg_name };
try self.execCommand(argv);
}
fn execCommand(self: *Self, argv: []const []const u8) !void {
const runner = try std.ChildProcess.init(argv, self.allocator);
try self.stdinClearByte();
runner.stdin = std.io.getStdIn();
runner.stdout = std.io.getStdOut();
runner.stdin_behavior = std.ChildProcess.StdIo.Inherit;
runner.stdout_behavior = std.ChildProcess.StdIo.Inherit;
// TODO: Ctrl+c from a [sudo] prompt causes some weird output behavior.
// I probably need signal handling for this to properly work.
// TODO: We also need some additional cleanup steps if it fails.
_ = try runner.spawnAndWait();
}
fn moveBuiltPackages(self: *Self, pkg_name: []const u8, pkg: *Package) !void {
const pkg_dir = try mem.join(self.allocator, "-", &[_][]const u8{ pkg_name, pkg.aur_version.? });
const full_pkg_dir = try fs.path.join(self.allocator, &[_][]const u8{ self.zur_path, pkg_dir });
var dir = fs.openDirAbsolute(full_pkg_dir, .{ .access_sub_paths = false, .iterate = true, .no_follow = true }) catch |err| switch (err) {
error.FileNotFound => return,
else => unreachable,
};
defer dir.close();
var dir_iter = dir.iterate();
while (try dir_iter.next()) |node| {
if (!mem.containsAtLeast(u8, node.name, 1, ".pkg.tar.zst")) {
continue;
}
const full_old_name = try fs.path.join(self.allocator, &[_][]const u8{ full_pkg_dir, node.name });
const full_new_name = try fs.path.join(self.allocator, &[_][]const u8{ self.zur_pkg_dir, node.name });
try fs.cwd().rename(full_old_name, full_new_name);
}
try self.removeStaleArtifacts(pkg_name, self.zur_path);
}
fn removeStaleArtifacts(self: *Self, pkg_name: []const u8, dir_path: []const u8) !void {
var dir = fs.openDirAbsolute(dir_path, .{ .access_sub_paths = false, .iterate = true, .no_follow = true }) catch |err| switch (err) {
error.FileNotFound => return,
else => unreachable,
};
defer dir.close();
// TODO: Implement better method to sorting these files by mtime.
var list = std.ArrayList(i128).init(self.allocator);
var map = std.AutoHashMap(i128, []const u8).init(self.allocator);
var dir_iter = dir.iterate();
while (try dir_iter.next()) |node| {
// TODO: This is broken if the package name is a substring of another.
if (!mem.containsAtLeast(u8, node.name, 1, pkg_name)) {
continue;
}
const path = try fs.path.join(self.allocator, &[_][]const u8{ dir_path, node.name });
var f = try fs.openFileAbsolute(path, .{});
defer f.close();
const stat = try f.stat();
try map.putNoClobber(stat.mtime, path);
try list.append(stat.mtime);
}
// Keep the last 3 installed versions of the package.
if (list.items.len > 3) {
const asc_i128 = comptime std.sort.asc(i128);
std.sort.sort(i128, list.items, {}, asc_i128);
const marked_for_removal = list.items[0 .. list.items.len - 3];
for (marked_for_removal) |mtime| {
const file_name = map.get(mtime).?;
try fs.deleteTreeAbsolute(file_name);
print(" {s}->{s} deleting stale file or dir: {s}\n", .{
color.ForegroundBlue,
color.Reset,
file_name,
});
}
}
}
fn snapshotFiles(self: *Self, pkg_name: []const u8, pkg_version: []const u8) !?std.StringHashMap([]u8) {
const dir_name = try mem.join(self.allocator, "-", &[_][]const u8{ pkg_name, pkg_version });
const path = try fs.path.join(self.allocator, &[_][]const u8{ self.zur_path, dir_name });
var dir = fs.openDirAbsolute(path, .{ .access_sub_paths = false, .iterate = true, .no_follow = true }) catch |err| switch (err) {
error.FileNotFound => return null,
else => unreachable,
};
defer dir.close();
print(" reading files in {s}{s}{s}\n", .{ color.Bold, path, color.Reset });
var files_map = std.StringHashMap([]u8).init(self.allocator);
var dir_iter = dir.iterate();
while (try dir_iter.next()) |node| {
if (mem.eql(u8, node.name, ".SRCINFO")) {
continue;
}
if (mem.eql(u8, node.name, ".gitignore")) {
continue;
}
if (mem.containsAtLeast(u8, node.name, 1, ".tar.")) {
continue;
}
if (node.kind != fs.File.Kind.File) {
continue;
}
// TODO: The arbitrary 4096 byte file size limit is _probably_ fine here.
// No one is going to want to read a novel before installing.
var file_contents = dir.readFileAlloc(self.allocator, node.name, 4096) catch |err| switch (err) {
error.FileTooBig => {
print(" {s}->{s} skipping diff for large file: {s}{s}{s}\n", .{
color.ForegroundBlue,
color.Reset,
color.Bold,
node.name,
color.Reset,
});
continue;
},
else => unreachable,
};
// PKGBUILD's have their own indent logic
if (!mem.eql(u8, node.name, "PKGBUILD")) {
var buf = std.ArrayList(u8).init(self.allocator);
var lines_iter = mem.split(u8, file_contents, "\n");
while (lines_iter.next()) |line| {
try buf.appendSlice(" ");
try buf.appendSlice(line);
try buf.append('\n');
}
var copyName = try self.allocator.alloc(u8, node.name.len);
mem.copy(u8, copyName, node.name);
try files_map.putNoClobber(copyName, buf.toOwnedSlice());
} else {
var copyName = try self.allocator.alloc(u8, node.name.len);
mem.copy(u8, copyName, node.name);
try files_map.putNoClobber(copyName, file_contents);
}
}
return files_map;
}
fn stdinReadByte(self: *Self) !u8 {
var stdin = std.io.getStdIn();
const input = try stdin.reader().readByte();
self.stdin_has_input = true;
return input;
}
// We want to "eat" a character so that it doesn't get exposed to the child process.
// TODO: There's likely a more correct way to handle this.
fn stdinClearByte(self: *Self) !void {
if (!self.stdin_has_input) {
return;
}
var stdin = std.io.getStdIn();
_ = try stdin.reader().readBytesNoEof(1);
self.stdin_has_input = false;
}
};
pub fn search(allocator: std.mem.Allocator, pkg: []const u8) !void {
var pacman = try Pacman.init(allocator);
try pacman.fetchLocalPackages();
const installed = color.BoldForegroundCyan ++ "[Installed]" ++ color.Reset;
const resp = try aur.search(allocator, pkg);
for (resp.results) |result| {
const installed_text = if (pacman.pkgs.get(result.Name) == null) "" else installed;
print("{s}aur/{s}{s}{s}{s} {s}{s}{s} {s} ({d})\n {s}\n", .{
color.BoldForegroundMagenta,
color.Reset,
color.Bold,
result.Name,
color.Reset,
color.BoldForegroundGreen,
result.Version,
color.Reset,
installed_text,
result.Popularity,
result.Description,
});
}
}
fn print(comptime format: []const u8, args: anytype) void {
var stdout_writer = std.io.getStdOut().writer();
std.fmt.format(stdout_writer, format, args) catch unreachable;
} | src/pacman.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const gui = @import("gui");
const nvg = @import("nanovg");
const geometry = @import("gui/geometry.zig");
const Point = geometry.Point;
const Rect = geometry.Rect;
const EditorWidget = @import("EditorWidget.zig");
const NewDocumentWidget = @This();
widget: gui.Widget,
allocator: Allocator,
editor_widget: *EditorWidget,
width_label: *gui.Label,
width_spinner: *gui.Spinner(i32),
height_label: *gui.Label,
height_spinner: *gui.Spinner(i32),
color_label: *gui.Label,
indexed_radio: *gui.RadioButton,
truecolor_radio: *gui.RadioButton,
ok_button: *gui.Button,
cancel_button: *gui.Button,
onSelectedFn: ?fn (*Self) void = null,
const Self = @This();
pub fn init(allocator: Allocator, editor_widget: *EditorWidget) !*Self {
const rect = Rect(f32).make(0, 0, 240, 100);
var self = try allocator.create(Self);
self.* = Self{
.widget = gui.Widget.init(allocator, rect),
.allocator = allocator,
.editor_widget = editor_widget,
.width_label = try gui.Label.init(allocator, Rect(f32).make(10, 10, 45, 20), "Width:"),
.width_spinner = try gui.Spinner(i32).init(allocator, Rect(f32).make(55, 10, 60, 20)),
.height_label = try gui.Label.init(allocator, Rect(f32).make(125, 10, 45, 20), "Height:"),
.height_spinner = try gui.Spinner(i32).init(allocator, Rect(f32).make(170, 10, 60, 20)),
.color_label = try gui.Label.init(allocator, Rect(f32).make(10, 35, 45, 20), "Color:"),
.indexed_radio = try gui.RadioButton.init(allocator, Rect(f32).make(55, 35, 95, 20), "Indexed (8-bit)"),
.truecolor_radio = try gui.RadioButton.init(allocator, Rect(f32).make(160 - 3, 35, 70 + 3, 20), "True color"),
.ok_button = try gui.Button.init(allocator, Rect(f32).make(rect.w - 160 - 10 - 10, rect.h - 25 - 10, 80, 25), "OK"),
.cancel_button = try gui.Button.init(allocator, Rect(f32).make(rect.w - 80 - 10, rect.h - 25 - 10, 80, 25), "Cancel"),
};
self.widget.onKeyDownFn = onKeyDown;
self.width_spinner.setValue(@intCast(i32, editor_widget.document.getWidth()));
self.height_spinner.setValue(@intCast(i32, editor_widget.document.getHeight()));
self.width_spinner.min_value = 1;
self.height_spinner.min_value = 1;
self.width_spinner.max_value = 1 << 14; // 16k
self.height_spinner.max_value = 1 << 14;
self.truecolor_radio.checked = true;
self.truecolor_radio.onClickFn = onTruecolorRadioClick;
self.indexed_radio.onClickFn = onIndexedRadioClick;
self.ok_button.onClickFn = onOkButtonClick;
self.cancel_button.onClickFn = onCancelButtonClick;
try self.widget.addChild(&self.width_label.widget);
try self.widget.addChild(&self.width_spinner.widget);
try self.widget.addChild(&self.height_label.widget);
try self.widget.addChild(&self.height_spinner.widget);
try self.widget.addChild(&self.color_label.widget);
try self.widget.addChild(&self.indexed_radio.widget);
try self.widget.addChild(&self.truecolor_radio.widget);
try self.widget.addChild(&self.ok_button.widget);
try self.widget.addChild(&self.cancel_button.widget);
self.widget.drawFn = draw;
return self;
}
pub fn deinit(self: *Self) void {
self.width_label.deinit();
self.width_spinner.deinit();
self.height_label.deinit();
self.height_spinner.deinit();
self.color_label.deinit();
self.indexed_radio.deinit();
self.truecolor_radio.deinit();
self.ok_button.deinit();
self.cancel_button.deinit();
self.widget.deinit();
self.allocator.destroy(self);
}
fn onKeyDown(widget: *gui.Widget, event: *gui.KeyEvent) void {
var self = @fieldParentPtr(Self, "widget", widget);
switch (event.key) {
.Return => self.accept(),
.Escape => self.cancel(),
else => event.event.ignore(),
}
}
fn onIndexedRadioClick(radio: *gui.RadioButton) void {
if (radio.widget.parent) |parent| {
var self = @fieldParentPtr(Self, "widget", parent);
self.indexed_radio.checked = true;
self.truecolor_radio.checked = false;
}
}
fn onTruecolorRadioClick(radio: *gui.RadioButton) void {
if (radio.widget.parent) |parent| {
var self = @fieldParentPtr(Self, "widget", parent);
self.indexed_radio.checked = false;
self.truecolor_radio.checked = true;
}
}
fn onOkButtonClick(button: *gui.Button) void {
if (button.widget.parent) |parent| {
var self = @fieldParentPtr(Self, "widget", parent);
self.accept();
}
}
fn onCancelButtonClick(button: *gui.Button) void {
if (button.widget.parent) |parent| {
var self = @fieldParentPtr(Self, "widget", parent);
self.cancel();
}
}
fn accept(self: *Self) void {
self.editor_widget.createNewDocument(
@intCast(u32, self.width_spinner.value),
@intCast(u32, self.height_spinner.value),
if (self.truecolor_radio.checked) .color else .indexed,
) catch {
// TODO: error dialog
};
if (self.widget.getWindow()) |window| {
window.close();
}
}
fn cancel(self: *Self) void {
if (self.widget.getWindow()) |window| {
window.close();
}
}
pub fn draw(widget: *gui.Widget, vg: nvg) void {
const rect = widget.relative_rect;
gui.drawPanel(vg, rect.x, rect.y, rect.w, rect.h, 1, false, false);
widget.drawChildren(vg);
} | src/NewDocumentWidget.zig |
//--------------------------------------------------------------------------------
// Section: Types (1)
//--------------------------------------------------------------------------------
pub const UAL_DATA_BLOB = extern struct {
Size: u32,
RoleGuid: Guid,
TenantId: Guid,
Address: SOCKADDR_STORAGE,
UserName: [260]u16,
};
//--------------------------------------------------------------------------------
// Section: Functions (4)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows8.0'
pub extern "ualapi" fn UalStart(
Data: ?*UAL_DATA_BLOB,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "ualapi" fn UalStop(
Data: ?*UAL_DATA_BLOB,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "ualapi" fn UalInstrument(
Data: ?*UAL_DATA_BLOB,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "ualapi" fn UalRegisterProduct(
wszProductName: ?[*:0]const u16,
wszRoleName: ?[*:0]const u16,
wszGuid: ?[*:0]const u16,
) 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 (4)
//--------------------------------------------------------------------------------
const Guid = @import("../zig.zig").Guid;
const HRESULT = @import("../foundation.zig").HRESULT;
const PWSTR = @import("../foundation.zig").PWSTR;
const SOCKADDR_STORAGE = @import("../networking/win_sock.zig").SOCKADDR_STORAGE;
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/user_access_logging.zig |
const std = @import("std");
const zupnp = @import("zupnp");
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const logger = std.log.scoped(.Website);
pub fn main() !void {
var lib = try zupnp.ZUPnP.init(std.heap.page_allocator, .{});
defer lib.deinit();
lib.server.static_root_dir = "static";
_ = try lib.server.createEndpoint(Guestbook, .{ .allocator = std.heap.page_allocator }, "/guestbook");
try lib.server.start();
while (true) {
std.time.sleep(1_000_000);
}
}
const Guestbook = struct {
const Config = struct {
allocator: Allocator,
};
const Entry = struct {
timestamp: i64 = undefined,
name: []const u8,
message: []const u8,
};
arena: ArenaAllocator,
entries: std.ArrayList(Entry),
pub fn prepare(self: *Guestbook, config: Config) !void {
self.arena = ArenaAllocator.init(config.allocator);
self.entries = std.ArrayList(Entry).init(self.arena.allocator());
}
pub fn deinit(self: *Guestbook) void {
self.arena.deinit();
}
pub fn get(self: *Guestbook, request: *const zupnp.web.ServerGetRequest) zupnp.web.ServerResponse {
var buf = std.ArrayList(u8).init(request.allocator);
std.json.stringify(self.entries.items, .{}, buf.writer()) catch |e| {
logger.warn("{s}", .{e});
return zupnp.web.ServerResponse.forbidden();
};
return zupnp.web.ServerResponse.contents(.{ .contents = buf.toOwnedSlice(), .content_type = "application/json" });
}
pub fn post(self: *Guestbook, request: *const zupnp.web.ServerPostRequest) bool {
logger.debug("{s}", .{request.contents});
var token_stream = std.json.TokenStream.init(request.contents);
var entry = std.json.parse(Entry, &token_stream, .{ .allocator = self.arena.allocator() }) catch |e| {
logger.warn("{s}", .{e});
return false;
};
entry.timestamp = std.time.milliTimestamp();
self.entries.insert(0, entry) catch return false;
return true;
}
}; | samples/website/src/main.zig |
const std = @import("std");
const tests = @import("tests.zig");
const fs = std.fs;
const io = std.io;
const mem = std.mem;
const log = std.log;
const fmt = std.fmt;
const TokenIterator = mem.TokenIterator;
const stdout = &io.getStdOut().writer();
const READ_BUF_SIZE: u16 = 4096;
// Total 1GB 500MB 300MB 200MB 3MB/s 0 3MB/s 0 1MB/s
// v v ^
// NAME RSS Anon File Shmem vRSS vAnon vFile vShmem dirty
// filefox 10MB 3MB 3MB 4MB 1MB/s 670KB/s 300KB/s 0 30KB/s
//
const ProgrammMap = std.StringHashMap(ProgrammStats);
const OutputBuffer = std.ArrayList(u8);
const Programm = struct {
count: u32 = 0,
rss: u64 = 0,
anon: ?u64 = null,
file: ?u64 = null,
shmem: ?u64 = null,
};
const ProgrammStats = struct {
iteration: u32 = 0,
curr: Programm,
prev: Programm,
};
fn orderEntry(_: void, lhs: ProgrammMap.Entry, rhs: ProgrammMap.Entry) bool {
return lhs.value_ptr.curr.rss > rhs.value_ptr.curr.rss;
}
fn formatOptionalSize(sizeOptional: ?u64) [10]u8 {
var buf: [10]u8 = (" " ** 10).*;
if (sizeOptional) |size| {
_ = fmt.bufPrint(&buf, "{: <10.1}", .{fmt.fmtIntSizeBin(size * 1024)}) catch {
return "overflow! ".*;
};
return buf;
}
return "N/A ".*;
}
const PSM = struct {
alloc: *mem.Allocator,
topN: u32 = 25,
iteration: u32 = 0,
total: Programm,
programms: ProgrammMap,
_keys: std.BufMap,
_obsolete: std.BufSet,
_entries: std.ArrayList(ProgrammMap.Entry),
out: OutputBuffer,
fn init(allocator: *mem.Allocator) PSM {
return PSM{
.alloc = allocator,
.total = Programm{},
.programms = ProgrammMap.init(allocator),
._keys = std.BufMap.init(allocator),
._obsolete = std.BufSet.init(allocator),
._entries = std.ArrayList(ProgrammMap.Entry).init(allocator),
.out = OutputBuffer.init(allocator),
};
}
fn addProcess(self: *PSM, pid: u32) anyerror!void {
var linkBuf: [1024]u8 = undefined;
const name = try self.resolveProgrammName(pid, &linkBuf);
const prog = try self.readSmapsRollup(pid);
if (self._keys.get(name) == null) {
try self._keys.put(name, name);
}
const get_or_put = try self.programms.getOrPut(self._keys.get(name).?);
const v = get_or_put.value_ptr;
if (!get_or_put.found_existing) {
v.curr = Programm{};
v.prev = Programm{};
}
v.curr.count += 1;
v.curr.rss += prog.rss;
self.total.rss += prog.rss;
if (prog.anon) |m| {
v.curr.anon = m + (v.curr.anon orelse 0);
self.total.anon = m + (self.total.anon orelse 0);
}
if (prog.file) |m| {
v.curr.file = m + (v.curr.file orelse 0);
self.total.file = m + (self.total.file orelse 0);
}
if (prog.shmem) |m| {
v.curr.shmem = m + (v.curr.shmem orelse 0);
self.total.shmem = m + (self.total.shmem orelse 0);
}
// and set iteration
v.iteration = self.iteration;
}
fn resolveProgrammName(_: *PSM, pid: u32, linkBuf: []u8) ![]u8 {
var buf: [20]u8 = undefined;
const path = try fmt.bufPrint(&buf, "/proc/{d}/exe", .{pid});
var link = try std.os.readlink(path, linkBuf);
if (mem.lastIndexOfScalar(u8, link, '/')) |index| {
link = link[index + 1 ..];
}
if (link.len > 10 and mem.eql(u8, link[link.len - 10 ..], " (deleted)")) {
link = link[0 .. link.len - 10];
}
return link;
}
fn readSmapsRollup(self: *PSM, pid: u32) !Programm {
var buf: [29]u8 = undefined;
const path = try fmt.bufPrint(&buf, "/proc/{d}/smaps_rollup", .{pid});
const opts = fs.File.OpenFlags{ .read = true };
const file = try fs.openFileAbsolute(path, opts);
defer file.close();
var buffer: [READ_BUF_SIZE]u8 = undefined;
const size = try file.readAll(&buffer);
if (size == 0) return error.UnexpectedEof;
const start = mem.indexOf(u8, &buffer, "Pss:");
if (start == null) return error.UnexpectedEof;
var bufferPssSlice = buffer[start.? + 4 ..];
var p = Programm{};
var iter = mem.tokenize(u8, bufferPssSlice, "\n ");
p.rss = try self.parseNextTokenAsU64(&iter);
self.assertNextSmapsField(&iter, "kB");
if (iter.next()) |token| {
if (mem.eql(u8, token, "Pss_Anon:")) {
p.anon = try self.parseNextTokenAsU64(&iter);
self.assertNextSmapsField(&iter, "kB");
self.assertNextSmapsField(&iter, "Pss_File:");
p.file = try self.parseNextTokenAsU64(&iter);
self.assertNextSmapsField(&iter, "kB");
self.assertNextSmapsField(&iter, "Pss_Shmem:");
p.shmem = try self.parseNextTokenAsU64(&iter);
self.assertNextSmapsField(&iter, "kB");
}
}
return p;
}
fn assertNextSmapsField(_: *PSM, iter: *TokenIterator(u8), field: []const u8) void {
const nextField = iter.next().?;
if (!mem.eql(u8, nextField, field)) {
log.err("expected '{s}', buf found '{s}'", .{ field, nextField });
unreachable;
}
}
fn parseNextTokenAsU64(_: *PSM, iter: *TokenIterator(u8)) !u64 {
if (iter.next()) |token| {
return try fmt.parseInt(u64, token, 10);
}
return error.UnexpectedEof;
}
fn collectStats(self: *PSM) !void {
const opts = fs.Dir.OpenDirOptions{ .access_sub_paths = true, .iterate = true };
var dir = try fs.openDirAbsolute("/proc/", opts);
defer dir.close();
var iter = dir.iterate();
while (try iter.next()) |entry| {
if (!(entry.kind == .Directory)) continue;
const pid = fmt.parseInt(u32, entry.name, 10) catch continue;
self.addProcess(pid) catch |err| {
switch (err) {
error.OpenError => continue,
error.FileNotFound => continue,
error.InvalidCharacter => continue,
error.UnexpectedEof => continue,
error.AccessDenied => continue,
else => |e| return e,
}
};
}
}
fn rotateStats(self: *PSM) void {
self.total = Programm{};
self.iteration += 1;
var programmsIterator = self.programms.valueIterator();
while (programmsIterator.next()) |v| {
v.prev = v.curr;
v.curr = Programm{};
}
}
fn aggregateStats(self: *PSM) anyerror!void {
self._obsolete.hash_map.clearRetainingCapacity();
try self._entries.resize(0);
var programmsIterator = self.programms.iterator();
while (programmsIterator.next()) |entry| {
if (self.iteration != entry.value_ptr.iteration) {
try self._obsolete.insert(entry.key_ptr.*);
} else {
try self._entries.append(entry);
}
}
std.sort.sort(ProgrammMap.Entry, self._entries.items, {}, orderEntry);
var iter = self._obsolete.iterator();
while (iter.next()) |key| {
_ = self.programms.remove(key.*);
self._keys.remove(key.*);
}
}
fn printStats(self: *PSM) !void {
try self.out.writer().print(
"{d: <20} {s: <5} {s: <10} {s: <10} {s: <10} {s: <10}\n",
.{
std.time.timestamp(),
"total",
formatOptionalSize(self.total.rss),
formatOptionalSize(self.total.anon),
formatOptionalSize(self.total.file),
formatOptionalSize(self.total.shmem),
},
);
try self.out.writer().print(
"{s: <20} {s: <5} {s: <10} {s: <10} {s: <10} {s: <10}\n",
.{ "NAME", "COUNT", "RSS", "ANON", "FILE", "SHMEM" },
);
const nameLen = 18;
const n = std.math.min(self.topN, self._entries.items.len);
var idx: usize = 0;
while (idx < n) : (idx += 1) {
const v = self._entries.items[idx].value_ptr.curr;
const k = self._entries.items[idx].key_ptr.*;
const nameEnd = std.math.min(k.len, nameLen);
const nameEndChar: u8 = if (k.len > (nameEnd + 1)) '~' else ' ';
var nameBuf: [nameLen + 1]u8 = undefined;
const name = try fmt.bufPrint(
&nameBuf,
"{s}{c}",
.{ k[0..nameEnd], nameEndChar },
);
try self.out.writer().print(
"{s: <20} {d: <5} {s: <10.1} {s: <10} {s: <10} {s: <10}\n",
.{
name,
v.count,
formatOptionalSize(v.rss),
formatOptionalSize(v.anon),
formatOptionalSize(v.file),
formatOptionalSize(v.shmem),
},
);
}
try stdout.writeAll(self.out.items);
try self.out.resize(0);
}
fn cleanupScreen(self: *PSM) !void {
const escape = "\x1b";
const cursorUp = escape ++ "[1A";
const clearLine = escape ++ "[2K\r";
const cursorUpAndClearLine = cursorUp ++ clearLine;
var n: i64 = self.topN + 1; // +1 -> total
while (n >= 0) : (n -= 1) {
_ = try self.out.writer().writeAll(cursorUpAndClearLine);
}
}
fn deinit(self: *PSM) void {
self.programms.deinit();
self._keys.deinit();
self._obsolete.deinit();
self._entries.deinit();
self.out.deinit();
}
};
pub fn main() !void {
tests.codebaseOwnership();
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer {
const leaked = gpa.deinit();
if (leaked) unreachable;
}
var psm = PSM.init(&gpa.allocator);
defer psm.deinit();
while (true) {
psm.rotateStats();
try psm.collectStats();
try psm.aggregateStats();
if (psm.iteration > 1) {
try psm.cleanupScreen();
}
try psm.printStats();
std.time.sleep(5 * std.time.ns_per_s);
}
} | src/main.zig |
const std = @import("std");
pub const bits = struct {
pub const fd_t = u32;
pub const uid_t = void;
pub const gid_t = void;
pub const mode_t = usize;
pub const timespec = struct {
tv_sec: u32,
tv_nsec: u32,
};
pub const STDOUT_FILENO = 1;
pub const STDERR_FILENO = 2;
// errors
pub const EPERM = 1;
/// No such file or directory
pub const ENOENT = 2;
/// No such process
pub const ESRCH = 3;
/// Interrupted system call
pub const EINTR = 4;
/// I/O error
pub const EIO = 5;
/// No such device or address
pub const ENXIO = 6;
/// Arg list too long
pub const E2BIG = 7;
/// Exec format error
pub const ENOEXEC = 8;
/// Bad file number
pub const EBADF = 9;
/// No child processes
pub const ECHILD = 10;
/// Try again
pub const EAGAIN = 11;
/// Out of memory
pub const ENOMEM = 12;
/// Permission denied
pub const EACCES = 13;
/// Bad address
pub const EFAULT = 14;
/// Block device required
pub const ENOTBLK = 15;
/// Device or resource busy
pub const EBUSY = 16;
/// File exists
pub const EEXIST = 17;
/// Cross-device link
pub const EXDEV = 18;
/// No such device
pub const ENODEV = 19;
/// Not a directory
pub const ENOTDIR = 20;
/// Is a directory
pub const EISDIR = 21;
/// Invalid argument
pub const EINVAL = 22;
/// File table overflow
pub const ENFILE = 23;
/// Too many open files
pub const EMFILE = 24;
/// Not a typewriter
pub const ENOTTY = 25;
/// Text file busy
pub const ETXTBSY = 26;
/// File too large
pub const EFBIG = 27;
/// No space left on device
pub const ENOSPC = 28;
/// Illegal seek
pub const ESPIPE = 29;
/// Read-only file system
pub const EROFS = 30;
/// Too many links
pub const EMLINK = 31;
/// Broken pipe
pub const EPIPE = 32;
/// Math argument out of domain of func
pub const EDOM = 33;
/// Math result not representable
pub const ERANGE = 34;
/// Resource deadlock would occur
pub const EDEADLK = 35;
/// File name too long
pub const ENAMETOOLONG = 36;
/// No record locks available
pub const ENOLCK = 37;
/// Function not implemented
pub const ENOSYS = 38;
/// Directory not empty
pub const ENOTEMPTY = 39;
/// Too many symbolic links encountered
pub const ELOOP = 40;
/// Operation would block
pub const EWOULDBLOCK = EAGAIN;
/// No message of desired type
pub const ENOMSG = 42;
/// Identifier removed
pub const EIDRM = 43;
/// Channel number out of range
pub const ECHRNG = 44;
/// Level 2 not synchronized
pub const EL2NSYNC = 45;
/// Level 3 halted
pub const EL3HLT = 46;
/// Level 3 reset
pub const EL3RST = 47;
/// Link number out of range
pub const ELNRNG = 48;
/// Protocol driver not attached
pub const EUNATCH = 49;
/// No CSI structure available
pub const ENOCSI = 50;
/// Level 2 halted
pub const EL2HLT = 51;
/// Invalid exchange
pub const EBADE = 52;
/// Invalid request descriptor
pub const EBADR = 53;
/// Exchange full
pub const EXFULL = 54;
/// No anode
pub const ENOANO = 55;
/// Invalid request code
pub const EBADRQC = 56;
/// Invalid slot
pub const EBADSLT = 57;
/// Bad font file format
pub const EBFONT = 59;
/// Device not a stream
pub const ENOSTR = 60;
/// No data available
pub const ENODATA = 61;
/// Timer expired
pub const ETIME = 62;
/// Out of streams resources
pub const ENOSR = 63;
/// Machine is not on the network
pub const ENONET = 64;
/// Package not installed
pub const ENOPKG = 65;
/// Object is remote
pub const EREMOTE = 66;
/// Link has been severed
pub const ENOLINK = 67;
/// Advertise error
pub const EADV = 68;
/// Srmount error
pub const ESRMNT = 69;
/// Communication error on send
pub const ECOMM = 70;
/// Protocol error
pub const EPROTO = 71;
/// Multihop attempted
pub const EMULTIHOP = 72;
/// RFS specific error
pub const EDOTDOT = 73;
/// Not a data message
pub const EBADMSG = 74;
/// Value too large for defined data type
pub const EOVERFLOW = 75;
/// Name not unique on network
pub const ENOTUNIQ = 76;
/// File descriptor in bad state
pub const EBADFD = 77;
/// Remote address changed
pub const EREMCHG = 78;
/// Can not access a needed shared library
pub const ELIBACC = 79;
/// Accessing a corrupted shared library
pub const ELIBBAD = 80;
/// .lib section in a.out corrupted
pub const ELIBSCN = 81;
/// Attempting to link in too many shared libraries
pub const ELIBMAX = 82;
/// Cannot exec a shared library directly
pub const ELIBEXEC = 83;
/// Illegal byte sequence
pub const EILSEQ = 84;
/// Interrupted system call should be restarted
pub const ERESTART = 85;
/// Streams pipe error
pub const ESTRPIPE = 86;
/// Too many users
pub const EUSERS = 87;
/// Socket operation on non-socket
pub const ENOTSOCK = 88;
/// Destination address required
pub const EDESTADDRREQ = 89;
/// Message too long
pub const EMSGSIZE = 90;
/// Protocol wrong type for socket
pub const EPROTOTYPE = 91;
/// Protocol not available
pub const ENOPROTOOPT = 92;
/// Protocol not supported
pub const EPROTONOSUPPORT = 93;
/// Socket type not supported
pub const ESOCKTNOSUPPORT = 94;
/// Operation not supported on transport endpoint
pub const EOPNOTSUPP = 95;
pub const ENOTSUP = EOPNOTSUPP;
/// Protocol family not supported
pub const EPFNOSUPPORT = 96;
/// Address family not supported by protocol
pub const EAFNOSUPPORT = 97;
/// Address already in use
pub const EADDRINUSE = 98;
/// Cannot assign requested address
pub const EADDRNOTAVAIL = 99;
/// Network is down
pub const ENETDOWN = 100;
/// Network is unreachable
pub const ENETUNREACH = 101;
/// Network dropped connection because of reset
pub const ENETRESET = 102;
/// Software caused connection abort
pub const ECONNABORTED = 103;
/// Connection reset by peer
pub const ECONNRESET = 104;
/// No buffer space available
pub const ENOBUFS = 105;
/// Transport endpoint is already connected
pub const EISCONN = 106;
/// Transport endpoint is not connected
pub const ENOTCONN = 107;
/// Cannot send after transport endpoint shutdown
pub const ESHUTDOWN = 108;
/// Too many references: cannot splice
pub const ETOOMANYREFS = 109;
/// Connection timed out
pub const ETIMEDOUT = 110;
/// Connection refused
pub const ECONNREFUSED = 111;
/// Host is down
pub const EHOSTDOWN = 112;
/// No route to host
pub const EHOSTUNREACH = 113;
/// Operation already in progress
pub const EALREADY = 114;
/// Operation now in progress
pub const EINPROGRESS = 115;
/// Stale NFS file handle
pub const ESTALE = 116;
/// Structure needs cleaning
pub const EUCLEAN = 117;
/// Not a XENIX named type file
pub const ENOTNAM = 118;
/// No XENIX semaphores available
pub const ENAVAIL = 119;
/// Is a named type file
pub const EISNAM = 120;
/// Remote I/O error
pub const EREMOTEIO = 121;
/// Quota exceeded
pub const EDQUOT = 122;
/// No medium found
pub const ENOMEDIUM = 123;
/// Wrong medium type
pub const EMEDIUMTYPE = 124;
/// Operation canceled
pub const ECANCELED = 125;
/// Required key not available
pub const ENOKEY = 126;
/// Key has expired
pub const EKEYEXPIRED = 127;
/// Key has been revoked
pub const EKEYREVOKED = 128;
/// Key was rejected by service
pub const EKEYREJECTED = 129;
// for robust mutexes
/// Owner died
pub const EOWNERDEAD = 130;
/// State not recoverable
pub const ENOTRECOVERABLE = 131;
/// Operation not possible due to RF-kill
pub const ERFKILL = 132;
/// Memory page has hardware error
pub const EHWPOISON = 133;
// nameserver query return codes
/// DNS server returned answer with no data
pub const ENSROK = 0;
/// DNS server returned answer with no data
pub const ENSRNODATA = 160;
/// DNS server claims query was misformatted
pub const ENSRFORMERR = 161;
/// DNS server returned general failure
pub const ENSRSERVFAIL = 162;
/// Domain name not found
pub const ENSRNOTFOUND = 163;
/// DNS server does not implement requested operation
pub const ENSRNOTIMP = 164;
/// DNS server refused query
pub const ENSRREFUSED = 165;
/// Misformatted DNS query
pub const ENSRBADQUERY = 166;
/// Misformatted domain name
pub const ENSRBADNAME = 167;
/// Unsupported address family
pub const ENSRBADFAMILY = 168;
/// Misformatted DNS reply
pub const ENSRBADRESP = 169;
/// Could not contact DNS servers
pub const ENSRCONNREFUSED = 170;
/// Timeout while contacting DNS servers
pub const ENSRTIMEOUT = 171;
/// End of file
pub const ENSROF = 172;
/// Error reading file
pub const ENSRFILE = 173;
/// Out of memory
pub const ENSRNOMEM = 174;
/// Application terminated lookup
pub const ENSRDESTRUCTION = 175;
/// Domain name is too long
pub const ENSRQUERYDOMAINTOOLONG = 176;
/// Domain name is too long
pub const ENSRCNAMELOOP = 177;
pub const AT_FDCWD = 2;
pub const O_DIRECTORY = 1;
pub const O_NOFOLLOW = 2;
pub const O_CLOEXEC = 3;
pub const O_PATH = 4;
pub const O_NOCTTY = 5;
pub const O_RDONLY = 6;
pub const O_RDWR = 7;
pub const O_WRONLY = 8;
pub const LOCK_NB = 20;
pub const LOCK_SH = 21;
pub const LOCK_EX = 22;
pub const CLOCK_REALTIME = 5;
};
pub const io = struct {
pub fn getStdInHandle() std.os.fd_t {
return 0;
}
pub fn getStdOutHandle() std.os.fd_t {
return 1;
}
};
pub const system = struct {
pub fn exit(exit_code: u32) noreturn {
@panic("");
}
pub fn getErrno(err: usize) u16 {
return 0;
}
pub fn clock_gettime(id: i32, tp: *std.os.timespec) usize {
return 0;
}
pub fn openat(fd: std.os.fd_t, buf: [*:0]const u8, flags: usize, mode: usize) usize {
return 0;
}
pub fn read(fd: std.os.fd_t, buf: [*]u8, count: usize) usize {
return 0;
}
pub fn write(fd: std.os.fd_t, buf: [*]const u8, count: usize) usize {
return 0;
}
pub fn isatty(fd: std.os.fd_t) usize {
return 0;
}
pub fn close(fd: std.os.fd_t) usize {
return 0;
}
pub fn flock(fd: std.os.fd_t, operation: i32) usize {
return 0;
}
};
pub const fs = struct {
pub const MAX_PATH_BYTES = 256;
}; | src/os.zig |
const arm = @import("arm.zig");
const intc = @import("intc.zig");
const log = @import("log.zig");
const panic = @import("panic.zig").panic;
pub const IrqHandler = struct {
pub const Context = struct {
// @fieldParentPtr doesn't work with zero-sized types, hence this
// field. See: https://github.com/ziglang/zig/issues/4599
dummy: u1 = 0,
};
handler: ?fn (context: *Context) void = null,
context: *Context = undefined,
};
pub const IrqHandlers = struct {
handlers: [64]IrqHandler,
};
extern var __vector_table_el1: u8;
var controller: *const intc.Intc = undefined;
var irq_handlers = IrqHandlers{
.handlers = [_]IrqHandler{IrqHandler{}} ** 64,
};
const ExceptionFrame = packed struct {
x30: u64,
gpr: [30]u64, // x30 and x31 not included
fpr: [32]u128,
};
export fn handleCurrElSp0Sync(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleCurrElSp0Irq(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleCurrElSp0Fiq(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleCurrElSp0Serror(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleCurrElSpxSync(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
const esr = @truncate(u32, arm.mrs("ESR_EL1"));
log.println(" ESR_EL1 = 0b{b:0>24}", .{esr});
log.println(" ISS is 0b{b:0>24}", .{esr & 0xffffff});
log.println(" EC is 0b{b:0>6}", .{esr >> 26});
const elr = @truncate(u32, arm.mrs("ELR_EL1"));
log.println(" ELR_EL1 is 0x{x:0>16}", .{elr});
const fault_addr = @truncate(u32, arm.mrs("FAR_EL1"));
log.println(" FAR_EL1 is 0x{x:0>16}", .{fault_addr});
panic("Unexpected synchronous exception!");
}
export fn handleCurrElSpxIrq(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
const pending = controller.getPendingIrqMask();
log.println("In IRQ handler; pending = 0x{x:0>16}", .{pending});
var remaining_irqs = pending;
while (remaining_irqs != 0) {
const irq = @truncate(u6, @ctz(u64, remaining_irqs));
const h = &irq_handlers.handlers[irq];
if (h.handler) |handler| {
handler(h.context);
} else {
log.println("warning: unimplemented IRQ {d}", .{irq});
}
remaining_irqs &= ~(@as(u64, 1) << irq);
}
}
export fn handleCurrElSpxFiq(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleCurrElSpxSerror(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleLowerElAarch64Sync(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleLowerElAarch64Irq(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleLowerElAarch64Fiq(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleLowerElAarch64Serror(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleLowerElAarch32Sync(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleLowerElAarch32Irq(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleLowerElAarch32Fiq(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
export fn handleLowerElAarch32Serror(frame: *ExceptionFrame) callconv(.C) void {
_ = frame;
panic(@src().fn_name ++ " not implemented yet!");
}
pub fn installIrqHandler(line: u6, handler: fn (context: *IrqHandler.Context) void, context: *IrqHandler.Context) void {
const h = &irq_handlers.handlers[line];
if (h.handler != null)
panic("Attempted to overwrite existing IRQ handler!");
h.handler = handler;
h.context = context;
}
pub fn init(_controller: *const intc.Intc) void {
arm.msr("VBAR_EL1", @ptrToInt(&__vector_table_el1));
controller = _controller;
} | interrupt.zig |
const std = @import("std");
const CPUData = extern union(enum) {
/// The base clock speed of this CPU.
///
/// Do note that this data may or may not be accurate,
/// depending on the current system in use.
///
/// For example, macOS provides a neat way to check this:
/// `sysctl hw.cpufrequency`
baseClockSpeed: u32,
/// The codename of this CPU.
/// For the time being, Intel/AMD CPUs are only supported.
///
/// Sometimes, this data will not be reliable.
/// Usually, in cases of older CPUs, or if the machine this is
/// being ran on has not internet connection.
///
/// If you wish to be 100% certain, it's best to implement your own logic
/// to determine this, or hardcode every model in existence (I do not recommend doing this.)
///
/// The current implementation scrapes [Intel's ARK](https://ark.intel.com) for Intel's CPUs,
/// and [AMD's page](https://amd.com) for AMD's CPUs.
///
/// Special thanks to [CorpNewt](https://github.com/CorpNewt) who originally implemented the
/// logic for scraping AMD's site.
codename: []const u8,
/// The number of cores of this CPU.
cores: u32,
/// The current clock speed of this CPU.
currentClockSpeed: u32,
/// The available instruction sets for this CPU.
///
/// Here, we can simply take advantage of Zig's
/// built-in instruction set detection.
///
/// Aliases: `flags`
instructionSets: std.ArrayList([]const u8),
/// The available instruction sets for this CPU.
///
/// Here, we can simply take advantage of Zig's
/// built-in instruction set detection.
///
/// Aliases: `instructionSets`
flags: std.ArrayList([]const u8),
/// The maximum clock speed of this CPU.
maxClockSpeed: u32,
/// The microarchitecture of this CPU.
///
/// Some examples being:
/// - Intel
/// - Haswell
/// - Kaby Lake
/// - Skylake
/// - AMD
/// - Zen
/// - Zen+ (Zen+ is a Zen variant with a larger L1 cache.)
/// - Zen2
microarchitecture: []const u8,
/// The model of this CPU.
model: []const u8,
/// The number of logical processors (threads) of this CPU.
threads: u32,
}; | lib/core/cpu.zig |
const std = @import("std");
const math = std.math;
const L = std.unicode.utf8ToUtf16LeStringLiteral;
const zwin32 = @import("zwin32");
const w = zwin32.base;
const d3d12 = zwin32.d3d12;
const hrPanicOnFail = zwin32.hrPanicOnFail;
const hrPanic = zwin32.hrPanic;
const zd3d12 = @import("zd3d12");
const common = @import("common");
const c = common.c;
const vm = common.vectormath;
const GuiRenderer = common.GuiRenderer;
pub export const D3D12SDKVersion: u32 = 4;
pub export const D3D12SDKPath: [*:0]const u8 = ".\\d3d12\\";
const content_dir = @import("build_options").content_dir;
const num_mipmaps = 5;
const Vertex = struct {
position: vm.Vec3,
uv: vm.Vec2,
};
comptime {
std.debug.assert(@sizeOf([2]Vertex) == 40);
std.debug.assert(@alignOf([2]Vertex) == 4);
}
const DemoState = struct {
const window_name = "zig-gamedev: textured quad";
const window_width = 1024;
const window_height = 1024;
window: w.HWND,
grfx: zd3d12.GraphicsContext,
gui: GuiRenderer,
frame_stats: common.FrameStats,
pipeline: zd3d12.PipelineHandle,
vertex_buffer: zd3d12.ResourceHandle,
index_buffer: zd3d12.ResourceHandle,
texture: zd3d12.ResourceHandle,
texture_srv: d3d12.CPU_DESCRIPTOR_HANDLE,
mipmap_level: i32,
fn init(gpa_allocator: std.mem.Allocator) DemoState {
const window = common.initWindow(gpa_allocator, window_name, window_width, window_height) catch unreachable;
var grfx = zd3d12.GraphicsContext.init(gpa_allocator, window);
var arena_allocator_state = std.heap.ArenaAllocator.init(gpa_allocator);
defer arena_allocator_state.deinit();
const arena_allocator = arena_allocator_state.allocator();
const pipeline = blk: {
const input_layout_desc = [_]d3d12.INPUT_ELEMENT_DESC{
d3d12.INPUT_ELEMENT_DESC.init("POSITION", 0, .R32G32B32_FLOAT, 0, 0, .PER_VERTEX_DATA, 0),
d3d12.INPUT_ELEMENT_DESC.init("_Texcoords", 0, .R32G32_FLOAT, 0, 12, .PER_VERTEX_DATA, 0),
};
var pso_desc = d3d12.GRAPHICS_PIPELINE_STATE_DESC.initDefault();
pso_desc.RTVFormats[0] = .R8G8B8A8_UNORM;
pso_desc.NumRenderTargets = 1;
pso_desc.BlendState.RenderTarget[0].RenderTargetWriteMask = 0xf;
pso_desc.PrimitiveTopologyType = .TRIANGLE;
pso_desc.RasterizerState.CullMode = .NONE;
pso_desc.DepthStencilState.DepthEnable = w.FALSE;
pso_desc.InputLayout = .{
.pInputElementDescs = &input_layout_desc,
.NumElements = input_layout_desc.len,
};
break :blk grfx.createGraphicsShaderPipeline(
arena_allocator,
&pso_desc,
content_dir ++ "shaders/textured_quad.vs.cso",
content_dir ++ "shaders/textured_quad.ps.cso",
);
};
const vertex_buffer = grfx.createCommittedResource(
.DEFAULT,
d3d12.HEAP_FLAG_NONE,
&d3d12.RESOURCE_DESC.initBuffer(num_mipmaps * 4 * @sizeOf(Vertex)),
d3d12.RESOURCE_STATE_COPY_DEST,
null,
) catch |err| hrPanic(err);
const index_buffer = grfx.createCommittedResource(
.DEFAULT,
d3d12.HEAP_FLAG_NONE,
&d3d12.RESOURCE_DESC.initBuffer(4 * @sizeOf(u32)),
d3d12.RESOURCE_STATE_COPY_DEST,
null,
) catch |err| hrPanic(err);
var mipgen = zd3d12.MipmapGenerator.init(arena_allocator, &grfx, .R8G8B8A8_UNORM, content_dir);
grfx.beginFrame();
const gui = GuiRenderer.init(arena_allocator, &grfx, 1, content_dir);
const texture = grfx.createAndUploadTex2dFromFile(
content_dir ++ "genart_0025_5.png",
.{}, // Create complete mipmap chain (up to 1x1).
) catch |err| hrPanic(err);
mipgen.generateMipmaps(&grfx, texture);
const texture_srv = grfx.allocateCpuDescriptors(.CBV_SRV_UAV, 1);
grfx.device.CreateShaderResourceView(
grfx.lookupResource(texture).?,
&d3d12.SHADER_RESOURCE_VIEW_DESC{
.Format = .UNKNOWN,
.ViewDimension = .TEXTURE2D,
.Shader4ComponentMapping = d3d12.DEFAULT_SHADER_4_COMPONENT_MAPPING,
.u = .{
.Texture2D = .{
.MostDetailedMip = 0,
.MipLevels = 0xffff_ffff,
.PlaneSlice = 0,
.ResourceMinLODClamp = 0.0,
},
},
},
texture_srv,
);
// Fill vertex buffer.
{
const upload_verts = grfx.allocateUploadBufferRegion(Vertex, num_mipmaps * 4);
var mipmap_index: u32 = 0;
var r: f32 = 1.0;
while (mipmap_index < num_mipmaps) : (mipmap_index += 1) {
const index = mipmap_index * 4;
upload_verts.cpu_slice[index] = .{
.position = vm.Vec3.init(-r, r, 0.0),
.uv = vm.Vec2.init(0.0, 0.0),
};
upload_verts.cpu_slice[index + 1] = .{
.position = vm.Vec3.init(r, r, 0.0),
.uv = vm.Vec2.init(1.0, 0.0),
};
upload_verts.cpu_slice[index + 2] = .{
.position = vm.Vec3.init(-r, -r, 0.0),
.uv = vm.Vec2.init(0.0, 1.0),
};
upload_verts.cpu_slice[index + 3] = .{
.position = vm.Vec3.init(r, -r, 0.0),
.uv = vm.Vec2.init(1.0, 1.0),
};
r *= 0.5;
}
grfx.cmdlist.CopyBufferRegion(
grfx.lookupResource(vertex_buffer).?,
0,
upload_verts.buffer,
upload_verts.buffer_offset,
upload_verts.cpu_slice.len * @sizeOf(@TypeOf(upload_verts.cpu_slice[0])),
);
}
// Fill index buffer.
{
const upload_indices = grfx.allocateUploadBufferRegion(u32, 4);
upload_indices.cpu_slice[0] = 0;
upload_indices.cpu_slice[1] = 1;
upload_indices.cpu_slice[2] = 2;
upload_indices.cpu_slice[3] = 3;
grfx.cmdlist.CopyBufferRegion(
grfx.lookupResource(index_buffer).?,
0,
upload_indices.buffer,
upload_indices.buffer_offset,
upload_indices.cpu_slice.len * @sizeOf(@TypeOf(upload_indices.cpu_slice[0])),
);
}
grfx.addTransitionBarrier(vertex_buffer, d3d12.RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
grfx.addTransitionBarrier(index_buffer, d3d12.RESOURCE_STATE_INDEX_BUFFER);
grfx.addTransitionBarrier(texture, d3d12.RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
grfx.flushResourceBarriers();
grfx.endFrame();
grfx.finishGpuCommands();
// NOTE(mziulek):
// We need to call 'deinit' explicitly - we can't rely on 'defer' in this case because it runs *after*
// 'grfx' is copied in 'return' statement below.
mipgen.deinit(&grfx);
return .{
.grfx = grfx,
.gui = gui,
.window = window,
.frame_stats = common.FrameStats.init(),
.pipeline = pipeline,
.vertex_buffer = vertex_buffer,
.index_buffer = index_buffer,
.texture = texture,
.texture_srv = texture_srv,
.mipmap_level = 1,
};
}
fn deinit(demo: *DemoState, gpa_allocator: std.mem.Allocator) void {
demo.grfx.finishGpuCommands();
demo.gui.deinit(&demo.grfx);
demo.grfx.deinit(gpa_allocator);
common.deinitWindow(gpa_allocator);
demo.* = undefined;
}
fn update(demo: *DemoState) void {
demo.frame_stats.update(demo.grfx.window, window_name);
common.newImGuiFrame(demo.frame_stats.delta_time);
c.igSetNextWindowPos(.{ .x = 10.0, .y = 10.0 }, c.ImGuiCond_FirstUseEver, .{ .x = 0.0, .y = 0.0 });
c.igSetNextWindowSize(.{ .x = 600.0, .y = 0.0 }, c.ImGuiCond_FirstUseEver);
_ = c.igBegin(
"Demo Settings",
null,
c.ImGuiWindowFlags_NoMove | c.ImGuiWindowFlags_NoResize | c.ImGuiWindowFlags_NoSavedSettings,
);
_ = c.igSliderInt("Mipmap Level", &demo.mipmap_level, 0, num_mipmaps - 1, null, c.ImGuiSliderFlags_None);
c.igEnd();
}
fn draw(demo: *DemoState) void {
var grfx = &demo.grfx;
grfx.beginFrame();
const back_buffer = grfx.getBackBuffer();
grfx.addTransitionBarrier(back_buffer.resource_handle, d3d12.RESOURCE_STATE_RENDER_TARGET);
grfx.flushResourceBarriers();
grfx.cmdlist.OMSetRenderTargets(
1,
&[_]d3d12.CPU_DESCRIPTOR_HANDLE{back_buffer.descriptor_handle},
w.TRUE,
null,
);
grfx.cmdlist.ClearRenderTargetView(
back_buffer.descriptor_handle,
&[4]f32{ 0.2, 0.4, 0.8, 1.0 },
0,
null,
);
grfx.setCurrentPipeline(demo.pipeline);
grfx.cmdlist.IASetPrimitiveTopology(.TRIANGLESTRIP);
grfx.cmdlist.IASetVertexBuffers(0, 1, &[_]d3d12.VERTEX_BUFFER_VIEW{.{
.BufferLocation = grfx.lookupResource(demo.vertex_buffer).?.GetGPUVirtualAddress(),
.SizeInBytes = num_mipmaps * 4 * @sizeOf(Vertex),
.StrideInBytes = @sizeOf(Vertex),
}});
grfx.cmdlist.IASetIndexBuffer(&.{
.BufferLocation = grfx.lookupResource(demo.index_buffer).?.GetGPUVirtualAddress(),
.SizeInBytes = 4 * @sizeOf(u32),
.Format = .R32_UINT,
});
grfx.cmdlist.SetGraphicsRootDescriptorTable(0, grfx.copyDescriptorsToGpuHeap(1, demo.texture_srv));
grfx.cmdlist.DrawIndexedInstanced(4, 1, 0, demo.mipmap_level * 4, 0);
demo.gui.draw(grfx);
grfx.addTransitionBarrier(back_buffer.resource_handle, d3d12.RESOURCE_STATE_PRESENT);
grfx.flushResourceBarriers();
grfx.endFrame();
}
};
pub fn main() !void {
common.init();
defer common.deinit();
var gpa_allocator_state = std.heap.GeneralPurposeAllocator(.{}){};
defer {
const leaked = gpa_allocator_state.deinit();
std.debug.assert(leaked == false);
}
const gpa_allocator = gpa_allocator_state.allocator();
var demo = DemoState.init(gpa_allocator);
defer demo.deinit(gpa_allocator);
while (true) {
var message = std.mem.zeroes(w.user32.MSG);
const has_message = w.user32.peekMessageA(&message, null, 0, 0, w.user32.PM_REMOVE) catch unreachable;
if (has_message) {
_ = w.user32.translateMessage(&message);
_ = w.user32.dispatchMessageA(&message);
if (message.message == w.user32.WM_QUIT) {
break;
}
} else {
demo.update();
demo.draw();
}
}
} | samples/textured_quad/src/textured_quad.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
const Vec2 = tools.Vec2;
const Map = tools.Map(u8, 64, 64, false);
pub fn run(input_text: []const u8, allocator: std.mem.Allocator) ![2][]const u8 {
var arena = std.heap.ArenaAllocator.init(allocator);
defer arena.deinit();
var maps = [_]Map{ Map{ .default_tile = 0 }, Map{ .default_tile = 0 } };
{
maps[0].fill('.', null);
maps[1].fill('.', null);
var p = Vec2{ .x = 0, .y = 0 };
var it = std.mem.tokenize(u8, input_text, "\n\r");
while (it.next()) |line| {
maps[0].setLine(p, line);
p.y += 1;
}
}
const ans1 = ans: {
var gen: u32 = 0;
while (gen < 10) : (gen += 1) {
const map0 = &maps[gen % 2];
const map1 = &maps[1 - gen % 2];
var it = map0.iter(null);
while (it.nextEx()) |sq| {
const up_left = if (sq.up_left) |x| x else '.';
const up = if (sq.up) |x| x else '.';
const up_right = if (sq.up_right) |x| x else '.';
const left = if (sq.left) |x| x else '.';
const right = if (sq.right) |x| x else '.';
const down_left = if (sq.down_left) |x| x else '.';
const down = if (sq.down) |x| x else '.';
const down_right = if (sq.down_right) |x| x else '.';
const neib = [_]u8{ up_left, up, up_right, left, right, down_left, down, down_right };
var nb_tree: u32 = 0;
var nb_lumber: u32 = 0;
for (neib) |n| {
switch (n) {
'#' => nb_lumber += 1,
'|' => nb_tree += 1,
else => continue,
}
}
var t = sq.t.*;
switch (t) {
'#' => {
if (nb_lumber == 0 or nb_tree == 0) t = '.';
},
'|' => {
if (nb_lumber >= 3) t = '#';
},
'.' => {
if (nb_tree >= 3) t = '|';
},
else => unreachable,
}
map1.set(sq.p, t);
}
//var buf: [100 * 100]u8 = undefined;
//std.debug.print("{}\n", .{map1.printToBuf(null, null, null, &buf)});
}
var nb_tree: u32 = 0;
var nb_lumber: u32 = 0;
var it = maps[gen % 2].iter(null);
while (it.next()) |sq| {
switch (sq) {
'#' => nb_lumber += 1,
'|' => nb_tree += 1,
else => continue,
}
}
break :ans nb_tree * nb_lumber;
};
const ans2 = ans: {
var results: [1001]u32 = undefined;
var gen: u32 = 10;
while (gen < 1000) : (gen += 1) {
const map0 = &maps[gen % 2];
const map1 = &maps[1 - gen % 2];
var total_tree: u32 = 0;
var total_lumber: u32 = 0;
var it = map0.iter(null);
while (it.nextEx()) |sq| {
const up_left = if (sq.up_left) |x| x else '.';
const up = if (sq.up) |x| x else '.';
const up_right = if (sq.up_right) |x| x else '.';
const left = if (sq.left) |x| x else '.';
const right = if (sq.right) |x| x else '.';
const down_left = if (sq.down_left) |x| x else '.';
const down = if (sq.down) |x| x else '.';
const down_right = if (sq.down_right) |x| x else '.';
const neib = [_]u8{ up_left, up, up_right, left, right, down_left, down, down_right };
var nb_tree: u32 = 0;
var nb_lumber: u32 = 0;
for (neib) |n| {
switch (n) {
'#' => nb_lumber += 1,
'|' => nb_tree += 1,
else => continue,
}
}
var t = sq.t.*;
switch (t) {
'#' => {
if (nb_lumber == 0 or nb_tree == 0) t = '.';
},
'|' => {
if (nb_lumber >= 3) t = '#';
},
'.' => {
if (nb_tree >= 3) t = '|';
},
else => unreachable,
}
map1.set(sq.p, t);
switch (t) {
'#' => total_lumber += 1,
'|' => total_tree += 1,
else => continue,
}
}
results[gen + 1] = total_tree * total_lumber;
// var buf: [100 * 100]u8 = undefined;
// std.debug.print("{}\n", .{map1.printToBuf(null, null, null, &buf)});
//std.debug.print("gen={} => {}\n", .{ gen + 1, total_tree * total_lumber });
}
var period: u32 = 1;
while (results[1000 - period] != results[1000]) : (period += 1) {}
const phase = (1000 % period);
assert(results[(1000 - period - phase) + (1000 % period)] == results[1000]);
const res = results[(1000 - period - phase) + (1000000000 % period)]; //203236 too low
//std.debug.print("period={} v={}\n", .{ period, res });
break :ans res;
};
return [_][]const u8{
try std.fmt.allocPrint(allocator, "{}", .{ans1}),
try std.fmt.allocPrint(allocator, "{}", .{ans2}),
};
}
pub const main = tools.defaultMain("2018/input_day18.txt", run); | 2018/day18.zig |
const std = @import("std");
const print = std.debug.print;
const assert = std.debug.assert;
const threads = @import("threads.zig");
const config = @import("config.zig");
const MAX_FILENAME_LENGTH = 64;
const FileData = struct {
name: [MAX_FILENAME_LENGTH:0]u8,
name_length: usize,
mtime: i128,
ctime: i128,
size: u64,
file: bool,
};
const FolderListing = struct {
count: usize,
bytes: u64,
items: []FileData,
};
fn max(comptime T: type, a: T, b: T) T {
return if (a > b) a else b;
}
fn min(comptime T: type, a: T, b: T) T {
return if (a > b) b else a;
}
fn directory_entry(dir: std.fs.Dir, entry: std.fs.Dir.Entry) ?FileData {
if (dir.openFile(entry.name, .{ .read = true, .write = false })) |handle| {
defer handle.close();
if (handle.stat()) |stat| {
var bytes = min(usize, MAX_FILENAME_LENGTH, entry.name.len);
var data = FileData{
.name = [_:0]u8{0} ** MAX_FILENAME_LENGTH,
.size = stat.size,
.mtime = @divTrunc(stat.mtime, std.time.ns_per_ms),
.ctime = @divTrunc(stat.ctime, std.time.ns_per_ms),
.file = true,
.name_length = bytes,
};
std.mem.copy(u8, data.name[0..], entry.name[0..bytes]);
if (stat.kind == std.fs.File.Kind.Directory) {
data.file = false;
data.size = 0;
}
return data;
} else |err| {
std.log.warn("could not stat file {s}\n", .{entry.name});
}
} else |err| {
std.log.warn("could not open file {s}\n", .{entry.name});
}
return null;
}
fn cmp_file_listing_name(context: void, a: FileData, b: FileData) bool {
_ = context;
return std.mem.lessThan(u8, a.name, b.name);
}
fn cmp_file_listing_ctime(context: void, a: FileData, b: FileData) bool {
_ = context;
return a.ctime < b.ctime;
}
fn cmp_file_listing_mtime(context: void, a: FileData, b: FileData) bool {
_ = context;
return a.mtime < b.mtime;
}
pub fn directory_listing(allocator: *std.mem.Allocator, path: []const u8) ?FolderListing {
var total_size: u64 = 0;
var count: usize = 0;
const stdout = std.io.getStdOut().writer();
var list = std.ArrayList(FileData).init(allocator);
// defer list.deinit();
if (std.fs.openDirAbsolute(path, .{ .iterate = true, .no_follow = false })) |dir| {
var it = dir.iterate();
while (it.next()) |opt| {
if (opt) |entry| {
// Skip files starting with '.'
if (entry.name[0] == 0x2E) {
continue;
}
if (directory_entry(dir, entry)) |data| {
// std.json.stringify(data, std.json.StringifyOptions{
// .whitespace = .{ .indent = .{ .Space = 2 } },
// }, stdout) catch unreachable;
// print("\n", .{});
list.append(data) catch {
std.log.err("failed to append entry: {s}", .{data.name});
return null;
};
total_size += data.size;
count += 1;
}
} else {
break;
}
} else |err| {
std.log.warn("directory iter error\n", .{});
return null;
}
} else |err| {
std.log.warn("[{any}] when opening recording directory {s}\n", .{ err, path });
return null;
}
std.sort.sort(FileData, list.items, {}, cmp_file_listing_mtime);
return FolderListing{ .count = count, .bytes = total_size, .items = list.toOwnedSlice() };
}
pub fn directory_cleanup(ctx: threads.RecordingContext) void {
if (directory_listing(ctx.allocator, ctx.config.dir)) |listing| {
defer ctx.allocator.free(listing.items);
std.log.info("count: {d}", .{listing.count});
std.log.info("size: {d}", .{listing.bytes});
// for (listing.items) |elem| {
// std.log.info("node: {s}", .{elem.name});
// }
if (ctx.config.max_size * 1024 * 1024 < listing.bytes) {
const to_delete = listing.bytes - ctx.config.max_size * 1024 * 1024;
var deleted: u64 = 0;
std.log.info("recordings will be trimmed by at least {d} kB", .{@divTrunc(to_delete, 1024)});
for (listing.items) |elem| {
deleted += elem.size;
// std.log.info("node: {s} is {d} kB", .{ elem.name, @divTrunc(elem.size, 1024) });
// acutally do the delete here
if (std.fs.openDirAbsolute(ctx.config.dir, .{ .iterate = true, .no_follow = false })) |dir| {
dir.deleteFileZ(elem.name[0..]) catch unreachable;
} else |err| {
std.log.warn("[{any}] when opening recording directory to delete\n", .{err});
}
if (deleted > to_delete) {
break;
}
}
}
}
}
test "recording directory cleanup" {
const alloc = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
var dir_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const dir_path = try std.os.getFdPath(tmp.dir.fd, &dir_buffer);
const max_size = 1; // MB
var cfg = config.Recording{ .max_size = max_size, .dir = dir_path };
var ctx = threads.RecordingContext{ .config = cfg, .allocator = alloc };
if (directory_listing(ctx.allocator, ctx.config.dir)) |listing| {
defer alloc.free(listing.items);
try std.testing.expectEqual(listing.count, 0);
}
var file_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const file_suffixes: []const u8 = "012345";
const buffer_slice = file_name_buffer[0..];
const file_size = 1024 * 256;
var file_data_buffer: [file_size]u8 = undefined;
for (file_suffixes) |suffix| {
const file_name = try std.fmt.bufPrint(buffer_slice, "frame_{c}.ext", .{suffix});
// Write randome data into the file
std.crypto.random.bytes(file_data_buffer[0..]);
try tmp.dir.writeFile(file_name, &file_data_buffer);
// Sleep a bit to ensure that mtime listing works correctly
std.time.sleep(std.time.ns_per_ms);
}
// Check that the directory listing finds the files and counts the file sizes correctly
if (directory_listing(ctx.allocator, ctx.config.dir)) |listing| {
defer alloc.free(listing.items);
try std.testing.expectEqual(listing.count, file_suffixes.len);
try std.testing.expectEqual(listing.bytes, file_size * file_suffixes.len);
}
directory_cleanup(ctx);
// Check that cleanup removed the correct number of files
// TODO : check that cleanup removed the correct (oldest) files
if (directory_listing(ctx.allocator, ctx.config.dir)) |listing| {
defer alloc.free(listing.items);
try std.testing.expect(listing.count < file_suffixes.len);
try std.testing.expectEqual(listing.count, @divTrunc(max_size * 1024 * 1024, file_size));
try std.testing.expect(listing.bytes < 1024 * 1024 * max_size);
}
} | src/recording.zig |
const std = @import("std");
pub fn build(b: *std.build.Builder) !void {
const target = b.standardTargetOptions(.{});
const mode = releaseOptions(b);
var code: u8 = undefined;
const tags = b.execAllowFail(
&.{ "git", "describe", "--tags" },
&code,
std.ChildProcess.StdIo.Ignore,
) catch b.fmt("v0.0.0-{s}", .{try b.execAllowFail(
&.{ "git", "rev-parse", "--short", "HEAD" },
&code,
std.ChildProcess.StdIo.Ignore,
)});
{ // Add all executables
var srcDir = try std.fs.cwd().openDir("src", .{ .access_sub_paths = false, .iterate = true });
defer srcDir.close();
var iter = srcDir.iterate();
while (try iter.next()) |entry| {
if (stripSuffix(u8, entry.name, ".zig")) |name| {
// Add executable to the build
const exe = b.addExecutable(name, b.fmt("src/{s}", .{entry.name}));
exe.addBuildOption(
[]const u8,
"tags",
tags,
);
exe.strip = mode == .ReleaseSmall;
exe.setTarget(target);
exe.setBuildMode(mode);
exe.install();
// Add a run step for the executable
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step(name, b.fmt("Run {s}", .{name}));
run_step.dependOn(&run_cmd.step);
}
}
}
{ // Add tests for everything
const test_step = b.step("run-tests", "Run library tests");
var walker = try std.fs.walkPath(b.allocator, "src");
defer walker.deinit();
while (try walker.next()) |entry| {
if (std.mem.endsWith(u8, entry.basename, ".zig")) {
// Add tests to test step
var tests = b.addTest(entry.path);
tests.setBuildMode(mode);
test_step.dependOn(&tests.step);
}
}
}
{ // Install manpages
b.installDirectory(.{
.source_dir = "man",
.install_dir = .Prefix,
.install_subdir = "man",
});
}
}
fn releaseOptions(b: *std.build.Builder) std.builtin.Mode {
const release = b.option(bool, "release", "Optimize for speed; safety checking and debug symbols remain") orelse false;
const small = b.option(bool, "small", "Optimize for size, disable safety checking and strip debug symbols") orelse false;
if (release and small) {
std.debug.warn("-Drelease and -Dsmall are mutually exclusive\n\n", .{});
b.invalid_user_input = true;
} else if (release) {
return .ReleaseSafe;
} else if (small) {
return .ReleaseSmall;
}
return .Debug;
}
fn stripSuffix(comptime T: type, slice: []const T, suffix: []const T) ?[]const T {
if (std.mem.endsWith(T, slice, suffix)) {
return slice[0 .. slice.len - suffix.len];
} else {
return null;
}
} | build.zig |
const os = @import("root").os;
const atmcqueue = os.lib.atmcqueue;
/// Task queue is a generic helper for the queue of tasks (allows to enqueue/dequeue them)
/// It does no locking (though it disables interrupts) for its operations
pub const TaskQueue = struct {
queue: atmcqueue.MPSCUnboundedQueue(os.thread.Task, "atmcqueue_hook") = undefined,
last_ack: usize = 0,
last_triggered: usize = 0,
/// Spin until new events are available
/// Used only if Doorbell is not implemented for the given arch
fn wait(self: *@This()) void {
while (self.last_ack == @atomicLoad(usize, &self.last_triggered, .Acquire)) {
os.platform.spin_hint();
}
}
/// Remove task that is queue head from the queue. Returns null if queue is "empty"
pub fn dequeue(self: *@This()) ?*os.thread.Task {
const state = os.platform.get_and_disable_interrupts();
if (self.last_ack < @atomicLoad(usize, &self.last_triggered, .Acquire)) {
while (true) {
os.platform.spin_hint();
const note = self.queue.dequeue() orelse continue;
self.last_ack += 1;
os.platform.set_interrupts(state);
return note;
}
}
os.platform.set_interrupts(state);
return null;
}
/// Enqueue task in the end of the queue.
pub fn enqueue(self: *@This(), t: *os.thread.Task) void {
const state = os.platform.get_and_disable_interrupts();
_ = @atomicRmw(usize, &self.last_triggered, .Add, 1, .AcqRel);
self.queue.enqueue(t);
os.platform.set_interrupts(state);
}
/// Initialize atomic queue used to store tasks
pub fn init(self: *@This()) void {
self.queue.init();
}
};
/// True if CoreDoorbell is implemented
const use_doorbell = @hasDecl(os.platform.thread, "CoreDoorbell");
/// ReadyQueue is a data structure that implements core ready task queue logic
/// With the help of os.platform.thread.CoreDoorbell to notify about newer tasks
/// os.platform.thread.CoreDoorbell should define:
/// 1) start_monitoring: Initialize monitor to get ring events. If events occurs after this function call,
/// it should be captured. Corresponds to MONITOR on x86
/// 2) wait: Wait for events. If one was recieved after call to start_monitoring, return immediatelly
pub const ReadyQueue = struct {
queue: TaskQueue = .{},
doorbell: if (use_doorbell) os.platform.thread.CoreDoorbell else void = .{},
/// Enqueue task to run
pub fn enqueue(self: *@This(), task: *os.thread.Task) void {
self.queue.enqueue(task);
if (use_doorbell) {
self.doorbell.ring();
}
}
/// Dequeue task. Waits for one to become available
/// Should run in interrupts enabled context
pub fn dequeue(self: *@This()) *os.thread.Task {
while (true) {
// Begin waiting for ring events
if (use_doorbell) {
self.doorbell.start_monitoring();
}
// If task already there, just return
if (self.queue.dequeue()) |task| {
return task;
}
// Wait for events
if (use_doorbell) {
self.doorbell.wait();
} else {
self.queue.wait();
}
}
}
/// Try to dequeue task
pub fn try_dequeue(self: *@This()) ?*os.thread.Task {
return self.queue.dequeue();
}
/// Initialize atomic queue used to store tasks
pub fn init(self: *@This()) void {
if (use_doorbell) {
self.doorbell.init();
}
self.queue.init();
}
}; | src/thread/task_queue.zig |
pub const MARSHALINTERFACE_MIN = @as(u32, 500);
pub const ASYNC_MODE_COMPATIBILITY = @as(i32, 1);
pub const ASYNC_MODE_DEFAULT = @as(i32, 0);
pub const STGTY_REPEAT = @as(i32, 256);
pub const STG_TOEND = @as(i32, -1);
pub const STG_LAYOUT_SEQUENTIAL = @as(i32, 0);
pub const STG_LAYOUT_INTERLEAVED = @as(i32, 1);
pub const PROPSETFLAG_DEFAULT = @as(u32, 0);
pub const PROPSETFLAG_NONSIMPLE = @as(u32, 1);
pub const PROPSETFLAG_ANSI = @as(u32, 2);
pub const PROPSETFLAG_UNBUFFERED = @as(u32, 4);
pub const PROPSETFLAG_CASE_SENSITIVE = @as(u32, 8);
pub const PROPSET_BEHAVIOR_CASE_SENSITIVE = @as(u32, 1);
pub const PID_DICTIONARY = @as(u32, 0);
pub const PID_CODEPAGE = @as(u32, 1);
pub const PID_FIRST_NAME_DEFAULT = @as(u32, 4095);
pub const PID_LOCALE = @as(u32, 2147483648);
pub const PID_MODIFY_TIME = @as(u32, 2147483649);
pub const PID_SECURITY = @as(u32, 2147483650);
pub const PID_BEHAVIOR = @as(u32, 2147483651);
pub const PID_ILLEGAL = @as(u32, 4294967295);
pub const PID_MIN_READONLY = @as(u32, 2147483648);
pub const PID_MAX_READONLY = @as(u32, 3221225471);
pub const PRSPEC_INVALID = @as(u32, 4294967295);
pub const PROPSETHDR_OSVERSION_UNKNOWN = @as(u32, 4294967295);
pub const PIDDI_THUMBNAIL = @as(i32, 2);
pub const PIDSI_TITLE = @as(i32, 2);
pub const PIDSI_SUBJECT = @as(i32, 3);
pub const PIDSI_AUTHOR = @as(i32, 4);
pub const PIDSI_KEYWORDS = @as(i32, 5);
pub const PIDSI_COMMENTS = @as(i32, 6);
pub const PIDSI_TEMPLATE = @as(i32, 7);
pub const PIDSI_LASTAUTHOR = @as(i32, 8);
pub const PIDSI_REVNUMBER = @as(i32, 9);
pub const PIDSI_EDITTIME = @as(i32, 10);
pub const PIDSI_LASTPRINTED = @as(i32, 11);
pub const PIDSI_CREATE_DTM = @as(i32, 12);
pub const PIDSI_LASTSAVE_DTM = @as(i32, 13);
pub const PIDSI_PAGECOUNT = @as(i32, 14);
pub const PIDSI_WORDCOUNT = @as(i32, 15);
pub const PIDSI_CHARCOUNT = @as(i32, 16);
pub const PIDSI_THUMBNAIL = @as(i32, 17);
pub const PIDSI_APPNAME = @as(i32, 18);
pub const PIDSI_DOC_SECURITY = @as(i32, 19);
pub const PIDDSI_CATEGORY = @as(u32, 2);
pub const PIDDSI_PRESFORMAT = @as(u32, 3);
pub const PIDDSI_BYTECOUNT = @as(u32, 4);
pub const PIDDSI_LINECOUNT = @as(u32, 5);
pub const PIDDSI_PARCOUNT = @as(u32, 6);
pub const PIDDSI_SLIDECOUNT = @as(u32, 7);
pub const PIDDSI_NOTECOUNT = @as(u32, 8);
pub const PIDDSI_HIDDENCOUNT = @as(u32, 9);
pub const PIDDSI_MMCLIPCOUNT = @as(u32, 10);
pub const PIDDSI_SCALE = @as(u32, 11);
pub const PIDDSI_HEADINGPAIR = @as(u32, 12);
pub const PIDDSI_DOCPARTS = @as(u32, 13);
pub const PIDDSI_MANAGER = @as(u32, 14);
pub const PIDDSI_COMPANY = @as(u32, 15);
pub const PIDDSI_LINKSDIRTY = @as(u32, 16);
pub const PIDMSI_EDITOR = @as(i32, 2);
pub const PIDMSI_SUPPLIER = @as(i32, 3);
pub const PIDMSI_SOURCE = @as(i32, 4);
pub const PIDMSI_SEQUENCE_NO = @as(i32, 5);
pub const PIDMSI_PROJECT = @as(i32, 6);
pub const PIDMSI_STATUS = @as(i32, 7);
pub const PIDMSI_OWNER = @as(i32, 8);
pub const PIDMSI_RATING = @as(i32, 9);
pub const PIDMSI_PRODUCTION = @as(i32, 10);
pub const PIDMSI_COPYRIGHT = @as(i32, 11);
pub const CWCSTORAGENAME = @as(u32, 32);
pub const STGM_DIRECT = @as(i32, 0);
pub const STGM_TRANSACTED = @as(i32, 65536);
pub const STGM_SIMPLE = @as(i32, 134217728);
pub const STGM_READ = @as(i32, 0);
pub const STGM_WRITE = @as(i32, 1);
pub const STGM_READWRITE = @as(i32, 2);
pub const STGM_SHARE_DENY_NONE = @as(i32, 64);
pub const STGM_SHARE_DENY_READ = @as(i32, 48);
pub const STGM_SHARE_DENY_WRITE = @as(i32, 32);
pub const STGM_SHARE_EXCLUSIVE = @as(i32, 16);
pub const STGM_PRIORITY = @as(i32, 262144);
pub const STGM_DELETEONRELEASE = @as(i32, 67108864);
pub const STGM_NOSCRATCH = @as(i32, 1048576);
pub const STGM_CREATE = @as(i32, 4096);
pub const STGM_CONVERT = @as(i32, 131072);
pub const STGM_FAILIFTHERE = @as(i32, 0);
pub const STGM_NOSNAPSHOT = @as(i32, 2097152);
pub const STGM_DIRECT_SWMR = @as(i32, 4194304);
pub const STGFMT_STORAGE = @as(u32, 0);
pub const STGFMT_NATIVE = @as(u32, 1);
pub const STGFMT_FILE = @as(u32, 3);
pub const STGFMT_ANY = @as(u32, 4);
pub const STGFMT_DOCFILE = @as(u32, 5);
pub const STGFMT_DOCUMENT = @as(u32, 0);
pub const STGOPTIONS_VERSION = @as(u32, 1);
pub const CCH_MAX_PROPSTG_NAME = @as(u32, 31);
pub const JET_bitConfigStoreReadControlInhibitRead = @as(u32, 1);
pub const JET_bitConfigStoreReadControlDisableAll = @as(u32, 2);
pub const JET_bitConfigStoreReadControlDefault = @as(u32, 0);
pub const JET_bitDefragmentBatchStart = @as(u32, 1);
pub const JET_bitDefragmentBatchStop = @as(u32, 2);
pub const JET_bitDefragmentAvailSpaceTreesOnly = @as(u32, 64);
pub const JET_bitDefragmentNoPartialMerges = @as(u32, 128);
pub const JET_bitDefragmentBTree = @as(u32, 256);
pub const JET_cbtypNull = @as(u32, 0);
pub const JET_cbtypFinalize = @as(u32, 1);
pub const JET_cbtypBeforeInsert = @as(u32, 2);
pub const JET_cbtypAfterInsert = @as(u32, 4);
pub const JET_cbtypBeforeReplace = @as(u32, 8);
pub const JET_cbtypAfterReplace = @as(u32, 16);
pub const JET_cbtypBeforeDelete = @as(u32, 32);
pub const JET_cbtypAfterDelete = @as(u32, 64);
pub const JET_cbtypUserDefinedDefaultValue = @as(u32, 128);
pub const JET_cbtypOnlineDefragCompleted = @as(u32, 256);
pub const JET_cbtypFreeCursorLS = @as(u32, 512);
pub const JET_cbtypFreeTableLS = @as(u32, 1024);
pub const JET_bitTableInfoUpdatable = @as(u32, 1);
pub const JET_bitTableInfoBookmark = @as(u32, 2);
pub const JET_bitTableInfoRollback = @as(u32, 4);
pub const JET_bitObjectSystem = @as(u32, 2147483648);
pub const JET_bitObjectTableFixedDDL = @as(u32, 1073741824);
pub const JET_bitObjectTableTemplate = @as(u32, 536870912);
pub const JET_bitObjectTableDerived = @as(u32, 268435456);
pub const JET_bitObjectTableNoFixedVarColumnsInDerivedTables = @as(u32, 67108864);
pub const JET_MAX_COMPUTERNAME_LENGTH = @as(u32, 15);
pub const JET_bitDurableCommitCallbackLogUnavailable = @as(u32, 1);
pub const JET_cbBookmarkMost = @as(u32, 256);
pub const JET_cbNameMost = @as(u32, 64);
pub const JET_cbFullNameMost = @as(u32, 255);
pub const JET_cbColumnLVPageOverhead = @as(u32, 82);
pub const JET_cbLVDefaultValueMost = @as(u32, 255);
pub const JET_cbColumnMost = @as(u32, 255);
pub const JET_cbLVColumnMost = @as(u32, 2147483647);
pub const JET_cbKeyMost8KBytePage = @as(u32, 2000);
pub const JET_cbKeyMost4KBytePage = @as(u32, 1000);
pub const JET_cbKeyMost2KBytePage = @as(u32, 500);
pub const JET_cbKeyMostMin = @as(u32, 255);
pub const JET_cbKeyMost = @as(u32, 255);
pub const JET_cbLimitKeyMost = @as(u32, 256);
pub const JET_cbPrimaryKeyMost = @as(u32, 255);
pub const JET_cbSecondaryKeyMost = @as(u32, 255);
pub const JET_ccolKeyMost = @as(u32, 16);
pub const JET_ccolMost = @as(u32, 65248);
pub const JET_ccolFixedMost = @as(u32, 127);
pub const JET_ccolVarMost = @as(u32, 128);
pub const JET_EventLoggingDisable = @as(u32, 0);
pub const JET_EventLoggingLevelMin = @as(u32, 1);
pub const JET_EventLoggingLevelLow = @as(u32, 25);
pub const JET_EventLoggingLevelMedium = @as(u32, 50);
pub const JET_EventLoggingLevelHigh = @as(u32, 75);
pub const JET_EventLoggingLevelMax = @as(u32, 100);
pub const JET_IOPriorityNormal = @as(u32, 0);
pub const JET_IOPriorityLow = @as(u32, 1);
pub const JET_configDefault = @as(u32, 1);
pub const JET_configRemoveQuotas = @as(u32, 2);
pub const JET_configLowDiskFootprint = @as(u32, 4);
pub const JET_configMediumDiskFootprint = @as(u32, 8);
pub const JET_configLowMemory = @as(u32, 16);
pub const JET_configDynamicMediumMemory = @as(u32, 32);
pub const JET_configLowPower = @as(u32, 64);
pub const JET_configSSDProfileIO = @as(u32, 128);
pub const JET_configRunSilent = @as(u32, 256);
pub const JET_configUnthrottledMemory = @as(u32, 512);
pub const JET_configHighConcurrencyScaling = @as(u32, 1024);
pub const JET_paramSystemPath = @as(u32, 0);
pub const JET_paramTempPath = @as(u32, 1);
pub const JET_paramLogFilePath = @as(u32, 2);
pub const JET_paramBaseName = @as(u32, 3);
pub const JET_paramEventSource = @as(u32, 4);
pub const JET_paramMaxSessions = @as(u32, 5);
pub const JET_paramMaxOpenTables = @as(u32, 6);
pub const JET_paramPreferredMaxOpenTables = @as(u32, 7);
pub const JET_paramCachedClosedTables = @as(u32, 125);
pub const JET_paramMaxCursors = @as(u32, 8);
pub const JET_paramMaxVerPages = @as(u32, 9);
pub const JET_paramPreferredVerPages = @as(u32, 63);
pub const JET_paramGlobalMinVerPages = @as(u32, 81);
pub const JET_paramVersionStoreTaskQueueMax = @as(u32, 105);
pub const JET_paramMaxTemporaryTables = @as(u32, 10);
pub const JET_paramLogFileSize = @as(u32, 11);
pub const JET_paramLogBuffers = @as(u32, 12);
pub const JET_paramWaitLogFlush = @as(u32, 13);
pub const JET_paramLogCheckpointPeriod = @as(u32, 14);
pub const JET_paramLogWaitingUserMax = @as(u32, 15);
pub const JET_paramCommitDefault = @as(u32, 16);
pub const JET_paramCircularLog = @as(u32, 17);
pub const JET_paramDbExtensionSize = @as(u32, 18);
pub const JET_paramPageTempDBMin = @as(u32, 19);
pub const JET_paramPageFragment = @as(u32, 20);
pub const JET_paramEnableFileCache = @as(u32, 126);
pub const JET_paramVerPageSize = @as(u32, 128);
pub const JET_paramConfiguration = @as(u32, 129);
pub const JET_paramEnableAdvanced = @as(u32, 130);
pub const JET_paramMaxColtyp = @as(u32, 131);
pub const JET_paramBatchIOBufferMax = @as(u32, 22);
pub const JET_paramCacheSize = @as(u32, 41);
pub const JET_paramCacheSizeMin = @as(u32, 60);
pub const JET_paramCacheSizeMax = @as(u32, 23);
pub const JET_paramCheckpointDepthMax = @as(u32, 24);
pub const JET_paramLRUKCorrInterval = @as(u32, 25);
pub const JET_paramLRUKHistoryMax = @as(u32, 26);
pub const JET_paramLRUKPolicy = @as(u32, 27);
pub const JET_paramLRUKTimeout = @as(u32, 28);
pub const JET_paramLRUKTrxCorrInterval = @as(u32, 29);
pub const JET_paramOutstandingIOMax = @as(u32, 30);
pub const JET_paramStartFlushThreshold = @as(u32, 31);
pub const JET_paramStopFlushThreshold = @as(u32, 32);
pub const JET_paramEnableViewCache = @as(u32, 127);
pub const JET_paramCheckpointIOMax = @as(u32, 135);
pub const JET_paramTableClass1Name = @as(u32, 137);
pub const JET_paramTableClass2Name = @as(u32, 138);
pub const JET_paramTableClass3Name = @as(u32, 139);
pub const JET_paramTableClass4Name = @as(u32, 140);
pub const JET_paramTableClass5Name = @as(u32, 141);
pub const JET_paramTableClass6Name = @as(u32, 142);
pub const JET_paramTableClass7Name = @as(u32, 143);
pub const JET_paramTableClass8Name = @as(u32, 144);
pub const JET_paramTableClass9Name = @as(u32, 145);
pub const JET_paramTableClass10Name = @as(u32, 146);
pub const JET_paramTableClass11Name = @as(u32, 147);
pub const JET_paramTableClass12Name = @as(u32, 148);
pub const JET_paramTableClass13Name = @as(u32, 149);
pub const JET_paramTableClass14Name = @as(u32, 150);
pub const JET_paramTableClass15Name = @as(u32, 151);
pub const JET_paramIOPriority = @as(u32, 152);
pub const JET_paramRecovery = @as(u32, 34);
pub const JET_paramEnableOnlineDefrag = @as(u32, 35);
pub const JET_paramCheckFormatWhenOpenFail = @as(u32, 44);
pub const JET_paramEnableTempTableVersioning = @as(u32, 46);
pub const JET_paramIgnoreLogVersion = @as(u32, 47);
pub const JET_paramDeleteOldLogs = @as(u32, 48);
pub const JET_paramEventSourceKey = @as(u32, 49);
pub const JET_paramNoInformationEvent = @as(u32, 50);
pub const JET_paramEventLoggingLevel = @as(u32, 51);
pub const JET_paramDeleteOutOfRangeLogs = @as(u32, 52);
pub const JET_paramAccessDeniedRetryPeriod = @as(u32, 53);
pub const JET_paramEnableIndexChecking = @as(u32, 45);
pub const JET_paramEnableIndexCleanup = @as(u32, 54);
pub const JET_paramDatabasePageSize = @as(u32, 64);
pub const JET_paramDisableCallbacks = @as(u32, 65);
pub const JET_paramLogFileCreateAsynch = @as(u32, 69);
pub const JET_paramErrorToString = @as(u32, 70);
pub const JET_paramZeroDatabaseDuringBackup = @as(u32, 71);
pub const JET_paramUnicodeIndexDefault = @as(u32, 72);
pub const JET_paramRuntimeCallback = @as(u32, 73);
pub const JET_paramCleanupMismatchedLogFiles = @as(u32, 77);
pub const JET_paramRecordUpgradeDirtyLevel = @as(u32, 78);
pub const JET_paramOSSnapshotTimeout = @as(u32, 82);
pub const JET_paramExceptionAction = @as(u32, 98);
pub const JET_paramEventLogCache = @as(u32, 99);
pub const JET_paramCreatePathIfNotExist = @as(u32, 100);
pub const JET_paramPageHintCacheSize = @as(u32, 101);
pub const JET_paramOneDatabasePerSession = @as(u32, 102);
pub const JET_paramMaxInstances = @as(u32, 104);
pub const JET_paramDisablePerfmon = @as(u32, 107);
pub const JET_paramIndexTuplesLengthMin = @as(u32, 110);
pub const JET_paramIndexTuplesLengthMax = @as(u32, 111);
pub const JET_paramIndexTuplesToIndexMax = @as(u32, 112);
pub const JET_paramAlternateDatabaseRecoveryPath = @as(u32, 113);
pub const JET_paramIndexTupleIncrement = @as(u32, 132);
pub const JET_paramIndexTupleStart = @as(u32, 133);
pub const JET_paramKeyMost = @as(u32, 134);
pub const JET_paramLegacyFileNames = @as(u32, 136);
pub const JET_paramEnablePersistedCallbacks = @as(u32, 156);
pub const JET_paramWaypointLatency = @as(u32, 153);
pub const JET_paramDefragmentSequentialBTrees = @as(u32, 160);
pub const JET_paramDefragmentSequentialBTreesDensityCheckFrequency = @as(u32, 161);
pub const JET_paramIOThrottlingTimeQuanta = @as(u32, 162);
pub const JET_paramLVChunkSizeMost = @as(u32, 163);
pub const JET_paramMaxCoalesceReadSize = @as(u32, 164);
pub const JET_paramMaxCoalesceWriteSize = @as(u32, 165);
pub const JET_paramMaxCoalesceReadGapSize = @as(u32, 166);
pub const JET_paramMaxCoalesceWriteGapSize = @as(u32, 167);
pub const JET_paramEnableDBScanInRecovery = @as(u32, 169);
pub const JET_paramDbScanThrottle = @as(u32, 170);
pub const JET_paramDbScanIntervalMinSec = @as(u32, 171);
pub const JET_paramDbScanIntervalMaxSec = @as(u32, 172);
pub const JET_paramCachePriority = @as(u32, 177);
pub const JET_paramMaxTransactionSize = @as(u32, 178);
pub const JET_paramPrereadIOMax = @as(u32, 179);
pub const JET_paramEnableDBScanSerialization = @as(u32, 180);
pub const JET_paramHungIOThreshold = @as(u32, 181);
pub const JET_paramHungIOActions = @as(u32, 182);
pub const JET_paramMinDataForXpress = @as(u32, 183);
pub const JET_paramEnableShrinkDatabase = @as(u32, 184);
pub const JET_paramProcessFriendlyName = @as(u32, 186);
pub const JET_paramDurableCommitCallback = @as(u32, 187);
pub const JET_paramEnableSqm = @as(u32, 188);
pub const JET_paramConfigStoreSpec = @as(u32, 189);
pub const JET_paramMaxValueInvalid = @as(u32, 212);
pub const JET_sesparamCommitDefault = @as(u32, 4097);
pub const JET_sesparamTransactionLevel = @as(u32, 4099);
pub const JET_sesparamOperationContext = @as(u32, 4100);
pub const JET_sesparamCorrelationID = @as(u32, 4101);
pub const JET_sesparamMaxValueInvalid = @as(u32, 4109);
pub const JET_bitESE98FileNames = @as(u32, 1);
pub const JET_bitEightDotThreeSoftCompat = @as(u32, 2);
pub const JET_bitHungIOEvent = @as(u32, 1);
pub const JET_bitShrinkDatabaseOff = @as(u32, 0);
pub const JET_bitShrinkDatabaseOn = @as(u32, 1);
pub const JET_bitShrinkDatabaseRealtime = @as(u32, 2);
pub const JET_bitShrinkDatabaseTrim = @as(u32, 1);
pub const JET_bitReplayIgnoreMissingDB = @as(u32, 4);
pub const JET_bitRecoveryWithoutUndo = @as(u32, 8);
pub const JET_bitTruncateLogsAfterRecovery = @as(u32, 16);
pub const JET_bitReplayMissingMapEntryDB = @as(u32, 32);
pub const JET_bitLogStreamMustExist = @as(u32, 64);
pub const JET_bitReplayIgnoreLostLogs = @as(u32, 128);
pub const JET_bitKeepDbAttachedAtEndOfRecovery = @as(u32, 4096);
pub const JET_bitTermComplete = @as(u32, 1);
pub const JET_bitTermAbrupt = @as(u32, 2);
pub const JET_bitTermStopBackup = @as(u32, 4);
pub const JET_bitTermDirty = @as(u32, 8);
pub const JET_bitIdleFlushBuffers = @as(u32, 1);
pub const JET_bitIdleCompact = @as(u32, 2);
pub const JET_bitIdleStatus = @as(u32, 4);
pub const JET_bitDbReadOnly = @as(u32, 1);
pub const JET_bitDbExclusive = @as(u32, 2);
pub const JET_bitDbDeleteCorruptIndexes = @as(u32, 16);
pub const JET_bitDbDeleteUnicodeIndexes = @as(u32, 1024);
pub const JET_bitDbUpgrade = @as(u32, 512);
pub const JET_bitDbEnableBackgroundMaintenance = @as(u32, 2048);
pub const JET_bitDbPurgeCacheOnAttach = @as(u32, 4096);
pub const JET_bitForceDetach = @as(u32, 1);
pub const JET_bitDbRecoveryOff = @as(u32, 8);
pub const JET_bitDbShadowingOff = @as(u32, 128);
pub const JET_bitDbOverwriteExisting = @as(u32, 512);
pub const JET_bitBackupIncremental = @as(u32, 1);
pub const JET_bitBackupAtomic = @as(u32, 4);
pub const JET_bitBackupSnapshot = @as(u32, 16);
pub const JET_bitBackupEndNormal = @as(u32, 1);
pub const JET_bitBackupEndAbort = @as(u32, 2);
pub const JET_bitBackupTruncateDone = @as(u32, 256);
pub const JET_bitTableCreateFixedDDL = @as(u32, 1);
pub const JET_bitTableCreateTemplateTable = @as(u32, 2);
pub const JET_bitTableCreateNoFixedVarColumnsInDerivedTables = @as(u32, 4);
pub const JET_bitTableCreateImmutableStructure = @as(u32, 8);
pub const JET_bitColumnFixed = @as(u32, 1);
pub const JET_bitColumnTagged = @as(u32, 2);
pub const JET_bitColumnNotNULL = @as(u32, 4);
pub const JET_bitColumnVersion = @as(u32, 8);
pub const JET_bitColumnAutoincrement = @as(u32, 16);
pub const JET_bitColumnUpdatable = @as(u32, 32);
pub const JET_bitColumnTTKey = @as(u32, 64);
pub const JET_bitColumnTTDescending = @as(u32, 128);
pub const JET_bitColumnMultiValued = @as(u32, 1024);
pub const JET_bitColumnEscrowUpdate = @as(u32, 2048);
pub const JET_bitColumnUnversioned = @as(u32, 4096);
pub const JET_bitColumnMaybeNull = @as(u32, 8192);
pub const JET_bitColumnFinalize = @as(u32, 16384);
pub const JET_bitColumnUserDefinedDefault = @as(u32, 32768);
pub const JET_bitColumnDeleteOnZero = @as(u32, 131072);
pub const JET_bitColumnCompressed = @as(u32, 524288);
pub const JET_bitDeleteColumnIgnoreTemplateColumns = @as(u32, 1);
pub const JET_bitMoveFirst = @as(u32, 0);
pub const JET_bitNoMove = @as(u32, 2);
pub const JET_bitNewKey = @as(u32, 1);
pub const JET_bitStrLimit = @as(u32, 2);
pub const JET_bitSubStrLimit = @as(u32, 4);
pub const JET_bitNormalizedKey = @as(u32, 8);
pub const JET_bitKeyDataZeroLength = @as(u32, 16);
pub const JET_bitFullColumnStartLimit = @as(u32, 256);
pub const JET_bitFullColumnEndLimit = @as(u32, 512);
pub const JET_bitPartialColumnStartLimit = @as(u32, 1024);
pub const JET_bitPartialColumnEndLimit = @as(u32, 2048);
pub const JET_bitRangeInclusive = @as(u32, 1);
pub const JET_bitRangeUpperLimit = @as(u32, 2);
pub const JET_bitRangeInstantDuration = @as(u32, 4);
pub const JET_bitRangeRemove = @as(u32, 8);
pub const JET_bitReadLock = @as(u32, 1);
pub const JET_bitWriteLock = @as(u32, 2);
pub const JET_MoveFirst = @as(u32, 2147483648);
pub const JET_MovePrevious = @as(i32, -1);
pub const JET_MoveLast = @as(u32, 2147483647);
pub const JET_bitMoveKeyNE = @as(u32, 1);
pub const JET_bitSeekEQ = @as(u32, 1);
pub const JET_bitSeekLT = @as(u32, 2);
pub const JET_bitSeekLE = @as(u32, 4);
pub const JET_bitSeekGE = @as(u32, 8);
pub const JET_bitSeekGT = @as(u32, 16);
pub const JET_bitSetIndexRange = @as(u32, 32);
pub const JET_bitCheckUniqueness = @as(u32, 64);
pub const JET_bitBookmarkPermitVirtualCurrency = @as(u32, 1);
pub const JET_bitIndexColumnMustBeNull = @as(u32, 1);
pub const JET_bitIndexColumnMustBeNonNull = @as(u32, 2);
pub const JET_bitRecordInIndex = @as(u32, 1);
pub const JET_bitRecordNotInIndex = @as(u32, 2);
pub const JET_bitIndexUnique = @as(u32, 1);
pub const JET_bitIndexPrimary = @as(u32, 2);
pub const JET_bitIndexDisallowNull = @as(u32, 4);
pub const JET_bitIndexIgnoreNull = @as(u32, 8);
pub const JET_bitIndexIgnoreAnyNull = @as(u32, 32);
pub const JET_bitIndexIgnoreFirstNull = @as(u32, 64);
pub const JET_bitIndexLazyFlush = @as(u32, 128);
pub const JET_bitIndexEmpty = @as(u32, 256);
pub const JET_bitIndexUnversioned = @as(u32, 512);
pub const JET_bitIndexSortNullsHigh = @as(u32, 1024);
pub const JET_bitIndexUnicode = @as(u32, 2048);
pub const JET_bitIndexTuples = @as(u32, 4096);
pub const JET_bitIndexTupleLimits = @as(u32, 8192);
pub const JET_bitIndexCrossProduct = @as(u32, 16384);
pub const JET_bitIndexKeyMost = @as(u32, 32768);
pub const JET_bitIndexDisallowTruncation = @as(u32, 65536);
pub const JET_bitIndexNestedTable = @as(u32, 131072);
pub const JET_bitIndexDotNetGuid = @as(u32, 262144);
pub const JET_bitIndexImmutableStructure = @as(u32, 524288);
pub const JET_bitKeyAscending = @as(u32, 0);
pub const JET_bitKeyDescending = @as(u32, 1);
pub const JET_bitTableDenyWrite = @as(u32, 1);
pub const JET_bitTableDenyRead = @as(u32, 2);
pub const JET_bitTableReadOnly = @as(u32, 4);
pub const JET_bitTableUpdatable = @as(u32, 8);
pub const JET_bitTablePermitDDL = @as(u32, 16);
pub const JET_bitTableNoCache = @as(u32, 32);
pub const JET_bitTablePreread = @as(u32, 64);
pub const JET_bitTableOpportuneRead = @as(u32, 128);
pub const JET_bitTableSequential = @as(u32, 32768);
pub const JET_bitTableClassMask = @as(u32, 2031616);
pub const JET_bitTableClassNone = @as(u32, 0);
pub const JET_bitTableClass1 = @as(u32, 65536);
pub const JET_bitTableClass2 = @as(u32, 131072);
pub const JET_bitTableClass3 = @as(u32, 196608);
pub const JET_bitTableClass4 = @as(u32, 262144);
pub const JET_bitTableClass5 = @as(u32, 327680);
pub const JET_bitTableClass6 = @as(u32, 393216);
pub const JET_bitTableClass7 = @as(u32, 458752);
pub const JET_bitTableClass8 = @as(u32, 524288);
pub const JET_bitTableClass9 = @as(u32, 589824);
pub const JET_bitTableClass10 = @as(u32, 655360);
pub const JET_bitTableClass11 = @as(u32, 720896);
pub const JET_bitTableClass12 = @as(u32, 786432);
pub const JET_bitTableClass13 = @as(u32, 851968);
pub const JET_bitTableClass14 = @as(u32, 917504);
pub const JET_bitTableClass15 = @as(u32, 983040);
pub const JET_bitLSReset = @as(u32, 1);
pub const JET_bitLSCursor = @as(u32, 2);
pub const JET_bitLSTable = @as(u32, 4);
pub const JET_bitPrereadForward = @as(u32, 1);
pub const JET_bitPrereadBackward = @as(u32, 2);
pub const JET_bitPrereadFirstPage = @as(u32, 4);
pub const JET_bitPrereadNormalizedKey = @as(u32, 8);
pub const JET_bitTTIndexed = @as(u32, 1);
pub const JET_bitTTUnique = @as(u32, 2);
pub const JET_bitTTUpdatable = @as(u32, 4);
pub const JET_bitTTScrollable = @as(u32, 8);
pub const JET_bitTTSortNullsHigh = @as(u32, 16);
pub const JET_bitTTForceMaterialization = @as(u32, 32);
pub const JET_bitTTForwardOnly = @as(u32, 64);
pub const JET_bitTTIntrinsicLVsOnly = @as(u32, 128);
pub const JET_bitTTDotNetGuid = @as(u32, 256);
pub const JET_bitSetAppendLV = @as(u32, 1);
pub const JET_bitSetOverwriteLV = @as(u32, 4);
pub const JET_bitSetSizeLV = @as(u32, 8);
pub const JET_bitSetZeroLength = @as(u32, 32);
pub const JET_bitSetSeparateLV = @as(u32, 64);
pub const JET_bitSetUniqueMultiValues = @as(u32, 128);
pub const JET_bitSetUniqueNormalizedMultiValues = @as(u32, 256);
pub const JET_bitSetRevertToDefaultValue = @as(u32, 512);
pub const JET_bitSetIntrinsicLV = @as(u32, 1024);
pub const JET_bitSetUncompressed = @as(u32, 65536);
pub const JET_bitSetCompressed = @as(u32, 131072);
pub const JET_bitSetContiguousLV = @as(u32, 262144);
pub const JET_bitSpaceHintsUtilizeParentSpace = @as(u32, 1);
pub const JET_bitCreateHintAppendSequential = @as(u32, 2);
pub const JET_bitCreateHintHotpointSequential = @as(u32, 4);
pub const JET_bitRetrieveHintReserve1 = @as(u32, 8);
pub const JET_bitRetrieveHintTableScanForward = @as(u32, 16);
pub const JET_bitRetrieveHintTableScanBackward = @as(u32, 32);
pub const JET_bitRetrieveHintReserve2 = @as(u32, 64);
pub const JET_bitRetrieveHintReserve3 = @as(u32, 128);
pub const JET_bitDeleteHintTableSequential = @as(u32, 256);
pub const JET_prepInsert = @as(u32, 0);
pub const JET_prepReplace = @as(u32, 2);
pub const JET_prepCancel = @as(u32, 3);
pub const JET_prepReplaceNoLock = @as(u32, 4);
pub const JET_prepInsertCopy = @as(u32, 5);
pub const JET_prepInsertCopyDeleteOriginal = @as(u32, 7);
pub const JET_prepInsertCopyReplaceOriginal = @as(u32, 9);
pub const JET_sqmDisable = @as(u32, 0);
pub const JET_sqmEnable = @as(u32, 1);
pub const JET_sqmFromCEIP = @as(u32, 2);
pub const JET_bitUpdateCheckESE97Compatibility = @as(u32, 1);
pub const JET_bitEscrowNoRollback = @as(u32, 1);
pub const JET_bitRetrieveCopy = @as(u32, 1);
pub const JET_bitRetrieveFromIndex = @as(u32, 2);
pub const JET_bitRetrieveFromPrimaryBookmark = @as(u32, 4);
pub const JET_bitRetrieveTag = @as(u32, 8);
pub const JET_bitRetrieveNull = @as(u32, 16);
pub const JET_bitRetrieveIgnoreDefault = @as(u32, 32);
pub const JET_bitRetrieveTuple = @as(u32, 2048);
pub const JET_bitZeroLength = @as(u32, 1);
pub const JET_bitEnumeratePresenceOnly = @as(u32, 131072);
pub const JET_bitEnumerateTaggedOnly = @as(u32, 262144);
pub const JET_bitEnumerateCompressOutput = @as(u32, 524288);
pub const JET_bitEnumerateIgnoreUserDefinedDefault = @as(u32, 1048576);
pub const JET_bitEnumerateInRecordOnly = @as(u32, 2097152);
pub const JET_bitRecordSizeInCopyBuffer = @as(u32, 1);
pub const JET_bitRecordSizeRunningTotal = @as(u32, 2);
pub const JET_bitRecordSizeLocal = @as(u32, 4);
pub const JET_bitTransactionReadOnly = @as(u32, 1);
pub const JET_bitCommitLazyFlush = @as(u32, 1);
pub const JET_bitWaitLastLevel0Commit = @as(u32, 2);
pub const JET_bitWaitAllLevel0Commit = @as(u32, 8);
pub const JET_bitForceNewLog = @as(u32, 16);
pub const JET_bitRollbackAll = @as(u32, 1);
pub const JET_bitIncrementalSnapshot = @as(u32, 1);
pub const JET_bitCopySnapshot = @as(u32, 2);
pub const JET_bitContinueAfterThaw = @as(u32, 4);
pub const JET_bitExplicitPrepare = @as(u32, 8);
pub const JET_bitAllDatabasesSnapshot = @as(u32, 1);
pub const JET_bitAbortSnapshot = @as(u32, 1);
pub const JET_DbInfoFilename = @as(u32, 0);
pub const JET_DbInfoConnect = @as(u32, 1);
pub const JET_DbInfoCountry = @as(u32, 2);
pub const JET_DbInfoLCID = @as(u32, 3);
pub const JET_DbInfoLangid = @as(u32, 3);
pub const JET_DbInfoCp = @as(u32, 4);
pub const JET_DbInfoCollate = @as(u32, 5);
pub const JET_DbInfoOptions = @as(u32, 6);
pub const JET_DbInfoTransactions = @as(u32, 7);
pub const JET_DbInfoVersion = @as(u32, 8);
pub const JET_DbInfoIsam = @as(u32, 9);
pub const JET_DbInfoFilesize = @as(u32, 10);
pub const JET_DbInfoSpaceOwned = @as(u32, 11);
pub const JET_DbInfoSpaceAvailable = @as(u32, 12);
pub const JET_DbInfoUpgrade = @as(u32, 13);
pub const JET_DbInfoMisc = @as(u32, 14);
pub const JET_DbInfoDBInUse = @as(u32, 15);
pub const JET_DbInfoPageSize = @as(u32, 17);
pub const JET_DbInfoFileType = @as(u32, 19);
pub const JET_DbInfoFilesizeOnDisk = @as(u32, 21);
pub const JET_dbstateJustCreated = @as(u32, 1);
pub const JET_dbstateDirtyShutdown = @as(u32, 2);
pub const JET_dbstateCleanShutdown = @as(u32, 3);
pub const JET_dbstateBeingConverted = @as(u32, 4);
pub const JET_dbstateForceDetach = @as(u32, 5);
pub const JET_filetypeUnknown = @as(u32, 0);
pub const JET_filetypeDatabase = @as(u32, 1);
pub const JET_filetypeLog = @as(u32, 3);
pub const JET_filetypeCheckpoint = @as(u32, 4);
pub const JET_filetypeTempDatabase = @as(u32, 5);
pub const JET_filetypeFlushMap = @as(u32, 7);
pub const JET_coltypNil = @as(u32, 0);
pub const JET_coltypBit = @as(u32, 1);
pub const JET_coltypUnsignedByte = @as(u32, 2);
pub const JET_coltypShort = @as(u32, 3);
pub const JET_coltypLong = @as(u32, 4);
pub const JET_coltypCurrency = @as(u32, 5);
pub const JET_coltypIEEESingle = @as(u32, 6);
pub const JET_coltypIEEEDouble = @as(u32, 7);
pub const JET_coltypDateTime = @as(u32, 8);
pub const JET_coltypBinary = @as(u32, 9);
pub const JET_coltypText = @as(u32, 10);
pub const JET_coltypLongBinary = @as(u32, 11);
pub const JET_coltypLongText = @as(u32, 12);
pub const JET_coltypMax = @as(u32, 13);
pub const JET_coltypSLV = @as(u32, 13);
pub const JET_coltypUnsignedLong = @as(u32, 14);
pub const JET_coltypLongLong = @as(u32, 15);
pub const JET_coltypGUID = @as(u32, 16);
pub const JET_coltypUnsignedShort = @as(u32, 17);
pub const JET_coltypUnsignedLongLong = @as(u32, 18);
pub const JET_ColInfoGrbitNonDerivedColumnsOnly = @as(u32, 2147483648);
pub const JET_ColInfoGrbitMinimalInfo = @as(u32, 1073741824);
pub const JET_ColInfoGrbitSortByColumnid = @as(u32, 536870912);
pub const JET_objtypNil = @as(u32, 0);
pub const JET_objtypTable = @as(u32, 1);
pub const JET_bitCompactStats = @as(u32, 32);
pub const JET_bitCompactRepair = @as(u32, 64);
pub const JET_snpRepair = @as(u32, 2);
pub const JET_snpCompact = @as(u32, 4);
pub const JET_snpRestore = @as(u32, 8);
pub const JET_snpBackup = @as(u32, 9);
pub const JET_snpUpgrade = @as(u32, 10);
pub const JET_snpScrub = @as(u32, 11);
pub const JET_snpUpgradeRecordFormat = @as(u32, 12);
pub const JET_sntBegin = @as(u32, 5);
pub const JET_sntRequirements = @as(u32, 7);
pub const JET_sntProgress = @as(u32, 0);
pub const JET_sntComplete = @as(u32, 6);
pub const JET_sntFail = @as(u32, 3);
pub const JET_ExceptionMsgBox = @as(u32, 1);
pub const JET_ExceptionNone = @as(u32, 2);
pub const JET_ExceptionFailFast = @as(u32, 4);
pub const JET_OnlineDefragDisable = @as(u32, 0);
pub const JET_OnlineDefragAllOBSOLETE = @as(u32, 1);
pub const JET_OnlineDefragDatabases = @as(u32, 2);
pub const JET_OnlineDefragSpaceTrees = @as(u32, 4);
pub const JET_OnlineDefragAll = @as(u32, 65535);
pub const JET_bitResizeDatabaseOnlyGrow = @as(u32, 1);
pub const JET_bitResizeDatabaseOnlyShrink = @as(u32, 2);
pub const JET_bitStopServiceAll = @as(u32, 0);
pub const JET_bitStopServiceBackgroundUserTasks = @as(u32, 2);
pub const JET_bitStopServiceQuiesceCaches = @as(u32, 4);
pub const JET_bitStopServiceResume = @as(u32, 2147483648);
pub const JET_errSuccess = @as(u32, 0);
pub const JET_wrnNyi = @as(i32, -1);
pub const JET_errRfsFailure = @as(i32, -100);
pub const JET_errRfsNotArmed = @as(i32, -101);
pub const JET_errFileClose = @as(i32, -102);
pub const JET_errOutOfThreads = @as(i32, -103);
pub const JET_errTooManyIO = @as(i32, -105);
pub const JET_errTaskDropped = @as(i32, -106);
pub const JET_errInternalError = @as(i32, -107);
pub const JET_errDisabledFunctionality = @as(i32, -112);
pub const JET_errUnloadableOSFunctionality = @as(i32, -113);
pub const JET_errDatabaseBufferDependenciesCorrupted = @as(i32, -255);
pub const JET_wrnRemainingVersions = @as(u32, 321);
pub const JET_errPreviousVersion = @as(i32, -322);
pub const JET_errPageBoundary = @as(i32, -323);
pub const JET_errKeyBoundary = @as(i32, -324);
pub const JET_errBadPageLink = @as(i32, -327);
pub const JET_errBadBookmark = @as(i32, -328);
pub const JET_errNTSystemCallFailed = @as(i32, -334);
pub const JET_errBadParentPageLink = @as(i32, -338);
pub const JET_errSPAvailExtCacheOutOfSync = @as(i32, -340);
pub const JET_errSPAvailExtCorrupted = @as(i32, -341);
pub const JET_errSPAvailExtCacheOutOfMemory = @as(i32, -342);
pub const JET_errSPOwnExtCorrupted = @as(i32, -343);
pub const JET_errDbTimeCorrupted = @as(i32, -344);
pub const JET_wrnUniqueKey = @as(u32, 345);
pub const JET_errKeyTruncated = @as(i32, -346);
pub const JET_errDatabaseLeakInSpace = @as(i32, -348);
pub const JET_errBadEmptyPage = @as(i32, -351);
pub const JET_errBadLineCount = @as(i32, -354);
pub const JET_wrnSeparateLongValue = @as(u32, 406);
pub const JET_errKeyTooBig = @as(i32, -408);
pub const JET_errCannotSeparateIntrinsicLV = @as(i32, -416);
pub const JET_errSeparatedLongValue = @as(i32, -421);
pub const JET_errMustBeSeparateLongValue = @as(i32, -423);
pub const JET_errInvalidPreread = @as(i32, -424);
pub const JET_errInvalidLoggedOperation = @as(i32, -500);
pub const JET_errLogFileCorrupt = @as(i32, -501);
pub const JET_errNoBackupDirectory = @as(i32, -503);
pub const JET_errBackupDirectoryNotEmpty = @as(i32, -504);
pub const JET_errBackupInProgress = @as(i32, -505);
pub const JET_errRestoreInProgress = @as(i32, -506);
pub const JET_errMissingPreviousLogFile = @as(i32, -509);
pub const JET_errLogWriteFail = @as(i32, -510);
pub const JET_errLogDisabledDueToRecoveryFailure = @as(i32, -511);
pub const JET_errCannotLogDuringRecoveryRedo = @as(i32, -512);
pub const JET_errLogGenerationMismatch = @as(i32, -513);
pub const JET_errBadLogVersion = @as(i32, -514);
pub const JET_errInvalidLogSequence = @as(i32, -515);
pub const JET_errLoggingDisabled = @as(i32, -516);
pub const JET_errLogBufferTooSmall = @as(i32, -517);
pub const JET_errLogSequenceEnd = @as(i32, -519);
pub const JET_errNoBackup = @as(i32, -520);
pub const JET_errInvalidBackupSequence = @as(i32, -521);
pub const JET_errBackupNotAllowedYet = @as(i32, -523);
pub const JET_errDeleteBackupFileFail = @as(i32, -524);
pub const JET_errMakeBackupDirectoryFail = @as(i32, -525);
pub const JET_errInvalidBackup = @as(i32, -526);
pub const JET_errRecoveredWithErrors = @as(i32, -527);
pub const JET_errMissingLogFile = @as(i32, -528);
pub const JET_errLogDiskFull = @as(i32, -529);
pub const JET_errBadLogSignature = @as(i32, -530);
pub const JET_errBadDbSignature = @as(i32, -531);
pub const JET_errBadCheckpointSignature = @as(i32, -532);
pub const JET_errCheckpointCorrupt = @as(i32, -533);
pub const JET_errMissingPatchPage = @as(i32, -534);
pub const JET_errBadPatchPage = @as(i32, -535);
pub const JET_errRedoAbruptEnded = @as(i32, -536);
pub const JET_errPatchFileMissing = @as(i32, -538);
pub const JET_errDatabaseLogSetMismatch = @as(i32, -539);
pub const JET_errDatabaseStreamingFileMismatch = @as(i32, -540);
pub const JET_errLogFileSizeMismatch = @as(i32, -541);
pub const JET_errCheckpointFileNotFound = @as(i32, -542);
pub const JET_errRequiredLogFilesMissing = @as(i32, -543);
pub const JET_errSoftRecoveryOnBackupDatabase = @as(i32, -544);
pub const JET_errLogFileSizeMismatchDatabasesConsistent = @as(i32, -545);
pub const JET_errLogSectorSizeMismatch = @as(i32, -546);
pub const JET_errLogSectorSizeMismatchDatabasesConsistent = @as(i32, -547);
pub const JET_errLogSequenceEndDatabasesConsistent = @as(i32, -548);
pub const JET_errStreamingDataNotLogged = @as(i32, -549);
pub const JET_errDatabaseDirtyShutdown = @as(i32, -550);
pub const JET_errConsistentTimeMismatch = @as(i32, -551);
pub const JET_errDatabasePatchFileMismatch = @as(i32, -552);
pub const JET_errEndingRestoreLogTooLow = @as(i32, -553);
pub const JET_errStartingRestoreLogTooHigh = @as(i32, -554);
pub const JET_errGivenLogFileHasBadSignature = @as(i32, -555);
pub const JET_errGivenLogFileIsNotContiguous = @as(i32, -556);
pub const JET_errMissingRestoreLogFiles = @as(i32, -557);
pub const JET_wrnExistingLogFileHasBadSignature = @as(u32, 558);
pub const JET_wrnExistingLogFileIsNotContiguous = @as(u32, 559);
pub const JET_errMissingFullBackup = @as(i32, -560);
pub const JET_errBadBackupDatabaseSize = @as(i32, -561);
pub const JET_errDatabaseAlreadyUpgraded = @as(i32, -562);
pub const JET_errDatabaseIncompleteUpgrade = @as(i32, -563);
pub const JET_wrnSkipThisRecord = @as(u32, 564);
pub const JET_errMissingCurrentLogFiles = @as(i32, -565);
pub const JET_errDbTimeTooOld = @as(i32, -566);
pub const JET_errDbTimeTooNew = @as(i32, -567);
pub const JET_errMissingFileToBackup = @as(i32, -569);
pub const JET_errLogTornWriteDuringHardRestore = @as(i32, -570);
pub const JET_errLogTornWriteDuringHardRecovery = @as(i32, -571);
pub const JET_errLogCorruptDuringHardRestore = @as(i32, -573);
pub const JET_errLogCorruptDuringHardRecovery = @as(i32, -574);
pub const JET_errMustDisableLoggingForDbUpgrade = @as(i32, -575);
pub const JET_errBadRestoreTargetInstance = @as(i32, -577);
pub const JET_wrnTargetInstanceRunning = @as(u32, 578);
pub const JET_errRecoveredWithoutUndo = @as(i32, -579);
pub const JET_errDatabasesNotFromSameSnapshot = @as(i32, -580);
pub const JET_errSoftRecoveryOnSnapshot = @as(i32, -581);
pub const JET_errCommittedLogFilesMissing = @as(i32, -582);
pub const JET_errSectorSizeNotSupported = @as(i32, -583);
pub const JET_errRecoveredWithoutUndoDatabasesConsistent = @as(i32, -584);
pub const JET_wrnCommittedLogFilesLost = @as(u32, 585);
pub const JET_errCommittedLogFileCorrupt = @as(i32, -586);
pub const JET_wrnCommittedLogFilesRemoved = @as(u32, 587);
pub const JET_wrnFinishWithUndo = @as(u32, 588);
pub const JET_errLogSequenceChecksumMismatch = @as(i32, -590);
pub const JET_wrnDatabaseRepaired = @as(u32, 595);
pub const JET_errPageInitializedMismatch = @as(i32, -596);
pub const JET_errUnicodeTranslationBufferTooSmall = @as(i32, -601);
pub const JET_errUnicodeTranslationFail = @as(i32, -602);
pub const JET_errUnicodeNormalizationNotSupported = @as(i32, -603);
pub const JET_errUnicodeLanguageValidationFailure = @as(i32, -604);
pub const JET_errExistingLogFileHasBadSignature = @as(i32, -610);
pub const JET_errExistingLogFileIsNotContiguous = @as(i32, -611);
pub const JET_errLogReadVerifyFailure = @as(i32, -612);
pub const JET_errCheckpointDepthTooDeep = @as(i32, -614);
pub const JET_errRestoreOfNonBackupDatabase = @as(i32, -615);
pub const JET_errLogFileNotCopied = @as(i32, -616);
pub const JET_errTransactionTooLong = @as(i32, -618);
pub const JET_errEngineFormatVersionNoLongerSupportedTooLow = @as(i32, -619);
pub const JET_errEngineFormatVersionNotYetImplementedTooHigh = @as(i32, -620);
pub const JET_errEngineFormatVersionParamTooLowForRequestedFeature = @as(i32, -621);
pub const JET_errEngineFormatVersionSpecifiedTooLowForLogVersion = @as(i32, -622);
pub const JET_errEngineFormatVersionSpecifiedTooLowForDatabaseVersion = @as(i32, -623);
pub const JET_errBackupAbortByServer = @as(i32, -801);
pub const JET_errInvalidGrbit = @as(i32, -900);
pub const JET_errTermInProgress = @as(i32, -1000);
pub const JET_errFeatureNotAvailable = @as(i32, -1001);
pub const JET_errInvalidName = @as(i32, -1002);
pub const JET_errInvalidParameter = @as(i32, -1003);
pub const JET_wrnColumnNull = @as(u32, 1004);
pub const JET_wrnBufferTruncated = @as(u32, 1006);
pub const JET_wrnDatabaseAttached = @as(u32, 1007);
pub const JET_errDatabaseFileReadOnly = @as(i32, -1008);
pub const JET_wrnSortOverflow = @as(u32, 1009);
pub const JET_errInvalidDatabaseId = @as(i32, -1010);
pub const JET_errOutOfMemory = @as(i32, -1011);
pub const JET_errOutOfDatabaseSpace = @as(i32, -1012);
pub const JET_errOutOfCursors = @as(i32, -1013);
pub const JET_errOutOfBuffers = @as(i32, -1014);
pub const JET_errTooManyIndexes = @as(i32, -1015);
pub const JET_errTooManyKeys = @as(i32, -1016);
pub const JET_errRecordDeleted = @as(i32, -1017);
pub const JET_errReadVerifyFailure = @as(i32, -1018);
pub const JET_errPageNotInitialized = @as(i32, -1019);
pub const JET_errOutOfFileHandles = @as(i32, -1020);
pub const JET_errDiskReadVerificationFailure = @as(i32, -1021);
pub const JET_errDiskIO = @as(i32, -1022);
pub const JET_errInvalidPath = @as(i32, -1023);
pub const JET_errInvalidSystemPath = @as(i32, -1024);
pub const JET_errInvalidLogDirectory = @as(i32, -1025);
pub const JET_errRecordTooBig = @as(i32, -1026);
pub const JET_errTooManyOpenDatabases = @as(i32, -1027);
pub const JET_errInvalidDatabase = @as(i32, -1028);
pub const JET_errNotInitialized = @as(i32, -1029);
pub const JET_errAlreadyInitialized = @as(i32, -1030);
pub const JET_errInitInProgress = @as(i32, -1031);
pub const JET_errFileAccessDenied = @as(i32, -1032);
pub const JET_errBufferTooSmall = @as(i32, -1038);
pub const JET_wrnSeekNotEqual = @as(u32, 1039);
pub const JET_errTooManyColumns = @as(i32, -1040);
pub const JET_errContainerNotEmpty = @as(i32, -1043);
pub const JET_errInvalidFilename = @as(i32, -1044);
pub const JET_errInvalidBookmark = @as(i32, -1045);
pub const JET_errColumnInUse = @as(i32, -1046);
pub const JET_errInvalidBufferSize = @as(i32, -1047);
pub const JET_errColumnNotUpdatable = @as(i32, -1048);
pub const JET_errIndexInUse = @as(i32, -1051);
pub const JET_errLinkNotSupported = @as(i32, -1052);
pub const JET_errNullKeyDisallowed = @as(i32, -1053);
pub const JET_errNotInTransaction = @as(i32, -1054);
pub const JET_wrnNoErrorInfo = @as(u32, 1055);
pub const JET_errMustRollback = @as(i32, -1057);
pub const JET_wrnNoIdleActivity = @as(u32, 1058);
pub const JET_errTooManyActiveUsers = @as(i32, -1059);
pub const JET_errInvalidCountry = @as(i32, -1061);
pub const JET_errInvalidLanguageId = @as(i32, -1062);
pub const JET_errInvalidCodePage = @as(i32, -1063);
pub const JET_errInvalidLCMapStringFlags = @as(i32, -1064);
pub const JET_errVersionStoreEntryTooBig = @as(i32, -1065);
pub const JET_errVersionStoreOutOfMemoryAndCleanupTimedOut = @as(i32, -1066);
pub const JET_wrnNoWriteLock = @as(u32, 1067);
pub const JET_wrnColumnSetNull = @as(u32, 1068);
pub const JET_errVersionStoreOutOfMemory = @as(i32, -1069);
pub const JET_errCannotIndex = @as(i32, -1071);
pub const JET_errRecordNotDeleted = @as(i32, -1072);
pub const JET_errTooManyMempoolEntries = @as(i32, -1073);
pub const JET_errOutOfObjectIDs = @as(i32, -1074);
pub const JET_errOutOfLongValueIDs = @as(i32, -1075);
pub const JET_errOutOfAutoincrementValues = @as(i32, -1076);
pub const JET_errOutOfDbtimeValues = @as(i32, -1077);
pub const JET_errOutOfSequentialIndexValues = @as(i32, -1078);
pub const JET_errRunningInOneInstanceMode = @as(i32, -1080);
pub const JET_errRunningInMultiInstanceMode = @as(i32, -1081);
pub const JET_errSystemParamsAlreadySet = @as(i32, -1082);
pub const JET_errSystemPathInUse = @as(i32, -1083);
pub const JET_errLogFilePathInUse = @as(i32, -1084);
pub const JET_errTempPathInUse = @as(i32, -1085);
pub const JET_errInstanceNameInUse = @as(i32, -1086);
pub const JET_errSystemParameterConflict = @as(i32, -1087);
pub const JET_errInstanceUnavailable = @as(i32, -1090);
pub const JET_errDatabaseUnavailable = @as(i32, -1091);
pub const JET_errInstanceUnavailableDueToFatalLogDiskFull = @as(i32, -1092);
pub const JET_errInvalidSesparamId = @as(i32, -1093);
pub const JET_errTooManyRecords = @as(i32, -1094);
pub const JET_errInvalidDbparamId = @as(i32, -1095);
pub const JET_errOutOfSessions = @as(i32, -1101);
pub const JET_errWriteConflict = @as(i32, -1102);
pub const JET_errTransTooDeep = @as(i32, -1103);
pub const JET_errInvalidSesid = @as(i32, -1104);
pub const JET_errWriteConflictPrimaryIndex = @as(i32, -1105);
pub const JET_errInTransaction = @as(i32, -1108);
pub const JET_errRollbackRequired = @as(i32, -1109);
pub const JET_errTransReadOnly = @as(i32, -1110);
pub const JET_errSessionWriteConflict = @as(i32, -1111);
pub const JET_errRecordTooBigForBackwardCompatibility = @as(i32, -1112);
pub const JET_errCannotMaterializeForwardOnlySort = @as(i32, -1113);
pub const JET_errSesidTableIdMismatch = @as(i32, -1114);
pub const JET_errInvalidInstance = @as(i32, -1115);
pub const JET_errDirtyShutdown = @as(i32, -1116);
pub const JET_errReadPgnoVerifyFailure = @as(i32, -1118);
pub const JET_errReadLostFlushVerifyFailure = @as(i32, -1119);
pub const JET_errFileSystemCorruption = @as(i32, -1121);
pub const JET_wrnShrinkNotPossible = @as(u32, 1122);
pub const JET_errRecoveryVerifyFailure = @as(i32, -1123);
pub const JET_errFilteredMoveNotSupported = @as(i32, -1124);
pub const JET_errDatabaseDuplicate = @as(i32, -1201);
pub const JET_errDatabaseInUse = @as(i32, -1202);
pub const JET_errDatabaseNotFound = @as(i32, -1203);
pub const JET_errDatabaseInvalidName = @as(i32, -1204);
pub const JET_errDatabaseInvalidPages = @as(i32, -1205);
pub const JET_errDatabaseCorrupted = @as(i32, -1206);
pub const JET_errDatabaseLocked = @as(i32, -1207);
pub const JET_errCannotDisableVersioning = @as(i32, -1208);
pub const JET_errInvalidDatabaseVersion = @as(i32, -1209);
pub const JET_errDatabase200Format = @as(i32, -1210);
pub const JET_errDatabase400Format = @as(i32, -1211);
pub const JET_errDatabase500Format = @as(i32, -1212);
pub const JET_errPageSizeMismatch = @as(i32, -1213);
pub const JET_errTooManyInstances = @as(i32, -1214);
pub const JET_errDatabaseSharingViolation = @as(i32, -1215);
pub const JET_errAttachedDatabaseMismatch = @as(i32, -1216);
pub const JET_errDatabaseInvalidPath = @as(i32, -1217);
pub const JET_errDatabaseIdInUse = @as(i32, -1218);
pub const JET_errForceDetachNotAllowed = @as(i32, -1219);
pub const JET_errCatalogCorrupted = @as(i32, -1220);
pub const JET_errPartiallyAttachedDB = @as(i32, -1221);
pub const JET_errDatabaseSignInUse = @as(i32, -1222);
pub const JET_errDatabaseCorruptedNoRepair = @as(i32, -1224);
pub const JET_errInvalidCreateDbVersion = @as(i32, -1225);
pub const JET_errDatabaseNotReady = @as(i32, -1230);
pub const JET_errDatabaseAttachedForRecovery = @as(i32, -1231);
pub const JET_errTransactionsNotReadyDuringRecovery = @as(i32, -1232);
pub const JET_wrnTableEmpty = @as(u32, 1301);
pub const JET_errTableLocked = @as(i32, -1302);
pub const JET_errTableDuplicate = @as(i32, -1303);
pub const JET_errTableInUse = @as(i32, -1304);
pub const JET_errObjectNotFound = @as(i32, -1305);
pub const JET_errDensityInvalid = @as(i32, -1307);
pub const JET_errTableNotEmpty = @as(i32, -1308);
pub const JET_errInvalidTableId = @as(i32, -1310);
pub const JET_errTooManyOpenTables = @as(i32, -1311);
pub const JET_errIllegalOperation = @as(i32, -1312);
pub const JET_errTooManyOpenTablesAndCleanupTimedOut = @as(i32, -1313);
pub const JET_errObjectDuplicate = @as(i32, -1314);
pub const JET_errInvalidObject = @as(i32, -1316);
pub const JET_errCannotDeleteTempTable = @as(i32, -1317);
pub const JET_errCannotDeleteSystemTable = @as(i32, -1318);
pub const JET_errCannotDeleteTemplateTable = @as(i32, -1319);
pub const JET_errExclusiveTableLockRequired = @as(i32, -1322);
pub const JET_errFixedDDL = @as(i32, -1323);
pub const JET_errFixedInheritedDDL = @as(i32, -1324);
pub const JET_errCannotNestDDL = @as(i32, -1325);
pub const JET_errDDLNotInheritable = @as(i32, -1326);
pub const JET_wrnTableInUseBySystem = @as(u32, 1327);
pub const JET_errInvalidSettings = @as(i32, -1328);
pub const JET_errClientRequestToStopJetService = @as(i32, -1329);
pub const JET_errCannotAddFixedVarColumnToDerivedTable = @as(i32, -1330);
pub const JET_errIndexCantBuild = @as(i32, -1401);
pub const JET_errIndexHasPrimary = @as(i32, -1402);
pub const JET_errIndexDuplicate = @as(i32, -1403);
pub const JET_errIndexNotFound = @as(i32, -1404);
pub const JET_errIndexMustStay = @as(i32, -1405);
pub const JET_errIndexInvalidDef = @as(i32, -1406);
pub const JET_errInvalidCreateIndex = @as(i32, -1409);
pub const JET_errTooManyOpenIndexes = @as(i32, -1410);
pub const JET_errMultiValuedIndexViolation = @as(i32, -1411);
pub const JET_errIndexBuildCorrupted = @as(i32, -1412);
pub const JET_errPrimaryIndexCorrupted = @as(i32, -1413);
pub const JET_errSecondaryIndexCorrupted = @as(i32, -1414);
pub const JET_wrnCorruptIndexDeleted = @as(u32, 1415);
pub const JET_errInvalidIndexId = @as(i32, -1416);
pub const JET_wrnPrimaryIndexOutOfDate = @as(u32, 1417);
pub const JET_wrnSecondaryIndexOutOfDate = @as(u32, 1418);
pub const JET_errIndexTuplesSecondaryIndexOnly = @as(i32, -1430);
pub const JET_errIndexTuplesTooManyColumns = @as(i32, -1431);
pub const JET_errIndexTuplesNonUniqueOnly = @as(i32, -1432);
pub const JET_errIndexTuplesTextBinaryColumnsOnly = @as(i32, -1433);
pub const JET_errIndexTuplesVarSegMacNotAllowed = @as(i32, -1434);
pub const JET_errIndexTuplesInvalidLimits = @as(i32, -1435);
pub const JET_errIndexTuplesCannotRetrieveFromIndex = @as(i32, -1436);
pub const JET_errIndexTuplesKeyTooSmall = @as(i32, -1437);
pub const JET_errInvalidLVChunkSize = @as(i32, -1438);
pub const JET_errColumnCannotBeEncrypted = @as(i32, -1439);
pub const JET_errCannotIndexOnEncryptedColumn = @as(i32, -1440);
pub const JET_errColumnLong = @as(i32, -1501);
pub const JET_errColumnNoChunk = @as(i32, -1502);
pub const JET_errColumnDoesNotFit = @as(i32, -1503);
pub const JET_errNullInvalid = @as(i32, -1504);
pub const JET_errColumnIndexed = @as(i32, -1505);
pub const JET_errColumnTooBig = @as(i32, -1506);
pub const JET_errColumnNotFound = @as(i32, -1507);
pub const JET_errColumnDuplicate = @as(i32, -1508);
pub const JET_errMultiValuedColumnMustBeTagged = @as(i32, -1509);
pub const JET_errColumnRedundant = @as(i32, -1510);
pub const JET_errInvalidColumnType = @as(i32, -1511);
pub const JET_wrnColumnMaxTruncated = @as(u32, 1512);
pub const JET_errTaggedNotNULL = @as(i32, -1514);
pub const JET_errNoCurrentIndex = @as(i32, -1515);
pub const JET_errKeyIsMade = @as(i32, -1516);
pub const JET_errBadColumnId = @as(i32, -1517);
pub const JET_errBadItagSequence = @as(i32, -1518);
pub const JET_errColumnInRelationship = @as(i32, -1519);
pub const JET_wrnCopyLongValue = @as(u32, 1520);
pub const JET_errCannotBeTagged = @as(i32, -1521);
pub const JET_errDefaultValueTooBig = @as(i32, -1524);
pub const JET_errMultiValuedDuplicate = @as(i32, -1525);
pub const JET_errLVCorrupted = @as(i32, -1526);
pub const JET_errMultiValuedDuplicateAfterTruncation = @as(i32, -1528);
pub const JET_errDerivedColumnCorruption = @as(i32, -1529);
pub const JET_errInvalidPlaceholderColumn = @as(i32, -1530);
pub const JET_wrnColumnSkipped = @as(u32, 1531);
pub const JET_wrnColumnNotLocal = @as(u32, 1532);
pub const JET_wrnColumnMoreTags = @as(u32, 1533);
pub const JET_wrnColumnTruncated = @as(u32, 1534);
pub const JET_wrnColumnPresent = @as(u32, 1535);
pub const JET_wrnColumnSingleValue = @as(u32, 1536);
pub const JET_wrnColumnDefault = @as(u32, 1537);
pub const JET_errColumnCannotBeCompressed = @as(i32, -1538);
pub const JET_wrnColumnNotInRecord = @as(u32, 1539);
pub const JET_errColumnNoEncryptionKey = @as(i32, -1540);
pub const JET_wrnColumnReference = @as(u32, 1541);
pub const JET_errRecordNotFound = @as(i32, -1601);
pub const JET_errRecordNoCopy = @as(i32, -1602);
pub const JET_errNoCurrentRecord = @as(i32, -1603);
pub const JET_errRecordPrimaryChanged = @as(i32, -1604);
pub const JET_errKeyDuplicate = @as(i32, -1605);
pub const JET_errAlreadyPrepared = @as(i32, -1607);
pub const JET_errKeyNotMade = @as(i32, -1608);
pub const JET_errUpdateNotPrepared = @as(i32, -1609);
pub const JET_wrnDataHasChanged = @as(u32, 1610);
pub const JET_errDataHasChanged = @as(i32, -1611);
pub const JET_wrnKeyChanged = @as(u32, 1618);
pub const JET_errLanguageNotSupported = @as(i32, -1619);
pub const JET_errDecompressionFailed = @as(i32, -1620);
pub const JET_errUpdateMustVersion = @as(i32, -1621);
pub const JET_errDecryptionFailed = @as(i32, -1622);
pub const JET_errEncryptionBadItag = @as(i32, -1623);
pub const JET_errTooManySorts = @as(i32, -1701);
pub const JET_errInvalidOnSort = @as(i32, -1702);
pub const JET_errTempFileOpenError = @as(i32, -1803);
pub const JET_errTooManyAttachedDatabases = @as(i32, -1805);
pub const JET_errDiskFull = @as(i32, -1808);
pub const JET_errPermissionDenied = @as(i32, -1809);
pub const JET_errFileNotFound = @as(i32, -1811);
pub const JET_errFileInvalidType = @as(i32, -1812);
pub const JET_wrnFileOpenReadOnly = @as(u32, 1813);
pub const JET_errFileAlreadyExists = @as(i32, -1814);
pub const JET_errAfterInitialization = @as(i32, -1850);
pub const JET_errLogCorrupted = @as(i32, -1852);
pub const JET_errInvalidOperation = @as(i32, -1906);
pub const JET_errAccessDenied = @as(i32, -1907);
pub const JET_wrnIdleFull = @as(u32, 1908);
pub const JET_errTooManySplits = @as(i32, -1909);
pub const JET_errSessionSharingViolation = @as(i32, -1910);
pub const JET_errEntryPointNotFound = @as(i32, -1911);
pub const JET_errSessionContextAlreadySet = @as(i32, -1912);
pub const JET_errSessionContextNotSetByThisThread = @as(i32, -1913);
pub const JET_errSessionInUse = @as(i32, -1914);
pub const JET_errRecordFormatConversionFailed = @as(i32, -1915);
pub const JET_errOneDatabasePerSession = @as(i32, -1916);
pub const JET_errRollbackError = @as(i32, -1917);
pub const JET_errFlushMapVersionUnsupported = @as(i32, -1918);
pub const JET_errFlushMapDatabaseMismatch = @as(i32, -1919);
pub const JET_errFlushMapUnrecoverable = @as(i32, -1920);
pub const JET_wrnDefragAlreadyRunning = @as(u32, 2000);
pub const JET_wrnDefragNotRunning = @as(u32, 2001);
pub const JET_errDatabaseAlreadyRunningMaintenance = @as(i32, -2004);
pub const JET_wrnCallbackNotRegistered = @as(u32, 2100);
pub const JET_errCallbackFailed = @as(i32, -2101);
pub const JET_errCallbackNotResolved = @as(i32, -2102);
pub const JET_errSpaceHintsInvalid = @as(i32, -2103);
pub const JET_errOSSnapshotInvalidSequence = @as(i32, -2401);
pub const JET_errOSSnapshotTimeOut = @as(i32, -2402);
pub const JET_errOSSnapshotNotAllowed = @as(i32, -2403);
pub const JET_errOSSnapshotInvalidSnapId = @as(i32, -2404);
pub const JET_errLSCallbackNotSpecified = @as(i32, -3000);
pub const JET_errLSAlreadySet = @as(i32, -3001);
pub const JET_errLSNotSet = @as(i32, -3002);
pub const JET_errFileIOSparse = @as(i32, -4000);
pub const JET_errFileIOBeyondEOF = @as(i32, -4001);
pub const JET_errFileIOAbort = @as(i32, -4002);
pub const JET_errFileIORetry = @as(i32, -4003);
pub const JET_errFileIOFail = @as(i32, -4004);
pub const JET_errFileCompressed = @as(i32, -4005);
pub const JET_BASE_NAME_LENGTH = @as(u32, 3);
pub const JET_bitDumpMinimum = @as(u32, 1);
pub const JET_bitDumpMaximum = @as(u32, 2);
pub const JET_bitDumpCacheMinimum = @as(u32, 4);
pub const JET_bitDumpCacheMaximum = @as(u32, 8);
pub const JET_bitDumpCacheIncludeDirtyPages = @as(u32, 16);
pub const JET_bitDumpCacheIncludeCachedPages = @as(u32, 32);
pub const JET_bitDumpCacheIncludeCorruptedPages = @as(u32, 64);
pub const JET_bitDumpCacheNoDecommit = @as(u32, 128);
//--------------------------------------------------------------------------------
// Section: Types (150)
//--------------------------------------------------------------------------------
pub const PROPSPEC_KIND = enum(u32) {
LPWSTR = 0,
PROPID = 1,
};
pub const PRSPEC_LPWSTR = PROPSPEC_KIND.LPWSTR;
pub const PRSPEC_PROPID = PROPSPEC_KIND.PROPID;
pub const PMemoryAllocator = extern struct {
placeholder: usize, // TODO: why is this type empty?
};
pub const JET_HANDLE = usize;
pub const JET_INSTANCE = usize;
pub const JET_SESID = *opaque{};
pub const JET_TABLEID = usize;
pub const JET_API_PTR = usize;
pub const JET_OSSNAPID = usize;
pub const JET_LS = usize;
pub const STGC = enum(i32) {
DEFAULT = 0,
OVERWRITE = 1,
ONLYIFCURRENT = 2,
DANGEROUSLYCOMMITMERELYTODISKCACHE = 4,
CONSOLIDATE = 8,
};
pub const STGC_DEFAULT = STGC.DEFAULT;
pub const STGC_OVERWRITE = STGC.OVERWRITE;
pub const STGC_ONLYIFCURRENT = STGC.ONLYIFCURRENT;
pub const STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = STGC.DANGEROUSLYCOMMITMERELYTODISKCACHE;
pub const STGC_CONSOLIDATE = STGC.CONSOLIDATE;
pub const STGMOVE = enum(i32) {
MOVE = 0,
COPY = 1,
SHALLOWCOPY = 2,
};
pub const STGMOVE_MOVE = STGMOVE.MOVE;
pub const STGMOVE_COPY = STGMOVE.COPY;
pub const STGMOVE_SHALLOWCOPY = STGMOVE.SHALLOWCOPY;
pub const STATFLAG = enum(i32) {
DEFAULT = 0,
NONAME = 1,
NOOPEN = 2,
};
pub const STATFLAG_DEFAULT = STATFLAG.DEFAULT;
pub const STATFLAG_NONAME = STATFLAG.NONAME;
pub const STATFLAG_NOOPEN = STATFLAG.NOOPEN;
// TODO: this type is limited to platform 'windows5.0'
const IID_ISequentialStream_Value = @import("../zig.zig").Guid.initString("0c733a30-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ISequentialStream = &IID_ISequentialStream_Value;
pub const ISequentialStream = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Read: fn(
self: *const ISequentialStream,
// TODO: what to do with BytesParamIndex 1?
pv: ?*c_void,
cb: u32,
pcbRead: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Write: fn(
self: *const ISequentialStream,
// TODO: what to do with BytesParamIndex 1?
pv: ?*const c_void,
cb: u32,
pcbWritten: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISequentialStream_Read(self: *const T, pv: ?*c_void, cb: u32, pcbRead: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISequentialStream.VTable, self.vtable).Read(@ptrCast(*const ISequentialStream, self), pv, cb, pcbRead);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISequentialStream_Write(self: *const T, pv: ?*const c_void, cb: u32, pcbWritten: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISequentialStream.VTable, self.vtable).Write(@ptrCast(*const ISequentialStream, self), pv, cb, pcbWritten);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const STATSTG = extern struct {
pwcsName: ?PWSTR,
type: u32,
cbSize: ULARGE_INTEGER,
mtime: FILETIME,
ctime: FILETIME,
atime: FILETIME,
grfMode: u32,
grfLocksSupported: u32,
clsid: Guid,
grfStateBits: u32,
reserved: u32,
};
pub const STGTY = enum(i32) {
STORAGE = 1,
STREAM = 2,
LOCKBYTES = 3,
PROPERTY = 4,
};
pub const STGTY_STORAGE = STGTY.STORAGE;
pub const STGTY_STREAM = STGTY.STREAM;
pub const STGTY_LOCKBYTES = STGTY.LOCKBYTES;
pub const STGTY_PROPERTY = STGTY.PROPERTY;
pub const STREAM_SEEK = enum(u32) {
SET = 0,
CUR = 1,
END = 2,
};
pub const STREAM_SEEK_SET = STREAM_SEEK.SET;
pub const STREAM_SEEK_CUR = STREAM_SEEK.CUR;
pub const STREAM_SEEK_END = STREAM_SEEK.END;
pub const LOCKTYPE = enum(i32) {
WRITE = 1,
EXCLUSIVE = 2,
ONLYONCE = 4,
};
pub const LOCK_WRITE = LOCKTYPE.WRITE;
pub const LOCK_EXCLUSIVE = LOCKTYPE.EXCLUSIVE;
pub const LOCK_ONLYONCE = LOCKTYPE.ONLYONCE;
// TODO: this type is limited to platform 'windows5.0'
const IID_IStream_Value = @import("../zig.zig").Guid.initString("0000000c-0000-0000-c000-000000000046");
pub const IID_IStream = &IID_IStream_Value;
pub const IStream = extern struct {
pub const VTable = extern struct {
base: ISequentialStream.VTable,
Seek: fn(
self: *const IStream,
dlibMove: LARGE_INTEGER,
dwOrigin: STREAM_SEEK,
plibNewPosition: ?*ULARGE_INTEGER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSize: fn(
self: *const IStream,
libNewSize: ULARGE_INTEGER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CopyTo: fn(
self: *const IStream,
pstm: ?*IStream,
cb: ULARGE_INTEGER,
pcbRead: ?*ULARGE_INTEGER,
pcbWritten: ?*ULARGE_INTEGER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Commit: fn(
self: *const IStream,
grfCommitFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Revert: fn(
self: *const IStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LockRegion: fn(
self: *const IStream,
libOffset: ULARGE_INTEGER,
cb: ULARGE_INTEGER,
dwLockType: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnlockRegion: fn(
self: *const IStream,
libOffset: ULARGE_INTEGER,
cb: ULARGE_INTEGER,
dwLockType: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Stat: fn(
self: *const IStream,
pstatstg: ?*STATSTG,
grfStatFlag: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IStream,
ppstm: ?*?*IStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISequentialStream.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStream_Seek(self: *const T, dlibMove: LARGE_INTEGER, dwOrigin: STREAM_SEEK, plibNewPosition: ?*ULARGE_INTEGER) callconv(.Inline) HRESULT {
return @ptrCast(*const IStream.VTable, self.vtable).Seek(@ptrCast(*const IStream, self), dlibMove, dwOrigin, plibNewPosition);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStream_SetSize(self: *const T, libNewSize: ULARGE_INTEGER) callconv(.Inline) HRESULT {
return @ptrCast(*const IStream.VTable, self.vtable).SetSize(@ptrCast(*const IStream, self), libNewSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStream_CopyTo(self: *const T, pstm: ?*IStream, cb: ULARGE_INTEGER, pcbRead: ?*ULARGE_INTEGER, pcbWritten: ?*ULARGE_INTEGER) callconv(.Inline) HRESULT {
return @ptrCast(*const IStream.VTable, self.vtable).CopyTo(@ptrCast(*const IStream, self), pstm, cb, pcbRead, pcbWritten);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStream_Commit(self: *const T, grfCommitFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IStream.VTable, self.vtable).Commit(@ptrCast(*const IStream, self), grfCommitFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStream_Revert(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IStream.VTable, self.vtable).Revert(@ptrCast(*const IStream, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStream_LockRegion(self: *const T, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IStream.VTable, self.vtable).LockRegion(@ptrCast(*const IStream, self), libOffset, cb, dwLockType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStream_UnlockRegion(self: *const T, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IStream.VTable, self.vtable).UnlockRegion(@ptrCast(*const IStream, self), libOffset, cb, dwLockType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStream_Stat(self: *const T, pstatstg: ?*STATSTG, grfStatFlag: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IStream.VTable, self.vtable).Stat(@ptrCast(*const IStream, self), pstatstg, grfStatFlag);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStream_Clone(self: *const T, ppstm: ?*?*IStream) callconv(.Inline) HRESULT {
return @ptrCast(*const IStream.VTable, self.vtable).Clone(@ptrCast(*const IStream, self), ppstm);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IEnumSTATSTG_Value = @import("../zig.zig").Guid.initString("0000000d-0000-0000-c000-000000000046");
pub const IID_IEnumSTATSTG = &IID_IEnumSTATSTG_Value;
pub const IEnumSTATSTG = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Next: fn(
self: *const IEnumSTATSTG,
celt: u32,
rgelt: [*]STATSTG,
pceltFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const IEnumSTATSTG,
celt: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IEnumSTATSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IEnumSTATSTG,
ppenum: ?*?*IEnumSTATSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATSTG_Next(self: *const T, celt: u32, rgelt: [*]STATSTG, pceltFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATSTG.VTable, self.vtable).Next(@ptrCast(*const IEnumSTATSTG, self), celt, rgelt, pceltFetched);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATSTG_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATSTG.VTable, self.vtable).Skip(@ptrCast(*const IEnumSTATSTG, self), celt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATSTG_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATSTG.VTable, self.vtable).Reset(@ptrCast(*const IEnumSTATSTG, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATSTG_Clone(self: *const T, ppenum: ?*?*IEnumSTATSTG) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATSTG.VTable, self.vtable).Clone(@ptrCast(*const IEnumSTATSTG, self), ppenum);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const RemSNB = extern struct {
ulCntStr: u32,
ulCntChar: u32,
rgString: [1]u16,
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IStorage_Value = @import("../zig.zig").Guid.initString("0000000b-0000-0000-c000-000000000046");
pub const IID_IStorage = &IID_IStorage_Value;
pub const IStorage = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateStream: fn(
self: *const IStorage,
pwcsName: ?[*:0]const u16,
grfMode: u32,
reserved1: u32,
reserved2: u32,
ppstm: ?*?*IStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenStream: fn(
self: *const IStorage,
pwcsName: ?[*:0]const u16,
reserved1: ?*c_void,
grfMode: u32,
reserved2: u32,
ppstm: ?*?*IStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateStorage: fn(
self: *const IStorage,
pwcsName: ?[*:0]const u16,
grfMode: u32,
reserved1: u32,
reserved2: u32,
ppstg: ?*?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenStorage: fn(
self: *const IStorage,
pwcsName: ?[*:0]const u16,
pstgPriority: ?*IStorage,
grfMode: u32,
snbExclude: ?*?*u16,
reserved: u32,
ppstg: ?*?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CopyTo: fn(
self: *const IStorage,
ciidExclude: u32,
rgiidExclude: ?[*]const Guid,
snbExclude: ?*?*u16,
pstgDest: ?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MoveElementTo: fn(
self: *const IStorage,
pwcsName: ?[*:0]const u16,
pstgDest: ?*IStorage,
pwcsNewName: ?[*:0]const u16,
grfFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Commit: fn(
self: *const IStorage,
grfCommitFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Revert: fn(
self: *const IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumElements: fn(
self: *const IStorage,
reserved1: u32,
reserved2: ?*c_void,
reserved3: u32,
ppenum: ?*?*IEnumSTATSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DestroyElement: fn(
self: *const IStorage,
pwcsName: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RenameElement: fn(
self: *const IStorage,
pwcsOldName: ?[*:0]const u16,
pwcsNewName: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetElementTimes: fn(
self: *const IStorage,
pwcsName: ?[*:0]const u16,
pctime: ?*const FILETIME,
patime: ?*const FILETIME,
pmtime: ?*const FILETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetClass: fn(
self: *const IStorage,
clsid: ?*const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetStateBits: fn(
self: *const IStorage,
grfStateBits: u32,
grfMask: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Stat: fn(
self: *const IStorage,
pstatstg: ?*STATSTG,
grfStatFlag: 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 IStorage_CreateStream(self: *const T, pwcsName: ?[*:0]const u16, grfMode: u32, reserved1: u32, reserved2: u32, ppstm: ?*?*IStream) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).CreateStream(@ptrCast(*const IStorage, self), pwcsName, grfMode, reserved1, reserved2, ppstm);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_OpenStream(self: *const T, pwcsName: ?[*:0]const u16, reserved1: ?*c_void, grfMode: u32, reserved2: u32, ppstm: ?*?*IStream) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).OpenStream(@ptrCast(*const IStorage, self), pwcsName, reserved1, grfMode, reserved2, ppstm);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_CreateStorage(self: *const T, pwcsName: ?[*:0]const u16, grfMode: u32, reserved1: u32, reserved2: u32, ppstg: ?*?*IStorage) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).CreateStorage(@ptrCast(*const IStorage, self), pwcsName, grfMode, reserved1, reserved2, ppstg);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_OpenStorage(self: *const T, pwcsName: ?[*:0]const u16, pstgPriority: ?*IStorage, grfMode: u32, snbExclude: ?*?*u16, reserved: u32, ppstg: ?*?*IStorage) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).OpenStorage(@ptrCast(*const IStorage, self), pwcsName, pstgPriority, grfMode, snbExclude, reserved, ppstg);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_CopyTo(self: *const T, ciidExclude: u32, rgiidExclude: ?[*]const Guid, snbExclude: ?*?*u16, pstgDest: ?*IStorage) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).CopyTo(@ptrCast(*const IStorage, self), ciidExclude, rgiidExclude, snbExclude, pstgDest);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_MoveElementTo(self: *const T, pwcsName: ?[*:0]const u16, pstgDest: ?*IStorage, pwcsNewName: ?[*:0]const u16, grfFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).MoveElementTo(@ptrCast(*const IStorage, self), pwcsName, pstgDest, pwcsNewName, grfFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_Commit(self: *const T, grfCommitFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).Commit(@ptrCast(*const IStorage, self), grfCommitFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_Revert(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).Revert(@ptrCast(*const IStorage, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_EnumElements(self: *const T, reserved1: u32, reserved2: ?*c_void, reserved3: u32, ppenum: ?*?*IEnumSTATSTG) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).EnumElements(@ptrCast(*const IStorage, self), reserved1, reserved2, reserved3, ppenum);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_DestroyElement(self: *const T, pwcsName: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).DestroyElement(@ptrCast(*const IStorage, self), pwcsName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_RenameElement(self: *const T, pwcsOldName: ?[*:0]const u16, pwcsNewName: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).RenameElement(@ptrCast(*const IStorage, self), pwcsOldName, pwcsNewName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_SetElementTimes(self: *const T, pwcsName: ?[*:0]const u16, pctime: ?*const FILETIME, patime: ?*const FILETIME, pmtime: ?*const FILETIME) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).SetElementTimes(@ptrCast(*const IStorage, self), pwcsName, pctime, patime, pmtime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_SetClass(self: *const T, clsid: ?*const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).SetClass(@ptrCast(*const IStorage, self), clsid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_SetStateBits(self: *const T, grfStateBits: u32, grfMask: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).SetStateBits(@ptrCast(*const IStorage, self), grfStateBits, grfMask);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStorage_Stat(self: *const T, pstatstg: ?*STATSTG, grfStatFlag: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IStorage.VTable, self.vtable).Stat(@ptrCast(*const IStorage, self), pstatstg, grfStatFlag);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_ILockBytes_Value = @import("../zig.zig").Guid.initString("0000000a-0000-0000-c000-000000000046");
pub const IID_ILockBytes = &IID_ILockBytes_Value;
pub const ILockBytes = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ReadAt: fn(
self: *const ILockBytes,
ulOffset: ULARGE_INTEGER,
// TODO: what to do with BytesParamIndex 2?
pv: ?*c_void,
cb: u32,
pcbRead: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WriteAt: fn(
self: *const ILockBytes,
ulOffset: ULARGE_INTEGER,
// TODO: what to do with BytesParamIndex 2?
pv: ?*const c_void,
cb: u32,
pcbWritten: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Flush: fn(
self: *const ILockBytes,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSize: fn(
self: *const ILockBytes,
cb: ULARGE_INTEGER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LockRegion: fn(
self: *const ILockBytes,
libOffset: ULARGE_INTEGER,
cb: ULARGE_INTEGER,
dwLockType: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnlockRegion: fn(
self: *const ILockBytes,
libOffset: ULARGE_INTEGER,
cb: ULARGE_INTEGER,
dwLockType: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Stat: fn(
self: *const ILockBytes,
pstatstg: ?*STATSTG,
grfStatFlag: 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 ILockBytes_ReadAt(self: *const T, ulOffset: ULARGE_INTEGER, pv: ?*c_void, cb: u32, pcbRead: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ILockBytes.VTable, self.vtable).ReadAt(@ptrCast(*const ILockBytes, self), ulOffset, pv, cb, pcbRead);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILockBytes_WriteAt(self: *const T, ulOffset: ULARGE_INTEGER, pv: ?*const c_void, cb: u32, pcbWritten: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ILockBytes.VTable, self.vtable).WriteAt(@ptrCast(*const ILockBytes, self), ulOffset, pv, cb, pcbWritten);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILockBytes_Flush(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ILockBytes.VTable, self.vtable).Flush(@ptrCast(*const ILockBytes, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILockBytes_SetSize(self: *const T, cb: ULARGE_INTEGER) callconv(.Inline) HRESULT {
return @ptrCast(*const ILockBytes.VTable, self.vtable).SetSize(@ptrCast(*const ILockBytes, self), cb);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILockBytes_LockRegion(self: *const T, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ILockBytes.VTable, self.vtable).LockRegion(@ptrCast(*const ILockBytes, self), libOffset, cb, dwLockType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILockBytes_UnlockRegion(self: *const T, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ILockBytes.VTable, self.vtable).UnlockRegion(@ptrCast(*const ILockBytes, self), libOffset, cb, dwLockType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILockBytes_Stat(self: *const T, pstatstg: ?*STATSTG, grfStatFlag: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ILockBytes.VTable, self.vtable).Stat(@ptrCast(*const ILockBytes, self), pstatstg, grfStatFlag);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IRootStorage_Value = @import("../zig.zig").Guid.initString("00000012-0000-0000-c000-000000000046");
pub const IID_IRootStorage = &IID_IRootStorage_Value;
pub const IRootStorage = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SwitchToFile: fn(
self: *const IRootStorage,
pszFile: ?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 IRootStorage_SwitchToFile(self: *const T, pszFile: ?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IRootStorage.VTable, self.vtable).SwitchToFile(@ptrCast(*const IRootStorage, self), pszFile);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IFillLockBytes_Value = @import("../zig.zig").Guid.initString("99caf010-415e-11cf-8814-00aa00b569f5");
pub const IID_IFillLockBytes = &IID_IFillLockBytes_Value;
pub const IFillLockBytes = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
FillAppend: fn(
self: *const IFillLockBytes,
// TODO: what to do with BytesParamIndex 1?
pv: ?*const c_void,
cb: u32,
pcbWritten: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
FillAt: fn(
self: *const IFillLockBytes,
ulOffset: ULARGE_INTEGER,
// TODO: what to do with BytesParamIndex 2?
pv: ?*const c_void,
cb: u32,
pcbWritten: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetFillSize: fn(
self: *const IFillLockBytes,
ulSize: ULARGE_INTEGER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Terminate: fn(
self: *const IFillLockBytes,
bCanceled: 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 IFillLockBytes_FillAppend(self: *const T, pv: ?*const c_void, cb: u32, pcbWritten: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IFillLockBytes.VTable, self.vtable).FillAppend(@ptrCast(*const IFillLockBytes, self), pv, cb, pcbWritten);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IFillLockBytes_FillAt(self: *const T, ulOffset: ULARGE_INTEGER, pv: ?*const c_void, cb: u32, pcbWritten: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IFillLockBytes.VTable, self.vtable).FillAt(@ptrCast(*const IFillLockBytes, self), ulOffset, pv, cb, pcbWritten);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IFillLockBytes_SetFillSize(self: *const T, ulSize: ULARGE_INTEGER) callconv(.Inline) HRESULT {
return @ptrCast(*const IFillLockBytes.VTable, self.vtable).SetFillSize(@ptrCast(*const IFillLockBytes, self), ulSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IFillLockBytes_Terminate(self: *const T, bCanceled: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IFillLockBytes.VTable, self.vtable).Terminate(@ptrCast(*const IFillLockBytes, self), bCanceled);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const StorageLayout = extern struct {
LayoutType: u32,
pwcsElementName: ?PWSTR,
cOffset: LARGE_INTEGER,
cBytes: LARGE_INTEGER,
};
// TODO: this type is limited to platform 'windows5.0'
const IID_ILayoutStorage_Value = @import("../zig.zig").Guid.initString("0e6d4d90-6738-11cf-9608-00aa00680db4");
pub const IID_ILayoutStorage = &IID_ILayoutStorage_Value;
pub const ILayoutStorage = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
LayoutScript: fn(
self: *const ILayoutStorage,
pStorageLayout: [*]StorageLayout,
nEntries: u32,
glfInterleavedFlag: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BeginMonitor: fn(
self: *const ILayoutStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EndMonitor: fn(
self: *const ILayoutStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReLayoutDocfile: fn(
self: *const ILayoutStorage,
pwcsNewDfName: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReLayoutDocfileOnILockBytes: fn(
self: *const ILayoutStorage,
pILockBytes: ?*ILockBytes,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILayoutStorage_LayoutScript(self: *const T, pStorageLayout: [*]StorageLayout, nEntries: u32, glfInterleavedFlag: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ILayoutStorage.VTable, self.vtable).LayoutScript(@ptrCast(*const ILayoutStorage, self), pStorageLayout, nEntries, glfInterleavedFlag);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILayoutStorage_BeginMonitor(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ILayoutStorage.VTable, self.vtable).BeginMonitor(@ptrCast(*const ILayoutStorage, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILayoutStorage_EndMonitor(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ILayoutStorage.VTable, self.vtable).EndMonitor(@ptrCast(*const ILayoutStorage, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILayoutStorage_ReLayoutDocfile(self: *const T, pwcsNewDfName: ?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ILayoutStorage.VTable, self.vtable).ReLayoutDocfile(@ptrCast(*const ILayoutStorage, self), pwcsNewDfName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILayoutStorage_ReLayoutDocfileOnILockBytes(self: *const T, pILockBytes: ?*ILockBytes) callconv(.Inline) HRESULT {
return @ptrCast(*const ILayoutStorage.VTable, self.vtable).ReLayoutDocfileOnILockBytes(@ptrCast(*const ILayoutStorage, self), pILockBytes);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IDirectWriterLock_Value = @import("../zig.zig").Guid.initString("0e6d4d92-6738-11cf-9608-00aa00680db4");
pub const IID_IDirectWriterLock = &IID_IDirectWriterLock_Value;
pub const IDirectWriterLock = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
WaitForWriteAccess: fn(
self: *const IDirectWriterLock,
dwTimeout: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReleaseWriteAccess: fn(
self: *const IDirectWriterLock,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
HaveWriteAccess: fn(
self: *const IDirectWriterLock,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectWriterLock_WaitForWriteAccess(self: *const T, dwTimeout: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectWriterLock.VTable, self.vtable).WaitForWriteAccess(@ptrCast(*const IDirectWriterLock, self), dwTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectWriterLock_ReleaseWriteAccess(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectWriterLock.VTable, self.vtable).ReleaseWriteAccess(@ptrCast(*const IDirectWriterLock, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectWriterLock_HaveWriteAccess(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectWriterLock.VTable, self.vtable).HaveWriteAccess(@ptrCast(*const IDirectWriterLock, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const VERSIONEDSTREAM = extern struct {
guidVersion: Guid,
pStream: ?*IStream,
};
pub const CAC = extern struct {
cElems: u32,
pElems: ?PSTR,
};
pub const CAUB = extern struct {
cElems: u32,
pElems: ?*u8,
};
pub const CAI = extern struct {
cElems: u32,
pElems: ?*i16,
};
pub const CAUI = extern struct {
cElems: u32,
pElems: ?*u16,
};
pub const CAL = extern struct {
cElems: u32,
pElems: ?*i32,
};
pub const CAUL = extern struct {
cElems: u32,
pElems: ?*u32,
};
pub const CAFLT = extern struct {
cElems: u32,
pElems: ?*f32,
};
pub const CADBL = extern struct {
cElems: u32,
pElems: ?*f64,
};
pub const CACY = extern struct {
cElems: u32,
pElems: ?*CY,
};
pub const CADATE = extern struct {
cElems: u32,
pElems: ?*f64,
};
pub const CABSTR = extern struct {
cElems: u32,
pElems: ?*?BSTR,
};
pub const CABSTRBLOB = extern struct {
cElems: u32,
pElems: ?*BSTRBLOB,
};
pub const CABOOL = extern struct {
cElems: u32,
pElems: ?*i16,
};
pub const CASCODE = extern struct {
cElems: u32,
pElems: ?*i32,
};
pub const CAPROPVARIANT = extern struct {
cElems: u32,
pElems: ?*PROPVARIANT,
};
pub const CAH = extern struct {
cElems: u32,
pElems: ?*LARGE_INTEGER,
};
pub const CAUH = extern struct {
cElems: u32,
pElems: ?*ULARGE_INTEGER,
};
pub const CALPSTR = extern struct {
cElems: u32,
pElems: ?*?PSTR,
};
pub const CALPWSTR = extern struct {
cElems: u32,
pElems: ?*?PWSTR,
};
pub const CAFILETIME = extern struct {
cElems: u32,
pElems: ?*FILETIME,
};
pub const CACLIPDATA = extern struct {
cElems: u32,
pElems: ?*CLIPDATA,
};
pub const CACLSID = extern struct {
cElems: u32,
pElems: ?*Guid,
};
pub const PROPVARIANT = extern struct {
Anonymous: extern union {
Anonymous: extern struct {
vt: u16,
wReserved1: u16,
wReserved2: u16,
wReserved3: u16,
Anonymous: extern union {
cVal: CHAR,
bVal: u8,
iVal: i16,
uiVal: u16,
lVal: i32,
ulVal: u32,
intVal: i32,
uintVal: u32,
hVal: LARGE_INTEGER,
uhVal: ULARGE_INTEGER,
fltVal: f32,
dblVal: f64,
boolVal: i16,
__OBSOLETE__VARIANT_BOOL: i16,
scode: i32,
cyVal: CY,
date: f64,
filetime: FILETIME,
puuid: ?*Guid,
pclipdata: ?*CLIPDATA,
bstrVal: ?BSTR,
bstrblobVal: BSTRBLOB,
blob: BLOB,
pszVal: ?PSTR,
pwszVal: ?PWSTR,
punkVal: ?*IUnknown,
pdispVal: ?*IDispatch,
pStream: ?*IStream,
pStorage: ?*IStorage,
pVersionedStream: ?*VERSIONEDSTREAM,
parray: ?*SAFEARRAY,
cac: CAC,
caub: CAUB,
cai: CAI,
caui: CAUI,
cal: CAL,
caul: CAUL,
cah: CAH,
cauh: CAUH,
caflt: CAFLT,
cadbl: CADBL,
cabool: CABOOL,
cascode: CASCODE,
cacy: CACY,
cadate: CADATE,
cafiletime: CAFILETIME,
cauuid: CACLSID,
caclipdata: CACLIPDATA,
cabstr: CABSTR,
cabstrblob: CABSTRBLOB,
calpstr: CALPSTR,
calpwstr: CALPWSTR,
capropvar: CAPROPVARIANT,
pcVal: ?PSTR,
pbVal: ?*u8,
piVal: ?*i16,
puiVal: ?*u16,
plVal: ?*i32,
pulVal: ?*u32,
pintVal: ?*i32,
puintVal: ?*u32,
pfltVal: ?*f32,
pdblVal: ?*f64,
pboolVal: ?*i16,
pdecVal: ?*DECIMAL,
pscode: ?*i32,
pcyVal: ?*CY,
pdate: ?*f64,
pbstrVal: ?*?BSTR,
ppunkVal: ?*?*IUnknown,
ppdispVal: ?*?*IDispatch,
pparray: ?*?*SAFEARRAY,
pvarVal: ?*PROPVARIANT,
},
},
decVal: DECIMAL,
},
};
pub const PROPSPEC = extern struct {
ulKind: PROPSPEC_KIND,
Anonymous: extern union {
propid: u32,
lpwstr: ?PWSTR,
},
};
pub const STATPROPSTG = extern struct {
lpwstrName: ?PWSTR,
propid: u32,
vt: u16,
};
pub const STATPROPSETSTG = extern struct {
fmtid: Guid,
clsid: Guid,
grfFlags: u32,
mtime: FILETIME,
ctime: FILETIME,
atime: FILETIME,
dwOSVersion: u32,
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IPropertyStorage_Value = @import("../zig.zig").Guid.initString("00000138-0000-0000-c000-000000000046");
pub const IID_IPropertyStorage = &IID_IPropertyStorage_Value;
pub const IPropertyStorage = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ReadMultiple: fn(
self: *const IPropertyStorage,
cpspec: u32,
rgpspec: [*]const PROPSPEC,
rgpropvar: [*]PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WriteMultiple: fn(
self: *const IPropertyStorage,
cpspec: u32,
rgpspec: [*]const PROPSPEC,
rgpropvar: [*]const PROPVARIANT,
propidNameFirst: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteMultiple: fn(
self: *const IPropertyStorage,
cpspec: u32,
rgpspec: [*]const PROPSPEC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReadPropertyNames: fn(
self: *const IPropertyStorage,
cpropid: u32,
rgpropid: [*]const u32,
rglpwstrName: [*]?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WritePropertyNames: fn(
self: *const IPropertyStorage,
cpropid: u32,
rgpropid: [*]const u32,
rglpwstrName: [*]const ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeletePropertyNames: fn(
self: *const IPropertyStorage,
cpropid: u32,
rgpropid: [*]const u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Commit: fn(
self: *const IPropertyStorage,
grfCommitFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Revert: fn(
self: *const IPropertyStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Enum: fn(
self: *const IPropertyStorage,
ppenum: ?*?*IEnumSTATPROPSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTimes: fn(
self: *const IPropertyStorage,
pctime: ?*const FILETIME,
patime: ?*const FILETIME,
pmtime: ?*const FILETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetClass: fn(
self: *const IPropertyStorage,
clsid: ?*const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Stat: fn(
self: *const IPropertyStorage,
pstatpsstg: ?*STATPROPSETSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_ReadMultiple(self: *const T, cpspec: u32, rgpspec: [*]const PROPSPEC, rgpropvar: [*]PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).ReadMultiple(@ptrCast(*const IPropertyStorage, self), cpspec, rgpspec, rgpropvar);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_WriteMultiple(self: *const T, cpspec: u32, rgpspec: [*]const PROPSPEC, rgpropvar: [*]const PROPVARIANT, propidNameFirst: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).WriteMultiple(@ptrCast(*const IPropertyStorage, self), cpspec, rgpspec, rgpropvar, propidNameFirst);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_DeleteMultiple(self: *const T, cpspec: u32, rgpspec: [*]const PROPSPEC) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).DeleteMultiple(@ptrCast(*const IPropertyStorage, self), cpspec, rgpspec);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_ReadPropertyNames(self: *const T, cpropid: u32, rgpropid: [*]const u32, rglpwstrName: [*]?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).ReadPropertyNames(@ptrCast(*const IPropertyStorage, self), cpropid, rgpropid, rglpwstrName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_WritePropertyNames(self: *const T, cpropid: u32, rgpropid: [*]const u32, rglpwstrName: [*]const ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).WritePropertyNames(@ptrCast(*const IPropertyStorage, self), cpropid, rgpropid, rglpwstrName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_DeletePropertyNames(self: *const T, cpropid: u32, rgpropid: [*]const u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).DeletePropertyNames(@ptrCast(*const IPropertyStorage, self), cpropid, rgpropid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_Commit(self: *const T, grfCommitFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).Commit(@ptrCast(*const IPropertyStorage, self), grfCommitFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_Revert(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).Revert(@ptrCast(*const IPropertyStorage, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_Enum(self: *const T, ppenum: ?*?*IEnumSTATPROPSTG) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).Enum(@ptrCast(*const IPropertyStorage, self), ppenum);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_SetTimes(self: *const T, pctime: ?*const FILETIME, patime: ?*const FILETIME, pmtime: ?*const FILETIME) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).SetTimes(@ptrCast(*const IPropertyStorage, self), pctime, patime, pmtime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_SetClass(self: *const T, clsid: ?*const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).SetClass(@ptrCast(*const IPropertyStorage, self), clsid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertyStorage_Stat(self: *const T, pstatpsstg: ?*STATPROPSETSTG) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertyStorage.VTable, self.vtable).Stat(@ptrCast(*const IPropertyStorage, self), pstatpsstg);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IPropertySetStorage_Value = @import("../zig.zig").Guid.initString("0000013a-0000-0000-c000-000000000046");
pub const IID_IPropertySetStorage = &IID_IPropertySetStorage_Value;
pub const IPropertySetStorage = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Create: fn(
self: *const IPropertySetStorage,
rfmtid: ?*const Guid,
pclsid: ?*const Guid,
grfFlags: u32,
grfMode: u32,
ppprstg: ?*?*IPropertyStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Open: fn(
self: *const IPropertySetStorage,
rfmtid: ?*const Guid,
grfMode: u32,
ppprstg: ?*?*IPropertyStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Delete: fn(
self: *const IPropertySetStorage,
rfmtid: ?*const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Enum: fn(
self: *const IPropertySetStorage,
ppenum: ?*?*IEnumSTATPROPSETSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertySetStorage_Create(self: *const T, rfmtid: ?*const Guid, pclsid: ?*const Guid, grfFlags: u32, grfMode: u32, ppprstg: ?*?*IPropertyStorage) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertySetStorage.VTable, self.vtable).Create(@ptrCast(*const IPropertySetStorage, self), rfmtid, pclsid, grfFlags, grfMode, ppprstg);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertySetStorage_Open(self: *const T, rfmtid: ?*const Guid, grfMode: u32, ppprstg: ?*?*IPropertyStorage) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertySetStorage.VTable, self.vtable).Open(@ptrCast(*const IPropertySetStorage, self), rfmtid, grfMode, ppprstg);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertySetStorage_Delete(self: *const T, rfmtid: ?*const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertySetStorage.VTable, self.vtable).Delete(@ptrCast(*const IPropertySetStorage, self), rfmtid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IPropertySetStorage_Enum(self: *const T, ppenum: ?*?*IEnumSTATPROPSETSTG) callconv(.Inline) HRESULT {
return @ptrCast(*const IPropertySetStorage.VTable, self.vtable).Enum(@ptrCast(*const IPropertySetStorage, self), ppenum);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IEnumSTATPROPSTG_Value = @import("../zig.zig").Guid.initString("00000139-0000-0000-c000-000000000046");
pub const IID_IEnumSTATPROPSTG = &IID_IEnumSTATPROPSTG_Value;
pub const IEnumSTATPROPSTG = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Next: fn(
self: *const IEnumSTATPROPSTG,
celt: u32,
rgelt: [*]STATPROPSTG,
pceltFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const IEnumSTATPROPSTG,
celt: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IEnumSTATPROPSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IEnumSTATPROPSTG,
ppenum: ?*?*IEnumSTATPROPSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATPROPSTG_Next(self: *const T, celt: u32, rgelt: [*]STATPROPSTG, pceltFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATPROPSTG.VTable, self.vtable).Next(@ptrCast(*const IEnumSTATPROPSTG, self), celt, rgelt, pceltFetched);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATPROPSTG_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATPROPSTG.VTable, self.vtable).Skip(@ptrCast(*const IEnumSTATPROPSTG, self), celt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATPROPSTG_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATPROPSTG.VTable, self.vtable).Reset(@ptrCast(*const IEnumSTATPROPSTG, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATPROPSTG_Clone(self: *const T, ppenum: ?*?*IEnumSTATPROPSTG) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATPROPSTG.VTable, self.vtable).Clone(@ptrCast(*const IEnumSTATPROPSTG, self), ppenum);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IEnumSTATPROPSETSTG_Value = @import("../zig.zig").Guid.initString("0000013b-0000-0000-c000-000000000046");
pub const IID_IEnumSTATPROPSETSTG = &IID_IEnumSTATPROPSETSTG_Value;
pub const IEnumSTATPROPSETSTG = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Next: fn(
self: *const IEnumSTATPROPSETSTG,
celt: u32,
rgelt: [*]STATPROPSETSTG,
pceltFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const IEnumSTATPROPSETSTG,
celt: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IEnumSTATPROPSETSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IEnumSTATPROPSETSTG,
ppenum: ?*?*IEnumSTATPROPSETSTG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATPROPSETSTG_Next(self: *const T, celt: u32, rgelt: [*]STATPROPSETSTG, pceltFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATPROPSETSTG.VTable, self.vtable).Next(@ptrCast(*const IEnumSTATPROPSETSTG, self), celt, rgelt, pceltFetched);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATPROPSETSTG_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATPROPSETSTG.VTable, self.vtable).Skip(@ptrCast(*const IEnumSTATPROPSETSTG, self), celt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATPROPSETSTG_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATPROPSETSTG.VTable, self.vtable).Reset(@ptrCast(*const IEnumSTATPROPSETSTG, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSTATPROPSETSTG_Clone(self: *const T, ppenum: ?*?*IEnumSTATPROPSETSTG) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSTATPROPSETSTG.VTable, self.vtable).Clone(@ptrCast(*const IEnumSTATPROPSETSTG, self), ppenum);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const STGOPTIONS = extern struct {
usVersion: u16,
reserved: u16,
ulSectorSize: u32,
pwcsTemplateFile: ?[*:0]const u16,
};
pub const PIDMSI_STATUS_VALUE = enum(i32) {
NORMAL = 0,
NEW = 1,
PRELIM = 2,
DRAFT = 3,
INPROGRESS = 4,
EDIT = 5,
REVIEW = 6,
PROOF = 7,
FINAL = 8,
OTHER = 32767,
};
pub const PIDMSI_STATUS_NORMAL = PIDMSI_STATUS_VALUE.NORMAL;
pub const PIDMSI_STATUS_NEW = PIDMSI_STATUS_VALUE.NEW;
pub const PIDMSI_STATUS_PRELIM = PIDMSI_STATUS_VALUE.PRELIM;
pub const PIDMSI_STATUS_DRAFT = PIDMSI_STATUS_VALUE.DRAFT;
pub const PIDMSI_STATUS_INPROGRESS = PIDMSI_STATUS_VALUE.INPROGRESS;
pub const PIDMSI_STATUS_EDIT = PIDMSI_STATUS_VALUE.EDIT;
pub const PIDMSI_STATUS_REVIEW = PIDMSI_STATUS_VALUE.REVIEW;
pub const PIDMSI_STATUS_PROOF = PIDMSI_STATUS_VALUE.PROOF;
pub const PIDMSI_STATUS_FINAL = PIDMSI_STATUS_VALUE.FINAL;
pub const PIDMSI_STATUS_OTHER = PIDMSI_STATUS_VALUE.OTHER;
pub const SERIALIZEDPROPERTYVALUE = extern struct {
dwType: u32,
rgb: [1]u8,
};
pub const JET_PFNSTATUS = fn(
sesid: ?JET_SESID,
snp: u32,
snt: u32,
pv: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) i32;
pub const JET_RSTMAP_A = extern struct {
szDatabaseName: ?PSTR,
szNewDatabaseName: ?PSTR,
};
pub const JET_RSTMAP_W = extern struct {
szDatabaseName: ?PWSTR,
szNewDatabaseName: ?PWSTR,
};
pub const CONVERT_A = extern struct {
szOldDll: ?PSTR,
Anonymous: extern union {
fFlags: u32,
Anonymous: extern struct {
_bitfield: u32,
},
},
};
pub const CONVERT_W = extern struct {
szOldDll: ?PWSTR,
Anonymous: extern union {
fFlags: u32,
Anonymous: extern struct {
_bitfield: u32,
},
},
};
pub const JET_CALLBACK = fn(
sesid: ?JET_SESID,
dbid: u32,
tableid: JET_TABLEID,
cbtyp: u32,
pvArg1: ?*c_void,
pvArg2: ?*c_void,
pvContext: ?*c_void,
ulUnused: JET_API_PTR,
) callconv(@import("std").os.windows.WINAPI) i32;
pub const JET_SNPROG = extern struct {
cbStruct: u32,
cunitDone: u32,
cunitTotal: u32,
};
pub const JET_DBINFOUPGRADE = extern struct {
cbStruct: u32,
cbFilesizeLow: u32,
cbFilesizeHigh: u32,
cbFreeSpaceRequiredLow: u32,
cbFreeSpaceRequiredHigh: u32,
csecToUpgrade: u32,
Anonymous: extern union {
ulFlags: u32,
Anonymous: extern struct {
_bitfield: u32,
},
},
};
pub const JET_OBJECTLIST = extern struct {
cbStruct: u32,
tableid: JET_TABLEID,
cRecord: u32,
columnidcontainername: u32,
columnidobjectname: u32,
columnidobjtyp: u32,
columniddtCreate: u32,
columniddtUpdate: u32,
columnidgrbit: u32,
columnidflags: u32,
columnidcRecord: u32,
columnidcPage: u32,
};
pub const JET_COLUMNLIST = extern struct {
cbStruct: u32,
tableid: JET_TABLEID,
cRecord: u32,
columnidPresentationOrder: u32,
columnidcolumnname: u32,
columnidcolumnid: u32,
columnidcoltyp: u32,
columnidCountry: u32,
columnidLangid: u32,
columnidCp: u32,
columnidCollate: u32,
columnidcbMax: u32,
columnidgrbit: u32,
columnidDefault: u32,
columnidBaseTableName: u32,
columnidBaseColumnName: u32,
columnidDefinitionName: u32,
};
pub const JET_COLUMNDEF = extern struct {
cbStruct: u32,
columnid: u32,
coltyp: u32,
wCountry: u16,
langid: u16,
cp: u16,
wCollate: u16,
cbMax: u32,
grbit: u32,
};
pub const JET_COLUMNBASE_A = extern struct {
cbStruct: u32,
columnid: u32,
coltyp: u32,
wCountry: u16,
langid: u16,
cp: u16,
wFiller: u16,
cbMax: u32,
grbit: u32,
szBaseTableName: [256]CHAR,
szBaseColumnName: [256]CHAR,
};
pub const JET_COLUMNBASE_W = extern struct {
cbStruct: u32,
columnid: u32,
coltyp: u32,
wCountry: u16,
langid: u16,
cp: u16,
wFiller: u16,
cbMax: u32,
grbit: u32,
szBaseTableName: [256]u16,
szBaseColumnName: [256]u16,
};
pub const JET_INDEXLIST = extern struct {
cbStruct: u32,
tableid: JET_TABLEID,
cRecord: u32,
columnidindexname: u32,
columnidgrbitIndex: u32,
columnidcKey: u32,
columnidcEntry: u32,
columnidcPage: u32,
columnidcColumn: u32,
columnidiColumn: u32,
columnidcolumnid: u32,
columnidcoltyp: u32,
columnidCountry: u32,
columnidLangid: u32,
columnidCp: u32,
columnidCollate: u32,
columnidgrbitColumn: u32,
columnidcolumnname: u32,
columnidLCMapFlags: u32,
};
pub const JET_COLUMNCREATE_A = extern struct {
cbStruct: u32,
szColumnName: ?PSTR,
coltyp: u32,
cbMax: u32,
grbit: u32,
pvDefault: ?*c_void,
cbDefault: u32,
cp: u32,
columnid: u32,
err: i32,
};
pub const JET_COLUMNCREATE_W = extern struct {
cbStruct: u32,
szColumnName: ?PWSTR,
coltyp: u32,
cbMax: u32,
grbit: u32,
pvDefault: ?*c_void,
cbDefault: u32,
cp: u32,
columnid: u32,
err: i32,
};
pub const JET_USERDEFINEDDEFAULT_A = extern struct {
szCallback: ?PSTR,
pbUserData: ?*u8,
cbUserData: u32,
szDependantColumns: ?PSTR,
};
pub const JET_USERDEFINEDDEFAULT_W = extern struct {
szCallback: ?PWSTR,
pbUserData: ?*u8,
cbUserData: u32,
szDependantColumns: ?PWSTR,
};
pub const JET_CONDITIONALCOLUMN_A = extern struct {
cbStruct: u32,
szColumnName: ?PSTR,
grbit: u32,
};
pub const JET_CONDITIONALCOLUMN_W = extern struct {
cbStruct: u32,
szColumnName: ?PWSTR,
grbit: u32,
};
pub const JET_UNICODEINDEX = extern struct {
lcid: u32,
dwMapFlags: u32,
};
pub const JET_UNICODEINDEX2 = extern struct {
szLocaleName: ?PWSTR,
dwMapFlags: u32,
};
pub const JET_TUPLELIMITS = extern struct {
chLengthMin: u32,
chLengthMax: u32,
chToIndexMax: u32,
cchIncrement: u32,
ichStart: u32,
};
pub const JET_SPACEHINTS = extern struct {
cbStruct: u32,
ulInitialDensity: u32,
cbInitial: u32,
grbit: u32,
ulMaintDensity: u32,
ulGrowth: u32,
cbMinExtent: u32,
cbMaxExtent: u32,
};
pub const JET_INDEXCREATE_A = extern struct {
cbStruct: u32,
szIndexName: ?PSTR,
szKey: ?PSTR,
cbKey: u32,
grbit: u32,
ulDensity: u32,
Anonymous1: extern union {
lcid: u32,
pidxunicode: ?*JET_UNICODEINDEX,
},
Anonymous2: extern union {
cbVarSegMac: u32,
ptuplelimits: ?*JET_TUPLELIMITS,
},
rgconditionalcolumn: ?*JET_CONDITIONALCOLUMN_A,
cConditionalColumn: u32,
err: i32,
cbKeyMost: u32,
};
pub const JET_INDEXCREATE_W = extern struct {
cbStruct: u32,
szIndexName: ?PWSTR,
szKey: ?PWSTR,
cbKey: u32,
grbit: u32,
ulDensity: u32,
Anonymous1: extern union {
lcid: u32,
pidxunicode: ?*JET_UNICODEINDEX,
},
Anonymous2: extern union {
cbVarSegMac: u32,
ptuplelimits: ?*JET_TUPLELIMITS,
},
rgconditionalcolumn: ?*JET_CONDITIONALCOLUMN_W,
cConditionalColumn: u32,
err: i32,
cbKeyMost: u32,
};
pub const JET_INDEXCREATE2_A = extern struct {
cbStruct: u32,
szIndexName: ?PSTR,
szKey: ?PSTR,
cbKey: u32,
grbit: u32,
ulDensity: u32,
Anonymous1: extern union {
lcid: u32,
pidxunicode: ?*JET_UNICODEINDEX,
},
Anonymous2: extern union {
cbVarSegMac: u32,
ptuplelimits: ?*JET_TUPLELIMITS,
},
rgconditionalcolumn: ?*JET_CONDITIONALCOLUMN_A,
cConditionalColumn: u32,
err: i32,
cbKeyMost: u32,
pSpacehints: ?*JET_SPACEHINTS,
};
pub const JET_INDEXCREATE2_W = extern struct {
cbStruct: u32,
szIndexName: ?PWSTR,
szKey: ?PWSTR,
cbKey: u32,
grbit: u32,
ulDensity: u32,
Anonymous1: extern union {
lcid: u32,
pidxunicode: ?*JET_UNICODEINDEX,
},
Anonymous2: extern union {
cbVarSegMac: u32,
ptuplelimits: ?*JET_TUPLELIMITS,
},
rgconditionalcolumn: ?*JET_CONDITIONALCOLUMN_W,
cConditionalColumn: u32,
err: i32,
cbKeyMost: u32,
pSpacehints: ?*JET_SPACEHINTS,
};
pub const JET_INDEXCREATE3_A = extern struct {
cbStruct: u32,
szIndexName: ?PSTR,
szKey: ?PSTR,
cbKey: u32,
grbit: u32,
ulDensity: u32,
pidxunicode: ?*JET_UNICODEINDEX2,
Anonymous: extern union {
cbVarSegMac: u32,
ptuplelimits: ?*JET_TUPLELIMITS,
},
rgconditionalcolumn: ?*JET_CONDITIONALCOLUMN_A,
cConditionalColumn: u32,
err: i32,
cbKeyMost: u32,
pSpacehints: ?*JET_SPACEHINTS,
};
pub const JET_INDEXCREATE3_W = extern struct {
cbStruct: u32,
szIndexName: ?PWSTR,
szKey: ?PWSTR,
cbKey: u32,
grbit: u32,
ulDensity: u32,
pidxunicode: ?*JET_UNICODEINDEX2,
Anonymous: extern union {
cbVarSegMac: u32,
ptuplelimits: ?*JET_TUPLELIMITS,
},
rgconditionalcolumn: ?*JET_CONDITIONALCOLUMN_W,
cConditionalColumn: u32,
err: i32,
cbKeyMost: u32,
pSpacehints: ?*JET_SPACEHINTS,
};
pub const JET_TABLECREATE_A = extern struct {
cbStruct: u32,
szTableName: ?PSTR,
szTemplateTableName: ?PSTR,
ulPages: u32,
ulDensity: u32,
rgcolumncreate: ?*JET_COLUMNCREATE_A,
cColumns: u32,
rgindexcreate: ?*JET_INDEXCREATE_A,
cIndexes: u32,
grbit: u32,
tableid: JET_TABLEID,
cCreated: u32,
};
pub const JET_TABLECREATE_W = extern struct {
cbStruct: u32,
szTableName: ?PWSTR,
szTemplateTableName: ?PWSTR,
ulPages: u32,
ulDensity: u32,
rgcolumncreate: ?*JET_COLUMNCREATE_W,
cColumns: u32,
rgindexcreate: ?*JET_INDEXCREATE_W,
cIndexes: u32,
grbit: u32,
tableid: JET_TABLEID,
cCreated: u32,
};
pub const JET_TABLECREATE2_A = extern struct {
cbStruct: u32,
szTableName: ?PSTR,
szTemplateTableName: ?PSTR,
ulPages: u32,
ulDensity: u32,
rgcolumncreate: ?*JET_COLUMNCREATE_A,
cColumns: u32,
rgindexcreate: ?*JET_INDEXCREATE_A,
cIndexes: u32,
szCallback: ?PSTR,
cbtyp: u32,
grbit: u32,
tableid: JET_TABLEID,
cCreated: u32,
};
pub const JET_TABLECREATE2_W = extern struct {
cbStruct: u32,
szTableName: ?PWSTR,
szTemplateTableName: ?PWSTR,
ulPages: u32,
ulDensity: u32,
rgcolumncreate: ?*JET_COLUMNCREATE_W,
cColumns: u32,
rgindexcreate: ?*JET_INDEXCREATE_W,
cIndexes: u32,
szCallback: ?PWSTR,
cbtyp: u32,
grbit: u32,
tableid: JET_TABLEID,
cCreated: u32,
};
pub const JET_TABLECREATE3_A = extern struct {
cbStruct: u32,
szTableName: ?PSTR,
szTemplateTableName: ?PSTR,
ulPages: u32,
ulDensity: u32,
rgcolumncreate: ?*JET_COLUMNCREATE_A,
cColumns: u32,
rgindexcreate: ?*JET_INDEXCREATE2_A,
cIndexes: u32,
szCallback: ?PSTR,
cbtyp: u32,
grbit: u32,
pSeqSpacehints: ?*JET_SPACEHINTS,
pLVSpacehints: ?*JET_SPACEHINTS,
cbSeparateLV: u32,
tableid: JET_TABLEID,
cCreated: u32,
};
pub const JET_TABLECREATE3_W = extern struct {
cbStruct: u32,
szTableName: ?PWSTR,
szTemplateTableName: ?PWSTR,
ulPages: u32,
ulDensity: u32,
rgcolumncreate: ?*JET_COLUMNCREATE_W,
cColumns: u32,
rgindexcreate: ?*JET_INDEXCREATE2_W,
cIndexes: u32,
szCallback: ?PWSTR,
cbtyp: u32,
grbit: u32,
pSeqSpacehints: ?*JET_SPACEHINTS,
pLVSpacehints: ?*JET_SPACEHINTS,
cbSeparateLV: u32,
tableid: JET_TABLEID,
cCreated: u32,
};
pub const JET_TABLECREATE4_A = extern struct {
cbStruct: u32,
szTableName: ?PSTR,
szTemplateTableName: ?PSTR,
ulPages: u32,
ulDensity: u32,
rgcolumncreate: ?*JET_COLUMNCREATE_A,
cColumns: u32,
rgindexcreate: ?*JET_INDEXCREATE3_A,
cIndexes: u32,
szCallback: ?PSTR,
cbtyp: u32,
grbit: u32,
pSeqSpacehints: ?*JET_SPACEHINTS,
pLVSpacehints: ?*JET_SPACEHINTS,
cbSeparateLV: u32,
tableid: JET_TABLEID,
cCreated: u32,
};
pub const JET_TABLECREATE4_W = extern struct {
cbStruct: u32,
szTableName: ?PWSTR,
szTemplateTableName: ?PWSTR,
ulPages: u32,
ulDensity: u32,
rgcolumncreate: ?*JET_COLUMNCREATE_W,
cColumns: u32,
rgindexcreate: ?*JET_INDEXCREATE3_W,
cIndexes: u32,
szCallback: ?PWSTR,
cbtyp: u32,
grbit: u32,
pSeqSpacehints: ?*JET_SPACEHINTS,
pLVSpacehints: ?*JET_SPACEHINTS,
cbSeparateLV: u32,
tableid: JET_TABLEID,
cCreated: u32,
};
pub const JET_OPENTEMPORARYTABLE = extern struct {
cbStruct: u32,
prgcolumndef: ?*const JET_COLUMNDEF,
ccolumn: u32,
pidxunicode: ?*JET_UNICODEINDEX,
grbit: u32,
prgcolumnid: ?*u32,
cbKeyMost: u32,
cbVarSegMac: u32,
tableid: JET_TABLEID,
};
pub const JET_OPENTEMPORARYTABLE2 = extern struct {
cbStruct: u32,
prgcolumndef: ?*const JET_COLUMNDEF,
ccolumn: u32,
pidxunicode: ?*JET_UNICODEINDEX2,
grbit: u32,
prgcolumnid: ?*u32,
cbKeyMost: u32,
cbVarSegMac: u32,
tableid: JET_TABLEID,
};
pub const JET_RETINFO = extern struct {
cbStruct: u32,
ibLongValue: u32,
itagSequence: u32,
columnidNextTagged: u32,
};
pub const JET_SETINFO = extern struct {
cbStruct: u32,
ibLongValue: u32,
itagSequence: u32,
};
pub const JET_RECPOS = extern struct {
cbStruct: u32,
centriesLT: u32,
centriesInRange: u32,
centriesTotal: u32,
};
pub const JET_RECORDLIST = extern struct {
cbStruct: u32,
tableid: JET_TABLEID,
cRecord: u32,
columnidBookmark: u32,
};
pub const JET_INDEXRANGE = extern struct {
cbStruct: u32,
tableid: JET_TABLEID,
grbit: u32,
};
pub const JET_RELOP = enum(i32) {
Equals = 0,
PrefixEquals = 1,
NotEquals = 2,
LessThanOrEqual = 3,
LessThan = 4,
GreaterThanOrEqual = 5,
GreaterThan = 6,
BitmaskEqualsZero = 7,
BitmaskNotEqualsZero = 8,
};
pub const JET_relopEquals = JET_RELOP.Equals;
pub const JET_relopPrefixEquals = JET_RELOP.PrefixEquals;
pub const JET_relopNotEquals = JET_RELOP.NotEquals;
pub const JET_relopLessThanOrEqual = JET_RELOP.LessThanOrEqual;
pub const JET_relopLessThan = JET_RELOP.LessThan;
pub const JET_relopGreaterThanOrEqual = JET_RELOP.GreaterThanOrEqual;
pub const JET_relopGreaterThan = JET_RELOP.GreaterThan;
pub const JET_relopBitmaskEqualsZero = JET_RELOP.BitmaskEqualsZero;
pub const JET_relopBitmaskNotEqualsZero = JET_RELOP.BitmaskNotEqualsZero;
pub const JET_INDEX_COLUMN = extern struct {
columnid: u32,
relop: JET_RELOP,
pv: ?*c_void,
cb: u32,
grbit: u32,
};
pub const JET_INDEX_RANGE = extern struct {
rgStartColumns: ?*JET_INDEX_COLUMN,
cStartColumns: u32,
rgEndColumns: ?*JET_INDEX_COLUMN,
cEndColumns: u32,
};
pub const JET_LOGTIME = extern struct {
bSeconds: CHAR,
bMinutes: CHAR,
bHours: CHAR,
bDay: CHAR,
bMonth: CHAR,
bYear: CHAR,
Anonymous1: extern union {
bFiller1: CHAR,
Anonymous: extern struct {
_bitfield: u8,
},
},
Anonymous2: extern union {
bFiller2: CHAR,
Anonymous: extern struct {
_bitfield: u8,
},
},
};
pub const JET_BKLOGTIME = extern struct {
bSeconds: CHAR,
bMinutes: CHAR,
bHours: CHAR,
bDay: CHAR,
bMonth: CHAR,
bYear: CHAR,
Anonymous1: extern union {
bFiller1: CHAR,
Anonymous: extern struct {
_bitfield: u8,
},
},
Anonymous2: extern union {
bFiller2: CHAR,
Anonymous: extern struct {
_bitfield: u8,
},
},
};
pub const JET_LGPOS = packed struct {
ib: u16,
isec: u16,
lGeneration: i32,
};
pub const JET_SIGNATURE = packed struct {
ulRandom: u32,
logtimeCreate: JET_LOGTIME,
szComputerName: [16]CHAR,
};
pub const JET_BKINFO = packed struct {
lgposMark: JET_LGPOS,
Anonymous: extern union {
logtimeMark: JET_LOGTIME,
bklogtimeMark: JET_BKLOGTIME,
},
genLow: u32,
genHigh: u32,
};
pub const JET_DBINFOMISC = extern struct {
ulVersion: u32,
ulUpdate: u32,
signDb: JET_SIGNATURE,
dbstate: u32,
lgposConsistent: JET_LGPOS,
logtimeConsistent: JET_LOGTIME,
logtimeAttach: JET_LOGTIME,
lgposAttach: JET_LGPOS,
logtimeDetach: JET_LOGTIME,
lgposDetach: JET_LGPOS,
signLog: JET_SIGNATURE,
bkinfoFullPrev: JET_BKINFO,
bkinfoIncPrev: JET_BKINFO,
bkinfoFullCur: JET_BKINFO,
fShadowingDisabled: u32,
fUpgradeDb: u32,
dwMajorVersion: u32,
dwMinorVersion: u32,
dwBuildNumber: u32,
lSPNumber: i32,
cbPageSize: u32,
};
pub const JET_DBINFOMISC2 = extern struct {
ulVersion: u32,
ulUpdate: u32,
signDb: JET_SIGNATURE,
dbstate: u32,
lgposConsistent: JET_LGPOS,
logtimeConsistent: JET_LOGTIME,
logtimeAttach: JET_LOGTIME,
lgposAttach: JET_LGPOS,
logtimeDetach: JET_LOGTIME,
lgposDetach: JET_LGPOS,
signLog: JET_SIGNATURE,
bkinfoFullPrev: JET_BKINFO,
bkinfoIncPrev: JET_BKINFO,
bkinfoFullCur: JET_BKINFO,
fShadowingDisabled: u32,
fUpgradeDb: u32,
dwMajorVersion: u32,
dwMinorVersion: u32,
dwBuildNumber: u32,
lSPNumber: i32,
cbPageSize: u32,
genMinRequired: u32,
genMaxRequired: u32,
logtimeGenMaxCreate: JET_LOGTIME,
ulRepairCount: u32,
logtimeRepair: JET_LOGTIME,
ulRepairCountOld: u32,
ulECCFixSuccess: u32,
logtimeECCFixSuccess: JET_LOGTIME,
ulECCFixSuccessOld: u32,
ulECCFixFail: u32,
logtimeECCFixFail: JET_LOGTIME,
ulECCFixFailOld: u32,
ulBadChecksum: u32,
logtimeBadChecksum: JET_LOGTIME,
ulBadChecksumOld: u32,
};
pub const JET_DBINFOMISC3 = extern struct {
ulVersion: u32,
ulUpdate: u32,
signDb: JET_SIGNATURE,
dbstate: u32,
lgposConsistent: JET_LGPOS,
logtimeConsistent: JET_LOGTIME,
logtimeAttach: JET_LOGTIME,
lgposAttach: JET_LGPOS,
logtimeDetach: JET_LOGTIME,
lgposDetach: JET_LGPOS,
signLog: JET_SIGNATURE,
bkinfoFullPrev: JET_BKINFO,
bkinfoIncPrev: JET_BKINFO,
bkinfoFullCur: JET_BKINFO,
fShadowingDisabled: u32,
fUpgradeDb: u32,
dwMajorVersion: u32,
dwMinorVersion: u32,
dwBuildNumber: u32,
lSPNumber: i32,
cbPageSize: u32,
genMinRequired: u32,
genMaxRequired: u32,
logtimeGenMaxCreate: JET_LOGTIME,
ulRepairCount: u32,
logtimeRepair: JET_LOGTIME,
ulRepairCountOld: u32,
ulECCFixSuccess: u32,
logtimeECCFixSuccess: JET_LOGTIME,
ulECCFixSuccessOld: u32,
ulECCFixFail: u32,
logtimeECCFixFail: JET_LOGTIME,
ulECCFixFailOld: u32,
ulBadChecksum: u32,
logtimeBadChecksum: JET_LOGTIME,
ulBadChecksumOld: u32,
genCommitted: u32,
};
pub const JET_DBINFOMISC4 = extern struct {
ulVersion: u32,
ulUpdate: u32,
signDb: JET_SIGNATURE,
dbstate: u32,
lgposConsistent: JET_LGPOS,
logtimeConsistent: JET_LOGTIME,
logtimeAttach: JET_LOGTIME,
lgposAttach: JET_LGPOS,
logtimeDetach: JET_LOGTIME,
lgposDetach: JET_LGPOS,
signLog: JET_SIGNATURE,
bkinfoFullPrev: JET_BKINFO,
bkinfoIncPrev: JET_BKINFO,
bkinfoFullCur: JET_BKINFO,
fShadowingDisabled: u32,
fUpgradeDb: u32,
dwMajorVersion: u32,
dwMinorVersion: u32,
dwBuildNumber: u32,
lSPNumber: i32,
cbPageSize: u32,
genMinRequired: u32,
genMaxRequired: u32,
logtimeGenMaxCreate: JET_LOGTIME,
ulRepairCount: u32,
logtimeRepair: JET_LOGTIME,
ulRepairCountOld: u32,
ulECCFixSuccess: u32,
logtimeECCFixSuccess: JET_LOGTIME,
ulECCFixSuccessOld: u32,
ulECCFixFail: u32,
logtimeECCFixFail: JET_LOGTIME,
ulECCFixFailOld: u32,
ulBadChecksum: u32,
logtimeBadChecksum: JET_LOGTIME,
ulBadChecksumOld: u32,
genCommitted: u32,
bkinfoCopyPrev: JET_BKINFO,
bkinfoDiffPrev: JET_BKINFO,
};
pub const JET_THREADSTATS = extern struct {
cbStruct: u32,
cPageReferenced: u32,
cPageRead: u32,
cPagePreread: u32,
cPageDirtied: u32,
cPageRedirtied: u32,
cLogRecord: u32,
cbLogRecord: u32,
};
pub const JET_RSTINFO_A = extern struct {
cbStruct: u32,
rgrstmap: ?*JET_RSTMAP_A,
crstmap: i32,
lgposStop: JET_LGPOS,
logtimeStop: JET_LOGTIME,
pfnStatus: ?JET_PFNSTATUS,
};
pub const JET_RSTINFO_W = extern struct {
cbStruct: u32,
rgrstmap: ?*JET_RSTMAP_W,
crstmap: i32,
lgposStop: JET_LGPOS,
logtimeStop: JET_LOGTIME,
pfnStatus: ?JET_PFNSTATUS,
};
pub const JET_ERRCAT = enum(i32) {
Unknown = 0,
Error = 1,
Operation = 2,
Fatal = 3,
IO = 4,
Resource = 5,
Memory = 6,
Quota = 7,
Disk = 8,
Data = 9,
Corruption = 10,
Inconsistent = 11,
Fragmentation = 12,
Api = 13,
Usage = 14,
State = 15,
Obsolete = 16,
Max = 17,
};
pub const JET_errcatUnknown = JET_ERRCAT.Unknown;
pub const JET_errcatError = JET_ERRCAT.Error;
pub const JET_errcatOperation = JET_ERRCAT.Operation;
pub const JET_errcatFatal = JET_ERRCAT.Fatal;
pub const JET_errcatIO = JET_ERRCAT.IO;
pub const JET_errcatResource = JET_ERRCAT.Resource;
pub const JET_errcatMemory = JET_ERRCAT.Memory;
pub const JET_errcatQuota = JET_ERRCAT.Quota;
pub const JET_errcatDisk = JET_ERRCAT.Disk;
pub const JET_errcatData = JET_ERRCAT.Data;
pub const JET_errcatCorruption = JET_ERRCAT.Corruption;
pub const JET_errcatInconsistent = JET_ERRCAT.Inconsistent;
pub const JET_errcatFragmentation = JET_ERRCAT.Fragmentation;
pub const JET_errcatApi = JET_ERRCAT.Api;
pub const JET_errcatUsage = JET_ERRCAT.Usage;
pub const JET_errcatState = JET_ERRCAT.State;
pub const JET_errcatObsolete = JET_ERRCAT.Obsolete;
pub const JET_errcatMax = JET_ERRCAT.Max;
pub const JET_ERRINFOBASIC_W = extern struct {
cbStruct: u32,
errValue: i32,
errcatMostSpecific: JET_ERRCAT,
rgCategoricalHierarchy: [8]u8,
lSourceLine: u32,
rgszSourceFile: [64]u16,
};
pub const JET_PFNDURABLECOMMITCALLBACK = fn(
instance: JET_INSTANCE,
pCommitIdSeen: ?*JET_COMMIT_ID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub const JET_INDEXCHECKING = enum(i32) {
Off = 0,
On = 1,
DeferToOpenTable = 2,
Max = 3,
};
pub const JET_IndexCheckingOff = JET_INDEXCHECKING.Off;
pub const JET_IndexCheckingOn = JET_INDEXCHECKING.On;
pub const JET_IndexCheckingDeferToOpenTable = JET_INDEXCHECKING.DeferToOpenTable;
pub const JET_IndexCheckingMax = JET_INDEXCHECKING.Max;
pub const JET_OPERATIONCONTEXT = extern struct {
ulUserID: u32,
nOperationID: u8,
nOperationType: u8,
nClientType: u8,
fFlags: u8,
};
pub const JET_SETCOLUMN = extern struct {
columnid: u32,
pvData: ?*const c_void,
cbData: u32,
grbit: u32,
ibLongValue: u32,
itagSequence: u32,
err: i32,
};
pub const JET_SETSYSPARAM_A = extern struct {
paramid: u32,
lParam: JET_API_PTR,
sz: ?[*:0]const u8,
err: i32,
};
pub const JET_SETSYSPARAM_W = extern struct {
paramid: u32,
lParam: JET_API_PTR,
sz: ?[*:0]const u16,
err: i32,
};
pub const JET_RETRIEVECOLUMN = extern struct {
columnid: u32,
pvData: ?*c_void,
cbData: u32,
cbActual: u32,
grbit: u32,
ibLongValue: u32,
itagSequence: u32,
columnidNextTagged: u32,
err: i32,
};
pub const JET_ENUMCOLUMNID = extern struct {
columnid: u32,
ctagSequence: u32,
rgtagSequence: ?*u32,
};
pub const JET_ENUMCOLUMNVALUE = extern struct {
itagSequence: u32,
err: i32,
cbData: u32,
pvData: ?*c_void,
};
pub const JET_ENUMCOLUMN = extern struct {
columnid: u32,
err: i32,
Anonymous: extern union {
Anonymous1: extern struct {
cEnumColumnValue: u32,
rgEnumColumnValue: ?*JET_ENUMCOLUMNVALUE,
},
Anonymous2: extern struct {
cbData: u32,
pvData: ?*c_void,
},
},
};
pub const JET_PFNREALLOC = fn(
pvContext: ?*c_void,
pv: ?*c_void,
cb: u32,
) callconv(@import("std").os.windows.WINAPI) ?*c_void;
pub const JET_LOGINFO_A = extern struct {
cbSize: u32,
ulGenLow: u32,
ulGenHigh: u32,
szBaseName: [4]CHAR,
};
pub const JET_LOGINFO_W = extern struct {
cbSize: u32,
ulGenLow: u32,
ulGenHigh: u32,
szBaseName: [4]u16,
};
pub const JET_INSTANCE_INFO_A = extern struct {
hInstanceId: JET_INSTANCE,
szInstanceName: ?PSTR,
cDatabases: JET_API_PTR,
szDatabaseFileName: ?*?*i8,
szDatabaseDisplayName: ?*?*i8,
szDatabaseSLVFileName_Obsolete: ?*?*i8,
};
pub const JET_INSTANCE_INFO_W = extern struct {
hInstanceId: JET_INSTANCE,
szInstanceName: ?PWSTR,
cDatabases: JET_API_PTR,
szDatabaseFileName: ?*?*u16,
szDatabaseDisplayName: ?*?*u16,
szDatabaseSLVFileName_Obsolete: ?*?*u16,
};
pub const JET_INDEXID = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
cbStruct: u32,
rgbIndexId: [16]u8,
},
.X86 => extern struct {
cbStruct: u32,
rgbIndexId: [12]u8,
},
};
pub const JET_OBJECTINFO = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
cbStruct: u32,
objtyp: u32,
dtCreate: f64,
dtUpdate: f64,
grbit: u32,
flags: u32,
cRecord: u32,
cPage: u32,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
cbStruct: u32,
objtyp: u32,
dtCreate: f64,
dtUpdate: f64,
grbit: u32,
flags: u32,
cRecord: u32,
cPage: u32,
},
};
pub const JET_THREADSTATS2 = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
cbStruct: u32,
cPageReferenced: u32,
cPageRead: u32,
cPagePreread: u32,
cPageDirtied: u32,
cPageRedirtied: u32,
cLogRecord: u32,
cbLogRecord: u32,
cusecPageCacheMiss: u64,
cPageCacheMiss: u32,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
cbStruct: u32,
cPageReferenced: u32,
cPageRead: u32,
cPagePreread: u32,
cPageDirtied: u32,
cPageRedirtied: u32,
cLogRecord: u32,
cbLogRecord: u32,
cusecPageCacheMiss: u64,
cPageCacheMiss: u32,
},
};
pub const JET_COMMIT_ID = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
signLog: JET_SIGNATURE,
reserved: i32,
commitId: i64,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
signLog: JET_SIGNATURE,
reserved: i32,
commitId: i64,
},
};
pub const JET_RECSIZE = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
cbData: u64,
cbLongValueData: u64,
cbOverhead: u64,
cbLongValueOverhead: u64,
cNonTaggedColumns: u64,
cTaggedColumns: u64,
cLongValues: u64,
cMultiValues: u64,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
cbData: u64,
cbLongValueData: u64,
cbOverhead: u64,
cbLongValueOverhead: u64,
cNonTaggedColumns: u64,
cTaggedColumns: u64,
cLongValues: u64,
cMultiValues: u64,
},
};
pub const JET_RECSIZE2 = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
cbData: u64,
cbLongValueData: u64,
cbOverhead: u64,
cbLongValueOverhead: u64,
cNonTaggedColumns: u64,
cTaggedColumns: u64,
cLongValues: u64,
cMultiValues: u64,
cCompressedColumns: u64,
cbDataCompressed: u64,
cbLongValueDataCompressed: u64,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
cbData: u64,
cbLongValueData: u64,
cbOverhead: u64,
cbLongValueOverhead: u64,
cNonTaggedColumns: u64,
cTaggedColumns: u64,
cLongValues: u64,
cMultiValues: u64,
cCompressedColumns: u64,
cbDataCompressed: u64,
cbLongValueDataCompressed: u64,
},
};
//--------------------------------------------------------------------------------
// Section: Functions (274)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn WriteFmtUserTypeStg(
pstg: ?*IStorage,
cf: u16,
lpszUserType: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn ReadFmtUserTypeStg(
pstg: ?*IStorage,
pcf: ?*u16,
lplpszUserType: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "ole32" fn OleConvertOLESTREAMToIStorage(
lpolestream: ?*OLESTREAM,
pstg: ?*IStorage,
ptd: ?*const DVTARGETDEVICE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "ole32" fn OleConvertIStorageToOLESTREAM(
pstg: ?*IStorage,
lpolestream: ?*OLESTREAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn SetConvertStg(
pStg: ?*IStorage,
fConvert: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "ole32" fn OleConvertIStorageToOLESTREAMEx(
pstg: ?*IStorage,
cfFormat: u16,
lWidth: i32,
lHeight: i32,
dwSize: u32,
pmedium: ?*STGMEDIUM,
polestm: ?*OLESTREAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "ole32" fn OleConvertOLESTREAMToIStorageEx(
polestm: ?*OLESTREAM,
pstg: ?*IStorage,
pcfFormat: ?*u16,
plwWidth: ?*i32,
plHeight: ?*i32,
pdwSize: ?*u32,
pmedium: ?*STGMEDIUM,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn CreateStreamOnHGlobal(
hGlobal: isize,
fDeleteOnRelease: BOOL,
ppstm: ?*?*IStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn GetHGlobalFromStream(
pstm: ?*IStream,
phglobal: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn PropVariantCopy(
pvarDest: ?*PROPVARIANT,
pvarSrc: ?*const PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn PropVariantClear(
pvar: ?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn FreePropVariantArray(
cVariants: u32,
rgvars: [*]PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "PROPSYS" fn StgSerializePropVariant(
ppropvar: ?*const PROPVARIANT,
ppProp: ?*?*SERIALIZEDPROPERTYVALUE,
pcb: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "PROPSYS" fn StgDeserializePropVariant(
pprop: ?*const SERIALIZEDPROPERTYVALUE,
cbMax: u32,
ppropvar: ?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgCreateDocfile(
pwcsName: ?[*:0]const u16,
grfMode: u32,
reserved: u32,
ppstgOpen: ?*?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgCreateDocfileOnILockBytes(
plkbyt: ?*ILockBytes,
grfMode: u32,
reserved: u32,
ppstgOpen: ?*?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgOpenStorage(
pwcsName: ?[*:0]const u16,
pstgPriority: ?*IStorage,
grfMode: u32,
snbExclude: ?*?*u16,
reserved: u32,
ppstgOpen: ?*?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgOpenStorageOnILockBytes(
plkbyt: ?*ILockBytes,
pstgPriority: ?*IStorage,
grfMode: u32,
snbExclude: ?*?*u16,
reserved: u32,
ppstgOpen: ?*?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgIsStorageFile(
pwcsName: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgIsStorageILockBytes(
plkbyt: ?*ILockBytes,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgSetTimes(
lpszName: ?[*:0]const u16,
pctime: ?*const FILETIME,
patime: ?*const FILETIME,
pmtime: ?*const FILETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgCreateStorageEx(
pwcsName: ?[*:0]const u16,
grfMode: u32,
stgfmt: u32,
grfAttrs: u32,
pStgOptions: ?*STGOPTIONS,
pSecurityDescriptor: ?*SECURITY_DESCRIPTOR,
riid: ?*const Guid,
ppObjectOpen: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgOpenStorageEx(
pwcsName: ?[*:0]const u16,
grfMode: u32,
stgfmt: u32,
grfAttrs: u32,
pStgOptions: ?*STGOPTIONS,
pSecurityDescriptor: ?*SECURITY_DESCRIPTOR,
riid: ?*const Guid,
ppObjectOpen: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgCreatePropStg(
pUnk: ?*IUnknown,
fmtid: ?*const Guid,
pclsid: ?*const Guid,
grfFlags: u32,
dwReserved: u32,
ppPropStg: ?*?*IPropertyStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgOpenPropStg(
pUnk: ?*IUnknown,
fmtid: ?*const Guid,
grfFlags: u32,
dwReserved: u32,
ppPropStg: ?*?*IPropertyStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn StgCreatePropSetStg(
pStorage: ?*IStorage,
dwReserved: u32,
ppPropSetStg: ?*?*IPropertySetStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn FmtIdToPropStgName(
pfmtid: ?*const Guid,
oszName: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn PropStgNameToFmtId(
oszName: ?[*:0]const u16,
pfmtid: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn ReadClassStg(
pStg: ?*IStorage,
pclsid: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn WriteClassStg(
pStg: ?*IStorage,
rclsid: ?*const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn ReadClassStm(
pStm: ?*IStream,
pclsid: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn WriteClassStm(
pStm: ?*IStream,
rclsid: ?*const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn GetHGlobalFromILockBytes(
plkbyt: ?*ILockBytes,
phglobal: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn CreateILockBytesOnHGlobal(
hGlobal: isize,
fDeleteOnRelease: BOOL,
pplkbyt: ?*?*ILockBytes,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "OLE32" fn GetConvertStg(
pStg: ?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "ole32" fn CoBuildVersion(
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "ole32" fn DcomChannelSetHResult(
pvReserved: ?*c_void,
pulReserved: ?*u32,
appsHR: HRESULT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "ole32" fn StgOpenAsyncDocfileOnIFillLockBytes(
pflb: ?*IFillLockBytes,
grfMode: u32,
asyncFlags: u32,
ppstgOpen: ?*?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "ole32" fn StgGetIFillLockBytesOnILockBytes(
pilb: ?*ILockBytes,
ppflb: ?*?*IFillLockBytes,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "ole32" fn StgGetIFillLockBytesOnFile(
pwcsName: ?[*:0]const u16,
ppflb: ?*?*IFillLockBytes,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "dflayout" fn StgOpenLayoutDocfile(
pwcsDfName: ?[*:0]const u16,
grfMode: u32,
reserved: u32,
ppstgOpen: ?*?*IStorage,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "ole32" fn StgConvertVariantToProperty(
pvar: ?*const PROPVARIANT,
CodePage: u16,
// TODO: what to do with BytesParamIndex 3?
pprop: ?*SERIALIZEDPROPERTYVALUE,
pcb: ?*u32,
pid: u32,
fReserved: BOOLEAN,
pcIndirect: ?*u32,
) callconv(@import("std").os.windows.WINAPI) ?*SERIALIZEDPROPERTYVALUE;
// TODO: this type is limited to platform 'windows5.0'
pub extern "ole32" fn StgConvertPropertyToVariant(
pprop: ?*const SERIALIZEDPROPERTYVALUE,
CodePage: u16,
pvar: ?*PROPVARIANT,
pma: ?*PMemoryAllocator,
) callconv(@import("std").os.windows.WINAPI) BOOLEAN;
pub extern "ole32" fn CreateStdProgressIndicator(
hwndParent: ?HWND,
pszTitle: ?[*:0]const u16,
pIbscCaller: ?*IBindStatusCallback,
ppIbsc: ?*?*IBindStatusCallback,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows5.0'
pub extern "ole32" fn StgPropertyLengthAsVariant(
// TODO: what to do with BytesParamIndex 1?
pProp: ?*const SERIALIZEDPROPERTYVALUE,
cbProp: u32,
CodePage: u16,
bReserved: u8,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "ESENT" fn JetInit(
pinstance: ?*JET_INSTANCE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetInit2(
pinstance: ?*JET_INSTANCE,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetInit3A(
pinstance: ?*JET_INSTANCE,
prstInfo: ?*JET_RSTINFO_A,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetInit3W(
pinstance: ?*JET_INSTANCE,
prstInfo: ?*JET_RSTINFO_W,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateInstanceA(
pinstance: ?*JET_INSTANCE,
szInstanceName: ?*i8,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateInstanceW(
pinstance: ?*JET_INSTANCE,
szInstanceName: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateInstance2A(
pinstance: ?*JET_INSTANCE,
szInstanceName: ?*i8,
szDisplayName: ?*i8,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateInstance2W(
pinstance: ?*JET_INSTANCE,
szInstanceName: ?*u16,
szDisplayName: ?*u16,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetInstanceMiscInfo(
instance: JET_INSTANCE,
// TODO: what to do with BytesParamIndex 2?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetTerm(
instance: JET_INSTANCE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetTerm2(
instance: JET_INSTANCE,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetStopService(
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetStopServiceInstance(
instance: JET_INSTANCE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetStopServiceInstance2(
instance: JET_INSTANCE,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetStopBackup(
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetStopBackupInstance(
instance: JET_INSTANCE,
) callconv(@import("std").os.windows.WINAPI) i32;
// This function from dll 'ESENT' is being skipped because it has some sort of issue
pub fn JetSetSystemParameterA() void { @panic("this function is not working"); }
// This function from dll 'ESENT' is being skipped because it has some sort of issue
pub fn JetSetSystemParameterW() void { @panic("this function is not working"); }
pub extern "ESENT" fn JetGetSystemParameterA(
instance: JET_INSTANCE,
sesid: ?JET_SESID,
paramid: u32,
plParam: ?*JET_API_PTR,
// TODO: what to do with BytesParamIndex 5?
szParam: ?*i8,
cbMax: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetSystemParameterW(
instance: JET_INSTANCE,
sesid: ?JET_SESID,
paramid: u32,
plParam: ?*JET_API_PTR,
// TODO: what to do with BytesParamIndex 5?
szParam: ?*u16,
cbMax: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetEnableMultiInstanceA(
psetsysparam: ?[*]JET_SETSYSPARAM_A,
csetsysparam: u32,
pcsetsucceed: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetEnableMultiInstanceW(
psetsysparam: ?[*]JET_SETSYSPARAM_W,
csetsysparam: u32,
pcsetsucceed: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetThreadStats(
// TODO: what to do with BytesParamIndex 1?
pvResult: ?*c_void,
cbMax: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBeginSessionA(
instance: JET_INSTANCE,
psesid: ?*?JET_SESID,
szUserName: ?*i8,
szPassword: ?*i8,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBeginSessionW(
instance: JET_INSTANCE,
psesid: ?*?JET_SESID,
szUserName: ?*u16,
szPassword: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDupSession(
sesid: ?JET_SESID,
psesid: ?*?JET_SESID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetEndSession(
sesid: ?JET_SESID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetVersion(
sesid: ?JET_SESID,
pwVersion: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetIdle(
sesid: ?JET_SESID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateDatabaseA(
sesid: ?JET_SESID,
szFilename: ?*i8,
szConnect: ?*i8,
pdbid: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateDatabaseW(
sesid: ?JET_SESID,
szFilename: ?*u16,
szConnect: ?*u16,
pdbid: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateDatabase2A(
sesid: ?JET_SESID,
szFilename: ?*i8,
cpgDatabaseSizeMax: u32,
pdbid: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateDatabase2W(
sesid: ?JET_SESID,
szFilename: ?*u16,
cpgDatabaseSizeMax: u32,
pdbid: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetAttachDatabaseA(
sesid: ?JET_SESID,
szFilename: ?*i8,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetAttachDatabaseW(
sesid: ?JET_SESID,
szFilename: ?*u16,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetAttachDatabase2A(
sesid: ?JET_SESID,
szFilename: ?*i8,
cpgDatabaseSizeMax: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetAttachDatabase2W(
sesid: ?JET_SESID,
szFilename: ?*u16,
cpgDatabaseSizeMax: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDetachDatabaseA(
sesid: ?JET_SESID,
szFilename: ?*i8,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDetachDatabaseW(
sesid: ?JET_SESID,
szFilename: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDetachDatabase2A(
sesid: ?JET_SESID,
szFilename: ?*i8,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDetachDatabase2W(
sesid: ?JET_SESID,
szFilename: ?*u16,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetObjectInfoA(
sesid: ?JET_SESID,
dbid: u32,
objtyp: u32,
szContainerName: ?*i8,
szObjectName: ?*i8,
// TODO: what to do with BytesParamIndex 6?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetObjectInfoW(
sesid: ?JET_SESID,
dbid: u32,
objtyp: u32,
szContainerName: ?*u16,
szObjectName: ?*u16,
// TODO: what to do with BytesParamIndex 6?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetTableInfoA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetTableInfoW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableA(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*i8,
lPages: u32,
lDensity: u32,
ptableid: ?*JET_TABLEID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableW(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*u16,
lPages: u32,
lDensity: u32,
ptableid: ?*JET_TABLEID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableColumnIndexA(
sesid: ?JET_SESID,
dbid: u32,
ptablecreate: ?*JET_TABLECREATE_A,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableColumnIndexW(
sesid: ?JET_SESID,
dbid: u32,
ptablecreate: ?*JET_TABLECREATE_W,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableColumnIndex2A(
sesid: ?JET_SESID,
dbid: u32,
ptablecreate: ?*JET_TABLECREATE2_A,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableColumnIndex2W(
sesid: ?JET_SESID,
dbid: u32,
ptablecreate: ?*JET_TABLECREATE2_W,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableColumnIndex3A(
sesid: ?JET_SESID,
dbid: u32,
ptablecreate: ?*JET_TABLECREATE3_A,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableColumnIndex3W(
sesid: ?JET_SESID,
dbid: u32,
ptablecreate: ?*JET_TABLECREATE3_W,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableColumnIndex4A(
sesid: ?JET_SESID,
dbid: u32,
ptablecreate: ?*JET_TABLECREATE4_A,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateTableColumnIndex4W(
sesid: ?JET_SESID,
dbid: u32,
ptablecreate: ?*JET_TABLECREATE4_W,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDeleteTableA(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*i8,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDeleteTableW(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRenameTableA(
sesid: ?JET_SESID,
dbid: u32,
szName: ?*i8,
szNameNew: ?*i8,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRenameTableW(
sesid: ?JET_SESID,
dbid: u32,
szName: ?*u16,
szNameNew: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetTableColumnInfoA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szColumnName: ?*i8,
// TODO: what to do with BytesParamIndex 4?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetTableColumnInfoW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szColumnName: ?*u16,
// TODO: what to do with BytesParamIndex 4?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetColumnInfoA(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*i8,
pColumnNameOrId: ?*i8,
// TODO: what to do with BytesParamIndex 5?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetColumnInfoW(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*u16,
pwColumnNameOrId: ?*u16,
// TODO: what to do with BytesParamIndex 5?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetAddColumnA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szColumnName: ?*i8,
pcolumndef: ?*const JET_COLUMNDEF,
// TODO: what to do with BytesParamIndex 5?
pvDefault: ?*const c_void,
cbDefault: u32,
pcolumnid: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetAddColumnW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szColumnName: ?*u16,
pcolumndef: ?*const JET_COLUMNDEF,
// TODO: what to do with BytesParamIndex 5?
pvDefault: ?*const c_void,
cbDefault: u32,
pcolumnid: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDeleteColumnA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szColumnName: ?*i8,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDeleteColumnW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szColumnName: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDeleteColumn2A(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szColumnName: ?*i8,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDeleteColumn2W(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szColumnName: ?*u16,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRenameColumnA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szName: ?*i8,
szNameNew: ?*i8,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRenameColumnW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szName: ?*u16,
szNameNew: ?*u16,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetColumnDefaultValueA(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*i8,
szColumnName: ?*i8,
// TODO: what to do with BytesParamIndex 5?
pvData: ?*const c_void,
cbData: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetColumnDefaultValueW(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*u16,
szColumnName: ?*u16,
// TODO: what to do with BytesParamIndex 5?
pvData: ?*const c_void,
cbData: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetTableIndexInfoA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*i8,
// TODO: what to do with BytesParamIndex 4?
pvResult: ?*c_void,
cbResult: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetTableIndexInfoW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*u16,
// TODO: what to do with BytesParamIndex 4?
pvResult: ?*c_void,
cbResult: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetIndexInfoA(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*i8,
szIndexName: ?*i8,
// TODO: what to do with BytesParamIndex 5?
pvResult: ?*c_void,
cbResult: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetIndexInfoW(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*u16,
szIndexName: ?*u16,
// TODO: what to do with BytesParamIndex 5?
pvResult: ?*c_void,
cbResult: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateIndexA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*i8,
grbit: u32,
// TODO: what to do with BytesParamIndex 5?
szKey: ?[*:0]const u8,
cbKey: u32,
lDensity: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateIndexW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*u16,
grbit: u32,
// TODO: what to do with BytesParamIndex 5?
szKey: ?[*:0]const u16,
cbKey: u32,
lDensity: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateIndex2A(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
pindexcreate: [*]JET_INDEXCREATE_A,
cIndexCreate: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateIndex2W(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
pindexcreate: [*]JET_INDEXCREATE_W,
cIndexCreate: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateIndex3A(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
pindexcreate: [*]JET_INDEXCREATE2_A,
cIndexCreate: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateIndex3W(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
pindexcreate: [*]JET_INDEXCREATE2_W,
cIndexCreate: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateIndex4A(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
pindexcreate: [*]JET_INDEXCREATE3_A,
cIndexCreate: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCreateIndex4W(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
pindexcreate: [*]JET_INDEXCREATE3_W,
cIndexCreate: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDeleteIndexA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*i8,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDeleteIndexW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBeginTransaction(
sesid: ?JET_SESID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBeginTransaction2(
sesid: ?JET_SESID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBeginTransaction3(
sesid: ?JET_SESID,
trxid: i64,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCommitTransaction(
sesid: ?JET_SESID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCommitTransaction2(
sesid: ?JET_SESID,
grbit: u32,
cmsecDurableCommit: u32,
pCommitId: ?*JET_COMMIT_ID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRollback(
sesid: ?JET_SESID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetDatabaseInfoA(
sesid: ?JET_SESID,
dbid: u32,
// TODO: what to do with BytesParamIndex 3?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetDatabaseInfoW(
sesid: ?JET_SESID,
dbid: u32,
// TODO: what to do with BytesParamIndex 3?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetDatabaseFileInfoA(
szDatabaseName: ?*i8,
// TODO: what to do with BytesParamIndex 2?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetDatabaseFileInfoW(
szDatabaseName: ?*u16,
// TODO: what to do with BytesParamIndex 2?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenDatabaseA(
sesid: ?JET_SESID,
szFilename: ?*i8,
szConnect: ?*i8,
pdbid: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenDatabaseW(
sesid: ?JET_SESID,
szFilename: ?*u16,
szConnect: ?*u16,
pdbid: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCloseDatabase(
sesid: ?JET_SESID,
dbid: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenTableA(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*i8,
// TODO: what to do with BytesParamIndex 4?
pvParameters: ?*const c_void,
cbParameters: u32,
grbit: u32,
ptableid: ?*JET_TABLEID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenTableW(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*u16,
// TODO: what to do with BytesParamIndex 4?
pvParameters: ?*const c_void,
cbParameters: u32,
grbit: u32,
ptableid: ?*JET_TABLEID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetTableSequential(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetResetTableSequential(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCloseTable(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDelete(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetUpdate(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvBookmark: ?*c_void,
cbBookmark: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetUpdate2(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvBookmark: ?*c_void,
cbBookmark: u32,
pcbActual: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetEscrowUpdate(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
columnid: u32,
// TODO: what to do with BytesParamIndex 4?
pv: ?*c_void,
cbMax: u32,
// TODO: what to do with BytesParamIndex 6?
pvOld: ?*c_void,
cbOldMax: u32,
pcbOldActual: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRetrieveColumn(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
columnid: u32,
// TODO: what to do with BytesParamIndex 4?
pvData: ?*c_void,
cbData: u32,
pcbActual: ?*u32,
grbit: u32,
pretinfo: ?*JET_RETINFO,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRetrieveColumns(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
pretrievecolumn: ?[*]JET_RETRIEVECOLUMN,
cretrievecolumn: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetEnumerateColumns(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
cEnumColumnId: u32,
rgEnumColumnId: ?[*]JET_ENUMCOLUMNID,
pcEnumColumn: ?*u32,
prgEnumColumn: ?*?*JET_ENUMCOLUMN,
pfnRealloc: ?JET_PFNREALLOC,
pvReallocContext: ?*c_void,
cbDataMost: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetRecordSize(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
precsize: ?*JET_RECSIZE,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetRecordSize2(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
precsize: ?*JET_RECSIZE2,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetColumn(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
columnid: u32,
// TODO: what to do with BytesParamIndex 4?
pvData: ?*const c_void,
cbData: u32,
grbit: u32,
psetinfo: ?*JET_SETINFO,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetColumns(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
psetcolumn: ?[*]JET_SETCOLUMN,
csetcolumn: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetPrepareUpdate(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
prep: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetRecordPosition(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
precpos: ?*JET_RECPOS,
cbRecpos: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGotoPosition(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
precpos: ?*JET_RECPOS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetCursorInfo(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDupCursor(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
ptableid: ?*JET_TABLEID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetCurrentIndexA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
szIndexName: ?*i8,
cbIndexName: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetCurrentIndexW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
szIndexName: ?*u16,
cbIndexName: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetCurrentIndexA(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*i8,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetCurrentIndexW(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetCurrentIndex2A(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*i8,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetCurrentIndex2W(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*u16,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetCurrentIndex3A(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*i8,
grbit: u32,
itagSequence: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetCurrentIndex3W(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*u16,
grbit: u32,
itagSequence: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetCurrentIndex4A(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*i8,
pindexid: ?*JET_INDEXID,
grbit: u32,
itagSequence: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetCurrentIndex4W(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
szIndexName: ?*u16,
pindexid: ?*JET_INDEXID,
grbit: u32,
itagSequence: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetMove(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
cRow: i32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetCursorFilter(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
rgColumnFilters: [*]JET_INDEX_COLUMN,
cColumnFilters: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetLock(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetMakeKey(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvData: ?*const c_void,
cbData: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSeek(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetPrereadKeys(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
rgpvKeys: [*]const ?*const c_void,
rgcbKeys: [*]const u32,
ckeys: i32,
pckeysPreread: ?*i32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetPrereadIndexRanges(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
rgIndexRanges: [*]const JET_INDEX_RANGE,
cIndexRanges: u32,
pcRangesPreread: ?*u32,
rgcolumnidPreread: [*]const u32,
ccolumnidPreread: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetBookmark(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvBookmark: ?*c_void,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetSecondaryIndexBookmark(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvSecondaryKey: ?*c_void,
cbSecondaryKeyMax: u32,
pcbSecondaryKeyActual: ?*u32,
// TODO: what to do with BytesParamIndex 6?
pvPrimaryBookmark: ?*c_void,
cbPrimaryBookmarkMax: u32,
pcbPrimaryBookmarkActual: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCompactA(
sesid: ?JET_SESID,
szDatabaseSrc: ?*i8,
szDatabaseDest: ?*i8,
pfnStatus: ?JET_PFNSTATUS,
pconvert: ?*CONVERT_A,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCompactW(
sesid: ?JET_SESID,
szDatabaseSrc: ?*u16,
szDatabaseDest: ?*u16,
pfnStatus: ?JET_PFNSTATUS,
pconvert: ?*CONVERT_W,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDefragmentA(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*i8,
pcPasses: ?*u32,
pcSeconds: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDefragmentW(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*u16,
pcPasses: ?*u32,
pcSeconds: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDefragment2A(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*i8,
pcPasses: ?*u32,
pcSeconds: ?*u32,
callback: ?JET_CALLBACK,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDefragment2W(
sesid: ?JET_SESID,
dbid: u32,
szTableName: ?*u16,
pcPasses: ?*u32,
pcSeconds: ?*u32,
callback: ?JET_CALLBACK,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDefragment3A(
sesid: ?JET_SESID,
szDatabaseName: ?*i8,
szTableName: ?*i8,
pcPasses: ?*u32,
pcSeconds: ?*u32,
callback: ?JET_CALLBACK,
pvContext: ?*c_void,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetDefragment3W(
sesid: ?JET_SESID,
szDatabaseName: ?*u16,
szTableName: ?*u16,
pcPasses: ?*u32,
pcSeconds: ?*u32,
callback: ?JET_CALLBACK,
pvContext: ?*c_void,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetDatabaseSizeA(
sesid: ?JET_SESID,
szDatabaseName: ?*i8,
cpg: u32,
pcpgReal: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetDatabaseSizeW(
sesid: ?JET_SESID,
szDatabaseName: ?*u16,
cpg: u32,
pcpgReal: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGrowDatabase(
sesid: ?JET_SESID,
dbid: u32,
cpg: u32,
pcpgReal: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetResizeDatabase(
sesid: ?JET_SESID,
dbid: u32,
cpgTarget: u32,
pcpgActual: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetSessionContext(
sesid: ?JET_SESID,
ulContext: JET_API_PTR,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetResetSessionContext(
sesid: ?JET_SESID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGotoBookmark(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvBookmark: ?*c_void,
cbBookmark: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGotoSecondaryIndexBookmark(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvSecondaryKey: ?*c_void,
cbSecondaryKey: u32,
// TODO: what to do with BytesParamIndex 5?
pvPrimaryBookmark: ?*c_void,
cbPrimaryBookmark: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetIntersectIndexes(
sesid: ?JET_SESID,
rgindexrange: [*]JET_INDEXRANGE,
cindexrange: u32,
precordlist: ?*JET_RECORDLIST,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetComputeStats(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenTempTable(
sesid: ?JET_SESID,
prgcolumndef: [*]const JET_COLUMNDEF,
ccolumn: u32,
grbit: u32,
ptableid: ?*JET_TABLEID,
prgcolumnid: [*]u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenTempTable2(
sesid: ?JET_SESID,
prgcolumndef: [*]const JET_COLUMNDEF,
ccolumn: u32,
lcid: u32,
grbit: u32,
ptableid: ?*JET_TABLEID,
prgcolumnid: [*]u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenTempTable3(
sesid: ?JET_SESID,
prgcolumndef: [*]const JET_COLUMNDEF,
ccolumn: u32,
pidxunicode: ?*JET_UNICODEINDEX,
grbit: u32,
ptableid: ?*JET_TABLEID,
prgcolumnid: [*]u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenTemporaryTable(
sesid: ?JET_SESID,
popentemporarytable: ?*JET_OPENTEMPORARYTABLE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenTemporaryTable2(
sesid: ?JET_SESID,
popentemporarytable: ?*JET_OPENTEMPORARYTABLE2,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBackupA(
szBackupPath: ?*i8,
grbit: u32,
pfnStatus: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBackupW(
szBackupPath: ?*u16,
grbit: u32,
pfnStatus: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBackupInstanceA(
instance: JET_INSTANCE,
szBackupPath: ?*i8,
grbit: u32,
pfnStatus: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBackupInstanceW(
instance: JET_INSTANCE,
szBackupPath: ?*u16,
grbit: u32,
pfnStatus: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRestoreA(
szSource: ?*i8,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRestoreW(
szSource: ?*u16,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRestore2A(
sz: ?*i8,
szDest: ?*i8,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRestore2W(
sz: ?*u16,
szDest: ?*u16,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRestoreInstanceA(
instance: JET_INSTANCE,
sz: ?*i8,
szDest: ?*i8,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRestoreInstanceW(
instance: JET_INSTANCE,
sz: ?*u16,
szDest: ?*u16,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetIndexRange(
sesid: ?JET_SESID,
tableidSrc: JET_TABLEID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetIndexRecordCount(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
pcrec: ?*u32,
crecMax: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRetrieveKey(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
// TODO: what to do with BytesParamIndex 3?
pvKey: ?*c_void,
cbMax: u32,
pcbActual: ?*u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBeginExternalBackup(
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetBeginExternalBackupInstance(
instance: JET_INSTANCE,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetAttachInfoA(
// TODO: what to do with BytesParamIndex 1?
szzDatabases: ?*i8,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetAttachInfoW(
// TODO: what to do with BytesParamIndex 1?
wszzDatabases: ?*u16,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetAttachInfoInstanceA(
instance: JET_INSTANCE,
// TODO: what to do with BytesParamIndex 2?
szzDatabases: ?*i8,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetAttachInfoInstanceW(
instance: JET_INSTANCE,
// TODO: what to do with BytesParamIndex 2?
szzDatabases: ?*u16,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenFileA(
szFileName: ?*i8,
phfFile: ?*JET_HANDLE,
pulFileSizeLow: ?*u32,
pulFileSizeHigh: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenFileW(
szFileName: ?*u16,
phfFile: ?*JET_HANDLE,
pulFileSizeLow: ?*u32,
pulFileSizeHigh: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenFileInstanceA(
instance: JET_INSTANCE,
szFileName: ?*i8,
phfFile: ?*JET_HANDLE,
pulFileSizeLow: ?*u32,
pulFileSizeHigh: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOpenFileInstanceW(
instance: JET_INSTANCE,
szFileName: ?*u16,
phfFile: ?*JET_HANDLE,
pulFileSizeLow: ?*u32,
pulFileSizeHigh: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetReadFile(
hfFile: JET_HANDLE,
// TODO: what to do with BytesParamIndex 2?
pv: ?*c_void,
cb: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetReadFileInstance(
instance: JET_INSTANCE,
hfFile: JET_HANDLE,
// TODO: what to do with BytesParamIndex 3?
pv: ?*c_void,
cb: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCloseFile(
hfFile: JET_HANDLE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetCloseFileInstance(
instance: JET_INSTANCE,
hfFile: JET_HANDLE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetLogInfoA(
// TODO: what to do with BytesParamIndex 1?
szzLogs: ?*i8,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetLogInfoW(
// TODO: what to do with BytesParamIndex 1?
szzLogs: ?*u16,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetLogInfoInstanceA(
instance: JET_INSTANCE,
// TODO: what to do with BytesParamIndex 2?
szzLogs: ?*i8,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetLogInfoInstanceW(
instance: JET_INSTANCE,
// TODO: what to do with BytesParamIndex 2?
wszzLogs: ?*u16,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetLogInfoInstance2A(
instance: JET_INSTANCE,
// TODO: what to do with BytesParamIndex 2?
szzLogs: ?*i8,
cbMax: u32,
pcbActual: ?*u32,
pLogInfo: ?*JET_LOGINFO_A,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetLogInfoInstance2W(
instance: JET_INSTANCE,
// TODO: what to do with BytesParamIndex 2?
wszzLogs: ?*u16,
cbMax: u32,
pcbActual: ?*u32,
pLogInfo: ?*JET_LOGINFO_W,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetTruncateLogInfoInstanceA(
instance: JET_INSTANCE,
// TODO: what to do with BytesParamIndex 2?
szzLogs: ?*i8,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetTruncateLogInfoInstanceW(
instance: JET_INSTANCE,
// TODO: what to do with BytesParamIndex 2?
wszzLogs: ?*u16,
cbMax: u32,
pcbActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetTruncateLog(
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetTruncateLogInstance(
instance: JET_INSTANCE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetEndExternalBackup(
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetEndExternalBackupInstance(
instance: JET_INSTANCE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetEndExternalBackupInstance2(
instance: JET_INSTANCE,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetExternalRestoreA(
szCheckpointFilePath: ?*i8,
szLogPath: ?*i8,
rgrstmap: ?[*]JET_RSTMAP_A,
crstfilemap: i32,
szBackupLogPath: ?*i8,
genLow: i32,
genHigh: i32,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetExternalRestoreW(
szCheckpointFilePath: ?*u16,
szLogPath: ?*u16,
rgrstmap: ?[*]JET_RSTMAP_W,
crstfilemap: i32,
szBackupLogPath: ?*u16,
genLow: i32,
genHigh: i32,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetExternalRestore2A(
szCheckpointFilePath: ?*i8,
szLogPath: ?*i8,
rgrstmap: ?[*]JET_RSTMAP_A,
crstfilemap: i32,
szBackupLogPath: ?*i8,
pLogInfo: ?*JET_LOGINFO_A,
szTargetInstanceName: ?*i8,
szTargetInstanceLogPath: ?*i8,
szTargetInstanceCheckpointPath: ?*i8,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetExternalRestore2W(
szCheckpointFilePath: ?*u16,
szLogPath: ?*u16,
rgrstmap: ?[*]JET_RSTMAP_W,
crstfilemap: i32,
szBackupLogPath: ?*u16,
pLogInfo: ?*JET_LOGINFO_W,
szTargetInstanceName: ?*u16,
szTargetInstanceLogPath: ?*u16,
szTargetInstanceCheckpointPath: ?*u16,
pfn: ?JET_PFNSTATUS,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetRegisterCallback(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
cbtyp: u32,
pCallback: ?JET_CALLBACK,
pvContext: ?*c_void,
phCallbackId: ?*JET_HANDLE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetUnregisterCallback(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
cbtyp: u32,
hCallbackId: JET_HANDLE,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetInstanceInfoA(
pcInstanceInfo: ?*u32,
paInstanceInfo: ?*?*JET_INSTANCE_INFO_A,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetInstanceInfoW(
pcInstanceInfo: ?*u32,
paInstanceInfo: ?*?*JET_INSTANCE_INFO_W,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetFreeBuffer(
pbBuf: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetLS(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
ls: JET_LS,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetLS(
sesid: ?JET_SESID,
tableid: JET_TABLEID,
pls: ?*JET_LS,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotPrepare(
psnapId: ?*JET_OSSNAPID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotPrepareInstance(
snapId: JET_OSSNAPID,
instance: JET_INSTANCE,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotFreezeA(
snapId: JET_OSSNAPID,
pcInstanceInfo: ?*u32,
paInstanceInfo: ?*?*JET_INSTANCE_INFO_A,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotFreezeW(
snapId: JET_OSSNAPID,
pcInstanceInfo: ?*u32,
paInstanceInfo: ?*?*JET_INSTANCE_INFO_W,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotThaw(
snapId: JET_OSSNAPID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotAbort(
snapId: JET_OSSNAPID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotTruncateLog(
snapId: JET_OSSNAPID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotTruncateLogInstance(
snapId: JET_OSSNAPID,
instance: JET_INSTANCE,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotGetFreezeInfoA(
snapId: JET_OSSNAPID,
pcInstanceInfo: ?*u32,
paInstanceInfo: ?*?*JET_INSTANCE_INFO_A,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotGetFreezeInfoW(
snapId: JET_OSSNAPID,
pcInstanceInfo: ?*u32,
paInstanceInfo: ?*?*JET_INSTANCE_INFO_W,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetOSSnapshotEnd(
snapId: JET_OSSNAPID,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetConfigureProcessForCrashDump(
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetErrorInfoW(
pvContext: ?*c_void,
// TODO: what to do with BytesParamIndex 2?
pvResult: ?*c_void,
cbMax: u32,
InfoLevel: u32,
grbit: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetSetSessionParameter(
sesid: ?JET_SESID,
sesparamid: u32,
// TODO: what to do with BytesParamIndex 3?
pvParam: ?*c_void,
cbParam: u32,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "ESENT" fn JetGetSessionParameter(
sesid: ?JET_SESID,
sesparamid: u32,
pvParam: [*]u8,
cbParamMax: u32,
pcbParamActual: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i32;
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (85)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../zig.zig").unicode_mode) {
.ansi => struct {
pub const JET_RSTMAP_ = thismodule.JET_RSTMAP_A;
pub const CONVERT_ = thismodule.CONVERT_A;
pub const JET_COLUMNBASE_ = thismodule.JET_COLUMNBASE_A;
pub const JET_COLUMNCREATE_ = thismodule.JET_COLUMNCREATE_A;
pub const JET_USERDEFINEDDEFAULT_ = thismodule.JET_USERDEFINEDDEFAULT_A;
pub const JET_CONDITIONALCOLUMN_ = thismodule.JET_CONDITIONALCOLUMN_A;
pub const JET_INDEXCREATE_ = thismodule.JET_INDEXCREATE_A;
pub const JET_INDEXCREATE2_ = thismodule.JET_INDEXCREATE2_A;
pub const JET_INDEXCREATE3_ = thismodule.JET_INDEXCREATE3_A;
pub const JET_TABLECREATE_ = thismodule.JET_TABLECREATE_A;
pub const JET_TABLECREATE2_ = thismodule.JET_TABLECREATE2_A;
pub const JET_TABLECREATE3_ = thismodule.JET_TABLECREATE3_A;
pub const JET_TABLECREATE4_ = thismodule.JET_TABLECREATE4_A;
pub const JET_RSTINFO_ = thismodule.JET_RSTINFO_A;
pub const JET_SETSYSPARAM_ = thismodule.JET_SETSYSPARAM_A;
pub const JET_LOGINFO_ = thismodule.JET_LOGINFO_A;
pub const JET_INSTANCE_INFO_ = thismodule.JET_INSTANCE_INFO_A;
pub const JetInit3 = thismodule.JetInit3A;
pub const JetCreateInstance = thismodule.JetCreateInstanceA;
pub const JetCreateInstance2 = thismodule.JetCreateInstance2A;
pub const JetSetSystemParameter = thismodule.JetSetSystemParameterA;
pub const JetGetSystemParameter = thismodule.JetGetSystemParameterA;
pub const JetEnableMultiInstance = thismodule.JetEnableMultiInstanceA;
pub const JetBeginSession = thismodule.JetBeginSessionA;
pub const JetCreateDatabase = thismodule.JetCreateDatabaseA;
pub const JetCreateDatabase2 = thismodule.JetCreateDatabase2A;
pub const JetAttachDatabase = thismodule.JetAttachDatabaseA;
pub const JetAttachDatabase2 = thismodule.JetAttachDatabase2A;
pub const JetDetachDatabase = thismodule.JetDetachDatabaseA;
pub const JetDetachDatabase2 = thismodule.JetDetachDatabase2A;
pub const JetGetObjectInfo = thismodule.JetGetObjectInfoA;
pub const JetGetTableInfo = thismodule.JetGetTableInfoA;
pub const JetCreateTable = thismodule.JetCreateTableA;
pub const JetCreateTableColumnIndex = thismodule.JetCreateTableColumnIndexA;
pub const JetCreateTableColumnIndex2 = thismodule.JetCreateTableColumnIndex2A;
pub const JetCreateTableColumnIndex3 = thismodule.JetCreateTableColumnIndex3A;
pub const JetCreateTableColumnIndex4 = thismodule.JetCreateTableColumnIndex4A;
pub const JetDeleteTable = thismodule.JetDeleteTableA;
pub const JetRenameTable = thismodule.JetRenameTableA;
pub const JetGetTableColumnInfo = thismodule.JetGetTableColumnInfoA;
pub const JetGetColumnInfo = thismodule.JetGetColumnInfoA;
pub const JetAddColumn = thismodule.JetAddColumnA;
pub const JetDeleteColumn = thismodule.JetDeleteColumnA;
pub const JetDeleteColumn2 = thismodule.JetDeleteColumn2A;
pub const JetRenameColumn = thismodule.JetRenameColumnA;
pub const JetSetColumnDefaultValue = thismodule.JetSetColumnDefaultValueA;
pub const JetGetTableIndexInfo = thismodule.JetGetTableIndexInfoA;
pub const JetGetIndexInfo = thismodule.JetGetIndexInfoA;
pub const JetCreateIndex = thismodule.JetCreateIndexA;
pub const JetCreateIndex2 = thismodule.JetCreateIndex2A;
pub const JetCreateIndex3 = thismodule.JetCreateIndex3A;
pub const JetCreateIndex4 = thismodule.JetCreateIndex4A;
pub const JetDeleteIndex = thismodule.JetDeleteIndexA;
pub const JetGetDatabaseInfo = thismodule.JetGetDatabaseInfoA;
pub const JetGetDatabaseFileInfo = thismodule.JetGetDatabaseFileInfoA;
pub const JetOpenDatabase = thismodule.JetOpenDatabaseA;
pub const JetOpenTable = thismodule.JetOpenTableA;
pub const JetGetCurrentIndex = thismodule.JetGetCurrentIndexA;
pub const JetSetCurrentIndex = thismodule.JetSetCurrentIndexA;
pub const JetSetCurrentIndex2 = thismodule.JetSetCurrentIndex2A;
pub const JetSetCurrentIndex3 = thismodule.JetSetCurrentIndex3A;
pub const JetSetCurrentIndex4 = thismodule.JetSetCurrentIndex4A;
pub const JetCompact = thismodule.JetCompactA;
pub const JetDefragment = thismodule.JetDefragmentA;
pub const JetDefragment2 = thismodule.JetDefragment2A;
pub const JetDefragment3 = thismodule.JetDefragment3A;
pub const JetSetDatabaseSize = thismodule.JetSetDatabaseSizeA;
pub const JetBackup = thismodule.JetBackupA;
pub const JetBackupInstance = thismodule.JetBackupInstanceA;
pub const JetRestore = thismodule.JetRestoreA;
pub const JetRestore2 = thismodule.JetRestore2A;
pub const JetRestoreInstance = thismodule.JetRestoreInstanceA;
pub const JetGetAttachInfo = thismodule.JetGetAttachInfoA;
pub const JetGetAttachInfoInstance = thismodule.JetGetAttachInfoInstanceA;
pub const JetOpenFile = thismodule.JetOpenFileA;
pub const JetOpenFileInstance = thismodule.JetOpenFileInstanceA;
pub const JetGetLogInfo = thismodule.JetGetLogInfoA;
pub const JetGetLogInfoInstance = thismodule.JetGetLogInfoInstanceA;
pub const JetGetLogInfoInstance2 = thismodule.JetGetLogInfoInstance2A;
pub const JetGetTruncateLogInfoInstance = thismodule.JetGetTruncateLogInfoInstanceA;
pub const JetExternalRestore = thismodule.JetExternalRestoreA;
pub const JetExternalRestore2 = thismodule.JetExternalRestore2A;
pub const JetGetInstanceInfo = thismodule.JetGetInstanceInfoA;
pub const JetOSSnapshotFreeze = thismodule.JetOSSnapshotFreezeA;
pub const JetOSSnapshotGetFreezeInfo = thismodule.JetOSSnapshotGetFreezeInfoA;
},
.wide => struct {
pub const JET_RSTMAP_ = thismodule.JET_RSTMAP_W;
pub const CONVERT_ = thismodule.CONVERT_W;
pub const JET_COLUMNBASE_ = thismodule.JET_COLUMNBASE_W;
pub const JET_COLUMNCREATE_ = thismodule.JET_COLUMNCREATE_W;
pub const JET_USERDEFINEDDEFAULT_ = thismodule.JET_USERDEFINEDDEFAULT_W;
pub const JET_CONDITIONALCOLUMN_ = thismodule.JET_CONDITIONALCOLUMN_W;
pub const JET_INDEXCREATE_ = thismodule.JET_INDEXCREATE_W;
pub const JET_INDEXCREATE2_ = thismodule.JET_INDEXCREATE2_W;
pub const JET_INDEXCREATE3_ = thismodule.JET_INDEXCREATE3_W;
pub const JET_TABLECREATE_ = thismodule.JET_TABLECREATE_W;
pub const JET_TABLECREATE2_ = thismodule.JET_TABLECREATE2_W;
pub const JET_TABLECREATE3_ = thismodule.JET_TABLECREATE3_W;
pub const JET_TABLECREATE4_ = thismodule.JET_TABLECREATE4_W;
pub const JET_RSTINFO_ = thismodule.JET_RSTINFO_W;
pub const JET_SETSYSPARAM_ = thismodule.JET_SETSYSPARAM_W;
pub const JET_LOGINFO_ = thismodule.JET_LOGINFO_W;
pub const JET_INSTANCE_INFO_ = thismodule.JET_INSTANCE_INFO_W;
pub const JetInit3 = thismodule.JetInit3W;
pub const JetCreateInstance = thismodule.JetCreateInstanceW;
pub const JetCreateInstance2 = thismodule.JetCreateInstance2W;
pub const JetSetSystemParameter = thismodule.JetSetSystemParameterW;
pub const JetGetSystemParameter = thismodule.JetGetSystemParameterW;
pub const JetEnableMultiInstance = thismodule.JetEnableMultiInstanceW;
pub const JetBeginSession = thismodule.JetBeginSessionW;
pub const JetCreateDatabase = thismodule.JetCreateDatabaseW;
pub const JetCreateDatabase2 = thismodule.JetCreateDatabase2W;
pub const JetAttachDatabase = thismodule.JetAttachDatabaseW;
pub const JetAttachDatabase2 = thismodule.JetAttachDatabase2W;
pub const JetDetachDatabase = thismodule.JetDetachDatabaseW;
pub const JetDetachDatabase2 = thismodule.JetDetachDatabase2W;
pub const JetGetObjectInfo = thismodule.JetGetObjectInfoW;
pub const JetGetTableInfo = thismodule.JetGetTableInfoW;
pub const JetCreateTable = thismodule.JetCreateTableW;
pub const JetCreateTableColumnIndex = thismodule.JetCreateTableColumnIndexW;
pub const JetCreateTableColumnIndex2 = thismodule.JetCreateTableColumnIndex2W;
pub const JetCreateTableColumnIndex3 = thismodule.JetCreateTableColumnIndex3W;
pub const JetCreateTableColumnIndex4 = thismodule.JetCreateTableColumnIndex4W;
pub const JetDeleteTable = thismodule.JetDeleteTableW;
pub const JetRenameTable = thismodule.JetRenameTableW;
pub const JetGetTableColumnInfo = thismodule.JetGetTableColumnInfoW;
pub const JetGetColumnInfo = thismodule.JetGetColumnInfoW;
pub const JetAddColumn = thismodule.JetAddColumnW;
pub const JetDeleteColumn = thismodule.JetDeleteColumnW;
pub const JetDeleteColumn2 = thismodule.JetDeleteColumn2W;
pub const JetRenameColumn = thismodule.JetRenameColumnW;
pub const JetSetColumnDefaultValue = thismodule.JetSetColumnDefaultValueW;
pub const JetGetTableIndexInfo = thismodule.JetGetTableIndexInfoW;
pub const JetGetIndexInfo = thismodule.JetGetIndexInfoW;
pub const JetCreateIndex = thismodule.JetCreateIndexW;
pub const JetCreateIndex2 = thismodule.JetCreateIndex2W;
pub const JetCreateIndex3 = thismodule.JetCreateIndex3W;
pub const JetCreateIndex4 = thismodule.JetCreateIndex4W;
pub const JetDeleteIndex = thismodule.JetDeleteIndexW;
pub const JetGetDatabaseInfo = thismodule.JetGetDatabaseInfoW;
pub const JetGetDatabaseFileInfo = thismodule.JetGetDatabaseFileInfoW;
pub const JetOpenDatabase = thismodule.JetOpenDatabaseW;
pub const JetOpenTable = thismodule.JetOpenTableW;
pub const JetGetCurrentIndex = thismodule.JetGetCurrentIndexW;
pub const JetSetCurrentIndex = thismodule.JetSetCurrentIndexW;
pub const JetSetCurrentIndex2 = thismodule.JetSetCurrentIndex2W;
pub const JetSetCurrentIndex3 = thismodule.JetSetCurrentIndex3W;
pub const JetSetCurrentIndex4 = thismodule.JetSetCurrentIndex4W;
pub const JetCompact = thismodule.JetCompactW;
pub const JetDefragment = thismodule.JetDefragmentW;
pub const JetDefragment2 = thismodule.JetDefragment2W;
pub const JetDefragment3 = thismodule.JetDefragment3W;
pub const JetSetDatabaseSize = thismodule.JetSetDatabaseSizeW;
pub const JetBackup = thismodule.JetBackupW;
pub const JetBackupInstance = thismodule.JetBackupInstanceW;
pub const JetRestore = thismodule.JetRestoreW;
pub const JetRestore2 = thismodule.JetRestore2W;
pub const JetRestoreInstance = thismodule.JetRestoreInstanceW;
pub const JetGetAttachInfo = thismodule.JetGetAttachInfoW;
pub const JetGetAttachInfoInstance = thismodule.JetGetAttachInfoInstanceW;
pub const JetOpenFile = thismodule.JetOpenFileW;
pub const JetOpenFileInstance = thismodule.JetOpenFileInstanceW;
pub const JetGetLogInfo = thismodule.JetGetLogInfoW;
pub const JetGetLogInfoInstance = thismodule.JetGetLogInfoInstanceW;
pub const JetGetLogInfoInstance2 = thismodule.JetGetLogInfoInstance2W;
pub const JetGetTruncateLogInfoInstance = thismodule.JetGetTruncateLogInfoInstanceW;
pub const JetExternalRestore = thismodule.JetExternalRestoreW;
pub const JetExternalRestore2 = thismodule.JetExternalRestore2W;
pub const JetGetInstanceInfo = thismodule.JetGetInstanceInfoW;
pub const JetOSSnapshotFreeze = thismodule.JetOSSnapshotFreezeW;
pub const JetOSSnapshotGetFreezeInfo = thismodule.JetOSSnapshotGetFreezeInfoW;
},
.unspecified => if (@import("builtin").is_test) struct {
pub const JET_RSTMAP_ = *opaque{};
pub const CONVERT_ = *opaque{};
pub const JET_COLUMNBASE_ = *opaque{};
pub const JET_COLUMNCREATE_ = *opaque{};
pub const JET_USERDEFINEDDEFAULT_ = *opaque{};
pub const JET_CONDITIONALCOLUMN_ = *opaque{};
pub const JET_INDEXCREATE_ = *opaque{};
pub const JET_INDEXCREATE2_ = *opaque{};
pub const JET_INDEXCREATE3_ = *opaque{};
pub const JET_TABLECREATE_ = *opaque{};
pub const JET_TABLECREATE2_ = *opaque{};
pub const JET_TABLECREATE3_ = *opaque{};
pub const JET_TABLECREATE4_ = *opaque{};
pub const JET_RSTINFO_ = *opaque{};
pub const JET_SETSYSPARAM_ = *opaque{};
pub const JET_LOGINFO_ = *opaque{};
pub const JET_INSTANCE_INFO_ = *opaque{};
pub const JetInit3 = *opaque{};
pub const JetCreateInstance = *opaque{};
pub const JetCreateInstance2 = *opaque{};
pub const JetSetSystemParameter = *opaque{};
pub const JetGetSystemParameter = *opaque{};
pub const JetEnableMultiInstance = *opaque{};
pub const JetBeginSession = *opaque{};
pub const JetCreateDatabase = *opaque{};
pub const JetCreateDatabase2 = *opaque{};
pub const JetAttachDatabase = *opaque{};
pub const JetAttachDatabase2 = *opaque{};
pub const JetDetachDatabase = *opaque{};
pub const JetDetachDatabase2 = *opaque{};
pub const JetGetObjectInfo = *opaque{};
pub const JetGetTableInfo = *opaque{};
pub const JetCreateTable = *opaque{};
pub const JetCreateTableColumnIndex = *opaque{};
pub const JetCreateTableColumnIndex2 = *opaque{};
pub const JetCreateTableColumnIndex3 = *opaque{};
pub const JetCreateTableColumnIndex4 = *opaque{};
pub const JetDeleteTable = *opaque{};
pub const JetRenameTable = *opaque{};
pub const JetGetTableColumnInfo = *opaque{};
pub const JetGetColumnInfo = *opaque{};
pub const JetAddColumn = *opaque{};
pub const JetDeleteColumn = *opaque{};
pub const JetDeleteColumn2 = *opaque{};
pub const JetRenameColumn = *opaque{};
pub const JetSetColumnDefaultValue = *opaque{};
pub const JetGetTableIndexInfo = *opaque{};
pub const JetGetIndexInfo = *opaque{};
pub const JetCreateIndex = *opaque{};
pub const JetCreateIndex2 = *opaque{};
pub const JetCreateIndex3 = *opaque{};
pub const JetCreateIndex4 = *opaque{};
pub const JetDeleteIndex = *opaque{};
pub const JetGetDatabaseInfo = *opaque{};
pub const JetGetDatabaseFileInfo = *opaque{};
pub const JetOpenDatabase = *opaque{};
pub const JetOpenTable = *opaque{};
pub const JetGetCurrentIndex = *opaque{};
pub const JetSetCurrentIndex = *opaque{};
pub const JetSetCurrentIndex2 = *opaque{};
pub const JetSetCurrentIndex3 = *opaque{};
pub const JetSetCurrentIndex4 = *opaque{};
pub const JetCompact = *opaque{};
pub const JetDefragment = *opaque{};
pub const JetDefragment2 = *opaque{};
pub const JetDefragment3 = *opaque{};
pub const JetSetDatabaseSize = *opaque{};
pub const JetBackup = *opaque{};
pub const JetBackupInstance = *opaque{};
pub const JetRestore = *opaque{};
pub const JetRestore2 = *opaque{};
pub const JetRestoreInstance = *opaque{};
pub const JetGetAttachInfo = *opaque{};
pub const JetGetAttachInfoInstance = *opaque{};
pub const JetOpenFile = *opaque{};
pub const JetOpenFileInstance = *opaque{};
pub const JetGetLogInfo = *opaque{};
pub const JetGetLogInfoInstance = *opaque{};
pub const JetGetLogInfoInstance2 = *opaque{};
pub const JetGetTruncateLogInfoInstance = *opaque{};
pub const JetExternalRestore = *opaque{};
pub const JetExternalRestore2 = *opaque{};
pub const JetGetInstanceInfo = *opaque{};
pub const JetOSSnapshotFreeze = *opaque{};
pub const JetOSSnapshotGetFreezeInfo = *opaque{};
} else struct {
pub const JET_RSTMAP_ = @compileError("'JET_RSTMAP_' requires that UNICODE be set to true or false in the root module");
pub const CONVERT_ = @compileError("'CONVERT_' requires that UNICODE be set to true or false in the root module");
pub const JET_COLUMNBASE_ = @compileError("'JET_COLUMNBASE_' requires that UNICODE be set to true or false in the root module");
pub const JET_COLUMNCREATE_ = @compileError("'JET_COLUMNCREATE_' requires that UNICODE be set to true or false in the root module");
pub const JET_USERDEFINEDDEFAULT_ = @compileError("'JET_USERDEFINEDDEFAULT_' requires that UNICODE be set to true or false in the root module");
pub const JET_CONDITIONALCOLUMN_ = @compileError("'JET_CONDITIONALCOLUMN_' requires that UNICODE be set to true or false in the root module");
pub const JET_INDEXCREATE_ = @compileError("'JET_INDEXCREATE_' requires that UNICODE be set to true or false in the root module");
pub const JET_INDEXCREATE2_ = @compileError("'JET_INDEXCREATE2_' requires that UNICODE be set to true or false in the root module");
pub const JET_INDEXCREATE3_ = @compileError("'JET_INDEXCREATE3_' requires that UNICODE be set to true or false in the root module");
pub const JET_TABLECREATE_ = @compileError("'JET_TABLECREATE_' requires that UNICODE be set to true or false in the root module");
pub const JET_TABLECREATE2_ = @compileError("'JET_TABLECREATE2_' requires that UNICODE be set to true or false in the root module");
pub const JET_TABLECREATE3_ = @compileError("'JET_TABLECREATE3_' requires that UNICODE be set to true or false in the root module");
pub const JET_TABLECREATE4_ = @compileError("'JET_TABLECREATE4_' requires that UNICODE be set to true or false in the root module");
pub const JET_RSTINFO_ = @compileError("'JET_RSTINFO_' requires that UNICODE be set to true or false in the root module");
pub const JET_SETSYSPARAM_ = @compileError("'JET_SETSYSPARAM_' requires that UNICODE be set to true or false in the root module");
pub const JET_LOGINFO_ = @compileError("'JET_LOGINFO_' requires that UNICODE be set to true or false in the root module");
pub const JET_INSTANCE_INFO_ = @compileError("'JET_INSTANCE_INFO_' requires that UNICODE be set to true or false in the root module");
pub const JetInit3 = @compileError("'JetInit3' requires that UNICODE be set to true or false in the root module");
pub const JetCreateInstance = @compileError("'JetCreateInstance' requires that UNICODE be set to true or false in the root module");
pub const JetCreateInstance2 = @compileError("'JetCreateInstance2' requires that UNICODE be set to true or false in the root module");
pub const JetSetSystemParameter = @compileError("'JetSetSystemParameter' requires that UNICODE be set to true or false in the root module");
pub const JetGetSystemParameter = @compileError("'JetGetSystemParameter' requires that UNICODE be set to true or false in the root module");
pub const JetEnableMultiInstance = @compileError("'JetEnableMultiInstance' requires that UNICODE be set to true or false in the root module");
pub const JetBeginSession = @compileError("'JetBeginSession' requires that UNICODE be set to true or false in the root module");
pub const JetCreateDatabase = @compileError("'JetCreateDatabase' requires that UNICODE be set to true or false in the root module");
pub const JetCreateDatabase2 = @compileError("'JetCreateDatabase2' requires that UNICODE be set to true or false in the root module");
pub const JetAttachDatabase = @compileError("'JetAttachDatabase' requires that UNICODE be set to true or false in the root module");
pub const JetAttachDatabase2 = @compileError("'JetAttachDatabase2' requires that UNICODE be set to true or false in the root module");
pub const JetDetachDatabase = @compileError("'JetDetachDatabase' requires that UNICODE be set to true or false in the root module");
pub const JetDetachDatabase2 = @compileError("'JetDetachDatabase2' requires that UNICODE be set to true or false in the root module");
pub const JetGetObjectInfo = @compileError("'JetGetObjectInfo' requires that UNICODE be set to true or false in the root module");
pub const JetGetTableInfo = @compileError("'JetGetTableInfo' requires that UNICODE be set to true or false in the root module");
pub const JetCreateTable = @compileError("'JetCreateTable' requires that UNICODE be set to true or false in the root module");
pub const JetCreateTableColumnIndex = @compileError("'JetCreateTableColumnIndex' requires that UNICODE be set to true or false in the root module");
pub const JetCreateTableColumnIndex2 = @compileError("'JetCreateTableColumnIndex2' requires that UNICODE be set to true or false in the root module");
pub const JetCreateTableColumnIndex3 = @compileError("'JetCreateTableColumnIndex3' requires that UNICODE be set to true or false in the root module");
pub const JetCreateTableColumnIndex4 = @compileError("'JetCreateTableColumnIndex4' requires that UNICODE be set to true or false in the root module");
pub const JetDeleteTable = @compileError("'JetDeleteTable' requires that UNICODE be set to true or false in the root module");
pub const JetRenameTable = @compileError("'JetRenameTable' requires that UNICODE be set to true or false in the root module");
pub const JetGetTableColumnInfo = @compileError("'JetGetTableColumnInfo' requires that UNICODE be set to true or false in the root module");
pub const JetGetColumnInfo = @compileError("'JetGetColumnInfo' requires that UNICODE be set to true or false in the root module");
pub const JetAddColumn = @compileError("'JetAddColumn' requires that UNICODE be set to true or false in the root module");
pub const JetDeleteColumn = @compileError("'JetDeleteColumn' requires that UNICODE be set to true or false in the root module");
pub const JetDeleteColumn2 = @compileError("'JetDeleteColumn2' requires that UNICODE be set to true or false in the root module");
pub const JetRenameColumn = @compileError("'JetRenameColumn' requires that UNICODE be set to true or false in the root module");
pub const JetSetColumnDefaultValue = @compileError("'JetSetColumnDefaultValue' requires that UNICODE be set to true or false in the root module");
pub const JetGetTableIndexInfo = @compileError("'JetGetTableIndexInfo' requires that UNICODE be set to true or false in the root module");
pub const JetGetIndexInfo = @compileError("'JetGetIndexInfo' requires that UNICODE be set to true or false in the root module");
pub const JetCreateIndex = @compileError("'JetCreateIndex' requires that UNICODE be set to true or false in the root module");
pub const JetCreateIndex2 = @compileError("'JetCreateIndex2' requires that UNICODE be set to true or false in the root module");
pub const JetCreateIndex3 = @compileError("'JetCreateIndex3' requires that UNICODE be set to true or false in the root module");
pub const JetCreateIndex4 = @compileError("'JetCreateIndex4' requires that UNICODE be set to true or false in the root module");
pub const JetDeleteIndex = @compileError("'JetDeleteIndex' requires that UNICODE be set to true or false in the root module");
pub const JetGetDatabaseInfo = @compileError("'JetGetDatabaseInfo' requires that UNICODE be set to true or false in the root module");
pub const JetGetDatabaseFileInfo = @compileError("'JetGetDatabaseFileInfo' requires that UNICODE be set to true or false in the root module");
pub const JetOpenDatabase = @compileError("'JetOpenDatabase' requires that UNICODE be set to true or false in the root module");
pub const JetOpenTable = @compileError("'JetOpenTable' requires that UNICODE be set to true or false in the root module");
pub const JetGetCurrentIndex = @compileError("'JetGetCurrentIndex' requires that UNICODE be set to true or false in the root module");
pub const JetSetCurrentIndex = @compileError("'JetSetCurrentIndex' requires that UNICODE be set to true or false in the root module");
pub const JetSetCurrentIndex2 = @compileError("'JetSetCurrentIndex2' requires that UNICODE be set to true or false in the root module");
pub const JetSetCurrentIndex3 = @compileError("'JetSetCurrentIndex3' requires that UNICODE be set to true or false in the root module");
pub const JetSetCurrentIndex4 = @compileError("'JetSetCurrentIndex4' requires that UNICODE be set to true or false in the root module");
pub const JetCompact = @compileError("'JetCompact' requires that UNICODE be set to true or false in the root module");
pub const JetDefragment = @compileError("'JetDefragment' requires that UNICODE be set to true or false in the root module");
pub const JetDefragment2 = @compileError("'JetDefragment2' requires that UNICODE be set to true or false in the root module");
pub const JetDefragment3 = @compileError("'JetDefragment3' requires that UNICODE be set to true or false in the root module");
pub const JetSetDatabaseSize = @compileError("'JetSetDatabaseSize' requires that UNICODE be set to true or false in the root module");
pub const JetBackup = @compileError("'JetBackup' requires that UNICODE be set to true or false in the root module");
pub const JetBackupInstance = @compileError("'JetBackupInstance' requires that UNICODE be set to true or false in the root module");
pub const JetRestore = @compileError("'JetRestore' requires that UNICODE be set to true or false in the root module");
pub const JetRestore2 = @compileError("'JetRestore2' requires that UNICODE be set to true or false in the root module");
pub const JetRestoreInstance = @compileError("'JetRestoreInstance' requires that UNICODE be set to true or false in the root module");
pub const JetGetAttachInfo = @compileError("'JetGetAttachInfo' requires that UNICODE be set to true or false in the root module");
pub const JetGetAttachInfoInstance = @compileError("'JetGetAttachInfoInstance' requires that UNICODE be set to true or false in the root module");
pub const JetOpenFile = @compileError("'JetOpenFile' requires that UNICODE be set to true or false in the root module");
pub const JetOpenFileInstance = @compileError("'JetOpenFileInstance' requires that UNICODE be set to true or false in the root module");
pub const JetGetLogInfo = @compileError("'JetGetLogInfo' requires that UNICODE be set to true or false in the root module");
pub const JetGetLogInfoInstance = @compileError("'JetGetLogInfoInstance' requires that UNICODE be set to true or false in the root module");
pub const JetGetLogInfoInstance2 = @compileError("'JetGetLogInfoInstance2' requires that UNICODE be set to true or false in the root module");
pub const JetGetTruncateLogInfoInstance = @compileError("'JetGetTruncateLogInfoInstance' requires that UNICODE be set to true or false in the root module");
pub const JetExternalRestore = @compileError("'JetExternalRestore' requires that UNICODE be set to true or false in the root module");
pub const JetExternalRestore2 = @compileError("'JetExternalRestore2' requires that UNICODE be set to true or false in the root module");
pub const JetGetInstanceInfo = @compileError("'JetGetInstanceInfo' requires that UNICODE be set to true or false in the root module");
pub const JetOSSnapshotFreeze = @compileError("'JetOSSnapshotFreeze' requires that UNICODE be set to true or false in the root module");
pub const JetOSSnapshotGetFreezeInfo = @compileError("'JetOSSnapshotGetFreezeInfo' requires that UNICODE be set to true or false in the root module");
},
};
//--------------------------------------------------------------------------------
// Section: Imports (25)
//--------------------------------------------------------------------------------
const Guid = @import("../zig.zig").Guid;
const BLOB = @import("../system/com.zig").BLOB;
const BOOL = @import("../foundation.zig").BOOL;
const BOOLEAN = @import("../foundation.zig").BOOLEAN;
const BSTR = @import("../foundation.zig").BSTR;
const BSTRBLOB = @import("../system/system_services.zig").BSTRBLOB;
const CHAR = @import("../system/system_services.zig").CHAR;
const CLIPDATA = @import("../system/system_services.zig").CLIPDATA;
const CY = @import("../system/system_services.zig").CY;
const DECIMAL = @import("../system/system_services.zig").DECIMAL;
const DVTARGETDEVICE = @import("../system/com.zig").DVTARGETDEVICE;
const FILETIME = @import("../foundation.zig").FILETIME;
const HRESULT = @import("../foundation.zig").HRESULT;
const HWND = @import("../foundation.zig").HWND;
const IBindStatusCallback = @import("../system/com.zig").IBindStatusCallback;
const IDispatch = @import("../system/ole_automation.zig").IDispatch;
const IUnknown = @import("../system/com.zig").IUnknown;
const LARGE_INTEGER = @import("../system/system_services.zig").LARGE_INTEGER;
const OLESTREAM = @import("../system/com.zig").OLESTREAM;
const PSTR = @import("../foundation.zig").PSTR;
const PWSTR = @import("../foundation.zig").PWSTR;
const SAFEARRAY = @import("../system/ole_automation.zig").SAFEARRAY;
const SECURITY_DESCRIPTOR = @import("../security.zig").SECURITY_DESCRIPTOR;
const STGMEDIUM = @import("../system/com.zig").STGMEDIUM;
const ULARGE_INTEGER = @import("../system/system_services.zig").ULARGE_INTEGER;
test {
// The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
if (@hasDecl(@This(), "JET_PFNSTATUS")) { _ = JET_PFNSTATUS; }
if (@hasDecl(@This(), "JET_CALLBACK")) { _ = JET_CALLBACK; }
if (@hasDecl(@This(), "JET_PFNDURABLECOMMITCALLBACK")) { _ = JET_PFNDURABLECOMMITCALLBACK; }
if (@hasDecl(@This(), "JET_PFNREALLOC")) { _ = JET_PFNREALLOC; }
@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/structured_storage.zig |
const std = @import("std");
const log = std.log.scoped(.state_machine);
pub const StateMachine = struct {
pub const Operation = enum(u8) {
/// Operations reserved by VR protocol (for all state machines):
reserved,
init,
register,
hash,
};
state: u128,
pub fn init(seed: u64) StateMachine {
return .{ .state = hash(0, std.mem.asBytes(&seed)) };
}
pub fn prepare(
state_machine: *StateMachine,
realtime: i64,
operation: Operation,
input: []u8,
) void {
_ = state_machine;
_ = realtime;
_ = operation;
_ = input;
// TODO: use realtime in some way to test the system
}
pub fn commit(
state_machine: *StateMachine,
client: u128,
operation: Operation,
input: []const u8,
output: []u8,
) usize {
switch (operation) {
.reserved, .init => unreachable,
.register => return 0,
// TODO: instead of always using the first 32 bytes of the output
// buffer, get tricky and use a random but deterministic slice
// of it, filling the rest with 0s.
.hash => {
// Fold the input into our current state, creating a hash chain.
// Hash the input with the client ID since small inputs may collide across clients.
const client_input = hash(client, input);
const new_state = hash(state_machine.state, std.mem.asBytes(&client_input));
log.debug("state={x} input={x} input.len={} new state={x}", .{
state_machine.state,
client_input,
input.len,
new_state,
});
state_machine.state = new_state;
std.mem.copy(u8, output, std.mem.asBytes(&state_machine.state));
return @sizeOf(@TypeOf(state_machine.state));
},
}
}
pub fn hash(state: u128, input: []const u8) u128 {
var key: [32]u8 = [_]u8{0} ** 32;
std.mem.copy(u8, key[0..16], std.mem.asBytes(&state));
var target: [32]u8 = undefined;
std.crypto.hash.Blake3.hash(input, &target, .{ .key = key });
return @bitCast(u128, target[0..16].*);
}
}; | src/test/state_machine.zig |
const vk = @import("vk");
const memory = @import("memory.zig");
pub fn createDefaultImage(
physical: vk.VkPhysicalDevice, device: vk.VkDevice,
width: usize, height: usize,
format: vk.VkFormat, tiling: vk.VkImageTiling, usage: vk.VkImageUsageFlags,
properties: vk.VkMemoryPropertyFlags,
img: *vk.VkImage, image_mem: *vk.VkDeviceMemory
) void {
const create_info = vk.VkImageCreateInfo{
.sType = vk.VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.imageType = vk.VK_IMAGE_TYPE_2D,
.extent = .{
.width = @intCast(u32, width),
.height = @intCast(u32, height),
.depth = 1,
},
.mipLevels = 1,
.arrayLayers = 1,
.format = format,
.tiling = tiling,
.initialLayout = vk.VK_IMAGE_LAYOUT_UNDEFINED,
.usage = usage,
.sharingMode = vk.VK_SHARING_MODE_EXCLUSIVE,
.samples = vk.VK_SAMPLE_COUNT_1_BIT,
.flags = 0,
.pNext = null,
.queueFamilyIndexCount = 0,
.pQueueFamilyIndices = null,
};
var res = vk.createImage(device, &create_info, null, img);
vk.assertSuccess(res);
var mem_requirements: vk.VkMemoryRequirements = undefined;
vk.getImageMemoryRequirements(device, img.*, &mem_requirements);
var alloc_info = vk.VkMemoryAllocateInfo{
.sType = vk.VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.allocationSize = mem_requirements.size,
.memoryTypeIndex = memory.findMemoryType(physical, mem_requirements.memoryTypeBits, properties),
.pNext = null,
};
res = vk.allocateMemory(device, &alloc_info, null, image_mem);
vk.assertSuccess(res);
res = vk.bindImageMemory(device, img.*, image_mem.*, 0);
vk.assertSuccess(res);
}
pub fn createDefaultTextureImageView(device: vk.VkDevice, tex_image: vk.VkImage) vk.VkImageView {
return createDefaultImageView(device, tex_image, vk.VK_FORMAT_R8G8B8A8_SRGB);
}
pub fn createDefaultImageView(device: vk.VkDevice, image: vk.VkImage, format: vk.VkFormat) vk.VkImageView {
var aspect_mask: u32 = vk.VK_IMAGE_ASPECT_COLOR_BIT;
if (format == vk.VK_FORMAT_D32_SFLOAT) {
aspect_mask = vk.VK_IMAGE_ASPECT_DEPTH_BIT;
}
const create_info = vk.VkImageViewCreateInfo{
.sType = vk.VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = image,
.viewType = vk.VK_IMAGE_VIEW_TYPE_2D,
.format = format,
.components = vk.VkComponentMapping{
.r = vk.VK_COMPONENT_SWIZZLE_IDENTITY,
.g = vk.VK_COMPONENT_SWIZZLE_IDENTITY,
.b = vk.VK_COMPONENT_SWIZZLE_IDENTITY,
.a = vk.VK_COMPONENT_SWIZZLE_IDENTITY,
},
.subresourceRange = vk.VkImageSubresourceRange{
.aspectMask = aspect_mask,
.baseMipLevel = 0,
.levelCount = 1,
.baseArrayLayer = 0,
.layerCount = 1,
},
.pNext = null,
.flags = 0,
};
var ret: vk.VkImageView = undefined;
const res = vk.createImageView(device, &create_info, null, &ret);
vk.assertSuccess(res);
return ret;
} | graphics/src/backend/vk/image.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqualSlices = std.testing.expectEqualSlices;
// Most tests here can be comptime but use runtime so that a stacktrace
// can show failure location.
//
// Note certain results of `@typeName()` expect `behavior.zig` to be the
// root file. Running a test against this file as root will result in
// failures.
// CAUTION: this test is source-location sensitive.
test "anon fn param - source-location sensitive" {
// https://github.com/ziglang/zig/issues/9339
try expectEqualSlices(u8, @typeName(TypeFromFn(struct {})), "behavior.typename.TypeFromFn(behavior.typename.struct:15:52)");
try expectEqualSlices(u8, @typeName(TypeFromFn(union { unused: u8 })), "behavior.typename.TypeFromFn(behavior.typename.union:16:52)");
try expectEqualSlices(u8, @typeName(TypeFromFn(enum { unused })), "behavior.typename.TypeFromFn(behavior.typename.enum:17:52)");
try expectEqualSlices(
u8,
@typeName(TypeFromFn3(struct {}, union { unused: u8 }, enum { unused })),
"behavior.typename.TypeFromFn3(behavior.typename.struct:21:31,behavior.typename.union:21:42,behavior.typename.enum:21:64)",
);
}
// CAUTION: this test is source-location sensitive.
test "anon field init" {
const Foo = .{
.T1 = struct {},
.T2 = union { unused: u8 },
.T3 = enum { unused },
};
try expectEqualSlices(u8, @typeName(Foo.T1), "behavior.typename.struct:29:15");
try expectEqualSlices(u8, @typeName(Foo.T2), "behavior.typename.union:30:15");
try expectEqualSlices(u8, @typeName(Foo.T3), "behavior.typename.enum:31:15");
}
test "basic" {
try expectEqualSlices(u8, @typeName(i64), "i64");
try expectEqualSlices(u8, @typeName(*usize), "*usize");
try expectEqualSlices(u8, @typeName([]u8), "[]u8");
}
test "top level decl" {
try expectEqualSlices(u8, @typeName(A_Struct), "A_Struct");
try expectEqualSlices(u8, @typeName(A_Union), "A_Union");
try expectEqualSlices(u8, @typeName(A_Enum), "A_Enum");
// regular fn, without error
try expectEqualSlices(u8, @typeName(@TypeOf(regular)), "fn() void");
// regular fn inside struct, with error
try expectEqualSlices(u8, @typeName(@TypeOf(B.doTest)), "fn() @typeInfo(@typeInfo(@TypeOf(behavior.typename.B.doTest)).Fn.return_type.?).ErrorUnion.error_set!void");
// generic fn
try expectEqualSlices(u8, @typeName(@TypeOf(TypeFromFn)), "fn(type) anytype");
}
const A_Struct = struct {};
const A_Union = union {
unused: u8,
};
const A_Enum = enum {
unused,
};
fn regular() void {}
test "fn body decl" {
try B.doTest();
}
const B = struct {
fn doTest() !void {
const B_Struct = struct {};
const B_Union = union {
unused: u8,
};
const B_Enum = enum {
unused,
};
try expectEqualSlices(u8, @typeName(B_Struct), "B_Struct");
try expectEqualSlices(u8, @typeName(B_Union), "B_Union");
try expectEqualSlices(u8, @typeName(B_Enum), "B_Enum");
}
};
test "fn param" {
// https://github.com/ziglang/zig/issues/675
try expectEqualSlices(u8, @typeName(TypeFromFn(u8)), "behavior.typename.TypeFromFn(u8)");
try expectEqualSlices(u8, @typeName(TypeFromFn(A_Struct)), "behavior.typename.TypeFromFn(behavior.typename.A_Struct)");
try expectEqualSlices(u8, @typeName(TypeFromFn(A_Union)), "behavior.typename.TypeFromFn(behavior.typename.A_Union)");
try expectEqualSlices(u8, @typeName(TypeFromFn(A_Enum)), "behavior.typename.TypeFromFn(behavior.typename.A_Enum)");
try expectEqualSlices(u8, @typeName(TypeFromFn2(u8, bool)), "behavior.typename.TypeFromFn2(u8,bool)");
}
fn TypeFromFn(comptime T: type) type {
_ = T;
return struct {};
}
fn TypeFromFn2(comptime T1: type, comptime T2: type) type {
_ = T1;
_ = T2;
return struct {};
}
fn TypeFromFn3(comptime T1: type, comptime T2: type, comptime T3: type) type {
_ = T1;
_ = T2;
_ = T3;
return struct {};
} | test/behavior/typename.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const Ast = std.zig.Ast;
const Zir = @import("Zir.zig");
const Module = @import("Module.zig");
const LazySrcLoc = Module.LazySrcLoc;
/// Write human-readable, debug formatted ZIR code to a file.
pub fn renderAsTextToFile(
gpa: Allocator,
scope_file: *Module.File,
fs_file: std.fs.File,
) !void {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
var writer: Writer = .{
.gpa = gpa,
.arena = arena.allocator(),
.file = scope_file,
.code = scope_file.zir,
.indent = 0,
.parent_decl_node = 0,
.recurse_decls = true,
.recurse_blocks = true,
};
var raw_stream = std.io.bufferedWriter(fs_file.writer());
const stream = raw_stream.writer();
const main_struct_inst = Zir.main_struct_inst;
try stream.print("%{d} ", .{main_struct_inst});
try writer.writeInstToStream(stream, main_struct_inst);
try stream.writeAll("\n");
const imports_index = scope_file.zir.extra[@enumToInt(Zir.ExtraIndex.imports)];
if (imports_index != 0) {
try stream.writeAll("Imports:\n");
const extra = scope_file.zir.extraData(Zir.Inst.Imports, imports_index);
var import_i: u32 = 0;
var extra_index = extra.end;
while (import_i < extra.data.imports_len) : (import_i += 1) {
const item = scope_file.zir.extraData(Zir.Inst.Imports.Item, extra_index);
extra_index = item.end;
const src: LazySrcLoc = .{ .token_abs = item.data.token };
const import_path = scope_file.zir.nullTerminatedString(item.data.name);
try stream.print(" @import(\"{}\") ", .{
std.zig.fmtEscapes(import_path),
});
try writer.writeSrc(stream, src);
try stream.writeAll("\n");
}
}
try raw_stream.flush();
}
pub fn renderInstructionContext(
gpa: Allocator,
block: []const Zir.Inst.Index,
block_index: usize,
scope_file: *Module.File,
parent_decl_node: Ast.Node.Index,
indent: u32,
stream: anytype,
) !void {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
var writer: Writer = .{
.gpa = gpa,
.arena = arena.allocator(),
.file = scope_file,
.code = scope_file.zir,
.indent = if (indent < 2) 2 else indent,
.parent_decl_node = parent_decl_node,
.recurse_decls = false,
.recurse_blocks = true,
};
try writer.writeBody(stream, block[0..block_index]);
try stream.writeByteNTimes(' ', writer.indent - 2);
try stream.print("> %{d} ", .{block[block_index]});
try writer.writeInstToStream(stream, block[block_index]);
try stream.writeByte('\n');
if (block_index + 1 < block.len) {
try writer.writeBody(stream, block[block_index + 1 ..]);
}
}
pub fn renderSingleInstruction(
gpa: Allocator,
inst: Zir.Inst.Index,
scope_file: *Module.File,
parent_decl_node: Ast.Node.Index,
indent: u32,
stream: anytype,
) !void {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
var writer: Writer = .{
.gpa = gpa,
.arena = arena.allocator(),
.file = scope_file,
.code = scope_file.zir,
.indent = indent,
.parent_decl_node = parent_decl_node,
.recurse_decls = false,
.recurse_blocks = false,
};
try stream.print("%{d} ", .{inst});
try writer.writeInstToStream(stream, inst);
}
const Writer = struct {
gpa: Allocator,
arena: Allocator,
file: *Module.File,
code: Zir,
indent: u32,
parent_decl_node: Ast.Node.Index,
recurse_decls: bool,
recurse_blocks: bool,
fn relativeToNodeIndex(self: *Writer, offset: i32) Ast.Node.Index {
return @bitCast(Ast.Node.Index, offset + @bitCast(i32, self.parent_decl_node));
}
fn writeInstToStream(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const tags = self.code.instructions.items(.tag);
const tag = tags[inst];
try stream.print("= {s}(", .{@tagName(tags[inst])});
switch (tag) {
.array_type,
.as,
.coerce_result_ptr,
.elem_ptr,
.elem_val,
.store,
.store_to_block_ptr,
.store_to_inferred_ptr,
=> try self.writeBin(stream, inst),
.alloc,
.alloc_mut,
.alloc_comptime_mut,
.indexable_ptr_len,
.anyframe_type,
.bit_not,
.bool_not,
.negate,
.negate_wrap,
.load,
.ensure_result_used,
.ensure_result_non_error,
.ret_node,
.ret_load,
.resolve_inferred_alloc,
.optional_type,
.optional_payload_safe,
.optional_payload_unsafe,
.optional_payload_safe_ptr,
.optional_payload_unsafe_ptr,
.err_union_payload_safe,
.err_union_payload_unsafe,
.err_union_payload_safe_ptr,
.err_union_payload_unsafe_ptr,
.err_union_code,
.err_union_code_ptr,
.is_non_null,
.is_non_null_ptr,
.is_non_err,
.is_non_err_ptr,
.typeof,
.struct_init_empty,
.type_info,
.size_of,
.bit_size_of,
.typeof_log2_int_type,
.log2_int_type,
.ptr_to_int,
.error_to_int,
.int_to_error,
.compile_error,
.set_eval_branch_quota,
.enum_to_int,
.align_of,
.bool_to_int,
.embed_file,
.error_name,
.panic,
.set_align_stack,
.set_cold,
.set_float_mode,
.set_runtime_safety,
.sqrt,
.sin,
.cos,
.exp,
.exp2,
.log,
.log2,
.log10,
.fabs,
.floor,
.ceil,
.trunc,
.round,
.tag_name,
.reify,
.type_name,
.frame_type,
.frame_size,
.clz,
.ctz,
.pop_count,
.byte_swap,
.bit_reverse,
.elem_type,
.@"resume",
.@"await",
.await_nosuspend,
.fence,
.switch_cond,
.switch_cond_ref,
.array_base_ptr,
.field_base_ptr,
.validate_array_init_ty,
.validate_struct_init_ty,
.make_ptr_const,
=> try self.writeUnNode(stream, inst),
.ref,
.ret_tok,
.ensure_err_payload_void,
.closure_capture,
=> try self.writeUnTok(stream, inst),
.bool_br_and,
.bool_br_or,
=> try self.writeBoolBr(stream, inst),
.array_type_sentinel => try self.writeArrayTypeSentinel(stream, inst),
.ptr_type_simple => try self.writePtrTypeSimple(stream, inst),
.ptr_type => try self.writePtrType(stream, inst),
.int => try self.writeInt(stream, inst),
.int_big => try self.writeIntBig(stream, inst),
.float => try self.writeFloat(stream, inst),
.float128 => try self.writeFloat128(stream, inst),
.str => try self.writeStr(stream, inst),
.int_type => try self.writeIntType(stream, inst),
.@"break",
.break_inline,
=> try self.writeBreak(stream, inst),
.array_init,
.array_init_ref,
.array_init_anon,
.array_init_anon_ref,
=> try self.writeArrayInit(stream, inst),
.array_init_sent,
.array_init_sent_ref,
=> try self.writeArrayInitSent(stream, inst),
.slice_start => try self.writeSliceStart(stream, inst),
.slice_end => try self.writeSliceEnd(stream, inst),
.slice_sentinel => try self.writeSliceSentinel(stream, inst),
.union_init => try self.writeUnionInit(stream, inst),
.struct_init,
.struct_init_ref,
=> try self.writeStructInit(stream, inst),
.cmpxchg_strong, .cmpxchg_weak => try self.writeCmpxchg(stream, inst),
.atomic_store => try self.writeAtomicStore(stream, inst),
.atomic_rmw => try self.writeAtomicRmw(stream, inst),
.memcpy => try self.writeMemcpy(stream, inst),
.memset => try self.writeMemset(stream, inst),
.shuffle => try self.writeShuffle(stream, inst),
.select => try self.writeSelect(stream, inst),
.mul_add => try self.writeMulAdd(stream, inst),
.field_parent_ptr => try self.writeFieldParentPtr(stream, inst),
.builtin_call => try self.writeBuiltinCall(stream, inst),
.builtin_async_call => try self.writeBuiltinAsyncCall(stream, inst),
.struct_init_anon,
.struct_init_anon_ref,
=> try self.writeStructInitAnon(stream, inst),
.field_type => try self.writeFieldType(stream, inst),
.field_type_ref => try self.writeFieldTypeRef(stream, inst),
.add,
.addwrap,
.add_sat,
.array_cat,
.array_mul,
.mul,
.mulwrap,
.mul_sat,
.sub,
.subwrap,
.sub_sat,
.cmp_lt,
.cmp_lte,
.cmp_eq,
.cmp_gte,
.cmp_gt,
.cmp_neq,
.div,
.has_decl,
.has_field,
.mod_rem,
.shl,
.shl_exact,
.shl_sat,
.shr,
.shr_exact,
.xor,
.store_node,
.error_union_type,
.merge_error_sets,
.bit_and,
.bit_or,
.float_to_int,
.int_to_float,
.int_to_ptr,
.int_to_enum,
.float_cast,
.int_cast,
.err_set_cast,
.ptr_cast,
.truncate,
.align_cast,
.div_exact,
.div_floor,
.div_trunc,
.mod,
.rem,
.bit_offset_of,
.offset_of,
.splat,
.reduce,
.atomic_load,
.bitcast,
.vector_type,
.maximum,
.minimum,
.elem_ptr_node,
.elem_val_node,
=> try self.writePlNodeBin(stream, inst),
.elem_ptr_imm => try self.writeElemPtrImm(stream, inst),
.@"export" => try self.writePlNodeExport(stream, inst),
.export_value => try self.writePlNodeExportValue(stream, inst),
.call => try self.writePlNodeCall(stream, inst),
.block,
.block_inline,
.suspend_block,
.loop,
.validate_struct_init,
.validate_struct_init_comptime,
.validate_array_init,
.validate_array_init_comptime,
.c_import,
.typeof_builtin,
=> try self.writePlNodeBlock(stream, inst),
.condbr,
.condbr_inline,
=> try self.writePlNodeCondBr(stream, inst),
.error_set_decl => try self.writeErrorSetDecl(stream, inst, .parent),
.error_set_decl_anon => try self.writeErrorSetDecl(stream, inst, .anon),
.error_set_decl_func => try self.writeErrorSetDecl(stream, inst, .func),
.switch_block => try self.writePlNodeSwitchBlock(stream, inst),
.field_ptr,
.field_val,
.field_call_bind,
=> try self.writePlNodeField(stream, inst),
.field_ptr_named,
.field_val_named,
.field_call_bind_named,
=> try self.writePlNodeFieldNamed(stream, inst),
.as_node => try self.writeAs(stream, inst),
.breakpoint,
.repeat,
.repeat_inline,
.alloc_inferred,
.alloc_inferred_mut,
.alloc_inferred_comptime,
.alloc_inferred_comptime_mut,
=> try self.writeNode(stream, inst),
.error_value,
.enum_literal,
.decl_ref,
.decl_val,
.import,
.ret_err_value,
.ret_err_value_code,
.param_anytype,
.param_anytype_comptime,
=> try self.writeStrTok(stream, inst),
.dbg_var_ptr,
.dbg_var_val,
=> try self.writeStrOp(stream, inst),
.param, .param_comptime => try self.writeParam(stream, inst),
.func => try self.writeFunc(stream, inst, false),
.func_inferred => try self.writeFunc(stream, inst, true),
.@"unreachable" => try self.writeUnreachable(stream, inst),
.switch_capture,
.switch_capture_ref,
.switch_capture_multi,
.switch_capture_multi_ref,
=> try self.writeSwitchCapture(stream, inst),
.dbg_stmt => try self.writeDbgStmt(stream, inst),
.closure_get => try self.writeInstNode(stream, inst),
.extended => try self.writeExtended(stream, inst),
}
}
fn writeExtended(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const extended = self.code.instructions.items(.data)[inst].extended;
try stream.print("{s}(", .{@tagName(extended.opcode)});
switch (extended.opcode) {
.ret_ptr,
.ret_type,
.this,
.ret_addr,
.error_return_trace,
.frame,
.frame_address,
.builtin_src,
=> try self.writeExtNode(stream, extended),
.dbg_block_begin,
.dbg_block_end,
=> try stream.writeAll("))"),
.@"asm" => try self.writeAsm(stream, extended),
.func => try self.writeFuncExtended(stream, extended),
.variable => try self.writeVarExtended(stream, extended),
.alloc => try self.writeAllocExtended(stream, extended),
.compile_log => try self.writeNodeMultiOp(stream, extended),
.typeof_peer => try self.writeTypeofPeer(stream, extended),
.add_with_overflow,
.sub_with_overflow,
.mul_with_overflow,
.shl_with_overflow,
=> try self.writeOverflowArithmetic(stream, extended),
.struct_decl => try self.writeStructDecl(stream, extended),
.union_decl => try self.writeUnionDecl(stream, extended),
.enum_decl => try self.writeEnumDecl(stream, extended),
.opaque_decl => try self.writeOpaqueDecl(stream, extended),
.c_undef, .c_include, .wasm_memory_size => {
const inst_data = self.code.extraData(Zir.Inst.UnNode, extended.operand).data;
const src: LazySrcLoc = .{ .node_offset = inst_data.node };
try self.writeInstRef(stream, inst_data.operand);
try stream.writeAll(")) ");
try self.writeSrc(stream, src);
},
.builtin_extern, .c_define, .wasm_memory_grow, .prefetch => {
const inst_data = self.code.extraData(Zir.Inst.BinNode, extended.operand).data;
const src: LazySrcLoc = .{ .node_offset = inst_data.node };
try self.writeInstRef(stream, inst_data.lhs);
try stream.writeAll(", ");
try self.writeInstRef(stream, inst_data.rhs);
try stream.writeAll(")) ");
try self.writeSrc(stream, src);
},
}
}
fn writeExtNode(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) };
try stream.writeAll(")) ");
try self.writeSrc(stream, src);
}
fn writeBin(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].bin;
try self.writeInstRef(stream, inst_data.lhs);
try stream.writeAll(", ");
try self.writeInstRef(stream, inst_data.rhs);
try stream.writeByte(')');
}
fn writeUnNode(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const inst_data = self.code.instructions.items(.data)[inst].un_node;
try self.writeInstRef(stream, inst_data.operand);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeUnTok(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const inst_data = self.code.instructions.items(.data)[inst].un_tok;
try self.writeInstRef(stream, inst_data.operand);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeArrayTypeSentinel(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.ArrayTypeSentinel, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.len);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.sentinel);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.elem_type);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writePtrTypeSimple(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const inst_data = self.code.instructions.items(.data)[inst].ptr_type_simple;
const str_allowzero = if (inst_data.is_allowzero) "allowzero, " else "";
const str_const = if (!inst_data.is_mutable) "const, " else "";
const str_volatile = if (inst_data.is_volatile) "volatile, " else "";
try self.writeInstRef(stream, inst_data.elem_type);
try stream.print(", {s}{s}{s}{s})", .{
str_allowzero,
str_const,
str_volatile,
@tagName(inst_data.size),
});
}
fn writePtrType(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const inst_data = self.code.instructions.items(.data)[inst].ptr_type;
const str_allowzero = if (inst_data.flags.is_allowzero) "allowzero, " else "";
const str_const = if (!inst_data.flags.is_mutable) "const, " else "";
const str_volatile = if (inst_data.flags.is_volatile) "volatile, " else "";
const extra = self.code.extraData(Zir.Inst.PtrType, inst_data.payload_index);
try self.writeInstRef(stream, extra.data.elem_type);
try stream.print(", {s}{s}{s}{s}", .{
str_allowzero,
str_const,
str_volatile,
@tagName(inst_data.size),
});
var extra_index = extra.end;
if (inst_data.flags.has_sentinel) {
try stream.writeAll(", ");
try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]));
extra_index += 1;
}
if (inst_data.flags.has_align) {
try stream.writeAll(", align(");
try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]));
extra_index += 1;
if (inst_data.flags.has_bit_range) {
const bit_start = extra_index + @boolToInt(inst_data.flags.has_addrspace);
try stream.writeAll(":");
try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[bit_start]));
try stream.writeAll(":");
try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[bit_start + 1]));
}
try stream.writeAll(")");
}
if (inst_data.flags.has_addrspace) {
try stream.writeAll(", addrspace(");
try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]));
try stream.writeAll(")");
}
try stream.writeAll(")");
}
fn writeInt(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].int;
try stream.print("{d})", .{inst_data});
}
fn writeIntBig(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].str;
const byte_count = inst_data.len * @sizeOf(std.math.big.Limb);
const limb_bytes = self.code.string_bytes[inst_data.start..][0..byte_count];
// limb_bytes is not aligned properly; we must allocate and copy the bytes
// in order to accomplish this.
const limbs = try self.gpa.alloc(std.math.big.Limb, inst_data.len);
defer self.gpa.free(limbs);
mem.copy(u8, mem.sliceAsBytes(limbs), limb_bytes);
const big_int: std.math.big.int.Const = .{
.limbs = limbs,
.positive = true,
};
const as_string = try big_int.toStringAlloc(self.gpa, 10, .lower);
defer self.gpa.free(as_string);
try stream.print("{s})", .{as_string});
}
fn writeFloat(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const number = self.code.instructions.items(.data)[inst].float;
try stream.print("{d})", .{number});
}
fn writeFloat128(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Float128, inst_data.payload_index).data;
const src = inst_data.src();
const number = extra.get();
// TODO improve std.format to be able to print f128 values
try stream.print("{d}) ", .{@floatCast(f64, number)});
try self.writeSrc(stream, src);
}
fn writeStr(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const inst_data = self.code.instructions.items(.data)[inst].str;
const str = inst_data.get(self.code);
try stream.print("\"{}\")", .{std.zig.fmtEscapes(str)});
}
fn writeSliceStart(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.SliceStart, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.lhs);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.start);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeSliceEnd(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.SliceEnd, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.lhs);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.start);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.end);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeSliceSentinel(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.SliceSentinel, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.lhs);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.start);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.end);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.sentinel);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeUnionInit(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.union_type);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.field_name);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.init);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeShuffle(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Shuffle, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.elem_type);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.a);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.b);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.mask);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeSelect(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Select, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.elem_type);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.pred);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.a);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.b);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeMulAdd(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.MulAdd, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.mulend1);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.mulend2);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.addend);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeBuiltinCall(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.options);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.callee);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.args);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeFieldParentPtr(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.FieldParentPtr, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.parent_type);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.field_name);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.field_ptr);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeBuiltinAsyncCall(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.AsyncCall, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.frame_buffer);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.result_ptr);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.fn_ptr);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.args);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeParam(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_tok;
const extra = self.code.extraData(Zir.Inst.Param, inst_data.payload_index);
const body = self.code.extra[extra.end..][0..extra.data.body_len];
try stream.print("\"{}\", ", .{
std.zig.fmtEscapes(self.code.nullTerminatedString(extra.data.name)),
});
if (extra.data.doc_comment != 0) {
try stream.writeAll("\n");
try self.writeDocComment(stream, extra.data.doc_comment);
try stream.writeByteNTimes(' ', self.indent);
}
try self.writeBracedBody(stream, body);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writePlNodeBin(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.lhs);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.rhs);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeElemPtrImm(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.ElemPtrImm, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.ptr);
try stream.print(", {d}) ", .{extra.index});
try self.writeSrc(stream, inst_data.src());
}
fn writePlNodeExport(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Export, inst_data.payload_index).data;
const decl_name = self.code.nullTerminatedString(extra.decl_name);
try self.writeInstRef(stream, extra.namespace);
try stream.print(", {}, ", .{std.zig.fmtId(decl_name)});
try self.writeInstRef(stream, extra.options);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writePlNodeExportValue(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.ExportValue, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.operand);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.options);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeStructInit(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.StructInit, inst_data.payload_index);
var field_i: u32 = 0;
var extra_index = extra.end;
while (field_i < extra.data.fields_len) : (field_i += 1) {
const item = self.code.extraData(Zir.Inst.StructInit.Item, extra_index);
extra_index = item.end;
if (field_i != 0) {
try stream.writeAll(", [");
} else {
try stream.writeAll("[");
}
try self.writeInstIndex(stream, item.data.field_type);
try stream.writeAll(", ");
try self.writeInstRef(stream, item.data.init);
try stream.writeAll("]");
}
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeCmpxchg(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Cmpxchg, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.ptr);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.expected_value);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.new_value);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.success_order);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.failure_order);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeAtomicStore(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.AtomicStore, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.ptr);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.operand);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.ordering);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeAtomicRmw(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.AtomicRmw, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.ptr);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.operation);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.operand);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.ordering);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeMemcpy(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Memcpy, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.dest);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.source);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.byte_count);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeMemset(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Memset, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.dest);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.byte);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.byte_count);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeStructInitAnon(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.StructInitAnon, inst_data.payload_index);
var field_i: u32 = 0;
var extra_index = extra.end;
while (field_i < extra.data.fields_len) : (field_i += 1) {
const item = self.code.extraData(Zir.Inst.StructInitAnon.Item, extra_index);
extra_index = item.end;
const field_name = self.code.nullTerminatedString(item.data.field_name);
const prefix = if (field_i != 0) ", [" else "[";
try stream.print("{s}{s}=", .{ prefix, field_name });
try self.writeInstRef(stream, item.data.init);
try stream.writeAll("]");
}
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeFieldType(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.container_type);
const field_name = self.code.nullTerminatedString(extra.name_start);
try stream.print(", {s}) ", .{field_name});
try self.writeSrc(stream, inst_data.src());
}
fn writeFieldTypeRef(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.FieldTypeRef, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.container_type);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.field_name);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeNodeMultiOp(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const extra = self.code.extraData(Zir.Inst.NodeMultiOp, extended.operand);
const src: LazySrcLoc = .{ .node_offset = extra.data.src_node };
const operands = self.code.refSlice(extra.end, extended.small);
for (operands) |operand, i| {
if (i != 0) try stream.writeAll(", ");
try self.writeInstRef(stream, operand);
}
try stream.writeAll(")) ");
try self.writeSrc(stream, src);
}
fn writeInstNode(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const inst_data = self.code.instructions.items(.data)[inst].inst_node;
try self.writeInstIndex(stream, inst_data.inst);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeAsm(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const extra = self.code.extraData(Zir.Inst.Asm, extended.operand);
const src: LazySrcLoc = .{ .node_offset = extra.data.src_node };
const outputs_len = @truncate(u5, extended.small);
const inputs_len = @truncate(u5, extended.small >> 5);
const clobbers_len = @truncate(u5, extended.small >> 10);
const is_volatile = @truncate(u1, extended.small >> 15) != 0;
const asm_source = self.code.nullTerminatedString(extra.data.asm_source);
try self.writeFlag(stream, "volatile, ", is_volatile);
try stream.print("\"{}\", ", .{std.zig.fmtEscapes(asm_source)});
try stream.writeAll(", ");
var extra_i: usize = extra.end;
var output_type_bits = extra.data.output_type_bits;
{
var i: usize = 0;
while (i < outputs_len) : (i += 1) {
const output = self.code.extraData(Zir.Inst.Asm.Output, extra_i);
extra_i = output.end;
const is_type = @truncate(u1, output_type_bits) != 0;
output_type_bits >>= 1;
const name = self.code.nullTerminatedString(output.data.name);
const constraint = self.code.nullTerminatedString(output.data.constraint);
try stream.print("output({}, \"{}\", ", .{
std.zig.fmtId(name), std.zig.fmtEscapes(constraint),
});
try self.writeFlag(stream, "->", is_type);
try self.writeInstRef(stream, output.data.operand);
try stream.writeAll(")");
if (i + 1 < outputs_len) {
try stream.writeAll("), ");
}
}
}
{
var i: usize = 0;
while (i < inputs_len) : (i += 1) {
const input = self.code.extraData(Zir.Inst.Asm.Input, extra_i);
extra_i = input.end;
const name = self.code.nullTerminatedString(input.data.name);
const constraint = self.code.nullTerminatedString(input.data.constraint);
try stream.print("input({}, \"{}\", ", .{
std.zig.fmtId(name), std.zig.fmtEscapes(constraint),
});
try self.writeInstRef(stream, input.data.operand);
try stream.writeAll(")");
if (i + 1 < inputs_len) {
try stream.writeAll(", ");
}
}
}
{
var i: usize = 0;
while (i < clobbers_len) : (i += 1) {
const str_index = self.code.extra[extra_i];
extra_i += 1;
const clobber = self.code.nullTerminatedString(str_index);
try stream.print("{}", .{std.zig.fmtId(clobber)});
if (i + 1 < clobbers_len) {
try stream.writeAll(", ");
}
}
}
try stream.writeAll(")) ");
try self.writeSrc(stream, src);
}
fn writeOverflowArithmetic(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const extra = self.code.extraData(Zir.Inst.OverflowArithmetic, extended.operand).data;
const src: LazySrcLoc = .{ .node_offset = extra.node };
try self.writeInstRef(stream, extra.lhs);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.rhs);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.ptr);
try stream.writeAll(")) ");
try self.writeSrc(stream, src);
}
fn writePlNodeCall(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Call, inst_data.payload_index);
const args = self.code.refSlice(extra.end, extra.data.flags.args_len);
if (extra.data.flags.ensure_result_used) {
try stream.writeAll("nodiscard ");
}
try stream.print(".{s}, ", .{@tagName(@intToEnum(std.builtin.CallOptions.Modifier, extra.data.flags.packed_modifier))});
try self.writeInstRef(stream, extra.data.callee);
try stream.writeAll(", [");
for (args) |arg, i| {
if (i != 0) try stream.writeAll(", ");
try self.writeInstRef(stream, arg);
}
try stream.writeAll("]) ");
try self.writeSrc(stream, inst_data.src());
}
fn writePlNodeBlock(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
try self.writePlNodeBlockWithoutSrc(stream, inst);
try self.writeSrc(stream, inst_data.src());
}
fn writePlNodeBlockWithoutSrc(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Block, inst_data.payload_index);
const body = self.code.extra[extra.end..][0..extra.data.body_len];
try self.writeBracedBody(stream, body);
try stream.writeAll(") ");
}
fn writePlNodeCondBr(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.CondBr, inst_data.payload_index);
const then_body = self.code.extra[extra.end..][0..extra.data.then_body_len];
const else_body = self.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len];
try self.writeInstRef(stream, extra.data.condition);
try stream.writeAll(", ");
try self.writeBracedBody(stream, then_body);
try stream.writeAll(", ");
try self.writeBracedBody(stream, else_body);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeStructDecl(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const small = @bitCast(Zir.Inst.StructDecl.Small, extended.small);
var extra_index: usize = extended.operand;
const src_node: ?i32 = if (small.has_src_node) blk: {
const src_node = @bitCast(i32, self.code.extra[extra_index]);
extra_index += 1;
break :blk src_node;
} else null;
const body_len = if (small.has_body_len) blk: {
const body_len = self.code.extra[extra_index];
extra_index += 1;
break :blk body_len;
} else 0;
const fields_len = if (small.has_fields_len) blk: {
const fields_len = self.code.extra[extra_index];
extra_index += 1;
break :blk fields_len;
} else 0;
const decls_len = if (small.has_decls_len) blk: {
const decls_len = self.code.extra[extra_index];
extra_index += 1;
break :blk decls_len;
} else 0;
try self.writeFlag(stream, "known_non_opv, ", small.known_non_opv);
try self.writeFlag(stream, "known_comptime_only, ", small.known_comptime_only);
try stream.print("{s}, {s}, ", .{
@tagName(small.name_strategy), @tagName(small.layout),
});
if (decls_len == 0) {
try stream.writeAll("{}, ");
} else {
try stream.writeAll("{\n");
self.indent += 2;
extra_index = try self.writeDecls(stream, decls_len, extra_index);
self.indent -= 2;
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("}, ");
}
const body = self.code.extra[extra_index..][0..body_len];
extra_index += body.len;
if (fields_len == 0) {
assert(body.len == 0);
try stream.writeAll("{}, {})");
} else {
const prev_parent_decl_node = self.parent_decl_node;
if (src_node) |off| self.parent_decl_node = self.relativeToNodeIndex(off);
try self.writeBracedDecl(stream, body);
try stream.writeAll(", {\n");
self.indent += 2;
const bits_per_field = 4;
const fields_per_u32 = 32 / bits_per_field;
const bit_bags_count = std.math.divCeil(usize, fields_len, fields_per_u32) catch unreachable;
var bit_bag_index: usize = extra_index;
extra_index += bit_bags_count;
var cur_bit_bag: u32 = undefined;
var field_i: u32 = 0;
while (field_i < fields_len) : (field_i += 1) {
if (field_i % fields_per_u32 == 0) {
cur_bit_bag = self.code.extra[bit_bag_index];
bit_bag_index += 1;
}
const has_align = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const has_default = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const is_comptime = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const unused = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
_ = unused;
const field_name = self.code.nullTerminatedString(self.code.extra[extra_index]);
extra_index += 1;
const field_type = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
const doc_comment_index = self.code.extra[extra_index];
extra_index += 1;
try self.writeDocComment(stream, doc_comment_index);
try stream.writeByteNTimes(' ', self.indent);
try self.writeFlag(stream, "comptime ", is_comptime);
try stream.print("{}: ", .{std.zig.fmtId(field_name)});
try self.writeInstRef(stream, field_type);
if (has_align) {
const align_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
try stream.writeAll(" align(");
try self.writeInstRef(stream, align_ref);
try stream.writeAll(")");
}
if (has_default) {
const default_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
try stream.writeAll(" = ");
try self.writeInstRef(stream, default_ref);
}
try stream.writeAll(",\n");
}
self.parent_decl_node = prev_parent_decl_node;
self.indent -= 2;
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("})");
}
try self.writeSrcNode(stream, src_node);
}
fn writeUnionDecl(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const small = @bitCast(Zir.Inst.UnionDecl.Small, extended.small);
var extra_index: usize = extended.operand;
const src_node: ?i32 = if (small.has_src_node) blk: {
const src_node = @bitCast(i32, self.code.extra[extra_index]);
extra_index += 1;
break :blk src_node;
} else null;
const tag_type_ref = if (small.has_tag_type) blk: {
const tag_type_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :blk tag_type_ref;
} else .none;
const body_len = if (small.has_body_len) blk: {
const body_len = self.code.extra[extra_index];
extra_index += 1;
break :blk body_len;
} else 0;
const fields_len = if (small.has_fields_len) blk: {
const fields_len = self.code.extra[extra_index];
extra_index += 1;
break :blk fields_len;
} else 0;
const decls_len = if (small.has_decls_len) blk: {
const decls_len = self.code.extra[extra_index];
extra_index += 1;
break :blk decls_len;
} else 0;
try stream.print("{s}, {s}, ", .{
@tagName(small.name_strategy), @tagName(small.layout),
});
try self.writeFlag(stream, "autoenum, ", small.auto_enum_tag);
if (decls_len == 0) {
try stream.writeAll("{}, ");
} else {
try stream.writeAll("{\n");
self.indent += 2;
extra_index = try self.writeDecls(stream, decls_len, extra_index);
self.indent -= 2;
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("}, ");
}
assert(fields_len != 0);
if (tag_type_ref != .none) {
try self.writeInstRef(stream, tag_type_ref);
try stream.writeAll(", ");
}
const body = self.code.extra[extra_index..][0..body_len];
extra_index += body.len;
const prev_parent_decl_node = self.parent_decl_node;
if (src_node) |off| self.parent_decl_node = self.relativeToNodeIndex(off);
try self.writeBracedDecl(stream, body);
try stream.writeAll(", {\n");
self.indent += 2;
const bits_per_field = 4;
const fields_per_u32 = 32 / bits_per_field;
const bit_bags_count = std.math.divCeil(usize, fields_len, fields_per_u32) catch unreachable;
const body_end = extra_index;
extra_index += bit_bags_count;
var bit_bag_index: usize = body_end;
var cur_bit_bag: u32 = undefined;
var field_i: u32 = 0;
while (field_i < fields_len) : (field_i += 1) {
if (field_i % fields_per_u32 == 0) {
cur_bit_bag = self.code.extra[bit_bag_index];
bit_bag_index += 1;
}
const has_type = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const has_align = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const has_value = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const unused = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
_ = unused;
const field_name = self.code.nullTerminatedString(self.code.extra[extra_index]);
extra_index += 1;
const doc_comment_index = self.code.extra[extra_index];
extra_index += 1;
try self.writeDocComment(stream, doc_comment_index);
try stream.writeByteNTimes(' ', self.indent);
try stream.print("{}", .{std.zig.fmtId(field_name)});
if (has_type) {
const field_type = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
try stream.writeAll(": ");
try self.writeInstRef(stream, field_type);
}
if (has_align) {
const align_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
try stream.writeAll(" align(");
try self.writeInstRef(stream, align_ref);
try stream.writeAll(")");
}
if (has_value) {
const default_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
try stream.writeAll(" = ");
try self.writeInstRef(stream, default_ref);
}
try stream.writeAll(",\n");
}
self.parent_decl_node = prev_parent_decl_node;
self.indent -= 2;
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("})");
try self.writeSrcNode(stream, src_node);
}
fn writeDecls(self: *Writer, stream: anytype, decls_len: u32, extra_start: usize) !usize {
const parent_decl_node = self.parent_decl_node;
const bit_bags_count = std.math.divCeil(usize, decls_len, 8) catch unreachable;
var extra_index = extra_start + bit_bags_count;
var bit_bag_index: usize = extra_start;
var cur_bit_bag: u32 = undefined;
var decl_i: u32 = 0;
while (decl_i < decls_len) : (decl_i += 1) {
if (decl_i % 8 == 0) {
cur_bit_bag = self.code.extra[bit_bag_index];
bit_bag_index += 1;
}
const is_pub = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const is_exported = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const has_align = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const has_section_or_addrspace = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const sub_index = extra_index;
const hash_u32s = self.code.extra[extra_index..][0..4];
extra_index += 4;
const line = self.code.extra[extra_index];
extra_index += 1;
const decl_name_index = self.code.extra[extra_index];
extra_index += 1;
const decl_index = self.code.extra[extra_index];
extra_index += 1;
const doc_comment_index = self.code.extra[extra_index];
extra_index += 1;
const align_inst: Zir.Inst.Ref = if (!has_align) .none else inst: {
const inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :inst inst;
};
const section_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: {
const inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :inst inst;
};
const addrspace_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: {
const inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :inst inst;
};
const pub_str = if (is_pub) "pub " else "";
const hash_bytes = @bitCast([16]u8, hash_u32s.*);
if (decl_name_index == 0) {
try stream.writeByteNTimes(' ', self.indent);
const name = if (is_exported) "usingnamespace" else "comptime";
try stream.writeAll(pub_str);
try stream.writeAll(name);
} else if (decl_name_index == 1) {
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("test");
} else if (decl_name_index == 2) {
try stream.writeByteNTimes(' ', self.indent);
try stream.print("[{d}] decltest {s}", .{ sub_index, self.code.nullTerminatedString(doc_comment_index) });
} else {
const raw_decl_name = self.code.nullTerminatedString(decl_name_index);
const decl_name = if (raw_decl_name.len == 0)
self.code.nullTerminatedString(decl_name_index + 1)
else
raw_decl_name;
const test_str = if (raw_decl_name.len == 0) "test \"" else "";
const export_str = if (is_exported) "export " else "";
try self.writeDocComment(stream, doc_comment_index);
try stream.writeByteNTimes(' ', self.indent);
const endquote_if_test: []const u8 = if (raw_decl_name.len == 0) "\"" else "";
try stream.print("[{d}] {s}{s}{s}{}{s}", .{
sub_index, pub_str, test_str, export_str, std.zig.fmtId(decl_name), endquote_if_test,
});
if (align_inst != .none) {
try stream.writeAll(" align(");
try self.writeInstRef(stream, align_inst);
try stream.writeAll(")");
}
if (addrspace_inst != .none) {
try stream.writeAll(" addrspace(");
try self.writeInstRef(stream, addrspace_inst);
try stream.writeAll(")");
}
if (section_inst != .none) {
try stream.writeAll(" linksection(");
try self.writeInstRef(stream, section_inst);
try stream.writeAll(")");
}
}
if (self.recurse_decls) {
const tag = self.code.instructions.items(.tag)[decl_index];
try stream.print(" line({d}) hash({}): %{d} = {s}(", .{
line, std.fmt.fmtSliceHexLower(&hash_bytes), decl_index, @tagName(tag),
});
const decl_block_inst_data = self.code.instructions.items(.data)[decl_index].pl_node;
const sub_decl_node_off = decl_block_inst_data.src_node;
self.parent_decl_node = self.relativeToNodeIndex(sub_decl_node_off);
try self.writePlNodeBlockWithoutSrc(stream, decl_index);
self.parent_decl_node = parent_decl_node;
try self.writeSrc(stream, decl_block_inst_data.src());
try stream.writeAll("\n");
} else {
try stream.print(" line({d}) hash({}): %{d} = ...\n", .{
line, std.fmt.fmtSliceHexLower(&hash_bytes), decl_index,
});
}
}
return extra_index;
}
fn writeEnumDecl(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const small = @bitCast(Zir.Inst.EnumDecl.Small, extended.small);
var extra_index: usize = extended.operand;
const src_node: ?i32 = if (small.has_src_node) blk: {
const src_node = @bitCast(i32, self.code.extra[extra_index]);
extra_index += 1;
break :blk src_node;
} else null;
const tag_type_ref = if (small.has_tag_type) blk: {
const tag_type_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :blk tag_type_ref;
} else .none;
const body_len = if (small.has_body_len) blk: {
const body_len = self.code.extra[extra_index];
extra_index += 1;
break :blk body_len;
} else 0;
const fields_len = if (small.has_fields_len) blk: {
const fields_len = self.code.extra[extra_index];
extra_index += 1;
break :blk fields_len;
} else 0;
const decls_len = if (small.has_decls_len) blk: {
const decls_len = self.code.extra[extra_index];
extra_index += 1;
break :blk decls_len;
} else 0;
try stream.print("{s}, ", .{@tagName(small.name_strategy)});
try self.writeFlag(stream, "nonexhaustive, ", small.nonexhaustive);
if (decls_len == 0) {
try stream.writeAll("{}, ");
} else {
try stream.writeAll("{\n");
self.indent += 2;
extra_index = try self.writeDecls(stream, decls_len, extra_index);
self.indent -= 2;
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("}, ");
}
if (tag_type_ref != .none) {
try self.writeInstRef(stream, tag_type_ref);
try stream.writeAll(", ");
}
const body = self.code.extra[extra_index..][0..body_len];
extra_index += body.len;
if (fields_len == 0) {
assert(body.len == 0);
try stream.writeAll("{}, {})");
} else {
const prev_parent_decl_node = self.parent_decl_node;
if (src_node) |off| self.parent_decl_node = self.relativeToNodeIndex(off);
try self.writeBracedDecl(stream, body);
try stream.writeAll(", {\n");
self.indent += 2;
const bit_bags_count = std.math.divCeil(usize, fields_len, 32) catch unreachable;
const body_end = extra_index;
extra_index += bit_bags_count;
var bit_bag_index: usize = body_end;
var cur_bit_bag: u32 = undefined;
var field_i: u32 = 0;
while (field_i < fields_len) : (field_i += 1) {
if (field_i % 32 == 0) {
cur_bit_bag = self.code.extra[bit_bag_index];
bit_bag_index += 1;
}
const has_tag_value = @truncate(u1, cur_bit_bag) != 0;
cur_bit_bag >>= 1;
const field_name = self.code.nullTerminatedString(self.code.extra[extra_index]);
extra_index += 1;
const doc_comment_index = self.code.extra[extra_index];
extra_index += 1;
try self.writeDocComment(stream, doc_comment_index);
try stream.writeByteNTimes(' ', self.indent);
try stream.print("{}", .{std.zig.fmtId(field_name)});
if (has_tag_value) {
const tag_value_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
try stream.writeAll(" = ");
try self.writeInstRef(stream, tag_value_ref);
}
try stream.writeAll(",\n");
}
self.parent_decl_node = prev_parent_decl_node;
self.indent -= 2;
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("})");
}
try self.writeSrcNode(stream, src_node);
}
fn writeOpaqueDecl(
self: *Writer,
stream: anytype,
extended: Zir.Inst.Extended.InstData,
) !void {
const small = @bitCast(Zir.Inst.OpaqueDecl.Small, extended.small);
var extra_index: usize = extended.operand;
const src_node: ?i32 = if (small.has_src_node) blk: {
const src_node = @bitCast(i32, self.code.extra[extra_index]);
extra_index += 1;
break :blk src_node;
} else null;
const decls_len = if (small.has_decls_len) blk: {
const decls_len = self.code.extra[extra_index];
extra_index += 1;
break :blk decls_len;
} else 0;
try stream.print("{s}, ", .{@tagName(small.name_strategy)});
if (decls_len == 0) {
try stream.writeAll("{})");
} else {
try stream.writeAll("{\n");
self.indent += 2;
_ = try self.writeDecls(stream, decls_len, extra_index);
self.indent -= 2;
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("})");
}
try self.writeSrcNode(stream, src_node);
}
fn writeErrorSetDecl(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
name_strategy: Zir.Inst.NameStrategy,
) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index);
try stream.print("{s}, ", .{@tagName(name_strategy)});
try stream.writeAll("{\n");
self.indent += 2;
var extra_index = @intCast(u32, extra.end);
const extra_index_end = extra_index + (extra.data.fields_len * 2);
while (extra_index < extra_index_end) : (extra_index += 2) {
const str_index = self.code.extra[extra_index];
const name = self.code.nullTerminatedString(str_index);
const doc_comment_index = self.code.extra[extra_index + 1];
try self.writeDocComment(stream, doc_comment_index);
try stream.writeByteNTimes(' ', self.indent);
try stream.print("{},\n", .{std.zig.fmtId(name)});
}
self.indent -= 2;
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("}) ");
try self.writeSrc(stream, inst_data.src());
}
fn writePlNodeSwitchBlock(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.SwitchBlock, inst_data.payload_index);
var extra_index: usize = extra.end;
const multi_cases_len = if (extra.data.bits.has_multi_cases) blk: {
const multi_cases_len = self.code.extra[extra_index];
extra_index += 1;
break :blk multi_cases_len;
} else 0;
try self.writeInstRef(stream, extra.data.operand);
try self.writeFlag(stream, ", ref", extra.data.bits.is_ref);
self.indent += 2;
else_prong: {
const special_prong = extra.data.bits.specialProng();
const prong_name = switch (special_prong) {
.@"else" => "else",
.under => "_",
else => break :else_prong,
};
const body_len = self.code.extra[extra_index];
extra_index += 1;
const body = self.code.extra[extra_index..][0..body_len];
extra_index += body.len;
try stream.writeAll(",\n");
try stream.writeByteNTimes(' ', self.indent);
try stream.print("{s} => ", .{prong_name});
try self.writeBracedBody(stream, body);
}
{
const scalar_cases_len = extra.data.bits.scalar_cases_len;
var scalar_i: usize = 0;
while (scalar_i < scalar_cases_len) : (scalar_i += 1) {
const item_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
const body_len = self.code.extra[extra_index];
extra_index += 1;
const body = self.code.extra[extra_index..][0..body_len];
extra_index += body_len;
try stream.writeAll(",\n");
try stream.writeByteNTimes(' ', self.indent);
try self.writeInstRef(stream, item_ref);
try stream.writeAll(" => ");
try self.writeBracedBody(stream, body);
}
}
{
var multi_i: usize = 0;
while (multi_i < multi_cases_len) : (multi_i += 1) {
const items_len = self.code.extra[extra_index];
extra_index += 1;
const ranges_len = self.code.extra[extra_index];
extra_index += 1;
const body_len = self.code.extra[extra_index];
extra_index += 1;
const items = self.code.refSlice(extra_index, items_len);
extra_index += items_len;
try stream.writeAll(",\n");
try stream.writeByteNTimes(' ', self.indent);
for (items) |item_ref, item_i| {
if (item_i != 0) try stream.writeAll(", ");
try self.writeInstRef(stream, item_ref);
}
var range_i: usize = 0;
while (range_i < ranges_len) : (range_i += 1) {
const item_first = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
const item_last = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
if (range_i != 0 or items.len != 0) {
try stream.writeAll(", ");
}
try self.writeInstRef(stream, item_first);
try stream.writeAll("...");
try self.writeInstRef(stream, item_last);
}
const body = self.code.extra[extra_index..][0..body_len];
extra_index += body_len;
try stream.writeAll(" => ");
try self.writeBracedBody(stream, body);
}
}
self.indent -= 2;
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writePlNodeField(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.Field, inst_data.payload_index).data;
const name = self.code.nullTerminatedString(extra.field_name_start);
try self.writeInstRef(stream, extra.lhs);
try stream.print(", \"{}\") ", .{std.zig.fmtEscapes(name)});
try self.writeSrc(stream, inst_data.src());
}
fn writePlNodeFieldNamed(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.lhs);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.field_name);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeAs(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.As, inst_data.payload_index).data;
try self.writeInstRef(stream, extra.dest_type);
try stream.writeAll(", ");
try self.writeInstRef(stream, extra.operand);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());
}
fn writeNode(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const src_node = self.code.instructions.items(.data)[inst].node;
const src: LazySrcLoc = .{ .node_offset = src_node };
try stream.writeAll(") ");
try self.writeSrc(stream, src);
}
fn writeStrTok(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
) (@TypeOf(stream).Error || error{OutOfMemory})!void {
const inst_data = self.code.instructions.items(.data)[inst].str_tok;
const str = inst_data.get(self.code);
try stream.print("\"{}\") ", .{std.zig.fmtEscapes(str)});
try self.writeSrc(stream, inst_data.src());
}
fn writeStrOp(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].str_op;
const str = inst_data.getStr(self.code);
try self.writeInstRef(stream, inst_data.operand);
try stream.print(", \"{}\")", .{std.zig.fmtEscapes(str)});
}
fn writeFunc(
self: *Writer,
stream: anytype,
inst: Zir.Inst.Index,
inferred_error_set: bool,
) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const src = inst_data.src();
const extra = self.code.extraData(Zir.Inst.Func, inst_data.payload_index);
var extra_index = extra.end;
const ret_ty_body = self.code.extra[extra_index..][0..extra.data.ret_body_len];
extra_index += ret_ty_body.len;
const body = self.code.extra[extra_index..][0..extra.data.body_len];
extra_index += body.len;
var src_locs: Zir.Inst.Func.SrcLocs = undefined;
if (body.len != 0) {
src_locs = self.code.extraData(Zir.Inst.Func.SrcLocs, extra_index).data;
}
return self.writeFuncCommon(
stream,
ret_ty_body,
inferred_error_set,
false,
false,
.none,
.none,
body,
src,
src_locs,
);
}
fn writeFuncExtended(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const extra = self.code.extraData(Zir.Inst.ExtendedFunc, extended.operand);
const src: LazySrcLoc = .{ .node_offset = extra.data.src_node };
const small = @bitCast(Zir.Inst.ExtendedFunc.Small, extended.small);
var extra_index: usize = extra.end;
if (small.has_lib_name) {
const lib_name = self.code.nullTerminatedString(self.code.extra[extra_index]);
extra_index += 1;
try stream.print("lib_name=\"{}\", ", .{std.zig.fmtEscapes(lib_name)});
}
try self.writeFlag(stream, "test, ", small.is_test);
const cc: Zir.Inst.Ref = if (!small.has_cc) .none else blk: {
const cc = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :blk cc;
};
const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: {
const align_inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :blk align_inst;
};
const ret_ty_body = self.code.extra[extra_index..][0..extra.data.ret_body_len];
extra_index += ret_ty_body.len;
const body = self.code.extra[extra_index..][0..extra.data.body_len];
extra_index += body.len;
var src_locs: Zir.Inst.Func.SrcLocs = undefined;
if (body.len != 0) {
src_locs = self.code.extraData(Zir.Inst.Func.SrcLocs, extra_index).data;
}
return self.writeFuncCommon(
stream,
ret_ty_body,
small.is_inferred_error,
small.is_var_args,
small.is_extern,
cc,
align_inst,
body,
src,
src_locs,
);
}
fn writeVarExtended(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const extra = self.code.extraData(Zir.Inst.ExtendedVar, extended.operand);
const small = @bitCast(Zir.Inst.ExtendedVar.Small, extended.small);
try self.writeInstRef(stream, extra.data.var_type);
var extra_index: usize = extra.end;
if (small.has_lib_name) {
const lib_name = self.code.nullTerminatedString(self.code.extra[extra_index]);
extra_index += 1;
try stream.print(", lib_name=\"{}\"", .{std.zig.fmtEscapes(lib_name)});
}
const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: {
const align_inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :blk align_inst;
};
const init_inst: Zir.Inst.Ref = if (!small.has_init) .none else blk: {
const init_inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :blk init_inst;
};
try self.writeFlag(stream, ", is_extern", small.is_extern);
try self.writeFlag(stream, ", is_threadlocal", small.is_threadlocal);
try self.writeOptionalInstRef(stream, ", align=", align_inst);
try self.writeOptionalInstRef(stream, ", init=", init_inst);
try stream.writeAll("))");
}
fn writeAllocExtended(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const extra = self.code.extraData(Zir.Inst.AllocExtended, extended.operand);
const small = @bitCast(Zir.Inst.AllocExtended.Small, extended.small);
const src: LazySrcLoc = .{ .node_offset = extra.data.src_node };
var extra_index: usize = extra.end;
const type_inst: Zir.Inst.Ref = if (!small.has_type) .none else blk: {
const type_inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :blk type_inst;
};
const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: {
const align_inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
extra_index += 1;
break :blk align_inst;
};
try self.writeFlag(stream, ",is_const", small.is_const);
try self.writeFlag(stream, ",is_comptime", small.is_comptime);
try self.writeOptionalInstRef(stream, ",ty=", type_inst);
try self.writeOptionalInstRef(stream, ",align=", align_inst);
try stream.writeAll(")) ");
try self.writeSrc(stream, src);
}
fn writeTypeofPeer(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const extra = self.code.extraData(Zir.Inst.TypeOfPeer, extended.operand);
const body = self.code.extra[extra.data.body_index..][0..extra.data.body_len];
try self.writeBracedBody(stream, body);
try stream.writeAll(",[");
const args = self.code.refSlice(extra.end, extended.small);
for (args) |arg, i| {
if (i != 0) try stream.writeAll(", ");
try self.writeInstRef(stream, arg);
}
try stream.writeAll("])");
}
fn writeBoolBr(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].bool_br;
const extra = self.code.extraData(Zir.Inst.Block, inst_data.payload_index);
const body = self.code.extra[extra.end..][0..extra.data.body_len];
try self.writeInstRef(stream, inst_data.lhs);
try stream.writeAll(", ");
try self.writeBracedBody(stream, body);
}
fn writeIntType(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const int_type = self.code.instructions.items(.data)[inst].int_type;
const prefix: u8 = switch (int_type.signedness) {
.signed => 'i',
.unsigned => 'u',
};
try stream.print("{c}{d}) ", .{ prefix, int_type.bit_count });
try self.writeSrc(stream, int_type.src());
}
fn writeBreak(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].@"break";
try self.writeInstIndex(stream, inst_data.block_inst);
try stream.writeAll(", ");
try self.writeInstRef(stream, inst_data.operand);
try stream.writeAll(")");
}
fn writeArrayInit(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index);
const args = self.code.refSlice(extra.end, extra.data.operands_len);
try stream.writeAll(".{");
for (args) |arg, i| {
if (i != 0) try stream.writeAll(", ");
try self.writeInstRef(stream, arg);
}
try stream.writeAll("}) ");
try self.writeSrc(stream, inst_data.src());
}
fn writeArrayInitSent(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;
const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index);
const args = self.code.refSlice(extra.end, extra.data.operands_len);
const sent = args[args.len - 1];
const elems = args[0 .. args.len - 1];
try self.writeInstRef(stream, sent);
try stream.writeAll(", ");
try stream.writeAll(".{");
for (elems) |elem, i| {
if (i != 0) try stream.writeAll(", ");
try self.writeInstRef(stream, elem);
}
try stream.writeAll("}) ");
try self.writeSrc(stream, inst_data.src());
}
fn writeUnreachable(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].@"unreachable";
const safety_str = if (inst_data.safety) "safe" else "unsafe";
try stream.print("{s}) ", .{safety_str});
try self.writeSrc(stream, inst_data.src());
}
fn writeFuncCommon(
self: *Writer,
stream: anytype,
ret_ty_body: []const Zir.Inst.Index,
inferred_error_set: bool,
var_args: bool,
is_extern: bool,
cc: Zir.Inst.Ref,
align_inst: Zir.Inst.Ref,
body: []const Zir.Inst.Index,
src: LazySrcLoc,
src_locs: Zir.Inst.Func.SrcLocs,
) !void {
if (ret_ty_body.len == 0) {
try stream.writeAll("ret_ty=void");
} else {
try stream.writeAll("ret_ty=");
try self.writeBracedBody(stream, ret_ty_body);
}
try self.writeOptionalInstRef(stream, ", cc=", cc);
try self.writeOptionalInstRef(stream, ", align=", align_inst);
try self.writeFlag(stream, ", vargs", var_args);
try self.writeFlag(stream, ", extern", is_extern);
try self.writeFlag(stream, ", inferror", inferred_error_set);
try stream.writeAll(", body=");
try self.writeBracedBody(stream, body);
try stream.writeAll(") ");
if (body.len != 0) {
try stream.print("(lbrace={d}:{d},rbrace={d}:{d}) ", .{
src_locs.lbrace_line + 1, @truncate(u16, src_locs.columns) + 1,
src_locs.rbrace_line + 1, @truncate(u16, src_locs.columns >> 16) + 1,
});
}
try self.writeSrc(stream, src);
}
fn writeSwitchCapture(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].switch_capture;
try self.writeInstIndex(stream, inst_data.switch_inst);
try stream.print(", {d})", .{inst_data.prong_index});
}
fn writeDbgStmt(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].dbg_stmt;
try stream.print("{d}, {d})", .{ inst_data.line + 1, inst_data.column + 1 });
}
fn writeInstRef(self: *Writer, stream: anytype, ref: Zir.Inst.Ref) !void {
var i: usize = @enumToInt(ref);
if (i < Zir.Inst.Ref.typed_value_map.len) {
return stream.print("@{}", .{ref});
}
i -= Zir.Inst.Ref.typed_value_map.len;
return self.writeInstIndex(stream, @intCast(Zir.Inst.Index, i));
}
fn writeInstIndex(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
_ = self;
return stream.print("%{d}", .{inst});
}
fn writeOptionalInstRef(
self: *Writer,
stream: anytype,
prefix: []const u8,
inst: Zir.Inst.Ref,
) !void {
if (inst == .none) return;
try stream.writeAll(prefix);
try self.writeInstRef(stream, inst);
}
fn writeFlag(
self: *Writer,
stream: anytype,
name: []const u8,
flag: bool,
) !void {
_ = self;
if (!flag) return;
try stream.writeAll(name);
}
fn writeSrc(self: *Writer, stream: anytype, src: LazySrcLoc) !void {
if (self.file.tree_loaded) {
const tree = self.file.tree;
const src_loc: Module.SrcLoc = .{
.file_scope = self.file,
.parent_decl_node = self.parent_decl_node,
.lazy = src,
};
const abs_byte_off = src_loc.byteOffset(self.gpa) catch unreachable;
const delta_line = std.zig.findLineColumn(tree.source, abs_byte_off);
try stream.print("{s}:{d}:{d}", .{
@tagName(src), delta_line.line + 1, delta_line.column + 1,
});
}
}
fn writeSrcNode(self: *Writer, stream: anytype, src_node: ?i32) !void {
const node_offset = src_node orelse return;
const src: LazySrcLoc = .{ .node_offset = node_offset };
try stream.writeAll(" ");
return self.writeSrc(stream, src);
}
fn writeBracedDecl(self: *Writer, stream: anytype, body: []const Zir.Inst.Index) !void {
try self.writeBracedBodyConditional(stream, body, self.recurse_decls);
}
fn writeBracedBody(self: *Writer, stream: anytype, body: []const Zir.Inst.Index) !void {
try self.writeBracedBodyConditional(stream, body, self.recurse_blocks);
}
fn writeBracedBodyConditional(self: *Writer, stream: anytype, body: []const Zir.Inst.Index, enabled: bool) !void {
if (body.len == 0) {
try stream.writeAll("{}");
} else if (enabled) {
try stream.writeAll("{\n");
self.indent += 2;
try self.writeBody(stream, body);
self.indent -= 2;
try stream.writeByteNTimes(' ', self.indent);
try stream.writeAll("}");
} else if (body.len == 1) {
try stream.writeByte('{');
try self.writeInstIndex(stream, body[0]);
try stream.writeByte('}');
} else if (body.len == 2) {
try stream.writeByte('{');
try self.writeInstIndex(stream, body[0]);
try stream.writeAll(", ");
try self.writeInstIndex(stream, body[1]);
try stream.writeByte('}');
} else {
try stream.writeByte('{');
try self.writeInstIndex(stream, body[0]);
try stream.writeAll("..");
try self.writeInstIndex(stream, body[body.len - 1]);
try stream.writeByte('}');
}
}
fn writeDocComment(self: *Writer, stream: anytype, doc_comment_index: u32) !void {
if (doc_comment_index != 0) {
const doc_comment = self.code.nullTerminatedString(doc_comment_index);
var it = std.mem.tokenize(u8, doc_comment, "\n");
while (it.next()) |doc_line| {
try stream.writeByteNTimes(' ', self.indent);
try stream.print("///{s}\n", .{doc_line});
}
}
}
fn writeBody(self: *Writer, stream: anytype, body: []const Zir.Inst.Index) !void {
for (body) |inst| {
try stream.writeByteNTimes(' ', self.indent);
try stream.print("%{d} ", .{inst});
try self.writeInstToStream(stream, inst);
try stream.writeByte('\n');
}
}
}; | src/print_zir.zig |
const std = @import("std.zig");
const builtin = @import("builtin");
const debug = std.debug;
const fs = std.fs;
const io = std.io;
const mem = std.mem;
const math = std.math;
const leb = @import("leb128.zig");
const ArrayList = std.ArrayList;
pub usingnamespace @import("dwarf_bits.zig");
const PcRange = struct {
start: u64,
end: u64,
};
const Func = struct {
pc_range: ?PcRange,
name: ?[]const u8,
};
const CompileUnit = struct {
version: u16,
is_64: bool,
die: *Die,
pc_range: ?PcRange,
};
const AbbrevTable = ArrayList(AbbrevTableEntry);
const AbbrevTableHeader = struct {
// offset from .debug_abbrev
offset: u64,
table: AbbrevTable,
};
const AbbrevTableEntry = struct {
has_children: bool,
abbrev_code: u64,
tag_id: u64,
attrs: ArrayList(AbbrevAttr),
};
const AbbrevAttr = struct {
attr_id: u64,
form_id: u64,
};
const FormValue = union(enum) {
Address: u64,
Block: []u8,
Const: Constant,
ExprLoc: []u8,
Flag: bool,
SecOffset: u64,
Ref: u64,
RefAddr: u64,
String: []const u8,
StrPtr: u64,
};
const Constant = struct {
payload: u64,
signed: bool,
fn asUnsignedLe(self: *const Constant) !u64 {
if (self.signed) return error.InvalidDebugInfo;
return self.payload;
}
};
const Die = struct {
tag_id: u64,
has_children: bool,
attrs: ArrayList(Attr),
const Attr = struct {
id: u64,
value: FormValue,
};
fn getAttr(self: *const Die, id: u64) ?*const FormValue {
for (self.attrs.items) |*attr| {
if (attr.id == id) return &attr.value;
}
return null;
}
fn getAttrAddr(self: *const Die, id: u64) !u64 {
const form_value = self.getAttr(id) orelse return error.MissingDebugInfo;
return switch (form_value.*) {
FormValue.Address => |value| value,
else => error.InvalidDebugInfo,
};
}
fn getAttrSecOffset(self: *const Die, id: u64) !u64 {
const form_value = self.getAttr(id) orelse return error.MissingDebugInfo;
return switch (form_value.*) {
FormValue.Const => |value| value.asUnsignedLe(),
FormValue.SecOffset => |value| value,
else => error.InvalidDebugInfo,
};
}
fn getAttrUnsignedLe(self: *const Die, id: u64) !u64 {
const form_value = self.getAttr(id) orelse return error.MissingDebugInfo;
return switch (form_value.*) {
FormValue.Const => |value| value.asUnsignedLe(),
else => error.InvalidDebugInfo,
};
}
fn getAttrRef(self: *const Die, id: u64) !u64 {
const form_value = self.getAttr(id) orelse return error.MissingDebugInfo;
return switch (form_value.*) {
FormValue.Ref => |value| value,
else => error.InvalidDebugInfo,
};
}
pub fn getAttrString(self: *const Die, di: *DwarfInfo, id: u64) ![]const u8 {
const form_value = self.getAttr(id) orelse return error.MissingDebugInfo;
return switch (form_value.*) {
FormValue.String => |value| value,
FormValue.StrPtr => |offset| di.getString(offset),
else => error.InvalidDebugInfo,
};
}
};
const FileEntry = struct {
file_name: []const u8,
dir_index: usize,
mtime: usize,
len_bytes: usize,
};
const LineNumberProgram = struct {
address: usize,
file: usize,
line: i64,
column: u64,
is_stmt: bool,
basic_block: bool,
end_sequence: bool,
default_is_stmt: bool,
target_address: usize,
include_dirs: []const []const u8,
file_entries: *ArrayList(FileEntry),
prev_address: usize,
prev_file: usize,
prev_line: i64,
prev_column: u64,
prev_is_stmt: bool,
prev_basic_block: bool,
prev_end_sequence: bool,
// Reset the state machine following the DWARF specification
pub fn reset(self: *LineNumberProgram) void {
self.address = 0;
self.file = 1;
self.line = 1;
self.column = 0;
self.is_stmt = self.default_is_stmt;
self.basic_block = false;
self.end_sequence = false;
// Invalidate all the remaining fields
self.prev_address = 0;
self.prev_file = undefined;
self.prev_line = undefined;
self.prev_column = undefined;
self.prev_is_stmt = undefined;
self.prev_basic_block = undefined;
self.prev_end_sequence = undefined;
}
pub fn init(is_stmt: bool, include_dirs: []const []const u8, file_entries: *ArrayList(FileEntry), target_address: usize) LineNumberProgram {
return LineNumberProgram{
.address = 0,
.file = 1,
.line = 1,
.column = 0,
.is_stmt = is_stmt,
.basic_block = false,
.end_sequence = false,
.include_dirs = include_dirs,
.file_entries = file_entries,
.default_is_stmt = is_stmt,
.target_address = target_address,
.prev_address = 0,
.prev_file = undefined,
.prev_line = undefined,
.prev_column = undefined,
.prev_is_stmt = undefined,
.prev_basic_block = undefined,
.prev_end_sequence = undefined,
};
}
pub fn checkLineMatch(self: *LineNumberProgram) !?debug.LineInfo {
if (self.target_address >= self.prev_address and self.target_address < self.address) {
const file_entry = if (self.prev_file == 0) {
return error.MissingDebugInfo;
} else if (self.prev_file - 1 >= self.file_entries.items.len) {
return error.InvalidDebugInfo;
} else
&self.file_entries.items[self.prev_file - 1];
const dir_name = if (file_entry.dir_index >= self.include_dirs.len) {
return error.InvalidDebugInfo;
} else
self.include_dirs[file_entry.dir_index];
const file_name = try fs.path.join(self.file_entries.allocator, &[_][]const u8{ dir_name, file_entry.file_name });
errdefer self.file_entries.allocator.free(file_name);
return debug.LineInfo{
.line = if (self.prev_line >= 0) @intCast(u64, self.prev_line) else 0,
.column = self.prev_column,
.file_name = file_name,
.allocator = self.file_entries.allocator,
};
}
self.prev_address = self.address;
self.prev_file = self.file;
self.prev_line = self.line;
self.prev_column = self.column;
self.prev_is_stmt = self.is_stmt;
self.prev_basic_block = self.basic_block;
self.prev_end_sequence = self.end_sequence;
return null;
}
};
fn readUnitLength(in_stream: anytype, endian: builtin.Endian, is_64: *bool) !u64 {
const first_32_bits = try in_stream.readInt(u32, endian);
is_64.* = (first_32_bits == 0xffffffff);
if (is_64.*) {
return in_stream.readInt(u64, endian);
} else {
if (first_32_bits >= 0xfffffff0) return error.InvalidDebugInfo;
// TODO this cast should not be needed
return @as(u64, first_32_bits);
}
}
// TODO the nosuspends here are workarounds
fn readAllocBytes(allocator: *mem.Allocator, in_stream: anytype, size: usize) ![]u8 {
const buf = try allocator.alloc(u8, size);
errdefer allocator.free(buf);
if ((try nosuspend in_stream.read(buf)) < size) return error.EndOfFile;
return buf;
}
// TODO the nosuspends here are workarounds
fn readAddress(in_stream: anytype, endian: builtin.Endian, is_64: bool) !u64 {
return nosuspend if (is_64)
try in_stream.readInt(u64, endian)
else
@as(u64, try in_stream.readInt(u32, endian));
}
fn parseFormValueBlockLen(allocator: *mem.Allocator, in_stream: anytype, size: usize) !FormValue {
const buf = try readAllocBytes(allocator, in_stream, size);
return FormValue{ .Block = buf };
}
// TODO the nosuspends here are workarounds
fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: anytype, endian: builtin.Endian, size: usize) !FormValue {
const block_len = try nosuspend in_stream.readVarInt(usize, endian, size);
return parseFormValueBlockLen(allocator, in_stream, block_len);
}
fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: anytype, signed: bool, endian: builtin.Endian, comptime size: i32) !FormValue {
// TODO: Please forgive me, I've worked around zig not properly spilling some intermediate values here.
// `nosuspend` should be removed from all the function calls once it is fixed.
return FormValue{
.Const = Constant{
.signed = signed,
.payload = switch (size) {
1 => try nosuspend in_stream.readInt(u8, endian),
2 => try nosuspend in_stream.readInt(u16, endian),
4 => try nosuspend in_stream.readInt(u32, endian),
8 => try nosuspend in_stream.readInt(u64, endian),
-1 => blk: {
if (signed) {
const x = try nosuspend leb.readILEB128(i64, in_stream);
break :blk @bitCast(u64, x);
} else {
const x = try nosuspend leb.readULEB128(u64, in_stream);
break :blk x;
}
},
else => @compileError("Invalid size"),
},
},
};
}
// TODO the nosuspends here are workarounds
fn parseFormValueRef(allocator: *mem.Allocator, in_stream: anytype, endian: builtin.Endian, size: i32) !FormValue {
return FormValue{
.Ref = switch (size) {
1 => try nosuspend in_stream.readInt(u8, endian),
2 => try nosuspend in_stream.readInt(u16, endian),
4 => try nosuspend in_stream.readInt(u32, endian),
8 => try nosuspend in_stream.readInt(u64, endian),
-1 => try nosuspend leb.readULEB128(u64, in_stream),
else => unreachable,
},
};
}
// TODO the nosuspends here are workarounds
fn parseFormValue(allocator: *mem.Allocator, in_stream: anytype, form_id: u64, endian: builtin.Endian, is_64: bool) anyerror!FormValue {
return switch (form_id) {
FORM_addr => FormValue{ .Address = try readAddress(in_stream, endian, @sizeOf(usize) == 8) },
FORM_block1 => parseFormValueBlock(allocator, in_stream, endian, 1),
FORM_block2 => parseFormValueBlock(allocator, in_stream, endian, 2),
FORM_block4 => parseFormValueBlock(allocator, in_stream, endian, 4),
FORM_block => {
const block_len = try nosuspend leb.readULEB128(usize, in_stream);
return parseFormValueBlockLen(allocator, in_stream, block_len);
},
FORM_data1 => parseFormValueConstant(allocator, in_stream, false, endian, 1),
FORM_data2 => parseFormValueConstant(allocator, in_stream, false, endian, 2),
FORM_data4 => parseFormValueConstant(allocator, in_stream, false, endian, 4),
FORM_data8 => parseFormValueConstant(allocator, in_stream, false, endian, 8),
FORM_udata, FORM_sdata => {
const signed = form_id == FORM_sdata;
return parseFormValueConstant(allocator, in_stream, signed, endian, -1);
},
FORM_exprloc => {
const size = try nosuspend leb.readULEB128(usize, in_stream);
const buf = try readAllocBytes(allocator, in_stream, size);
return FormValue{ .ExprLoc = buf };
},
FORM_flag => FormValue{ .Flag = (try nosuspend in_stream.readByte()) != 0 },
FORM_flag_present => FormValue{ .Flag = true },
FORM_sec_offset => FormValue{ .SecOffset = try readAddress(in_stream, endian, is_64) },
FORM_ref1 => parseFormValueRef(allocator, in_stream, endian, 1),
FORM_ref2 => parseFormValueRef(allocator, in_stream, endian, 2),
FORM_ref4 => parseFormValueRef(allocator, in_stream, endian, 4),
FORM_ref8 => parseFormValueRef(allocator, in_stream, endian, 8),
FORM_ref_udata => parseFormValueRef(allocator, in_stream, endian, -1),
FORM_ref_addr => FormValue{ .RefAddr = try readAddress(in_stream, endian, is_64) },
FORM_ref_sig8 => FormValue{ .Ref = try nosuspend in_stream.readInt(u64, endian) },
FORM_string => FormValue{ .String = try in_stream.readUntilDelimiterAlloc(allocator, 0, math.maxInt(usize)) },
FORM_strp => FormValue{ .StrPtr = try readAddress(in_stream, endian, is_64) },
FORM_indirect => {
const child_form_id = try nosuspend leb.readULEB128(u64, in_stream);
const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64));
var frame = try allocator.create(F);
defer allocator.destroy(frame);
return await @asyncCall(frame, {}, parseFormValue, .{ allocator, in_stream, child_form_id, endian, is_64 });
},
else => error.InvalidDebugInfo,
};
}
fn getAbbrevTableEntry(abbrev_table: *const AbbrevTable, abbrev_code: u64) ?*const AbbrevTableEntry {
for (abbrev_table.items) |*table_entry| {
if (table_entry.abbrev_code == abbrev_code) return table_entry;
}
return null;
}
pub const DwarfInfo = struct {
endian: builtin.Endian,
// No memory is owned by the DwarfInfo
debug_info: []const u8,
debug_abbrev: []const u8,
debug_str: []const u8,
debug_line: []const u8,
debug_ranges: ?[]const u8,
// Filled later by the initializer
abbrev_table_list: ArrayList(AbbrevTableHeader) = undefined,
compile_unit_list: ArrayList(CompileUnit) = undefined,
func_list: ArrayList(Func) = undefined,
pub fn allocator(self: DwarfInfo) *mem.Allocator {
return self.abbrev_table_list.allocator;
}
pub fn getSymbolName(di: *DwarfInfo, address: u64) ?[]const u8 {
for (di.func_list.items) |*func| {
if (func.pc_range) |range| {
if (address >= range.start and address < range.end) {
return func.name;
}
}
}
return null;
}
fn scanAllFunctions(di: *DwarfInfo) !void {
var stream = io.fixedBufferStream(di.debug_info);
const in = &stream.inStream();
const seekable = &stream.seekableStream();
var this_unit_offset: u64 = 0;
while (this_unit_offset < try seekable.getEndPos()) {
seekable.seekTo(this_unit_offset) catch |err| switch (err) {
error.EndOfStream => unreachable,
else => return err,
};
var is_64: bool = undefined;
const unit_length = try readUnitLength(in, di.endian, &is_64);
if (unit_length == 0) return;
const next_offset = unit_length + (if (is_64) @as(usize, 12) else @as(usize, 4));
const version = try in.readInt(u16, di.endian);
if (version < 2 or version > 5) return error.InvalidDebugInfo;
const debug_abbrev_offset = if (is_64) try in.readInt(u64, di.endian) else try in.readInt(u32, di.endian);
const address_size = try in.readByte();
if (address_size != @sizeOf(usize)) return error.InvalidDebugInfo;
const compile_unit_pos = try seekable.getPos();
const abbrev_table = try di.getAbbrevTable(debug_abbrev_offset);
try seekable.seekTo(compile_unit_pos);
const next_unit_pos = this_unit_offset + next_offset;
while ((try seekable.getPos()) < next_unit_pos) {
const die_obj = (try di.parseDie(in, abbrev_table, is_64)) orelse continue;
defer die_obj.attrs.deinit();
const after_die_offset = try seekable.getPos();
switch (die_obj.tag_id) {
TAG_subprogram, TAG_inlined_subroutine, TAG_subroutine, TAG_entry_point => {
const fn_name = x: {
var depth: i32 = 3;
var this_die_obj = die_obj;
// Prenvent endless loops
while (depth > 0) : (depth -= 1) {
if (this_die_obj.getAttr(AT_name)) |_| {
const name = try this_die_obj.getAttrString(di, AT_name);
break :x name;
} else if (this_die_obj.getAttr(AT_abstract_origin)) |ref| {
// Follow the DIE it points to and repeat
const ref_offset = try this_die_obj.getAttrRef(AT_abstract_origin);
if (ref_offset > next_offset) return error.InvalidDebugInfo;
try seekable.seekTo(this_unit_offset + ref_offset);
this_die_obj = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo;
} else if (this_die_obj.getAttr(AT_specification)) |ref| {
// Follow the DIE it points to and repeat
const ref_offset = try this_die_obj.getAttrRef(AT_specification);
if (ref_offset > next_offset) return error.InvalidDebugInfo;
try seekable.seekTo(this_unit_offset + ref_offset);
this_die_obj = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo;
} else {
break :x null;
}
}
break :x null;
};
const pc_range = x: {
if (die_obj.getAttrAddr(AT_low_pc)) |low_pc| {
if (die_obj.getAttr(AT_high_pc)) |high_pc_value| {
const pc_end = switch (high_pc_value.*) {
FormValue.Address => |value| value,
FormValue.Const => |value| b: {
const offset = try value.asUnsignedLe();
break :b (low_pc + offset);
},
else => return error.InvalidDebugInfo,
};
break :x PcRange{
.start = low_pc,
.end = pc_end,
};
} else {
break :x null;
}
} else |err| {
if (err != error.MissingDebugInfo) return err;
break :x null;
}
};
try di.func_list.append(Func{
.name = fn_name,
.pc_range = pc_range,
});
},
else => {},
}
try seekable.seekTo(after_die_offset);
}
this_unit_offset += next_offset;
}
}
fn scanAllCompileUnits(di: *DwarfInfo) !void {
var stream = io.fixedBufferStream(di.debug_info);
const in = &stream.inStream();
const seekable = &stream.seekableStream();
var this_unit_offset: u64 = 0;
while (this_unit_offset < try seekable.getEndPos()) {
seekable.seekTo(this_unit_offset) catch |err| switch (err) {
error.EndOfStream => unreachable,
else => return err,
};
var is_64: bool = undefined;
const unit_length = try readUnitLength(in, di.endian, &is_64);
if (unit_length == 0) return;
const next_offset = unit_length + (if (is_64) @as(usize, 12) else @as(usize, 4));
const version = try in.readInt(u16, di.endian);
if (version < 2 or version > 5) return error.InvalidDebugInfo;
const debug_abbrev_offset = if (is_64) try in.readInt(u64, di.endian) else try in.readInt(u32, di.endian);
const address_size = try in.readByte();
if (address_size != @sizeOf(usize)) return error.InvalidDebugInfo;
const compile_unit_pos = try seekable.getPos();
const abbrev_table = try di.getAbbrevTable(debug_abbrev_offset);
try seekable.seekTo(compile_unit_pos);
const compile_unit_die = try di.allocator().create(Die);
compile_unit_die.* = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo;
if (compile_unit_die.tag_id != TAG_compile_unit) return error.InvalidDebugInfo;
const pc_range = x: {
if (compile_unit_die.getAttrAddr(AT_low_pc)) |low_pc| {
if (compile_unit_die.getAttr(AT_high_pc)) |high_pc_value| {
const pc_end = switch (high_pc_value.*) {
FormValue.Address => |value| value,
FormValue.Const => |value| b: {
const offset = try value.asUnsignedLe();
break :b (low_pc + offset);
},
else => return error.InvalidDebugInfo,
};
break :x PcRange{
.start = low_pc,
.end = pc_end,
};
} else {
break :x null;
}
} else |err| {
if (err != error.MissingDebugInfo) return err;
break :x null;
}
};
try di.compile_unit_list.append(CompileUnit{
.version = version,
.is_64 = is_64,
.pc_range = pc_range,
.die = compile_unit_die,
});
this_unit_offset += next_offset;
}
}
pub fn findCompileUnit(di: *DwarfInfo, target_address: u64) !*const CompileUnit {
for (di.compile_unit_list.items) |*compile_unit| {
if (compile_unit.pc_range) |range| {
if (target_address >= range.start and target_address < range.end) return compile_unit;
}
if (di.debug_ranges) |debug_ranges| {
if (compile_unit.die.getAttrSecOffset(AT_ranges)) |ranges_offset| {
var stream = io.fixedBufferStream(debug_ranges);
const in = &stream.inStream();
const seekable = &stream.seekableStream();
// All the addresses in the list are relative to the value
// specified by DW_AT_low_pc or to some other value encoded
// in the list itself.
// If no starting value is specified use zero.
var base_address = compile_unit.die.getAttrAddr(AT_low_pc) catch |err| switch (err) {
error.MissingDebugInfo => 0,
else => return err,
};
try seekable.seekTo(ranges_offset);
while (true) {
const begin_addr = try in.readInt(usize, di.endian);
const end_addr = try in.readInt(usize, di.endian);
if (begin_addr == 0 and end_addr == 0) {
break;
}
// This entry selects a new value for the base address
if (begin_addr == math.maxInt(usize)) {
base_address = end_addr;
continue;
}
if (target_address >= base_address + begin_addr and target_address < base_address + end_addr) {
return compile_unit;
}
}
} else |err| {
if (err != error.MissingDebugInfo) return err;
continue;
}
}
}
return error.MissingDebugInfo;
}
/// Gets an already existing AbbrevTable given the abbrev_offset, or if not found,
/// seeks in the stream and parses it.
fn getAbbrevTable(di: *DwarfInfo, abbrev_offset: u64) !*const AbbrevTable {
for (di.abbrev_table_list.items) |*header| {
if (header.offset == abbrev_offset) {
return &header.table;
}
}
try di.abbrev_table_list.append(AbbrevTableHeader{
.offset = abbrev_offset,
.table = try di.parseAbbrevTable(abbrev_offset),
});
return &di.abbrev_table_list.items[di.abbrev_table_list.items.len - 1].table;
}
fn parseAbbrevTable(di: *DwarfInfo, offset: u64) !AbbrevTable {
var stream = io.fixedBufferStream(di.debug_abbrev);
const in = &stream.inStream();
const seekable = &stream.seekableStream();
try seekable.seekTo(offset);
var result = AbbrevTable.init(di.allocator());
errdefer result.deinit();
while (true) {
const abbrev_code = try leb.readULEB128(u64, in);
if (abbrev_code == 0) return result;
try result.append(AbbrevTableEntry{
.abbrev_code = abbrev_code,
.tag_id = try leb.readULEB128(u64, in),
.has_children = (try in.readByte()) == CHILDREN_yes,
.attrs = ArrayList(AbbrevAttr).init(di.allocator()),
});
const attrs = &result.items[result.items.len - 1].attrs;
while (true) {
const attr_id = try leb.readULEB128(u64, in);
const form_id = try leb.readULEB128(u64, in);
if (attr_id == 0 and form_id == 0) break;
try attrs.append(AbbrevAttr{
.attr_id = attr_id,
.form_id = form_id,
});
}
}
}
fn parseDie(di: *DwarfInfo, in_stream: anytype, abbrev_table: *const AbbrevTable, is_64: bool) !?Die {
const abbrev_code = try leb.readULEB128(u64, in_stream);
if (abbrev_code == 0) return null;
const table_entry = getAbbrevTableEntry(abbrev_table, abbrev_code) orelse return error.InvalidDebugInfo;
var result = Die{
.tag_id = table_entry.tag_id,
.has_children = table_entry.has_children,
.attrs = ArrayList(Die.Attr).init(di.allocator()),
};
try result.attrs.resize(table_entry.attrs.items.len);
for (table_entry.attrs.items) |attr, i| {
result.attrs.items[i] = Die.Attr{
.id = attr.attr_id,
.value = try parseFormValue(di.allocator(), in_stream, attr.form_id, di.endian, is_64),
};
}
return result;
}
pub fn getLineNumberInfo(di: *DwarfInfo, compile_unit: CompileUnit, target_address: usize) !debug.LineInfo {
var stream = io.fixedBufferStream(di.debug_line);
const in = &stream.inStream();
const seekable = &stream.seekableStream();
const compile_unit_cwd = try compile_unit.die.getAttrString(di, AT_comp_dir);
const line_info_offset = try compile_unit.die.getAttrSecOffset(AT_stmt_list);
try seekable.seekTo(line_info_offset);
var is_64: bool = undefined;
const unit_length = try readUnitLength(in, di.endian, &is_64);
if (unit_length == 0) {
return error.MissingDebugInfo;
}
const next_offset = unit_length + (if (is_64) @as(usize, 12) else @as(usize, 4));
const version = try in.readInt(u16, di.endian);
if (version < 2 or version > 4) return error.InvalidDebugInfo;
const prologue_length = if (is_64) try in.readInt(u64, di.endian) else try in.readInt(u32, di.endian);
const prog_start_offset = (try seekable.getPos()) + prologue_length;
const minimum_instruction_length = try in.readByte();
if (minimum_instruction_length == 0) return error.InvalidDebugInfo;
if (version >= 4) {
// maximum_operations_per_instruction
_ = try in.readByte();
}
const default_is_stmt = (try in.readByte()) != 0;
const line_base = try in.readByteSigned();
const line_range = try in.readByte();
if (line_range == 0) return error.InvalidDebugInfo;
const opcode_base = try in.readByte();
const standard_opcode_lengths = try di.allocator().alloc(u8, opcode_base - 1);
defer di.allocator().free(standard_opcode_lengths);
{
var i: usize = 0;
while (i < opcode_base - 1) : (i += 1) {
standard_opcode_lengths[i] = try in.readByte();
}
}
var include_directories = ArrayList([]const u8).init(di.allocator());
try include_directories.append(compile_unit_cwd);
while (true) {
const dir = try in.readUntilDelimiterAlloc(di.allocator(), 0, math.maxInt(usize));
if (dir.len == 0) break;
try include_directories.append(dir);
}
var file_entries = ArrayList(FileEntry).init(di.allocator());
var prog = LineNumberProgram.init(default_is_stmt, include_directories.items, &file_entries, target_address);
while (true) {
const file_name = try in.readUntilDelimiterAlloc(di.allocator(), 0, math.maxInt(usize));
if (file_name.len == 0) break;
const dir_index = try leb.readULEB128(usize, in);
const mtime = try leb.readULEB128(usize, in);
const len_bytes = try leb.readULEB128(usize, in);
try file_entries.append(FileEntry{
.file_name = file_name,
.dir_index = dir_index,
.mtime = mtime,
.len_bytes = len_bytes,
});
}
try seekable.seekTo(prog_start_offset);
const next_unit_pos = line_info_offset + next_offset;
while ((try seekable.getPos()) < next_unit_pos) {
const opcode = try in.readByte();
if (opcode == LNS_extended_op) {
const op_size = try leb.readULEB128(u64, in);
if (op_size < 1) return error.InvalidDebugInfo;
var sub_op = try in.readByte();
switch (sub_op) {
LNE_end_sequence => {
prog.end_sequence = true;
if (try prog.checkLineMatch()) |info| return info;
prog.reset();
},
LNE_set_address => {
const addr = try in.readInt(usize, di.endian);
prog.address = addr;
},
LNE_define_file => {
const file_name = try in.readUntilDelimiterAlloc(di.allocator(), 0, math.maxInt(usize));
const dir_index = try leb.readULEB128(usize, in);
const mtime = try leb.readULEB128(usize, in);
const len_bytes = try leb.readULEB128(usize, in);
try file_entries.append(FileEntry{
.file_name = file_name,
.dir_index = dir_index,
.mtime = mtime,
.len_bytes = len_bytes,
});
},
else => {
const fwd_amt = math.cast(isize, op_size - 1) catch return error.InvalidDebugInfo;
try seekable.seekBy(fwd_amt);
},
}
} else if (opcode >= opcode_base) {
// special opcodes
const adjusted_opcode = opcode - opcode_base;
const inc_addr = minimum_instruction_length * (adjusted_opcode / line_range);
const inc_line = @as(i32, line_base) + @as(i32, adjusted_opcode % line_range);
prog.line += inc_line;
prog.address += inc_addr;
if (try prog.checkLineMatch()) |info| return info;
prog.basic_block = false;
} else {
switch (opcode) {
LNS_copy => {
if (try prog.checkLineMatch()) |info| return info;
prog.basic_block = false;
},
LNS_advance_pc => {
const arg = try leb.readULEB128(usize, in);
prog.address += arg * minimum_instruction_length;
},
LNS_advance_line => {
const arg = try leb.readILEB128(i64, in);
prog.line += arg;
},
LNS_set_file => {
const arg = try leb.readULEB128(usize, in);
prog.file = arg;
},
LNS_set_column => {
const arg = try leb.readULEB128(u64, in);
prog.column = arg;
},
LNS_negate_stmt => {
prog.is_stmt = !prog.is_stmt;
},
LNS_set_basic_block => {
prog.basic_block = true;
},
LNS_const_add_pc => {
const inc_addr = minimum_instruction_length * ((255 - opcode_base) / line_range);
prog.address += inc_addr;
},
LNS_fixed_advance_pc => {
const arg = try in.readInt(u16, di.endian);
prog.address += arg;
},
LNS_set_prologue_end => {},
else => {
if (opcode - 1 >= standard_opcode_lengths.len) return error.InvalidDebugInfo;
const len_bytes = standard_opcode_lengths[opcode - 1];
try seekable.seekBy(len_bytes);
},
}
}
}
return error.MissingDebugInfo;
}
fn getString(di: *DwarfInfo, offset: u64) ![]const u8 {
if (offset > di.debug_str.len)
return error.InvalidDebugInfo;
const casted_offset = math.cast(usize, offset) catch
return error.InvalidDebugInfo;
// Valid strings always have a terminating zero byte
if (mem.indexOfScalarPos(u8, di.debug_str, casted_offset, 0)) |last| {
return di.debug_str[casted_offset..last];
}
return error.InvalidDebugInfo;
}
};
/// Initialize DWARF info. The caller has the responsibility to initialize most
/// the DwarfInfo fields before calling. These fields can be left undefined:
/// * abbrev_table_list
/// * compile_unit_list
pub fn openDwarfDebugInfo(di: *DwarfInfo, allocator: *mem.Allocator) !void {
di.abbrev_table_list = ArrayList(AbbrevTableHeader).init(allocator);
di.compile_unit_list = ArrayList(CompileUnit).init(allocator);
di.func_list = ArrayList(Func).init(allocator);
try di.scanAllFunctions();
try di.scanAllCompileUnits();
} | lib/std/dwarf.zig |
const std = @import("std");
const assert = std.debug.assert;
const expect = std.testing.expect;
const print = std.debug.print;
const time = std.time;
const Random = std.rand.Random;
const Sha256 = std.crypto.hash.sha2.Sha256;
const Timer = time.Timer;
const W = 8;
fn PrivateKey(comptime Hash: type) type {
const n = Hash.digest_length;
return struct {
const Self = @This();
pub const digest_length = n;
forward_hash_key: [n][n]u8 = undefined,
reverse_hash_key: [n][n]u8 = undefined,
pub fn init(csprng: *Random) Self {
var self = Self{};
for (self.forward_hash_key) |_, i| {
csprng.bytes(self.forward_hash_key[i][0..]);
}
for (self.reverse_hash_key) |_, i| {
csprng.bytes(self.reverse_hash_key[i][0..]);
}
return self;
}
};
}
fn PublicKey(comptime Hash: type) type {
const n = Hash.digest_length;
return struct {
const Self = @This();
pub const digest_length = n;
forward_hash_key: [n][n]u8,
reverse_hash_key: [n][n]u8,
pub fn fromPrivateKey(pk: *const PrivateKey(Hash)) Self {
var self = Self{
.forward_hash_key = pk.forward_hash_key,
.reverse_hash_key = pk.reverse_hash_key,
};
const iterations = [_]u8{(1 << W) - 1} ** n; // max iterations
multi_hash(Hash, iterations, &self.forward_hash_key, false);
multi_hash(Hash, iterations, &self.reverse_hash_key, false);
return self;
}
pub fn fromSignature(sig: *const Signature(Hash)) Self {
var self = Self{
.forward_hash_key = sig.forward_hash_key,
.reverse_hash_key = sig.reverse_hash_key,
};
multi_hash(Hash, sig.messge_digest, &self.forward_hash_key, true);
multi_hash(Hash, sig.messge_digest, &self.reverse_hash_key, false);
return self;
}
pub fn compress(self: *const Self, digest: *[n]u8) void {
var d = Hash.init(.{});
for (self.forward_hash_key) |key| {
d.update(key[0..]);
}
for (self.reverse_hash_key) |key| {
d.update(key[0..]);
}
d.final(digest);
}
};
}
fn Signature(comptime Hash: type) type {
const n = Hash.digest_length;
return struct {
const Self = @This();
pub const digest_length = n;
messge_digest: [n]u8 = undefined,
forward_hash_key: [n][n]u8,
reverse_hash_key: [n][n]u8,
pub fn fromPrivateKey(pk: *const PrivateKey(Hash), msg: []const u8) Self {
var self = Self{
.forward_hash_key = pk.forward_hash_key,
.reverse_hash_key = pk.reverse_hash_key,
};
Hash.hash(msg, self.messge_digest[0..], .{});
multi_hash(Hash, self.messge_digest, &self.forward_hash_key, false);
multi_hash(Hash, self.messge_digest, &self.reverse_hash_key, true);
return self;
}
};
}
fn multi_hash(
comptime Hash: type,
iterations: [Hash.digest_length]u8,
digest: *[Hash.digest_length][Hash.digest_length]u8,
flipbits: bool,
) void {
for (iterations) |n, i| {
const m = if (flipbits) ~n else n;
var k: usize = 0;
while (k < m) : (k += 1) {
Hash.hash(digest[i][0..], digest[i][0..], .{});
}
}
}
test "PrivateKey" {
const n = 32;
const seed = [_]u8{0} ** n;
var rand = std.rand.DefaultCsprng.init(seed);
const foo = PrivateKey(Sha256).init(&rand.random);
expect(foo.forward_hash_key[0][0] == 196);
expect(foo.reverse_hash_key[31][31] == 179);
}
test "PublicKey" {
const n = 32;
const seed = [_]u8{0} ** n;
var rand = std.rand.DefaultCsprng.init(seed);
const foo = PrivateKey(Sha256).init(&rand.random);
const bar = PublicKey(Sha256).fromPrivateKey(&foo);
expect(bar.forward_hash_key[0][0] == 117);
expect(bar.reverse_hash_key[31][31] == 190);
var digest = [_]u8{0} ** n;
bar.compress(digest[0..]);
expect(digest[0] == 42);
}
test "Signature" {
const n = 32;
const seed = [_]u8{0} ** n;
var rand = std.rand.DefaultCsprng.init(seed);
const foo = PrivateKey(Sha256).init(&rand.random);
const bar = PublicKey(Sha256).fromPrivateKey(&foo);
var pkdigest1 = [_]u8{0} ** n;
bar.compress(pkdigest1[0..]);
const sig = Signature(Sha256).fromPrivateKey(&foo, "foo");
expect(sig.forward_hash_key[0][0] == 176);
expect(sig.reverse_hash_key[31][31] == 110);
const baz = PublicKey(Sha256).fromSignature(&sig);
expect(@TypeOf(bar) == @TypeOf(baz));
var pkdigest2 = [_]u8{0} ** n;
baz.compress(pkdigest2[0..]);
expect(std.mem.eql(u8, pkdigest1[0..], pkdigest2[0..]));
}
test "Benchmark" {
const n = 32;
const seed = [_]u8{0} ** n;
var rand = std.rand.DefaultCsprng.init(seed);
var timer = try Timer.start();
const iter1 = 10000;
var start: u64 = timer.lap();
{
var i: usize = 0;
while (i < iter1) : (i += 1) {
const tmp = PrivateKey(Sha256).init(&rand.random);
std.mem.doNotOptimizeAway(&tmp);
}
}
var end: u64 = timer.read();
var t = @intToFloat(f64, end - start) / time.ns_per_s / iter1;
print("\nPrivateKey.init: {}s\n", .{t});
const foo = PrivateKey(Sha256).init(&rand.random);
const iter2 = 100;
start = timer.lap();
{
var i: usize = 0;
while (i < iter2) : (i += 1) {
const tmp = Signature(Sha256).fromPrivateKey(&foo, "foo");
std.mem.doNotOptimizeAway(&tmp);
}
}
end = timer.read();
t = @intToFloat(f64, end - start) / time.ns_per_s / iter2;
print("\nSignature.fromPrivateKey: {}s\n", .{t});
start = timer.lap();
{
var i: usize = 0;
while (i < iter2) : (i += 1) {
const tmp = PublicKey(Sha256).fromPrivateKey(&foo);
std.mem.doNotOptimizeAway(&tmp);
}
}
end = timer.read();
t = @intToFloat(f64, end - start) / time.ns_per_s / iter2;
print("\nPublicKey.fromPrivateKey: {}s\n", .{t});
} | src/main.zig |
const std = @import("std");
const string = []const u8;
const range = @import("range").range;
const input = @embedFile("../input/day04.txt");
const BingoBoard = [5][5]u32;
pub fn main() !void {
// part 1
blk: {
var iter = std.mem.split(u8, input, "\n");
const temp_numbers = iter.next().?;
_ = iter.next().?;
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const alloc = &arena.allocator;
var all_boards = std.ArrayList(BingoBoard).init(alloc);
defer all_boards.deinit();
while (iter.next()) |line| {
try all_boards.append(parseBoard(.{
line,
iter.next().?,
iter.next().?,
iter.next().?,
iter.next().?,
}));
// absorb trailing newline
_ = iter.next();
}
// get next called number
var num_iter = std.mem.split(u8, temp_numbers, ",");
while (num_iter.next()) |num_s| {
const num = std.fmt.parseUnsigned(u32, num_s, 10) catch @panic("");
// mark number in all boards
for (all_boards.items) |*board| {
for (range(5)) |_, y| {
for (range(5)) |_, x| {
if (board[y][x] == num) {
board[y][x] = 1000;
}
}
}
// // check if this board is the winner
var has_winner = false;
// check horizontals
for (range(5)) |_, y| {
var sum: u32 = 0;
for (range(5)) |_, x| {
sum += board[y][x];
}
if (sum == 5000) has_winner = true;
}
// check verticals
for (range(5)) |_, x| {
var sum: u32 = 0;
for (range(5)) |_, y| {
sum += board[y][x];
}
if (sum == 5000) has_winner = true;
}
if (has_winner) {
var unmarked_sum: u32 = 0;
for (range(5)) |_, y| {
for (range(5)) |_, x| {
var g = board[y][x];
if (g != 1000) unmarked_sum += g;
}
}
std.debug.print("{d}\n", .{unmarked_sum * num});
break :blk;
}
}
}
}
// part 2
blk1: {
var iter = std.mem.split(u8, input, "\n");
const temp_numbers = iter.next().?;
_ = iter.next().?;
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const alloc = &arena.allocator;
var all_boards = std.ArrayList(BingoBoard).init(alloc);
defer all_boards.deinit();
while (iter.next()) |line| {
try all_boards.append(parseBoard(.{
line,
iter.next().?,
iter.next().?,
iter.next().?,
iter.next().?,
}));
// absorb trailing newline
_ = iter.next();
}
// get next called number
var num_iter = std.mem.split(u8, temp_numbers, ",");
while (num_iter.next()) |num_s| {
const num = std.fmt.parseUnsigned(u32, num_s, 10) catch @panic("");
// mark number in all boards
var i: usize = 0;
while (i < all_boards.items.len) : (i += 1) {
var board = &all_boards.items[i];
markNumber(board, num);
// // check if this board is the winner
var has_winner = false;
// check horizontals
for (range(5)) |_, y| {
var sum: u32 = 0;
for (range(5)) |_, x| {
sum += board[y][x];
}
if (sum == 5000) has_winner = true;
}
// check verticals
for (range(5)) |_, x| {
var sum: u32 = 0;
for (range(5)) |_, y| {
sum += board[y][x];
}
if (sum == 5000) has_winner = true;
}
if (has_winner) {
if (all_boards.items.len == 1) {
const unmarked_sum = unmarkedSum(board);
std.debug.print("{d}\n", .{unmarked_sum * num});
break :blk1;
} else {
_ = all_boards.orderedRemove(i);
}
}
}
}
}
}
fn parseBoard(lines: [5]string) BingoBoard {
return .{
parseLine(lines[0]),
parseLine(lines[1]),
parseLine(lines[2]),
parseLine(lines[3]),
parseLine(lines[4]),
};
}
fn parseLine(line: string) [5]u32 {
return .{
std.fmt.parseUnsigned(u32, std.mem.trim(u8, line[0..2], " "), 10) catch @panic(""),
std.fmt.parseUnsigned(u32, std.mem.trim(u8, line[3..5], " "), 10) catch @panic(""),
std.fmt.parseUnsigned(u32, std.mem.trim(u8, line[6..8], " "), 10) catch @panic(""),
std.fmt.parseUnsigned(u32, std.mem.trim(u8, line[9..11], " "), 10) catch @panic(""),
std.fmt.parseUnsigned(u32, std.mem.trim(u8, line[12..14], " "), 10) catch @panic(""),
};
}
fn markNumber(board: *BingoBoard, n: u32) void {
for (range(5)) |_, y| {
for (range(5)) |_, x| {
if (board[y][x] == n) {
board[y][x] = 1000;
}
}
}
}
fn unmarkedSum(board: *BingoBoard) u32 {
var sum: u32 = 0;
for (range(5)) |_, y| {
for (range(5)) |_, x| {
var g = board[y][x];
if (g != 1000) sum += g;
}
}
return sum;
} | src/day04.zig |
const std = @import("std");
const serial = @import("serial-port.zig");
pub const Color = enum(u4) {
black = 0,
blue = 1,
green = 2,
cyan = 3,
red = 4,
magenta = 5,
brown = 6,
lightGray = 7,
gray = 8,
lightBlue = 9,
lightGreen = 10,
lightCyan = 11,
lightRed = 12,
lightMagenta = 13,
yellow = 14,
white = 15,
};
pub const Char = packed struct {
char: u8,
foreground: Color,
background: Color,
};
pub const WIDTH = 80;
pub const HEIGHT = 25;
var videoBuffer = @intToPtr(*[HEIGHT][WIDTH]Char, 0xB8000);
var currentForeground: Color = .lightGray;
var currentBackground: Color = .black;
var cursorX: u16 = 0;
var cursorY: u16 = 0;
pub var enable_serial = true;
pub var enable_video = true;
pub fn clear() void {
cursorX = 0;
cursorY = 0;
for (videoBuffer) |*line| {
for (line) |*char| {
char.* = Char{
.char = ' ',
.foreground = currentForeground,
.background = currentBackground,
};
}
}
}
pub fn resetColors() void {
currentForeground = .lightGray;
currentBackground = .black;
}
pub fn setForegroundColor(color: Color) void {
currentForeground = color;
}
pub fn setBackgroundColor(color: Color) void {
currentBackground = color;
}
pub fn setColors(foreground: Color, background: Color) void {
currentBackground = background;
currentForeground = foreground;
}
pub fn scroll(lineCount: usize) void {
var i: usize = 0;
while (i < lineCount) : (i += 1) {
var y: usize = 0;
while (y < HEIGHT - 1) : (y += 1) {
videoBuffer.*[y] = videoBuffer.*[y + 1];
}
videoBuffer.*[HEIGHT - 1] = [1]Char{Char{
.background = .black,
.foreground = .black,
.char = ' ',
}} ** WIDTH;
}
cursorY -= 1;
}
fn newline() void {
cursorY += 1;
if (cursorY >= HEIGHT) {
scroll(1);
}
}
fn put_raw(c: u8) void {
if (!enable_video) return;
videoBuffer[cursorY][cursorX] = Char{
.char = c,
.foreground = currentForeground,
.background = currentBackground,
};
cursorX += 1;
if (cursorX >= WIDTH) {
cursorX = 0;
newline();
}
}
pub fn put(c: u8) void {
if (enable_serial)
serial.put(c);
switch (c) {
'\r' => cursorX = 0,
'\n' => newline(),
'\t' => {
const oldpos = cursorX;
cursorX = (cursorX & ~@as(u16, 3)) + 4;
// std.mem.set(Char, videoBuffer[cursorY][oldpos..cursorX], Char{
// .char = ' ',
// .foreground = currentForeground,
// .background = currentBackground,
// });
if (cursorX >= WIDTH)
newline();
},
else => put_raw(c),
}
}
fn write_raw(raw: []const u8) void {
for (raw) |c| {
put_raw(c);
}
}
pub fn write(text: []const u8) void {
for (text) |c| {
put(c);
}
}
fn putFormat(x: void, data: []const u8) error{NeverHappens}!void {
write(data);
}
pub fn print(comptime fmt: []const u8, params: var) void {
std.fmt.format(void{}, error{NeverHappens}, putFormat, fmt, params) catch |err| switch (err) {
error.NeverHappens => unreachable,
};
}
pub fn println(comptime fmt: []const u8, params: var) void {
print(fmt, params);
write("\r\n");
} | src/kernel/arch/x86/boot/tty.zig |
const std = @import("std");
const ascii = std.ascii;
const assert = std.debug.assert;
const nodes = @import("nodes.zig");
const strings = @import("strings.zig");
const zunicode = @import("zunicode");
pub const AutolinkProcessor = struct {
allocator: *std.mem.Allocator,
text: *[]u8,
pub fn init(allocator: *std.mem.Allocator, text: *[]u8) AutolinkProcessor {
return .{
.allocator = allocator,
.text = text,
};
}
const Match = struct {
post: *nodes.AstNode,
reverse: usize,
skip: usize,
};
pub fn process(self: AutolinkProcessor, node: *nodes.AstNode) !void {
const len = self.text.len;
var i: usize = 0;
while (i < len) {
var post_org: ?Match = blk: {
while (i < len) : (i += 1) {
switch (self.text.*[i]) {
'w' => if (try self.wwwMatch(i)) |match| {
break :blk match;
},
':' => if (try self.urlMatch(i)) |match| {
break :blk match;
},
'@' => if (try self.emailMatch(i)) |match| {
break :blk match;
},
else => {},
}
}
break :blk null;
};
if (post_org) |org| {
i -= org.reverse;
node.insertAfter(org.post);
if (i + org.skip < len) {
const remain = self.text.*[i + org.skip ..];
assert(remain.len > 0);
org.post.insertAfter(try self.makeInline(.{ .Text = try self.allocator.dupe(u8, remain) }));
}
self.text.* = self.allocator.shrink(self.text.*, i);
return;
}
}
}
const WWW_DELIMS = strings.createMap("*_~([");
fn wwwMatch(self: AutolinkProcessor, i: usize) !?Match {
if (i > 0 and !ascii.isSpace(self.text.*[i - 1]) and !WWW_DELIMS[self.text.*[i - 1]]) {
return null;
}
if (!std.mem.startsWith(u8, self.text.*[i..], "www.")) {
return null;
}
var link_end = (try checkDomain(self.text.*[i..], false)) orelse return null;
while (i + link_end < self.text.len and
!ascii.isSpace(self.text.*[i + link_end])) : (link_end += 1)
{}
link_end = autolinkDelim(self.text.*[i..], link_end);
var url = try std.ArrayList(u8).initCapacity(self.allocator, 7 + link_end);
try url.appendSlice("http://");
try url.appendSlice(self.text.*[i .. link_end + i]);
var inl = try self.makeInline(.{
.Link = .{
.url = url.toOwnedSlice(),
.title = &[_]u8{},
},
});
inl.append(try self.makeInline(.{
.Text = try self.allocator.dupe(u8, self.text.*[i .. link_end + i]),
}));
return Match{
.post = inl,
.reverse = 0,
.skip = link_end,
};
}
const SCHEMES = [_][]const u8{ "http", "https", "ftp" };
fn urlMatch(self: AutolinkProcessor, i: usize) !?Match {
const size = self.text.len;
if (size - i < 4 or self.text.*[i + 1] != '/' or self.text.*[i + 2] != '/') {
return null;
}
var rewind: usize = 0;
while (rewind < i and
ascii.isAlpha(self.text.*[i - rewind - 1])) : (rewind += 1)
{}
if (!scheme_matched: {
for (SCHEMES) |scheme| {
if (size - i + rewind >= scheme.len and std.mem.eql(u8, self.text.*[i - rewind .. i], scheme)) {
break :scheme_matched true;
}
}
break :scheme_matched false;
}) {
return null;
}
var link_end = (try checkDomain(self.text.*[i + 3 ..], true)) orelse return null;
while (link_end < size - i and !ascii.isSpace(self.text.*[i + link_end])) : (link_end += 1) {}
link_end = autolinkDelim(self.text.*[i..], link_end);
const url = self.text.*[i - rewind .. i + link_end];
var inl = try self.makeInline(.{
.Link = .{
.url = try self.allocator.dupe(u8, url),
.title = &[_]u8{},
},
});
inl.append(try self.makeInline(.{ .Text = try self.allocator.dupe(u8, url) }));
return Match{
.post = inl,
.reverse = rewind,
.skip = rewind + link_end,
};
}
const EMAIL_OK_SET = strings.createMap(".+-_");
fn emailMatch(self: AutolinkProcessor, i: usize) !?Match {
const size = self.text.len;
var rewind: usize = 0;
var ns: usize = 0;
while (rewind < i) {
const c = self.text.*[i - rewind - 1];
if (ascii.isAlNum(c) or EMAIL_OK_SET[c]) {
rewind += 1;
continue;
}
if (c == '/') {
ns += 1;
}
break;
}
if (rewind == 0 or ns > 0) {
return null;
}
var link_end: usize = 0;
var nb: usize = 0;
var np: usize = 0;
while (link_end < size - i) {
const c = self.text.*[i + link_end];
if (ascii.isAlNum(c)) {
// empty
} else if (c == '@') {
nb += 1;
} else if (c == '.' and link_end < size - i - 1 and ascii.isAlNum(self.text.*[i + link_end + 1])) {
np += 1;
} else if (c != '-' and c != '_') {
break;
}
link_end += 1;
}
if (link_end < 2 or nb != 1 or np == 0 or (!ascii.isAlpha(self.text.*[i + link_end - 1]) and self.text.*[i + link_end - 1] != '.')) {
return null;
}
link_end = autolinkDelim(self.text.*[i..], link_end);
var url = try std.ArrayList(u8).initCapacity(self.allocator, 7 + link_end - rewind);
try url.appendSlice("mailto:");
try url.appendSlice(self.text.*[i - rewind .. link_end + i]);
var inl = try self.makeInline(.{
.Link = .{
.url = url.toOwnedSlice(),
.title = &[_]u8{},
},
});
inl.append(try self.makeInline(.{ .Text = try self.allocator.dupe(u8, self.text.*[i - rewind .. link_end + i]) }));
return Match{
.post = inl,
.reverse = rewind,
.skip = rewind + link_end,
};
}
fn checkDomain(data: []const u8, allow_short: bool) !?usize {
var np: usize = 0;
var uscore1: usize = 0;
var uscore2: usize = 0;
var view = std.unicode.Utf8View.initUnchecked(data);
var it = view.iterator();
var last_i = it.i;
while (it.nextCodepoint()) |c| {
if (c == '_') {
uscore2 += 1;
} else if (c == '.') {
uscore1 = uscore2;
uscore2 = 0;
np += 1;
} else if (!isValidHostchar(c) and c != '-') {
if (uscore1 == 0 and uscore2 == 0 and np > 0) {
return last_i;
}
return null;
}
last_i = it.i;
}
if (uscore1 > 0 or uscore2 > 0) {
return null;
} else if (allow_short or np > 0) {
return data.len;
} else {
return null;
}
}
fn isValidHostchar(c: u21) bool {
return !zunicode.isSpace(c) and !zunicode.isPunct(c);
}
const LINK_END_ASSORTMENT = strings.createMap("?!.,:*_~'\"");
fn autolinkDelim(data: []const u8, in_link_end: usize) usize {
var link_end = in_link_end;
for (data[0..link_end]) |c, i| {
if (c == '<') {
link_end = i;
break;
}
}
while (link_end > 0) {
const cclose = data[link_end - 1];
const copen: ?u8 = if (cclose == ')') '(' else null;
if (LINK_END_ASSORTMENT[cclose]) {
link_end -= 1;
} else if (cclose == ';') {
var new_end = link_end - 2;
while (new_end > 0 and
ascii.isAlNum(data[new_end])) : (new_end -= 1)
{}
if (new_end < link_end - 2 and data[new_end] == '&') {
link_end = new_end;
} else {
link_end -= 1;
}
} else if (copen) |c| {
var opening: usize = 0;
var closing: usize = 0;
for (data[0..link_end]) |b| {
if (b == c) {
opening += 1;
} else if (b == cclose) {
closing += 1;
}
}
if (closing <= opening) break;
link_end -= 1;
} else {
break;
}
}
return link_end;
}
fn makeInline(self: AutolinkProcessor, value: nodes.NodeValue) !*nodes.AstNode {
return nodes.AstNode.create(self.allocator, .{
.value = value,
.content = std.ArrayList(u8).init(self.allocator),
});
}
}; | src/autolink.zig |
const std = @import("std");
const hzzp = @import("hzzp");
const wz = @import("wz");
const ssl = @import("zig-bearssl");
const analBuddy = @import("analysis-buddy");
const format = @import("format.zig");
const request = @import("request.zig");
const util = @import("util.zig");
const agent = "zigbot9001/0.0.1";
const auto_restart = true;
//const auto_restart = std.builtin.mode == .Debug;
pub usingnamespace if (auto_restart) RestartHandler else struct {};
const RestartHandler = struct {
pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn {
std.debug.print("PANIC -- {s}\n", .{msg});
if (error_return_trace) |t| {
std.debug.dumpStackTrace(t.*);
}
std.debug.dumpCurrentStackTrace(@returnAddress());
const err = std.os.execveZ(
std.os.argv[0],
@ptrCast([*:null]?[*:0]u8, std.os.argv.ptr),
@ptrCast([*:null]?[*:0]u8, std.os.environ.ptr),
);
std.debug.print("{s}\n", .{@errorName(err)});
std.os.exit(42);
}
};
fn Buffer(comptime max_len: usize) type {
return struct {
data: [max_len]u8 = undefined,
len: usize = 0,
fn initFrom(data: []const u8) @This() {
var result: @This() = undefined;
std.mem.copy(u8, &result.data, data);
result.len = data.len;
return result;
}
fn slice(self: @This()) []const u8 {
return self.data[0..self.len];
}
fn append(self: *@This(), char: u8) !void {
if (self.len >= max_len) {
return error.NoSpaceLeft;
}
self.data[self.len] = char;
self.len += 1;
}
fn last(self: @This()) ?u8 {
if (self.len > 0) {
return self.data[self.len - 1];
} else {
return null;
}
}
fn pop(self: *@This()) !u8 {
return self.last() orelse error.Empty;
}
};
}
const Context = struct {
allocator: *std.mem.Allocator,
auth_token: []const u8,
github_auth_token: ?[]const u8,
prng: std.rand.DefaultPrng,
prepared_anal: analBuddy.PrepareResult,
timer: std.time.Timer,
ask_mailbox: util.Mailbox(AskData),
ask_thread: *std.Thread,
// TODO move this to instance variable somehow?
var awaiting_enema = false;
const AskData = struct { ask: Buffer(0x100), channel_id: u64 };
pub fn init(allocator: *std.mem.Allocator, auth_token: []const u8, ziglib: []const u8, github_auth_token: ?[]const u8) !*Context {
const result = try allocator.create(Context);
errdefer allocator.destroy(result);
result.allocator = allocator;
result.auth_token = auth_token;
result.github_auth_token = github_auth_token;
result.prng = std.rand.DefaultPrng.init(@bitCast(u64, std.time.timestamp()));
result.prepared_anal = try analBuddy.prepare(allocator, ziglib);
errdefer analBuddy.dispose(&result.prepared_anal);
result.timer = try std.time.Timer.start();
result.ask_mailbox = util.Mailbox(AskData).init();
result.ask_thread = try std.Thread.spawn(result, askHandler);
std.os.sigaction(
std.os.SIGWINCH,
&std.os.Sigaction{
.handler = .{
.handler = winchHandler,
},
.mask = std.os.empty_sigset,
.flags = 0,
},
null,
);
return result;
}
fn winchHandler(signum: c_int) callconv(.C) void {
awaiting_enema = true;
}
pub fn askHandler(self: *Context) void {
while (true) {
const mailbox = self.ask_mailbox.get();
self.askOne(mailbox.channel_id, mailbox.ask.slice()) catch |err| {
std.debug.print("{s}\n", .{err});
};
}
}
pub fn askOne(self: *Context, channel_id: u64, ask: []const u8) !void {
const swh = util.Swhash(16);
switch (swh.match(ask)) {
swh.case("ping") => return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "pong",
.description =
\\```
\\ ,;;;!!!!!;;.
\\ :!!!!!!!!!!!!!!;
\\ :!!!!!!!!!!!!!!!!!;
\\ ;!!!!!!!!!!!!!!!!!!!;
\\ ;!!!!!!!!!!!!!!!!!!!!!
\\ ;!!!!!!!!!!!!!!!!!!!!'
\\ ;!!!!!!!!!!!!!!!!!!!'
\\ :!!!!!!!!!!!!!!!!'
\\ ,!!!!!!!!!!!!!''
\\ ,;!!!''''''''''
\\ .!!!!'
\\!!!!`
\\```
}),
swh.case("status") => {
const rusage = std.os.getrusage(std.os.RUSAGE_SELF);
const cpu_sec = (rusage.utime.tv_sec + rusage.stime.tv_sec) * 1000;
const cpu_us = @divFloor(rusage.utime.tv_usec + rusage.stime.tv_usec, 1000);
var buf: [0x1000]u8 = undefined;
return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "",
.description = std.fmt.bufPrint(
&buf,
\\```
\\Uptime: {s}
\\CPU time: {s}
\\Max RSS: {Bi:.3}
\\```
,
.{
format.time(@intCast(i64, self.timer.read() / std.time.ns_per_ms)),
format.time(cpu_sec + cpu_us),
@intCast(u64, rusage.maxrss),
},
) catch unreachable,
});
},
swh.case("zen") => return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "For Great Justice",
.description =
\\```
\\* Communicate intent precisely.
\\* Edge cases matter.
\\* Favor reading code over writing code.
\\* Only one obvious way to do things.
\\* Runtime crashes are better than bugs.
\\* Compile errors are better than runtime crashes.
\\* Incremental improvements.
\\* Avoid local maximums.
\\* Reduce the amount one must remember.
\\* Focus on code rather than style.
\\* Resource allocation may fail; resource deallocation must succeed.
\\* Memory is a resource.
\\* Together we serve the users.
\\```
}),
swh.case("zenlang"),
swh.case("v"),
swh.case("vlang"),
=> return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "bruh",
}),
swh.case("u0") => return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "Zig's billion dollar mistake™",
.description = "https://github.com/ziglang/zig/issues/1530#issuecomment-422113755",
}),
swh.case("tater") => return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "",
.image = "https://memegenerator.net/img/instances/41913604.jpg",
}),
swh.case("5076"), swh.case("ziglang/zig#5076") => return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.color = .green,
.title = "ziglang/zig — issue #5076",
.description =
\\~~[syntax: drop the `const` keyword in global scopes](https://github.com/ziglang/zig/issues/5076)~~
\\https://www.youtube.com/watch?v=880uR25pP5U
}),
swh.case("submodule"), swh.case("submodules") => return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "git submodules are the devil — _andrewrk_",
.description = "https://github.com/ziglang/zig-bootstrap/issues/17#issuecomment-609980730",
}),
swh.case("2.718"), swh.case("2.71828") => return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "",
.image = "https://camo.githubusercontent.com/7f0d955df2205a170bf1582105c319ec6b00ec5c/68747470733a2f2f692e696d67666c69702e636f6d2f34646d7978702e6a7067",
}),
swh.case("bruh") => return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "",
.image = "https://user-images.githubusercontent.com/106511/86198112-6718ba00-bb46-11ea-92fd-d006b462c5b1.jpg",
}),
swh.case("dab") => return try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = "I promised I would dab and say “bruh” — _andrewrk_",
.description = "https://vimeo.com/492676992",
.image = "https://i.vimeocdn.com/video/1018725604.jpg?mw=700&mh=1243&q=70",
}),
else => {},
}
if (try self.maybeGithubIssue(ask)) |issue| {
const is_pull_request = std.mem.indexOf(u8, issue.url.slice(), "/pull/") != null;
const label = if (is_pull_request) "pull" else "issue";
var title_buf: [0x1000]u8 = undefined;
const title = try std.fmt.bufPrint(&title_buf, "{s} — {s} #{d}", .{
issue.repo.slice(),
label,
issue.number,
});
var desc_buf: [0x1000]u8 = undefined;
const description = try std.fmt.bufPrint(&desc_buf, "[{s}]({s})", .{ issue.title.slice(), issue.url.slice() });
try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = title,
.description = description,
.color = if (is_pull_request) HexColor.blue else HexColor.green,
});
} else {
var arena = std.heap.ArenaAllocator.init(self.allocator);
defer arena.deinit();
if (awaiting_enema) {
try analBuddy.reloadCached(&arena, self.prepared_anal.store.allocator, &self.prepared_anal);
awaiting_enema = false;
}
if (try analBuddy.analyse(&arena, &self.prepared_anal, ask)) |match| {
try self.sendDiscordMessage(.{
.channel_id = channel_id,
.title = ask,
.description = std.mem.trim(u8, match, " \t\r\n"),
.color = .red,
});
} else {}
}
}
fn maybeGithubIssue(self: Context, ask: []const u8) !?GithubIssue {
if (std.fmt.parseInt(u32, ask, 10)) |issue| {
return try self.requestGithubIssue("ziglang/zig", ask);
} else |_| {}
const slash = std.mem.indexOfScalar(u8, ask, '/') orelse return null;
const pound = std.mem.indexOfScalar(u8, ask, '#') orelse return null;
if (slash > pound) return null;
return try self.requestGithubIssue(ask[0..pound], ask[pound + 1 ..]);
}
pub fn sendDiscordMessage(self: Context, args: struct {
channel_id: u64,
title: []const u8,
color: HexColor = HexColor.black,
description: ?[]const u8 = null,
image: ?[]const u8 = null,
}) !void {
var path: [0x100]u8 = undefined;
var req = try request.Https.init(.{
.allocator = self.allocator,
.pem = @embedFile("../discord-com-chain.pem"),
.host = "discord.com",
.method = "POST",
.path = try std.fmt.bufPrint(&path, "/api/v6/channels/{d}/messages", .{args.channel_id}),
});
defer req.deinit();
try req.client.writeHeaderValue("Accept", "application/json");
try req.client.writeHeaderValue("Content-Type", "application/json");
try req.client.writeHeaderValue("Authorization", self.auth_token);
// Zig has difficulty resolving these peer types
const image: ?struct { url: []const u8 } = if (args.image) |url|
.{ .url = url }
else
null;
const embed = .{
.title = args.title,
.color = @enumToInt(args.color),
.description = args.description,
.image = image,
};
try req.printSend("{}", .{
format.json(.{
.content = "",
.tts = false,
.embed = embed,
}),
});
if (req.expectSuccessStatus()) |_| {
// Rudimentary rate limiting
std.time.sleep(std.time.ns_per_s);
} else |err| switch (err) {
error.TooManyRequests => {
try req.completeHeaders();
var body = req.body();
var stream = util.streamJson(body.reader());
const root = try stream.root();
if (try root.objectMatch("retry_after")) |match| {
const sec = try match.value.number(f64);
// Don't bother trying for awhile
std.time.sleep(@floatToInt(u64, sec * std.time.ns_per_s));
}
},
else => return err,
}
}
const GithubIssue = struct { repo: Buffer(0x100), number: u32, title: Buffer(0x100), url: Buffer(0x100) };
// from https://gist.github.com/thomasbnt/b6f455e2c7d743b796917fa3c205f812
const HexColor = enum(u24) {
black = 0,
aqua = 0x1ABC9C,
green = 0x2ECC71,
blue = 0x3498DB,
red = 0xE74C3C,
gold = 0xF1C40F,
_,
pub fn init(raw: u32) HexColor {
return @intToEnum(HexColor, raw);
}
};
pub fn requestGithubIssue(self: Context, repo: []const u8, issue: []const u8) !GithubIssue {
var path: [0x100]u8 = undefined;
var req = try request.Https.init(.{
.allocator = self.allocator,
.pem = @embedFile("../github-com-chain.pem"),
.host = "api.github.com",
.method = "GET",
.path = try std.fmt.bufPrint(&path, "/repos/{s}/issues/{s}", .{ repo, issue }),
});
defer req.deinit();
try req.client.writeHeaderValue("Accept", "application/json");
if (self.github_auth_token) |github_auth_token| {
var auth_buf: [0x100]u8 = undefined;
const token = try std.fmt.bufPrint(&auth_buf, "token {s}", .{github_auth_token});
try req.client.writeHeaderValue("Authorization", token);
}
try req.client.writeHeadComplete();
try req.ssl_tunnel.conn.flush();
_ = try req.expectSuccessStatus();
try req.completeHeaders();
var body = req.body();
var stream = util.streamJson(body.reader());
const root = try stream.root();
var result = GithubIssue{ .repo = Buffer(0x100).initFrom(repo), .number = 0, .title = .{}, .url = .{} };
while (try root.objectMatchAny(&[_][]const u8{ "number", "title", "html_url" })) |match| {
const swh = util.Swhash(16);
switch (swh.match(match.key)) {
swh.case("number") => {
result.number = try match.value.number(u32);
},
swh.case("html_url") => {
const slice = try match.value.stringBuffer(&result.url.data);
result.url.len = slice.len;
},
swh.case("title") => {
const slice = try match.value.stringBuffer(&result.title.data);
result.title.len = slice.len;
},
else => unreachable,
}
if (result.number > 0 and result.title.len > 0 and result.url.len > 0) {
return result;
}
}
return error.FieldNotFound;
}
};
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var auth_buf: [0x100]u8 = undefined;
const context = try Context.init(
&gpa.allocator,
try std.fmt.bufPrint(&auth_buf, "Bot {s}", .{std.os.getenv("DISCORD_AUTH") orelse return error.AuthNotFound}),
std.os.getenv("ZIGLIB") orelse return error.ZiglibNotFound,
std.os.getenv("GITHUB_AUTH"),
);
var reconnect_wait: u64 = 1;
while (true) {
var discord_ws = DiscordWs.init(
context.allocator,
context.auth_token,
DiscordWs.Intents{ .guild_messages = true },
) catch |err| {
std.debug.print("Connect error: {s}\n", .{@errorName(err)});
std.time.sleep(reconnect_wait * std.time.ns_per_s);
reconnect_wait = std.math.min(reconnect_wait * 2, 30);
continue;
};
reconnect_wait = 1;
defer discord_ws.deinit();
discord_ws.run(context, struct {
fn handleDispatch(ctx: *Context, name: []const u8, data: anytype) !void {
if (!std.mem.eql(u8, name, "MESSAGE_CREATE")) return;
var ask: Buffer(0x100) = .{};
var channel_id: ?u64 = null;
while (try data.objectMatchAny(&[_][]const u8{ "content", "channel_id" })) |match| {
const swh = util.Swhash(16);
switch (swh.match(match.key)) {
swh.case("content") => {
ask = try findAsk(try match.value.stringReader());
_ = try match.value.finalizeToken();
},
swh.case("channel_id") => {
var buf: [0x100]u8 = undefined;
const channel_string = try match.value.stringBuffer(&buf);
channel_id = try std.fmt.parseInt(u64, channel_string, 10);
},
else => unreachable,
}
}
if (ask.len > 0 and channel_id != null) {
std.debug.print(">> %%{s}\n", .{ask.slice()});
ctx.ask_mailbox.putOverwrite(.{ .channel_id = channel_id.?, .ask = ask });
}
}
fn findAsk(reader: anytype) !Buffer(0x100) {
const State = enum {
no_match,
percent,
ready,
};
var state = State.no_match;
var buffer: Buffer(0x100) = .{};
while (reader.readByte()) |c| {
switch (state) {
.no_match => {
if (c == '%') {
state = .percent;
}
},
.percent => {
state = if (c == '%') .ready else .no_match;
},
.ready => {
switch (c) {
' ', ',', '\n', '\t', '(', ')', '!', '?', '[', ']', '{', '}' => break,
else => try buffer.append(c),
}
},
}
} else |err| switch (err) {
error.EndOfStream => {},
else => |e| return e,
}
// Strip trailing period
if (buffer.last() == @as(u8, '.')) {
_ = buffer.pop() catch unreachable;
}
return buffer;
}
}) catch |err| switch (err) {
// TODO: investigate if IO localized enough. And possibly convert to ConnectionReset
error.ConnectionReset, error.IO => continue,
else => @panic(@errorName(err)),
};
std.debug.print("Exited: {}\n", .{discord_ws.client});
}
}
const DiscordWs = struct {
allocator: *std.mem.Allocator,
is_dying: bool,
ssl_tunnel: *request.SslTunnel,
client: wz.base.Client.Client(request.SslTunnel.Stream.DstInStream, request.SslTunnel.Stream.DstOutStream),
client_buffer: []u8,
write_mutex: std.Mutex,
heartbeat_interval: usize,
heartbeat_seq: ?usize,
heartbeat_ack: bool,
heartbeat_thread: *std.Thread,
const Opcode = enum {
/// An event was dispatched.
dispatch = 0,
/// Fired periodically by the client to keep the connection alive.
heartbeat = 1,
/// Starts a new session during the initial handshake.
identify = 2,
/// Update the client's presence.
presence_update = 3,
/// Used to join/leave or move between voice channels.
voice_state_update = 4,
/// Resume a previous session that was disconnected.
@"resume" = 6,
/// You should attempt to reconnect and resume immediately.
reconnect = 7,
/// Request information about offline guild members in a large guild.
request_guild_members = 8,
/// The session has been invalidated. You should reconnect and identify/resume accordingly.
invalid_session = 9,
/// Sent immediately after connecting, contains the heartbeat_interval to use.
hello = 10,
/// Sent in response to receiving a heartbeat to acknowledge that it has been received.
heartbeat_ack = 11,
};
const Intents = packed struct {
guilds: bool = false,
guild_members: bool = false,
guild_bans: bool = false,
guild_emojis: bool = false,
guild_integrations: bool = false,
guild_webhooks: bool = false,
guild_invites: bool = false,
guild_voice_states: bool = false,
guild_presences: bool = false,
guild_messages: bool = false,
guild_message_reactions: bool = false,
guild_message_typing: bool = false,
direct_messages: bool = false,
direct_message_reactions: bool = false,
direct_message_typing: bool = false,
_pad: bool = undefined,
fn toRaw(self: Intents) u16 {
return @bitCast(u16, self);
}
fn fromRaw(raw: u16) Intents {
return @bitCast(Intents, self);
}
};
pub fn init(allocator: *std.mem.Allocator, auth_token: []const u8, intents: Intents) !*DiscordWs {
const result = try allocator.create(DiscordWs);
errdefer allocator.destroy(result);
result.allocator = allocator;
result.write_mutex = .{};
result.ssl_tunnel = try request.SslTunnel.init(.{
.allocator = allocator,
.pem = @embedFile("../discord-gg-chain.pem"),
.host = "gateway.discord.gg",
});
errdefer result.ssl_tunnel.deinit();
result.client_buffer = try allocator.alloc(u8, 0x1000);
errdefer allocator.free(result.client_buffer);
result.client = wz.base.Client.create(
result.client_buffer,
result.ssl_tunnel.conn.inStream(),
result.ssl_tunnel.conn.outStream(),
);
// Handshake
try result.client.sendHandshakeHead("/?v=6&encoding=json");
try result.client.sendHandshakeHeaderValue("Host", "gateway.discord.gg");
try result.client.sendHandshakeHeadComplete();
try result.ssl_tunnel.conn.flush();
try result.client.waitForHandshake();
if (try result.client.readEvent()) |event| {
std.debug.assert(event == .header);
}
result.is_dying = false;
result.heartbeat_interval = 0;
if (try result.client.readEvent()) |event| {
std.debug.assert(event == .chunk);
var fba = std.io.fixedBufferStream(event.chunk.data);
var stream = util.streamJson(fba.reader());
const root = try stream.root();
while (try root.objectMatchAny(&[_][]const u8{ "op", "d" })) |match| {
const swh = util.Swhash(2);
switch (swh.match(match.key)) {
swh.case("op") => {
const op = try std.meta.intToEnum(Opcode, try match.value.number(u8));
if (op != .hello) {
return error.MalformedHelloResponse;
}
},
swh.case("d") => {
while (try match.value.objectMatch("heartbeat_interval")) |hbi| {
result.heartbeat_interval = try hbi.value.number(u32);
}
},
else => unreachable,
}
}
}
if (result.heartbeat_interval == 0) {
return error.MalformedHelloResponse;
}
const Activity = struct {
@"type": u8,
name: []const u8,
};
try result.sendCommand(.identify, .{
.compress = false,
.intents = intents.toRaw(),
.token = auth_token,
.properties = .{
.@"$os" = @tagName(std.Target.current.os.tag),
.@"$browser" = agent,
.@"$device" = agent,
},
.presence = .{
.status = "online",
.activities = &[_]Activity{
.{
.@"type" = 0,
.name = "examples: %%666 or %%std.ArrayList",
},
},
},
});
result.heartbeat_seq = null;
result.heartbeat_ack = true;
result.heartbeat_thread = try std.Thread.spawn(result, heartbeatHandler);
return result;
}
pub fn deinit(self: *DiscordWs) void {
self.ssl_tunnel.deinit();
self.is_dying = true;
self.heartbeat_thread.wait();
self.allocator.destroy(self);
}
pub fn run(self: *DiscordWs, ctx: anytype, handler: anytype) !void {
while (try self.client.readEvent()) |event| {
// Skip over any remaining chunks. The processor didn't take care of it.
if (event != .header) continue;
switch (event.header.opcode) {
.Text => {
self.processChunks(ctx, handler) catch |err| {
std.debug.print("Process chunks failed: {s}\n", .{err});
};
},
.Ping, .Pong => {},
.Close => {
std.debug.print("Websocket close frame. Reconnecting...\n", .{});
return error.ConnectionReset;
},
.Binary => return error.WtfBinary,
else => return error.WtfWtf,
}
}
}
pub fn processChunks(self: *DiscordWs, ctx: anytype, handler: anytype) !void {
const event = (try self.client.readEvent()) orelse return error.NoBody;
std.debug.assert(event == .chunk);
var name_buf: [32]u8 = undefined;
var name: ?[]u8 = null;
var op: ?Opcode = null;
var fba = std.io.fixedBufferStream(event.chunk.data);
var stream = util.streamJson(fba.reader());
const root = try stream.root();
while (try root.objectMatchAny(&[_][]const u8{ "t", "s", "op", "d" })) |match| {
const swh = util.Swhash(2);
switch (swh.match(match.key)) {
swh.case("t") => {
name = try match.value.optionalStringBuffer(&name_buf);
},
swh.case("s") => {
if (try match.value.optionalNumber(u32)) |seq| {
self.heartbeat_seq = seq;
}
},
swh.case("op") => {
op = try std.meta.intToEnum(Opcode, try match.value.number(u8));
},
swh.case("d") => {
switch (op orelse return error.DataBeforeOp) {
.dispatch => {
std.debug.print("<< {d} -- {s}\n", .{ self.heartbeat_seq, name });
try handler.handleDispatch(
ctx,
name orelse return error.DispatchWithoutName,
match.value,
);
},
.heartbeat_ack => {
std.debug.print("<< ♥\n", .{});
self.heartbeat_ack = true;
},
else => {},
}
_ = try match.value.finalizeToken();
},
else => unreachable,
}
}
}
pub fn sendCommand(self: *DiscordWs, opcode: Opcode, data: anytype) !void {
var buf: [0x1000]u8 = undefined;
const msg = try std.fmt.bufPrint(&buf, "{s}", .{
format.json(.{
.op = @enumToInt(opcode),
.d = data,
}),
});
const held = self.write_mutex.acquire();
defer held.release();
try self.client.writeMessageHeader(.{ .length = msg.len, .opcode = .Text });
try self.client.writeMessagePayload(msg);
try self.ssl_tunnel.conn.flush();
}
pub extern "c" fn shutdown(sockfd: std.os.fd_t, how: c_int) c_int;
fn heartbeatHandler(self: *DiscordWs) void {
while (true) {
const start = std.time.milliTimestamp();
// Buffer to fire early than late
while (std.time.milliTimestamp() - start < self.heartbeat_interval - 1000) {
std.time.sleep(std.time.ns_per_s);
if (self.is_dying) {
return;
}
}
if (!self.heartbeat_ack) {
std.debug.print("Missed heartbeat. Reconnecting...\n", .{});
const SHUT_RDWR = 2;
const rc = shutdown(self.ssl_tunnel.tcp_conn.handle, SHUT_RDWR);
if (rc != 0) {
std.debug.print("Shutdown failed: {d}\n", .{std.c.getErrno(rc)});
}
return;
}
self.heartbeat_ack = false;
var retries: u6 = 0;
while (self.sendCommand(.heartbeat, self.heartbeat_seq)) |_| {
std.debug.print(">> ♡\n", .{});
break;
} else |err| {
if (retries < 3) {
std.os.nanosleep(@as(u64, 1) << retries, 0);
retries += 1;
} else {
const SHUT_RDWR = 2;
const rc = shutdown(self.ssl_tunnel.tcp_conn.handle, SHUT_RDWR);
if (rc != 0) {
std.debug.print("Shutdown failed: {d}\n", .{std.c.getErrno(rc)});
}
return;
}
}
}
}
};
test "" {
_ = request;
_ = util;
} | src/main.zig |
pub extern fn sokol_main(argc: c_int, argv: [*c][*c]u8) sapp_desc;
pub extern fn sapp_isvalid() bool;
pub extern fn sapp_width() c_int;
pub extern fn sapp_height() c_int;
pub extern fn sapp_color_format() c_int;
pub extern fn sapp_depth_format() c_int;
pub extern fn sapp_sample_count() c_int;
pub extern fn sapp_high_dpi() bool;
pub extern fn sapp_dpi_scale() f32;
pub extern fn sapp_show_keyboard(visible: bool) void;
pub extern fn sapp_keyboard_shown() bool;
pub extern fn sapp_is_fullscreen() bool;
pub extern fn sapp_toggle_fullscreen() void;
pub extern fn sapp_show_mouse(visible: bool) void;
pub extern fn sapp_mouse_shown(...) bool;
pub extern fn sapp_userdata() ?*c_void;
pub extern fn sapp_query_desc() sapp_desc;
pub extern fn sapp_request_quit() void;
pub extern fn sapp_cancel_quit() void;
pub extern fn sapp_quit() void;
pub extern fn sapp_consume_event() void;
pub extern fn sapp_frame_count() u64;
pub extern fn sapp_set_clipboard_string(str: [*c]const u8) void;
pub extern fn sapp_get_clipboard_string() [*c]const u8;
pub extern fn sapp_get_num_dropped_files() c_int;
pub extern fn sapp_get_dropped_file_path(index: c_int) [*c]const u8;
pub extern fn sapp_run(desc: [*c]const sapp_desc) c_int;
pub extern fn sapp_gles2() bool;
pub extern fn sapp_html5_ask_leave_site(ask: bool) void;
pub extern fn sapp_metal_get_device() ?*const c_void;
pub extern fn sapp_metal_get_renderpass_descriptor() ?*const c_void;
pub extern fn sapp_metal_get_drawable() ?*const c_void;
pub extern fn sapp_macos_get_window() ?*const c_void;
pub extern fn sapp_ios_get_window() ?*const c_void;
pub extern fn sapp_d3d11_get_device() ?*const c_void;
pub extern fn sapp_d3d11_get_device_context() ?*const c_void;
pub extern fn sapp_d3d11_get_render_target_view() ?*const c_void;
pub extern fn sapp_d3d11_get_depth_stencil_view() ?*const c_void;
pub extern fn sapp_win32_get_hwnd() ?*const c_void;
pub extern fn sapp_wgpu_get_device() ?*const c_void;
pub extern fn sapp_wgpu_get_render_view() ?*const c_void;
pub extern fn sapp_wgpu_get_resolve_view() ?*const c_void;
pub extern fn sapp_wgpu_get_depth_stencil_view() ?*const c_void;
pub extern fn sapp_android_get_native_activity() ?*const c_void;
pub const struct_sapp_event = extern struct {
frame_count: u64,
type: sapp_event_type,
key_code: sapp_keycode,
char_code: u32,
key_repeat: bool,
modifiers: u32,
mouse_button: sapp_mousebutton,
mouse_x: f32,
mouse_y: f32,
scroll_x: f32,
scroll_y: f32,
num_touches: c_int,
touches: [8]sapp_touchpoint,
window_width: c_int,
window_height: c_int,
framebuffer_width: c_int,
framebuffer_height: c_int,
};
pub const sapp_event = struct_sapp_event;
pub const struct_sapp_desc = extern struct {
init_cb: ?fn () callconv(.C) void,
frame_cb: ?fn () callconv(.C) void,
cleanup_cb: ?fn () callconv(.C) void,
event_cb: ?fn ([*c]const sapp_event) callconv(.C) void,
fail_cb: ?fn ([*c]const u8) callconv(.C) void,
user_data: ?*c_void,
init_userdata_cb: ?fn (?*c_void) callconv(.C) void,
frame_userdata_cb: ?fn (?*c_void) callconv(.C) void,
cleanup_userdata_cb: ?fn (?*c_void) callconv(.C) void,
event_userdata_cb: ?fn ([*c]const sapp_event, ?*c_void) callconv(.C) void,
fail_userdata_cb: ?fn ([*c]const u8, ?*c_void) callconv(.C) void,
width: c_int,
height: c_int,
sample_count: c_int,
swap_interval: c_int,
high_dpi: bool,
fullscreen: bool,
alpha: bool,
window_title: [*c]const u8,
user_cursor: bool,
enable_clipboard: bool,
clipboard_size: c_int,
max_dropped_files: c_int,
max_dropped_file_path_length: c_int,
html5_canvas_name: [*c]const u8,
html5_canvas_resize: bool,
html5_preserve_drawing_buffer: bool,
html5_premultiplied_alpha: bool,
html5_ask_leave_site: bool,
ios_keyboard_resizes_canvas: bool,
gl_force_gles2: bool,
};
pub const sapp_desc = struct_sapp_desc;
pub const SAPP_MAX_TOUCHPOINTS = @enumToInt(enum_unnamed_2.SAPP_MAX_TOUCHPOINTS);
pub const SAPP_MAX_MOUSEBUTTONS = @enumToInt(enum_unnamed_2.SAPP_MAX_MOUSEBUTTONS);
pub const SAPP_MAX_KEYCODES = @enumToInt(enum_unnamed_2.SAPP_MAX_KEYCODES);
const enum_unnamed_2 = extern enum(c_int) {
SAPP_MAX_TOUCHPOINTS = 8,
SAPP_MAX_MOUSEBUTTONS = 3,
SAPP_MAX_KEYCODES = 512,
_,
};
pub const SAPP_EVENTTYPE_INVALID = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_INVALID);
pub const SAPP_EVENTTYPE_KEY_DOWN = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_KEY_DOWN);
pub const SAPP_EVENTTYPE_KEY_UP = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_KEY_UP);
pub const SAPP_EVENTTYPE_CHAR = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_CHAR);
pub const SAPP_EVENTTYPE_MOUSE_DOWN = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_MOUSE_DOWN);
pub const SAPP_EVENTTYPE_MOUSE_UP = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_MOUSE_UP);
pub const SAPP_EVENTTYPE_MOUSE_SCROLL = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_MOUSE_SCROLL);
pub const SAPP_EVENTTYPE_MOUSE_MOVE = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_MOUSE_MOVE);
pub const SAPP_EVENTTYPE_MOUSE_ENTER = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_MOUSE_ENTER);
pub const SAPP_EVENTTYPE_MOUSE_LEAVE = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_MOUSE_LEAVE);
pub const SAPP_EVENTTYPE_TOUCHES_BEGAN = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_TOUCHES_BEGAN);
pub const SAPP_EVENTTYPE_TOUCHES_MOVED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_TOUCHES_MOVED);
pub const SAPP_EVENTTYPE_TOUCHES_ENDED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_TOUCHES_ENDED);
pub const SAPP_EVENTTYPE_TOUCHES_CANCELLED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_TOUCHES_CANCELLED);
pub const SAPP_EVENTTYPE_RESIZED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_RESIZED);
pub const SAPP_EVENTTYPE_ICONIFIED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_ICONIFIED);
pub const SAPP_EVENTTYPE_RESTORED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_RESTORED);
pub const SAPP_EVENTTYPE_SUSPENDED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_SUSPENDED);
pub const SAPP_EVENTTYPE_RESUMED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_RESUMED);
pub const SAPP_EVENTTYPE_UPDATE_CURSOR = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_UPDATE_CURSOR);
pub const SAPP_EVENTTYPE_QUIT_REQUESTED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_QUIT_REQUESTED);
pub const SAPP_EVENTTYPE_CLIPBOARD_PASTED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_CLIPBOARD_PASTED);
pub const SAPP_EVENTTYPE_FILE_DROPPED = @enumToInt(enum_sapp_event_type.SAPP_EVENTTYPE_FILE_DROPPED);
pub const _SAPP_EVENTTYPE_NUM = @enumToInt(enum_sapp_event_type._SAPP_EVENTTYPE_NUM);
pub const _SAPP_EVENTTYPE_FORCE_U32 = @enumToInt(enum_sapp_event_type._SAPP_EVENTTYPE_FORCE_U32);
pub const enum_sapp_event_type = extern enum(c_int) {
SAPP_EVENTTYPE_INVALID = 0,
SAPP_EVENTTYPE_KEY_DOWN = 1,
SAPP_EVENTTYPE_KEY_UP = 2,
SAPP_EVENTTYPE_CHAR = 3,
SAPP_EVENTTYPE_MOUSE_DOWN = 4,
SAPP_EVENTTYPE_MOUSE_UP = 5,
SAPP_EVENTTYPE_MOUSE_SCROLL = 6,
SAPP_EVENTTYPE_MOUSE_MOVE = 7,
SAPP_EVENTTYPE_MOUSE_ENTER = 8,
SAPP_EVENTTYPE_MOUSE_LEAVE = 9,
SAPP_EVENTTYPE_TOUCHES_BEGAN = 10,
SAPP_EVENTTYPE_TOUCHES_MOVED = 11,
SAPP_EVENTTYPE_TOUCHES_ENDED = 12,
SAPP_EVENTTYPE_TOUCHES_CANCELLED = 13,
SAPP_EVENTTYPE_RESIZED = 14,
SAPP_EVENTTYPE_ICONIFIED = 15,
SAPP_EVENTTYPE_RESTORED = 16,
SAPP_EVENTTYPE_SUSPENDED = 17,
SAPP_EVENTTYPE_RESUMED = 18,
SAPP_EVENTTYPE_UPDATE_CURSOR = 19,
SAPP_EVENTTYPE_QUIT_REQUESTED = 20,
SAPP_EVENTTYPE_CLIPBOARD_PASTED = 21,
SAPP_EVENTTYPE_FILE_DROPPED = 22,
_SAPP_EVENTTYPE_NUM = 23,
_SAPP_EVENTTYPE_FORCE_U32 = 2147483647,
_,
};
pub const sapp_event_type = enum_sapp_event_type;
pub const SAPP_KEYCODE_INVALID = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_INVALID);
pub const SAPP_KEYCODE_SPACE = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_SPACE);
pub const SAPP_KEYCODE_APOSTROPHE = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_APOSTROPHE);
pub const SAPP_KEYCODE_COMMA = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_COMMA);
pub const SAPP_KEYCODE_MINUS = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_MINUS);
pub const SAPP_KEYCODE_PERIOD = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_PERIOD);
pub const SAPP_KEYCODE_SLASH = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_SLASH);
pub const SAPP_KEYCODE_0 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_0);
pub const SAPP_KEYCODE_1 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_1);
pub const SAPP_KEYCODE_2 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_2);
pub const SAPP_KEYCODE_3 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_3);
pub const SAPP_KEYCODE_4 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_4);
pub const SAPP_KEYCODE_5 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_5);
pub const SAPP_KEYCODE_6 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_6);
pub const SAPP_KEYCODE_7 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_7);
pub const SAPP_KEYCODE_8 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_8);
pub const SAPP_KEYCODE_9 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_9);
pub const SAPP_KEYCODE_SEMICOLON = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_SEMICOLON);
pub const SAPP_KEYCODE_EQUAL = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_EQUAL);
pub const SAPP_KEYCODE_A = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_A);
pub const SAPP_KEYCODE_B = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_B);
pub const SAPP_KEYCODE_C = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_C);
pub const SAPP_KEYCODE_D = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_D);
pub const SAPP_KEYCODE_E = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_E);
pub const SAPP_KEYCODE_F = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F);
pub const SAPP_KEYCODE_G = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_G);
pub const SAPP_KEYCODE_H = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_H);
pub const SAPP_KEYCODE_I = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_I);
pub const SAPP_KEYCODE_J = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_J);
pub const SAPP_KEYCODE_K = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_K);
pub const SAPP_KEYCODE_L = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_L);
pub const SAPP_KEYCODE_M = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_M);
pub const SAPP_KEYCODE_N = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_N);
pub const SAPP_KEYCODE_O = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_O);
pub const SAPP_KEYCODE_P = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_P);
pub const SAPP_KEYCODE_Q = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_Q);
pub const SAPP_KEYCODE_R = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_R);
pub const SAPP_KEYCODE_S = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_S);
pub const SAPP_KEYCODE_T = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_T);
pub const SAPP_KEYCODE_U = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_U);
pub const SAPP_KEYCODE_V = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_V);
pub const SAPP_KEYCODE_W = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_W);
pub const SAPP_KEYCODE_X = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_X);
pub const SAPP_KEYCODE_Y = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_Y);
pub const SAPP_KEYCODE_Z = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_Z);
pub const SAPP_KEYCODE_LEFT_BRACKET = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_LEFT_BRACKET);
pub const SAPP_KEYCODE_BACKSLASH = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_BACKSLASH);
pub const SAPP_KEYCODE_RIGHT_BRACKET = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_RIGHT_BRACKET);
pub const SAPP_KEYCODE_GRAVE_ACCENT = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_GRAVE_ACCENT);
pub const SAPP_KEYCODE_WORLD_1 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_WORLD_1);
pub const SAPP_KEYCODE_WORLD_2 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_WORLD_2);
pub const SAPP_KEYCODE_ESCAPE = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_ESCAPE);
pub const SAPP_KEYCODE_ENTER = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_ENTER);
pub const SAPP_KEYCODE_TAB = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_TAB);
pub const SAPP_KEYCODE_BACKSPACE = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_BACKSPACE);
pub const SAPP_KEYCODE_INSERT = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_INSERT);
pub const SAPP_KEYCODE_DELETE = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_DELETE);
pub const SAPP_KEYCODE_RIGHT = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_RIGHT);
pub const SAPP_KEYCODE_LEFT = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_LEFT);
pub const SAPP_KEYCODE_DOWN = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_DOWN);
pub const SAPP_KEYCODE_UP = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_UP);
pub const SAPP_KEYCODE_PAGE_UP = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_PAGE_UP);
pub const SAPP_KEYCODE_PAGE_DOWN = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_PAGE_DOWN);
pub const SAPP_KEYCODE_HOME = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_HOME);
pub const SAPP_KEYCODE_END = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_END);
pub const SAPP_KEYCODE_CAPS_LOCK = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_CAPS_LOCK);
pub const SAPP_KEYCODE_SCROLL_LOCK = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_SCROLL_LOCK);
pub const SAPP_KEYCODE_NUM_LOCK = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_NUM_LOCK);
pub const SAPP_KEYCODE_PRINT_SCREEN = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_PRINT_SCREEN);
pub const SAPP_KEYCODE_PAUSE = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_PAUSE);
pub const SAPP_KEYCODE_F1 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F1);
pub const SAPP_KEYCODE_F2 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F2);
pub const SAPP_KEYCODE_F3 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F3);
pub const SAPP_KEYCODE_F4 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F4);
pub const SAPP_KEYCODE_F5 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F5);
pub const SAPP_KEYCODE_F6 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F6);
pub const SAPP_KEYCODE_F7 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F7);
pub const SAPP_KEYCODE_F8 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F8);
pub const SAPP_KEYCODE_F9 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F9);
pub const SAPP_KEYCODE_F10 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F10);
pub const SAPP_KEYCODE_F11 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F11);
pub const SAPP_KEYCODE_F12 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F12);
pub const SAPP_KEYCODE_F13 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F13);
pub const SAPP_KEYCODE_F14 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F14);
pub const SAPP_KEYCODE_F15 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F15);
pub const SAPP_KEYCODE_F16 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F16);
pub const SAPP_KEYCODE_F17 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F17);
pub const SAPP_KEYCODE_F18 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F18);
pub const SAPP_KEYCODE_F19 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F19);
pub const SAPP_KEYCODE_F20 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F20);
pub const SAPP_KEYCODE_F21 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F21);
pub const SAPP_KEYCODE_F22 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F22);
pub const SAPP_KEYCODE_F23 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F23);
pub const SAPP_KEYCODE_F24 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F24);
pub const SAPP_KEYCODE_F25 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_F25);
pub const SAPP_KEYCODE_KP_0 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_0);
pub const SAPP_KEYCODE_KP_1 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_1);
pub const SAPP_KEYCODE_KP_2 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_2);
pub const SAPP_KEYCODE_KP_3 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_3);
pub const SAPP_KEYCODE_KP_4 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_4);
pub const SAPP_KEYCODE_KP_5 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_5);
pub const SAPP_KEYCODE_KP_6 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_6);
pub const SAPP_KEYCODE_KP_7 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_7);
pub const SAPP_KEYCODE_KP_8 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_8);
pub const SAPP_KEYCODE_KP_9 = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_9);
pub const SAPP_KEYCODE_KP_DECIMAL = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_DECIMAL);
pub const SAPP_KEYCODE_KP_DIVIDE = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_DIVIDE);
pub const SAPP_KEYCODE_KP_MULTIPLY = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_MULTIPLY);
pub const SAPP_KEYCODE_KP_SUBTRACT = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_SUBTRACT);
pub const SAPP_KEYCODE_KP_ADD = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_ADD);
pub const SAPP_KEYCODE_KP_ENTER = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_ENTER);
pub const SAPP_KEYCODE_KP_EQUAL = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_KP_EQUAL);
pub const SAPP_KEYCODE_LEFT_SHIFT = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_LEFT_SHIFT);
pub const SAPP_KEYCODE_LEFT_CONTROL = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_LEFT_CONTROL);
pub const SAPP_KEYCODE_LEFT_ALT = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_LEFT_ALT);
pub const SAPP_KEYCODE_LEFT_SUPER = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_LEFT_SUPER);
pub const SAPP_KEYCODE_RIGHT_SHIFT = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_RIGHT_SHIFT);
pub const SAPP_KEYCODE_RIGHT_CONTROL = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_RIGHT_CONTROL);
pub const SAPP_KEYCODE_RIGHT_ALT = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_RIGHT_ALT);
pub const SAPP_KEYCODE_RIGHT_SUPER = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_RIGHT_SUPER);
pub const SAPP_KEYCODE_MENU = @enumToInt(enum_sapp_keycode.SAPP_KEYCODE_MENU);
pub const enum_sapp_keycode = extern enum(c_int) {
SAPP_KEYCODE_INVALID = 0,
SAPP_KEYCODE_SPACE = 32,
SAPP_KEYCODE_APOSTROPHE = 39,
SAPP_KEYCODE_COMMA = 44,
SAPP_KEYCODE_MINUS = 45,
SAPP_KEYCODE_PERIOD = 46,
SAPP_KEYCODE_SLASH = 47,
SAPP_KEYCODE_0 = 48,
SAPP_KEYCODE_1 = 49,
SAPP_KEYCODE_2 = 50,
SAPP_KEYCODE_3 = 51,
SAPP_KEYCODE_4 = 52,
SAPP_KEYCODE_5 = 53,
SAPP_KEYCODE_6 = 54,
SAPP_KEYCODE_7 = 55,
SAPP_KEYCODE_8 = 56,
SAPP_KEYCODE_9 = 57,
SAPP_KEYCODE_SEMICOLON = 59,
SAPP_KEYCODE_EQUAL = 61,
SAPP_KEYCODE_A = 65,
SAPP_KEYCODE_B = 66,
SAPP_KEYCODE_C = 67,
SAPP_KEYCODE_D = 68,
SAPP_KEYCODE_E = 69,
SAPP_KEYCODE_F = 70,
SAPP_KEYCODE_G = 71,
SAPP_KEYCODE_H = 72,
SAPP_KEYCODE_I = 73,
SAPP_KEYCODE_J = 74,
SAPP_KEYCODE_K = 75,
SAPP_KEYCODE_L = 76,
SAPP_KEYCODE_M = 77,
SAPP_KEYCODE_N = 78,
SAPP_KEYCODE_O = 79,
SAPP_KEYCODE_P = 80,
SAPP_KEYCODE_Q = 81,
SAPP_KEYCODE_R = 82,
SAPP_KEYCODE_S = 83,
SAPP_KEYCODE_T = 84,
SAPP_KEYCODE_U = 85,
SAPP_KEYCODE_V = 86,
SAPP_KEYCODE_W = 87,
SAPP_KEYCODE_X = 88,
SAPP_KEYCODE_Y = 89,
SAPP_KEYCODE_Z = 90,
SAPP_KEYCODE_LEFT_BRACKET = 91,
SAPP_KEYCODE_BACKSLASH = 92,
SAPP_KEYCODE_RIGHT_BRACKET = 93,
SAPP_KEYCODE_GRAVE_ACCENT = 96,
SAPP_KEYCODE_WORLD_1 = 161,
SAPP_KEYCODE_WORLD_2 = 162,
SAPP_KEYCODE_ESCAPE = 256,
SAPP_KEYCODE_ENTER = 257,
SAPP_KEYCODE_TAB = 258,
SAPP_KEYCODE_BACKSPACE = 259,
SAPP_KEYCODE_INSERT = 260,
SAPP_KEYCODE_DELETE = 261,
SAPP_KEYCODE_RIGHT = 262,
SAPP_KEYCODE_LEFT = 263,
SAPP_KEYCODE_DOWN = 264,
SAPP_KEYCODE_UP = 265,
SAPP_KEYCODE_PAGE_UP = 266,
SAPP_KEYCODE_PAGE_DOWN = 267,
SAPP_KEYCODE_HOME = 268,
SAPP_KEYCODE_END = 269,
SAPP_KEYCODE_CAPS_LOCK = 280,
SAPP_KEYCODE_SCROLL_LOCK = 281,
SAPP_KEYCODE_NUM_LOCK = 282,
SAPP_KEYCODE_PRINT_SCREEN = 283,
SAPP_KEYCODE_PAUSE = 284,
SAPP_KEYCODE_F1 = 290,
SAPP_KEYCODE_F2 = 291,
SAPP_KEYCODE_F3 = 292,
SAPP_KEYCODE_F4 = 293,
SAPP_KEYCODE_F5 = 294,
SAPP_KEYCODE_F6 = 295,
SAPP_KEYCODE_F7 = 296,
SAPP_KEYCODE_F8 = 297,
SAPP_KEYCODE_F9 = 298,
SAPP_KEYCODE_F10 = 299,
SAPP_KEYCODE_F11 = 300,
SAPP_KEYCODE_F12 = 301,
SAPP_KEYCODE_F13 = 302,
SAPP_KEYCODE_F14 = 303,
SAPP_KEYCODE_F15 = 304,
SAPP_KEYCODE_F16 = 305,
SAPP_KEYCODE_F17 = 306,
SAPP_KEYCODE_F18 = 307,
SAPP_KEYCODE_F19 = 308,
SAPP_KEYCODE_F20 = 309,
SAPP_KEYCODE_F21 = 310,
SAPP_KEYCODE_F22 = 311,
SAPP_KEYCODE_F23 = 312,
SAPP_KEYCODE_F24 = 313,
SAPP_KEYCODE_F25 = 314,
SAPP_KEYCODE_KP_0 = 320,
SAPP_KEYCODE_KP_1 = 321,
SAPP_KEYCODE_KP_2 = 322,
SAPP_KEYCODE_KP_3 = 323,
SAPP_KEYCODE_KP_4 = 324,
SAPP_KEYCODE_KP_5 = 325,
SAPP_KEYCODE_KP_6 = 326,
SAPP_KEYCODE_KP_7 = 327,
SAPP_KEYCODE_KP_8 = 328,
SAPP_KEYCODE_KP_9 = 329,
SAPP_KEYCODE_KP_DECIMAL = 330,
SAPP_KEYCODE_KP_DIVIDE = 331,
SAPP_KEYCODE_KP_MULTIPLY = 332,
SAPP_KEYCODE_KP_SUBTRACT = 333,
SAPP_KEYCODE_KP_ADD = 334,
SAPP_KEYCODE_KP_ENTER = 335,
SAPP_KEYCODE_KP_EQUAL = 336,
SAPP_KEYCODE_LEFT_SHIFT = 340,
SAPP_KEYCODE_LEFT_CONTROL = 341,
SAPP_KEYCODE_LEFT_ALT = 342,
SAPP_KEYCODE_LEFT_SUPER = 343,
SAPP_KEYCODE_RIGHT_SHIFT = 344,
SAPP_KEYCODE_RIGHT_CONTROL = 345,
SAPP_KEYCODE_RIGHT_ALT = 346,
SAPP_KEYCODE_RIGHT_SUPER = 347,
SAPP_KEYCODE_MENU = 348,
_,
};
pub const sapp_keycode = enum_sapp_keycode;
pub const struct_sapp_touchpoint = extern struct {
identifier: usize,
pos_x: f32,
pos_y: f32,
changed: bool,
};
pub const sapp_touchpoint = struct_sapp_touchpoint;
pub const SAPP_MOUSEBUTTON_INVALID = @enumToInt(enum_sapp_mousebutton.SAPP_MOUSEBUTTON_INVALID);
pub const SAPP_MOUSEBUTTON_LEFT = @enumToInt(enum_sapp_mousebutton.SAPP_MOUSEBUTTON_LEFT);
pub const SAPP_MOUSEBUTTON_RIGHT = @enumToInt(enum_sapp_mousebutton.SAPP_MOUSEBUTTON_RIGHT);
pub const SAPP_MOUSEBUTTON_MIDDLE = @enumToInt(enum_sapp_mousebutton.SAPP_MOUSEBUTTON_MIDDLE);
pub const enum_sapp_mousebutton = extern enum(c_int) {
SAPP_MOUSEBUTTON_INVALID = -1,
SAPP_MOUSEBUTTON_LEFT = 0,
SAPP_MOUSEBUTTON_RIGHT = 1,
SAPP_MOUSEBUTTON_MIDDLE = 2,
_,
};
pub const sapp_mousebutton = enum_sapp_mousebutton;
pub const SAPP_MODIFIER_SHIFT = @enumToInt(enum_unnamed_3.SAPP_MODIFIER_SHIFT);
pub const SAPP_MODIFIER_CTRL = @enumToInt(enum_unnamed_3.SAPP_MODIFIER_CTRL);
pub const SAPP_MODIFIER_ALT = @enumToInt(enum_unnamed_3.SAPP_MODIFIER_ALT);
pub const SAPP_MODIFIER_SUPER = @enumToInt(enum_unnamed_3.SAPP_MODIFIER_SUPER);
const enum_unnamed_3 = extern enum(c_int) {
SAPP_MODIFIER_SHIFT = 1,
SAPP_MODIFIER_CTRL = 2,
SAPP_MODIFIER_ALT = 4,
SAPP_MODIFIER_SUPER = 8,
_,
}; | src/deps/sokol/sokol_app.zig |
const fmath = @import("index.zig");
const expo2 = @import("_expo2.zig").expo2;
pub fn sinh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(sinhf, x),
f64 => @inlineCall(sinhd, x),
else => @compileError("sinh not implemented for " ++ @typeName(T)),
}
}
// sinh(x) = (exp(x) - 1 / exp(x)) / 2
// = (exp(x) - 1 + (exp(x) - 1) / exp(x)) / 2
// = x + x^3 / 6 + o(x^5)
fn sinhf(x: f32) -> f32 {
const u = @bitCast(u32, x);
const ux = u & 0x7FFFFFFF;
const ax = @bitCast(f32, ux);
var h: f32 = 0.5;
if (u >> 31 != 0) {
h = -h;
}
// |x| < log(FLT_MAX)
if (ux < 0x42B17217) {
const t = fmath.expm1(ax);
if (ux < 0x3F800000) {
if (ux < 0x3F800000 - (12 << 23)) {
return x;
} else {
return h * (2 * t - t * t / (t + 1));
}
}
return h * (t + t / (t + 1));
}
// |x| > log(FLT_MAX) or nan
2 * h * expo2(ax)
}
fn sinhd(x: f64) -> f64 {
const u = @bitCast(u64, x);
const w = u32(u >> 32);
const ax = @bitCast(f64, u & (@maxValue(u64) >> 1));
var h: f32 = 0.5;
if (u >> 63 != 0) {
h = -h;
}
// |x| < log(FLT_MAX)
if (w < 0x40862E42) {
const t = fmath.expm1(ax);
if (w < 0x3FF00000) {
if (w < 0x3FF00000 - (26 << 20)) {
return x;
} else {
return h * (2 * t - t * t / (t + 1));
}
}
// NOTE: |x| > log(0x1p26) + eps could be h * exp(x)
return h * (t + t / (t + 1));
}
// |x| > log(DBL_MAX) or nan
2 * h * expo2(ax)
}
test "sinh" {
fmath.assert(sinh(f32(1.5)) == sinhf(1.5));
fmath.assert(sinh(f64(1.5)) == sinhd(1.5));
}
test "sinhf" {
const epsilon = 0.000001;
fmath.assert(fmath.approxEq(f32, sinhf(0.0), 0.0, epsilon));
fmath.assert(fmath.approxEq(f32, sinhf(0.2), 0.201336, epsilon));
fmath.assert(fmath.approxEq(f32, sinhf(0.8923), 1.015512, epsilon));
fmath.assert(fmath.approxEq(f32, sinhf(1.5), 2.129279, epsilon));
}
test "sinhd" {
const epsilon = 0.000001;
fmath.assert(fmath.approxEq(f64, sinhd(0.0), 0.0, epsilon));
fmath.assert(fmath.approxEq(f64, sinhd(0.2), 0.201336, epsilon));
fmath.assert(fmath.approxEq(f64, sinhd(0.8923), 1.015512, epsilon));
fmath.assert(fmath.approxEq(f64, sinhd(1.5), 2.129279, epsilon));
} | src/sinh.zig |
const std = @import("std");
const assert = std.debug.assert;
const allocator = std.heap.page_allocator;
const Computer = @import("./computer.zig").Computer;
pub const Map = struct {
pub const Pos = struct {
x: usize,
y: usize,
pub fn init(x: usize, y: usize) Pos {
return Pos{
.x = x,
.y = y,
};
}
pub fn equal(self: Pos, other: Pos) bool {
return self.x == other.x and self.y == other.y;
}
};
cells: std.AutoHashMap(Pos, Tile),
pmin: Pos,
pmax: Pos,
prg: []const u8,
pub const Tile = enum(u8) {
Stationary = 0,
Pulled = 1,
};
pub fn init(minx: usize, miny: usize, maxx: usize, maxy: usize, prg: []const u8) Map {
var self = Map{
.cells = std.AutoHashMap(Pos, Tile).init(allocator),
.pmin = Pos.init(minx, miny),
.pmax = Pos.init(maxx, maxy),
.prg = prg,
};
return self;
}
pub fn deinit(self: *Map) void {
self.cells.deinit();
}
pub fn run_for_one_point(self: *Map, p: Pos) Tile {
var comp = Computer.init(true);
defer comp.deinit();
comp.parse(self.prg);
comp.enqueueInput(@intCast(i64, p.x));
comp.enqueueInput(@intCast(i64, p.y));
comp.run();
const output = comp.getOutput();
if (output == null) {
std.debug.warn("FUCK\n", .{});
return Tile.Stationary;
}
const v = @intCast(u8, output.?);
// std.debug.warn("RUN {} {} => {}\n", .{ p.x, p.y, v});
const t = @intToEnum(Tile, v);
return t;
}
pub fn find_first_pulled(self: *Map, y: usize) usize {
var xl: usize = 0;
var xh: usize = (y - 48) * 45 / 41 + 53;
var s: usize = 1;
var t: Tile = undefined;
while (true) {
const p = Pos.init(xh, y);
t = self.run_for_one_point(p);
// std.debug.warn("D {} {} {}\n", .{ xh, y, t});
if (t == Tile.Pulled) break;
xh += s;
s *= 2;
}
while (xl <= xh) {
var xm: usize = (xl + xh) / 2;
const p = Pos.init(xm, y);
t = self.run_for_one_point(p);
// std.debug.warn("M {} {} {}\n", .{ xm, y, t});
if (t == Tile.Pulled) {
xh = xm - 1;
} else {
xl = xm + 1;
}
}
// if (t != Tile.Pulled) xl += 1;
// std.debug.warn("F {} {}\n", .{ xl, y});
return xl;
}
pub fn run_to_get_map(self: *Map) usize {
var count: usize = 0;
var y: usize = self.pmin.y;
while (y < self.pmax.y) : (y += 1) {
var x: usize = self.pmin.x;
while (x < self.pmax.x) : (x += 1) {
// if (self.computer.halted) break :main;
const p = Pos.init(x, y);
const t = self.run_for_one_point(p);
self.set_pos(p, t);
if (t == Tile.Pulled) count += 1;
}
}
return count;
}
pub fn set_pos(self: *Map, pos: Pos, mark: Tile) void {
_ = self.cells.put(pos, mark) catch unreachable;
}
pub fn show(self: Map) void {
std.debug.warn("MAP: {} {} - {} {}\n", .{ self.pmin.x, self.pmin.y, self.pmax.x, self.pmax.y });
var y: usize = self.pmin.y;
while (y < self.pmax.y) : (y += 1) {
std.debug.warn("{:4} | ", .{y});
var x: usize = self.pmin.x;
while (x < self.pmax.x) : (x += 1) {
const p = Pos.init(x, y);
const g = self.cells.get(p);
var c: u8 = ' ';
if (g) |v| {
switch (v) {
Tile.Stationary => c = '.',
Tile.Pulled => c = '#',
}
}
std.debug.warn("{c}", .{c});
}
std.debug.warn("\n", .{});
}
}
}; | 2019/p19/map.zig |
const std = @import("std");
const helper = @import("helper.zig");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const input = @embedFile("../inputs/day16.txt");
pub fn run(alloc: Allocator, stdout_: anytype) !void {
const binary: []const u1 = try convertToBinary(alloc, input);
defer alloc.free(binary);
var arena = std.heap.ArenaAllocator.init(alloc);
defer arena.deinit();
const arena_alloc = arena.allocator();
var packet_parser = PacketParser{ .binary = binary, .alloc = arena_alloc };
const outer_packet = try packet_parser.get();
const res1 = calculateVersionSum(outer_packet);
const res2 = outer_packet.eval();
if (stdout_) |stdout| {
try stdout.print("Part 1: {}\n", .{res1});
try stdout.print("Part 2: {}\n", .{res2});
}
}
fn convertToBinary(alloc: Allocator, data: []const u8) ![]const u1 {
var list = try ArrayList(u1).initCapacity(alloc, data.len * 4); // 4 bits per hex digit, *not* 8
defer list.deinit();
for (data) |hexdigit| {
if (!std.ascii.isXDigit(hexdigit)) continue;
const num = try parseUnsigned(u4, &.{hexdigit}, 16);
inline for (.{ 3, 2, 1, 0 }) |i| {
try list.append(getBit(num, i));
}
}
return list.toOwnedSlice();
}
fn getBit(num: u4, i: u2) u1 {
const one: u4 = 1;
return @boolToInt(num & (one << i) != 0);
}
fn calculateVersionSum(packet: Packet) i64 {
switch (packet.kind) {
.literal => return packet.version,
.operator => |data| {
var sum: i64 = packet.version;
for (data.subpackets) |subpacket| {
sum += calculateVersionSum(subpacket);
}
return sum;
},
}
}
const Packet = struct {
version: u3,
id: u3,
bin_len: usize,
kind: union(enum) {
literal: []const u1,
operator: struct {
length_type: u1,
subpackets: []Packet,
},
},
const Self = @This();
pub fn eval(self: Self) i64 {
switch (self.kind) {
.literal => |binary| return evalLiteral(binary),
.operator => |data| {
const packets = data.subpackets;
switch (self.id) {
0 => return evalSum(packets),
1 => return evalProduct(packets),
2 => return evalMin(packets),
3 => return evalMax(packets),
5 => return evalGT(packets),
6 => return evalLT(packets),
7 => return evalEQ(packets),
else => unreachable,
}
},
}
}
fn evalLiteral(binary: []const u1) i64 {
var sum: i64 = 0;
var i: usize = 0;
while (i < binary.len) : (i += 1) {
if (i % 5 == 0) continue; // skip every 5th control bit
sum = sum << 1;
sum += binary[i];
}
return sum;
}
fn evalSum(packets: []const Packet) i64 {
var sum: i64 = 0;
for (packets) |packet| {
sum += packet.eval();
}
return sum;
}
fn evalProduct(packets: []const Packet) i64 {
var product: i64 = 1;
for (packets) |packet| {
product *= packet.eval();
}
return product;
}
fn evalMin(packets: []const Packet) i64 {
var min: i64 = std.math.maxInt(i64);
for (packets) |packet| {
const val = packet.eval();
if (val < min) min = val;
}
return min;
}
fn evalMax(packets: []const Packet) i64 {
var max: i64 = std.math.minInt(i64);
for (packets) |packet| {
const val = packet.eval();
if (val > max) max = val;
}
return max;
}
fn evalGT(packets: []const Packet) i64 {
if (packets.len != 2) unreachable;
return @boolToInt(packets[0].eval() > packets[1].eval());
}
fn evalLT(packets: []const Packet) i64 {
if (packets.len != 2) unreachable;
return @boolToInt(packets[0].eval() < packets[1].eval());
}
fn evalEQ(packets: []const Packet) i64 {
if (packets.len != 2) unreachable;
return @boolToInt(packets[0].eval() == packets[1].eval());
}
};
const PacketParser = struct {
binary: []const u1,
alloc: Allocator,
idx: usize = 0,
const Self = @This();
pub fn get(self: *Self) Allocator.Error!Packet {
const start = self.idx;
const version = self.getN(3);
const id = self.getN(3);
if (id == 4) {
return self.getLiteral(start, version, id);
} else {
return self.getOperator(start, version, id);
}
}
fn getLiteral(self: *Self, start: usize, version: u3, id: u3) Packet {
const literal_start = self.idx;
while (self.binary[self.idx] == 1) : (self.idx += 5) {}
self.idx += 5; // also consume the last section that starts with a 0
const literal = self.binary[literal_start..self.idx];
return Packet{
.version = version,
.id = id,
.bin_len = (self.idx - start),
.kind = .{
.literal = literal,
},
};
}
fn getOperator(self: *Self, start: usize, version: u3, id: u3) Allocator.Error!Packet {
const length_type: u1 = self.binary[self.idx];
self.idx += 1;
const subpackets = if (length_type == 0) // total length in bits is provided
try self.getSubpacketsWithBitLength()
else // number of sub-packets immediately contained is provided
try self.getSubpacketsWithNumber();
return Packet{
.version = version,
.id = id,
.bin_len = (self.idx - start),
.kind = .{ .operator = .{
.length_type = length_type,
.subpackets = subpackets,
} },
};
}
fn getSubpacketsWithBitLength(self: *Self) Allocator.Error![]Packet {
var packets = ArrayList(Packet).init(self.alloc);
defer packets.deinit();
const limit_bit_length = @intCast(usize, self.getN(15));
var total_bit_length: usize = 0;
while (total_bit_length < limit_bit_length) {
const packet = try self.get();
try packets.append(packet);
total_bit_length += packet.bin_len;
}
return packets.toOwnedSlice();
}
fn getSubpacketsWithNumber(self: *Self) Allocator.Error![]Packet {
var packets = ArrayList(Packet).init(self.alloc);
defer packets.deinit();
const limit_num: u11 = self.getN(11);
var total_num: u11 = 0;
while (total_num < limit_num) : (total_num += 1) {
const packet = try self.get();
try packets.append(packet);
}
return packets.toOwnedSlice();
}
fn getN(self: *Self, comptime n: u16) std.meta.Int(.unsigned, n) {
if (self.idx + n >= self.binary.len) unreachable;
const idx = self.idx;
const binary = self.binary;
defer self.idx += n;
var sum: std.meta.Int(.unsigned, n) = 0;
comptime var i = 0;
inline while (i < n) : (i += 1) {
sum = sum << 1;
sum += binary[idx + i];
}
return sum;
}
};
const eql = std.mem.eql;
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const count = std.mem.count;
const parseUnsigned = std.fmt.parseUnsigned;
const parseInt = std.fmt.parseInt;
const sort = std.sort.sort; | src/day16.zig |
const std = @import("std");
const panic = std.debug.panic;
const utils = @import("utils.zig");
const print = utils.print;
const puts_e = utils.puts_e;
const types = @import("types.zig");
const NodeKind = types.NodeKind;
const Node = types.Node;
const List = types.List;
const allocator = std.heap.page_allocator;
const ParseRetval = struct {
list: *List,
size: usize,
fn init(list: *List, size: usize) *ParseRetval {
var obj = allocator.create(ParseRetval) catch |err| {
panic("Failed to allocate ({})", .{err});
};
obj.list = list;
obj.size = size;
return obj;
}
};
pub fn parseList(input_json: []const u8) *ParseRetval {
const list = List.init();
var pos: usize = 1;
var rest: []const u8 = undefined;
while (pos < input_json.len) {
rest = input_json[pos..];
if (rest[0] == ']') {
pos += 1;
break;
} else if (rest[0] == '[') {
const retval = parseList(rest);
list.addList(retval.list);
pos += retval.size;
} else if (rest[0] == ' ' or rest[0] == '\n' or rest[0] == ',') {
pos += 1;
} else if (utils.isNumeric(rest[0]) or rest[0] == '-') {
const idx = utils.indexOfNonNumeric(rest, 1);
const matched_part = rest[0..idx];
const n: i32 = utils.parseInt(matched_part);
list.addInt(n);
pos += matched_part.len;
} else if (rest[0] == '"') {
const idx: i32 = utils.indexOf(rest, '"', 1);
var usize_idx: usize = 0;
if (1 <= idx) {
usize_idx = @intCast(usize, idx);
} else {
panic("must not happen ({})", .{idx});
}
const matched_part = rest[1..usize_idx];
list.addStr(matched_part);
pos += matched_part.len + 2;
} else {
std.debug.panic("Unexpected pattern: pos({}) rest({}) rest[0]({})", .{ pos, rest, rest[0] });
}
}
return ParseRetval.init(list, pos);
}
pub fn parse(input_json: []const u8) *List {
if (input_json[0] == '[') {
const retval = parseList(input_json);
return retval.list;
} else {
panic("Unexpected pattern", .{});
}
}
fn printIndent(lv: u8) void {
var i: usize = 0;
while (i < lv) : (i += 1) {
print(" ");
}
}
fn printNodeAsJson(node: *Node, lv: u8) void {
switch (node.kind) {
.INT => {
printIndent(lv + 1);
print(node.int);
},
.STR => {
printIndent(lv + 1);
print("\"");
print(node.getStr());
print("\"");
},
.LIST => {
const list: ?*List = node.list;
if (list) |_list| {
printListAsJson(_list, lv + 1);
}
},
}
}
fn printListAsJson(list: *List, lv: u8) void {
printIndent(lv);
print("[\n");
var i: usize = 0;
while (i < list.size()) : (i += 1) {
const node = list.get(i);
if (1 <= i) {
print(",");
print("\n");
}
printNodeAsJson(node, lv);
}
print("\n");
printIndent(lv);
print("]");
}
pub fn printAsJson(list: *List) void {
printListAsJson(list, 0);
print("\n");
} | lib/json.zig |
const std = @import("std");
const testing = std.testing;
const assert = @import("std").debug.assert;
const mem = std.mem;
const MAX_BYTE = 255;
const MAX_SHORT = 65535;
const MAX_INT = 4294967295;
const Fletcher16 = struct {
c0: u16,
c1: u16,
const Self = @This();
pub fn init() Self {
return Self{ .c0 = 0, .c1 = 0 };
}
pub fn reset(self: *Self) void {
self.c0 = 0;
self.c1 = 0;
}
pub fn update(self: *Self, input: []const u8) void {
for (input) |byte| {
self.c0 = (self.c0 +% byte) % MAX_BYTE;
self.c1 = (self.c1 +% self.c0) % MAX_BYTE;
}
}
pub fn final(self: *Self) u16 {
return self.c1 << 8 | self.c0;
}
};
const Fletcher32 = struct {
c0: u32,
c1: u32,
cache: u8,
has_cache: bool,
const Self = @This();
pub fn init() Self {
return Self{ .c0 = 0, .c1 = 0, .cache = 0, .has_cache = false };
}
pub fn reset(self: *Self) void {
self.c0 = 0;
self.c1 = 0;
self.cache = 0;
self.has_cache = false;
}
pub fn update(self: *Self, input: []const u8) void {
if (input.len == 0) {
return;
} else if (input.len == 1) {
if (self.has_cache) {
const reconstructed = self.cache | @as(u16, input[0]) << 8;
self.update_internal_unit(reconstructed);
self.has_cache = false;
} else {
self.cache = input[0];
self.has_cache = true;
}
} else {
if (self.has_cache) {
const reconstructed = self.cache | @as(u16, input[0]) << 8;
self.update_internal_unit(reconstructed);
if (input.len % 2 != 0) {
// Even number of elements left, no cache left
const cast_array = mem.bytesAsSlice(u16, input[1..]);
for (cast_array) |word| {
self.update_internal_unit(word);
}
self.has_cache = false;
} else {
// Odd number of elements left, put last element in cache
const cast_array = mem.bytesAsSlice(u16, input[1..(input.len-1)]);
for (cast_array) |word| {
self.update_internal_unit(word);
}
self.cache = input[input.len - 1];
self.has_cache = true;
}
} else {
const take = (input.len/2)*2;
var slice = input[0..take];
const cast_array = mem.bytesAsSlice(u16, slice);
for (cast_array) |word| {
self.update_internal_unit(word);
}
if (take != input.len) {
self.has_cache = true;
self.cache = input[input.len - 1];
}
}
}
}
fn update_internal_unit(self: *Self, unit: u16) void {
self.c0 = (self.c0 +% unit) % MAX_SHORT;
self.c1 = (self.c1 +% self.c0) % MAX_SHORT;
}
pub fn final(self: *Self) u32 {
if (self.has_cache) {
const reconstructed = @as(u16, self.cache);
self.update_internal_unit(reconstructed);
}
return self.c1 << 16 | self.c0;
}
};
const Fletcher64 = struct {
c0: u64,
c1: u64,
const Self = @This();
pub fn init() Self {
return Self{ .c0 = 0, .c1 = 0 };
}
pub fn reset(self: *Self) void {
self.c0 = 0;
self.c1 = 0;
}
pub fn update(self: *Self, input: []u32) void {
for (input) |dword| {
self.c0 = (self.c0 +% dword) % MAX_INT;
self.c1 = (self.c1 +% self.c0) % MAX_INT;
}
}
pub fn final(self: *Self) u64 {
return self.c1 << 32 | self.c0;
}
};
test "fletcher 16 empty string" {
var empty_block: []u8 = &.{};
var fletcher16 = Fletcher16.init();
fletcher16.update(empty_block);
const result = fletcher16.final();
const expected: u16 = 0;
try testing.expectEqual(expected, result);
}
test "fletcher 16 string1" {
const mystring_const: []const u8 = "abcde";
var fletcher16 = Fletcher16.init();
fletcher16.update(mystring_const[0..]);
const result = fletcher16.final();
const expected: u16 = 51440;
try testing.expectEqual(expected, result);
}
test "fletcher 16 string2" {
const mystring_const: []const u8 = "abcdef";
var fletcher16 = Fletcher16.init();
fletcher16.update(mystring_const[0..]);
const result = fletcher16.final();
const expected: u16 = 8279;
try testing.expectEqual(expected, result);
}
test "fletcher 16 string3" {
const mystring_const: []const u8 = "abcdefgh";
var fletcher16 = Fletcher16.init();
fletcher16.update(mystring_const[0..]);
const result = fletcher16.final();
const expected: u16 = 1575;
try testing.expectEqual(expected, result);
}
test "fletcher 16 string3 piecewise" {
const mystring_const1: []const u8 = "abc";
const mystring_const2: []const u8 = "defgh";
var fletcher16 = Fletcher16.init();
fletcher16.update(mystring_const1[0..]);
fletcher16.update(mystring_const2[0..]);
const result = fletcher16.final();
const expected: u16 = 1575;
try testing.expectEqual(expected, result);
}
test "fletcher 32 empty string" {
var empty_block: []u8 = &.{};
var fletcher32 = Fletcher32.init();
fletcher32.update(empty_block);
const result = fletcher32.final();
const expected: u32 = 0;
try testing.expectEqual(expected, result);
}
test "fletcher 32 string1" {
const mystring_const: []const u8 = "abcde";
var fletcher = Fletcher32.init();
fletcher.update(mystring_const[0..]);
const result = fletcher.final();
const expected: u32 = 4031760169;
try testing.expectEqual(expected, result);
}
test "fletcher 32 string2" {
const mystring_const: []const u8 = "abcdef";
var fletcher = Fletcher32.init();
fletcher.update(mystring_const[0..]);
const result = fletcher.final();
const expected: u32 = 1448095018;
try testing.expectEqual(expected, result);
}
test "fletcher 32 string3" {
const mystring_const: []const u8 = "abcdefgh";
var fletcher = Fletcher32.init();
fletcher.update(mystring_const[0..]);
const result = fletcher.final();
const expected: u32 = 3957429649;
try testing.expectEqual(expected, result);
}
test "fletcher 32 piecewise 1" {
const mystring_const1: []const u8 = "abc";
const mystring_const2: []const u8 = "defgh";
var fletcher = Fletcher32.init();
fletcher.update(mystring_const1[0..]);
fletcher.update(mystring_const2[0..]);
const result = fletcher.final();
const expected: u32 = 3957429649;
try testing.expectEqual(expected, result);
}
test "fletcher 32 piecewise 2" {
const mystring_const1: []const u8 = "abcd";
const mystring_const2: []const u8 = "efgh";
var fletcher = Fletcher32.init();
fletcher.update(mystring_const1[0..]);
fletcher.update(mystring_const2[0..]);
const result = fletcher.final();
const expected: u32 = 3957429649;
try testing.expectEqual(expected, result);
}
test "fletcher 32 piecewise 3" {
const mystring_const1: []const u8 = "abcdefg";
const mystring_const2: []const u8 = "h";
var fletcher = Fletcher32.init();
fletcher.update(mystring_const1[0..]);
try testing.expectEqual(true, fletcher.has_cache);
try testing.expectEqual(@as(u8, 'g'), fletcher.cache);
fletcher.update(mystring_const2[0..]);
const result = fletcher.final();
const expected: u32 = 3957429649;
try testing.expectEqual(expected, result);
}
test "fletcher 32 piecewise 4" {
const mystring_const1: []const u8 = "abcd";
const mystring_const2: []const u8 = "e";
var fletcher = Fletcher32.init();
fletcher.update(mystring_const1[0..]);
fletcher.update(mystring_const2[0..]);
const result = fletcher.final();
const expected: u32 = 4031760169;
try testing.expectEqual(expected, result);
} | fletcher.zig |
pub const Link = ZigLLDLink;
extern fn ZigLLDLink(
oformat: ObjectFormatType,
args: [*:null]const ?[*:0]const u8,
arg_count: usize,
append_diagnostic: fn (context: usize, ptr: [*]const u8, len: usize) callconv(.C) void,
context_stdout: usize,
context_stderr: usize,
) bool;
pub const ObjectFormatType = extern enum(c_int) {
Unknown,
COFF,
ELF,
MachO,
Wasm,
XCOFF,
};
pub const GetHostCPUName = LLVMGetHostCPUName;
extern fn LLVMGetHostCPUName() ?[*:0]u8;
pub const GetNativeFeatures = ZigLLVMGetNativeFeatures;
extern fn ZigLLVMGetNativeFeatures() ?[*:0]u8;
pub const WriteArchive = ZigLLVMWriteArchive;
extern fn ZigLLVMWriteArchive(
archive_name: [*:0]const u8,
file_names_ptr: [*]const [*:0]const u8,
file_names_len: usize,
os_type: OSType,
) bool;
pub const OSType = extern enum(c_int) {
UnknownOS = 0,
Ananas = 1,
CloudABI = 2,
Darwin = 3,
DragonFly = 4,
FreeBSD = 5,
Fuchsia = 6,
IOS = 7,
KFreeBSD = 8,
Linux = 9,
Lv2 = 10,
MacOSX = 11,
NetBSD = 12,
OpenBSD = 13,
Solaris = 14,
Win32 = 15,
Haiku = 16,
Minix = 17,
RTEMS = 18,
NaCl = 19,
CNK = 20,
AIX = 21,
CUDA = 22,
NVCL = 23,
AMDHSA = 24,
PS4 = 25,
ELFIAMCU = 26,
TvOS = 27,
WatchOS = 28,
Mesa3D = 29,
Contiki = 30,
AMDPAL = 31,
HermitCore = 32,
Hurd = 33,
WASI = 34,
Emscripten = 35,
};
pub const ArchType = extern enum(c_int) {
UnknownArch = 0,
arm = 1,
armeb = 2,
aarch64 = 3,
aarch64_be = 4,
aarch64_32 = 5,
arc = 6,
avr = 7,
bpfel = 8,
bpfeb = 9,
hexagon = 10,
mips = 11,
mipsel = 12,
mips64 = 13,
mips64el = 14,
msp430 = 15,
ppc = 16,
ppc64 = 17,
ppc64le = 18,
r600 = 19,
amdgcn = 20,
riscv32 = 21,
riscv64 = 22,
sparc = 23,
sparcv9 = 24,
sparcel = 25,
systemz = 26,
tce = 27,
tcele = 28,
thumb = 29,
thumbeb = 30,
x86 = 31,
x86_64 = 32,
xcore = 33,
nvptx = 34,
nvptx64 = 35,
le32 = 36,
le64 = 37,
amdil = 38,
amdil64 = 39,
hsail = 40,
hsail64 = 41,
spir = 42,
spir64 = 43,
kalimba = 44,
shave = 45,
lanai = 46,
wasm32 = 47,
wasm64 = 48,
renderscript32 = 49,
renderscript64 = 50,
ve = 51,
};
pub const ParseCommandLineOptions = ZigLLVMParseCommandLineOptions;
extern fn ZigLLVMParseCommandLineOptions(argc: usize, argv: [*]const [*:0]const u8) void;
pub const WriteImportLibrary = ZigLLVMWriteImportLibrary;
extern fn ZigLLVMWriteImportLibrary(
def_path: [*:0]const u8,
arch: ArchType,
output_lib_path: [*c]const u8,
kill_at: bool,
) bool; | src/llvm.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const data = @embedFile("../inputs/day05.txt");
pub fn main() anyerror!void {
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa_impl.deinit();
const gpa = gpa_impl.allocator();
return main_with_allocator(gpa);
}
pub fn main_with_allocator(allocator: Allocator) anyerror!void {
const lines = try parse(allocator, data[0..]);
defer lines.deinit();
const res = try solve(lines.items);
print("Part 1: {d}\n", .{res.part1});
print("Part 2: {d}\n", .{res.part2});
}
const Point = struct {
const Self = @This();
x: i16,
y: i16,
fn parse(input: []const u8) !Self {
var pos = std.mem.split(u8, input, ",");
const x = try std.fmt.parseInt(i16, pos.next().?, 10);
const y = try std.fmt.parseInt(i16, pos.next().?, 10);
return Point{
.x = x,
.y = y,
};
}
fn eql(self: Self, other: Self) bool {
return self.x == other.x and self.y == other.y;
}
};
const Direction = enum {
Horizontal,
Vertical,
Diagonal,
};
const PointIterator = struct {
const Self = @This();
line: Line,
idx: i16,
fn next(self: *Self) ?Point {
switch (self.line.direction()) {
.Horizontal => {
const from = std.math.min(self.line.start.x, self.line.end.x);
const to = std.math.max(self.line.start.x, self.line.end.x);
const x = from + self.idx;
if (x <= to) {
self.idx += 1;
return Point{
.x = x,
.y = self.line.start.y,
};
}
},
.Vertical => {
const from = std.math.min(self.line.start.y, self.line.end.y);
const to = std.math.max(self.line.start.y, self.line.end.y);
const y = from + self.idx;
if (y <= to) {
self.idx += 1;
return Point{
.x = self.line.start.x,
.y = y,
};
}
},
.Diagonal => {
const assending_x = self.line.start.x < self.line.end.x;
const delta_x = if (self.line.start.x < self.line.end.x) @as(i16, 1) else -1;
const delta_y = if (self.line.start.y < self.line.end.y) @as(i16, 1) else -1;
var x = self.line.start.x + self.idx * delta_x;
var y = self.line.start.y + self.idx * delta_y;
if ((assending_x and x <= self.line.end.x) or (!assending_x and x >= self.line.end.x)) {
self.idx += 1;
return Point{
.x = x,
.y = y,
};
}
},
}
return null;
}
};
const Line = struct {
const Self = @This();
start: Point,
end: Point,
fn parse(input: []const u8) !Self {
var point_str = std.mem.split(u8, input, " -> ");
const start = try Point.parse(point_str.next().?);
const end = try Point.parse(point_str.next().?);
return Line{
.start = start,
.end = end,
};
}
fn direction(self: Self) Direction {
if (self.start.x == self.end.x) return Direction.Vertical;
if (self.start.y == self.end.y) return Direction.Horizontal;
return Direction.Diagonal;
}
fn points_iterator(self: Self) PointIterator {
return PointIterator{
.line = self,
.idx = 0,
};
}
};
fn parse(allocator: Allocator, input: []const u8) !std.ArrayList(Line) {
var lines = std.mem.tokenize(u8, input, "\n");
var out = std.ArrayList(Line).init(allocator);
errdefer out.deinit();
while (lines.next()) |line| {
const l = try Line.parse(line);
try out.append(l);
}
return out;
}
const Result = struct {
part1: usize,
part2: usize,
};
const Cell = struct {
no_diagonal_count: u2,
with_diagonal_count: u2,
};
var points: [1000][1000]Cell = undefined; // zero initialisation
fn solve(lines: []const Line) !Result {
var overlaps: usize = 0;
var overlaps_with_diagonal: usize = 0;
for (lines) |line| {
var it = line.points_iterator();
while (it.next()) |lp| {
const x = @intCast(usize, lp.x);
const y = @intCast(usize, lp.y);
const p = &points[y][x];
if (p.with_diagonal_count < 3) {
p.with_diagonal_count += 1;
}
if (p.with_diagonal_count == 2) {
overlaps_with_diagonal += 1;
}
if (line.direction() != Direction.Diagonal) {
if (p.no_diagonal_count < 3) {
p.no_diagonal_count += 1;
}
if (p.no_diagonal_count == 2) {
overlaps += 1;
}
}
}
}
return Result{
.part1 = overlaps,
.part2 = overlaps_with_diagonal,
};
}
test "overlap" {
const input =
\\0,9 -> 5,9
\\8,0 -> 0,8
\\9,4 -> 3,4
\\2,2 -> 2,1
\\7,0 -> 7,4
\\6,4 -> 2,0
\\0,9 -> 2,9
\\3,4 -> 1,4
\\0,0 -> 8,8
\\5,5 -> 8,2
;
const allocator = std.testing.allocator;
const lines = try parse(allocator, input[0..]);
defer lines.deinit();
const res = try solve(lines.items);
try std.testing.expectEqual(@as(usize, 5), res.part1);
try std.testing.expectEqual(@as(usize, 12), res.part2);
} | src/day05.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const ArrayList = std.ArrayList;
const Builder = std.build.Builder;
const File = std.fs.File;
const InstallDir = std.build.InstallDir;
const LibExeObjStep = std.build.LibExeObjStep;
const Step = std.build.Step;
const elf = std.elf;
const fs = std.fs;
const io = std.io;
const sort = std.sort;
const warn = std.debug.warn;
const BinaryElfSection = struct {
elfOffset: u64,
binaryOffset: u64,
fileSize: usize,
segment: ?*BinaryElfSegment,
};
const BinaryElfSegment = struct {
physicalAddress: u64,
virtualAddress: u64,
elfOffset: u64,
binaryOffset: u64,
fileSize: usize,
firstSection: ?*BinaryElfSection,
};
const BinaryElfOutput = struct {
segments: ArrayList(*BinaryElfSegment),
sections: ArrayList(*BinaryElfSection),
const Self = @This();
pub fn deinit(self: *Self) void {
self.sections.deinit();
self.segments.deinit();
}
pub fn parse(allocator: *Allocator, elf_file: File) !Self {
var self: Self = .{
.segments = ArrayList(*BinaryElfSegment).init(allocator),
.sections = ArrayList(*BinaryElfSection).init(allocator),
};
const elf_hdr = try std.elf.Header.read(&elf_file);
var section_headers = elf_hdr.section_header_iterator(&elf_file);
while (try section_headers.next()) |section| {
if (sectionValidForOutput(section)) {
const newSection = try allocator.create(BinaryElfSection);
newSection.binaryOffset = 0;
newSection.elfOffset = section.sh_offset;
newSection.fileSize = @intCast(usize, section.sh_size);
newSection.segment = null;
try self.sections.append(newSection);
}
}
var program_headers = elf_hdr.program_header_iterator(&elf_file);
while (try program_headers.next()) |phdr| {
if (phdr.p_type == elf.PT_LOAD) {
const newSegment = try allocator.create(BinaryElfSegment);
newSegment.physicalAddress = if (phdr.p_paddr != 0) phdr.p_paddr else phdr.p_vaddr;
newSegment.virtualAddress = phdr.p_vaddr;
newSegment.fileSize = @intCast(usize, phdr.p_filesz);
newSegment.elfOffset = phdr.p_offset;
newSegment.binaryOffset = 0;
newSegment.firstSection = null;
for (self.sections.items) |section| {
if (sectionWithinSegment(section, phdr)) {
if (section.segment) |sectionSegment| {
if (sectionSegment.elfOffset > newSegment.elfOffset) {
section.segment = newSegment;
}
} else {
section.segment = newSegment;
}
if (newSegment.firstSection == null) {
newSegment.firstSection = section;
}
}
}
try self.segments.append(newSegment);
}
}
sort.sort(*BinaryElfSegment, self.segments.items, {}, segmentSortCompare);
if (self.segments.items.len > 0) {
const firstSegment = self.segments.items[0];
if (firstSegment.firstSection) |firstSection| {
const diff = firstSection.elfOffset - firstSegment.elfOffset;
firstSegment.elfOffset += diff;
firstSegment.fileSize += diff;
firstSegment.physicalAddress += diff;
const basePhysicalAddress = firstSegment.physicalAddress;
for (self.segments.items) |segment| {
segment.binaryOffset = segment.physicalAddress - basePhysicalAddress;
}
}
}
for (self.sections.items) |section| {
if (section.segment) |segment| {
section.binaryOffset = segment.binaryOffset + (section.elfOffset - segment.elfOffset);
}
}
sort.sort(*BinaryElfSection, self.sections.items, {}, sectionSortCompare);
return self;
}
fn sectionWithinSegment(section: *BinaryElfSection, segment: elf.Elf64_Phdr) bool {
return segment.p_offset <= section.elfOffset and (segment.p_offset + segment.p_filesz) >= (section.elfOffset + section.fileSize);
}
fn sectionValidForOutput(shdr: anytype) bool {
return shdr.sh_size > 0 and shdr.sh_type != elf.SHT_NOBITS and
((shdr.sh_flags & elf.SHF_ALLOC) == elf.SHF_ALLOC);
}
fn segmentSortCompare(context: void, left: *BinaryElfSegment, right: *BinaryElfSegment) bool {
_ = context;
if (left.physicalAddress < right.physicalAddress) {
return true;
}
if (left.physicalAddress > right.physicalAddress) {
return false;
}
return false;
}
fn sectionSortCompare(context: void, left: *BinaryElfSection, right: *BinaryElfSection) bool {
_ = context;
return left.binaryOffset < right.binaryOffset;
}
};
fn writeBinaryElfSection(elf_file: File, out_file: File, section: *BinaryElfSection) !void {
try out_file.seekTo(section.binaryOffset);
try out_file.writeFileAll(elf_file, .{
.in_offset = section.elfOffset,
.in_len = section.fileSize,
});
}
const HexWriter = struct {
prev_addr: ?u32 = null,
out_file: File,
/// Max data bytes per line of output
const MAX_PAYLOAD_LEN: u8 = 16;
fn addressParts(address: u16) [2]u8 {
const msb = @truncate(u8, address >> 8);
const lsb = @truncate(u8, address);
return [2]u8{ msb, lsb };
}
const Record = struct {
const Type = enum(u8) {
Data = 0,
EOF = 1,
ExtendedSegmentAddress = 2,
ExtendedLinearAddress = 4,
};
address: u16,
payload: union(Type) {
Data: []const u8,
EOF: void,
ExtendedSegmentAddress: [2]u8,
ExtendedLinearAddress: [2]u8,
},
fn EOF() Record {
return Record{
.address = 0,
.payload = .EOF,
};
}
fn Data(address: u32, data: []const u8) Record {
return Record{
.address = @intCast(u16, address % 0x10000),
.payload = .{ .Data = data },
};
}
fn Address(address: u32) Record {
std.debug.assert(address > 0xFFFF);
const segment = @intCast(u16, address / 0x10000);
if (address > 0xFFFFF) {
return Record{
.address = 0,
.payload = .{ .ExtendedLinearAddress = addressParts(segment) },
};
} else {
return Record{
.address = 0,
.payload = .{ .ExtendedSegmentAddress = addressParts(segment << 12) },
};
}
}
fn getPayloadBytes(self: Record) []const u8 {
return switch (self.payload) {
.Data => |d| d,
.EOF => @as([]const u8, &.{}),
.ExtendedSegmentAddress, .ExtendedLinearAddress => |*seg| seg,
};
}
fn checksum(self: Record) u8 {
const payload_bytes = self.getPayloadBytes();
var sum: u8 = @intCast(u8, payload_bytes.len);
const parts = addressParts(self.address);
sum +%= parts[0];
sum +%= parts[1];
sum +%= @enumToInt(self.payload);
for (payload_bytes) |byte| {
sum +%= byte;
}
return (sum ^ 0xFF) +% 1;
}
fn write(self: Record, file: File) File.WriteError!void {
const linesep = "\r\n";
// colon, (length, address, type, payload, checksum) as hex, CRLF
const BUFSIZE = 1 + (1 + 2 + 1 + MAX_PAYLOAD_LEN + 1) * 2 + linesep.len;
var outbuf: [BUFSIZE]u8 = undefined;
const payload_bytes = self.getPayloadBytes();
std.debug.assert(payload_bytes.len <= MAX_PAYLOAD_LEN);
const line = try std.fmt.bufPrint(&outbuf, ":{0X:0>2}{1X:0>4}{2X:0>2}{3s}{4X:0>2}" ++ linesep, .{
@intCast(u8, payload_bytes.len),
self.address,
@enumToInt(self.payload),
std.fmt.fmtSliceHexUpper(payload_bytes),
self.checksum(),
});
try file.writeAll(line);
}
};
pub fn writeSegment(self: *HexWriter, segment: *const BinaryElfSegment, elf_file: File) !void {
var buf: [MAX_PAYLOAD_LEN]u8 = undefined;
var bytes_read: usize = 0;
while (bytes_read < segment.fileSize) {
const row_address = @intCast(u32, segment.physicalAddress + bytes_read);
const remaining = segment.fileSize - bytes_read;
const to_read = @minimum(remaining, MAX_PAYLOAD_LEN);
const did_read = try elf_file.preadAll(buf[0..to_read], segment.elfOffset + bytes_read);
if (did_read < to_read) return error.UnexpectedEOF;
try self.writeDataRow(row_address, buf[0..did_read]);
bytes_read += did_read;
}
}
fn writeDataRow(self: *HexWriter, address: u32, data: []const u8) File.WriteError!void {
const record = Record.Data(address, data);
if (address > 0xFFFF and (self.prev_addr == null or record.address != self.prev_addr.?)) {
try Record.Address(address).write(self.out_file);
}
try record.write(self.out_file);
self.prev_addr = @intCast(u32, record.address + data.len);
}
fn writeEOF(self: HexWriter) File.WriteError!void {
try Record.EOF().write(self.out_file);
}
};
fn containsValidAddressRange(segments: []*BinaryElfSegment) bool {
const max_address = std.math.maxInt(u32);
for (segments) |segment| {
if (segment.fileSize > max_address or
segment.physicalAddress > max_address - segment.fileSize) return false;
}
return true;
}
fn emitRaw(allocator: *Allocator, elf_path: []const u8, raw_path: []const u8, format: RawFormat) !void {
var elf_file = try fs.cwd().openFile(elf_path, .{});
defer elf_file.close();
var out_file = try fs.cwd().createFile(raw_path, .{});
defer out_file.close();
var binary_elf_output = try BinaryElfOutput.parse(allocator, elf_file);
defer binary_elf_output.deinit();
switch (format) {
.bin => {
for (binary_elf_output.sections.items) |section| {
try writeBinaryElfSection(elf_file, out_file, section);
}
},
.hex => {
if (binary_elf_output.segments.items.len == 0) return;
if (!containsValidAddressRange(binary_elf_output.segments.items)) {
return error.InvalidHexfileAddressRange;
}
var hex_writer = HexWriter{ .out_file = out_file };
for (binary_elf_output.sections.items) |section| {
if (section.segment) |segment| {
try hex_writer.writeSegment(segment, elf_file);
}
}
try hex_writer.writeEOF();
},
}
}
const InstallRawStep = @This();
pub const base_id = .install_raw;
pub const RawFormat = enum {
bin,
hex,
};
step: Step,
builder: *Builder,
artifact: *LibExeObjStep,
dest_dir: InstallDir,
dest_filename: []const u8,
format: RawFormat,
output_file: std.build.GeneratedFile,
fn detectFormat(filename: []const u8) RawFormat {
if (std.mem.endsWith(u8, filename, ".hex") or std.mem.endsWith(u8, filename, ".ihex")) {
return .hex;
}
return .bin;
}
pub fn create(builder: *Builder, artifact: *LibExeObjStep, dest_filename: []const u8, format: ?RawFormat) *InstallRawStep {
const self = builder.allocator.create(InstallRawStep) catch unreachable;
self.* = InstallRawStep{
.step = Step.init(.install_raw, builder.fmt("install raw binary {s}", .{artifact.step.name}), builder.allocator, make),
.builder = builder,
.artifact = artifact,
.dest_dir = switch (artifact.kind) {
.obj => unreachable,
.@"test" => unreachable,
.exe => .bin,
.lib => unreachable,
},
.dest_filename = dest_filename,
.format = format orelse detectFormat(dest_filename),
.output_file = std.build.GeneratedFile{ .step = &self.step },
};
self.step.dependOn(&artifact.step);
builder.pushInstalledFile(self.dest_dir, dest_filename);
return self;
}
pub fn getOutputSource(self: *const InstallRawStep) std.build.FileSource {
return std.build.FileSource{ .generated = &self.output_file };
}
fn make(step: *Step) !void {
const self = @fieldParentPtr(InstallRawStep, "step", step);
const builder = self.builder;
if (self.artifact.target.getObjectFormat() != .elf) {
warn("InstallRawStep only works with ELF format.\n", .{});
return error.InvalidObjectFormat;
}
const full_src_path = self.artifact.getOutputSource().getPath(builder);
const full_dest_path = builder.getInstallPath(self.dest_dir, self.dest_filename);
fs.cwd().makePath(builder.getInstallPath(self.dest_dir, "")) catch unreachable;
try emitRaw(builder.allocator, full_src_path, full_dest_path, self.format);
self.output_file.path = full_dest_path;
}
test {
std.testing.refAllDecls(InstallRawStep);
}
test "Detect format from filename" {
try std.testing.expectEqual(RawFormat.hex, detectFormat("foo.hex"));
try std.testing.expectEqual(RawFormat.hex, detectFormat("foo.ihex"));
try std.testing.expectEqual(RawFormat.bin, detectFormat("foo.bin"));
try std.testing.expectEqual(RawFormat.bin, detectFormat("foo.bar"));
try std.testing.expectEqual(RawFormat.bin, detectFormat("a"));
}
test "containsValidAddressRange" {
var segment = BinaryElfSegment{
.physicalAddress = 0,
.virtualAddress = 0,
.elfOffset = 0,
.binaryOffset = 0,
.fileSize = 0,
.firstSection = null,
};
var buf: [1]*BinaryElfSegment = .{&segment};
// segment too big
segment.fileSize = std.math.maxInt(u32) + 1;
try std.testing.expect(!containsValidAddressRange(&buf));
// start address too big
segment.physicalAddress = std.math.maxInt(u32) + 1;
segment.fileSize = 2;
try std.testing.expect(!containsValidAddressRange(&buf));
// max address too big
segment.physicalAddress = std.math.maxInt(u32) - 1;
segment.fileSize = 2;
try std.testing.expect(!containsValidAddressRange(&buf));
// is ok
segment.physicalAddress = std.math.maxInt(u32) - 1;
segment.fileSize = 1;
try std.testing.expect(containsValidAddressRange(&buf));
} | lib/std/build/InstallRawStep.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const List = std.ArrayList;
const Map = std.AutoHashMap;
const StrMap = std.StringHashMap;
const BitSet = std.DynamicBitSet;
const Str = []const u8;
const int = i64;
const util = @import("util.zig");
const gpa = util.gpa;
const data = @embedFile("../data/day13.txt");
const data2 =
\\6,10
\\0,14
\\9,10
\\0,3
\\10,4
\\4,11
\\6,0
\\6,12
\\4,1
\\0,13
\\10,12
\\3,4
\\3,0
\\8,4
\\1,10
\\2,14
\\8,10
\\9,0
\\
\\fold along y=7
\\fold along x=5
\\
;
const Axis = enum { x, y };
const Point = struct { x: int, y: int };
const Fold = struct { axis: Axis, value: int };
pub fn main() !void {
var points: []Point = undefined;
var folds: []Fold = undefined;
{
var lines = split(u8, data, "\n");
// Read in the points
var pointsl = List(Point).init(gpa);
defer pointsl.deinit();
while (lines.next()) |line| {
if (line.len == 0) { break; }
var parts = tokenize(u8, line, ",\r");
const a = parts.next().?;
const b = parts.next().?;
assert(parts.next() == null);
try pointsl.append(.{
.x = parseInt(int, a, 10) catch unreachable,
.y = parseInt(int, b, 10) catch unreachable,
});
}
points = pointsl.toOwnedSlice();
// Read in the folds
var foldsl = List(Fold).init(gpa);
defer foldsl.deinit();
while (lines.next()) |line| {
if (line.len == 0) { continue; }
var parts = tokenize(u8, line, "fold ang=\r"); // let tokenize eat the english
const axis = parts.next().?;
const dist = parts.next().?;
assert(parts.next() == null);
try foldsl.append(.{
.axis = parseEnum(Axis, axis) orelse unreachable,
.value = parseInt(int, dist, 10) catch unreachable,
});
}
folds = foldsl.toOwnedSlice();
}
// Do the folds and track page size
var part1: usize = 0;
var width: usize = 0;
var height: usize = 0;
for (folds) |fold, i| {
// Fold each point
for (points) |*point| {
switch (fold.axis) {
.x => {
point.x = fold.value - (std.math.absInt(point.x - fold.value) catch unreachable);
width = @intCast(usize, fold.value + 1);
},
.y => {
point.y = fold.value - (std.math.absInt(point.y - fold.value) catch unreachable);
height = @intCast(usize, fold.value + 1);
},
}
}
// Calculate part 1 after the first fold
if (i == 0) {
var set = Map(Point, void).init(gpa);
defer set.deinit();
try set.ensureUnusedCapacity(@intCast(u32, points.len));
for (points) |p| {
set.putAssumeCapacity(p, {});
}
part1 = set.count();
}
}
// Allocate a scanout buffer and initialize it as blank lines
const pixel_width = 2;
const pitch = width * pixel_width + 1;
const buf = try gpa.alloc(u8, pitch * height);
defer gpa.free(buf);
{
std.mem.set(u8, buf, ' ');
var y: usize = 0;
while (y < height) : (y += 1) {
buf[y*pitch + (pitch-1)] = '\n';
}
}
// Mark all the points
for (points) |p| {
const x = @intCast(usize, p.x);
const y = @intCast(usize, p.y);
assert(x < width);
assert(y < height);
const idx = y * pitch + x * pixel_width;
buf[idx..][0..pixel_width].* = ("#" ** pixel_width).*;
}
print("part1={}, part2=\n{s}\n", .{part1, buf});
}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
const lastIndexOf = std.mem.lastIndexOfScalar;
const lastIndexOfAny = std.mem.lastIndexOfAny;
const lastIndexOfStr = std.mem.lastIndexOfLinear;
const trim = std.mem.trim;
const sliceMin = std.mem.min;
const sliceMax = std.mem.max;
const eql = std.mem.eql;
const parseEnum = std.meta.stringToEnum;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const asc = std.sort.asc;
const desc = std.sort.desc; | src/day13.zig |
const std = @import("std");
const Self = @This();
fn root() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
}
const root_path = root() ++ "/";
pub const include_dir = root_path ++ "include";
pub const Library = struct {
step: *std.build.LibExeObjStep,
pub fn link(self: Library, other: *std.build.LibExeObjStep) void {
other.addIncludeDir(include_dir);
other.linkLibrary(self.step);
}
};
pub fn create(b: *std.build.Builder, target: std.zig.CrossTarget, mode: std.builtin.Mode) Library {
const ret = b.addStaticLibrary("mp3lame", null);
ret.setTarget(target);
ret.setBuildMode(mode);
ret.linkLibC();
ret.addIncludeDir(include_dir);
ret.addIncludeDir(root_path ++ "lame/lame");
ret.addIncludeDir(root_path ++ "lame/mpglib");
ret.addIncludeDir(root_path ++ "lame/libmp3lame");
ret.addIncludeDir(root_path ++ "lame/include");
ret.addIncludeDir(root_path ++ "config");
ret.addCSourceFiles(&.{
root_path ++ "lame/libmp3lame/VbrTag.c",
root_path ++ "lame/libmp3lame/bitstream.c",
root_path ++ "lame/libmp3lame/encoder.c",
root_path ++ "lame/libmp3lame/fft.c",
root_path ++ "lame/libmp3lame/gain_analysis.c",
root_path ++ "lame/libmp3lame/id3tag.c",
root_path ++ "lame/libmp3lame/lame.c",
root_path ++ "lame/libmp3lame/mpglib_interface.c",
root_path ++ "lame/libmp3lame/newmdct.c",
root_path ++ "lame/libmp3lame/presets.c",
root_path ++ "lame/libmp3lame/psymodel.c",
root_path ++ "lame/libmp3lame/quantize.c",
root_path ++ "lame/libmp3lame/quantize_pvt.c",
root_path ++ "lame/libmp3lame/reservoir.c",
root_path ++ "lame/libmp3lame/set_get.c",
root_path ++ "lame/libmp3lame/tables.c",
root_path ++ "lame/libmp3lame/takehiro.c",
root_path ++ "lame/libmp3lame/util.c",
root_path ++ "lame/libmp3lame/vbrquantize.c",
root_path ++ "lame/libmp3lame/vector/xmm_quantize_sub.c",
root_path ++ "lame/libmp3lame/version.c",
root_path ++ "lame/mpglib/common.c",
root_path ++ "lame/mpglib/dct64_i386.c",
root_path ++ "lame/mpglib/decode_i386.c",
root_path ++ "lame/mpglib/interface.c",
root_path ++ "lame/mpglib/layer1.c",
root_path ++ "lame/mpglib/layer2.c",
root_path ++ "lame/mpglib/layer3.c",
root_path ++ "lame/mpglib/tabinit.c",
}, &.{
"-DHAVE_CONFIG_H",
});
// Define if SSE intrinsics work.
if (target.getCpuArch() == .x86_64)
ret.defineCMacro("HAVE_XMMINTRIN_H", "1");
return Library{ .step = ret };
} | lame.zig |
const std = @import("std");
const assert = std.debug.assert;
const Framebuffer = @import("Framebuffer.zig");
const zp = @import("../../zplay.zig");
const sdl = zp.deps.sdl;
const gl = zp.deps.gl;
const Self = @This();
pub const Api = enum {
opengl,
vulkan,
metal,
};
pub const Capability = enum(c_uint) {
blend = gl.GL_BLEND,
color_logic_op = gl.GL_COLOR_LOGIC_OP,
cull_face = gl.GL_CULL_FACE,
depth_clamp = gl.GL_DEPTH_CLAMP,
depth_test = gl.GL_DEPTH_TEST,
dither = gl.GL_DITHER,
framebuffer_srgb = gl.GL_FRAMEBUFFER_SRGB,
line_smooth = gl.GL_LINE_SMOOTH,
multisample = gl.GL_MULTISAMPLE,
polygon_offset_fill = gl.GL_POLYGON_OFFSET_FILL,
polygon_offset_line = gl.GL_POLYGON_OFFSET_LINE,
polygon_offset_point = gl.GL_POLYGON_OFFSET_POINT,
polygon_smooth = gl.GL_POLYGON_SMOOTH,
primitive_restart = gl.GL_PRIMITIVE_RESTART,
rasterizer_discard = gl.GL_RASTERIZER_DISCARD,
sample_alpha_to_coverage = gl.GL_SAMPLE_ALPHA_TO_COVERAGE,
sample_alpha_to_one = gl.GL_SAMPLE_ALPHA_TO_ONE,
sample_coverage = gl.GL_SAMPLE_COVERAGE,
sample_mask = gl.GL_SAMPLE_MASK,
scissor_test = gl.GL_SCISSOR_TEST,
stencil_test = gl.GL_STENCIL_TEST,
texture_cube_map_seamless = gl.GL_TEXTURE_CUBE_MAP_SEAMLESS,
program_point_size = gl.GL_PROGRAM_POINT_SIZE,
};
pub const PolygonMode = enum(c_uint) {
fill = gl.GL_FILL,
line = gl.GL_LINE,
};
pub const TestFunc = enum(c_uint) {
always = gl.GL_ALWAYS, // The test always passes.
never = gl.GL_NEVER, // The test never passes.
less = gl.GL_LESS, // Passes if the fragment's value is less than the stored value.
equal = gl.GL_EQUAL, // Passes if the fragment's value is equal to the stored value.
less_or_equal = gl.GL_LEQUAL, // Passes if the fragment's value is less than or equal to the stored value.
greater = gl.GL_GREATER, // Passes if the fragment's value is greater than the stored value.
not_equal = gl.GL_NOTEQUAL, // Passes if the fragment's value is not equal to the stored value.
greater_or_equal = gl.GL_GEQUAL, // Passes if the fragment's value is greater than or equal to the stored value.
};
pub const StencilOp = enum(c_uint) {
keep = gl.GL_KEEP, // The currently stored stencil value is kept.
zero = gl.GL_ZERO, // The stencil value is set to 0.
replace = gl.GL_REPLACE, // The stencil value is replaced with the reference value set with glStencilFunc.
incr = gl.GL_INCR, // The stencil value is increased by 1 if it is lower than the maximum value.
incr_wrap = gl.GL_INCR_WRAP, // Same as GL_INCR, but wraps it back to 0 as soon as the maximum value is exceeded.
decr = gl.GL_DECR, // The stencil value is decreased by 1 if it is higher than the minimum value.
decr_wrap = gl.GL_DECR_WRAP, // Same as GL_DECR, but wraps it to the maximum value if it ends up lower than 0.
invert = gl.GL_INVERT, // Bitwise inverts the current stencil buffer value.
};
pub const BlendFactor = enum(c_uint) {
zero = gl.GL_ZERO, // Factor is equal to 0.
one = gl.GL_ONE, // Factor is equal to 1.
src_color = gl.GL_SRC_COLOR, // Factor is equal to the source color vector C¯source.
one_minus_src_color = gl.GL_ONE_MINUS_SRC_COLOR, // Factor is equal to 1 minus the source color vector: 1−C¯source.
dst_color = gl.GL_DST_COLOR, // Factor is equal to the destination color vector C¯destination
one_minus_dst_color = gl.GL_ONE_MINUS_DST_COLOR, // Factor is equal to 1 minus the destination color vector: 1−C¯destination.
src_alpha = gl.GL_SRC_ALPHA, // Factor is equal to the alpha component of the source color vector C¯source.
one_minus_src_alpha = gl.GL_ONE_MINUS_SRC_ALPHA, // Factor is equal to 1−alpha of the source color vector C¯source.
dst_alpha = gl.GL_DST_ALPHA, // Factor is equal to the alpha component of the destination color vector C¯destination.
one_minus_dst_alpha = gl.GL_ONE_MINUS_DST_ALPHA, // Factor is equal to 1−alpha of the destination color vector C¯destination.
constant_color = gl.GL_CONSTANT_COLOR, // Factor is equal to the constant color vector C¯constant.
one_minus_constant_color = gl.GL_ONE_MINUS_CONSTANT_COLOR, // Factor is equal to 1 - the constant color vector C¯constant.
constant_alpha = gl.GL_CONSTANT_ALPHA, // Factor is equal to the alpha component of the constant color vector C¯constant.
one_minus_constant_alpha = gl.GL_ONE_MINUS_CONSTANT_ALPHA, // Factor is equal to 1−alpha of the constant color vector C¯constant.
};
pub const BlendEquation = enum(c_uint) {
add = gl.GL_FUNC_ADD, // the default, adds both colors to each other: C¯result=Src+Dst.
sub = gl.GL_FUNC_SUBTRACT, // subtracts both colors from each other: C¯result=Src−Dst.
rev_sub = gl.GL_FUNC_REVERSE_SUBTRACT, // subtracts both colors, but reverses order: C¯result=Dst−Src.
min = gl.GL_MIN, // takes the component-wise minimum of both colors: C¯result=min(Dst,Src).
max = gl.GL_MAX, // takes the component-wise maximum of both colors: C¯result=max(Dst,Src).
};
pub const CullFace = enum(c_uint) {
back = gl.GL_BACK, // Culls only the back faces.
front = gl.GL_FRONT, // Culls only the front faces.
front_and_back = gl.GL_FRONT_AND_BACK, // Culls both the front and back faces.
};
pub const FrontFace = enum(c_uint) {
ccw = gl.GL_CCW, // counter-clockwise ordering
cw = gl.GL_CW, // clockwise ordering
};
/// opengl context
gl_ctx: sdl.gl.Context,
/// vsync switch
vsync: bool = undefined,
/// current color
color: [4]f32 = .{ 0, 0, 0, 1 },
/// line width
line_width: f32 = 1,
/// current polygon mode
polygon_mode: PolygonMode = undefined,
/// current depth option
depth_option: DepthOption = undefined,
/// current stencil option
stencil_option: StencilOption = undefined,
/// current blend option
blend_option: BlendOption = undefined,
/// current culling option
culling_option: CullingOption = undefined,
/// prepare graphics api
pub fn prepare(g: zp.Game) !void {
assert(g.graphics_api == .opengl); // only opengl for now
if (sdl.c.SDL_GL_SetAttribute(sdl.c.SDL_GL_CONTEXT_MAJOR_VERSION, 3) != 0) {
return sdl.makeError();
}
if (sdl.c.SDL_GL_SetAttribute(sdl.c.SDL_GL_CONTEXT_MINOR_VERSION, 3) != 0) {
return sdl.makeError();
}
if (sdl.c.SDL_GL_SetAttribute(sdl.c.SDL_GL_STENCIL_SIZE, 1) != 0) {
return sdl.makeError();
}
if (g.enable_msaa) {
if (sdl.c.SDL_GL_SetAttribute(sdl.c.SDL_GL_MULTISAMPLEBUFFERS, 1) != 0) {
return sdl.makeError();
}
if (sdl.c.SDL_GL_SetAttribute(sdl.c.SDL_GL_MULTISAMPLESAMPLES, 4) != 0) {
return sdl.makeError();
}
}
if (g.enable_highres_depth) {
if (sdl.c.SDL_GL_SetAttribute(sdl.c.SDL_GL_DEPTH_SIZE, 32) != 0) {
return sdl.makeError();
}
} else {
if (sdl.c.SDL_GL_SetAttribute(sdl.c.SDL_GL_DEPTH_SIZE, 24) != 0) {
return sdl.makeError();
}
}
}
/// allocate graphics context
pub fn init(window: sdl.Window, api: Api) !Self {
assert(api == .opengl); // only opengl for now
const gl_ctx = try sdl.gl.createContext(window);
try sdl.gl.makeCurrent(gl_ctx, window);
if (gl.gladLoadGL() == 0) {
@panic("load opengl functions failed!");
}
var self = Self{
.gl_ctx = gl_ctx,
};
self.setPolygonMode(.fill);
self.setDepthOption(.{});
self.setStencilOption(.{});
self.setBlendOption(.{});
self.setCullingOption(.{});
return self;
}
/// delete graphics context
pub fn deinit(self: Self) void {
sdl.gl.deleteContext(self.gl_ctx);
}
/// swap buffer, rendering take effect here
pub fn swap(self: Self, window: sdl.Window) void {
_ = self;
sdl.gl.swapWindow(window);
}
/// get size of drawable place
pub fn getDrawableSize(self: Self, window: sdl.Window, w: *u32, h: *u32) void {
_ = self;
sdl.c.SDL_GL_GetDrawableSize(
window.ptr,
@ptrCast(*c_int, w),
@ptrCast(*c_int, h),
);
}
/// set vsync mode
pub fn setVsyncMode(self: *Self, on_off: bool) void {
_ = self;
sdl.gl.setSwapInterval(
if (on_off) .vsync else .immediate,
) catch |e| {
std.debug.print("toggle vsync failed, {}", .{e});
std.debug.print("using mode: {s}", .{
if (sdl.c.SDL_GL_GetSwapInterval() == 1) "immediate" else "vsync ",
});
};
self.vsync = on_off;
}
/// clear buffers
pub fn clear(
self: *Self,
clear_color: bool,
clear_depth: bool,
clear_stencil: bool,
color: ?[4]f32,
) void {
_ = self;
var clear_flags: c_uint = 0;
if (clear_color) {
clear_flags |= gl.GL_COLOR_BUFFER_BIT;
}
if (clear_depth) {
clear_flags |= gl.GL_DEPTH_BUFFER_BIT;
}
if (clear_stencil) {
clear_flags |= gl.GL_STENCIL_BUFFER_BIT;
}
if (color) |rgba| {
gl.clearColor(rgba[0], rgba[1], rgba[2], rgba[3]);
self.color = rgba;
}
gl.clear(clear_flags);
gl.util.checkError();
}
/// change viewport
pub fn setViewport(self: Self, x: u32, y: u32, width: u32, height: u32) void {
_ = self;
gl.viewport(
@intCast(c_int, x),
@intCast(c_int, y),
@intCast(c_int, width),
@intCast(c_int, height),
);
gl.util.checkError();
}
/// toggle capability
pub fn toggleCapability(self: Self, cap: Capability, on_off: bool) void {
_ = self;
if (on_off) {
gl.enable(@enumToInt(cap));
} else {
gl.disable(@enumToInt(cap));
}
gl.util.checkError();
}
/// check capability' s status
pub fn isCapabilityEnabled(self: Self, cap: Capability) bool {
_ = self;
return gl.isEnabled(@enumToInt(cap)) == gl.GL_TRUE;
}
/// set line width
pub fn setLineWidth(self: *Self, w: f32) void {
self.line_width = w;
gl.lineWidth(w);
gl.util.checkError();
}
/// set polygon mode
pub fn setPolygonMode(self: *Self, mode: PolygonMode) void {
_ = self;
gl.polygonMode(gl.GL_FRONT_AND_BACK, @enumToInt(mode));
self.polygon_mode = mode;
gl.util.checkError();
}
/// set depth options
pub const DepthOption = struct {
test_func: TestFunc = .less, // test function determines whether fragment is accepted
update_switch: ?bool = null, // false means depth buffer won't be updated during rendering
};
pub fn setDepthOption(self: *Self, option: DepthOption) void {
_ = self;
gl.depthFunc(@enumToInt(option.test_func));
if (option.update_switch) |s| {
gl.depthMask(gl.util.boolType(s));
}
self.depth_option = option;
gl.util.checkError();
}
/// set stencil options
pub const StencilOption = struct {
action_sfail: StencilOp = .keep, // action to take if the stencil test fails.
action_dpfail: StencilOp = .keep, // action to take if the stencil test passes, but the depth test fails.
action_dppass: StencilOp = .keep, // action to take if both the stencil and the depth test pass.
test_func: ?TestFunc = null, // stencil test function that determines whether a fragment passes or is discarded.
test_ref: u8 = 0, // the reference value for the stencil test. The stencil buffer's content is compared to this value.
test_mask: ?u8 = null, // ANDed with both the reference value and the stored stencil value before the test compares them.
write_mask: ?u8 = null, // bitmask that is ANDed with the stencil value about to be written to the buffer.
};
pub fn setStencilOption(self: *Self, option: StencilOption) void {
_ = self;
gl.stencilOp(
@enumToInt(option.action_sfail),
@enumToInt(option.action_dpfail),
@enumToInt(option.action_dppass),
);
if (option.test_func) |func| {
gl.stencilFunc(
@enumToInt(func),
@intCast(gl.GLint, option.test_ref),
@intCast(gl.GLuint, option.test_mask orelse 0xff),
);
}
if (option.write_mask) |mask| {
gl.stencilMask(@intCast(gl.GLuint, mask));
}
self.stencil_option = option;
gl.util.checkError();
}
/// set color blending options
pub const BlendOption = struct {
src_rgb: BlendFactor = .src_alpha, // blend factors for rgb
dst_rgb: BlendFactor = .one_minus_src_alpha,
src_alpha: BlendFactor = .one, // blend factors for alpha
dst_alpha: BlendFactor = .zero,
constant_color: ?[4]f32 = null, // constant blend color
equation: ?BlendEquation = null, // blend equation
};
pub fn setBlendOption(self: *Self, option: BlendOption) void {
_ = self;
gl.blendFuncSeparate(
@enumToInt(option.src_rgb),
@enumToInt(option.dst_rgb),
@enumToInt(option.src_alpha),
@enumToInt(option.dst_alpha),
);
if (option.constant_color) |color| {
gl.blendColor(color[0], color[1], color[2], color[3]);
}
if (option.equation) |eq| {
gl.blendEquation(@enumToInt(eq));
}
self.blend_option = option;
gl.util.checkError();
}
/// set face culling options
pub const CullingOption = struct {
face: CullFace = .back,
front: ?FrontFace = null,
};
pub fn setCullingOption(self: *Self, option: CullingOption) void {
_ = self;
gl.cullFace(@enumToInt(option.face));
if (option.front) |f| {
gl.frontFace(@enumToInt(f));
}
self.culling_option = option;
gl.util.checkError();
}
/// enable a framebuffer, use system-allocated by default
pub fn useFramebuffer(self: Self, framebuffer: ?Framebuffer) void {
_ = self;
gl.bindFramebuffer(
gl.GL_FRAMEBUFFER,
if (framebuffer) |fb| fb.id else 0,
);
gl.util.checkError();
} | src/graphics/common/Context.zig |
const std = @import("std");
const gemtext = @import("../gemtext.zig");
const Fragment = gemtext.Fragment;
const line_ending = "\r\n";
fn fmtRtfText(
data: []const u8,
comptime fmt: []const u8,
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
_ = fmt;
_ = options;
const illegal = "\\{}";
const replacement = [_][]const u8{
"\\\\",
"\\{",
"\\}",
};
var last_offset: usize = 0;
for (data) |c, index| {
if (std.mem.indexOf(u8, illegal, &[1]u8{c})) |i| {
if (index > last_offset) {
try writer.writeAll(data[last_offset..index]);
}
last_offset = index + 1;
try writer.writeAll(replacement[i]);
}
}
if (data.len > last_offset) {
try writer.writeAll(data[last_offset..]);
}
}
pub fn fmtRtf(slice: []const u8) std.fmt.Formatter(fmtRtfText) {
return .{ .data = slice };
}
pub const header = "{\\rtf1\\ansi{\\fonttbl{\\f0\\fswiss}{\\f1\\fmodern Courier New{\\*\\falt Monospace};}}" ++ line_ending;
pub const footer = "}" ++ line_ending;
/// Renders a sequence of fragments into a rich text document.
/// `fragments` is a slice of fragments which describe the document,
/// `writer` is a `std.io.Writer` structure that will be the target of the document rendering.
/// The document will be rendered with CR LF line endings.
pub fn render(fragments: []const Fragment, writer: anytype) !void {
for (fragments) |fragment| {
switch (fragment) {
.empty => try writer.writeAll("{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\par}" ++ line_ending),
.paragraph => |paragraph| try writer.print("{{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 {}\\par}}" ++ line_ending, .{fmtRtf(paragraph)}),
.preformatted => |preformatted| {
try writer.writeAll("{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\f1 ");
for (preformatted.text.lines) |line, i| {
if (i > 0)
try writer.writeAll("\\line " ++ line_ending);
try writer.print("{}", .{fmtRtf(line)});
}
try writer.writeAll("\\par}" ++ line_ending);
},
.quote => |quote| {
try writer.writeAll("{\\pard \\ql \\f0 \\sa180 \\li720 \\fi0 ");
for (quote.lines) |line, i| {
if (i > 0)
try writer.writeAll("\\line " ++ line_ending);
try writer.print("{}", .{fmtRtf(line)});
}
try writer.writeAll("\\par}" ++ line_ending);
},
.link => |link| {
try writer.writeAll("{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 {\\field{\\*\\fldinst{HYPERLINK \"");
try writer.print("{}", .{fmtRtf(link.href)});
try writer.writeAll("\"}}{\\fldrslt{\\ul ");
if (link.title) |title| {
try writer.print("{}", .{fmtRtf(title)});
} else {
try writer.print("{}", .{fmtRtf(link.href)});
}
try writer.writeAll("}}}\\par}" ++ line_ending);
},
.list => |list| for (list.lines) |line, i| {
try writer.writeAll("{\\pard \\ql \\f0 \\sa0 \\li360 \\fi-360 \\bullet \\tx360\\tab ");
try writer.print("{}", .{fmtRtf(line)});
if (i == list.lines.len - 1) {
try writer.writeAll("\\sa180\\par}" ++ line_ending);
} else {
try writer.writeAll("\\par}" ++ line_ending);
}
},
.heading => |heading| {
switch (heading.level) {
.h1 => try writer.print("{{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs36 {}\\par}}" ++ line_ending, .{fmtRtf(heading.text)}),
.h2 => try writer.print("{{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs32 {}\\par}}" ++ line_ending, .{fmtRtf(heading.text)}),
.h3 => try writer.print("{{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs28 {}\\par}}" ++ line_ending, .{fmtRtf(heading.text)}),
}
},
}
}
} | src/renderers/rtf.zig |
const std = @import("std");
const wren = @import("wren");
pub var alloc = std.testing.allocator;
// This is basically all the separate example programs squished together into
// one file so they can be ran all at once.
// See the other Zig files in example/ for cleaner examples.
// This will be a foreign class in Wren
pub const Point = struct {
size:f64 = 0,
pub fn setSize (vm:?*wren.VM) void {
// Get the Wren class handle which holds our Zig instance memory
if(wren.getSlotForeign(vm, 0)) |ptr| {
// Convert slot 0 memory back into the Zig class
var point = wren.foreign.castDataPtr(Point,ptr);
// Get the argument
var nsize:f64 = wren.getSlotAuto(vm,f64,1);
std.debug.print(" [+] Setting point to: {d}\n",.{nsize});
// Error checking
if(nsize < 1.0) {
// Error handling, put error msg back in slot 0 and abort the fiber
wren.setSlotAuto(vm,0,"That is way too small!");
wren.abortFiber(vm, 0);
return;
}
// Otherwise set the value
point.*.size = nsize;
std.debug.print(" [+] Point is now: {d}\n",.{nsize});
}
}
};
// A pair of allocate and finalize functions to keep Wren and Zig in sync
// when using the Point class above.
// Allocate is called on Wren creation and finalize on Wren destruction.
pub fn pointAllocate(vm:?*wren.VM) void {
std.debug.print(" [+] ALLOC Point\n",.{});
// Tell Wren how many bytes we need for the Zig class instance
var ptr:?*c_void = wren.setSlotNewForeign(vm, 0, 0, @sizeOf(Point));
// Get the parameter given to the class constructor in Wren
var size_param:f64 = wren.getSlotAuto(vm, f64, 1);
// Get a typed pointer to the Wren-allocated
var pt_ptr = wren.foreign.castDataPtr(Point, ptr);
// Create the Zig class instance into the Wren memory location,
// applying the passed value to keep them in sync
pt_ptr.* = Point { .size = size_param };
std.debug.print(" [+] ALLOC Point Done\n",.{});
}
pub fn pointFinalize(data:?*c_void) void {
_=data;
std.debug.print(" [+] Finalize Point\n",.{});
// Do whatever cleanup is needed here, deinits etc
}
// A function we will call from Wren
pub fn mathAdd (vm:?*wren.VM) void {
var a:f64 = wren.getSlotAuto(vm, f64, 1);
var b:f64 = wren.getSlotAuto(vm, f64, 2);
wren.setSlotDouble(vm, 0, a + b);
}
// A slightly different function we will call from Wren
pub fn mathAddSec (vm:?*wren.VM) void {
var a:f64 = wren.getSlotAuto(vm, f64, 1);
var b:f64 = wren.getSlotAuto(vm, f64, 2);
wren.setSlotAuto(vm, 0, a + b + b + a);
}
fn testBasic (vm:?*wren.VM) !void {
// Interpret code in the "main" module
std.debug.print("\n=== Basic Test ===\n",.{});
try wren.util.run(vm,"main",
\\ System.print("Hello from Wren!")
\\ System.print("Testing line 2!")
);
}
fn testSyntaxError (vm:?*wren.VM) !void {
// Interpret known-bad code
std.debug.print("\n=== Have an Error ===\n",.{});
wren.util.run(vm,"main",
\\ System.print("Hello from error!)
\\ System.prit("Ohno!")
) catch |err| {
std.debug.print("THIS IS FINE - {s}\n",.{err});
};
}
fn testForeign (vm:?*wren.VM) !void {
// Register our foreign methods
try wren.foreign.registerMethod(vm,"main","Math","add(_,_)",true,mathAdd);
// Try calling Zig code from Wren code
std.debug.print("\n=== Calling Zig from Wren ===\n",.{});
try wren.util.run(vm,"main",
\\ class Math {
\\ foreign static add(a, b)
\\ }
\\ System.print(Math.add(3,5))
);
// Register our foreign class and method
try wren.foreign.registerClass(vm,"main","Point",pointAllocate,pointFinalize);
try wren.foreign.registerMethod(vm,"main","Point","setSize(_)",false,Point.setSize);
// Foreign classes in Wren defined in Zig
std.debug.print("\n=== Using foreign classes ===\n",.{});
wren.util.run(vm,"main",
\\ foreign class Point {
\\ construct create(size) {}
\\
\\ foreign setSize(size)
\\ }
\\ var point = Point.create(20)
\\ point.setSize(40)
\\ point.setSize(0)
) catch |err| {
std.debug.print("THIS IS FINE TOO - {s}\n",.{err});
};
}
fn testValuePassing (vm:?*wren.VM) !void {
// Try calling Wren code from Zig code
std.debug.print("\n=== Calling Wren from Zig ===\n",.{});
try wren.util.run(vm,"main",
\\ class TestClass {
\\ static doubleUp(num) {
\\ return num + num
\\ }
\\ static text(txt) {
\\ return txt + "return"
\\ }
\\ static splat(val,count) {
\\ return [val] * count
\\ }
\\ static addArray(arr) {
\\ return arr[0] + arr[1]
\\ }
\\ static addStr(str1,str2) {
\\ return [str1,str2]
\\ }
\\ static fArr(flot,inte) {
\\ return [flot] * inte
\\ }
\\ static notMe(iambool) {
\\ return !iambool
\\ }
\\ static blah(farr) {
\\ return farr + farr
\\ }
\\ static tup(vtup,vint) {
\\ return vtup[1] + vint
\\ }
\\ static fmap(imap) {
\\ imap["Add1"] = "Wren"
\\ imap["Add2"] = "Wren"
\\ return imap
\\ }
\\ }
);
var needs_adding:usize = 41;
std.debug.print("Before Call: {}\n",.{needs_adding});
// (module, class, method sig, arg types tuple, return type)
var wm = try wren.MethodCallHandle("main","TestClass","doubleUp(_)",.{usize},usize).init(vm);
defer wm.deinit();
needs_adding = try wm.callMethod(.{needs_adding});
std.debug.print("Int->Int: {}\n",.{needs_adding});
var wm2 = try wren.MethodCallHandle("main","TestClass","text(_)",.{[]const u8},[]const u8).init(vm);
defer wm2.deinit();
var ostr = try wm2.callMethod(.{"Input "});
std.debug.print("String->String: {s}\n",.{ostr});
var wm3 = try wren.MethodCallHandle("main","TestClass","splat(_,_)",.{i32,i32},[]i32).init(vm);
defer wm3.deinit();
var oslc = try wm3.callMethod(.{3,5});
std.debug.print("IntArray->Slice: {any}\n",.{oslc});
var wm4 = try wren.MethodCallHandle("main","TestClass","addArray(_)",.{[]u32},i32).init(vm);
defer wm4.deinit();
var oarr = try wm4.callMethod(.{ .{3,5} });
std.debug.print("IntSlice->Int: {any}\n",.{oarr});
var wm5 = try wren.MethodCallHandle("main","TestClass","addStr(_,_)",.{[]const u8,[]const u8},[]const []const u8).init(vm);
defer wm5.deinit();
var oast = try wm5.callMethod(.{"abc","def"});
std.debug.print("String->StringSlice: {s}\n",.{oast});
var wm6 = try wren.MethodCallHandle("main","TestClass","fArr(_,_)",.{f32,i32},[]f32).init(vm);
defer wm6.deinit();
var ofsp = try wm6.callMethod(.{2.34,5});
std.debug.print("Float,Int->FloatSlice: {any}\n",.{ofsp});
var wm7 = try wren.MethodCallHandle("main","TestClass","notMe(_)",.{bool},bool).init(vm);
defer wm7.deinit();
var oboo = try wm7.callMethod(.{false});
std.debug.print("Bool->Bool: {any}\n",.{oboo});
var wm8 = try wren.MethodCallHandle("main","TestClass","blah(_)",.{[]f32},[]f32).init(vm);
defer wm8.deinit();
var obla = try wm8.callMethod(.{ .{2.34,2.34} });
std.debug.print("FloatSlice->FloatSlice: {any}\n",.{obla});
var wm9 = try wren.MethodCallHandle("main","TestClass","tup(_,_)",.{ std.meta.Tuple(&[_]type{[]const u8,i32}),i32 },i32).init(vm);
defer wm9.deinit();
var otup = try wm9.callMethod(.{ .{"poo",3}, 39 });
std.debug.print("Str,Int Tuple->Int: {any}\n",.{otup});
var wm10 = try wren.MethodCallHandle("main","TestClass","fmap(_)",.{ std.StringHashMap([]const u8) },std.StringHashMap([]const u8)).init(vm);
defer wm10.deinit();
var nmap = std.StringHashMap([]const u8).init(std.testing.allocator);
defer nmap.deinit();
nmap.put("Init1","Zig") catch unreachable;
nmap.put("Init2","Zig") catch unreachable;
var omap = try wm10.callMethod(.{ nmap });
std.debug.print("SMap->Map: \n",.{});
var it = omap.iterator();
while(it.next()) |entry| {
std.debug.print(" >> {s}: {s}\n",.{entry.key_ptr.*,entry.value_ptr.*});
}
}
fn testImports (vm:?*wren.VM) !void {
// Test importing a separate Wren code file
std.debug.print("\n=== Imports ===\n",.{});
try wren.util.run(vm,"main",
\\ System.print("start import")
\\ import "example/test"
\\ System.print("end import")
);
}
fn testOptionalModules (vm:?*wren.VM) !void {
// Test the optional 'Meta' module
std.debug.print("\n=== Meta module ===\n",.{});
try wren.util.run(vm,"main",
\\ import "meta" for Meta
\\
\\ var a = 2
\\ var b = 3
\\ var source = """
\\ var c = a * b
\\ System.print(c)
\\ """
\\ Meta.eval(source)
);
// Test the optional 'Random' module
std.debug.print("\n=== Random module ===\n",.{});
try wren.util.run(vm,"main",
\\ import "random" for Random
\\
\\ var random = Random.new(12345)
\\
\\ var below = 0
\\ for (i in 1..1000) {
\\ var n = random.int()
\\ if (n < 2147483648) below = below + 1
\\ }
\\
\\ System.print(below > 450) // expect: true
\\ System.print(below < 550) // expect: true
);
}
fn testMultiVm (vm:?*wren.VM) !void {
// Using additional VMs
var config:wren.Configuration = undefined;
wren.util.initDefaultConfig(&config);
var vm2 = wren.newVM(&config);
defer wren.freeVM(vm2);
// Same module, name, and signature, different VM and Zig function
try wren.foreign.registerMethod(vm2,"main","Math","add(_,_)",true,mathAddSec);
std.debug.print("\n=== Two VMs with different backing methods ===\n",.{});
// Original, already defined
try wren.util.run(vm,"main",
\\ System.print(Math.add(3,5))
);
// New, same Wren def but different Zig binding
try wren.util.run(vm2,"main",
\\ class Math {
\\ foreign static add(a, b)
\\ }
\\ System.print(Math.add(3,5))
);
}
pub fn main() anyerror!void {
std.debug.print("Version Major: {}\n",.{wren.version.major});
std.debug.print("Version Minor: {}\n",.{wren.version.minor});
std.debug.print("Version Patch: {}\n",.{wren.version.patch});
std.debug.print("Version String: {s}\n",.{wren.version.string});
std.debug.print("Version Number: {d}\n",.{wren.version.number});
// Initialize the data structures for the wrapper
wren.init(alloc);
defer wren.deinit();
// Set up a VM configuration using the supplied default bindings
var config = wren.util.defaultConfig();
// Create a new VM from our config we generated previously
const vm = wren.newVM(&config);
defer wren.freeVM(vm);
// Run all of our examples
std.debug.print("\n>>>>>> Starting Examples <<<<<<\n",.{});
try testBasic(vm);
try testSyntaxError(vm);
try testForeign(vm);
try testValuePassing(vm);
try testImports(vm);
try testOptionalModules(vm);
try testMultiVm(vm);
std.debug.print("\n>>>>>> Examples Done <<<<<<\n",.{});
// deferred wren.deinit unloads the VMs,
// this runs finalize on Zig-bound classes
} | example/everything.zig |
pub const DMUS_MAX_DESCRIPTION = @as(u32, 128);
pub const DMUS_MAX_DRIVER = @as(u32, 128);
pub const DMUS_EFFECT_NONE = @as(u32, 0);
pub const DMUS_EFFECT_REVERB = @as(u32, 1);
pub const DMUS_EFFECT_CHORUS = @as(u32, 2);
pub const DMUS_EFFECT_DELAY = @as(u32, 4);
pub const DMUS_PC_INPUTCLASS = @as(u32, 0);
pub const DMUS_PC_OUTPUTCLASS = @as(u32, 1);
pub const DMUS_PC_DLS = @as(u32, 1);
pub const DMUS_PC_EXTERNAL = @as(u32, 2);
pub const DMUS_PC_SOFTWARESYNTH = @as(u32, 4);
pub const DMUS_PC_MEMORYSIZEFIXED = @as(u32, 8);
pub const DMUS_PC_GMINHARDWARE = @as(u32, 16);
pub const DMUS_PC_GSINHARDWARE = @as(u32, 32);
pub const DMUS_PC_XGINHARDWARE = @as(u32, 64);
pub const DMUS_PC_DIRECTSOUND = @as(u32, 128);
pub const DMUS_PC_SHAREABLE = @as(u32, 256);
pub const DMUS_PC_DLS2 = @as(u32, 512);
pub const DMUS_PC_AUDIOPATH = @as(u32, 1024);
pub const DMUS_PC_WAVE = @as(u32, 2048);
pub const DMUS_PC_SYSTEMMEMORY = @as(u32, 2147483647);
pub const DMUS_PORT_WINMM_DRIVER = @as(u32, 0);
pub const DMUS_PORT_USER_MODE_SYNTH = @as(u32, 1);
pub const DMUS_PORT_KERNEL_MODE = @as(u32, 2);
pub const DMUS_PORTPARAMS_VOICES = @as(u32, 1);
pub const DMUS_PORTPARAMS_CHANNELGROUPS = @as(u32, 2);
pub const DMUS_PORTPARAMS_AUDIOCHANNELS = @as(u32, 4);
pub const DMUS_PORTPARAMS_SAMPLERATE = @as(u32, 8);
pub const DMUS_PORTPARAMS_EFFECTS = @as(u32, 32);
pub const DMUS_PORTPARAMS_SHARE = @as(u32, 64);
pub const DMUS_PORTPARAMS_FEATURES = @as(u32, 128);
pub const DMUS_PORT_FEATURE_AUDIOPATH = @as(u32, 1);
pub const DMUS_PORT_FEATURE_STREAMING = @as(u32, 2);
pub const DMUS_SYNTHSTATS_VOICES = @as(u32, 1);
pub const DMUS_SYNTHSTATS_TOTAL_CPU = @as(u32, 2);
pub const DMUS_SYNTHSTATS_CPU_PER_VOICE = @as(u32, 4);
pub const DMUS_SYNTHSTATS_LOST_NOTES = @as(u32, 8);
pub const DMUS_SYNTHSTATS_PEAK_VOLUME = @as(u32, 16);
pub const DMUS_SYNTHSTATS_FREE_MEMORY = @as(u32, 32);
pub const DMUS_CLOCKF_GLOBAL = @as(u32, 1);
pub const DSBUSID_FIRST_SPKR_LOC = @as(u32, 0);
pub const DSBUSID_FRONT_LEFT = @as(u32, 0);
pub const DSBUSID_LEFT = @as(u32, 0);
pub const DSBUSID_FRONT_RIGHT = @as(u32, 1);
pub const DSBUSID_RIGHT = @as(u32, 1);
pub const DSBUSID_FRONT_CENTER = @as(u32, 2);
pub const DSBUSID_LOW_FREQUENCY = @as(u32, 3);
pub const DSBUSID_BACK_LEFT = @as(u32, 4);
pub const DSBUSID_BACK_RIGHT = @as(u32, 5);
pub const DSBUSID_FRONT_LEFT_OF_CENTER = @as(u32, 6);
pub const DSBUSID_FRONT_RIGHT_OF_CENTER = @as(u32, 7);
pub const DSBUSID_BACK_CENTER = @as(u32, 8);
pub const DSBUSID_SIDE_LEFT = @as(u32, 9);
pub const DSBUSID_SIDE_RIGHT = @as(u32, 10);
pub const DSBUSID_TOP_CENTER = @as(u32, 11);
pub const DSBUSID_TOP_FRONT_LEFT = @as(u32, 12);
pub const DSBUSID_TOP_FRONT_CENTER = @as(u32, 13);
pub const DSBUSID_TOP_FRONT_RIGHT = @as(u32, 14);
pub const DSBUSID_TOP_BACK_LEFT = @as(u32, 15);
pub const DSBUSID_TOP_BACK_CENTER = @as(u32, 16);
pub const DSBUSID_TOP_BACK_RIGHT = @as(u32, 17);
pub const DSBUSID_LAST_SPKR_LOC = @as(u32, 17);
pub const DSBUSID_REVERB_SEND = @as(u32, 64);
pub const DSBUSID_CHORUS_SEND = @as(u32, 65);
pub const DSBUSID_DYNAMIC_0 = @as(u32, 512);
pub const DSBUSID_NULL = @as(u32, 4294967295);
pub const DAUD_CRITICAL_VOICE_PRIORITY = @as(u32, 4026531840);
pub const DAUD_HIGH_VOICE_PRIORITY = @as(u32, 3221225472);
pub const DAUD_STANDARD_VOICE_PRIORITY = @as(u32, 2147483648);
pub const DAUD_LOW_VOICE_PRIORITY = @as(u32, 1073741824);
pub const DAUD_PERSIST_VOICE_PRIORITY = @as(u32, 268435456);
pub const DAUD_CHAN1_VOICE_PRIORITY_OFFSET = @as(u32, 14);
pub const DAUD_CHAN2_VOICE_PRIORITY_OFFSET = @as(u32, 13);
pub const DAUD_CHAN3_VOICE_PRIORITY_OFFSET = @as(u32, 12);
pub const DAUD_CHAN4_VOICE_PRIORITY_OFFSET = @as(u32, 11);
pub const DAUD_CHAN5_VOICE_PRIORITY_OFFSET = @as(u32, 10);
pub const DAUD_CHAN6_VOICE_PRIORITY_OFFSET = @as(u32, 9);
pub const DAUD_CHAN7_VOICE_PRIORITY_OFFSET = @as(u32, 8);
pub const DAUD_CHAN8_VOICE_PRIORITY_OFFSET = @as(u32, 7);
pub const DAUD_CHAN9_VOICE_PRIORITY_OFFSET = @as(u32, 6);
pub const DAUD_CHAN10_VOICE_PRIORITY_OFFSET = @as(u32, 15);
pub const DAUD_CHAN11_VOICE_PRIORITY_OFFSET = @as(u32, 5);
pub const DAUD_CHAN12_VOICE_PRIORITY_OFFSET = @as(u32, 4);
pub const DAUD_CHAN13_VOICE_PRIORITY_OFFSET = @as(u32, 3);
pub const DAUD_CHAN14_VOICE_PRIORITY_OFFSET = @as(u32, 2);
pub const DAUD_CHAN15_VOICE_PRIORITY_OFFSET = @as(u32, 1);
pub const DAUD_CHAN16_VOICE_PRIORITY_OFFSET = @as(u32, 0);
pub const CLSID_DirectMusic = Guid.initString("636b9f10-0c7d-11d1-95b2-0020afdc7421");
pub const CLSID_DirectMusicCollection = Guid.initString("480ff4b0-28b2-11d1-bef7-00c04fbf8fef");
pub const CLSID_DirectMusicSynth = Guid.initString("58c2b4d0-46e7-11d1-89ac-00a0c9054129");
pub const GUID_DMUS_PROP_GM_Hardware = Guid.initString("178f2f24-c364-11d1-a760-0000f875ac12");
pub const GUID_DMUS_PROP_GS_Hardware = Guid.initString("178f2f25-c364-11d1-a760-0000f875ac12");
pub const GUID_DMUS_PROP_XG_Hardware = Guid.initString("178f2f26-c364-11d1-a760-0000f875ac12");
pub const GUID_DMUS_PROP_XG_Capable = Guid.initString("6496aba1-61b0-11d2-afa6-00aa0024d8b6");
pub const GUID_DMUS_PROP_GS_Capable = Guid.initString("6496aba2-61b0-11d2-afa6-00aa0024d8b6");
pub const GUID_DMUS_PROP_DLS1 = Guid.initString("178f2f27-c364-11d1-a760-0000f875ac12");
pub const GUID_DMUS_PROP_DLS2 = Guid.initString("f14599e5-4689-11d2-afa6-00aa0024d8b6");
pub const GUID_DMUS_PROP_INSTRUMENT2 = Guid.initString("865fd372-9f67-11d2-872a-00600893b1bd");
pub const GUID_DMUS_PROP_SynthSink_DSOUND = Guid.initString("0aa97844-c877-11d1-870c-00600893b1bd");
pub const GUID_DMUS_PROP_SynthSink_WAVE = Guid.initString("0aa97845-c877-11d1-870c-00600893b1bd");
pub const GUID_DMUS_PROP_SampleMemorySize = Guid.initString("178f2f28-c364-11d1-a760-0000f875ac12");
pub const GUID_DMUS_PROP_SamplePlaybackRate = Guid.initString("2a91f713-a4bf-11d2-bbdf-00600833dbd8");
pub const GUID_DMUS_PROP_WriteLatency = Guid.initString("268a0fa0-60f2-11d2-afa6-00aa0024d8b6");
pub const GUID_DMUS_PROP_WritePeriod = Guid.initString("268a0fa1-60f2-11d2-afa6-00aa0024d8b6");
pub const GUID_DMUS_PROP_MemorySize = Guid.initString("178f2f28-c364-11d1-a760-0000f875ac12");
pub const GUID_DMUS_PROP_WavesReverb = Guid.initString("04cb5622-32e5-11d2-afa6-00aa0024d8b6");
pub const GUID_DMUS_PROP_Effects = Guid.initString("cda8d611-684a-11d2-871e-00600893b1bd");
pub const GUID_DMUS_PROP_LegacyCaps = Guid.initString("cfa7cdc2-00a1-11d2-aad5-0000f875ac12");
pub const GUID_DMUS_PROP_Volume = Guid.initString("fedfae25-e46e-11d1-aace-0000f875ac12");
pub const DMUS_VOLUME_MAX = @as(u32, 2000);
pub const DMUS_VOLUME_MIN = @as(i32, -20000);
pub const DMUS_EVENT_STRUCTURED = @as(u32, 1);
pub const DIRECTSOUND_VERSION = @as(u32, 1792);
pub const _FACDS = @as(u32, 2168);
pub const CLSID_DirectSound = Guid.initString("47d4d946-62e8-11cf-93bc-444553540000");
pub const CLSID_DirectSound8 = Guid.initString("3901cc3f-84b5-4fa4-ba35-aa8172b8a09b");
pub const CLSID_DirectSoundCapture = Guid.initString("b0210780-89cd-11d0-af08-00a0c925cd16");
pub const CLSID_DirectSoundCapture8 = Guid.initString("e4bcac13-7f99-4908-9a8e-74e3bf24b6e1");
pub const CLSID_DirectSoundFullDuplex = Guid.initString("fea4300c-7959-4147-b26a-2377b9e7a91d");
pub const DSDEVID_DefaultPlayback = Guid.initString("def00000-9c6d-47ed-aaf1-4dda8f2b5c03");
pub const DSDEVID_DefaultCapture = Guid.initString("def00001-9c6d-47ed-aaf1-4dda8f2b5c03");
pub const DSDEVID_DefaultVoicePlayback = Guid.initString("def00002-9c6d-47ed-aaf1-4dda8f2b5c03");
pub const DSDEVID_DefaultVoiceCapture = Guid.initString("def00003-9c6d-47ed-aaf1-4dda8f2b5c03");
pub const GUID_All_Objects = Guid.initString("aa114de5-c262-4169-a1c8-23d698cc73b5");
pub const KSPROPERTY_SUPPORT_GET = @as(u32, 1);
pub const KSPROPERTY_SUPPORT_SET = @as(u32, 2);
pub const DSFXGARGLE_WAVE_TRIANGLE = @as(u32, 0);
pub const DSFXGARGLE_WAVE_SQUARE = @as(u32, 1);
pub const DSFXGARGLE_RATEHZ_MIN = @as(u32, 1);
pub const DSFXGARGLE_RATEHZ_MAX = @as(u32, 1000);
pub const DSFXCHORUS_WAVE_TRIANGLE = @as(u32, 0);
pub const DSFXCHORUS_WAVE_SIN = @as(u32, 1);
pub const DSFXCHORUS_WETDRYMIX_MIN = @as(f32, 0);
pub const DSFXCHORUS_WETDRYMIX_MAX = @as(f32, 100);
pub const DSFXCHORUS_DEPTH_MIN = @as(f32, 0);
pub const DSFXCHORUS_DEPTH_MAX = @as(f32, 100);
pub const DSFXCHORUS_FEEDBACK_MIN = @as(f32, -99);
pub const DSFXCHORUS_FEEDBACK_MAX = @as(f32, 99);
pub const DSFXCHORUS_FREQUENCY_MIN = @as(f32, 0);
pub const DSFXCHORUS_FREQUENCY_MAX = @as(f32, 10);
pub const DSFXCHORUS_DELAY_MIN = @as(f32, 0);
pub const DSFXCHORUS_DELAY_MAX = @as(f32, 20);
pub const DSFXCHORUS_PHASE_MIN = @as(u32, 0);
pub const DSFXCHORUS_PHASE_MAX = @as(u32, 4);
pub const DSFXCHORUS_PHASE_NEG_180 = @as(u32, 0);
pub const DSFXCHORUS_PHASE_NEG_90 = @as(u32, 1);
pub const DSFXCHORUS_PHASE_ZERO = @as(u32, 2);
pub const DSFXCHORUS_PHASE_90 = @as(u32, 3);
pub const DSFXCHORUS_PHASE_180 = @as(u32, 4);
pub const DSFXFLANGER_WAVE_TRIANGLE = @as(u32, 0);
pub const DSFXFLANGER_WAVE_SIN = @as(u32, 1);
pub const DSFXFLANGER_WETDRYMIX_MIN = @as(f32, 0);
pub const DSFXFLANGER_WETDRYMIX_MAX = @as(f32, 100);
pub const DSFXFLANGER_FREQUENCY_MIN = @as(f32, 0);
pub const DSFXFLANGER_FREQUENCY_MAX = @as(f32, 10);
pub const DSFXFLANGER_DEPTH_MIN = @as(f32, 0);
pub const DSFXFLANGER_DEPTH_MAX = @as(f32, 100);
pub const DSFXFLANGER_PHASE_MIN = @as(u32, 0);
pub const DSFXFLANGER_PHASE_MAX = @as(u32, 4);
pub const DSFXFLANGER_FEEDBACK_MIN = @as(f32, -99);
pub const DSFXFLANGER_FEEDBACK_MAX = @as(f32, 99);
pub const DSFXFLANGER_DELAY_MIN = @as(f32, 0);
pub const DSFXFLANGER_DELAY_MAX = @as(f32, 4);
pub const DSFXFLANGER_PHASE_NEG_180 = @as(u32, 0);
pub const DSFXFLANGER_PHASE_NEG_90 = @as(u32, 1);
pub const DSFXFLANGER_PHASE_ZERO = @as(u32, 2);
pub const DSFXFLANGER_PHASE_90 = @as(u32, 3);
pub const DSFXFLANGER_PHASE_180 = @as(u32, 4);
pub const DSFXECHO_WETDRYMIX_MIN = @as(f32, 0);
pub const DSFXECHO_WETDRYMIX_MAX = @as(f32, 100);
pub const DSFXECHO_FEEDBACK_MIN = @as(f32, 0);
pub const DSFXECHO_FEEDBACK_MAX = @as(f32, 100);
pub const DSFXECHO_LEFTDELAY_MIN = @as(f32, 1);
pub const DSFXECHO_LEFTDELAY_MAX = @as(f32, 2000);
pub const DSFXECHO_RIGHTDELAY_MIN = @as(f32, 1);
pub const DSFXECHO_RIGHTDELAY_MAX = @as(f32, 2000);
pub const DSFXECHO_PANDELAY_MIN = @as(u32, 0);
pub const DSFXECHO_PANDELAY_MAX = @as(u32, 1);
pub const DSFXDISTORTION_GAIN_MIN = @as(f32, -60);
pub const DSFXDISTORTION_GAIN_MAX = @as(f32, 0);
pub const DSFXDISTORTION_EDGE_MIN = @as(f32, 0);
pub const DSFXDISTORTION_EDGE_MAX = @as(f32, 100);
pub const DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN = @as(f32, 100);
pub const DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX = @as(f32, 8000);
pub const DSFXDISTORTION_POSTEQBANDWIDTH_MIN = @as(f32, 100);
pub const DSFXDISTORTION_POSTEQBANDWIDTH_MAX = @as(f32, 8000);
pub const DSFXDISTORTION_PRELOWPASSCUTOFF_MIN = @as(f32, 100);
pub const DSFXDISTORTION_PRELOWPASSCUTOFF_MAX = @as(f32, 8000);
pub const DSFXCOMPRESSOR_GAIN_MIN = @as(f32, -60);
pub const DSFXCOMPRESSOR_GAIN_MAX = @as(f32, 60);
pub const DSFXCOMPRESSOR_ATTACK_MIN = @as(f32, 1.0e-02);
pub const DSFXCOMPRESSOR_ATTACK_MAX = @as(f32, 500);
pub const DSFXCOMPRESSOR_RELEASE_MIN = @as(f32, 50);
pub const DSFXCOMPRESSOR_RELEASE_MAX = @as(f32, 3000);
pub const DSFXCOMPRESSOR_THRESHOLD_MIN = @as(f32, -60);
pub const DSFXCOMPRESSOR_THRESHOLD_MAX = @as(f32, 0);
pub const DSFXCOMPRESSOR_RATIO_MIN = @as(f32, 1);
pub const DSFXCOMPRESSOR_RATIO_MAX = @as(f32, 100);
pub const DSFXCOMPRESSOR_PREDELAY_MIN = @as(f32, 0);
pub const DSFXCOMPRESSOR_PREDELAY_MAX = @as(f32, 4);
pub const DSFXPARAMEQ_CENTER_MIN = @as(f32, 80);
pub const DSFXPARAMEQ_CENTER_MAX = @as(f32, 16000);
pub const DSFXPARAMEQ_BANDWIDTH_MIN = @as(f32, 1);
pub const DSFXPARAMEQ_BANDWIDTH_MAX = @as(f32, 36);
pub const DSFXPARAMEQ_GAIN_MIN = @as(f32, -15);
pub const DSFXPARAMEQ_GAIN_MAX = @as(f32, 15);
pub const DSFX_I3DL2REVERB_ROOM_MIN = @as(i32, -10000);
pub const DSFX_I3DL2REVERB_ROOM_MAX = @as(u32, 0);
pub const DSFX_I3DL2REVERB_ROOM_DEFAULT = @as(i32, -1000);
pub const DSFX_I3DL2REVERB_ROOMHF_MIN = @as(i32, -10000);
pub const DSFX_I3DL2REVERB_ROOMHF_MAX = @as(u32, 0);
pub const DSFX_I3DL2REVERB_ROOMHF_DEFAULT = @as(i32, -100);
pub const DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN = @as(f32, 0);
pub const DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX = @as(f32, 10);
pub const DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT = @as(f32, 0);
pub const DSFX_I3DL2REVERB_DECAYTIME_MIN = @as(f32, 1.0e-01);
pub const DSFX_I3DL2REVERB_DECAYTIME_MAX = @as(f32, 20);
pub const DSFX_I3DL2REVERB_DECAYTIME_DEFAULT = @as(f32, 1.49e+00);
pub const DSFX_I3DL2REVERB_DECAYHFRATIO_MIN = @as(f32, 1.0e-01);
pub const DSFX_I3DL2REVERB_DECAYHFRATIO_MAX = @as(f32, 2);
pub const DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT = @as(f32, 8.3e-01);
pub const DSFX_I3DL2REVERB_REFLECTIONS_MIN = @as(i32, -10000);
pub const DSFX_I3DL2REVERB_REFLECTIONS_MAX = @as(u32, 1000);
pub const DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT = @as(i32, -2602);
pub const DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN = @as(f32, 0);
pub const DSFX_I3DL2REVERB_REFLECTIONSDELAY_MAX = @as(f32, 3.0e-01);
pub const DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT = @as(f32, 7.0e-03);
pub const DSFX_I3DL2REVERB_REVERB_MIN = @as(i32, -10000);
pub const DSFX_I3DL2REVERB_REVERB_MAX = @as(u32, 2000);
pub const DSFX_I3DL2REVERB_REVERB_DEFAULT = @as(u32, 200);
pub const DSFX_I3DL2REVERB_REVERBDELAY_MIN = @as(f32, 0);
pub const DSFX_I3DL2REVERB_REVERBDELAY_MAX = @as(f32, 1.0e-01);
pub const DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT = @as(f32, 1.1e-02);
pub const DSFX_I3DL2REVERB_DIFFUSION_MIN = @as(f32, 0);
pub const DSFX_I3DL2REVERB_DIFFUSION_MAX = @as(f32, 100);
pub const DSFX_I3DL2REVERB_DIFFUSION_DEFAULT = @as(f32, 100);
pub const DSFX_I3DL2REVERB_DENSITY_MIN = @as(f32, 0);
pub const DSFX_I3DL2REVERB_DENSITY_MAX = @as(f32, 100);
pub const DSFX_I3DL2REVERB_DENSITY_DEFAULT = @as(f32, 100);
pub const DSFX_I3DL2REVERB_HFREFERENCE_MIN = @as(f32, 20);
pub const DSFX_I3DL2REVERB_HFREFERENCE_MAX = @as(f32, 20000);
pub const DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT = @as(f32, 5000);
pub const DSFX_I3DL2REVERB_QUALITY_MIN = @as(u32, 0);
pub const DSFX_I3DL2REVERB_QUALITY_MAX = @as(u32, 3);
pub const DSFX_I3DL2REVERB_QUALITY_DEFAULT = @as(u32, 2);
pub const DSFX_WAVESREVERB_INGAIN_MIN = @as(f32, -96);
pub const DSFX_WAVESREVERB_INGAIN_MAX = @as(f32, 0);
pub const DSFX_WAVESREVERB_INGAIN_DEFAULT = @as(f32, 0);
pub const DSFX_WAVESREVERB_REVERBMIX_MIN = @as(f32, -96);
pub const DSFX_WAVESREVERB_REVERBMIX_MAX = @as(f32, 0);
pub const DSFX_WAVESREVERB_REVERBMIX_DEFAULT = @as(f32, 0);
pub const DSFX_WAVESREVERB_REVERBTIME_MIN = @as(f32, 1.0e-03);
pub const DSFX_WAVESREVERB_REVERBTIME_MAX = @as(f32, 3000);
pub const DSFX_WAVESREVERB_REVERBTIME_DEFAULT = @as(f32, 1000);
pub const DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN = @as(f32, 1.0e-03);
pub const DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX = @as(f32, 9.99e-01);
pub const DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT = @as(f32, 1.0e-03);
pub const DSCFX_AEC_MODE_PASS_THROUGH = @as(u32, 0);
pub const DSCFX_AEC_MODE_HALF_DUPLEX = @as(u32, 1);
pub const DSCFX_AEC_MODE_FULL_DUPLEX = @as(u32, 2);
pub const DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED = @as(u32, 0);
pub const DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED = @as(u32, 1);
pub const DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED = @as(u32, 2);
pub const DSCFX_AEC_STATUS_CURRENTLY_CONVERGED = @as(u32, 8);
pub const DS_NO_VIRTUALIZATION = @import("../../zig.zig").typedConst(HRESULT, @as(i32, 142082058));
pub const DSCAPS_PRIMARYMONO = @as(u32, 1);
pub const DSCAPS_PRIMARYSTEREO = @as(u32, 2);
pub const DSCAPS_PRIMARY8BIT = @as(u32, 4);
pub const DSCAPS_PRIMARY16BIT = @as(u32, 8);
pub const DSCAPS_CONTINUOUSRATE = @as(u32, 16);
pub const DSCAPS_EMULDRIVER = @as(u32, 32);
pub const DSCAPS_CERTIFIED = @as(u32, 64);
pub const DSCAPS_SECONDARYMONO = @as(u32, 256);
pub const DSCAPS_SECONDARYSTEREO = @as(u32, 512);
pub const DSCAPS_SECONDARY8BIT = @as(u32, 1024);
pub const DSCAPS_SECONDARY16BIT = @as(u32, 2048);
pub const DSSCL_NORMAL = @as(u32, 1);
pub const DSSCL_PRIORITY = @as(u32, 2);
pub const DSSCL_EXCLUSIVE = @as(u32, 3);
pub const DSSCL_WRITEPRIMARY = @as(u32, 4);
pub const DSSPEAKER_DIRECTOUT = @as(u32, 0);
pub const DSSPEAKER_HEADPHONE = @as(u32, 1);
pub const DSSPEAKER_MONO = @as(u32, 2);
pub const DSSPEAKER_QUAD = @as(u32, 3);
pub const DSSPEAKER_STEREO = @as(u32, 4);
pub const DSSPEAKER_SURROUND = @as(u32, 5);
pub const DSSPEAKER_5POINT1 = @as(u32, 6);
pub const DSSPEAKER_7POINT1 = @as(u32, 7);
pub const DSSPEAKER_7POINT1_SURROUND = @as(u32, 8);
pub const DSSPEAKER_5POINT1_SURROUND = @as(u32, 9);
pub const DSSPEAKER_GEOMETRY_MIN = @as(u32, 5);
pub const DSSPEAKER_GEOMETRY_NARROW = @as(u32, 10);
pub const DSSPEAKER_GEOMETRY_WIDE = @as(u32, 20);
pub const DSSPEAKER_GEOMETRY_MAX = @as(u32, 180);
pub const DSBCAPS_PRIMARYBUFFER = @as(u32, 1);
pub const DSBCAPS_STATIC = @as(u32, 2);
pub const DSBCAPS_LOCHARDWARE = @as(u32, 4);
pub const DSBCAPS_LOCSOFTWARE = @as(u32, 8);
pub const DSBCAPS_CTRL3D = @as(u32, 16);
pub const DSBCAPS_CTRLFREQUENCY = @as(u32, 32);
pub const DSBCAPS_CTRLPAN = @as(u32, 64);
pub const DSBCAPS_CTRLVOLUME = @as(u32, 128);
pub const DSBCAPS_CTRLPOSITIONNOTIFY = @as(u32, 256);
pub const DSBCAPS_CTRLFX = @as(u32, 512);
pub const DSBCAPS_STICKYFOCUS = @as(u32, 16384);
pub const DSBCAPS_GLOBALFOCUS = @as(u32, 32768);
pub const DSBCAPS_GETCURRENTPOSITION2 = @as(u32, 65536);
pub const DSBCAPS_MUTE3DATMAXDISTANCE = @as(u32, 131072);
pub const DSBCAPS_LOCDEFER = @as(u32, 262144);
pub const DSBCAPS_TRUEPLAYPOSITION = @as(u32, 524288);
pub const DSBPLAY_LOOPING = @as(u32, 1);
pub const DSBPLAY_LOCHARDWARE = @as(u32, 2);
pub const DSBPLAY_LOCSOFTWARE = @as(u32, 4);
pub const DSBPLAY_TERMINATEBY_TIME = @as(u32, 8);
pub const DSBPLAY_TERMINATEBY_DISTANCE = @as(u64, 16);
pub const DSBPLAY_TERMINATEBY_PRIORITY = @as(u64, 32);
pub const DSBSTATUS_PLAYING = @as(u32, 1);
pub const DSBSTATUS_BUFFERLOST = @as(u32, 2);
pub const DSBSTATUS_LOOPING = @as(u32, 4);
pub const DSBSTATUS_LOCHARDWARE = @as(u32, 8);
pub const DSBSTATUS_LOCSOFTWARE = @as(u32, 16);
pub const DSBSTATUS_TERMINATED = @as(u32, 32);
pub const DSBLOCK_FROMWRITECURSOR = @as(u32, 1);
pub const DSBLOCK_ENTIREBUFFER = @as(u32, 2);
pub const DSBFREQUENCY_ORIGINAL = @as(u32, 0);
pub const DSBFREQUENCY_MIN = @as(u32, 100);
pub const DSBFREQUENCY_MAX = @as(u32, 200000);
pub const DSBPAN_LEFT = @as(i32, -10000);
pub const DSBPAN_CENTER = @as(u32, 0);
pub const DSBPAN_RIGHT = @as(u32, 10000);
pub const DSBVOLUME_MIN = @as(i32, -10000);
pub const DSBVOLUME_MAX = @as(u32, 0);
pub const DSBSIZE_MIN = @as(u32, 4);
pub const DSBSIZE_MAX = @as(u32, 268435455);
pub const DSBSIZE_FX_MIN = @as(u32, 150);
pub const DSBNOTIFICATIONS_MAX = @as(u32, 100000);
pub const DS3DMODE_NORMAL = @as(u32, 0);
pub const DS3DMODE_HEADRELATIVE = @as(u32, 1);
pub const DS3DMODE_DISABLE = @as(u32, 2);
pub const DS3D_IMMEDIATE = @as(u32, 0);
pub const DS3D_DEFERRED = @as(u32, 1);
pub const DS3D_DEFAULTDISTANCEFACTOR = @as(f32, 1);
pub const DS3D_MINROLLOFFFACTOR = @as(f32, 0);
pub const DS3D_MAXROLLOFFFACTOR = @as(f32, 10);
pub const DS3D_DEFAULTROLLOFFFACTOR = @as(f32, 1);
pub const DS3D_MINDOPPLERFACTOR = @as(f32, 0);
pub const DS3D_MAXDOPPLERFACTOR = @as(f32, 10);
pub const DS3D_DEFAULTDOPPLERFACTOR = @as(f32, 1);
pub const DS3D_DEFAULTMINDISTANCE = @as(f32, 1);
pub const DS3D_DEFAULTMAXDISTANCE = @as(f32, 1.0e+09);
pub const DS3D_MINCONEANGLE = @as(u32, 0);
pub const DS3D_MAXCONEANGLE = @as(u32, 360);
pub const DS3D_DEFAULTCONEANGLE = @as(u32, 360);
pub const DSCCAPS_MULTIPLECAPTURE = @as(u32, 1);
pub const DSCBCAPS_WAVEMAPPED = @as(u32, 2147483648);
pub const DSCBCAPS_CTRLFX = @as(u32, 512);
pub const DSCBLOCK_ENTIREBUFFER = @as(u32, 1);
pub const DSCBSTATUS_CAPTURING = @as(u32, 1);
pub const DSCBSTATUS_LOOPING = @as(u32, 2);
pub const DSCBSTART_LOOPING = @as(u32, 1);
pub const DSBPN_OFFSETSTOP = @as(u32, 4294967295);
pub const DS_CERTIFIED = @as(u32, 0);
pub const DS_UNCERTIFIED = @as(u32, 1);
pub const DS3DALG_NO_VIRTUALIZATION = Guid.initString("c241333f-1c1b-11d2-94f5-00c04fc28aca");
pub const DS3DALG_HRTF_FULL = Guid.initString("c2413340-1c1b-11d2-94f5-00c04fc28aca");
pub const DS3DALG_HRTF_LIGHT = Guid.initString("c2413342-1c1b-11d2-94f5-00c04fc28aca");
pub const GUID_DSFX_STANDARD_GARGLE = Guid.initString("dafd8210-5711-4b91-9fe3-f75b7ae279bf");
pub const GUID_DSFX_STANDARD_CHORUS = Guid.initString("efe6629c-81f7-4281-bd91-c9d604a95af6");
pub const GUID_DSFX_STANDARD_FLANGER = Guid.initString("efca3d92-dfd8-4672-a603-7420894bad98");
pub const GUID_DSFX_STANDARD_ECHO = Guid.initString("ef3e932c-d40b-4f51-8ccf-3f98f1b29d5d");
pub const GUID_DSFX_STANDARD_DISTORTION = Guid.initString("ef114c90-cd1d-484e-96e5-09cfaf912a21");
pub const GUID_DSFX_STANDARD_COMPRESSOR = Guid.initString("ef011f79-4000-406d-87af-bffb3fc39d57");
pub const GUID_DSFX_STANDARD_PARAMEQ = Guid.initString("120ced89-3bf4-4173-a132-3cb406cf3231");
pub const GUID_DSFX_STANDARD_I3DL2REVERB = Guid.initString("ef985e71-d5c7-42d4-ba4d-2d073e2e96f4");
pub const GUID_DSFX_WAVES_REVERB = Guid.initString("87fc0268-9a55-4360-95aa-004a1d9de26c");
pub const GUID_DSCFX_CLASS_AEC = Guid.initString("bf963d80-c559-11d0-8a2b-00a0c9255ac1");
pub const GUID_DSCFX_MS_AEC = Guid.initString("cdebb919-379a-488a-8765-f53cfd36de40");
pub const GUID_DSCFX_SYSTEM_AEC = Guid.initString("1c22c56d-9879-4f5b-a389-27996ddc2810");
pub const GUID_DSCFX_CLASS_NS = Guid.initString("e07f903f-62fd-4e60-8cdd-dea7236665b5");
pub const GUID_DSCFX_MS_NS = Guid.initString("11c5c73b-66e9-4ba1-a0ba-e814c6eed92d");
pub const GUID_DSCFX_SYSTEM_NS = Guid.initString("5ab0882e-7274-4516-877d-4eee99ba4fd0");
pub const DMUS_DOWNLOADINFO_INSTRUMENT = @as(u32, 1);
pub const DMUS_DOWNLOADINFO_WAVE = @as(u32, 2);
pub const DMUS_DOWNLOADINFO_INSTRUMENT2 = @as(u32, 3);
pub const DMUS_DOWNLOADINFO_WAVEARTICULATION = @as(u32, 4);
pub const DMUS_DOWNLOADINFO_STREAMINGWAVE = @as(u32, 5);
pub const DMUS_DOWNLOADINFO_ONESHOTWAVE = @as(u32, 6);
pub const DMUS_DEFAULT_SIZE_OFFSETTABLE = @as(u32, 1);
pub const DMUS_INSTRUMENT_GM_INSTRUMENT = @as(u32, 1);
pub const DMUS_MIN_DATA_SIZE = @as(u32, 4);
pub const CONN_SRC_NONE = @as(u32, 0);
pub const CONN_SRC_LFO = @as(u32, 1);
pub const CONN_SRC_KEYONVELOCITY = @as(u32, 2);
pub const CONN_SRC_KEYNUMBER = @as(u32, 3);
pub const CONN_SRC_EG1 = @as(u32, 4);
pub const CONN_SRC_EG2 = @as(u32, 5);
pub const CONN_SRC_PITCHWHEEL = @as(u32, 6);
pub const CONN_SRC_CC1 = @as(u32, 129);
pub const CONN_SRC_CC7 = @as(u32, 135);
pub const CONN_SRC_CC10 = @as(u32, 138);
pub const CONN_SRC_CC11 = @as(u32, 139);
pub const CONN_DST_NONE = @as(u32, 0);
pub const CONN_DST_ATTENUATION = @as(u32, 1);
pub const CONN_DST_PITCH = @as(u32, 3);
pub const CONN_DST_PAN = @as(u32, 4);
pub const CONN_DST_LFO_FREQUENCY = @as(u32, 260);
pub const CONN_DST_LFO_STARTDELAY = @as(u32, 261);
pub const CONN_DST_EG1_ATTACKTIME = @as(u32, 518);
pub const CONN_DST_EG1_DECAYTIME = @as(u32, 519);
pub const CONN_DST_EG1_RELEASETIME = @as(u32, 521);
pub const CONN_DST_EG1_SUSTAINLEVEL = @as(u32, 522);
pub const CONN_DST_EG2_ATTACKTIME = @as(u32, 778);
pub const CONN_DST_EG2_DECAYTIME = @as(u32, 779);
pub const CONN_DST_EG2_RELEASETIME = @as(u32, 781);
pub const CONN_DST_EG2_SUSTAINLEVEL = @as(u32, 782);
pub const CONN_TRN_NONE = @as(u32, 0);
pub const CONN_TRN_CONCAVE = @as(u32, 1);
pub const F_INSTRUMENT_DRUMS = @as(u32, 2147483648);
pub const F_RGN_OPTION_SELFNONEXCLUSIVE = @as(u32, 1);
pub const WAVELINK_CHANNEL_LEFT = @as(i32, 1);
pub const WAVELINK_CHANNEL_RIGHT = @as(i32, 2);
pub const F_WAVELINK_PHASE_MASTER = @as(u32, 1);
pub const POOL_CUE_NULL = @as(i32, -1);
pub const F_WSMP_NO_TRUNCATION = @as(i32, 1);
pub const F_WSMP_NO_COMPRESSION = @as(i32, 2);
pub const WLOOP_TYPE_FORWARD = @as(u32, 0);
pub const APOERR_ALREADY_INITIALIZED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073919));
pub const APOERR_NOT_INITIALIZED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073918));
pub const APOERR_FORMAT_NOT_SUPPORTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073917));
pub const APOERR_INVALID_APO_CLSID = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073916));
pub const APOERR_BUFFERS_OVERLAP = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073915));
pub const APOERR_ALREADY_UNLOCKED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073914));
pub const APOERR_NUM_CONNECTIONS_INVALID = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073913));
pub const APOERR_INVALID_OUTPUT_MAXFRAMECOUNT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073912));
pub const APOERR_INVALID_CONNECTION_FORMAT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073911));
pub const APOERR_APO_LOCKED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073910));
pub const APOERR_INVALID_COEFFCOUNT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073909));
pub const APOERR_INVALID_COEFFICIENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073908));
pub const APOERR_INVALID_CURVE_PARAM = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073907));
pub const AUDIO_MIN_FRAMERATE = @as(f64, 10);
pub const AUDIO_MAX_FRAMERATE = @as(f64, 384000);
pub const AUDIO_MIN_CHANNELS = @as(u32, 1);
pub const AUDIO_MAX_CHANNELS = @as(u32, 4096);
pub const REFRESH_F_LASTBUFFER = @as(u32, 1);
pub const CLSID_DirectMusicSynthSink = Guid.initString("aec17ce3-a514-11d1-afa6-00aa0024d8b6");
pub const GUID_DMUS_PROP_SetSynthSink = Guid.initString("0a3a5ba5-37b6-11d2-b9f9-0000f875ac12");
pub const GUID_DMUS_PROP_SinkUsesDSound = Guid.initString("be208857-8952-11d2-ba1c-0000f875ac12");
pub const AUDIOMEDIATYPE_EQUAL_FORMAT_TYPES = @as(u32, 2);
pub const AUDIOMEDIATYPE_EQUAL_FORMAT_DATA = @as(u32, 4);
pub const AUDIOMEDIATYPE_EQUAL_FORMAT_USER_DATA = @as(u32, 8);
pub const DSFXR_PRESENT = @as(i32, 0);
pub const DSFXR_LOCHARDWARE = @as(i32, 1);
pub const DSFXR_LOCSOFTWARE = @as(i32, 2);
pub const DSFXR_UNALLOCATED = @as(i32, 3);
pub const DSFXR_FAILED = @as(i32, 4);
pub const DSFXR_UNKNOWN = @as(i32, 5);
pub const DSFXR_SENDLOOP = @as(i32, 6);
pub const DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW = @as(i32, 0);
pub const DSFX_I3DL2_MATERIAL_PRESET_DOUBLEWINDOW = @as(i32, 1);
pub const DSFX_I3DL2_MATERIAL_PRESET_THINDOOR = @as(i32, 2);
pub const DSFX_I3DL2_MATERIAL_PRESET_THICKDOOR = @as(i32, 3);
pub const DSFX_I3DL2_MATERIAL_PRESET_WOODWALL = @as(i32, 4);
pub const DSFX_I3DL2_MATERIAL_PRESET_BRICKWALL = @as(i32, 5);
pub const DSFX_I3DL2_MATERIAL_PRESET_STONEWALL = @as(i32, 6);
pub const DSFX_I3DL2_MATERIAL_PRESET_CURTAIN = @as(i32, 7);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_DEFAULT = @as(i32, 0);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_GENERIC = @as(i32, 1);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_PADDEDCELL = @as(i32, 2);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_ROOM = @as(i32, 3);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_BATHROOM = @as(i32, 4);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_LIVINGROOM = @as(i32, 5);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_STONEROOM = @as(i32, 6);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_AUDITORIUM = @as(i32, 7);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_CONCERTHALL = @as(i32, 8);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_CAVE = @as(i32, 9);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_ARENA = @as(i32, 10);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_HANGAR = @as(i32, 11);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY = @as(i32, 12);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_HALLWAY = @as(i32, 13);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR = @as(i32, 14);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_ALLEY = @as(i32, 15);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_FOREST = @as(i32, 16);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_CITY = @as(i32, 17);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_MOUNTAINS = @as(i32, 18);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_QUARRY = @as(i32, 19);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_PLAIN = @as(i32, 20);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_PARKINGLOT = @as(i32, 21);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_SEWERPIPE = @as(i32, 22);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_UNDERWATER = @as(i32, 23);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_SMALLROOM = @as(i32, 24);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM = @as(i32, 25);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEROOM = @as(i32, 26);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL = @as(i32, 27);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEHALL = @as(i32, 28);
pub const DSFX_I3DL2_ENVIRONMENT_PRESET_PLATE = @as(i32, 29);
//--------------------------------------------------------------------------------
// Section: Types (131)
//--------------------------------------------------------------------------------
pub const UNCOMPRESSEDAUDIOFORMAT = extern struct {
guidFormatType: Guid,
dwSamplesPerFrame: u32,
dwBytesPerSampleContainer: u32,
dwValidBitsPerSample: u32,
fFramesPerSecond: f32,
dwChannelMask: u32,
};
const IID_IAudioMediaType_Value = @import("../../zig.zig").Guid.initString("4e997f73-b71f-4798-873b-ed7dfcf15b4d");
pub const IID_IAudioMediaType = &IID_IAudioMediaType_Value;
pub const IAudioMediaType = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
IsCompressedFormat: fn(
self: *const IAudioMediaType,
pfCompressed: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsEqual: fn(
self: *const IAudioMediaType,
pIAudioType: ?*IAudioMediaType,
pdwFlags: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAudioFormat: fn(
self: *const IAudioMediaType,
) callconv(@import("std").os.windows.WINAPI) ?*WAVEFORMATEX,
GetUncompressedAudioFormat: fn(
self: *const IAudioMediaType,
pUncompressedAudioFormat: ?*UNCOMPRESSEDAUDIOFORMAT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioMediaType_IsCompressedFormat(self: *const T, pfCompressed: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioMediaType.VTable, self.vtable).IsCompressedFormat(@ptrCast(*const IAudioMediaType, self), pfCompressed);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioMediaType_IsEqual(self: *const T, pIAudioType: ?*IAudioMediaType, pdwFlags: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioMediaType.VTable, self.vtable).IsEqual(@ptrCast(*const IAudioMediaType, self), pIAudioType, pdwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioMediaType_GetAudioFormat(self: *const T) callconv(.Inline) ?*WAVEFORMATEX {
return @ptrCast(*const IAudioMediaType.VTable, self.vtable).GetAudioFormat(@ptrCast(*const IAudioMediaType, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioMediaType_GetUncompressedAudioFormat(self: *const T, pUncompressedAudioFormat: ?*UNCOMPRESSEDAUDIOFORMAT) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioMediaType.VTable, self.vtable).GetUncompressedAudioFormat(@ptrCast(*const IAudioMediaType, self), pUncompressedAudioFormat);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const APO_CONNECTION_BUFFER_TYPE = enum(i32) {
ALLOCATED = 0,
EXTERNAL = 1,
DEPENDANT = 2,
};
pub const APO_CONNECTION_BUFFER_TYPE_ALLOCATED = APO_CONNECTION_BUFFER_TYPE.ALLOCATED;
pub const APO_CONNECTION_BUFFER_TYPE_EXTERNAL = APO_CONNECTION_BUFFER_TYPE.EXTERNAL;
pub const APO_CONNECTION_BUFFER_TYPE_DEPENDANT = APO_CONNECTION_BUFFER_TYPE.DEPENDANT;
pub const APO_CONNECTION_DESCRIPTOR = extern struct {
Type: APO_CONNECTION_BUFFER_TYPE,
pBuffer: usize,
u32MaxFrameCount: u32,
pFormat: ?*IAudioMediaType,
u32Signature: u32,
};
pub const APO_FLAG = enum(i32) {
NONE = 0,
INPLACE = 1,
SAMPLESPERFRAME_MUST_MATCH = 2,
FRAMESPERSECOND_MUST_MATCH = 4,
BITSPERSAMPLE_MUST_MATCH = 8,
MIXER = 16,
DEFAULT = 14,
};
pub const APO_FLAG_NONE = APO_FLAG.NONE;
pub const APO_FLAG_INPLACE = APO_FLAG.INPLACE;
pub const APO_FLAG_SAMPLESPERFRAME_MUST_MATCH = APO_FLAG.SAMPLESPERFRAME_MUST_MATCH;
pub const APO_FLAG_FRAMESPERSECOND_MUST_MATCH = APO_FLAG.FRAMESPERSECOND_MUST_MATCH;
pub const APO_FLAG_BITSPERSAMPLE_MUST_MATCH = APO_FLAG.BITSPERSAMPLE_MUST_MATCH;
pub const APO_FLAG_MIXER = APO_FLAG.MIXER;
pub const APO_FLAG_DEFAULT = APO_FLAG.DEFAULT;
pub const APO_REG_PROPERTIES = extern struct {
clsid: Guid,
Flags: APO_FLAG,
szFriendlyName: [256]u16,
szCopyrightInfo: [256]u16,
u32MajorVersion: u32,
u32MinorVersion: u32,
u32MinInputConnections: u32,
u32MaxInputConnections: u32,
u32MinOutputConnections: u32,
u32MaxOutputConnections: u32,
u32MaxInstances: u32,
u32NumAPOInterfaces: u32,
iidAPOInterfaceList: [1]Guid,
};
pub const APOInitBaseStruct = extern struct {
cbSize: u32,
clsid: Guid,
};
pub const AUDIO_FLOW_TYPE = enum(i32) {
LL = 0,
SH = 1,
};
pub const AUDIO_FLOW_PULL = AUDIO_FLOW_TYPE.LL;
pub const AUDIO_FLOW_PUSH = AUDIO_FLOW_TYPE.SH;
pub const EAudioConstriction = enum(i32) {
Off = 0,
@"48_16" = 1,
@"44_16" = 2,
@"14_14" = 3,
Mute = 4,
};
pub const eAudioConstrictionOff = EAudioConstriction.Off;
pub const eAudioConstriction48_16 = EAudioConstriction.@"48_16";
pub const eAudioConstriction44_16 = EAudioConstriction.@"44_16";
pub const eAudioConstriction14_14 = EAudioConstriction.@"14_14";
pub const eAudioConstrictionMute = EAudioConstriction.Mute;
const IID_IAudioProcessingObjectRT_Value = @import("../../zig.zig").Guid.initString("9e1d6a6d-ddbc-4e95-a4c7-ad64ba37846c");
pub const IID_IAudioProcessingObjectRT = &IID_IAudioProcessingObjectRT_Value;
pub const IAudioProcessingObjectRT = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
APOProcess: fn(
self: *const IAudioProcessingObjectRT,
u32NumInputConnections: u32,
ppInputConnections: ?*?*APO_CONNECTION_PROPERTY,
u32NumOutputConnections: u32,
ppOutputConnections: ?*?*APO_CONNECTION_PROPERTY,
) callconv(@import("std").os.windows.WINAPI) void,
CalcInputFrames: fn(
self: *const IAudioProcessingObjectRT,
u32OutputFrameCount: u32,
) callconv(@import("std").os.windows.WINAPI) u32,
CalcOutputFrames: fn(
self: *const IAudioProcessingObjectRT,
u32InputFrameCount: u32,
) callconv(@import("std").os.windows.WINAPI) u32,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObjectRT_APOProcess(self: *const T, u32NumInputConnections: u32, ppInputConnections: ?*?*APO_CONNECTION_PROPERTY, u32NumOutputConnections: u32, ppOutputConnections: ?*?*APO_CONNECTION_PROPERTY) callconv(.Inline) void {
return @ptrCast(*const IAudioProcessingObjectRT.VTable, self.vtable).APOProcess(@ptrCast(*const IAudioProcessingObjectRT, self), u32NumInputConnections, ppInputConnections, u32NumOutputConnections, ppOutputConnections);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObjectRT_CalcInputFrames(self: *const T, u32OutputFrameCount: u32) callconv(.Inline) u32 {
return @ptrCast(*const IAudioProcessingObjectRT.VTable, self.vtable).CalcInputFrames(@ptrCast(*const IAudioProcessingObjectRT, self), u32OutputFrameCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObjectRT_CalcOutputFrames(self: *const T, u32InputFrameCount: u32) callconv(.Inline) u32 {
return @ptrCast(*const IAudioProcessingObjectRT.VTable, self.vtable).CalcOutputFrames(@ptrCast(*const IAudioProcessingObjectRT, self), u32InputFrameCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IAudioProcessingObjectVBR_Value = @import("../../zig.zig").Guid.initString("7ba1db8f-78ad-49cd-9591-f79d80a17c81");
pub const IID_IAudioProcessingObjectVBR = &IID_IAudioProcessingObjectVBR_Value;
pub const IAudioProcessingObjectVBR = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CalcMaxInputFrames: fn(
self: *const IAudioProcessingObjectVBR,
u32MaxOutputFrameCount: u32,
pu32InputFrameCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CalcMaxOutputFrames: fn(
self: *const IAudioProcessingObjectVBR,
u32MaxInputFrameCount: u32,
pu32OutputFrameCount: ?*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 IAudioProcessingObjectVBR_CalcMaxInputFrames(self: *const T, u32MaxOutputFrameCount: u32, pu32InputFrameCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObjectVBR.VTable, self.vtable).CalcMaxInputFrames(@ptrCast(*const IAudioProcessingObjectVBR, self), u32MaxOutputFrameCount, pu32InputFrameCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObjectVBR_CalcMaxOutputFrames(self: *const T, u32MaxInputFrameCount: u32, pu32OutputFrameCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObjectVBR.VTable, self.vtable).CalcMaxOutputFrames(@ptrCast(*const IAudioProcessingObjectVBR, self), u32MaxInputFrameCount, pu32OutputFrameCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IAudioProcessingObjectConfiguration_Value = @import("../../zig.zig").Guid.initString("0e5ed805-aba6-49c3-8f9a-2b8c889c4fa8");
pub const IID_IAudioProcessingObjectConfiguration = &IID_IAudioProcessingObjectConfiguration_Value;
pub const IAudioProcessingObjectConfiguration = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
LockForProcess: fn(
self: *const IAudioProcessingObjectConfiguration,
u32NumInputConnections: u32,
ppInputConnections: ?*?*APO_CONNECTION_DESCRIPTOR,
u32NumOutputConnections: u32,
ppOutputConnections: ?*?*APO_CONNECTION_DESCRIPTOR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnlockForProcess: fn(
self: *const IAudioProcessingObjectConfiguration,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObjectConfiguration_LockForProcess(self: *const T, u32NumInputConnections: u32, ppInputConnections: ?*?*APO_CONNECTION_DESCRIPTOR, u32NumOutputConnections: u32, ppOutputConnections: ?*?*APO_CONNECTION_DESCRIPTOR) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObjectConfiguration.VTable, self.vtable).LockForProcess(@ptrCast(*const IAudioProcessingObjectConfiguration, self), u32NumInputConnections, ppInputConnections, u32NumOutputConnections, ppOutputConnections);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObjectConfiguration_UnlockForProcess(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObjectConfiguration.VTable, self.vtable).UnlockForProcess(@ptrCast(*const IAudioProcessingObjectConfiguration, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IAudioProcessingObject_Value = @import("../../zig.zig").Guid.initString("fd7f2b29-24d0-4b5c-b177-592c39f9ca10");
pub const IID_IAudioProcessingObject = &IID_IAudioProcessingObject_Value;
pub const IAudioProcessingObject = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Reset: fn(
self: *const IAudioProcessingObject,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLatency: fn(
self: *const IAudioProcessingObject,
pTime: ?*i64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRegistrationProperties: fn(
self: *const IAudioProcessingObject,
ppRegProps: ?*?*APO_REG_PROPERTIES,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Initialize: fn(
self: *const IAudioProcessingObject,
cbDataSize: u32,
pbyData: [*:0]u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsInputFormatSupported: fn(
self: *const IAudioProcessingObject,
pOppositeFormat: ?*IAudioMediaType,
pRequestedInputFormat: ?*IAudioMediaType,
ppSupportedInputFormat: ?*?*IAudioMediaType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsOutputFormatSupported: fn(
self: *const IAudioProcessingObject,
pOppositeFormat: ?*IAudioMediaType,
pRequestedOutputFormat: ?*IAudioMediaType,
ppSupportedOutputFormat: ?*?*IAudioMediaType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetInputChannelCount: fn(
self: *const IAudioProcessingObject,
pu32ChannelCount: ?*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 IAudioProcessingObject_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObject.VTable, self.vtable).Reset(@ptrCast(*const IAudioProcessingObject, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObject_GetLatency(self: *const T, pTime: ?*i64) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObject.VTable, self.vtable).GetLatency(@ptrCast(*const IAudioProcessingObject, self), pTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObject_GetRegistrationProperties(self: *const T, ppRegProps: ?*?*APO_REG_PROPERTIES) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObject.VTable, self.vtable).GetRegistrationProperties(@ptrCast(*const IAudioProcessingObject, self), ppRegProps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObject_Initialize(self: *const T, cbDataSize: u32, pbyData: [*:0]u8) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObject.VTable, self.vtable).Initialize(@ptrCast(*const IAudioProcessingObject, self), cbDataSize, pbyData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObject_IsInputFormatSupported(self: *const T, pOppositeFormat: ?*IAudioMediaType, pRequestedInputFormat: ?*IAudioMediaType, ppSupportedInputFormat: ?*?*IAudioMediaType) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObject.VTable, self.vtable).IsInputFormatSupported(@ptrCast(*const IAudioProcessingObject, self), pOppositeFormat, pRequestedInputFormat, ppSupportedInputFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObject_IsOutputFormatSupported(self: *const T, pOppositeFormat: ?*IAudioMediaType, pRequestedOutputFormat: ?*IAudioMediaType, ppSupportedOutputFormat: ?*?*IAudioMediaType) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObject.VTable, self.vtable).IsOutputFormatSupported(@ptrCast(*const IAudioProcessingObject, self), pOppositeFormat, pRequestedOutputFormat, ppSupportedOutputFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioProcessingObject_GetInputChannelCount(self: *const T, pu32ChannelCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioProcessingObject.VTable, self.vtable).GetInputChannelCount(@ptrCast(*const IAudioProcessingObject, self), pu32ChannelCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IAudioDeviceModulesClient_Value = @import("../../zig.zig").Guid.initString("98f37dac-d0b6-49f5-896a-aa4d169a4c48");
pub const IID_IAudioDeviceModulesClient = &IID_IAudioDeviceModulesClient_Value;
pub const IAudioDeviceModulesClient = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAudioDeviceModulesManager: fn(
self: *const IAudioDeviceModulesClient,
pAudioDeviceModulesManager: ?*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 IAudioDeviceModulesClient_SetAudioDeviceModulesManager(self: *const T, pAudioDeviceModulesManager: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioDeviceModulesClient.VTable, self.vtable).SetAudioDeviceModulesManager(@ptrCast(*const IAudioDeviceModulesClient, self), pAudioDeviceModulesManager);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const FNAPONOTIFICATIONCALLBACK = fn(
pProperties: ?*APO_REG_PROPERTIES,
pvRefData: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
const IID_IAudioSystemEffects_Value = @import("../../zig.zig").Guid.initString("5fa00f27-add6-499a-8a9d-6b98521fa75b");
pub const IID_IAudioSystemEffects = &IID_IAudioSystemEffects_Value;
pub const IAudioSystemEffects = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IAudioSystemEffects2_Value = @import("../../zig.zig").Guid.initString("bafe99d2-7436-44ce-9e0e-4d89afbfff56");
pub const IID_IAudioSystemEffects2 = &IID_IAudioSystemEffects2_Value;
pub const IAudioSystemEffects2 = extern struct {
pub const VTable = extern struct {
base: IAudioSystemEffects.VTable,
GetEffectsList: fn(
self: *const IAudioSystemEffects2,
ppEffectsIds: ?*?*Guid,
pcEffects: ?*u32,
Event: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IAudioSystemEffects.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioSystemEffects2_GetEffectsList(self: *const T, ppEffectsIds: ?*?*Guid, pcEffects: ?*u32, Event: ?HANDLE) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioSystemEffects2.VTable, self.vtable).GetEffectsList(@ptrCast(*const IAudioSystemEffects2, self), ppEffectsIds, pcEffects, Event);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IAudioSystemEffectsCustomFormats_Value = @import("../../zig.zig").Guid.initString("b1176e34-bb7f-4f05-bebd-1b18a534e097");
pub const IID_IAudioSystemEffectsCustomFormats = &IID_IAudioSystemEffectsCustomFormats_Value;
pub const IAudioSystemEffectsCustomFormats = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetFormatCount: fn(
self: *const IAudioSystemEffectsCustomFormats,
pcFormats: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFormat: fn(
self: *const IAudioSystemEffectsCustomFormats,
nFormat: u32,
ppFormat: ?*?*IAudioMediaType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFormatRepresentation: fn(
self: *const IAudioSystemEffectsCustomFormats,
nFormat: u32,
ppwstrFormatRep: ?*?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 IAudioSystemEffectsCustomFormats_GetFormatCount(self: *const T, pcFormats: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioSystemEffectsCustomFormats.VTable, self.vtable).GetFormatCount(@ptrCast(*const IAudioSystemEffectsCustomFormats, self), pcFormats);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioSystemEffectsCustomFormats_GetFormat(self: *const T, nFormat: u32, ppFormat: ?*?*IAudioMediaType) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioSystemEffectsCustomFormats.VTable, self.vtable).GetFormat(@ptrCast(*const IAudioSystemEffectsCustomFormats, self), nFormat, ppFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAudioSystemEffectsCustomFormats_GetFormatRepresentation(self: *const T, nFormat: u32, ppwstrFormatRep: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IAudioSystemEffectsCustomFormats.VTable, self.vtable).GetFormatRepresentation(@ptrCast(*const IAudioSystemEffectsCustomFormats, self), nFormat, ppwstrFormatRep);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const APOInitSystemEffects = extern struct {
APOInit: APOInitBaseStruct,
pAPOEndpointProperties: ?*IPropertyStore,
pAPOSystemEffectsProperties: ?*IPropertyStore,
pReserved: ?*c_void,
pDeviceCollection: ?*IMMDeviceCollection,
};
pub const APOInitSystemEffects2 = extern struct {
APOInit: APOInitBaseStruct,
pAPOEndpointProperties: ?*IPropertyStore,
pAPOSystemEffectsProperties: ?*IPropertyStore,
pReserved: ?*c_void,
pDeviceCollection: ?*IMMDeviceCollection,
nSoftwareIoDeviceInCollection: u32,
nSoftwareIoConnectorIndex: u32,
AudioProcessingMode: Guid,
InitializeForDiscoveryOnly: BOOL,
};
pub const AudioFXExtensionParams = extern struct {
AddPageParam: LPARAM,
pwstrEndpointID: ?PWSTR,
pFxProperties: ?*IPropertyStore,
};
pub const DLSID = extern struct {
ulData1: u32,
usData2: u16,
usData3: u16,
abData4: [8]u8,
};
pub const DLSVERSION = extern struct {
dwVersionMS: u32,
dwVersionLS: u32,
};
pub const CONNECTION = extern struct {
usSource: u16,
usControl: u16,
usDestination: u16,
usTransform: u16,
lScale: i32,
};
pub const CONNECTIONLIST = extern struct {
cbSize: u32,
cConnections: u32,
};
pub const RGNRANGE = extern struct {
usLow: u16,
usHigh: u16,
};
pub const MIDILOCALE = extern struct {
ulBank: u32,
ulInstrument: u32,
};
pub const RGNHEADER = extern struct {
RangeKey: RGNRANGE,
RangeVelocity: RGNRANGE,
fusOptions: u16,
usKeyGroup: u16,
};
pub const INSTHEADER = extern struct {
cRegions: u32,
Locale: MIDILOCALE,
};
pub const DLSHEADER = extern struct {
cInstruments: u32,
};
pub const WAVELINK = extern struct {
fusOptions: u16,
usPhaseGroup: u16,
ulChannel: u32,
ulTableIndex: u32,
};
pub const POOLCUE = extern struct {
ulOffset: u32,
};
pub const POOLTABLE = extern struct {
cbSize: u32,
cCues: u32,
};
pub const _rwsmp = extern struct {
cbSize: u32,
usUnityNote: u16,
sFineTune: i16,
lAttenuation: i32,
fulOptions: u32,
cSampleLoops: u32,
};
pub const _rloop = extern struct {
cbSize: u32,
ulType: u32,
ulStart: u32,
ulLength: u32,
};
pub const DMUS_DOWNLOADINFO = extern struct {
dwDLType: u32,
dwDLId: u32,
dwNumOffsetTableEntries: u32,
cbSize: u32,
};
pub const DMUS_OFFSETTABLE = extern struct {
ulOffsetTable: [1]u32,
};
pub const DMUS_INSTRUMENT = extern struct {
ulPatch: u32,
ulFirstRegionIdx: u32,
ulGlobalArtIdx: u32,
ulFirstExtCkIdx: u32,
ulCopyrightIdx: u32,
ulFlags: u32,
};
pub const DMUS_REGION = extern struct {
RangeKey: RGNRANGE,
RangeVelocity: RGNRANGE,
fusOptions: u16,
usKeyGroup: u16,
ulRegionArtIdx: u32,
ulNextRegionIdx: u32,
ulFirstExtCkIdx: u32,
WaveLink: WAVELINK,
WSMP: _rwsmp,
WLOOP: [1]_rloop,
};
pub const DMUS_LFOPARAMS = extern struct {
pcFrequency: i32,
tcDelay: i32,
gcVolumeScale: i32,
pcPitchScale: i32,
gcMWToVolume: i32,
pcMWToPitch: i32,
};
pub const DMUS_VEGPARAMS = extern struct {
tcAttack: i32,
tcDecay: i32,
ptSustain: i32,
tcRelease: i32,
tcVel2Attack: i32,
tcKey2Decay: i32,
};
pub const DMUS_PEGPARAMS = extern struct {
tcAttack: i32,
tcDecay: i32,
ptSustain: i32,
tcRelease: i32,
tcVel2Attack: i32,
tcKey2Decay: i32,
pcRange: i32,
};
pub const DMUS_MSCPARAMS = extern struct {
ptDefaultPan: i32,
};
pub const DMUS_ARTICPARAMS = extern struct {
LFO: DMUS_LFOPARAMS,
VolEG: DMUS_VEGPARAMS,
PitchEG: DMUS_PEGPARAMS,
Misc: DMUS_MSCPARAMS,
};
pub const DMUS_ARTICULATION = extern struct {
ulArt1Idx: u32,
ulFirstExtCkIdx: u32,
};
pub const DMUS_ARTICULATION2 = extern struct {
ulArtIdx: u32,
ulFirstExtCkIdx: u32,
ulNextArtIdx: u32,
};
pub const DMUS_EXTENSIONCHUNK = extern struct {
cbSize: u32,
ulNextExtCkIdx: u32,
ExtCkID: u32,
byExtCk: [4]u8,
};
pub const DMUS_COPYRIGHT = extern struct {
cbSize: u32,
byCopyright: [4]u8,
};
pub const DMUS_WAVEDATA = extern struct {
cbSize: u32,
byData: [4]u8,
};
pub const DMUS_WAVE = extern struct {
ulFirstExtCkIdx: u32,
ulCopyrightIdx: u32,
ulWaveDataIdx: u32,
WaveformatEx: WAVEFORMATEX,
};
pub const DMUS_NOTERANGE = extern struct {
dwLowNote: u32,
dwHighNote: u32,
};
pub const DMUS_WAVEARTDL = extern struct {
ulDownloadIdIdx: u32,
ulBus: u32,
ulBuffers: u32,
ulMasterDLId: u32,
usOptions: u16,
};
pub const DMUS_WAVEDL = extern struct {
cbWaveData: u32,
};
pub const DSCAPS = extern struct {
dwSize: u32,
dwFlags: u32,
dwMinSecondarySampleRate: u32,
dwMaxSecondarySampleRate: u32,
dwPrimaryBuffers: u32,
dwMaxHwMixingAllBuffers: u32,
dwMaxHwMixingStaticBuffers: u32,
dwMaxHwMixingStreamingBuffers: u32,
dwFreeHwMixingAllBuffers: u32,
dwFreeHwMixingStaticBuffers: u32,
dwFreeHwMixingStreamingBuffers: u32,
dwMaxHw3DAllBuffers: u32,
dwMaxHw3DStaticBuffers: u32,
dwMaxHw3DStreamingBuffers: u32,
dwFreeHw3DAllBuffers: u32,
dwFreeHw3DStaticBuffers: u32,
dwFreeHw3DStreamingBuffers: u32,
dwTotalHwMemBytes: u32,
dwFreeHwMemBytes: u32,
dwMaxContigFreeHwMemBytes: u32,
dwUnlockTransferRateHwBuffers: u32,
dwPlayCpuOverheadSwBuffers: u32,
dwReserved1: u32,
dwReserved2: u32,
};
pub const DSBCAPS = extern struct {
dwSize: u32,
dwFlags: u32,
dwBufferBytes: u32,
dwUnlockTransferRate: u32,
dwPlayCpuOverhead: u32,
};
pub const DSEFFECTDESC = extern struct {
dwSize: u32,
dwFlags: u32,
guidDSFXClass: Guid,
dwReserved1: usize,
dwReserved2: usize,
};
pub const DSCEFFECTDESC = extern struct {
dwSize: u32,
dwFlags: u32,
guidDSCFXClass: Guid,
guidDSCFXInstance: Guid,
dwReserved1: u32,
dwReserved2: u32,
};
pub const DSBUFFERDESC = extern struct {
dwSize: u32,
dwFlags: u32,
dwBufferBytes: u32,
dwReserved: u32,
lpwfxFormat: ?*WAVEFORMATEX,
guid3DAlgorithm: Guid,
};
pub const DSBUFFERDESC1 = extern struct {
dwSize: u32,
dwFlags: u32,
dwBufferBytes: u32,
dwReserved: u32,
lpwfxFormat: ?*WAVEFORMATEX,
};
pub const DS3DBUFFER = extern struct {
dwSize: u32,
vPosition: D3DVECTOR,
vVelocity: D3DVECTOR,
dwInsideConeAngle: u32,
dwOutsideConeAngle: u32,
vConeOrientation: D3DVECTOR,
lConeOutsideVolume: i32,
flMinDistance: f32,
flMaxDistance: f32,
dwMode: u32,
};
pub const DS3DLISTENER = extern struct {
dwSize: u32,
vPosition: D3DVECTOR,
vVelocity: D3DVECTOR,
vOrientFront: D3DVECTOR,
vOrientTop: D3DVECTOR,
flDistanceFactor: f32,
flRolloffFactor: f32,
flDopplerFactor: f32,
};
pub const DSCCAPS = extern struct {
dwSize: u32,
dwFlags: u32,
dwFormats: u32,
dwChannels: u32,
};
pub const DSCBUFFERDESC1 = extern struct {
dwSize: u32,
dwFlags: u32,
dwBufferBytes: u32,
dwReserved: u32,
lpwfxFormat: ?*WAVEFORMATEX,
};
pub const DSCBUFFERDESC = extern struct {
dwSize: u32,
dwFlags: u32,
dwBufferBytes: u32,
dwReserved: u32,
lpwfxFormat: ?*WAVEFORMATEX,
dwFXCount: u32,
lpDSCFXDesc: ?*DSCEFFECTDESC,
};
pub const DSCBCAPS = extern struct {
dwSize: u32,
dwFlags: u32,
dwBufferBytes: u32,
dwReserved: u32,
};
pub const DSBPOSITIONNOTIFY = extern struct {
dwOffset: u32,
hEventNotify: ?HANDLE,
};
pub const LPDSENUMCALLBACKA = fn(
param0: ?*Guid,
param1: ?[*:0]const u8,
param2: ?[*:0]const u8,
param3: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const LPDSENUMCALLBACKW = fn(
param0: ?*Guid,
param1: ?[*:0]const u16,
param2: ?[*:0]const u16,
param3: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) BOOL;
const IID_IDirectSound_Value = @import("../../zig.zig").Guid.initString("279afa83-4981-11ce-a521-0020af0be560");
pub const IID_IDirectSound = &IID_IDirectSound_Value;
pub const IDirectSound = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateSoundBuffer: fn(
self: *const IDirectSound,
pcDSBufferDesc: ?*DSBUFFERDESC,
ppDSBuffer: ?*?*IDirectSoundBuffer,
pUnkOuter: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCaps: fn(
self: *const IDirectSound,
pDSCaps: ?*DSCAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DuplicateSoundBuffer: fn(
self: *const IDirectSound,
pDSBufferOriginal: ?*IDirectSoundBuffer,
ppDSBufferDuplicate: ?*?*IDirectSoundBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCooperativeLevel: fn(
self: *const IDirectSound,
hwnd: ?HWND,
dwLevel: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Compact: fn(
self: *const IDirectSound,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSpeakerConfig: fn(
self: *const IDirectSound,
pdwSpeakerConfig: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSpeakerConfig: fn(
self: *const IDirectSound,
dwSpeakerConfig: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Initialize: fn(
self: *const IDirectSound,
pcGuidDevice: ?*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 IDirectSound_CreateSoundBuffer(self: *const T, pcDSBufferDesc: ?*DSBUFFERDESC, ppDSBuffer: ?*?*IDirectSoundBuffer, pUnkOuter: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound.VTable, self.vtable).CreateSoundBuffer(@ptrCast(*const IDirectSound, self), pcDSBufferDesc, ppDSBuffer, pUnkOuter);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound_GetCaps(self: *const T, pDSCaps: ?*DSCAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound.VTable, self.vtable).GetCaps(@ptrCast(*const IDirectSound, self), pDSCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound_DuplicateSoundBuffer(self: *const T, pDSBufferOriginal: ?*IDirectSoundBuffer, ppDSBufferDuplicate: ?*?*IDirectSoundBuffer) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound.VTable, self.vtable).DuplicateSoundBuffer(@ptrCast(*const IDirectSound, self), pDSBufferOriginal, ppDSBufferDuplicate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound_SetCooperativeLevel(self: *const T, hwnd: ?HWND, dwLevel: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound.VTable, self.vtable).SetCooperativeLevel(@ptrCast(*const IDirectSound, self), hwnd, dwLevel);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound_Compact(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound.VTable, self.vtable).Compact(@ptrCast(*const IDirectSound, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound_GetSpeakerConfig(self: *const T, pdwSpeakerConfig: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound.VTable, self.vtable).GetSpeakerConfig(@ptrCast(*const IDirectSound, self), pdwSpeakerConfig);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound_SetSpeakerConfig(self: *const T, dwSpeakerConfig: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound.VTable, self.vtable).SetSpeakerConfig(@ptrCast(*const IDirectSound, self), dwSpeakerConfig);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound_Initialize(self: *const T, pcGuidDevice: ?*const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound.VTable, self.vtable).Initialize(@ptrCast(*const IDirectSound, self), pcGuidDevice);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSound8_Value = @import("../../zig.zig").Guid.initString("c50a7e93-f395-4834-9ef6-7fa99de50966");
pub const IID_IDirectSound8 = &IID_IDirectSound8_Value;
pub const IDirectSound8 = extern struct {
pub const VTable = extern struct {
base: IDirectSound.VTable,
VerifyCertification: fn(
self: *const IDirectSound8,
pdwCertified: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDirectSound.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound8_VerifyCertification(self: *const T, pdwCertified: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound8.VTable, self.vtable).VerifyCertification(@ptrCast(*const IDirectSound8, self), pdwCertified);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSoundBuffer_Value = @import("../../zig.zig").Guid.initString("279afa85-4981-11ce-a521-0020af0be560");
pub const IID_IDirectSoundBuffer = &IID_IDirectSoundBuffer_Value;
pub const IDirectSoundBuffer = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetCaps: fn(
self: *const IDirectSoundBuffer,
pDSBufferCaps: ?*DSBCAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCurrentPosition: fn(
self: *const IDirectSoundBuffer,
pdwCurrentPlayCursor: ?*u32,
pdwCurrentWriteCursor: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFormat: fn(
self: *const IDirectSoundBuffer,
// TODO: what to do with BytesParamIndex 1?
pwfxFormat: ?*WAVEFORMATEX,
dwSizeAllocated: u32,
pdwSizeWritten: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVolume: fn(
self: *const IDirectSoundBuffer,
plVolume: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPan: fn(
self: *const IDirectSoundBuffer,
plPan: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFrequency: fn(
self: *const IDirectSoundBuffer,
pdwFrequency: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStatus: fn(
self: *const IDirectSoundBuffer,
pdwStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Initialize: fn(
self: *const IDirectSoundBuffer,
pDirectSound: ?*IDirectSound,
pcDSBufferDesc: ?*DSBUFFERDESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Lock: fn(
self: *const IDirectSoundBuffer,
dwOffset: u32,
dwBytes: u32,
ppvAudioPtr1: ?*?*c_void,
pdwAudioBytes1: ?*u32,
ppvAudioPtr2: ?*?*c_void,
pdwAudioBytes2: ?*u32,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Play: fn(
self: *const IDirectSoundBuffer,
dwReserved1: u32,
dwPriority: u32,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCurrentPosition: fn(
self: *const IDirectSoundBuffer,
dwNewPosition: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetFormat: fn(
self: *const IDirectSoundBuffer,
pcfxFormat: ?*WAVEFORMATEX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVolume: fn(
self: *const IDirectSoundBuffer,
lVolume: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPan: fn(
self: *const IDirectSoundBuffer,
lPan: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetFrequency: fn(
self: *const IDirectSoundBuffer,
dwFrequency: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Stop: fn(
self: *const IDirectSoundBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Unlock: fn(
self: *const IDirectSoundBuffer,
// TODO: what to do with BytesParamIndex 1?
pvAudioPtr1: ?*c_void,
dwAudioBytes1: u32,
// TODO: what to do with BytesParamIndex 3?
pvAudioPtr2: ?*c_void,
dwAudioBytes2: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Restore: fn(
self: *const IDirectSoundBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_GetCaps(self: *const T, pDSBufferCaps: ?*DSBCAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).GetCaps(@ptrCast(*const IDirectSoundBuffer, self), pDSBufferCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_GetCurrentPosition(self: *const T, pdwCurrentPlayCursor: ?*u32, pdwCurrentWriteCursor: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).GetCurrentPosition(@ptrCast(*const IDirectSoundBuffer, self), pdwCurrentPlayCursor, pdwCurrentWriteCursor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_GetFormat(self: *const T, pwfxFormat: ?*WAVEFORMATEX, dwSizeAllocated: u32, pdwSizeWritten: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).GetFormat(@ptrCast(*const IDirectSoundBuffer, self), pwfxFormat, dwSizeAllocated, pdwSizeWritten);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_GetVolume(self: *const T, plVolume: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).GetVolume(@ptrCast(*const IDirectSoundBuffer, self), plVolume);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_GetPan(self: *const T, plPan: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).GetPan(@ptrCast(*const IDirectSoundBuffer, self), plPan);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_GetFrequency(self: *const T, pdwFrequency: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).GetFrequency(@ptrCast(*const IDirectSoundBuffer, self), pdwFrequency);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_GetStatus(self: *const T, pdwStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).GetStatus(@ptrCast(*const IDirectSoundBuffer, self), pdwStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_Initialize(self: *const T, pDirectSound: ?*IDirectSound, pcDSBufferDesc: ?*DSBUFFERDESC) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).Initialize(@ptrCast(*const IDirectSoundBuffer, self), pDirectSound, pcDSBufferDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_Lock(self: *const T, dwOffset: u32, dwBytes: u32, ppvAudioPtr1: ?*?*c_void, pdwAudioBytes1: ?*u32, ppvAudioPtr2: ?*?*c_void, pdwAudioBytes2: ?*u32, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).Lock(@ptrCast(*const IDirectSoundBuffer, self), dwOffset, dwBytes, ppvAudioPtr1, pdwAudioBytes1, ppvAudioPtr2, pdwAudioBytes2, dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_Play(self: *const T, dwReserved1: u32, dwPriority: u32, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).Play(@ptrCast(*const IDirectSoundBuffer, self), dwReserved1, dwPriority, dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_SetCurrentPosition(self: *const T, dwNewPosition: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).SetCurrentPosition(@ptrCast(*const IDirectSoundBuffer, self), dwNewPosition);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_SetFormat(self: *const T, pcfxFormat: ?*WAVEFORMATEX) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).SetFormat(@ptrCast(*const IDirectSoundBuffer, self), pcfxFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_SetVolume(self: *const T, lVolume: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).SetVolume(@ptrCast(*const IDirectSoundBuffer, self), lVolume);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_SetPan(self: *const T, lPan: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).SetPan(@ptrCast(*const IDirectSoundBuffer, self), lPan);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_SetFrequency(self: *const T, dwFrequency: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).SetFrequency(@ptrCast(*const IDirectSoundBuffer, self), dwFrequency);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_Stop(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).Stop(@ptrCast(*const IDirectSoundBuffer, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_Unlock(self: *const T, pvAudioPtr1: ?*c_void, dwAudioBytes1: u32, pvAudioPtr2: ?*c_void, dwAudioBytes2: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).Unlock(@ptrCast(*const IDirectSoundBuffer, self), pvAudioPtr1, dwAudioBytes1, pvAudioPtr2, dwAudioBytes2);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer_Restore(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer.VTable, self.vtable).Restore(@ptrCast(*const IDirectSoundBuffer, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSoundBuffer8_Value = @import("../../zig.zig").Guid.initString("6825a449-7524-4d82-920f-50e36ab3ab1e");
pub const IID_IDirectSoundBuffer8 = &IID_IDirectSoundBuffer8_Value;
pub const IDirectSoundBuffer8 = extern struct {
pub const VTable = extern struct {
base: IDirectSoundBuffer.VTable,
SetFX: fn(
self: *const IDirectSoundBuffer8,
dwEffectsCount: u32,
pDSFXDesc: ?[*]DSEFFECTDESC,
pdwResultCodes: ?[*]u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AcquireResources: fn(
self: *const IDirectSoundBuffer8,
dwFlags: u32,
dwEffectsCount: u32,
pdwResultCodes: [*]u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetObjectInPath: fn(
self: *const IDirectSoundBuffer8,
rguidObject: ?*const Guid,
dwIndex: u32,
rguidInterface: ?*const Guid,
ppObject: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDirectSoundBuffer.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer8_SetFX(self: *const T, dwEffectsCount: u32, pDSFXDesc: ?[*]DSEFFECTDESC, pdwResultCodes: ?[*]u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer8.VTable, self.vtable).SetFX(@ptrCast(*const IDirectSoundBuffer8, self), dwEffectsCount, pDSFXDesc, pdwResultCodes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer8_AcquireResources(self: *const T, dwFlags: u32, dwEffectsCount: u32, pdwResultCodes: [*]u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer8.VTable, self.vtable).AcquireResources(@ptrCast(*const IDirectSoundBuffer8, self), dwFlags, dwEffectsCount, pdwResultCodes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundBuffer8_GetObjectInPath(self: *const T, rguidObject: ?*const Guid, dwIndex: u32, rguidInterface: ?*const Guid, ppObject: ?*?*c_void) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundBuffer8.VTable, self.vtable).GetObjectInPath(@ptrCast(*const IDirectSoundBuffer8, self), rguidObject, dwIndex, rguidInterface, ppObject);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSound3DListener_Value = @import("../../zig.zig").Guid.initString("279afa84-4981-11ce-a521-0020af0be560");
pub const IID_IDirectSound3DListener = &IID_IDirectSound3DListener_Value;
pub const IDirectSound3DListener = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetAllParameters: fn(
self: *const IDirectSound3DListener,
pListener: ?*DS3DLISTENER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDistanceFactor: fn(
self: *const IDirectSound3DListener,
pflDistanceFactor: ?*f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDopplerFactor: fn(
self: *const IDirectSound3DListener,
pflDopplerFactor: ?*f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetOrientation: fn(
self: *const IDirectSound3DListener,
pvOrientFront: ?*D3DVECTOR,
pvOrientTop: ?*D3DVECTOR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPosition: fn(
self: *const IDirectSound3DListener,
pvPosition: ?*D3DVECTOR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRolloffFactor: fn(
self: *const IDirectSound3DListener,
pflRolloffFactor: ?*f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVelocity: fn(
self: *const IDirectSound3DListener,
pvVelocity: ?*D3DVECTOR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAllParameters: fn(
self: *const IDirectSound3DListener,
pcListener: ?*DS3DLISTENER,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDistanceFactor: fn(
self: *const IDirectSound3DListener,
flDistanceFactor: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDopplerFactor: fn(
self: *const IDirectSound3DListener,
flDopplerFactor: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOrientation: fn(
self: *const IDirectSound3DListener,
xFront: f32,
yFront: f32,
zFront: f32,
xTop: f32,
yTop: f32,
zTop: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPosition: fn(
self: *const IDirectSound3DListener,
x: f32,
y: f32,
z: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRolloffFactor: fn(
self: *const IDirectSound3DListener,
flRolloffFactor: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVelocity: fn(
self: *const IDirectSound3DListener,
x: f32,
y: f32,
z: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CommitDeferredSettings: fn(
self: *const IDirectSound3DListener,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_GetAllParameters(self: *const T, pListener: ?*DS3DLISTENER) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSound3DListener, self), pListener);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_GetDistanceFactor(self: *const T, pflDistanceFactor: ?*f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).GetDistanceFactor(@ptrCast(*const IDirectSound3DListener, self), pflDistanceFactor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_GetDopplerFactor(self: *const T, pflDopplerFactor: ?*f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).GetDopplerFactor(@ptrCast(*const IDirectSound3DListener, self), pflDopplerFactor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_GetOrientation(self: *const T, pvOrientFront: ?*D3DVECTOR, pvOrientTop: ?*D3DVECTOR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).GetOrientation(@ptrCast(*const IDirectSound3DListener, self), pvOrientFront, pvOrientTop);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_GetPosition(self: *const T, pvPosition: ?*D3DVECTOR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).GetPosition(@ptrCast(*const IDirectSound3DListener, self), pvPosition);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_GetRolloffFactor(self: *const T, pflRolloffFactor: ?*f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).GetRolloffFactor(@ptrCast(*const IDirectSound3DListener, self), pflRolloffFactor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_GetVelocity(self: *const T, pvVelocity: ?*D3DVECTOR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).GetVelocity(@ptrCast(*const IDirectSound3DListener, self), pvVelocity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_SetAllParameters(self: *const T, pcListener: ?*DS3DLISTENER, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSound3DListener, self), pcListener, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_SetDistanceFactor(self: *const T, flDistanceFactor: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).SetDistanceFactor(@ptrCast(*const IDirectSound3DListener, self), flDistanceFactor, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_SetDopplerFactor(self: *const T, flDopplerFactor: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).SetDopplerFactor(@ptrCast(*const IDirectSound3DListener, self), flDopplerFactor, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_SetOrientation(self: *const T, xFront: f32, yFront: f32, zFront: f32, xTop: f32, yTop: f32, zTop: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).SetOrientation(@ptrCast(*const IDirectSound3DListener, self), xFront, yFront, zFront, xTop, yTop, zTop, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_SetPosition(self: *const T, x: f32, y: f32, z: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).SetPosition(@ptrCast(*const IDirectSound3DListener, self), x, y, z, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_SetRolloffFactor(self: *const T, flRolloffFactor: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).SetRolloffFactor(@ptrCast(*const IDirectSound3DListener, self), flRolloffFactor, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_SetVelocity(self: *const T, x: f32, y: f32, z: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).SetVelocity(@ptrCast(*const IDirectSound3DListener, self), x, y, z, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DListener_CommitDeferredSettings(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DListener.VTable, self.vtable).CommitDeferredSettings(@ptrCast(*const IDirectSound3DListener, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSound3DBuffer_Value = @import("../../zig.zig").Guid.initString("279afa86-4981-11ce-a521-0020af0be560");
pub const IID_IDirectSound3DBuffer = &IID_IDirectSound3DBuffer_Value;
pub const IDirectSound3DBuffer = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetAllParameters: fn(
self: *const IDirectSound3DBuffer,
pDs3dBuffer: ?*DS3DBUFFER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetConeAngles: fn(
self: *const IDirectSound3DBuffer,
pdwInsideConeAngle: ?*u32,
pdwOutsideConeAngle: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetConeOrientation: fn(
self: *const IDirectSound3DBuffer,
pvOrientation: ?*D3DVECTOR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetConeOutsideVolume: fn(
self: *const IDirectSound3DBuffer,
plConeOutsideVolume: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMaxDistance: fn(
self: *const IDirectSound3DBuffer,
pflMaxDistance: ?*f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMinDistance: fn(
self: *const IDirectSound3DBuffer,
pflMinDistance: ?*f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMode: fn(
self: *const IDirectSound3DBuffer,
pdwMode: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPosition: fn(
self: *const IDirectSound3DBuffer,
pvPosition: ?*D3DVECTOR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVelocity: fn(
self: *const IDirectSound3DBuffer,
pvVelocity: ?*D3DVECTOR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAllParameters: fn(
self: *const IDirectSound3DBuffer,
pcDs3dBuffer: ?*DS3DBUFFER,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetConeAngles: fn(
self: *const IDirectSound3DBuffer,
dwInsideConeAngle: u32,
dwOutsideConeAngle: u32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetConeOrientation: fn(
self: *const IDirectSound3DBuffer,
x: f32,
y: f32,
z: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetConeOutsideVolume: fn(
self: *const IDirectSound3DBuffer,
lConeOutsideVolume: i32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMaxDistance: fn(
self: *const IDirectSound3DBuffer,
flMaxDistance: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMinDistance: fn(
self: *const IDirectSound3DBuffer,
flMinDistance: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMode: fn(
self: *const IDirectSound3DBuffer,
dwMode: u32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPosition: fn(
self: *const IDirectSound3DBuffer,
x: f32,
y: f32,
z: f32,
dwApply: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVelocity: fn(
self: *const IDirectSound3DBuffer,
x: f32,
y: f32,
z: f32,
dwApply: 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 IDirectSound3DBuffer_GetAllParameters(self: *const T, pDs3dBuffer: ?*DS3DBUFFER) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSound3DBuffer, self), pDs3dBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_GetConeAngles(self: *const T, pdwInsideConeAngle: ?*u32, pdwOutsideConeAngle: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).GetConeAngles(@ptrCast(*const IDirectSound3DBuffer, self), pdwInsideConeAngle, pdwOutsideConeAngle);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_GetConeOrientation(self: *const T, pvOrientation: ?*D3DVECTOR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).GetConeOrientation(@ptrCast(*const IDirectSound3DBuffer, self), pvOrientation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_GetConeOutsideVolume(self: *const T, plConeOutsideVolume: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).GetConeOutsideVolume(@ptrCast(*const IDirectSound3DBuffer, self), plConeOutsideVolume);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_GetMaxDistance(self: *const T, pflMaxDistance: ?*f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).GetMaxDistance(@ptrCast(*const IDirectSound3DBuffer, self), pflMaxDistance);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_GetMinDistance(self: *const T, pflMinDistance: ?*f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).GetMinDistance(@ptrCast(*const IDirectSound3DBuffer, self), pflMinDistance);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_GetMode(self: *const T, pdwMode: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).GetMode(@ptrCast(*const IDirectSound3DBuffer, self), pdwMode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_GetPosition(self: *const T, pvPosition: ?*D3DVECTOR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).GetPosition(@ptrCast(*const IDirectSound3DBuffer, self), pvPosition);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_GetVelocity(self: *const T, pvVelocity: ?*D3DVECTOR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).GetVelocity(@ptrCast(*const IDirectSound3DBuffer, self), pvVelocity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_SetAllParameters(self: *const T, pcDs3dBuffer: ?*DS3DBUFFER, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSound3DBuffer, self), pcDs3dBuffer, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_SetConeAngles(self: *const T, dwInsideConeAngle: u32, dwOutsideConeAngle: u32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).SetConeAngles(@ptrCast(*const IDirectSound3DBuffer, self), dwInsideConeAngle, dwOutsideConeAngle, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_SetConeOrientation(self: *const T, x: f32, y: f32, z: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).SetConeOrientation(@ptrCast(*const IDirectSound3DBuffer, self), x, y, z, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_SetConeOutsideVolume(self: *const T, lConeOutsideVolume: i32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).SetConeOutsideVolume(@ptrCast(*const IDirectSound3DBuffer, self), lConeOutsideVolume, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_SetMaxDistance(self: *const T, flMaxDistance: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).SetMaxDistance(@ptrCast(*const IDirectSound3DBuffer, self), flMaxDistance, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_SetMinDistance(self: *const T, flMinDistance: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).SetMinDistance(@ptrCast(*const IDirectSound3DBuffer, self), flMinDistance, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_SetMode(self: *const T, dwMode: u32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).SetMode(@ptrCast(*const IDirectSound3DBuffer, self), dwMode, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_SetPosition(self: *const T, x: f32, y: f32, z: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).SetPosition(@ptrCast(*const IDirectSound3DBuffer, self), x, y, z, dwApply);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSound3DBuffer_SetVelocity(self: *const T, x: f32, y: f32, z: f32, dwApply: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSound3DBuffer.VTable, self.vtable).SetVelocity(@ptrCast(*const IDirectSound3DBuffer, self), x, y, z, dwApply);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSoundCapture_Value = @import("../../zig.zig").Guid.initString("b0210781-89cd-11d0-af08-00a0c925cd16");
pub const IID_IDirectSoundCapture = &IID_IDirectSoundCapture_Value;
pub const IDirectSoundCapture = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateCaptureBuffer: fn(
self: *const IDirectSoundCapture,
pcDSCBufferDesc: ?*DSCBUFFERDESC,
ppDSCBuffer: ?*?*IDirectSoundCaptureBuffer,
pUnkOuter: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCaps: fn(
self: *const IDirectSoundCapture,
pDSCCaps: ?*DSCCAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Initialize: fn(
self: *const IDirectSoundCapture,
pcGuidDevice: ?*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 IDirectSoundCapture_CreateCaptureBuffer(self: *const T, pcDSCBufferDesc: ?*DSCBUFFERDESC, ppDSCBuffer: ?*?*IDirectSoundCaptureBuffer, pUnkOuter: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCapture.VTable, self.vtable).CreateCaptureBuffer(@ptrCast(*const IDirectSoundCapture, self), pcDSCBufferDesc, ppDSCBuffer, pUnkOuter);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCapture_GetCaps(self: *const T, pDSCCaps: ?*DSCCAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCapture.VTable, self.vtable).GetCaps(@ptrCast(*const IDirectSoundCapture, self), pDSCCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCapture_Initialize(self: *const T, pcGuidDevice: ?*const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCapture.VTable, self.vtable).Initialize(@ptrCast(*const IDirectSoundCapture, self), pcGuidDevice);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSoundCaptureBuffer_Value = @import("../../zig.zig").Guid.initString("b0210782-89cd-11d0-af08-00a0c925cd16");
pub const IID_IDirectSoundCaptureBuffer = &IID_IDirectSoundCaptureBuffer_Value;
pub const IDirectSoundCaptureBuffer = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetCaps: fn(
self: *const IDirectSoundCaptureBuffer,
pDSCBCaps: ?*DSCBCAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCurrentPosition: fn(
self: *const IDirectSoundCaptureBuffer,
pdwCapturePosition: ?*u32,
pdwReadPosition: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFormat: fn(
self: *const IDirectSoundCaptureBuffer,
// TODO: what to do with BytesParamIndex 1?
pwfxFormat: ?*WAVEFORMATEX,
dwSizeAllocated: u32,
pdwSizeWritten: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStatus: fn(
self: *const IDirectSoundCaptureBuffer,
pdwStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Initialize: fn(
self: *const IDirectSoundCaptureBuffer,
pDirectSoundCapture: ?*IDirectSoundCapture,
pcDSCBufferDesc: ?*DSCBUFFERDESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Lock: fn(
self: *const IDirectSoundCaptureBuffer,
dwOffset: u32,
dwBytes: u32,
ppvAudioPtr1: ?*?*c_void,
pdwAudioBytes1: ?*u32,
ppvAudioPtr2: ?*?*c_void,
pdwAudioBytes2: ?*u32,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Start: fn(
self: *const IDirectSoundCaptureBuffer,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Stop: fn(
self: *const IDirectSoundCaptureBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Unlock: fn(
self: *const IDirectSoundCaptureBuffer,
// TODO: what to do with BytesParamIndex 1?
pvAudioPtr1: ?*c_void,
dwAudioBytes1: u32,
// TODO: what to do with BytesParamIndex 3?
pvAudioPtr2: ?*c_void,
dwAudioBytes2: 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 IDirectSoundCaptureBuffer_GetCaps(self: *const T, pDSCBCaps: ?*DSCBCAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer.VTable, self.vtable).GetCaps(@ptrCast(*const IDirectSoundCaptureBuffer, self), pDSCBCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer_GetCurrentPosition(self: *const T, pdwCapturePosition: ?*u32, pdwReadPosition: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer.VTable, self.vtable).GetCurrentPosition(@ptrCast(*const IDirectSoundCaptureBuffer, self), pdwCapturePosition, pdwReadPosition);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer_GetFormat(self: *const T, pwfxFormat: ?*WAVEFORMATEX, dwSizeAllocated: u32, pdwSizeWritten: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer.VTable, self.vtable).GetFormat(@ptrCast(*const IDirectSoundCaptureBuffer, self), pwfxFormat, dwSizeAllocated, pdwSizeWritten);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer_GetStatus(self: *const T, pdwStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer.VTable, self.vtable).GetStatus(@ptrCast(*const IDirectSoundCaptureBuffer, self), pdwStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer_Initialize(self: *const T, pDirectSoundCapture: ?*IDirectSoundCapture, pcDSCBufferDesc: ?*DSCBUFFERDESC) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer.VTable, self.vtable).Initialize(@ptrCast(*const IDirectSoundCaptureBuffer, self), pDirectSoundCapture, pcDSCBufferDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer_Lock(self: *const T, dwOffset: u32, dwBytes: u32, ppvAudioPtr1: ?*?*c_void, pdwAudioBytes1: ?*u32, ppvAudioPtr2: ?*?*c_void, pdwAudioBytes2: ?*u32, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer.VTable, self.vtable).Lock(@ptrCast(*const IDirectSoundCaptureBuffer, self), dwOffset, dwBytes, ppvAudioPtr1, pdwAudioBytes1, ppvAudioPtr2, pdwAudioBytes2, dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer_Start(self: *const T, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer.VTable, self.vtable).Start(@ptrCast(*const IDirectSoundCaptureBuffer, self), dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer_Stop(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer.VTable, self.vtable).Stop(@ptrCast(*const IDirectSoundCaptureBuffer, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer_Unlock(self: *const T, pvAudioPtr1: ?*c_void, dwAudioBytes1: u32, pvAudioPtr2: ?*c_void, dwAudioBytes2: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer.VTable, self.vtable).Unlock(@ptrCast(*const IDirectSoundCaptureBuffer, self), pvAudioPtr1, dwAudioBytes1, pvAudioPtr2, dwAudioBytes2);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSoundCaptureBuffer8_Value = @import("../../zig.zig").Guid.initString("00990df4-0dbb-4872-833e-6d303e80aeb6");
pub const IID_IDirectSoundCaptureBuffer8 = &IID_IDirectSoundCaptureBuffer8_Value;
pub const IDirectSoundCaptureBuffer8 = extern struct {
pub const VTable = extern struct {
base: IDirectSoundCaptureBuffer.VTable,
GetObjectInPath: fn(
self: *const IDirectSoundCaptureBuffer8,
rguidObject: ?*const Guid,
dwIndex: u32,
rguidInterface: ?*const Guid,
ppObject: ?*?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFXStatus: fn(
self: *const IDirectSoundCaptureBuffer8,
dwEffectsCount: u32,
pdwFXStatus: [*]u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDirectSoundCaptureBuffer.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer8_GetObjectInPath(self: *const T, rguidObject: ?*const Guid, dwIndex: u32, rguidInterface: ?*const Guid, ppObject: ?*?*c_void) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer8.VTable, self.vtable).GetObjectInPath(@ptrCast(*const IDirectSoundCaptureBuffer8, self), rguidObject, dwIndex, rguidInterface, ppObject);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureBuffer8_GetFXStatus(self: *const T, dwEffectsCount: u32, pdwFXStatus: [*]u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureBuffer8.VTable, self.vtable).GetFXStatus(@ptrCast(*const IDirectSoundCaptureBuffer8, self), dwEffectsCount, pdwFXStatus);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSoundNotify_Value = @import("../../zig.zig").Guid.initString("b0210783-89cd-11d0-af08-00a0c925cd16");
pub const IID_IDirectSoundNotify = &IID_IDirectSoundNotify_Value;
pub const IDirectSoundNotify = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetNotificationPositions: fn(
self: *const IDirectSoundNotify,
dwPositionNotifies: u32,
pcPositionNotifies: [*]DSBPOSITIONNOTIFY,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundNotify_SetNotificationPositions(self: *const T, dwPositionNotifies: u32, pcPositionNotifies: [*]DSBPOSITIONNOTIFY) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundNotify.VTable, self.vtable).SetNotificationPositions(@ptrCast(*const IDirectSoundNotify, self), dwPositionNotifies, pcPositionNotifies);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSFXGargle = extern struct {
dwRateHz: u32,
dwWaveShape: u32,
};
const IID_IDirectSoundFXGargle_Value = @import("../../zig.zig").Guid.initString("d616f352-d622-11ce-aac5-0020af0b99a3");
pub const IID_IDirectSoundFXGargle = &IID_IDirectSoundFXGargle_Value;
pub const IDirectSoundFXGargle = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundFXGargle,
pcDsFxGargle: ?*DSFXGargle,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundFXGargle,
pDsFxGargle: ?*DSFXGargle,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXGargle_SetAllParameters(self: *const T, pcDsFxGargle: ?*DSFXGargle) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXGargle.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundFXGargle, self), pcDsFxGargle);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXGargle_GetAllParameters(self: *const T, pDsFxGargle: ?*DSFXGargle) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXGargle.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundFXGargle, self), pDsFxGargle);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSFXChorus = extern struct {
fWetDryMix: f32,
fDepth: f32,
fFeedback: f32,
fFrequency: f32,
lWaveform: i32,
fDelay: f32,
lPhase: i32,
};
const IID_IDirectSoundFXChorus_Value = @import("../../zig.zig").Guid.initString("880842e3-145f-43e6-a934-a71806e50547");
pub const IID_IDirectSoundFXChorus = &IID_IDirectSoundFXChorus_Value;
pub const IDirectSoundFXChorus = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundFXChorus,
pcDsFxChorus: ?*DSFXChorus,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundFXChorus,
pDsFxChorus: ?*DSFXChorus,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXChorus_SetAllParameters(self: *const T, pcDsFxChorus: ?*DSFXChorus) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXChorus.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundFXChorus, self), pcDsFxChorus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXChorus_GetAllParameters(self: *const T, pDsFxChorus: ?*DSFXChorus) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXChorus.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundFXChorus, self), pDsFxChorus);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSFXFlanger = extern struct {
fWetDryMix: f32,
fDepth: f32,
fFeedback: f32,
fFrequency: f32,
lWaveform: i32,
fDelay: f32,
lPhase: i32,
};
const IID_IDirectSoundFXFlanger_Value = @import("../../zig.zig").Guid.initString("903e9878-2c92-4072-9b2c-ea68f5396783");
pub const IID_IDirectSoundFXFlanger = &IID_IDirectSoundFXFlanger_Value;
pub const IDirectSoundFXFlanger = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundFXFlanger,
pcDsFxFlanger: ?*DSFXFlanger,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundFXFlanger,
pDsFxFlanger: ?*DSFXFlanger,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXFlanger_SetAllParameters(self: *const T, pcDsFxFlanger: ?*DSFXFlanger) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXFlanger.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundFXFlanger, self), pcDsFxFlanger);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXFlanger_GetAllParameters(self: *const T, pDsFxFlanger: ?*DSFXFlanger) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXFlanger.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundFXFlanger, self), pDsFxFlanger);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSFXEcho = extern struct {
fWetDryMix: f32,
fFeedback: f32,
fLeftDelay: f32,
fRightDelay: f32,
lPanDelay: i32,
};
const IID_IDirectSoundFXEcho_Value = @import("../../zig.zig").Guid.initString("8bd28edf-50db-4e92-a2bd-445488d1ed42");
pub const IID_IDirectSoundFXEcho = &IID_IDirectSoundFXEcho_Value;
pub const IDirectSoundFXEcho = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundFXEcho,
pcDsFxEcho: ?*DSFXEcho,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundFXEcho,
pDsFxEcho: ?*DSFXEcho,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXEcho_SetAllParameters(self: *const T, pcDsFxEcho: ?*DSFXEcho) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXEcho.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundFXEcho, self), pcDsFxEcho);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXEcho_GetAllParameters(self: *const T, pDsFxEcho: ?*DSFXEcho) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXEcho.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundFXEcho, self), pDsFxEcho);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSFXDistortion = extern struct {
fGain: f32,
fEdge: f32,
fPostEQCenterFrequency: f32,
fPostEQBandwidth: f32,
fPreLowpassCutoff: f32,
};
const IID_IDirectSoundFXDistortion_Value = @import("../../zig.zig").Guid.initString("8ecf4326-455f-4d8b-bda9-8d5d3e9e3e0b");
pub const IID_IDirectSoundFXDistortion = &IID_IDirectSoundFXDistortion_Value;
pub const IDirectSoundFXDistortion = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundFXDistortion,
pcDsFxDistortion: ?*DSFXDistortion,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundFXDistortion,
pDsFxDistortion: ?*DSFXDistortion,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXDistortion_SetAllParameters(self: *const T, pcDsFxDistortion: ?*DSFXDistortion) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXDistortion.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundFXDistortion, self), pcDsFxDistortion);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXDistortion_GetAllParameters(self: *const T, pDsFxDistortion: ?*DSFXDistortion) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXDistortion.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundFXDistortion, self), pDsFxDistortion);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSFXCompressor = extern struct {
fGain: f32,
fAttack: f32,
fRelease: f32,
fThreshold: f32,
fRatio: f32,
fPredelay: f32,
};
const IID_IDirectSoundFXCompressor_Value = @import("../../zig.zig").Guid.initString("4bbd1154-62f6-4e2c-a15c-d3b6c417f7a0");
pub const IID_IDirectSoundFXCompressor = &IID_IDirectSoundFXCompressor_Value;
pub const IDirectSoundFXCompressor = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundFXCompressor,
pcDsFxCompressor: ?*DSFXCompressor,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundFXCompressor,
pDsFxCompressor: ?*DSFXCompressor,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXCompressor_SetAllParameters(self: *const T, pcDsFxCompressor: ?*DSFXCompressor) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXCompressor.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundFXCompressor, self), pcDsFxCompressor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXCompressor_GetAllParameters(self: *const T, pDsFxCompressor: ?*DSFXCompressor) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXCompressor.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundFXCompressor, self), pDsFxCompressor);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSFXParamEq = extern struct {
fCenter: f32,
fBandwidth: f32,
fGain: f32,
};
const IID_IDirectSoundFXParamEq_Value = @import("../../zig.zig").Guid.initString("c03ca9fe-fe90-4204-8078-82334cd177da");
pub const IID_IDirectSoundFXParamEq = &IID_IDirectSoundFXParamEq_Value;
pub const IDirectSoundFXParamEq = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundFXParamEq,
pcDsFxParamEq: ?*DSFXParamEq,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundFXParamEq,
pDsFxParamEq: ?*DSFXParamEq,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXParamEq_SetAllParameters(self: *const T, pcDsFxParamEq: ?*DSFXParamEq) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXParamEq.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundFXParamEq, self), pcDsFxParamEq);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXParamEq_GetAllParameters(self: *const T, pDsFxParamEq: ?*DSFXParamEq) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXParamEq.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundFXParamEq, self), pDsFxParamEq);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSFXI3DL2Reverb = extern struct {
lRoom: i32,
lRoomHF: i32,
flRoomRolloffFactor: f32,
flDecayTime: f32,
flDecayHFRatio: f32,
lReflections: i32,
flReflectionsDelay: f32,
lReverb: i32,
flReverbDelay: f32,
flDiffusion: f32,
flDensity: f32,
flHFReference: f32,
};
const IID_IDirectSoundFXI3DL2Reverb_Value = @import("../../zig.zig").Guid.initString("4b166a6a-0d66-43f3-80e3-ee6280dee1a4");
pub const IID_IDirectSoundFXI3DL2Reverb = &IID_IDirectSoundFXI3DL2Reverb_Value;
pub const IDirectSoundFXI3DL2Reverb = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundFXI3DL2Reverb,
pcDsFxI3DL2Reverb: ?*DSFXI3DL2Reverb,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundFXI3DL2Reverb,
pDsFxI3DL2Reverb: ?*DSFXI3DL2Reverb,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPreset: fn(
self: *const IDirectSoundFXI3DL2Reverb,
dwPreset: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPreset: fn(
self: *const IDirectSoundFXI3DL2Reverb,
pdwPreset: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetQuality: fn(
self: *const IDirectSoundFXI3DL2Reverb,
lQuality: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetQuality: fn(
self: *const IDirectSoundFXI3DL2Reverb,
plQuality: ?*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 IDirectSoundFXI3DL2Reverb_SetAllParameters(self: *const T, pcDsFxI3DL2Reverb: ?*DSFXI3DL2Reverb) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXI3DL2Reverb.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundFXI3DL2Reverb, self), pcDsFxI3DL2Reverb);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXI3DL2Reverb_GetAllParameters(self: *const T, pDsFxI3DL2Reverb: ?*DSFXI3DL2Reverb) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXI3DL2Reverb.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundFXI3DL2Reverb, self), pDsFxI3DL2Reverb);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXI3DL2Reverb_SetPreset(self: *const T, dwPreset: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXI3DL2Reverb.VTable, self.vtable).SetPreset(@ptrCast(*const IDirectSoundFXI3DL2Reverb, self), dwPreset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXI3DL2Reverb_GetPreset(self: *const T, pdwPreset: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXI3DL2Reverb.VTable, self.vtable).GetPreset(@ptrCast(*const IDirectSoundFXI3DL2Reverb, self), pdwPreset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXI3DL2Reverb_SetQuality(self: *const T, lQuality: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXI3DL2Reverb.VTable, self.vtable).SetQuality(@ptrCast(*const IDirectSoundFXI3DL2Reverb, self), lQuality);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXI3DL2Reverb_GetQuality(self: *const T, plQuality: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXI3DL2Reverb.VTable, self.vtable).GetQuality(@ptrCast(*const IDirectSoundFXI3DL2Reverb, self), plQuality);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSFXWavesReverb = extern struct {
fInGain: f32,
fReverbMix: f32,
fReverbTime: f32,
fHighFreqRTRatio: f32,
};
const IID_IDirectSoundFXWavesReverb_Value = @import("../../zig.zig").Guid.initString("46858c3a-0dc6-45e3-b760-d4eef16cb325");
pub const IID_IDirectSoundFXWavesReverb = &IID_IDirectSoundFXWavesReverb_Value;
pub const IDirectSoundFXWavesReverb = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundFXWavesReverb,
pcDsFxWavesReverb: ?*DSFXWavesReverb,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundFXWavesReverb,
pDsFxWavesReverb: ?*DSFXWavesReverb,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXWavesReverb_SetAllParameters(self: *const T, pcDsFxWavesReverb: ?*DSFXWavesReverb) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXWavesReverb.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundFXWavesReverb, self), pcDsFxWavesReverb);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFXWavesReverb_GetAllParameters(self: *const T, pDsFxWavesReverb: ?*DSFXWavesReverb) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFXWavesReverb.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundFXWavesReverb, self), pDsFxWavesReverb);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSCFXAec = extern struct {
fEnable: BOOL,
fNoiseFill: BOOL,
dwMode: u32,
};
const IID_IDirectSoundCaptureFXAec_Value = @import("../../zig.zig").Guid.initString("ad74143d-903d-4ab7-8066-28d363036d65");
pub const IID_IDirectSoundCaptureFXAec = &IID_IDirectSoundCaptureFXAec_Value;
pub const IDirectSoundCaptureFXAec = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundCaptureFXAec,
pDscFxAec: ?*DSCFXAec,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundCaptureFXAec,
pDscFxAec: ?*DSCFXAec,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStatus: fn(
self: *const IDirectSoundCaptureFXAec,
pdwStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IDirectSoundCaptureFXAec,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureFXAec_SetAllParameters(self: *const T, pDscFxAec: ?*DSCFXAec) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureFXAec.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundCaptureFXAec, self), pDscFxAec);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureFXAec_GetAllParameters(self: *const T, pDscFxAec: ?*DSCFXAec) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureFXAec.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundCaptureFXAec, self), pDscFxAec);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureFXAec_GetStatus(self: *const T, pdwStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureFXAec.VTable, self.vtable).GetStatus(@ptrCast(*const IDirectSoundCaptureFXAec, self), pdwStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureFXAec_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureFXAec.VTable, self.vtable).Reset(@ptrCast(*const IDirectSoundCaptureFXAec, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DSCFXNoiseSuppress = extern struct {
fEnable: BOOL,
};
const IID_IDirectSoundCaptureFXNoiseSuppress_Value = @import("../../zig.zig").Guid.initString("ed311e41-fbae-4175-9625-cd0854f693ca");
pub const IID_IDirectSoundCaptureFXNoiseSuppress = &IID_IDirectSoundCaptureFXNoiseSuppress_Value;
pub const IDirectSoundCaptureFXNoiseSuppress = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetAllParameters: fn(
self: *const IDirectSoundCaptureFXNoiseSuppress,
pcDscFxNoiseSuppress: ?*DSCFXNoiseSuppress,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAllParameters: fn(
self: *const IDirectSoundCaptureFXNoiseSuppress,
pDscFxNoiseSuppress: ?*DSCFXNoiseSuppress,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IDirectSoundCaptureFXNoiseSuppress,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureFXNoiseSuppress_SetAllParameters(self: *const T, pcDscFxNoiseSuppress: ?*DSCFXNoiseSuppress) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureFXNoiseSuppress.VTable, self.vtable).SetAllParameters(@ptrCast(*const IDirectSoundCaptureFXNoiseSuppress, self), pcDscFxNoiseSuppress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureFXNoiseSuppress_GetAllParameters(self: *const T, pDscFxNoiseSuppress: ?*DSCFXNoiseSuppress) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureFXNoiseSuppress.VTable, self.vtable).GetAllParameters(@ptrCast(*const IDirectSoundCaptureFXNoiseSuppress, self), pDscFxNoiseSuppress);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundCaptureFXNoiseSuppress_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundCaptureFXNoiseSuppress.VTable, self.vtable).Reset(@ptrCast(*const IDirectSoundCaptureFXNoiseSuppress, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectSoundFullDuplex_Value = @import("../../zig.zig").Guid.initString("edcb4c7a-daab-4216-a42e-6c50596ddc1d");
pub const IID_IDirectSoundFullDuplex = &IID_IDirectSoundFullDuplex_Value;
pub const IDirectSoundFullDuplex = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Initialize: fn(
self: *const IDirectSoundFullDuplex,
pCaptureGuid: ?*const Guid,
pRenderGuid: ?*const Guid,
lpDscBufferDesc: ?*DSCBUFFERDESC,
lpDsBufferDesc: ?*DSBUFFERDESC,
hWnd: ?HWND,
dwLevel: u32,
lplpDirectSoundCaptureBuffer8: ?*?*IDirectSoundCaptureBuffer8,
lplpDirectSoundBuffer8: ?*?*IDirectSoundBuffer8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectSoundFullDuplex_Initialize(self: *const T, pCaptureGuid: ?*const Guid, pRenderGuid: ?*const Guid, lpDscBufferDesc: ?*DSCBUFFERDESC, lpDsBufferDesc: ?*DSBUFFERDESC, hWnd: ?HWND, dwLevel: u32, lplpDirectSoundCaptureBuffer8: ?*?*IDirectSoundCaptureBuffer8, lplpDirectSoundBuffer8: ?*?*IDirectSoundBuffer8) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectSoundFullDuplex.VTable, self.vtable).Initialize(@ptrCast(*const IDirectSoundFullDuplex, self), pCaptureGuid, pRenderGuid, lpDscBufferDesc, lpDsBufferDesc, hWnd, dwLevel, lplpDirectSoundCaptureBuffer8, lplpDirectSoundBuffer8);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DMUS_EVENTHEADER = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
cbEvent: u32,
dwChannelGroup: u32,
rtDelta: i64,
dwFlags: u32,
};
pub const DMUS_BUFFERDESC = extern struct {
dwSize: u32,
dwFlags: u32,
guidBufferFormat: Guid,
cbBuffer: u32,
};
pub const DMUS_PORTCAPS = extern struct {
dwSize: u32,
dwFlags: u32,
guidPort: Guid,
dwClass: u32,
dwType: u32,
dwMemorySize: u32,
dwMaxChannelGroups: u32,
dwMaxVoices: u32,
dwMaxAudioChannels: u32,
dwEffectFlags: u32,
wszDescription: [128]u16,
};
pub const _DMUS_PORTPARAMS = extern struct {
dwSize: u32,
dwValidParams: u32,
dwVoices: u32,
dwChannelGroups: u32,
dwAudioChannels: u32,
dwSampleRate: u32,
dwEffectFlags: u32,
fShare: BOOL,
};
pub const DMUS_PORTPARAMS8 = extern struct {
dwSize: u32,
dwValidParams: u32,
dwVoices: u32,
dwChannelGroups: u32,
dwAudioChannels: u32,
dwSampleRate: u32,
dwEffectFlags: u32,
fShare: BOOL,
dwFeatures: u32,
};
pub const DMUS_SYNTHSTATS = extern struct {
dwSize: u32,
dwValidStats: u32,
dwVoices: u32,
dwTotalCPU: u32,
dwCPUPerVoice: u32,
dwLostNotes: u32,
dwFreeMemory: u32,
lPeakVolume: i32,
};
pub const DMUS_SYNTHSTATS8 = extern struct {
dwSize: u32,
dwValidStats: u32,
dwVoices: u32,
dwTotalCPU: u32,
dwCPUPerVoice: u32,
dwLostNotes: u32,
dwFreeMemory: u32,
lPeakVolume: i32,
dwSynthMemUse: u32,
};
pub const DMUS_WAVES_REVERB_PARAMS = extern struct {
fInGain: f32,
fReverbMix: f32,
fReverbTime: f32,
fHighFreqRTRatio: f32,
};
pub const DMUS_CLOCKTYPE = enum(i32) {
SYSTEM = 0,
WAVE = 1,
};
pub const DMUS_CLOCK_SYSTEM = DMUS_CLOCKTYPE.SYSTEM;
pub const DMUS_CLOCK_WAVE = DMUS_CLOCKTYPE.WAVE;
pub const DMUS_CLOCKINFO7 = extern struct {
dwSize: u32,
ctType: DMUS_CLOCKTYPE,
guidClock: Guid,
wszDescription: [128]u16,
};
pub const DMUS_CLOCKINFO8 = extern struct {
dwSize: u32,
ctType: DMUS_CLOCKTYPE,
guidClock: Guid,
wszDescription: [128]u16,
dwFlags: u32,
};
const IID_IDirectMusic_Value = @import("../../zig.zig").Guid.initString("6536115a-7b2d-11d2-ba18-0000f875ac12");
pub const IID_IDirectMusic = &IID_IDirectMusic_Value;
pub const IDirectMusic = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
EnumPort: fn(
self: *const IDirectMusic,
dwIndex: u32,
pPortCaps: ?*DMUS_PORTCAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateMusicBuffer: fn(
self: *const IDirectMusic,
pBufferDesc: ?*DMUS_BUFFERDESC,
ppBuffer: ?*?*IDirectMusicBuffer,
pUnkOuter: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreatePort: fn(
self: *const IDirectMusic,
rclsidPort: ?*const Guid,
pPortParams: ?*DMUS_PORTPARAMS8,
ppPort: ?*?*IDirectMusicPort,
pUnkOuter: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumMasterClock: fn(
self: *const IDirectMusic,
dwIndex: u32,
lpClockInfo: ?*DMUS_CLOCKINFO8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMasterClock: fn(
self: *const IDirectMusic,
pguidClock: ?*Guid,
ppReferenceClock: ?*?*IReferenceClock,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMasterClock: fn(
self: *const IDirectMusic,
rguidClock: ?*const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Activate: fn(
self: *const IDirectMusic,
fEnable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDefaultPort: fn(
self: *const IDirectMusic,
pguidPort: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDirectSound: fn(
self: *const IDirectMusic,
pDirectSound: ?*IDirectSound,
hWnd: ?HWND,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic_EnumPort(self: *const T, dwIndex: u32, pPortCaps: ?*DMUS_PORTCAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic.VTable, self.vtable).EnumPort(@ptrCast(*const IDirectMusic, self), dwIndex, pPortCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic_CreateMusicBuffer(self: *const T, pBufferDesc: ?*DMUS_BUFFERDESC, ppBuffer: ?*?*IDirectMusicBuffer, pUnkOuter: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic.VTable, self.vtable).CreateMusicBuffer(@ptrCast(*const IDirectMusic, self), pBufferDesc, ppBuffer, pUnkOuter);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic_CreatePort(self: *const T, rclsidPort: ?*const Guid, pPortParams: ?*DMUS_PORTPARAMS8, ppPort: ?*?*IDirectMusicPort, pUnkOuter: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic.VTable, self.vtable).CreatePort(@ptrCast(*const IDirectMusic, self), rclsidPort, pPortParams, ppPort, pUnkOuter);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic_EnumMasterClock(self: *const T, dwIndex: u32, lpClockInfo: ?*DMUS_CLOCKINFO8) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic.VTable, self.vtable).EnumMasterClock(@ptrCast(*const IDirectMusic, self), dwIndex, lpClockInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic_GetMasterClock(self: *const T, pguidClock: ?*Guid, ppReferenceClock: ?*?*IReferenceClock) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic.VTable, self.vtable).GetMasterClock(@ptrCast(*const IDirectMusic, self), pguidClock, ppReferenceClock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic_SetMasterClock(self: *const T, rguidClock: ?*const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic.VTable, self.vtable).SetMasterClock(@ptrCast(*const IDirectMusic, self), rguidClock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic_Activate(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic.VTable, self.vtable).Activate(@ptrCast(*const IDirectMusic, self), fEnable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic_GetDefaultPort(self: *const T, pguidPort: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic.VTable, self.vtable).GetDefaultPort(@ptrCast(*const IDirectMusic, self), pguidPort);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic_SetDirectSound(self: *const T, pDirectSound: ?*IDirectSound, hWnd: ?HWND) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic.VTable, self.vtable).SetDirectSound(@ptrCast(*const IDirectMusic, self), pDirectSound, hWnd);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusic8_Value = @import("../../zig.zig").Guid.initString("2d3629f7-813d-4939-8508-f05c6b75fd97");
pub const IID_IDirectMusic8 = &IID_IDirectMusic8_Value;
pub const IDirectMusic8 = extern struct {
pub const VTable = extern struct {
base: IDirectMusic.VTable,
SetExternalMasterClock: fn(
self: *const IDirectMusic8,
pClock: ?*IReferenceClock,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDirectMusic.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusic8_SetExternalMasterClock(self: *const T, pClock: ?*IReferenceClock) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusic8.VTable, self.vtable).SetExternalMasterClock(@ptrCast(*const IDirectMusic8, self), pClock);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicBuffer_Value = @import("../../zig.zig").Guid.initString("d2ac2878-b39b-11d1-8704-00600893b1bd");
pub const IID_IDirectMusicBuffer = &IID_IDirectMusicBuffer_Value;
pub const IDirectMusicBuffer = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Flush: fn(
self: *const IDirectMusicBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
TotalTime: fn(
self: *const IDirectMusicBuffer,
prtTime: ?*i64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PackStructured: fn(
self: *const IDirectMusicBuffer,
rt: i64,
dwChannelGroup: u32,
dwChannelMessage: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PackUnstructured: fn(
self: *const IDirectMusicBuffer,
rt: i64,
dwChannelGroup: u32,
cb: u32,
lpb: ?*u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ResetReadPtr: fn(
self: *const IDirectMusicBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetNextEvent: fn(
self: *const IDirectMusicBuffer,
prt: ?*i64,
pdwChannelGroup: ?*u32,
pdwLength: ?*u32,
ppData: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRawBufferPtr: fn(
self: *const IDirectMusicBuffer,
ppData: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStartTime: fn(
self: *const IDirectMusicBuffer,
prt: ?*i64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetUsedBytes: fn(
self: *const IDirectMusicBuffer,
pcb: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMaxBytes: fn(
self: *const IDirectMusicBuffer,
pcb: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBufferFormat: fn(
self: *const IDirectMusicBuffer,
pGuidFormat: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetStartTime: fn(
self: *const IDirectMusicBuffer,
rt: i64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetUsedBytes: fn(
self: *const IDirectMusicBuffer,
cb: 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 IDirectMusicBuffer_Flush(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).Flush(@ptrCast(*const IDirectMusicBuffer, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_TotalTime(self: *const T, prtTime: ?*i64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).TotalTime(@ptrCast(*const IDirectMusicBuffer, self), prtTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_PackStructured(self: *const T, rt: i64, dwChannelGroup: u32, dwChannelMessage: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).PackStructured(@ptrCast(*const IDirectMusicBuffer, self), rt, dwChannelGroup, dwChannelMessage);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_PackUnstructured(self: *const T, rt: i64, dwChannelGroup: u32, cb: u32, lpb: ?*u8) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).PackUnstructured(@ptrCast(*const IDirectMusicBuffer, self), rt, dwChannelGroup, cb, lpb);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_ResetReadPtr(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).ResetReadPtr(@ptrCast(*const IDirectMusicBuffer, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_GetNextEvent(self: *const T, prt: ?*i64, pdwChannelGroup: ?*u32, pdwLength: ?*u32, ppData: ?*?*u8) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).GetNextEvent(@ptrCast(*const IDirectMusicBuffer, self), prt, pdwChannelGroup, pdwLength, ppData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_GetRawBufferPtr(self: *const T, ppData: ?*?*u8) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).GetRawBufferPtr(@ptrCast(*const IDirectMusicBuffer, self), ppData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_GetStartTime(self: *const T, prt: ?*i64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).GetStartTime(@ptrCast(*const IDirectMusicBuffer, self), prt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_GetUsedBytes(self: *const T, pcb: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).GetUsedBytes(@ptrCast(*const IDirectMusicBuffer, self), pcb);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_GetMaxBytes(self: *const T, pcb: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).GetMaxBytes(@ptrCast(*const IDirectMusicBuffer, self), pcb);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_GetBufferFormat(self: *const T, pGuidFormat: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).GetBufferFormat(@ptrCast(*const IDirectMusicBuffer, self), pGuidFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_SetStartTime(self: *const T, rt: i64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).SetStartTime(@ptrCast(*const IDirectMusicBuffer, self), rt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicBuffer_SetUsedBytes(self: *const T, cb: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicBuffer.VTable, self.vtable).SetUsedBytes(@ptrCast(*const IDirectMusicBuffer, self), cb);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicInstrument_Value = @import("../../zig.zig").Guid.initString("d2ac287d-b39b-11d1-8704-00600893b1bd");
pub const IID_IDirectMusicInstrument = &IID_IDirectMusicInstrument_Value;
pub const IDirectMusicInstrument = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetPatch: fn(
self: *const IDirectMusicInstrument,
pdwPatch: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPatch: fn(
self: *const IDirectMusicInstrument,
dwPatch: 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 IDirectMusicInstrument_GetPatch(self: *const T, pdwPatch: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicInstrument.VTable, self.vtable).GetPatch(@ptrCast(*const IDirectMusicInstrument, self), pdwPatch);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicInstrument_SetPatch(self: *const T, dwPatch: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicInstrument.VTable, self.vtable).SetPatch(@ptrCast(*const IDirectMusicInstrument, self), dwPatch);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicDownloadedInstrument_Value = @import("../../zig.zig").Guid.initString("d2ac287e-b39b-11d1-8704-00600893b1bd");
pub const IID_IDirectMusicDownloadedInstrument = &IID_IDirectMusicDownloadedInstrument_Value;
pub const IDirectMusicDownloadedInstrument = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicCollection_Value = @import("../../zig.zig").Guid.initString("d2ac287c-b39b-11d1-8704-00600893b1bd");
pub const IID_IDirectMusicCollection = &IID_IDirectMusicCollection_Value;
pub const IDirectMusicCollection = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetInstrument: fn(
self: *const IDirectMusicCollection,
dwPatch: u32,
ppInstrument: ?*?*IDirectMusicInstrument,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumInstrument: fn(
self: *const IDirectMusicCollection,
dwIndex: u32,
pdwPatch: ?*u32,
pwszName: ?PWSTR,
dwNameLen: 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 IDirectMusicCollection_GetInstrument(self: *const T, dwPatch: u32, ppInstrument: ?*?*IDirectMusicInstrument) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicCollection.VTable, self.vtable).GetInstrument(@ptrCast(*const IDirectMusicCollection, self), dwPatch, ppInstrument);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicCollection_EnumInstrument(self: *const T, dwIndex: u32, pdwPatch: ?*u32, pwszName: ?PWSTR, dwNameLen: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicCollection.VTable, self.vtable).EnumInstrument(@ptrCast(*const IDirectMusicCollection, self), dwIndex, pdwPatch, pwszName, dwNameLen);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicDownload_Value = @import("../../zig.zig").Guid.initString("d2ac287b-b39b-11d1-8704-00600893b1bd");
pub const IID_IDirectMusicDownload = &IID_IDirectMusicDownload_Value;
pub const IDirectMusicDownload = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetBuffer: fn(
self: *const IDirectMusicDownload,
ppvBuffer: ?*?*c_void,
pdwSize: ?*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 IDirectMusicDownload_GetBuffer(self: *const T, ppvBuffer: ?*?*c_void, pdwSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicDownload.VTable, self.vtable).GetBuffer(@ptrCast(*const IDirectMusicDownload, self), ppvBuffer, pdwSize);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicPortDownload_Value = @import("../../zig.zig").Guid.initString("d2ac287a-b39b-11d1-8704-00600893b1bd");
pub const IID_IDirectMusicPortDownload = &IID_IDirectMusicPortDownload_Value;
pub const IDirectMusicPortDownload = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetBuffer: fn(
self: *const IDirectMusicPortDownload,
dwDLId: u32,
ppIDMDownload: ?*?*IDirectMusicDownload,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AllocateBuffer: fn(
self: *const IDirectMusicPortDownload,
dwSize: u32,
ppIDMDownload: ?*?*IDirectMusicDownload,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDLId: fn(
self: *const IDirectMusicPortDownload,
pdwStartDLId: ?*u32,
dwCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAppend: fn(
self: *const IDirectMusicPortDownload,
pdwAppend: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Download: fn(
self: *const IDirectMusicPortDownload,
pIDMDownload: ?*IDirectMusicDownload,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Unload: fn(
self: *const IDirectMusicPortDownload,
pIDMDownload: ?*IDirectMusicDownload,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPortDownload_GetBuffer(self: *const T, dwDLId: u32, ppIDMDownload: ?*?*IDirectMusicDownload) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPortDownload.VTable, self.vtable).GetBuffer(@ptrCast(*const IDirectMusicPortDownload, self), dwDLId, ppIDMDownload);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPortDownload_AllocateBuffer(self: *const T, dwSize: u32, ppIDMDownload: ?*?*IDirectMusicDownload) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPortDownload.VTable, self.vtable).AllocateBuffer(@ptrCast(*const IDirectMusicPortDownload, self), dwSize, ppIDMDownload);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPortDownload_GetDLId(self: *const T, pdwStartDLId: ?*u32, dwCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPortDownload.VTable, self.vtable).GetDLId(@ptrCast(*const IDirectMusicPortDownload, self), pdwStartDLId, dwCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPortDownload_GetAppend(self: *const T, pdwAppend: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPortDownload.VTable, self.vtable).GetAppend(@ptrCast(*const IDirectMusicPortDownload, self), pdwAppend);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPortDownload_Download(self: *const T, pIDMDownload: ?*IDirectMusicDownload) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPortDownload.VTable, self.vtable).Download(@ptrCast(*const IDirectMusicPortDownload, self), pIDMDownload);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPortDownload_Unload(self: *const T, pIDMDownload: ?*IDirectMusicDownload) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPortDownload.VTable, self.vtable).Unload(@ptrCast(*const IDirectMusicPortDownload, self), pIDMDownload);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicPort_Value = @import("../../zig.zig").Guid.initString("08f2d8c9-37c2-11d2-b9f9-0000f875ac12");
pub const IID_IDirectMusicPort = &IID_IDirectMusicPort_Value;
pub const IDirectMusicPort = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
PlayBuffer: fn(
self: *const IDirectMusicPort,
pBuffer: ?*IDirectMusicBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetReadNotificationHandle: fn(
self: *const IDirectMusicPort,
hEvent: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Read: fn(
self: *const IDirectMusicPort,
pBuffer: ?*IDirectMusicBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DownloadInstrument: fn(
self: *const IDirectMusicPort,
pInstrument: ?*IDirectMusicInstrument,
ppDownloadedInstrument: ?*?*IDirectMusicDownloadedInstrument,
pNoteRanges: ?*DMUS_NOTERANGE,
dwNumNoteRanges: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnloadInstrument: fn(
self: *const IDirectMusicPort,
pDownloadedInstrument: ?*IDirectMusicDownloadedInstrument,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLatencyClock: fn(
self: *const IDirectMusicPort,
ppClock: ?*?*IReferenceClock,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRunningStats: fn(
self: *const IDirectMusicPort,
pStats: ?*DMUS_SYNTHSTATS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Compact: fn(
self: *const IDirectMusicPort,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCaps: fn(
self: *const IDirectMusicPort,
pPortCaps: ?*DMUS_PORTCAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeviceIoControl: fn(
self: *const IDirectMusicPort,
dwIoControlCode: u32,
lpInBuffer: ?*c_void,
nInBufferSize: u32,
lpOutBuffer: ?*c_void,
nOutBufferSize: u32,
lpBytesReturned: ?*u32,
lpOverlapped: ?*OVERLAPPED,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNumChannelGroups: fn(
self: *const IDirectMusicPort,
dwChannelGroups: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetNumChannelGroups: fn(
self: *const IDirectMusicPort,
pdwChannelGroups: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Activate: fn(
self: *const IDirectMusicPort,
fActive: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetChannelPriority: fn(
self: *const IDirectMusicPort,
dwChannelGroup: u32,
dwChannel: u32,
dwPriority: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetChannelPriority: fn(
self: *const IDirectMusicPort,
dwChannelGroup: u32,
dwChannel: u32,
pdwPriority: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDirectSound: fn(
self: *const IDirectMusicPort,
pDirectSound: ?*IDirectSound,
pDirectSoundBuffer: ?*IDirectSoundBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFormat: fn(
self: *const IDirectMusicPort,
pWaveFormatEx: ?*WAVEFORMATEX,
pdwWaveFormatExSize: ?*u32,
pdwBufferSize: ?*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 IDirectMusicPort_PlayBuffer(self: *const T, pBuffer: ?*IDirectMusicBuffer) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).PlayBuffer(@ptrCast(*const IDirectMusicPort, self), pBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_SetReadNotificationHandle(self: *const T, hEvent: ?HANDLE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).SetReadNotificationHandle(@ptrCast(*const IDirectMusicPort, self), hEvent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_Read(self: *const T, pBuffer: ?*IDirectMusicBuffer) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).Read(@ptrCast(*const IDirectMusicPort, self), pBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_DownloadInstrument(self: *const T, pInstrument: ?*IDirectMusicInstrument, ppDownloadedInstrument: ?*?*IDirectMusicDownloadedInstrument, pNoteRanges: ?*DMUS_NOTERANGE, dwNumNoteRanges: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).DownloadInstrument(@ptrCast(*const IDirectMusicPort, self), pInstrument, ppDownloadedInstrument, pNoteRanges, dwNumNoteRanges);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_UnloadInstrument(self: *const T, pDownloadedInstrument: ?*IDirectMusicDownloadedInstrument) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).UnloadInstrument(@ptrCast(*const IDirectMusicPort, self), pDownloadedInstrument);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_GetLatencyClock(self: *const T, ppClock: ?*?*IReferenceClock) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).GetLatencyClock(@ptrCast(*const IDirectMusicPort, self), ppClock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_GetRunningStats(self: *const T, pStats: ?*DMUS_SYNTHSTATS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).GetRunningStats(@ptrCast(*const IDirectMusicPort, self), pStats);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_Compact(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).Compact(@ptrCast(*const IDirectMusicPort, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_GetCaps(self: *const T, pPortCaps: ?*DMUS_PORTCAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).GetCaps(@ptrCast(*const IDirectMusicPort, self), pPortCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_DeviceIoControl(self: *const T, dwIoControlCode: u32, lpInBuffer: ?*c_void, nInBufferSize: u32, lpOutBuffer: ?*c_void, nOutBufferSize: u32, lpBytesReturned: ?*u32, lpOverlapped: ?*OVERLAPPED) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).DeviceIoControl(@ptrCast(*const IDirectMusicPort, self), dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_SetNumChannelGroups(self: *const T, dwChannelGroups: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).SetNumChannelGroups(@ptrCast(*const IDirectMusicPort, self), dwChannelGroups);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_GetNumChannelGroups(self: *const T, pdwChannelGroups: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).GetNumChannelGroups(@ptrCast(*const IDirectMusicPort, self), pdwChannelGroups);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_Activate(self: *const T, fActive: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).Activate(@ptrCast(*const IDirectMusicPort, self), fActive);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_SetChannelPriority(self: *const T, dwChannelGroup: u32, dwChannel: u32, dwPriority: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).SetChannelPriority(@ptrCast(*const IDirectMusicPort, self), dwChannelGroup, dwChannel, dwPriority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_GetChannelPriority(self: *const T, dwChannelGroup: u32, dwChannel: u32, pdwPriority: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).GetChannelPriority(@ptrCast(*const IDirectMusicPort, self), dwChannelGroup, dwChannel, pdwPriority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_SetDirectSound(self: *const T, pDirectSound: ?*IDirectSound, pDirectSoundBuffer: ?*IDirectSoundBuffer) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).SetDirectSound(@ptrCast(*const IDirectMusicPort, self), pDirectSound, pDirectSoundBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicPort_GetFormat(self: *const T, pWaveFormatEx: ?*WAVEFORMATEX, pdwWaveFormatExSize: ?*u32, pdwBufferSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicPort.VTable, self.vtable).GetFormat(@ptrCast(*const IDirectMusicPort, self), pWaveFormatEx, pdwWaveFormatExSize, pdwBufferSize);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicThru_Value = @import("../../zig.zig").Guid.initString("ced153e7-3606-11d2-b9f9-0000f875ac12");
pub const IID_IDirectMusicThru = &IID_IDirectMusicThru_Value;
pub const IDirectMusicThru = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ThruChannel: fn(
self: *const IDirectMusicThru,
dwSourceChannelGroup: u32,
dwSourceChannel: u32,
dwDestinationChannelGroup: u32,
dwDestinationChannel: u32,
pDestinationPort: ?*IDirectMusicPort,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicThru_ThruChannel(self: *const T, dwSourceChannelGroup: u32, dwSourceChannel: u32, dwDestinationChannelGroup: u32, dwDestinationChannel: u32, pDestinationPort: ?*IDirectMusicPort) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicThru.VTable, self.vtable).ThruChannel(@ptrCast(*const IDirectMusicThru, self), dwSourceChannelGroup, dwSourceChannel, dwDestinationChannelGroup, dwDestinationChannel, pDestinationPort);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DMUS_VOICE_STATE = extern struct {
bExists: BOOL,
spPosition: u64,
};
const IID_IDirectMusicSynth_Value = @import("../../zig.zig").Guid.initString("09823661-5c85-11d2-afa6-00aa0024d8b6");
pub const IID_IDirectMusicSynth = &IID_IDirectMusicSynth_Value;
pub const IDirectMusicSynth = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Open: fn(
self: *const IDirectMusicSynth,
pPortParams: ?*DMUS_PORTPARAMS8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Close: fn(
self: *const IDirectMusicSynth,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNumChannelGroups: fn(
self: *const IDirectMusicSynth,
dwGroups: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Download: fn(
self: *const IDirectMusicSynth,
phDownload: ?*?HANDLE,
pvData: ?*c_void,
pbFree: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Unload: fn(
self: *const IDirectMusicSynth,
hDownload: ?HANDLE,
lpFreeHandle: isize,
hUserData: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PlayBuffer: fn(
self: *const IDirectMusicSynth,
rt: i64,
pbBuffer: ?*u8,
cbBuffer: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRunningStats: fn(
self: *const IDirectMusicSynth,
pStats: ?*DMUS_SYNTHSTATS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPortCaps: fn(
self: *const IDirectMusicSynth,
pCaps: ?*DMUS_PORTCAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMasterClock: fn(
self: *const IDirectMusicSynth,
pClock: ?*IReferenceClock,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLatencyClock: fn(
self: *const IDirectMusicSynth,
ppClock: ?*?*IReferenceClock,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Activate: fn(
self: *const IDirectMusicSynth,
fEnable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSynthSink: fn(
self: *const IDirectMusicSynth,
pSynthSink: ?*IDirectMusicSynthSink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Render: fn(
self: *const IDirectMusicSynth,
pBuffer: ?*i16,
dwLength: u32,
llPosition: i64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetChannelPriority: fn(
self: *const IDirectMusicSynth,
dwChannelGroup: u32,
dwChannel: u32,
dwPriority: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetChannelPriority: fn(
self: *const IDirectMusicSynth,
dwChannelGroup: u32,
dwChannel: u32,
pdwPriority: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFormat: fn(
self: *const IDirectMusicSynth,
pWaveFormatEx: ?*WAVEFORMATEX,
pdwWaveFormatExSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAppend: fn(
self: *const IDirectMusicSynth,
pdwAppend: ?*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 IDirectMusicSynth_Open(self: *const T, pPortParams: ?*DMUS_PORTPARAMS8) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).Open(@ptrCast(*const IDirectMusicSynth, self), pPortParams);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_Close(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).Close(@ptrCast(*const IDirectMusicSynth, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_SetNumChannelGroups(self: *const T, dwGroups: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).SetNumChannelGroups(@ptrCast(*const IDirectMusicSynth, self), dwGroups);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_Download(self: *const T, phDownload: ?*?HANDLE, pvData: ?*c_void, pbFree: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).Download(@ptrCast(*const IDirectMusicSynth, self), phDownload, pvData, pbFree);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_Unload(self: *const T, hDownload: ?HANDLE, lpFreeHandle: isize, hUserData: ?HANDLE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).Unload(@ptrCast(*const IDirectMusicSynth, self), hDownload, lpFreeHandle, hUserData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_PlayBuffer(self: *const T, rt: i64, pbBuffer: ?*u8, cbBuffer: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).PlayBuffer(@ptrCast(*const IDirectMusicSynth, self), rt, pbBuffer, cbBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_GetRunningStats(self: *const T, pStats: ?*DMUS_SYNTHSTATS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).GetRunningStats(@ptrCast(*const IDirectMusicSynth, self), pStats);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_GetPortCaps(self: *const T, pCaps: ?*DMUS_PORTCAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).GetPortCaps(@ptrCast(*const IDirectMusicSynth, self), pCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_SetMasterClock(self: *const T, pClock: ?*IReferenceClock) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).SetMasterClock(@ptrCast(*const IDirectMusicSynth, self), pClock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_GetLatencyClock(self: *const T, ppClock: ?*?*IReferenceClock) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).GetLatencyClock(@ptrCast(*const IDirectMusicSynth, self), ppClock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_Activate(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).Activate(@ptrCast(*const IDirectMusicSynth, self), fEnable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_SetSynthSink(self: *const T, pSynthSink: ?*IDirectMusicSynthSink) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).SetSynthSink(@ptrCast(*const IDirectMusicSynth, self), pSynthSink);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_Render(self: *const T, pBuffer: ?*i16, dwLength: u32, llPosition: i64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).Render(@ptrCast(*const IDirectMusicSynth, self), pBuffer, dwLength, llPosition);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_SetChannelPriority(self: *const T, dwChannelGroup: u32, dwChannel: u32, dwPriority: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).SetChannelPriority(@ptrCast(*const IDirectMusicSynth, self), dwChannelGroup, dwChannel, dwPriority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_GetChannelPriority(self: *const T, dwChannelGroup: u32, dwChannel: u32, pdwPriority: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).GetChannelPriority(@ptrCast(*const IDirectMusicSynth, self), dwChannelGroup, dwChannel, pdwPriority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_GetFormat(self: *const T, pWaveFormatEx: ?*WAVEFORMATEX, pdwWaveFormatExSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).GetFormat(@ptrCast(*const IDirectMusicSynth, self), pWaveFormatEx, pdwWaveFormatExSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth_GetAppend(self: *const T, pdwAppend: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth.VTable, self.vtable).GetAppend(@ptrCast(*const IDirectMusicSynth, self), pdwAppend);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicSynth8_Value = @import("../../zig.zig").Guid.initString("53cab625-2711-4c9f-9de7-1b7f925f6fc8");
pub const IID_IDirectMusicSynth8 = &IID_IDirectMusicSynth8_Value;
pub const IDirectMusicSynth8 = extern struct {
pub const VTable = extern struct {
base: IDirectMusicSynth.VTable,
PlayVoice: fn(
self: *const IDirectMusicSynth8,
rt: i64,
dwVoiceId: u32,
dwChannelGroup: u32,
dwChannel: u32,
dwDLId: u32,
prPitch: i32,
vrVolume: i32,
stVoiceStart: u64,
stLoopStart: u64,
stLoopEnd: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StopVoice: fn(
self: *const IDirectMusicSynth8,
rt: i64,
dwVoiceId: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVoiceState: fn(
self: *const IDirectMusicSynth8,
dwVoice: ?*u32,
cbVoice: u32,
dwVoiceState: ?*DMUS_VOICE_STATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Refresh: fn(
self: *const IDirectMusicSynth8,
dwDownloadID: u32,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AssignChannelToBuses: fn(
self: *const IDirectMusicSynth8,
dwChannelGroup: u32,
dwChannel: u32,
pdwBuses: ?*u32,
cBuses: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDirectMusicSynth.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth8_PlayVoice(self: *const T, rt: i64, dwVoiceId: u32, dwChannelGroup: u32, dwChannel: u32, dwDLId: u32, prPitch: i32, vrVolume: i32, stVoiceStart: u64, stLoopStart: u64, stLoopEnd: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth8.VTable, self.vtable).PlayVoice(@ptrCast(*const IDirectMusicSynth8, self), rt, dwVoiceId, dwChannelGroup, dwChannel, dwDLId, prPitch, vrVolume, stVoiceStart, stLoopStart, stLoopEnd);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth8_StopVoice(self: *const T, rt: i64, dwVoiceId: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth8.VTable, self.vtable).StopVoice(@ptrCast(*const IDirectMusicSynth8, self), rt, dwVoiceId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth8_GetVoiceState(self: *const T, dwVoice: ?*u32, cbVoice: u32, dwVoiceState: ?*DMUS_VOICE_STATE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth8.VTable, self.vtable).GetVoiceState(@ptrCast(*const IDirectMusicSynth8, self), dwVoice, cbVoice, dwVoiceState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth8_Refresh(self: *const T, dwDownloadID: u32, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth8.VTable, self.vtable).Refresh(@ptrCast(*const IDirectMusicSynth8, self), dwDownloadID, dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynth8_AssignChannelToBuses(self: *const T, dwChannelGroup: u32, dwChannel: u32, pdwBuses: ?*u32, cBuses: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynth8.VTable, self.vtable).AssignChannelToBuses(@ptrCast(*const IDirectMusicSynth8, self), dwChannelGroup, dwChannel, pdwBuses, cBuses);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDirectMusicSynthSink_Value = @import("../../zig.zig").Guid.initString("09823663-5c85-11d2-afa6-00aa0024d8b6");
pub const IID_IDirectMusicSynthSink = &IID_IDirectMusicSynthSink_Value;
pub const IDirectMusicSynthSink = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Init: fn(
self: *const IDirectMusicSynthSink,
pSynth: ?*IDirectMusicSynth,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMasterClock: fn(
self: *const IDirectMusicSynthSink,
pClock: ?*IReferenceClock,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLatencyClock: fn(
self: *const IDirectMusicSynthSink,
ppClock: ?*?*IReferenceClock,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Activate: fn(
self: *const IDirectMusicSynthSink,
fEnable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SampleToRefTime: fn(
self: *const IDirectMusicSynthSink,
llSampleTime: i64,
prfTime: ?*i64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RefTimeToSample: fn(
self: *const IDirectMusicSynthSink,
rfTime: i64,
pllSampleTime: ?*i64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetDirectSound: fn(
self: *const IDirectMusicSynthSink,
pDirectSound: ?*IDirectSound,
pDirectSoundBuffer: ?*IDirectSoundBuffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDesiredBufferSize: fn(
self: *const IDirectMusicSynthSink,
pdwBufferSizeInSamples: ?*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 IDirectMusicSynthSink_Init(self: *const T, pSynth: ?*IDirectMusicSynth) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynthSink.VTable, self.vtable).Init(@ptrCast(*const IDirectMusicSynthSink, self), pSynth);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynthSink_SetMasterClock(self: *const T, pClock: ?*IReferenceClock) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynthSink.VTable, self.vtable).SetMasterClock(@ptrCast(*const IDirectMusicSynthSink, self), pClock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynthSink_GetLatencyClock(self: *const T, ppClock: ?*?*IReferenceClock) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynthSink.VTable, self.vtable).GetLatencyClock(@ptrCast(*const IDirectMusicSynthSink, self), ppClock);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynthSink_Activate(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynthSink.VTable, self.vtable).Activate(@ptrCast(*const IDirectMusicSynthSink, self), fEnable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynthSink_SampleToRefTime(self: *const T, llSampleTime: i64, prfTime: ?*i64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynthSink.VTable, self.vtable).SampleToRefTime(@ptrCast(*const IDirectMusicSynthSink, self), llSampleTime, prfTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynthSink_RefTimeToSample(self: *const T, rfTime: i64, pllSampleTime: ?*i64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynthSink.VTable, self.vtable).RefTimeToSample(@ptrCast(*const IDirectMusicSynthSink, self), rfTime, pllSampleTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynthSink_SetDirectSound(self: *const T, pDirectSound: ?*IDirectSound, pDirectSoundBuffer: ?*IDirectSoundBuffer) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynthSink.VTable, self.vtable).SetDirectSound(@ptrCast(*const IDirectMusicSynthSink, self), pDirectSound, pDirectSoundBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDirectMusicSynthSink_GetDesiredBufferSize(self: *const T, pdwBufferSizeInSamples: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDirectMusicSynthSink.VTable, self.vtable).GetDesiredBufferSize(@ptrCast(*const IDirectMusicSynthSink, self), pdwBufferSizeInSamples);
}
};}
pub usingnamespace MethodMixin(@This());
};
const CLSID_KSPROPSETID_AudioEffectsDiscovery_Value = @import("../../zig.zig").Guid.initString("0b217a72-16b8-4a4d-bded-f9d6bbedcd8f");
pub const CLSID_KSPROPSETID_AudioEffectsDiscovery = &CLSID_KSPROPSETID_AudioEffectsDiscovery_Value;
pub const KSPROPERTY_AUDIOEFFECTSDISCOVERY = enum(i32) {
T = 1,
};
pub const KSPROPERTY_AUDIOEFFECTSDISCOVERY_EFFECTSLIST = KSPROPERTY_AUDIOEFFECTSDISCOVERY.T;
pub const KSP_PINMODE = extern struct {
PinProperty: KSP_PIN,
AudioProcessingMode: Guid,
};
pub const MDEVICECAPSEX = packed struct {
cbSize: u32,
pCaps: ?*c_void,
};
pub const MIDIOPENDESC = packed struct {
hMidi: ?HMIDI,
dwCallback: usize,
dwInstance: usize,
dnDevNode: usize,
cIds: u32,
rgIds: [1]MIDIOPENSTRMID,
};
//--------------------------------------------------------------------------------
// Section: Functions (10)
//--------------------------------------------------------------------------------
pub extern "DSOUND" fn DirectSoundCreate(
pcGuidDevice: ?*const Guid,
ppDS: ?*?*IDirectSound,
pUnkOuter: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "DSOUND" fn DirectSoundEnumerateA(
pDSEnumCallback: ?LPDSENUMCALLBACKA,
pContext: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "DSOUND" fn DirectSoundEnumerateW(
pDSEnumCallback: ?LPDSENUMCALLBACKW,
pContext: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "DSOUND" fn DirectSoundCaptureCreate(
pcGuidDevice: ?*const Guid,
ppDSC: ?*?*IDirectSoundCapture,
pUnkOuter: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "DSOUND" fn DirectSoundCaptureEnumerateA(
pDSEnumCallback: ?LPDSENUMCALLBACKA,
pContext: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "DSOUND" fn DirectSoundCaptureEnumerateW(
pDSEnumCallback: ?LPDSENUMCALLBACKW,
pContext: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "DSOUND" fn DirectSoundCreate8(
pcGuidDevice: ?*const Guid,
ppDS8: ?*?*IDirectSound8,
pUnkOuter: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "DSOUND" fn DirectSoundCaptureCreate8(
pcGuidDevice: ?*const Guid,
ppDSC8: ?*?*IDirectSoundCapture,
pUnkOuter: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "DSOUND" fn DirectSoundFullDuplexCreate(
pcGuidCaptureDevice: ?*const Guid,
pcGuidRenderDevice: ?*const Guid,
pcDSCBufferDesc: ?*DSCBUFFERDESC,
pcDSBufferDesc: ?*DSBUFFERDESC,
hWnd: ?HWND,
dwLevel: u32,
ppDSFD: ?*?*IDirectSoundFullDuplex,
ppDSCBuffer8: ?*?*IDirectSoundCaptureBuffer8,
ppDSBuffer8: ?*?*IDirectSoundBuffer8,
pUnkOuter: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "DSOUND" fn GetDeviceID(
pGuidSrc: ?*const Guid,
pGuidDest: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (3)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../../zig.zig").unicode_mode) {
.ansi => struct {
pub const LPDSENUMCALLBACK = thismodule.LPDSENUMCALLBACKA;
pub const DirectSoundEnumerate = thismodule.DirectSoundEnumerateA;
pub const DirectSoundCaptureEnumerate = thismodule.DirectSoundCaptureEnumerateA;
},
.wide => struct {
pub const LPDSENUMCALLBACK = thismodule.LPDSENUMCALLBACKW;
pub const DirectSoundEnumerate = thismodule.DirectSoundEnumerateW;
pub const DirectSoundCaptureEnumerate = thismodule.DirectSoundCaptureEnumerateW;
},
.unspecified => if (@import("builtin").is_test) struct {
pub const LPDSENUMCALLBACK = *opaque{};
pub const DirectSoundEnumerate = *opaque{};
pub const DirectSoundCaptureEnumerate = *opaque{};
} else struct {
pub const LPDSENUMCALLBACK = @compileError("'LPDSENUMCALLBACK' requires that UNICODE be set to true or false in the root module");
pub const DirectSoundEnumerate = @compileError("'DirectSoundEnumerate' requires that UNICODE be set to true or false in the root module");
pub const DirectSoundCaptureEnumerate = @compileError("'DirectSoundCaptureEnumerate' requires that UNICODE be set to true or false in the root module");
},
};
//--------------------------------------------------------------------------------
// Section: Imports (19)
//--------------------------------------------------------------------------------
const Guid = @import("../../zig.zig").Guid;
const APO_CONNECTION_PROPERTY = @import("../../system/remote_desktop.zig").APO_CONNECTION_PROPERTY;
const BOOL = @import("../../foundation.zig").BOOL;
const D3DVECTOR = @import("../../graphics/direct3d9.zig").D3DVECTOR;
const HANDLE = @import("../../foundation.zig").HANDLE;
const HMIDI = @import("../../media/multimedia.zig").HMIDI;
const HRESULT = @import("../../foundation.zig").HRESULT;
const HWND = @import("../../foundation.zig").HWND;
const IMMDeviceCollection = @import("../../media/audio/core_audio.zig").IMMDeviceCollection;
const IPropertyStore = @import("../../system/properties_system.zig").IPropertyStore;
const IReferenceClock = @import("../../graphics/direct_show.zig").IReferenceClock;
const IUnknown = @import("../../system/com.zig").IUnknown;
const KSP_PIN = @import("../../media/audio/core_audio.zig").KSP_PIN;
const LPARAM = @import("../../foundation.zig").LPARAM;
const MIDIOPENSTRMID = @import("../../media/multimedia.zig").MIDIOPENSTRMID;
const OVERLAPPED = @import("../../system/system_services.zig").OVERLAPPED;
const PSTR = @import("../../foundation.zig").PSTR;
const PWSTR = @import("../../foundation.zig").PWSTR;
const WAVEFORMATEX = @import("../../media/multimedia.zig").WAVEFORMATEX;
test {
// The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
if (@hasDecl(@This(), "FNAPONOTIFICATIONCALLBACK")) { _ = FNAPONOTIFICATIONCALLBACK; }
if (@hasDecl(@This(), "LPDSENUMCALLBACKA")) { _ = LPDSENUMCALLBACKA; }
if (@hasDecl(@This(), "LPDSENUMCALLBACKW")) { _ = LPDSENUMCALLBACKW; }
@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/media/audio/direct_music.zig |
Subsets and Splits