code
stringlengths
38
801k
repo_path
stringlengths
6
263
pub const WM_CAP_START = @as(u32, 1024); pub const MODM_USER = @as(u32, 16384); pub const MIDM_USER = @as(u32, 16384); pub const MODM_MAPPER = @as(u32, 8192); pub const MIDM_MAPPER = @as(u32, 8192); pub const MODM_INIT = @as(u32, 100); pub const MIDM_INIT = @as(u32, 100); pub const MODM_INIT_EX = @as(u32, 104); pub const MIDM_INIT_EX = @as(u32, 104); pub const DRV_MCI_FIRST = @as(u32, 2048); pub const ACMDM_BASE = @as(u32, 24576); pub const ICM_RESERVED = @as(u32, 20480); pub const MCI_TEST = @as(i32, 32); pub const MCI_CAPTURE = @as(u32, 2160); pub const MCI_MONITOR = @as(u32, 2161); pub const MCI_RESERVE = @as(u32, 2162); pub const MCI_SETAUDIO = @as(u32, 2163); pub const MCI_SIGNAL = @as(u32, 2165); pub const MCI_SETVIDEO = @as(u32, 2166); pub const MCI_QUALITY = @as(u32, 2167); pub const MCI_LIST = @as(u32, 2168); pub const MCI_UNDO = @as(u32, 2169); pub const MCI_CONFIGURE = @as(u32, 2170); pub const MCI_RESTORE = @as(u32, 2171); pub const MCI_ON = @as(u32, 1); pub const MCI_OFF = @as(u32, 0); pub const MCI_DGV_FILE_MODE_SAVING = @as(u32, 1); pub const MCI_DGV_FILE_MODE_LOADING = @as(u32, 2); pub const MCI_DGV_FILE_MODE_EDITING = @as(u32, 3); pub const MCI_DGV_FILE_MODE_IDLE = @as(u32, 4); pub const MCI_ON_S = @as(i32, 32768); pub const MCI_OFF_S = @as(i32, 32769); pub const MCI_DGV_FILE_S = @as(i32, 32770); pub const MCI_DGV_INPUT_S = @as(i32, 32771); pub const MCI_DGV_FILE_MODE_SAVING_S = @as(i32, 32772); pub const MCI_DGV_FILE_MODE_LOADING_S = @as(i32, 32773); pub const MCI_DGV_FILE_MODE_EDITING_S = @as(i32, 32774); pub const MCI_DGV_FILE_MODE_IDLE_S = @as(i32, 32775); pub const MCI_DGV_SETVIDEO_SRC_NTSC_S = @as(i32, 32784); pub const MCI_DGV_SETVIDEO_SRC_RGB_S = @as(i32, 32785); pub const MCI_DGV_SETVIDEO_SRC_SVIDEO_S = @as(i32, 32786); pub const MCI_DGV_SETVIDEO_SRC_PAL_S = @as(i32, 32787); pub const MCI_DGV_SETVIDEO_SRC_SECAM_S = @as(i32, 32788); pub const MCI_DGV_SETVIDEO_SRC_GENERIC_S = @as(i32, 32789); pub const MCI_DGV_SETAUDIO_SRC_LEFT_S = @as(i32, 32800); pub const MCI_DGV_SETAUDIO_SRC_RIGHT_S = @as(i32, 32801); pub const MCI_DGV_SETAUDIO_SRC_AVERAGE_S = @as(i32, 32802); pub const MCI_DGV_SETAUDIO_SRC_STEREO_S = @as(i32, 32803); pub const MCIERR_DGV_DEVICE_LIMIT = @as(u32, 512); pub const MCIERR_DGV_IOERR = @as(u32, 513); pub const MCIERR_DGV_WORKSPACE_EMPTY = @as(u32, 514); pub const MCIERR_DGV_DISK_FULL = @as(u32, 515); pub const MCIERR_DGV_DEVICE_MEMORY_FULL = @as(u32, 516); pub const MCIERR_DGV_BAD_CLIPBOARD_RANGE = @as(u32, 517); pub const MCI_DGV_METHOD_PRE = @as(i32, 40960); pub const MCI_DGV_METHOD_POST = @as(i32, 40961); pub const MCI_DGV_METHOD_DIRECT = @as(i32, 40962); pub const MCI_DGV_FF_AVSS = @as(i32, 16384); pub const MCI_DGV_FF_AVI = @as(i32, 16385); pub const MCI_DGV_FF_DIB = @as(i32, 16386); pub const MCI_DGV_FF_RDIB = @as(i32, 16387); pub const MCI_DGV_FF_JPEG = @as(i32, 16388); pub const MCI_DGV_FF_RJPEG = @as(i32, 16389); pub const MCI_DGV_FF_JFIF = @as(i32, 16390); pub const MCI_DGV_FF_MPEG = @as(i32, 16391); pub const MCI_DGV_GETDEVCAPS_CAN_LOCK = @as(i32, 16384); pub const MCI_DGV_GETDEVCAPS_CAN_STRETCH = @as(i32, 16385); pub const MCI_DGV_GETDEVCAPS_CAN_FREEZE = @as(i32, 16386); pub const MCI_DGV_GETDEVCAPS_MAX_WINDOWS = @as(i32, 16387); pub const MCI_DGV_GETDEVCAPS_CAN_REVERSE = @as(i32, 16388); pub const MCI_DGV_GETDEVCAPS_HAS_STILL = @as(i32, 16389); pub const MCI_DGV_GETDEVCAPS_PALETTES = @as(i32, 16390); pub const MCI_DGV_GETDEVCAPS_CAN_STR_IN = @as(i32, 16392); pub const MCI_DGV_GETDEVCAPS_CAN_TEST = @as(i32, 16393); pub const MCI_DGV_GETDEVCAPS_MAXIMUM_RATE = @as(i32, 16394); pub const MCI_DGV_GETDEVCAPS_MINIMUM_RATE = @as(i32, 16395); pub const MCI_DGV_CAPTURE_AS = @as(i32, 65536); pub const MCI_DGV_CAPTURE_AT = @as(i32, 131072); pub const MCI_DGV_COPY_AT = @as(i32, 65536); pub const MCI_DGV_COPY_AUDIO_STREAM = @as(i32, 131072); pub const MCI_DGV_COPY_VIDEO_STREAM = @as(i32, 262144); pub const MCI_DGV_CUE_INPUT = @as(i32, 65536); pub const MCI_DGV_CUE_OUTPUT = @as(i32, 131072); pub const MCI_DGV_CUE_NOSHOW = @as(i32, 262144); pub const MCI_DGV_CUT_AT = @as(i32, 65536); pub const MCI_DGV_CUT_AUDIO_STREAM = @as(i32, 131072); pub const MCI_DGV_CUT_VIDEO_STREAM = @as(i32, 262144); pub const MCI_DGV_DELETE_AT = @as(i32, 65536); pub const MCI_DGV_DELETE_AUDIO_STREAM = @as(i32, 131072); pub const MCI_DGV_DELETE_VIDEO_STREAM = @as(i32, 262144); pub const MCI_DGV_FREEZE_AT = @as(i32, 65536); pub const MCI_DGV_FREEZE_OUTSIDE = @as(i32, 131072); pub const MCI_DGV_INFO_TEXT = @as(i32, 65536); pub const MCI_DGV_INFO_ITEM = @as(i32, 131072); pub const MCI_INFO_VERSION = @as(i32, 1024); pub const MCI_DGV_INFO_USAGE = @as(i32, 16384); pub const MCI_DGV_INFO_AUDIO_QUALITY = @as(i32, 16385); pub const MCI_DGV_INFO_STILL_QUALITY = @as(i32, 16386); pub const MCI_DGV_INFO_VIDEO_QUALITY = @as(i32, 16387); pub const MCI_DGV_INFO_AUDIO_ALG = @as(i32, 16388); pub const MCI_DGV_INFO_STILL_ALG = @as(i32, 16389); pub const MCI_DGV_INFO_VIDEO_ALG = @as(i32, 16390); pub const MCI_DGV_LIST_ITEM = @as(i32, 65536); pub const MCI_DGV_LIST_COUNT = @as(i32, 131072); pub const MCI_DGV_LIST_NUMBER = @as(i32, 262144); pub const MCI_DGV_LIST_ALG = @as(i32, 524288); pub const MCI_DGV_LIST_AUDIO_ALG = @as(i32, 16384); pub const MCI_DGV_LIST_AUDIO_QUALITY = @as(i32, 16385); pub const MCI_DGV_LIST_AUDIO_STREAM = @as(i32, 16386); pub const MCI_DGV_LIST_STILL_ALG = @as(i32, 16387); pub const MCI_DGV_LIST_STILL_QUALITY = @as(i32, 16388); pub const MCI_DGV_LIST_VIDEO_ALG = @as(i32, 16389); pub const MCI_DGV_LIST_VIDEO_QUALITY = @as(i32, 16390); pub const MCI_DGV_LIST_VIDEO_STREAM = @as(i32, 16391); pub const MCI_DGV_LIST_VIDEO_SOURCE = @as(i32, 16392); pub const MCI_DGV_MONITOR_METHOD = @as(i32, 65536); pub const MCI_DGV_MONITOR_SOURCE = @as(i32, 131072); pub const MCI_DGV_MONITOR_INPUT = @as(i32, 16384); pub const MCI_DGV_MONITOR_FILE = @as(i32, 16385); pub const MCI_DGV_OPEN_WS = @as(i32, 65536); pub const MCI_DGV_OPEN_PARENT = @as(i32, 131072); pub const MCI_DGV_OPEN_NOSTATIC = @as(i32, 262144); pub const MCI_DGV_OPEN_16BIT = @as(i32, 524288); pub const MCI_DGV_OPEN_32BIT = @as(i32, 1048576); pub const MCI_DGV_PASTE_AT = @as(i32, 65536); pub const MCI_DGV_PASTE_AUDIO_STREAM = @as(i32, 131072); pub const MCI_DGV_PASTE_VIDEO_STREAM = @as(i32, 262144); pub const MCI_DGV_PASTE_INSERT = @as(i32, 524288); pub const MCI_DGV_PASTE_OVERWRITE = @as(i32, 1048576); pub const MCI_DGV_PLAY_REPEAT = @as(i32, 65536); pub const MCI_DGV_PLAY_REVERSE = @as(i32, 131072); pub const MCI_DGV_RECT = @as(i32, 65536); pub const MCI_DGV_PUT_SOURCE = @as(i32, 131072); pub const MCI_DGV_PUT_DESTINATION = @as(i32, 262144); pub const MCI_DGV_PUT_FRAME = @as(i32, 524288); pub const MCI_DGV_PUT_VIDEO = @as(i32, 1048576); pub const MCI_DGV_PUT_WINDOW = @as(i32, 2097152); pub const MCI_DGV_PUT_CLIENT = @as(i32, 4194304); pub const MCI_QUALITY_ITEM = @as(i32, 65536); pub const MCI_QUALITY_NAME = @as(i32, 131072); pub const MCI_QUALITY_ALG = @as(i32, 262144); pub const MCI_QUALITY_DIALOG = @as(i32, 524288); pub const MCI_QUALITY_HANDLE = @as(i32, 1048576); pub const MCI_QUALITY_ITEM_AUDIO = @as(i32, 16384); pub const MCI_QUALITY_ITEM_STILL = @as(i32, 16385); pub const MCI_QUALITY_ITEM_VIDEO = @as(i32, 16386); pub const MCI_DGV_REALIZE_NORM = @as(i32, 65536); pub const MCI_DGV_REALIZE_BKGD = @as(i32, 131072); pub const MCI_DGV_RECORD_HOLD = @as(i32, 131072); pub const MCI_DGV_RECORD_AUDIO_STREAM = @as(i32, 262144); pub const MCI_DGV_RECORD_VIDEO_STREAM = @as(i32, 524288); pub const MCI_DGV_RESERVE_IN = @as(i32, 65536); pub const MCI_DGV_RESERVE_SIZE = @as(i32, 131072); pub const MCI_DGV_RESTORE_FROM = @as(i32, 65536); pub const MCI_DGV_RESTORE_AT = @as(i32, 131072); pub const MCI_DGV_SAVE_ABORT = @as(i32, 131072); pub const MCI_DGV_SAVE_KEEPRESERVE = @as(i32, 262144); pub const MCI_DGV_SET_SEEK_EXACTLY = @as(i32, 65536); pub const MCI_DGV_SET_SPEED = @as(i32, 131072); pub const MCI_DGV_SET_STILL = @as(i32, 262144); pub const MCI_DGV_SET_FILEFORMAT = @as(i32, 524288); pub const MCI_DGV_SETAUDIO_OVER = @as(i32, 65536); pub const MCI_DGV_SETAUDIO_CLOCKTIME = @as(i32, 131072); pub const MCI_DGV_SETAUDIO_ALG = @as(i32, 262144); pub const MCI_DGV_SETAUDIO_QUALITY = @as(i32, 524288); pub const MCI_DGV_SETAUDIO_RECORD = @as(i32, 1048576); pub const MCI_DGV_SETAUDIO_LEFT = @as(i32, 2097152); pub const MCI_DGV_SETAUDIO_RIGHT = @as(i32, 4194304); pub const MCI_DGV_SETAUDIO_ITEM = @as(i32, 8388608); pub const MCI_DGV_SETAUDIO_VALUE = @as(i32, 16777216); pub const MCI_DGV_SETAUDIO_INPUT = @as(i32, 33554432); pub const MCI_DGV_SETAUDIO_OUTPUT = @as(i32, 67108864); pub const MCI_DGV_SETAUDIO_TREBLE = @as(i32, 16384); pub const MCI_DGV_SETAUDIO_BASS = @as(i32, 16385); pub const MCI_DGV_SETAUDIO_VOLUME = @as(i32, 16386); pub const MCI_DGV_SETAUDIO_STREAM = @as(i32, 16387); pub const MCI_DGV_SETAUDIO_SOURCE = @as(i32, 16388); pub const MCI_DGV_SETAUDIO_SAMPLESPERSEC = @as(i32, 16389); pub const MCI_DGV_SETAUDIO_AVGBYTESPERSEC = @as(i32, 16390); pub const MCI_DGV_SETAUDIO_BLOCKALIGN = @as(i32, 16391); pub const MCI_DGV_SETAUDIO_BITSPERSAMPLE = @as(i32, 16392); pub const MCI_DGV_SETAUDIO_SOURCE_STEREO = @as(i32, 0); pub const MCI_DGV_SETAUDIO_SOURCE_LEFT = @as(i32, 1); pub const MCI_DGV_SETAUDIO_SOURCE_RIGHT = @as(i32, 2); pub const MCI_DGV_SETAUDIO_SOURCE_AVERAGE = @as(i32, 16384); pub const MCI_DGV_SETVIDEO_QUALITY = @as(i32, 65536); pub const MCI_DGV_SETVIDEO_ALG = @as(i32, 131072); pub const MCI_DGV_SETVIDEO_CLOCKTIME = @as(i32, 262144); pub const MCI_DGV_SETVIDEO_SRC_NUMBER = @as(i32, 524288); pub const MCI_DGV_SETVIDEO_ITEM = @as(i32, 1048576); pub const MCI_DGV_SETVIDEO_OVER = @as(i32, 2097152); pub const MCI_DGV_SETVIDEO_RECORD = @as(i32, 4194304); pub const MCI_DGV_SETVIDEO_STILL = @as(i32, 8388608); pub const MCI_DGV_SETVIDEO_VALUE = @as(i32, 16777216); pub const MCI_DGV_SETVIDEO_INPUT = @as(i32, 33554432); pub const MCI_DGV_SETVIDEO_OUTPUT = @as(i32, 67108864); pub const MCI_DGV_SETVIDEO_SRC_NTSC = @as(i32, 16384); pub const MCI_DGV_SETVIDEO_SRC_RGB = @as(i32, 16385); pub const MCI_DGV_SETVIDEO_SRC_SVIDEO = @as(i32, 16386); pub const MCI_DGV_SETVIDEO_SRC_PAL = @as(i32, 16387); pub const MCI_DGV_SETVIDEO_SRC_SECAM = @as(i32, 16388); pub const MCI_DGV_SETVIDEO_SRC_GENERIC = @as(i32, 16389); pub const MCI_DGV_SETVIDEO_BRIGHTNESS = @as(i32, 16384); pub const MCI_DGV_SETVIDEO_COLOR = @as(i32, 16385); pub const MCI_DGV_SETVIDEO_CONTRAST = @as(i32, 16386); pub const MCI_DGV_SETVIDEO_TINT = @as(i32, 16387); pub const MCI_DGV_SETVIDEO_SHARPNESS = @as(i32, 16388); pub const MCI_DGV_SETVIDEO_GAMMA = @as(i32, 16389); pub const MCI_DGV_SETVIDEO_STREAM = @as(i32, 16390); pub const MCI_DGV_SETVIDEO_PALHANDLE = @as(i32, 16391); pub const MCI_DGV_SETVIDEO_FRAME_RATE = @as(i32, 16392); pub const MCI_DGV_SETVIDEO_SOURCE = @as(i32, 16393); pub const MCI_DGV_SETVIDEO_KEY_INDEX = @as(i32, 16394); pub const MCI_DGV_SETVIDEO_KEY_COLOR = @as(i32, 16395); pub const MCI_DGV_SETVIDEO_BITSPERPEL = @as(i32, 16396); pub const MCI_DGV_SIGNAL_AT = @as(i32, 65536); pub const MCI_DGV_SIGNAL_EVERY = @as(i32, 131072); pub const MCI_DGV_SIGNAL_USERVAL = @as(i32, 262144); pub const MCI_DGV_SIGNAL_CANCEL = @as(i32, 524288); pub const MCI_DGV_SIGNAL_POSITION = @as(i32, 1048576); pub const MCI_DGV_STATUS_NOMINAL = @as(i32, 131072); pub const MCI_DGV_STATUS_REFERENCE = @as(i32, 262144); pub const MCI_DGV_STATUS_LEFT = @as(i32, 524288); pub const MCI_DGV_STATUS_RIGHT = @as(i32, 1048576); pub const MCI_DGV_STATUS_DISKSPACE = @as(i32, 2097152); pub const MCI_DGV_STATUS_INPUT = @as(i32, 4194304); pub const MCI_DGV_STATUS_OUTPUT = @as(i32, 8388608); pub const MCI_DGV_STATUS_RECORD = @as(i32, 16777216); pub const MCI_DGV_STATUS_AUDIO_INPUT = @as(i32, 16384); pub const MCI_DGV_STATUS_HWND = @as(i32, 16385); pub const MCI_DGV_STATUS_SPEED = @as(i32, 16387); pub const MCI_DGV_STATUS_HPAL = @as(i32, 16388); pub const MCI_DGV_STATUS_BRIGHTNESS = @as(i32, 16389); pub const MCI_DGV_STATUS_COLOR = @as(i32, 16390); pub const MCI_DGV_STATUS_CONTRAST = @as(i32, 16391); pub const MCI_DGV_STATUS_FILEFORMAT = @as(i32, 16392); pub const MCI_DGV_STATUS_AUDIO_SOURCE = @as(i32, 16393); pub const MCI_DGV_STATUS_GAMMA = @as(i32, 16394); pub const MCI_DGV_STATUS_MONITOR = @as(i32, 16395); pub const MCI_DGV_STATUS_MONITOR_METHOD = @as(i32, 16396); pub const MCI_DGV_STATUS_FRAME_RATE = @as(i32, 16398); pub const MCI_DGV_STATUS_BASS = @as(i32, 16399); pub const MCI_DGV_STATUS_SIZE = @as(i32, 16400); pub const MCI_DGV_STATUS_SEEK_EXACTLY = @as(i32, 16401); pub const MCI_DGV_STATUS_SHARPNESS = @as(i32, 16402); pub const MCI_DGV_STATUS_SMPTE = @as(i32, 16403); pub const MCI_DGV_STATUS_AUDIO = @as(i32, 16404); pub const MCI_DGV_STATUS_TINT = @as(i32, 16405); pub const MCI_DGV_STATUS_TREBLE = @as(i32, 16406); pub const MCI_DGV_STATUS_UNSAVED = @as(i32, 16407); pub const MCI_DGV_STATUS_VIDEO = @as(i32, 16408); pub const MCI_DGV_STATUS_VOLUME = @as(i32, 16409); pub const MCI_DGV_STATUS_AUDIO_RECORD = @as(i32, 16410); pub const MCI_DGV_STATUS_VIDEO_SOURCE = @as(i32, 16411); pub const MCI_DGV_STATUS_VIDEO_RECORD = @as(i32, 16412); pub const MCI_DGV_STATUS_STILL_FILEFORMAT = @as(i32, 16413); pub const MCI_DGV_STATUS_VIDEO_SRC_NUM = @as(i32, 16414); pub const MCI_DGV_STATUS_FILE_MODE = @as(i32, 16415); pub const MCI_DGV_STATUS_FILE_COMPLETION = @as(i32, 16416); pub const MCI_DGV_STATUS_WINDOW_VISIBLE = @as(i32, 16417); pub const MCI_DGV_STATUS_WINDOW_MINIMIZED = @as(i32, 16418); pub const MCI_DGV_STATUS_WINDOW_MAXIMIZED = @as(i32, 16419); pub const MCI_DGV_STATUS_KEY_INDEX = @as(i32, 16420); pub const MCI_DGV_STATUS_KEY_COLOR = @as(i32, 16421); pub const MCI_DGV_STATUS_PAUSE_MODE = @as(i32, 16422); pub const MCI_DGV_STATUS_SAMPLESPERSEC = @as(i32, 16423); pub const MCI_DGV_STATUS_AVGBYTESPERSEC = @as(i32, 16424); pub const MCI_DGV_STATUS_BLOCKALIGN = @as(i32, 16425); pub const MCI_DGV_STATUS_BITSPERSAMPLE = @as(i32, 16426); pub const MCI_DGV_STATUS_BITSPERPEL = @as(i32, 16427); pub const MCI_DGV_STATUS_FORWARD = @as(i32, 16428); pub const MCI_DGV_STATUS_AUDIO_STREAM = @as(i32, 16429); pub const MCI_DGV_STATUS_VIDEO_STREAM = @as(i32, 16430); pub const MCI_DGV_STEP_REVERSE = @as(i32, 65536); pub const MCI_DGV_STEP_FRAMES = @as(i32, 131072); pub const MCI_DGV_STOP_HOLD = @as(i32, 65536); pub const MCI_DGV_UPDATE_HDC = @as(i32, 131072); pub const MCI_DGV_UPDATE_PAINT = @as(i32, 262144); pub const MCI_DGV_WHERE_SOURCE = @as(i32, 131072); pub const MCI_DGV_WHERE_DESTINATION = @as(i32, 262144); pub const MCI_DGV_WHERE_FRAME = @as(i32, 524288); pub const MCI_DGV_WHERE_VIDEO = @as(i32, 1048576); pub const MCI_DGV_WHERE_WINDOW = @as(i32, 2097152); pub const MCI_DGV_WHERE_MAX = @as(i32, 4194304); pub const MCI_DGV_WINDOW_HWND = @as(i32, 65536); pub const MCI_DGV_WINDOW_STATE = @as(i32, 262144); pub const MCI_DGV_WINDOW_TEXT = @as(i32, 524288); pub const MCI_DGV_WINDOW_DEFAULT = @as(i32, 0); pub const MM_CREATIVE = @as(u32, 2); pub const MM_MEDIAVISION = @as(u32, 3); pub const MM_FUJITSU = @as(u32, 4); pub const MM_PRAGMATRAX = @as(u32, 5); pub const MM_CYRIX = @as(u32, 6); pub const MM_PHILIPS_SPEECH_PROCESSING = @as(u32, 7); pub const MM_NETXL = @as(u32, 8); pub const MM_ZYXEL = @as(u32, 9); pub const MM_BECUBED = @as(u32, 10); pub const MM_AARDVARK = @as(u32, 11); pub const MM_BINTEC = @as(u32, 12); pub const MM_HEWLETT_PACKARD = @as(u32, 13); pub const MM_ACULAB = @as(u32, 14); pub const MM_FAITH = @as(u32, 15); pub const MM_MITEL = @as(u32, 16); pub const MM_QUANTUM3D = @as(u32, 17); pub const MM_SNI = @as(u32, 18); pub const MM_EMU = @as(u32, 19); pub const MM_ARTISOFT = @as(u32, 20); pub const MM_TURTLE_BEACH = @as(u32, 21); pub const MM_IBM = @as(u32, 22); pub const MM_VOCALTEC = @as(u32, 23); pub const MM_ROLAND = @as(u32, 24); pub const MM_DSP_SOLUTIONS = @as(u32, 25); pub const MM_NEC = @as(u32, 26); pub const MM_ATI = @as(u32, 27); pub const MM_WANGLABS = @as(u32, 28); pub const MM_TANDY = @as(u32, 29); pub const MM_VOYETRA = @as(u32, 30); pub const MM_ANTEX = @as(u32, 31); pub const MM_ICL_PS = @as(u32, 32); pub const MM_INTEL = @as(u32, 33); pub const MM_GRAVIS = @as(u32, 34); pub const MM_VAL = @as(u32, 35); pub const MM_INTERACTIVE = @as(u32, 36); pub const MM_YAMAHA = @as(u32, 37); pub const MM_EVEREX = @as(u32, 38); pub const MM_ECHO = @as(u32, 39); pub const MM_SIERRA = @as(u32, 40); pub const MM_CAT = @as(u32, 41); pub const MM_APPS = @as(u32, 42); pub const MM_DSP_GROUP = @as(u32, 43); pub const MM_MELABS = @as(u32, 44); pub const MM_COMPUTER_FRIENDS = @as(u32, 45); pub const MM_ESS = @as(u32, 46); pub const MM_AUDIOFILE = @as(u32, 47); pub const MM_MOTOROLA = @as(u32, 48); pub const MM_CANOPUS = @as(u32, 49); pub const MM_EPSON = @as(u32, 50); pub const MM_TRUEVISION = @as(u32, 51); pub const MM_AZTECH = @as(u32, 52); pub const MM_VIDEOLOGIC = @as(u32, 53); pub const MM_SCALACS = @as(u32, 54); pub const MM_KORG = @as(u32, 55); pub const MM_APT = @as(u32, 56); pub const MM_ICS = @as(u32, 57); pub const MM_ITERATEDSYS = @as(u32, 58); pub const MM_METHEUS = @as(u32, 59); pub const MM_LOGITECH = @as(u32, 60); pub const MM_WINNOV = @as(u32, 61); pub const MM_NCR = @as(u32, 62); pub const MM_EXAN = @as(u32, 63); pub const MM_AST = @as(u32, 64); pub const MM_WILLOWPOND = @as(u32, 65); pub const MM_SONICFOUNDRY = @as(u32, 66); pub const MM_VITEC = @as(u32, 67); pub const MM_MOSCOM = @as(u32, 68); pub const MM_SILICONSOFT = @as(u32, 69); pub const MM_TERRATEC = @as(u32, 70); pub const MM_MEDIASONIC = @as(u32, 71); pub const MM_SANYO = @as(u32, 72); pub const MM_SUPERMAC = @as(u32, 73); pub const MM_AUDIOPT = @as(u32, 74); pub const MM_NOGATECH = @as(u32, 75); pub const MM_SPEECHCOMP = @as(u32, 76); pub const MM_AHEAD = @as(u32, 77); pub const MM_DOLBY = @as(u32, 78); pub const MM_OKI = @as(u32, 79); pub const MM_AURAVISION = @as(u32, 80); pub const MM_OLIVETTI = @as(u32, 81); pub const MM_IOMAGIC = @as(u32, 82); pub const MM_MATSUSHITA = @as(u32, 83); pub const MM_CONTROLRES = @as(u32, 84); pub const MM_XEBEC = @as(u32, 85); pub const MM_NEWMEDIA = @as(u32, 86); pub const MM_NMS = @as(u32, 87); pub const MM_LYRRUS = @as(u32, 88); pub const MM_COMPUSIC = @as(u32, 89); pub const MM_OPTI = @as(u32, 90); pub const MM_ADLACC = @as(u32, 91); pub const MM_COMPAQ = @as(u32, 92); pub const MM_DIALOGIC = @as(u32, 93); pub const MM_INSOFT = @as(u32, 94); pub const MM_MPTUS = @as(u32, 95); pub const MM_WEITEK = @as(u32, 96); pub const MM_LERNOUT_AND_HAUSPIE = @as(u32, 97); pub const MM_QCIAR = @as(u32, 98); pub const MM_APPLE = @as(u32, 99); pub const MM_DIGITAL = @as(u32, 100); pub const MM_MOTU = @as(u32, 101); pub const MM_WORKBIT = @as(u32, 102); pub const MM_OSITECH = @as(u32, 103); pub const MM_MIRO = @as(u32, 104); pub const MM_CIRRUSLOGIC = @as(u32, 105); pub const MM_ISOLUTION = @as(u32, 106); pub const MM_HORIZONS = @as(u32, 107); pub const MM_CONCEPTS = @as(u32, 108); pub const MM_VTG = @as(u32, 109); pub const MM_RADIUS = @as(u32, 110); pub const MM_ROCKWELL = @as(u32, 111); pub const MM_XYZ = @as(u32, 112); pub const MM_OPCODE = @as(u32, 113); pub const MM_VOXWARE = @as(u32, 114); pub const MM_NORTHERN_TELECOM = @as(u32, 115); pub const MM_APICOM = @as(u32, 116); pub const MM_GRANDE = @as(u32, 117); pub const MM_ADDX = @as(u32, 118); pub const MM_WILDCAT = @as(u32, 119); pub const MM_RHETOREX = @as(u32, 120); pub const MM_BROOKTREE = @as(u32, 121); pub const MM_ENSONIQ = @as(u32, 125); pub const MM_FAST = @as(u32, 126); pub const MM_NVIDIA = @as(u32, 127); pub const MM_OKSORI = @as(u32, 128); pub const MM_DIACOUSTICS = @as(u32, 129); pub const MM_GULBRANSEN = @as(u32, 130); pub const MM_KAY_ELEMETRICS = @as(u32, 131); pub const MM_CRYSTAL = @as(u32, 132); pub const MM_SPLASH_STUDIOS = @as(u32, 133); pub const MM_QUARTERDECK = @as(u32, 134); pub const MM_TDK = @as(u32, 135); pub const MM_DIGITAL_AUDIO_LABS = @as(u32, 136); pub const MM_SEERSYS = @as(u32, 137); pub const MM_PICTURETEL = @as(u32, 138); pub const MM_ATT_MICROELECTRONICS = @as(u32, 139); pub const MM_OSPREY = @as(u32, 140); pub const MM_MEDIATRIX = @as(u32, 141); pub const MM_SOUNDESIGNS = @as(u32, 142); pub const MM_ALDIGITAL = @as(u32, 143); pub const MM_SPECTRUM_SIGNAL_PROCESSING = @as(u32, 144); pub const MM_ECS = @as(u32, 145); pub const MM_AMD = @as(u32, 146); pub const MM_COREDYNAMICS = @as(u32, 147); pub const MM_CANAM = @as(u32, 148); pub const MM_SOFTSOUND = @as(u32, 149); pub const MM_NORRIS = @as(u32, 150); pub const MM_DDD = @as(u32, 151); pub const MM_EUPHONICS = @as(u32, 152); pub const MM_PRECEPT = @as(u32, 153); pub const MM_CRYSTAL_NET = @as(u32, 154); pub const MM_CHROMATIC = @as(u32, 155); pub const MM_VOICEINFO = @as(u32, 156); pub const MM_VIENNASYS = @as(u32, 157); pub const MM_CONNECTIX = @as(u32, 158); pub const MM_GADGETLABS = @as(u32, 159); pub const MM_FRONTIER = @as(u32, 160); pub const MM_VIONA = @as(u32, 161); pub const MM_CASIO = @as(u32, 162); pub const MM_DIAMONDMM = @as(u32, 163); pub const MM_S3 = @as(u32, 164); pub const MM_DVISION = @as(u32, 165); pub const MM_NETSCAPE = @as(u32, 166); pub const MM_SOUNDSPACE = @as(u32, 167); pub const MM_VANKOEVERING = @as(u32, 168); pub const MM_QTEAM = @as(u32, 169); pub const MM_ZEFIRO = @as(u32, 170); pub const MM_STUDER = @as(u32, 171); pub const MM_FRAUNHOFER_IIS = @as(u32, 172); pub const MM_QUICKNET = @as(u32, 173); pub const MM_ALARIS = @as(u32, 174); pub const MM_SICRESOURCE = @as(u32, 175); pub const MM_NEOMAGIC = @as(u32, 176); pub const MM_MERGING_TECHNOLOGIES = @as(u32, 177); pub const MM_XIRLINK = @as(u32, 178); pub const MM_COLORGRAPH = @as(u32, 179); pub const MM_OTI = @as(u32, 180); pub const MM_AUREAL = @as(u32, 181); pub const MM_VIVO = @as(u32, 182); pub const MM_SHARP = @as(u32, 183); pub const MM_LUCENT = @as(u32, 184); pub const MM_ATT = @as(u32, 185); pub const MM_SUNCOM = @as(u32, 186); pub const MM_SORVIS = @as(u32, 187); pub const MM_INVISION = @as(u32, 188); pub const MM_BERKOM = @as(u32, 189); pub const MM_MARIAN = @as(u32, 190); pub const MM_DPSINC = @as(u32, 191); pub const MM_BCB = @as(u32, 192); pub const MM_MOTIONPIXELS = @as(u32, 193); pub const MM_QDESIGN = @as(u32, 194); pub const MM_NMP = @as(u32, 195); pub const MM_DATAFUSION = @as(u32, 196); pub const MM_DUCK = @as(u32, 197); pub const MM_FTR = @as(u32, 198); pub const MM_BERCOS = @as(u32, 199); pub const MM_ONLIVE = @as(u32, 200); pub const MM_SIEMENS_SBC = @as(u32, 201); pub const MM_TERALOGIC = @as(u32, 202); pub const MM_PHONET = @as(u32, 203); pub const MM_WINBOND = @as(u32, 204); pub const MM_VIRTUALMUSIC = @as(u32, 205); pub const MM_ENET = @as(u32, 206); pub const MM_GUILLEMOT = @as(u32, 207); pub const MM_EMAGIC = @as(u32, 208); pub const MM_MWM = @as(u32, 209); pub const MM_PACIFICRESEARCH = @as(u32, 210); pub const MM_SIPROLAB = @as(u32, 211); pub const MM_LYNX = @as(u32, 212); pub const MM_SPECTRUM_PRODUCTIONS = @as(u32, 213); pub const MM_DICTAPHONE = @as(u32, 214); pub const MM_QUALCOMM = @as(u32, 215); pub const MM_RZS = @as(u32, 216); pub const MM_AUDIOSCIENCE = @as(u32, 217); pub const MM_PINNACLE = @as(u32, 218); pub const MM_EES = @as(u32, 219); pub const MM_HAFTMANN = @as(u32, 220); pub const MM_LUCID = @as(u32, 221); pub const MM_HEADSPACE = @as(u32, 222); pub const MM_UNISYS = @as(u32, 223); pub const MM_LUMINOSITI = @as(u32, 224); pub const MM_ACTIVEVOICE = @as(u32, 225); pub const MM_DTS = @as(u32, 226); pub const MM_DIGIGRAM = @as(u32, 227); pub const MM_SOFTLAB_NSK = @as(u32, 228); pub const MM_FORTEMEDIA = @as(u32, 229); pub const MM_SONORUS = @as(u32, 230); pub const MM_ARRAY = @as(u32, 231); pub const MM_DATARAN = @as(u32, 232); pub const MM_I_LINK = @as(u32, 233); pub const MM_SELSIUS_SYSTEMS = @as(u32, 234); pub const MM_ADMOS = @as(u32, 235); pub const MM_LEXICON = @as(u32, 236); pub const MM_SGI = @as(u32, 237); pub const MM_IPI = @as(u32, 238); pub const MM_ICE = @as(u32, 239); pub const MM_VQST = @as(u32, 240); pub const MM_ETEK = @as(u32, 241); pub const MM_CS = @as(u32, 242); pub const MM_ALESIS = @as(u32, 243); pub const MM_INTERNET = @as(u32, 244); pub const MM_SONY = @as(u32, 245); pub const MM_HYPERACTIVE = @as(u32, 246); pub const MM_UHER_INFORMATIC = @as(u32, 247); pub const MM_SYDEC_NV = @as(u32, 248); pub const MM_FLEXION = @as(u32, 249); pub const MM_VIA = @as(u32, 250); pub const MM_MICRONAS = @as(u32, 251); pub const MM_ANALOGDEVICES = @as(u32, 252); pub const MM_HP = @as(u32, 253); pub const MM_MATROX_DIV = @as(u32, 254); pub const MM_QUICKAUDIO = @as(u32, 255); pub const MM_YOUCOM = @as(u32, 256); pub const MM_RICHMOND = @as(u32, 257); pub const MM_IODD = @as(u32, 258); pub const MM_ICCC = @as(u32, 259); pub const MM_3COM = @as(u32, 260); pub const MM_MALDEN = @as(u32, 261); pub const MM_3DFX = @as(u32, 262); pub const MM_MINDMAKER = @as(u32, 263); pub const MM_TELEKOL = @as(u32, 264); pub const MM_ST_MICROELECTRONICS = @as(u32, 265); pub const MM_ALGOVISION = @as(u32, 266); pub const MM_UNMAPPED = @as(u32, 65535); pub const MM_PID_UNMAPPED = @as(u32, 65535); pub const MM_PCSPEAKER_WAVEOUT = @as(u32, 13); pub const MM_MSFT_WSS_WAVEIN = @as(u32, 14); pub const MM_MSFT_WSS_WAVEOUT = @as(u32, 15); pub const MM_MSFT_WSS_FMSYNTH_STEREO = @as(u32, 16); pub const MM_MSFT_WSS_MIXER = @as(u32, 17); pub const MM_MSFT_WSS_OEM_WAVEIN = @as(u32, 18); pub const MM_MSFT_WSS_OEM_WAVEOUT = @as(u32, 19); pub const MM_MSFT_WSS_OEM_FMSYNTH_STEREO = @as(u32, 20); pub const MM_MSFT_WSS_AUX = @as(u32, 21); pub const MM_MSFT_WSS_OEM_AUX = @as(u32, 22); pub const MM_MSFT_GENERIC_WAVEIN = @as(u32, 23); pub const MM_MSFT_GENERIC_WAVEOUT = @as(u32, 24); pub const MM_MSFT_GENERIC_MIDIIN = @as(u32, 25); pub const MM_MSFT_GENERIC_MIDIOUT = @as(u32, 26); pub const MM_MSFT_GENERIC_MIDISYNTH = @as(u32, 27); pub const MM_MSFT_GENERIC_AUX_LINE = @as(u32, 28); pub const MM_MSFT_GENERIC_AUX_MIC = @as(u32, 29); pub const MM_MSFT_GENERIC_AUX_CD = @as(u32, 30); pub const MM_MSFT_WSS_OEM_MIXER = @as(u32, 31); pub const MM_MSFT_MSACM = @as(u32, 32); pub const MM_MSFT_ACM_MSADPCM = @as(u32, 33); pub const MM_MSFT_ACM_IMAADPCM = @as(u32, 34); pub const MM_MSFT_ACM_MSFILTER = @as(u32, 35); pub const MM_MSFT_ACM_GSM610 = @as(u32, 36); pub const MM_MSFT_ACM_G711 = @as(u32, 37); pub const MM_MSFT_ACM_PCM = @as(u32, 38); pub const MM_WSS_SB16_WAVEIN = @as(u32, 39); pub const MM_WSS_SB16_WAVEOUT = @as(u32, 40); pub const MM_WSS_SB16_MIDIIN = @as(u32, 41); pub const MM_WSS_SB16_MIDIOUT = @as(u32, 42); pub const MM_WSS_SB16_SYNTH = @as(u32, 43); pub const MM_WSS_SB16_AUX_LINE = @as(u32, 44); pub const MM_WSS_SB16_AUX_CD = @as(u32, 45); pub const MM_WSS_SB16_MIXER = @as(u32, 46); pub const MM_WSS_SBPRO_WAVEIN = @as(u32, 47); pub const MM_WSS_SBPRO_WAVEOUT = @as(u32, 48); pub const MM_WSS_SBPRO_MIDIIN = @as(u32, 49); pub const MM_WSS_SBPRO_MIDIOUT = @as(u32, 50); pub const MM_WSS_SBPRO_SYNTH = @as(u32, 51); pub const MM_WSS_SBPRO_AUX_LINE = @as(u32, 52); pub const MM_WSS_SBPRO_AUX_CD = @as(u32, 53); pub const MM_WSS_SBPRO_MIXER = @as(u32, 54); pub const MM_MSFT_WSS_NT_WAVEIN = @as(u32, 55); pub const MM_MSFT_WSS_NT_WAVEOUT = @as(u32, 56); pub const MM_MSFT_WSS_NT_FMSYNTH_STEREO = @as(u32, 57); pub const MM_MSFT_WSS_NT_MIXER = @as(u32, 58); pub const MM_MSFT_WSS_NT_AUX = @as(u32, 59); pub const MM_MSFT_SB16_WAVEIN = @as(u32, 60); pub const MM_MSFT_SB16_WAVEOUT = @as(u32, 61); pub const MM_MSFT_SB16_MIDIIN = @as(u32, 62); pub const MM_MSFT_SB16_MIDIOUT = @as(u32, 63); pub const MM_MSFT_SB16_SYNTH = @as(u32, 64); pub const MM_MSFT_SB16_AUX_LINE = @as(u32, 65); pub const MM_MSFT_SB16_AUX_CD = @as(u32, 66); pub const MM_MSFT_SB16_MIXER = @as(u32, 67); pub const MM_MSFT_SBPRO_WAVEIN = @as(u32, 68); pub const MM_MSFT_SBPRO_WAVEOUT = @as(u32, 69); pub const MM_MSFT_SBPRO_MIDIIN = @as(u32, 70); pub const MM_MSFT_SBPRO_MIDIOUT = @as(u32, 71); pub const MM_MSFT_SBPRO_SYNTH = @as(u32, 72); pub const MM_MSFT_SBPRO_AUX_LINE = @as(u32, 73); pub const MM_MSFT_SBPRO_AUX_CD = @as(u32, 74); pub const MM_MSFT_SBPRO_MIXER = @as(u32, 75); pub const MM_MSFT_MSOPL_SYNTH = @as(u32, 76); pub const MM_MSFT_VMDMS_LINE_WAVEIN = @as(u32, 80); pub const MM_MSFT_VMDMS_LINE_WAVEOUT = @as(u32, 81); pub const MM_MSFT_VMDMS_HANDSET_WAVEIN = @as(u32, 82); pub const MM_MSFT_VMDMS_HANDSET_WAVEOUT = @as(u32, 83); pub const MM_MSFT_VMDMW_LINE_WAVEIN = @as(u32, 84); pub const MM_MSFT_VMDMW_LINE_WAVEOUT = @as(u32, 85); pub const MM_MSFT_VMDMW_HANDSET_WAVEIN = @as(u32, 86); pub const MM_MSFT_VMDMW_HANDSET_WAVEOUT = @as(u32, 87); pub const MM_MSFT_VMDMW_MIXER = @as(u32, 88); pub const MM_MSFT_VMDM_GAME_WAVEOUT = @as(u32, 89); pub const MM_MSFT_VMDM_GAME_WAVEIN = @as(u32, 90); pub const MM_MSFT_ACM_MSNAUDIO = @as(u32, 91); pub const MM_MSFT_ACM_MSG723 = @as(u32, 92); pub const MM_MSFT_ACM_MSRT24 = @as(u32, 93); pub const MM_MSFT_WDMAUDIO_WAVEOUT = @as(u32, 100); pub const MM_MSFT_WDMAUDIO_WAVEIN = @as(u32, 101); pub const MM_MSFT_WDMAUDIO_MIDIOUT = @as(u32, 102); pub const MM_MSFT_WDMAUDIO_MIDIIN = @as(u32, 103); pub const MM_MSFT_WDMAUDIO_MIXER = @as(u32, 104); pub const MM_MSFT_WDMAUDIO_AUX = @as(u32, 105); pub const MM_CREATIVE_SB15_WAVEIN = @as(u32, 1); pub const MM_CREATIVE_SB20_WAVEIN = @as(u32, 2); pub const MM_CREATIVE_SBPRO_WAVEIN = @as(u32, 3); pub const MM_CREATIVE_SBP16_WAVEIN = @as(u32, 4); pub const MM_CREATIVE_PHNBLST_WAVEIN = @as(u32, 5); pub const MM_CREATIVE_SB15_WAVEOUT = @as(u32, 101); pub const MM_CREATIVE_SB20_WAVEOUT = @as(u32, 102); pub const MM_CREATIVE_SBPRO_WAVEOUT = @as(u32, 103); pub const MM_CREATIVE_SBP16_WAVEOUT = @as(u32, 104); pub const MM_CREATIVE_PHNBLST_WAVEOUT = @as(u32, 105); pub const MM_CREATIVE_MIDIOUT = @as(u32, 201); pub const MM_CREATIVE_MIDIIN = @as(u32, 202); pub const MM_CREATIVE_FMSYNTH_MONO = @as(u32, 301); pub const MM_CREATIVE_FMSYNTH_STEREO = @as(u32, 302); pub const MM_CREATIVE_MIDI_AWE32 = @as(u32, 303); pub const MM_CREATIVE_AUX_CD = @as(u32, 401); pub const MM_CREATIVE_AUX_LINE = @as(u32, 402); pub const MM_CREATIVE_AUX_MIC = @as(u32, 403); pub const MM_CREATIVE_AUX_MASTER = @as(u32, 404); pub const MM_CREATIVE_AUX_PCSPK = @as(u32, 405); pub const MM_CREATIVE_AUX_WAVE = @as(u32, 406); pub const MM_CREATIVE_AUX_MIDI = @as(u32, 407); pub const MM_CREATIVE_SBPRO_MIXER = @as(u32, 408); pub const MM_CREATIVE_SB16_MIXER = @as(u32, 409); pub const MM_MEDIAVISION_PROAUDIO = @as(u32, 16); pub const MM_PROAUD_MIDIOUT = @as(u32, 17); pub const MM_PROAUD_MIDIIN = @as(u32, 18); pub const MM_PROAUD_SYNTH = @as(u32, 19); pub const MM_PROAUD_WAVEOUT = @as(u32, 20); pub const MM_PROAUD_WAVEIN = @as(u32, 21); pub const MM_PROAUD_MIXER = @as(u32, 22); pub const MM_PROAUD_AUX = @as(u32, 23); pub const MM_MEDIAVISION_THUNDER = @as(u32, 32); pub const MM_THUNDER_SYNTH = @as(u32, 35); pub const MM_THUNDER_WAVEOUT = @as(u32, 36); pub const MM_THUNDER_WAVEIN = @as(u32, 37); pub const MM_THUNDER_AUX = @as(u32, 39); pub const MM_MEDIAVISION_TPORT = @as(u32, 64); pub const MM_TPORT_WAVEOUT = @as(u32, 65); pub const MM_TPORT_WAVEIN = @as(u32, 66); pub const MM_TPORT_SYNTH = @as(u32, 67); pub const MM_MEDIAVISION_PROAUDIO_PLUS = @as(u32, 80); pub const MM_PROAUD_PLUS_MIDIOUT = @as(u32, 81); pub const MM_PROAUD_PLUS_MIDIIN = @as(u32, 82); pub const MM_PROAUD_PLUS_SYNTH = @as(u32, 83); pub const MM_PROAUD_PLUS_WAVEOUT = @as(u32, 84); pub const MM_PROAUD_PLUS_WAVEIN = @as(u32, 85); pub const MM_PROAUD_PLUS_MIXER = @as(u32, 86); pub const MM_PROAUD_PLUS_AUX = @as(u32, 87); pub const MM_MEDIAVISION_PROAUDIO_16 = @as(u32, 96); pub const MM_PROAUD_16_MIDIOUT = @as(u32, 97); pub const MM_PROAUD_16_MIDIIN = @as(u32, 98); pub const MM_PROAUD_16_SYNTH = @as(u32, 99); pub const MM_PROAUD_16_WAVEOUT = @as(u32, 100); pub const MM_PROAUD_16_WAVEIN = @as(u32, 101); pub const MM_PROAUD_16_MIXER = @as(u32, 102); pub const MM_PROAUD_16_AUX = @as(u32, 103); pub const MM_MEDIAVISION_PROSTUDIO_16 = @as(u32, 96); pub const MM_STUDIO_16_MIDIOUT = @as(u32, 97); pub const MM_STUDIO_16_MIDIIN = @as(u32, 98); pub const MM_STUDIO_16_SYNTH = @as(u32, 99); pub const MM_STUDIO_16_WAVEOUT = @as(u32, 100); pub const MM_STUDIO_16_WAVEIN = @as(u32, 101); pub const MM_STUDIO_16_MIXER = @as(u32, 102); pub const MM_STUDIO_16_AUX = @as(u32, 103); pub const MM_MEDIAVISION_CDPC = @as(u32, 112); pub const MM_CDPC_MIDIOUT = @as(u32, 113); pub const MM_CDPC_MIDIIN = @as(u32, 114); pub const MM_CDPC_SYNTH = @as(u32, 115); pub const MM_CDPC_WAVEOUT = @as(u32, 116); pub const MM_CDPC_WAVEIN = @as(u32, 117); pub const MM_CDPC_MIXER = @as(u32, 118); pub const MM_CDPC_AUX = @as(u32, 119); pub const MM_MEDIAVISION_OPUS1208 = @as(u32, 128); pub const MM_OPUS401_MIDIOUT = @as(u32, 129); pub const MM_OPUS401_MIDIIN = @as(u32, 130); pub const MM_OPUS1208_SYNTH = @as(u32, 131); pub const MM_OPUS1208_WAVEOUT = @as(u32, 132); pub const MM_OPUS1208_WAVEIN = @as(u32, 133); pub const MM_OPUS1208_MIXER = @as(u32, 134); pub const MM_OPUS1208_AUX = @as(u32, 135); pub const MM_MEDIAVISION_OPUS1216 = @as(u32, 144); pub const MM_OPUS1216_MIDIOUT = @as(u32, 145); pub const MM_OPUS1216_MIDIIN = @as(u32, 146); pub const MM_OPUS1216_SYNTH = @as(u32, 147); pub const MM_OPUS1216_WAVEOUT = @as(u32, 148); pub const MM_OPUS1216_WAVEIN = @as(u32, 149); pub const MM_OPUS1216_MIXER = @as(u32, 150); pub const MM_OPUS1216_AUX = @as(u32, 151); pub const MM_CYRIX_XASYNTH = @as(u32, 1); pub const MM_CYRIX_XAMIDIIN = @as(u32, 2); pub const MM_CYRIX_XAMIDIOUT = @as(u32, 3); pub const MM_CYRIX_XAWAVEIN = @as(u32, 4); pub const MM_CYRIX_XAWAVEOUT = @as(u32, 5); pub const MM_CYRIX_XAAUX = @as(u32, 6); pub const MM_CYRIX_XAMIXER = @as(u32, 7); pub const MM_PHILIPS_ACM_LPCBB = @as(u32, 1); pub const MM_NETXL_XLVIDEO = @as(u32, 1); pub const MM_ZYXEL_ACM_ADPCM = @as(u32, 1); pub const MM_AARDVARK_STUDIO12_WAVEOUT = @as(u32, 1); pub const MM_AARDVARK_STUDIO12_WAVEIN = @as(u32, 2); pub const MM_AARDVARK_STUDIO88_WAVEOUT = @as(u32, 3); pub const MM_AARDVARK_STUDIO88_WAVEIN = @as(u32, 4); pub const MM_BINTEC_TAPI_WAVE = @as(u32, 1); pub const MM_HEWLETT_PACKARD_CU_CODEC = @as(u32, 1); pub const MM_MITEL_TALKTO_LINE_WAVEOUT = @as(u32, 100); pub const MM_MITEL_TALKTO_LINE_WAVEIN = @as(u32, 101); pub const MM_MITEL_TALKTO_HANDSET_WAVEOUT = @as(u32, 102); pub const MM_MITEL_TALKTO_HANDSET_WAVEIN = @as(u32, 103); pub const MM_MITEL_TALKTO_BRIDGED_WAVEOUT = @as(u32, 104); pub const MM_MITEL_TALKTO_BRIDGED_WAVEIN = @as(u32, 105); pub const MM_MITEL_MPA_HANDSET_WAVEOUT = @as(u32, 200); pub const MM_MITEL_MPA_HANDSET_WAVEIN = @as(u32, 201); pub const MM_MITEL_MPA_HANDSFREE_WAVEOUT = @as(u32, 202); pub const MM_MITEL_MPA_HANDSFREE_WAVEIN = @as(u32, 203); pub const MM_MITEL_MPA_LINE1_WAVEOUT = @as(u32, 204); pub const MM_MITEL_MPA_LINE1_WAVEIN = @as(u32, 205); pub const MM_MITEL_MPA_LINE2_WAVEOUT = @as(u32, 206); pub const MM_MITEL_MPA_LINE2_WAVEIN = @as(u32, 207); pub const MM_MITEL_MEDIAPATH_WAVEOUT = @as(u32, 300); pub const MM_MITEL_MEDIAPATH_WAVEIN = @as(u32, 301); pub const MM_SNI_ACM_G721 = @as(u32, 1); pub const MM_EMU_APSSYNTH = @as(u32, 1); pub const MM_EMU_APSMIDIIN = @as(u32, 2); pub const MM_EMU_APSMIDIOUT = @as(u32, 3); pub const MM_EMU_APSWAVEIN = @as(u32, 4); pub const MM_EMU_APSWAVEOUT = @as(u32, 5); pub const MM_ARTISOFT_SBWAVEIN = @as(u32, 1); pub const MM_ARTISOFT_SBWAVEOUT = @as(u32, 2); pub const MM_TBS_TROPEZ_WAVEIN = @as(u32, 37); pub const MM_TBS_TROPEZ_WAVEOUT = @as(u32, 38); pub const MM_TBS_TROPEZ_AUX1 = @as(u32, 39); pub const MM_TBS_TROPEZ_AUX2 = @as(u32, 40); pub const MM_TBS_TROPEZ_LINE = @as(u32, 41); pub const MM_MMOTION_WAVEAUX = @as(u32, 1); pub const MM_MMOTION_WAVEOUT = @as(u32, 2); pub const MM_MMOTION_WAVEIN = @as(u32, 3); pub const MM_IBM_PCMCIA_WAVEIN = @as(u32, 11); pub const MM_IBM_PCMCIA_WAVEOUT = @as(u32, 12); pub const MM_IBM_PCMCIA_SYNTH = @as(u32, 13); pub const MM_IBM_PCMCIA_MIDIIN = @as(u32, 14); pub const MM_IBM_PCMCIA_MIDIOUT = @as(u32, 15); pub const MM_IBM_PCMCIA_AUX = @as(u32, 16); pub const MM_IBM_THINKPAD200 = @as(u32, 17); pub const MM_IBM_MWAVE_WAVEIN = @as(u32, 18); pub const MM_IBM_MWAVE_WAVEOUT = @as(u32, 19); pub const MM_IBM_MWAVE_MIXER = @as(u32, 20); pub const MM_IBM_MWAVE_MIDIIN = @as(u32, 21); pub const MM_IBM_MWAVE_MIDIOUT = @as(u32, 22); pub const MM_IBM_MWAVE_AUX = @as(u32, 23); pub const MM_IBM_WC_MIDIOUT = @as(u32, 30); pub const MM_IBM_WC_WAVEOUT = @as(u32, 31); pub const MM_IBM_WC_MIXEROUT = @as(u32, 33); pub const MM_VOCALTEC_WAVEOUT = @as(u32, 1); pub const MM_VOCALTEC_WAVEIN = @as(u32, 2); pub const MM_ROLAND_RAP10_MIDIOUT = @as(u32, 10); pub const MM_ROLAND_RAP10_MIDIIN = @as(u32, 11); pub const MM_ROLAND_RAP10_SYNTH = @as(u32, 12); pub const MM_ROLAND_RAP10_WAVEOUT = @as(u32, 13); pub const MM_ROLAND_RAP10_WAVEIN = @as(u32, 14); pub const MM_ROLAND_MPU401_MIDIOUT = @as(u32, 15); pub const MM_ROLAND_MPU401_MIDIIN = @as(u32, 16); pub const MM_ROLAND_SMPU_MIDIOUTA = @as(u32, 17); pub const MM_ROLAND_SMPU_MIDIOUTB = @as(u32, 18); pub const MM_ROLAND_SMPU_MIDIINA = @as(u32, 19); pub const MM_ROLAND_SMPU_MIDIINB = @as(u32, 20); pub const MM_ROLAND_SC7_MIDIOUT = @as(u32, 21); pub const MM_ROLAND_SC7_MIDIIN = @as(u32, 22); pub const MM_ROLAND_SERIAL_MIDIOUT = @as(u32, 23); pub const MM_ROLAND_SERIAL_MIDIIN = @as(u32, 24); pub const MM_ROLAND_SCP_MIDIOUT = @as(u32, 38); pub const MM_ROLAND_SCP_MIDIIN = @as(u32, 39); pub const MM_ROLAND_SCP_WAVEOUT = @as(u32, 40); pub const MM_ROLAND_SCP_WAVEIN = @as(u32, 41); pub const MM_ROLAND_SCP_MIXER = @as(u32, 42); pub const MM_ROLAND_SCP_AUX = @as(u32, 48); pub const MM_DSP_SOLUTIONS_WAVEOUT = @as(u32, 1); pub const MM_DSP_SOLUTIONS_WAVEIN = @as(u32, 2); pub const MM_DSP_SOLUTIONS_SYNTH = @as(u32, 3); pub const MM_DSP_SOLUTIONS_AUX = @as(u32, 4); pub const MM_NEC_73_86_SYNTH = @as(u32, 5); pub const MM_NEC_73_86_WAVEOUT = @as(u32, 6); pub const MM_NEC_73_86_WAVEIN = @as(u32, 7); pub const MM_NEC_26_SYNTH = @as(u32, 9); pub const MM_NEC_MPU401_MIDIOUT = @as(u32, 10); pub const MM_NEC_MPU401_MIDIIN = @as(u32, 11); pub const MM_NEC_JOYSTICK = @as(u32, 12); pub const MM_WANGLABS_WAVEIN1 = @as(u32, 1); pub const MM_WANGLABS_WAVEOUT1 = @as(u32, 2); pub const MM_TANDY_VISWAVEIN = @as(u32, 1); pub const MM_TANDY_VISWAVEOUT = @as(u32, 2); pub const MM_TANDY_VISBIOSSYNTH = @as(u32, 3); pub const MM_TANDY_SENS_MMAWAVEIN = @as(u32, 4); pub const MM_TANDY_SENS_MMAWAVEOUT = @as(u32, 5); pub const MM_TANDY_SENS_MMAMIDIIN = @as(u32, 6); pub const MM_TANDY_SENS_MMAMIDIOUT = @as(u32, 7); pub const MM_TANDY_SENS_VISWAVEOUT = @as(u32, 8); pub const MM_TANDY_PSSJWAVEIN = @as(u32, 9); pub const MM_TANDY_PSSJWAVEOUT = @as(u32, 10); pub const MM_ANTEX_SX12_WAVEIN = @as(u32, 1); pub const MM_ANTEX_SX12_WAVEOUT = @as(u32, 2); pub const MM_ANTEX_SX15_WAVEIN = @as(u32, 3); pub const MM_ANTEX_SX15_WAVEOUT = @as(u32, 4); pub const MM_ANTEX_VP625_WAVEIN = @as(u32, 5); pub const MM_ANTEX_VP625_WAVEOUT = @as(u32, 6); pub const MM_ANTEX_AUDIOPORT22_WAVEIN = @as(u32, 7); pub const MM_ANTEX_AUDIOPORT22_WAVEOUT = @as(u32, 8); pub const MM_ANTEX_AUDIOPORT22_FEEDTHRU = @as(u32, 9); pub const MM_INTELOPD_WAVEIN = @as(u32, 1); pub const MM_INTELOPD_WAVEOUT = @as(u32, 101); pub const MM_INTELOPD_AUX = @as(u32, 401); pub const MM_INTEL_NSPMODEMLINEIN = @as(u32, 501); pub const MM_INTEL_NSPMODEMLINEOUT = @as(u32, 502); pub const MM_VAL_MICROKEY_AP_WAVEIN = @as(u32, 1); pub const MM_VAL_MICROKEY_AP_WAVEOUT = @as(u32, 2); pub const MM_INTERACTIVE_WAVEIN = @as(u32, 69); pub const MM_INTERACTIVE_WAVEOUT = @as(u32, 69); pub const MM_YAMAHA_GSS_SYNTH = @as(u32, 1); pub const MM_YAMAHA_GSS_WAVEOUT = @as(u32, 2); pub const MM_YAMAHA_GSS_WAVEIN = @as(u32, 3); pub const MM_YAMAHA_GSS_MIDIOUT = @as(u32, 4); pub const MM_YAMAHA_GSS_MIDIIN = @as(u32, 5); pub const MM_YAMAHA_GSS_AUX = @as(u32, 6); pub const MM_YAMAHA_SERIAL_MIDIOUT = @as(u32, 7); pub const MM_YAMAHA_SERIAL_MIDIIN = @as(u32, 8); pub const MM_YAMAHA_OPL3SA_WAVEOUT = @as(u32, 16); pub const MM_YAMAHA_OPL3SA_WAVEIN = @as(u32, 17); pub const MM_YAMAHA_OPL3SA_FMSYNTH = @as(u32, 18); pub const MM_YAMAHA_OPL3SA_YSYNTH = @as(u32, 19); pub const MM_YAMAHA_OPL3SA_MIDIOUT = @as(u32, 20); pub const MM_YAMAHA_OPL3SA_MIDIIN = @as(u32, 21); pub const MM_YAMAHA_OPL3SA_MIXER = @as(u32, 23); pub const MM_YAMAHA_OPL3SA_JOYSTICK = @as(u32, 24); pub const MM_YAMAHA_YMF724LEG_MIDIOUT = @as(u32, 25); pub const MM_YAMAHA_YMF724LEG_MIDIIN = @as(u32, 26); pub const MM_YAMAHA_YMF724_WAVEOUT = @as(u32, 27); pub const MM_YAMAHA_YMF724_WAVEIN = @as(u32, 28); pub const MM_YAMAHA_YMF724_MIDIOUT = @as(u32, 29); pub const MM_YAMAHA_YMF724_AUX = @as(u32, 30); pub const MM_YAMAHA_YMF724_MIXER = @as(u32, 31); pub const MM_YAMAHA_YMF724LEG_FMSYNTH = @as(u32, 32); pub const MM_YAMAHA_YMF724LEG_MIXER = @as(u32, 33); pub const MM_YAMAHA_SXG_MIDIOUT = @as(u32, 34); pub const MM_YAMAHA_SXG_WAVEOUT = @as(u32, 35); pub const MM_YAMAHA_SXG_MIXER = @as(u32, 36); pub const MM_YAMAHA_ACXG_WAVEIN = @as(u32, 37); pub const MM_YAMAHA_ACXG_WAVEOUT = @as(u32, 38); pub const MM_YAMAHA_ACXG_MIDIOUT = @as(u32, 39); pub const MM_YAMAHA_ACXG_MIXER = @as(u32, 40); pub const MM_YAMAHA_ACXG_AUX = @as(u32, 41); pub const MM_EVEREX_CARRIER = @as(u32, 1); pub const MM_ECHO_SYNTH = @as(u32, 1); pub const MM_ECHO_WAVEOUT = @as(u32, 2); pub const MM_ECHO_WAVEIN = @as(u32, 3); pub const MM_ECHO_MIDIOUT = @as(u32, 4); pub const MM_ECHO_MIDIIN = @as(u32, 5); pub const MM_ECHO_AUX = @as(u32, 6); pub const MM_SIERRA_ARIA_MIDIOUT = @as(u32, 20); pub const MM_SIERRA_ARIA_MIDIIN = @as(u32, 21); pub const MM_SIERRA_ARIA_SYNTH = @as(u32, 22); pub const MM_SIERRA_ARIA_WAVEOUT = @as(u32, 23); pub const MM_SIERRA_ARIA_WAVEIN = @as(u32, 24); pub const MM_SIERRA_ARIA_AUX = @as(u32, 25); pub const MM_SIERRA_ARIA_AUX2 = @as(u32, 32); pub const MM_SIERRA_QUARTET_WAVEIN = @as(u32, 80); pub const MM_SIERRA_QUARTET_WAVEOUT = @as(u32, 81); pub const MM_SIERRA_QUARTET_MIDIIN = @as(u32, 82); pub const MM_SIERRA_QUARTET_MIDIOUT = @as(u32, 83); pub const MM_SIERRA_QUARTET_SYNTH = @as(u32, 84); pub const MM_SIERRA_QUARTET_AUX_CD = @as(u32, 85); pub const MM_SIERRA_QUARTET_AUX_LINE = @as(u32, 86); pub const MM_SIERRA_QUARTET_AUX_MODEM = @as(u32, 87); pub const MM_SIERRA_QUARTET_MIXER = @as(u32, 88); pub const MM_CAT_WAVEOUT = @as(u32, 1); pub const MM_DSP_GROUP_TRUESPEECH = @as(u32, 1); pub const MM_MELABS_MIDI2GO = @as(u32, 1); pub const MM_ESS_AMWAVEOUT = @as(u32, 1); pub const MM_ESS_AMWAVEIN = @as(u32, 2); pub const MM_ESS_AMAUX = @as(u32, 3); pub const MM_ESS_AMSYNTH = @as(u32, 4); pub const MM_ESS_AMMIDIOUT = @as(u32, 5); pub const MM_ESS_AMMIDIIN = @as(u32, 6); pub const MM_ESS_MIXER = @as(u32, 7); pub const MM_ESS_AUX_CD = @as(u32, 8); pub const MM_ESS_MPU401_MIDIOUT = @as(u32, 9); pub const MM_ESS_MPU401_MIDIIN = @as(u32, 10); pub const MM_ESS_ES488_WAVEOUT = @as(u32, 16); pub const MM_ESS_ES488_WAVEIN = @as(u32, 17); pub const MM_ESS_ES488_MIXER = @as(u32, 18); pub const MM_ESS_ES688_WAVEOUT = @as(u32, 19); pub const MM_ESS_ES688_WAVEIN = @as(u32, 20); pub const MM_ESS_ES688_MIXER = @as(u32, 21); pub const MM_ESS_ES1488_WAVEOUT = @as(u32, 22); pub const MM_ESS_ES1488_WAVEIN = @as(u32, 23); pub const MM_ESS_ES1488_MIXER = @as(u32, 24); pub const MM_ESS_ES1688_WAVEOUT = @as(u32, 25); pub const MM_ESS_ES1688_WAVEIN = @as(u32, 26); pub const MM_ESS_ES1688_MIXER = @as(u32, 27); pub const MM_ESS_ES1788_WAVEOUT = @as(u32, 28); pub const MM_ESS_ES1788_WAVEIN = @as(u32, 29); pub const MM_ESS_ES1788_MIXER = @as(u32, 30); pub const MM_ESS_ES1888_WAVEOUT = @as(u32, 31); pub const MM_ESS_ES1888_WAVEIN = @as(u32, 32); pub const MM_ESS_ES1888_MIXER = @as(u32, 33); pub const MM_ESS_ES1868_WAVEOUT = @as(u32, 34); pub const MM_ESS_ES1868_WAVEIN = @as(u32, 35); pub const MM_ESS_ES1868_MIXER = @as(u32, 36); pub const MM_ESS_ES1878_WAVEOUT = @as(u32, 37); pub const MM_ESS_ES1878_WAVEIN = @as(u32, 38); pub const MM_ESS_ES1878_MIXER = @as(u32, 39); pub const MM_CANOPUS_ACM_DVREX = @as(u32, 1); pub const MM_EPS_FMSND = @as(u32, 1); pub const MM_TRUEVISION_WAVEIN1 = @as(u32, 1); pub const MM_TRUEVISION_WAVEOUT1 = @as(u32, 2); pub const MM_AZTECH_MIDIOUT = @as(u32, 3); pub const MM_AZTECH_MIDIIN = @as(u32, 4); pub const MM_AZTECH_WAVEIN = @as(u32, 17); pub const MM_AZTECH_WAVEOUT = @as(u32, 18); pub const MM_AZTECH_FMSYNTH = @as(u32, 20); pub const MM_AZTECH_MIXER = @as(u32, 21); pub const MM_AZTECH_PRO16_WAVEIN = @as(u32, 33); pub const MM_AZTECH_PRO16_WAVEOUT = @as(u32, 34); pub const MM_AZTECH_PRO16_FMSYNTH = @as(u32, 38); pub const MM_AZTECH_DSP16_WAVEIN = @as(u32, 65); pub const MM_AZTECH_DSP16_WAVEOUT = @as(u32, 66); pub const MM_AZTECH_DSP16_FMSYNTH = @as(u32, 68); pub const MM_AZTECH_DSP16_WAVESYNTH = @as(u32, 70); pub const MM_AZTECH_NOVA16_WAVEIN = @as(u32, 71); pub const MM_AZTECH_NOVA16_WAVEOUT = @as(u32, 72); pub const MM_AZTECH_NOVA16_MIXER = @as(u32, 73); pub const MM_AZTECH_WASH16_WAVEIN = @as(u32, 74); pub const MM_AZTECH_WASH16_WAVEOUT = @as(u32, 75); pub const MM_AZTECH_WASH16_MIXER = @as(u32, 76); pub const MM_AZTECH_AUX_CD = @as(u32, 401); pub const MM_AZTECH_AUX_LINE = @as(u32, 402); pub const MM_AZTECH_AUX_MIC = @as(u32, 403); pub const MM_AZTECH_AUX = @as(u32, 404); pub const MM_VIDEOLOGIC_MSWAVEIN = @as(u32, 1); pub const MM_VIDEOLOGIC_MSWAVEOUT = @as(u32, 2); pub const MM_KORG_PCIF_MIDIOUT = @as(u32, 1); pub const MM_KORG_PCIF_MIDIIN = @as(u32, 2); pub const MM_KORG_1212IO_MSWAVEIN = @as(u32, 3); pub const MM_KORG_1212IO_MSWAVEOUT = @as(u32, 4); pub const MM_APT_ACE100CD = @as(u32, 1); pub const MM_ICS_WAVEDECK_WAVEOUT = @as(u32, 1); pub const MM_ICS_WAVEDECK_WAVEIN = @as(u32, 2); pub const MM_ICS_WAVEDECK_MIXER = @as(u32, 3); pub const MM_ICS_WAVEDECK_AUX = @as(u32, 4); pub const MM_ICS_WAVEDECK_SYNTH = @as(u32, 5); pub const MM_ICS_WAVEDEC_SB_WAVEOUT = @as(u32, 6); pub const MM_ICS_WAVEDEC_SB_WAVEIN = @as(u32, 7); pub const MM_ICS_WAVEDEC_SB_FM_MIDIOUT = @as(u32, 8); pub const MM_ICS_WAVEDEC_SB_MPU401_MIDIOUT = @as(u32, 9); pub const MM_ICS_WAVEDEC_SB_MPU401_MIDIIN = @as(u32, 10); pub const MM_ICS_WAVEDEC_SB_MIXER = @as(u32, 11); pub const MM_ICS_WAVEDEC_SB_AUX = @as(u32, 12); pub const MM_ICS_2115_LITE_MIDIOUT = @as(u32, 13); pub const MM_ICS_2120_LITE_MIDIOUT = @as(u32, 14); pub const MM_ITERATEDSYS_FUFCODEC = @as(u32, 1); pub const MM_METHEUS_ZIPPER = @as(u32, 1); pub const MM_WINNOV_CAVIAR_WAVEIN = @as(u32, 1); pub const MM_WINNOV_CAVIAR_WAVEOUT = @as(u32, 2); pub const MM_WINNOV_CAVIAR_VIDC = @as(u32, 3); pub const MM_WINNOV_CAVIAR_CHAMPAGNE = @as(u32, 4); pub const MM_WINNOV_CAVIAR_YUV8 = @as(u32, 5); pub const MM_NCR_BA_WAVEIN = @as(u32, 1); pub const MM_NCR_BA_WAVEOUT = @as(u32, 2); pub const MM_NCR_BA_SYNTH = @as(u32, 3); pub const MM_NCR_BA_AUX = @as(u32, 4); pub const MM_NCR_BA_MIXER = @as(u32, 5); pub const MM_AST_MODEMWAVE_WAVEIN = @as(u32, 13); pub const MM_AST_MODEMWAVE_WAVEOUT = @as(u32, 14); pub const MM_WILLOWPOND_FMSYNTH_STEREO = @as(u32, 20); pub const MM_WILLOWPOND_MPU401 = @as(u32, 21); pub const MM_WILLOWPOND_SNDPORT_WAVEIN = @as(u32, 100); pub const MM_WILLOWPOND_SNDPORT_WAVEOUT = @as(u32, 101); pub const MM_WILLOWPOND_SNDPORT_MIXER = @as(u32, 102); pub const MM_WILLOWPOND_SNDPORT_AUX = @as(u32, 103); pub const MM_WILLOWPOND_PH_WAVEIN = @as(u32, 104); pub const MM_WILLOWPOND_PH_WAVEOUT = @as(u32, 105); pub const MM_WILLOWPOND_PH_MIXER = @as(u32, 106); pub const MM_WILLOWPOND_PH_AUX = @as(u32, 107); pub const MM_WILLOPOND_SNDCOMM_WAVEIN = @as(u32, 108); pub const MM_WILLOWPOND_SNDCOMM_WAVEOUT = @as(u32, 109); pub const MM_WILLOWPOND_SNDCOMM_MIXER = @as(u32, 110); pub const MM_WILLOWPOND_SNDCOMM_AUX = @as(u32, 111); pub const MM_WILLOWPOND_GENERIC_WAVEIN = @as(u32, 112); pub const MM_WILLOWPOND_GENERIC_WAVEOUT = @as(u32, 113); pub const MM_WILLOWPOND_GENERIC_MIXER = @as(u32, 114); pub const MM_WILLOWPOND_GENERIC_AUX = @as(u32, 115); pub const MM_VITEC_VMAKER = @as(u32, 1); pub const MM_VITEC_VMPRO = @as(u32, 2); pub const MM_MOSCOM_VPC2400_IN = @as(u32, 1); pub const MM_MOSCOM_VPC2400_OUT = @as(u32, 2); pub const MM_SILICONSOFT_SC1_WAVEIN = @as(u32, 1); pub const MM_SILICONSOFT_SC1_WAVEOUT = @as(u32, 2); pub const MM_SILICONSOFT_SC2_WAVEIN = @as(u32, 3); pub const MM_SILICONSOFT_SC2_WAVEOUT = @as(u32, 4); pub const MM_SILICONSOFT_SOUNDJR2_WAVEOUT = @as(u32, 5); pub const MM_SILICONSOFT_SOUNDJR2PR_WAVEIN = @as(u32, 6); pub const MM_SILICONSOFT_SOUNDJR2PR_WAVEOUT = @as(u32, 7); pub const MM_SILICONSOFT_SOUNDJR3_WAVEOUT = @as(u32, 8); pub const MM_TTEWS_WAVEIN = @as(u32, 1); pub const MM_TTEWS_WAVEOUT = @as(u32, 2); pub const MM_TTEWS_MIDIIN = @as(u32, 3); pub const MM_TTEWS_MIDIOUT = @as(u32, 4); pub const MM_TTEWS_MIDISYNTH = @as(u32, 5); pub const MM_TTEWS_MIDIMONITOR = @as(u32, 6); pub const MM_TTEWS_VMIDIIN = @as(u32, 7); pub const MM_TTEWS_VMIDIOUT = @as(u32, 8); pub const MM_TTEWS_AUX = @as(u32, 9); pub const MM_TTEWS_MIXER = @as(u32, 10); pub const MM_MEDIASONIC_ACM_G723 = @as(u32, 1); pub const MM_MEDIASONIC_ICOM = @as(u32, 2); pub const MM_ICOM_WAVEIN = @as(u32, 3); pub const MM_ICOM_WAVEOUT = @as(u32, 4); pub const MM_ICOM_MIXER = @as(u32, 5); pub const MM_ICOM_AUX = @as(u32, 6); pub const MM_ICOM_LINE = @as(u32, 7); pub const MM_SANYO_ACM_LD_ADPCM = @as(u32, 1); pub const MM_AHEAD_MULTISOUND = @as(u32, 1); pub const MM_AHEAD_SOUNDBLASTER = @as(u32, 2); pub const MM_AHEAD_PROAUDIO = @as(u32, 3); pub const MM_AHEAD_GENERIC = @as(u32, 4); pub const MM_OLIVETTI_WAVEIN = @as(u32, 1); pub const MM_OLIVETTI_WAVEOUT = @as(u32, 2); pub const MM_OLIVETTI_MIXER = @as(u32, 3); pub const MM_OLIVETTI_AUX = @as(u32, 4); pub const MM_OLIVETTI_MIDIIN = @as(u32, 5); pub const MM_OLIVETTI_MIDIOUT = @as(u32, 6); pub const MM_OLIVETTI_SYNTH = @as(u32, 7); pub const MM_OLIVETTI_JOYSTICK = @as(u32, 8); pub const MM_OLIVETTI_ACM_GSM = @as(u32, 9); pub const MM_OLIVETTI_ACM_ADPCM = @as(u32, 10); pub const MM_OLIVETTI_ACM_CELP = @as(u32, 11); pub const MM_OLIVETTI_ACM_SBC = @as(u32, 12); pub const MM_OLIVETTI_ACM_OPR = @as(u32, 13); pub const MM_IOMAGIC_TEMPO_WAVEOUT = @as(u32, 1); pub const MM_IOMAGIC_TEMPO_WAVEIN = @as(u32, 2); pub const MM_IOMAGIC_TEMPO_SYNTH = @as(u32, 3); pub const MM_IOMAGIC_TEMPO_MIDIOUT = @as(u32, 4); pub const MM_IOMAGIC_TEMPO_MXDOUT = @as(u32, 5); pub const MM_IOMAGIC_TEMPO_AUXOUT = @as(u32, 6); pub const MM_MATSUSHITA_WAVEIN = @as(u32, 1); pub const MM_MATSUSHITA_WAVEOUT = @as(u32, 2); pub const MM_MATSUSHITA_FMSYNTH_STEREO = @as(u32, 3); pub const MM_MATSUSHITA_MIXER = @as(u32, 4); pub const MM_MATSUSHITA_AUX = @as(u32, 5); pub const MM_NEWMEDIA_WAVJAMMER = @as(u32, 1); pub const MM_LYRRUS_BRIDGE_GUITAR = @as(u32, 1); pub const MM_OPTI_M16_FMSYNTH_STEREO = @as(u32, 1); pub const MM_OPTI_M16_MIDIIN = @as(u32, 2); pub const MM_OPTI_M16_MIDIOUT = @as(u32, 3); pub const MM_OPTI_M16_WAVEIN = @as(u32, 4); pub const MM_OPTI_M16_WAVEOUT = @as(u32, 5); pub const MM_OPTI_M16_MIXER = @as(u32, 6); pub const MM_OPTI_M16_AUX = @as(u32, 7); pub const MM_OPTI_P16_FMSYNTH_STEREO = @as(u32, 16); pub const MM_OPTI_P16_MIDIIN = @as(u32, 17); pub const MM_OPTI_P16_MIDIOUT = @as(u32, 18); pub const MM_OPTI_P16_WAVEIN = @as(u32, 19); pub const MM_OPTI_P16_WAVEOUT = @as(u32, 20); pub const MM_OPTI_P16_MIXER = @as(u32, 21); pub const MM_OPTI_P16_AUX = @as(u32, 22); pub const MM_OPTI_M32_WAVEIN = @as(u32, 32); pub const MM_OPTI_M32_WAVEOUT = @as(u32, 33); pub const MM_OPTI_M32_MIDIIN = @as(u32, 34); pub const MM_OPTI_M32_MIDIOUT = @as(u32, 35); pub const MM_OPTI_M32_SYNTH_STEREO = @as(u32, 36); pub const MM_OPTI_M32_MIXER = @as(u32, 37); pub const MM_OPTI_M32_AUX = @as(u32, 38); pub const MM_COMPAQ_BB_WAVEIN = @as(u32, 1); pub const MM_COMPAQ_BB_WAVEOUT = @as(u32, 2); pub const MM_COMPAQ_BB_WAVEAUX = @as(u32, 3); pub const MM_MPTUS_SPWAVEOUT = @as(u32, 1); pub const MM_LERNOUT_ANDHAUSPIE_LHCODECACM = @as(u32, 1); pub const MM_DIGITAL_AV320_WAVEIN = @as(u32, 1); pub const MM_DIGITAL_AV320_WAVEOUT = @as(u32, 2); pub const MM_DIGITAL_ACM_G723 = @as(u32, 3); pub const MM_DIGITAL_ICM_H263 = @as(u32, 4); pub const MM_DIGITAL_ICM_H261 = @as(u32, 5); pub const MM_MOTU_MTP_MIDIOUT_ALL = @as(u32, 100); pub const MM_MOTU_MTP_MIDIIN_1 = @as(u32, 101); pub const MM_MOTU_MTP_MIDIOUT_1 = @as(u32, 101); pub const MM_MOTU_MTP_MIDIIN_2 = @as(u32, 102); pub const MM_MOTU_MTP_MIDIOUT_2 = @as(u32, 102); pub const MM_MOTU_MTP_MIDIIN_3 = @as(u32, 103); pub const MM_MOTU_MTP_MIDIOUT_3 = @as(u32, 103); pub const MM_MOTU_MTP_MIDIIN_4 = @as(u32, 104); pub const MM_MOTU_MTP_MIDIOUT_4 = @as(u32, 104); pub const MM_MOTU_MTP_MIDIIN_5 = @as(u32, 105); pub const MM_MOTU_MTP_MIDIOUT_5 = @as(u32, 105); pub const MM_MOTU_MTP_MIDIIN_6 = @as(u32, 106); pub const MM_MOTU_MTP_MIDIOUT_6 = @as(u32, 106); pub const MM_MOTU_MTP_MIDIIN_7 = @as(u32, 107); pub const MM_MOTU_MTP_MIDIOUT_7 = @as(u32, 107); pub const MM_MOTU_MTP_MIDIIN_8 = @as(u32, 108); pub const MM_MOTU_MTP_MIDIOUT_8 = @as(u32, 108); pub const MM_MOTU_MTPII_MIDIOUT_ALL = @as(u32, 200); pub const MM_MOTU_MTPII_MIDIIN_SYNC = @as(u32, 200); pub const MM_MOTU_MTPII_MIDIIN_1 = @as(u32, 201); pub const MM_MOTU_MTPII_MIDIOUT_1 = @as(u32, 201); pub const MM_MOTU_MTPII_MIDIIN_2 = @as(u32, 202); pub const MM_MOTU_MTPII_MIDIOUT_2 = @as(u32, 202); pub const MM_MOTU_MTPII_MIDIIN_3 = @as(u32, 203); pub const MM_MOTU_MTPII_MIDIOUT_3 = @as(u32, 203); pub const MM_MOTU_MTPII_MIDIIN_4 = @as(u32, 204); pub const MM_MOTU_MTPII_MIDIOUT_4 = @as(u32, 204); pub const MM_MOTU_MTPII_MIDIIN_5 = @as(u32, 205); pub const MM_MOTU_MTPII_MIDIOUT_5 = @as(u32, 205); pub const MM_MOTU_MTPII_MIDIIN_6 = @as(u32, 206); pub const MM_MOTU_MTPII_MIDIOUT_6 = @as(u32, 206); pub const MM_MOTU_MTPII_MIDIIN_7 = @as(u32, 207); pub const MM_MOTU_MTPII_MIDIOUT_7 = @as(u32, 207); pub const MM_MOTU_MTPII_MIDIIN_8 = @as(u32, 208); pub const MM_MOTU_MTPII_MIDIOUT_8 = @as(u32, 208); pub const MM_MOTU_MTPII_NET_MIDIIN_1 = @as(u32, 209); pub const MM_MOTU_MTPII_NET_MIDIOUT_1 = @as(u32, 209); pub const MM_MOTU_MTPII_NET_MIDIIN_2 = @as(u32, 210); pub const MM_MOTU_MTPII_NET_MIDIOUT_2 = @as(u32, 210); pub const MM_MOTU_MTPII_NET_MIDIIN_3 = @as(u32, 211); pub const MM_MOTU_MTPII_NET_MIDIOUT_3 = @as(u32, 211); pub const MM_MOTU_MTPII_NET_MIDIIN_4 = @as(u32, 212); pub const MM_MOTU_MTPII_NET_MIDIOUT_4 = @as(u32, 212); pub const MM_MOTU_MTPII_NET_MIDIIN_5 = @as(u32, 213); pub const MM_MOTU_MTPII_NET_MIDIOUT_5 = @as(u32, 213); pub const MM_MOTU_MTPII_NET_MIDIIN_6 = @as(u32, 214); pub const MM_MOTU_MTPII_NET_MIDIOUT_6 = @as(u32, 214); pub const MM_MOTU_MTPII_NET_MIDIIN_7 = @as(u32, 215); pub const MM_MOTU_MTPII_NET_MIDIOUT_7 = @as(u32, 215); pub const MM_MOTU_MTPII_NET_MIDIIN_8 = @as(u32, 216); pub const MM_MOTU_MTPII_NET_MIDIOUT_8 = @as(u32, 216); pub const MM_MOTU_MXP_MIDIIN_MIDIOUT_ALL = @as(u32, 300); pub const MM_MOTU_MXP_MIDIIN_SYNC = @as(u32, 300); pub const MM_MOTU_MXP_MIDIIN_MIDIIN_1 = @as(u32, 301); pub const MM_MOTU_MXP_MIDIIN_MIDIOUT_1 = @as(u32, 301); pub const MM_MOTU_MXP_MIDIIN_MIDIIN_2 = @as(u32, 302); pub const MM_MOTU_MXP_MIDIIN_MIDIOUT_2 = @as(u32, 302); pub const MM_MOTU_MXP_MIDIIN_MIDIIN_3 = @as(u32, 303); pub const MM_MOTU_MXP_MIDIIN_MIDIOUT_3 = @as(u32, 303); pub const MM_MOTU_MXP_MIDIIN_MIDIIN_4 = @as(u32, 304); pub const MM_MOTU_MXP_MIDIIN_MIDIOUT_4 = @as(u32, 304); pub const MM_MOTU_MXP_MIDIIN_MIDIIN_5 = @as(u32, 305); pub const MM_MOTU_MXP_MIDIIN_MIDIOUT_5 = @as(u32, 305); pub const MM_MOTU_MXP_MIDIIN_MIDIIN_6 = @as(u32, 306); pub const MM_MOTU_MXP_MIDIIN_MIDIOUT_6 = @as(u32, 306); pub const MM_MOTU_MXPMPU_MIDIOUT_ALL = @as(u32, 400); pub const MM_MOTU_MXPMPU_MIDIIN_SYNC = @as(u32, 400); pub const MM_MOTU_MXPMPU_MIDIIN_1 = @as(u32, 401); pub const MM_MOTU_MXPMPU_MIDIOUT_1 = @as(u32, 401); pub const MM_MOTU_MXPMPU_MIDIIN_2 = @as(u32, 402); pub const MM_MOTU_MXPMPU_MIDIOUT_2 = @as(u32, 402); pub const MM_MOTU_MXPMPU_MIDIIN_3 = @as(u32, 403); pub const MM_MOTU_MXPMPU_MIDIOUT_3 = @as(u32, 403); pub const MM_MOTU_MXPMPU_MIDIIN_4 = @as(u32, 404); pub const MM_MOTU_MXPMPU_MIDIOUT_4 = @as(u32, 404); pub const MM_MOTU_MXPMPU_MIDIIN_5 = @as(u32, 405); pub const MM_MOTU_MXPMPU_MIDIOUT_5 = @as(u32, 405); pub const MM_MOTU_MXPMPU_MIDIIN_6 = @as(u32, 406); pub const MM_MOTU_MXPMPU_MIDIOUT_6 = @as(u32, 406); pub const MM_MOTU_MXN_MIDIOUT_ALL = @as(u32, 500); pub const MM_MOTU_MXN_MIDIIN_SYNC = @as(u32, 500); pub const MM_MOTU_MXN_MIDIIN_1 = @as(u32, 501); pub const MM_MOTU_MXN_MIDIOUT_1 = @as(u32, 501); pub const MM_MOTU_MXN_MIDIIN_2 = @as(u32, 502); pub const MM_MOTU_MXN_MIDIOUT_2 = @as(u32, 502); pub const MM_MOTU_MXN_MIDIIN_3 = @as(u32, 503); pub const MM_MOTU_MXN_MIDIOUT_3 = @as(u32, 503); pub const MM_MOTU_MXN_MIDIIN_4 = @as(u32, 504); pub const MM_MOTU_MXN_MIDIOUT_4 = @as(u32, 504); pub const MM_MOTU_FLYER_MIDI_IN_SYNC = @as(u32, 600); pub const MM_MOTU_FLYER_MIDI_IN_A = @as(u32, 601); pub const MM_MOTU_FLYER_MIDI_OUT_A = @as(u32, 601); pub const MM_MOTU_FLYER_MIDI_IN_B = @as(u32, 602); pub const MM_MOTU_FLYER_MIDI_OUT_B = @as(u32, 602); pub const MM_MOTU_PKX_MIDI_IN_SYNC = @as(u32, 700); pub const MM_MOTU_PKX_MIDI_IN_A = @as(u32, 701); pub const MM_MOTU_PKX_MIDI_OUT_A = @as(u32, 701); pub const MM_MOTU_PKX_MIDI_IN_B = @as(u32, 702); pub const MM_MOTU_PKX_MIDI_OUT_B = @as(u32, 702); pub const MM_MOTU_DTX_MIDI_IN_SYNC = @as(u32, 800); pub const MM_MOTU_DTX_MIDI_IN_A = @as(u32, 801); pub const MM_MOTU_DTX_MIDI_OUT_A = @as(u32, 801); pub const MM_MOTU_DTX_MIDI_IN_B = @as(u32, 802); pub const MM_MOTU_DTX_MIDI_OUT_B = @as(u32, 802); pub const MM_MOTU_MTPAV_MIDIOUT_ALL = @as(u32, 900); pub const MM_MOTU_MTPAV_MIDIIN_SYNC = @as(u32, 900); pub const MM_MOTU_MTPAV_MIDIIN_1 = @as(u32, 901); pub const MM_MOTU_MTPAV_MIDIOUT_1 = @as(u32, 901); pub const MM_MOTU_MTPAV_MIDIIN_2 = @as(u32, 902); pub const MM_MOTU_MTPAV_MIDIOUT_2 = @as(u32, 902); pub const MM_MOTU_MTPAV_MIDIIN_3 = @as(u32, 903); pub const MM_MOTU_MTPAV_MIDIOUT_3 = @as(u32, 903); pub const MM_MOTU_MTPAV_MIDIIN_4 = @as(u32, 904); pub const MM_MOTU_MTPAV_MIDIOUT_4 = @as(u32, 904); pub const MM_MOTU_MTPAV_MIDIIN_5 = @as(u32, 905); pub const MM_MOTU_MTPAV_MIDIOUT_5 = @as(u32, 905); pub const MM_MOTU_MTPAV_MIDIIN_6 = @as(u32, 906); pub const MM_MOTU_MTPAV_MIDIOUT_6 = @as(u32, 906); pub const MM_MOTU_MTPAV_MIDIIN_7 = @as(u32, 907); pub const MM_MOTU_MTPAV_MIDIOUT_7 = @as(u32, 907); pub const MM_MOTU_MTPAV_MIDIIN_8 = @as(u32, 908); pub const MM_MOTU_MTPAV_MIDIOUT_8 = @as(u32, 908); pub const MM_MOTU_MTPAV_NET_MIDIIN_1 = @as(u32, 909); pub const MM_MOTU_MTPAV_NET_MIDIOUT_1 = @as(u32, 909); pub const MM_MOTU_MTPAV_NET_MIDIIN_2 = @as(u32, 910); pub const MM_MOTU_MTPAV_NET_MIDIOUT_2 = @as(u32, 910); pub const MM_MOTU_MTPAV_NET_MIDIIN_3 = @as(u32, 911); pub const MM_MOTU_MTPAV_NET_MIDIOUT_3 = @as(u32, 911); pub const MM_MOTU_MTPAV_NET_MIDIIN_4 = @as(u32, 912); pub const MM_MOTU_MTPAV_NET_MIDIOUT_4 = @as(u32, 912); pub const MM_MOTU_MTPAV_NET_MIDIIN_5 = @as(u32, 913); pub const MM_MOTU_MTPAV_NET_MIDIOUT_5 = @as(u32, 913); pub const MM_MOTU_MTPAV_NET_MIDIIN_6 = @as(u32, 914); pub const MM_MOTU_MTPAV_NET_MIDIOUT_6 = @as(u32, 914); pub const MM_MOTU_MTPAV_NET_MIDIIN_7 = @as(u32, 915); pub const MM_MOTU_MTPAV_NET_MIDIOUT_7 = @as(u32, 915); pub const MM_MOTU_MTPAV_NET_MIDIIN_8 = @as(u32, 916); pub const MM_MOTU_MTPAV_NET_MIDIOUT_8 = @as(u32, 916); pub const MM_MOTU_MTPAV_MIDIIN_ADAT = @as(u32, 917); pub const MM_MOTU_MTPAV_MIDIOUT_ADAT = @as(u32, 917); pub const MM_MOTU_MXPXT_MIDIIN_SYNC = @as(u32, 1000); pub const MM_MOTU_MXPXT_MIDIOUT_ALL = @as(u32, 1000); pub const MM_MOTU_MXPXT_MIDIIN_1 = @as(u32, 1001); pub const MM_MOTU_MXPXT_MIDIOUT_1 = @as(u32, 1001); pub const MM_MOTU_MXPXT_MIDIOUT_2 = @as(u32, 1002); pub const MM_MOTU_MXPXT_MIDIIN_2 = @as(u32, 1002); pub const MM_MOTU_MXPXT_MIDIIN_3 = @as(u32, 1003); pub const MM_MOTU_MXPXT_MIDIOUT_3 = @as(u32, 1003); pub const MM_MOTU_MXPXT_MIDIIN_4 = @as(u32, 1004); pub const MM_MOTU_MXPXT_MIDIOUT_4 = @as(u32, 1004); pub const MM_MOTU_MXPXT_MIDIIN_5 = @as(u32, 1005); pub const MM_MOTU_MXPXT_MIDIOUT_5 = @as(u32, 1005); pub const MM_MOTU_MXPXT_MIDIOUT_6 = @as(u32, 1006); pub const MM_MOTU_MXPXT_MIDIIN_6 = @as(u32, 1006); pub const MM_MOTU_MXPXT_MIDIOUT_7 = @as(u32, 1007); pub const MM_MOTU_MXPXT_MIDIIN_7 = @as(u32, 1007); pub const MM_MOTU_MXPXT_MIDIOUT_8 = @as(u32, 1008); pub const MM_MOTU_MXPXT_MIDIIN_8 = @as(u32, 1008); pub const MM_WORKBIT_MIXER = @as(u32, 1); pub const MM_WORKBIT_WAVEOUT = @as(u32, 2); pub const MM_WORKBIT_WAVEIN = @as(u32, 3); pub const MM_WORKBIT_MIDIIN = @as(u32, 4); pub const MM_WORKBIT_MIDIOUT = @as(u32, 5); pub const MM_WORKBIT_FMSYNTH = @as(u32, 6); pub const MM_WORKBIT_AUX = @as(u32, 7); pub const MM_WORKBIT_JOYSTICK = @as(u32, 8); pub const MM_OSITECH_TRUMPCARD = @as(u32, 1); pub const MM_MIRO_MOVIEPRO = @as(u32, 1); pub const MM_MIRO_VIDEOD1 = @as(u32, 2); pub const MM_MIRO_VIDEODC1TV = @as(u32, 3); pub const MM_MIRO_VIDEOTD = @as(u32, 4); pub const MM_MIRO_DC30_WAVEOUT = @as(u32, 5); pub const MM_MIRO_DC30_WAVEIN = @as(u32, 6); pub const MM_MIRO_DC30_MIX = @as(u32, 7); pub const MM_ISOLUTION_PASCAL = @as(u32, 1); pub const MM_VOICEMIXER = @as(u32, 1); pub const ROCKWELL_WA1_WAVEIN = @as(u32, 100); pub const ROCKWELL_WA1_WAVEOUT = @as(u32, 101); pub const ROCKWELL_WA1_SYNTH = @as(u32, 102); pub const ROCKWELL_WA1_MIXER = @as(u32, 103); pub const ROCKWELL_WA1_MPU401_IN = @as(u32, 104); pub const ROCKWELL_WA1_MPU401_OUT = @as(u32, 105); pub const ROCKWELL_WA2_WAVEIN = @as(u32, 200); pub const ROCKWELL_WA2_WAVEOUT = @as(u32, 201); pub const ROCKWELL_WA2_SYNTH = @as(u32, 202); pub const ROCKWELL_WA2_MIXER = @as(u32, 203); pub const ROCKWELL_WA2_MPU401_IN = @as(u32, 204); pub const ROCKWELL_WA2_MPU401_OUT = @as(u32, 205); pub const MM_VOXWARE_CODEC = @as(u32, 1); pub const MM_NORTEL_MPXAC_WAVEIN = @as(u32, 1); pub const MM_NORTEL_MPXAC_WAVEOUT = @as(u32, 2); pub const MM_ADDX_PCTV_DIGITALMIX = @as(u32, 1); pub const MM_ADDX_PCTV_WAVEIN = @as(u32, 2); pub const MM_ADDX_PCTV_WAVEOUT = @as(u32, 3); pub const MM_ADDX_PCTV_MIXER = @as(u32, 4); pub const MM_ADDX_PCTV_AUX_CD = @as(u32, 5); pub const MM_ADDX_PCTV_AUX_LINE = @as(u32, 6); pub const MM_WILDCAT_AUTOSCOREMIDIIN = @as(u32, 1); pub const MM_RHETOREX_WAVEIN = @as(u32, 1); pub const MM_RHETOREX_WAVEOUT = @as(u32, 2); pub const MM_BTV_WAVEIN = @as(u32, 1); pub const MM_BTV_WAVEOUT = @as(u32, 2); pub const MM_BTV_MIDIIN = @as(u32, 3); pub const MM_BTV_MIDIOUT = @as(u32, 4); pub const MM_BTV_MIDISYNTH = @as(u32, 5); pub const MM_BTV_AUX_LINE = @as(u32, 6); pub const MM_BTV_AUX_MIC = @as(u32, 7); pub const MM_BTV_AUX_CD = @as(u32, 8); pub const MM_BTV_DIGITALIN = @as(u32, 9); pub const MM_BTV_DIGITALOUT = @as(u32, 10); pub const MM_BTV_MIDIWAVESTREAM = @as(u32, 11); pub const MM_BTV_MIXER = @as(u32, 12); pub const MM_ENSONIQ_SOUNDSCAPE = @as(u32, 16); pub const MM_SOUNDSCAPE_WAVEOUT = @as(u32, 17); pub const MM_SOUNDSCAPE_WAVEOUT_AUX = @as(u32, 18); pub const MM_SOUNDSCAPE_WAVEIN = @as(u32, 19); pub const MM_SOUNDSCAPE_MIDIOUT = @as(u32, 20); pub const MM_SOUNDSCAPE_MIDIIN = @as(u32, 21); pub const MM_SOUNDSCAPE_SYNTH = @as(u32, 22); pub const MM_SOUNDSCAPE_MIXER = @as(u32, 23); pub const MM_SOUNDSCAPE_AUX = @as(u32, 24); pub const MM_NVIDIA_WAVEOUT = @as(u32, 1); pub const MM_NVIDIA_WAVEIN = @as(u32, 2); pub const MM_NVIDIA_MIDIOUT = @as(u32, 3); pub const MM_NVIDIA_MIDIIN = @as(u32, 4); pub const MM_NVIDIA_GAMEPORT = @as(u32, 5); pub const MM_NVIDIA_MIXER = @as(u32, 6); pub const MM_NVIDIA_AUX = @as(u32, 7); pub const MM_OKSORI_BASE = @as(u32, 0); pub const MM_OKSORI_OSR8_WAVEOUT = @as(u32, 1); pub const MM_OKSORI_OSR8_WAVEIN = @as(u32, 2); pub const MM_OKSORI_OSR16_WAVEOUT = @as(u32, 3); pub const MM_OKSORI_OSR16_WAVEIN = @as(u32, 4); pub const MM_OKSORI_FM_OPL4 = @as(u32, 5); pub const MM_OKSORI_MIX_MASTER = @as(u32, 6); pub const MM_OKSORI_MIX_WAVE = @as(u32, 7); pub const MM_OKSORI_MIX_FM = @as(u32, 8); pub const MM_OKSORI_MIX_LINE = @as(u32, 9); pub const MM_OKSORI_MIX_CD = @as(u32, 10); pub const MM_OKSORI_MIX_MIC = @as(u32, 11); pub const MM_OKSORI_MIX_ECHO = @as(u32, 12); pub const MM_OKSORI_MIX_AUX1 = @as(u32, 13); pub const MM_OKSORI_MIX_LINE1 = @as(u32, 14); pub const MM_OKSORI_EXT_MIC1 = @as(u32, 15); pub const MM_OKSORI_EXT_MIC2 = @as(u32, 16); pub const MM_OKSORI_MIDIOUT = @as(u32, 17); pub const MM_OKSORI_MIDIIN = @as(u32, 18); pub const MM_OKSORI_MPEG_CDVISION = @as(u32, 19); pub const MM_DIACOUSTICS_DRUM_ACTION = @as(u32, 1); pub const MM_KAY_ELEMETRICS_CSL = @as(u32, 17152); pub const MM_KAY_ELEMETRICS_CSL_DAT = @as(u32, 17160); pub const MM_KAY_ELEMETRICS_CSL_4CHANNEL = @as(u32, 17161); pub const MM_CRYSTAL_CS4232_WAVEIN = @as(u32, 1); pub const MM_CRYSTAL_CS4232_WAVEOUT = @as(u32, 2); pub const MM_CRYSTAL_CS4232_WAVEMIXER = @as(u32, 3); pub const MM_CRYSTAL_CS4232_WAVEAUX_AUX1 = @as(u32, 4); pub const MM_CRYSTAL_CS4232_WAVEAUX_AUX2 = @as(u32, 5); pub const MM_CRYSTAL_CS4232_WAVEAUX_LINE = @as(u32, 6); pub const MM_CRYSTAL_CS4232_WAVEAUX_MONO = @as(u32, 7); pub const MM_CRYSTAL_CS4232_WAVEAUX_MASTER = @as(u32, 8); pub const MM_CRYSTAL_CS4232_MIDIIN = @as(u32, 9); pub const MM_CRYSTAL_CS4232_MIDIOUT = @as(u32, 10); pub const MM_CRYSTAL_CS4232_INPUTGAIN_AUX1 = @as(u32, 13); pub const MM_CRYSTAL_CS4232_INPUTGAIN_LOOP = @as(u32, 14); pub const MM_CRYSTAL_SOUND_FUSION_WAVEIN = @as(u32, 21); pub const MM_CRYSTAL_SOUND_FUSION_WAVEOUT = @as(u32, 22); pub const MM_CRYSTAL_SOUND_FUSION_MIXER = @as(u32, 23); pub const MM_CRYSTAL_SOUND_FUSION_MIDIIN = @as(u32, 24); pub const MM_CRYSTAL_SOUND_FUSION_MIDIOUT = @as(u32, 25); pub const MM_CRYSTAL_SOUND_FUSION_JOYSTICK = @as(u32, 26); pub const MM_QUARTERDECK_LHWAVEIN = @as(u32, 0); pub const MM_QUARTERDECK_LHWAVEOUT = @as(u32, 1); pub const MM_TDK_MW_MIDI_SYNTH = @as(u32, 1); pub const MM_TDK_MW_MIDI_IN = @as(u32, 2); pub const MM_TDK_MW_MIDI_OUT = @as(u32, 3); pub const MM_TDK_MW_WAVE_IN = @as(u32, 4); pub const MM_TDK_MW_WAVE_OUT = @as(u32, 5); pub const MM_TDK_MW_AUX = @as(u32, 6); pub const MM_TDK_MW_MIXER = @as(u32, 10); pub const MM_TDK_MW_AUX_MASTER = @as(u32, 100); pub const MM_TDK_MW_AUX_BASS = @as(u32, 101); pub const MM_TDK_MW_AUX_TREBLE = @as(u32, 102); pub const MM_TDK_MW_AUX_MIDI_VOL = @as(u32, 103); pub const MM_TDK_MW_AUX_WAVE_VOL = @as(u32, 104); pub const MM_TDK_MW_AUX_WAVE_RVB = @as(u32, 105); pub const MM_TDK_MW_AUX_WAVE_CHR = @as(u32, 106); pub const MM_TDK_MW_AUX_VOL = @as(u32, 107); pub const MM_TDK_MW_AUX_RVB = @as(u32, 108); pub const MM_TDK_MW_AUX_CHR = @as(u32, 109); pub const MM_DIGITAL_AUDIO_LABS_TC = @as(u32, 1); pub const MM_DIGITAL_AUDIO_LABS_DOC = @as(u32, 2); pub const MM_DIGITAL_AUDIO_LABS_V8 = @as(u32, 16); pub const MM_DIGITAL_AUDIO_LABS_CPRO = @as(u32, 17); pub const MM_DIGITAL_AUDIO_LABS_VP = @as(u32, 18); pub const MM_DIGITAL_AUDIO_LABS_CDLX = @as(u32, 19); pub const MM_DIGITAL_AUDIO_LABS_CTDIF = @as(u32, 20); pub const MM_SEERSYS_SEERSYNTH = @as(u32, 1); pub const MM_SEERSYS_SEERWAVE = @as(u32, 2); pub const MM_SEERSYS_SEERMIX = @as(u32, 3); pub const MM_SEERSYS_WAVESYNTH = @as(u32, 4); pub const MM_SEERSYS_WAVESYNTH_WG = @as(u32, 5); pub const MM_SEERSYS_REALITY = @as(u32, 6); pub const MM_OSPREY_1000WAVEIN = @as(u32, 1); pub const MM_OSPREY_1000WAVEOUT = @as(u32, 2); pub const MM_SOUNDESIGNS_WAVEIN = @as(u32, 1); pub const MM_SOUNDESIGNS_WAVEOUT = @as(u32, 2); pub const MM_SSP_SNDFESWAVEIN = @as(u32, 1); pub const MM_SSP_SNDFESWAVEOUT = @as(u32, 2); pub const MM_SSP_SNDFESMIDIIN = @as(u32, 3); pub const MM_SSP_SNDFESMIDIOUT = @as(u32, 4); pub const MM_SSP_SNDFESSYNTH = @as(u32, 5); pub const MM_SSP_SNDFESMIX = @as(u32, 6); pub const MM_SSP_SNDFESAUX = @as(u32, 7); pub const MM_ECS_AADF_MIDI_IN = @as(u32, 10); pub const MM_ECS_AADF_MIDI_OUT = @as(u32, 11); pub const MM_ECS_AADF_WAVE2MIDI_IN = @as(u32, 12); pub const MM_AMD_INTERWAVE_WAVEIN = @as(u32, 1); pub const MM_AMD_INTERWAVE_WAVEOUT = @as(u32, 2); pub const MM_AMD_INTERWAVE_SYNTH = @as(u32, 3); pub const MM_AMD_INTERWAVE_MIXER1 = @as(u32, 4); pub const MM_AMD_INTERWAVE_MIXER2 = @as(u32, 5); pub const MM_AMD_INTERWAVE_JOYSTICK = @as(u32, 6); pub const MM_AMD_INTERWAVE_EX_CD = @as(u32, 7); pub const MM_AMD_INTERWAVE_MIDIIN = @as(u32, 8); pub const MM_AMD_INTERWAVE_MIDIOUT = @as(u32, 9); pub const MM_AMD_INTERWAVE_AUX1 = @as(u32, 10); pub const MM_AMD_INTERWAVE_AUX2 = @as(u32, 11); pub const MM_AMD_INTERWAVE_AUX_MIC = @as(u32, 12); pub const MM_AMD_INTERWAVE_AUX_CD = @as(u32, 13); pub const MM_AMD_INTERWAVE_MONO_IN = @as(u32, 14); pub const MM_AMD_INTERWAVE_MONO_OUT = @as(u32, 15); pub const MM_AMD_INTERWAVE_EX_TELEPHONY = @as(u32, 16); pub const MM_AMD_INTERWAVE_WAVEOUT_BASE = @as(u32, 17); pub const MM_AMD_INTERWAVE_WAVEOUT_TREBLE = @as(u32, 18); pub const MM_AMD_INTERWAVE_STEREO_ENHANCED = @as(u32, 19); pub const MM_COREDYNAMICS_DYNAMIXHR = @as(u32, 1); pub const MM_COREDYNAMICS_DYNASONIX_SYNTH = @as(u32, 2); pub const MM_COREDYNAMICS_DYNASONIX_MIDI_IN = @as(u32, 3); pub const MM_COREDYNAMICS_DYNASONIX_MIDI_OUT = @as(u32, 4); pub const MM_COREDYNAMICS_DYNASONIX_WAVE_IN = @as(u32, 5); pub const MM_COREDYNAMICS_DYNASONIX_WAVE_OUT = @as(u32, 6); pub const MM_COREDYNAMICS_DYNASONIX_AUDIO_IN = @as(u32, 7); pub const MM_COREDYNAMICS_DYNASONIX_AUDIO_OUT = @as(u32, 8); pub const MM_COREDYNAMICS_DYNAGRAFX_VGA = @as(u32, 9); pub const MM_COREDYNAMICS_DYNAGRAFX_WAVE_IN = @as(u32, 10); pub const MM_COREDYNAMICS_DYNAGRAFX_WAVE_OUT = @as(u32, 11); pub const MM_CANAM_CBXWAVEOUT = @as(u32, 1); pub const MM_CANAM_CBXWAVEIN = @as(u32, 2); pub const MM_SOFTSOUND_CODEC = @as(u32, 1); pub const MM_NORRIS_VOICELINK = @as(u32, 1); pub const MM_DDD_MIDILINK_MIDIIN = @as(u32, 1); pub const MM_DDD_MIDILINK_MIDIOUT = @as(u32, 2); pub const MM_EUPHONICS_AUX_CD = @as(u32, 1); pub const MM_EUPHONICS_AUX_LINE = @as(u32, 2); pub const MM_EUPHONICS_AUX_MASTER = @as(u32, 3); pub const MM_EUPHONICS_AUX_MIC = @as(u32, 4); pub const MM_EUPHONICS_AUX_MIDI = @as(u32, 5); pub const MM_EUPHONICS_AUX_WAVE = @as(u32, 6); pub const MM_EUPHONICS_FMSYNTH_MONO = @as(u32, 7); pub const MM_EUPHONICS_FMSYNTH_STEREO = @as(u32, 8); pub const MM_EUPHONICS_MIDIIN = @as(u32, 9); pub const MM_EUPHONICS_MIDIOUT = @as(u32, 10); pub const MM_EUPHONICS_MIXER = @as(u32, 11); pub const MM_EUPHONICS_WAVEIN = @as(u32, 12); pub const MM_EUPHONICS_WAVEOUT = @as(u32, 13); pub const MM_EUPHONICS_EUSYNTH = @as(u32, 14); pub const CRYSTAL_NET_SFM_CODEC = @as(u32, 1); pub const MM_CHROMATIC_M1 = @as(u32, 1); pub const MM_CHROMATIC_M1_WAVEIN = @as(u32, 2); pub const MM_CHROMATIC_M1_WAVEOUT = @as(u32, 3); pub const MM_CHROMATIC_M1_FMSYNTH = @as(u32, 4); pub const MM_CHROMATIC_M1_MIXER = @as(u32, 5); pub const MM_CHROMATIC_M1_AUX = @as(u32, 6); pub const MM_CHROMATIC_M1_AUX_CD = @as(u32, 7); pub const MM_CHROMATIC_M1_MIDIIN = @as(u32, 8); pub const MM_CHROMATIC_M1_MIDIOUT = @as(u32, 9); pub const MM_CHROMATIC_M1_WTSYNTH = @as(u32, 16); pub const MM_CHROMATIC_M1_MPEGWAVEIN = @as(u32, 17); pub const MM_CHROMATIC_M1_MPEGWAVEOUT = @as(u32, 18); pub const MM_CHROMATIC_M2 = @as(u32, 19); pub const MM_CHROMATIC_M2_WAVEIN = @as(u32, 20); pub const MM_CHROMATIC_M2_WAVEOUT = @as(u32, 21); pub const MM_CHROMATIC_M2_FMSYNTH = @as(u32, 22); pub const MM_CHROMATIC_M2_MIXER = @as(u32, 23); pub const MM_CHROMATIC_M2_AUX = @as(u32, 24); pub const MM_CHROMATIC_M2_AUX_CD = @as(u32, 25); pub const MM_CHROMATIC_M2_MIDIIN = @as(u32, 32); pub const MM_CHROMATIC_M2_MIDIOUT = @as(u32, 33); pub const MM_CHROMATIC_M2_WTSYNTH = @as(u32, 34); pub const MM_CHROMATIC_M2_MPEGWAVEIN = @as(u32, 35); pub const MM_CHROMATIC_M2_MPEGWAVEOUT = @as(u32, 36); pub const MM_VIENNASYS_TSP_WAVE_DRIVER = @as(u32, 1); pub const MM_CONNECTIX_VIDEC_CODEC = @as(u32, 1); pub const MM_GADGETLABS_WAVE44_WAVEIN = @as(u32, 1); pub const MM_GADGETLABS_WAVE44_WAVEOUT = @as(u32, 2); pub const MM_GADGETLABS_WAVE42_WAVEIN = @as(u32, 3); pub const MM_GADGETLABS_WAVE42_WAVEOUT = @as(u32, 4); pub const MM_GADGETLABS_WAVE4_MIDIIN = @as(u32, 5); pub const MM_GADGETLABS_WAVE4_MIDIOUT = @as(u32, 6); pub const MM_FRONTIER_WAVECENTER_MIDIIN = @as(u32, 1); pub const MM_FRONTIER_WAVECENTER_MIDIOUT = @as(u32, 2); pub const MM_FRONTIER_WAVECENTER_WAVEIN = @as(u32, 3); pub const MM_FRONTIER_WAVECENTER_WAVEOUT = @as(u32, 4); pub const MM_VIONA_QVINPCI_MIXER = @as(u32, 1); pub const MM_VIONA_QVINPCI_WAVEIN = @as(u32, 2); pub const MM_VIONAQVINPCI_WAVEOUT = @as(u32, 3); pub const MM_VIONA_BUSTER_MIXER = @as(u32, 4); pub const MM_VIONA_CINEMASTER_MIXER = @as(u32, 5); pub const MM_VIONA_CONCERTO_MIXER = @as(u32, 6); pub const MM_CASIO_WP150_MIDIOUT = @as(u32, 1); pub const MM_CASIO_WP150_MIDIIN = @as(u32, 2); pub const MM_CASIO_LSG_MIDIOUT = @as(u32, 3); pub const MM_DIMD_PLATFORM = @as(u32, 0); pub const MM_DIMD_DIRSOUND = @as(u32, 1); pub const MM_DIMD_VIRTMPU = @as(u32, 2); pub const MM_DIMD_VIRTSB = @as(u32, 3); pub const MM_DIMD_VIRTJOY = @as(u32, 4); pub const MM_DIMD_WAVEIN = @as(u32, 5); pub const MM_DIMD_WAVEOUT = @as(u32, 6); pub const MM_DIMD_MIDIIN = @as(u32, 7); pub const MM_DIMD_MIDIOUT = @as(u32, 8); pub const MM_DIMD_AUX_LINE = @as(u32, 9); pub const MM_DIMD_MIXER = @as(u32, 10); pub const MM_DIMD_WSS_WAVEIN = @as(u32, 14); pub const MM_DIMD_WSS_WAVEOUT = @as(u32, 15); pub const MM_DIMD_WSS_MIXER = @as(u32, 17); pub const MM_DIMD_WSS_AUX = @as(u32, 21); pub const MM_DIMD_WSS_SYNTH = @as(u32, 76); pub const MM_S3_WAVEOUT = @as(u32, 1); pub const MM_S3_WAVEIN = @as(u32, 2); pub const MM_S3_MIDIOUT = @as(u32, 3); pub const MM_S3_MIDIIN = @as(u32, 4); pub const MM_S3_FMSYNTH = @as(u32, 5); pub const MM_S3_MIXER = @as(u32, 6); pub const MM_S3_AUX = @as(u32, 7); pub const MM_VKC_MPU401_MIDIIN = @as(u32, 256); pub const MM_VKC_SERIAL_MIDIIN = @as(u32, 257); pub const MM_VKC_MPU401_MIDIOUT = @as(u32, 512); pub const MM_VKC_SERIAL_MIDIOUT = @as(u32, 513); pub const MM_ZEFIRO_ZA2 = @as(u32, 2); pub const MM_FHGIIS_MPEGLAYER3_DECODE = @as(u32, 9); pub const MM_FHGIIS_MPEGLAYER3 = @as(u32, 10); pub const MM_FHGIIS_MPEGLAYER3_LITE = @as(u32, 10); pub const MM_FHGIIS_MPEGLAYER3_BASIC = @as(u32, 11); pub const MM_FHGIIS_MPEGLAYER3_ADVANCED = @as(u32, 12); pub const MM_FHGIIS_MPEGLAYER3_PROFESSIONAL = @as(u32, 13); pub const MM_FHGIIS_MPEGLAYER3_ADVANCEDPLUS = @as(u32, 14); pub const MM_QUICKNET_PJWAVEIN = @as(u32, 1); pub const MM_QUICKNET_PJWAVEOUT = @as(u32, 2); pub const MM_SICRESOURCE_SSO3D = @as(u32, 2); pub const MM_SICRESOURCE_SSOW3DI = @as(u32, 3); pub const MM_NEOMAGIC_SYNTH = @as(u32, 1); pub const MM_NEOMAGIC_WAVEOUT = @as(u32, 2); pub const MM_NEOMAGIC_WAVEIN = @as(u32, 3); pub const MM_NEOMAGIC_MIDIOUT = @as(u32, 4); pub const MM_NEOMAGIC_MIDIIN = @as(u32, 5); pub const MM_NEOMAGIC_AUX = @as(u32, 6); pub const MM_NEOMAGIC_MW3DX_WAVEOUT = @as(u32, 10); pub const MM_NEOMAGIC_MW3DX_WAVEIN = @as(u32, 11); pub const MM_NEOMAGIC_MW3DX_MIDIOUT = @as(u32, 12); pub const MM_NEOMAGIC_MW3DX_MIDIIN = @as(u32, 13); pub const MM_NEOMAGIC_MW3DX_FMSYNTH = @as(u32, 14); pub const MM_NEOMAGIC_MW3DX_GMSYNTH = @as(u32, 15); pub const MM_NEOMAGIC_MW3DX_MIXER = @as(u32, 16); pub const MM_NEOMAGIC_MW3DX_AUX = @as(u32, 17); pub const MM_NEOMAGIC_MWAVE_WAVEOUT = @as(u32, 20); pub const MM_NEOMAGIC_MWAVE_WAVEIN = @as(u32, 21); pub const MM_NEOMAGIC_MWAVE_MIDIOUT = @as(u32, 22); pub const MM_NEOMAGIC_MWAVE_MIDIIN = @as(u32, 23); pub const MM_NEOMAGIC_MWAVE_MIXER = @as(u32, 24); pub const MM_NEOMAGIC_MWAVE_AUX = @as(u32, 25); pub const MM_MERGING_MPEGL3 = @as(u32, 1); pub const MM_XIRLINK_VISIONLINK = @as(u32, 1); pub const MM_OTI_611WAVEIN = @as(u32, 5); pub const MM_OTI_611WAVEOUT = @as(u32, 6); pub const MM_OTI_611MIXER = @as(u32, 7); pub const MM_OTI_611MIDIN = @as(u32, 18); pub const MM_OTI_611MIDIOUT = @as(u32, 19); pub const MM_AUREAL_AU8820 = @as(u32, 16); pub const MM_AU8820_SYNTH = @as(u32, 17); pub const MM_AU8820_WAVEOUT = @as(u32, 18); pub const MM_AU8820_WAVEIN = @as(u32, 19); pub const MM_AU8820_MIXER = @as(u32, 20); pub const MM_AU8820_AUX = @as(u32, 21); pub const MM_AU8820_MIDIOUT = @as(u32, 22); pub const MM_AU8820_MIDIIN = @as(u32, 23); pub const MM_AUREAL_AU8830 = @as(u32, 32); pub const MM_AU8830_SYNTH = @as(u32, 33); pub const MM_AU8830_WAVEOUT = @as(u32, 34); pub const MM_AU8830_WAVEIN = @as(u32, 35); pub const MM_AU8830_MIXER = @as(u32, 36); pub const MM_AU8830_AUX = @as(u32, 37); pub const MM_AU8830_MIDIOUT = @as(u32, 38); pub const MM_AU8830_MIDIIN = @as(u32, 39); pub const MM_VIVO_AUDIO_CODEC = @as(u32, 1); pub const MM_SHARP_MDC_MIDI_SYNTH = @as(u32, 1); pub const MM_SHARP_MDC_MIDI_IN = @as(u32, 2); pub const MM_SHARP_MDC_MIDI_OUT = @as(u32, 3); pub const MM_SHARP_MDC_WAVE_IN = @as(u32, 4); pub const MM_SHARP_MDC_WAVE_OUT = @as(u32, 5); pub const MM_SHARP_MDC_AUX = @as(u32, 6); pub const MM_SHARP_MDC_MIXER = @as(u32, 10); pub const MM_SHARP_MDC_AUX_MASTER = @as(u32, 100); pub const MM_SHARP_MDC_AUX_BASS = @as(u32, 101); pub const MM_SHARP_MDC_AUX_TREBLE = @as(u32, 102); pub const MM_SHARP_MDC_AUX_MIDI_VOL = @as(u32, 103); pub const MM_SHARP_MDC_AUX_WAVE_VOL = @as(u32, 104); pub const MM_SHARP_MDC_AUX_WAVE_RVB = @as(u32, 105); pub const MM_SHARP_MDC_AUX_WAVE_CHR = @as(u32, 106); pub const MM_SHARP_MDC_AUX_VOL = @as(u32, 107); pub const MM_SHARP_MDC_AUX_RVB = @as(u32, 108); pub const MM_SHARP_MDC_AUX_CHR = @as(u32, 109); pub const MM_LUCENT_ACM_G723 = @as(u32, 0); pub const MM_ATT_G729A = @as(u32, 1); pub const MM_MARIAN_ARC44WAVEIN = @as(u32, 1); pub const MM_MARIAN_ARC44WAVEOUT = @as(u32, 2); pub const MM_MARIAN_PRODIF24WAVEIN = @as(u32, 3); pub const MM_MARIAN_PRODIF24WAVEOUT = @as(u32, 4); pub const MM_MARIAN_ARC88WAVEIN = @as(u32, 5); pub const MM_MARIAN_ARC88WAVEOUT = @as(u32, 6); pub const MM_BCB_NETBOARD_10 = @as(u32, 1); pub const MM_BCB_TT75_10 = @as(u32, 2); pub const MM_MOTIONPIXELS_MVI2 = @as(u32, 1); pub const MM_QDESIGN_ACM_MPEG = @as(u32, 1); pub const MM_QDESIGN_ACM_QDESIGN_MUSIC = @as(u32, 2); pub const MM_NMP_CCP_WAVEIN = @as(u32, 1); pub const MM_NMP_CCP_WAVEOUT = @as(u32, 2); pub const MM_NMP_ACM_AMR = @as(u32, 10); pub const MM_DF_ACM_G726 = @as(u32, 1); pub const MM_DF_ACM_GSM610 = @as(u32, 2); pub const MM_BERCOS_WAVEIN = @as(u32, 1); pub const MM_BERCOS_MIXER = @as(u32, 2); pub const MM_BERCOS_WAVEOUT = @as(u32, 3); pub const MM_ONLIVE_MPCODEC = @as(u32, 1); pub const MM_PHONET_PP_WAVEOUT = @as(u32, 1); pub const MM_PHONET_PP_WAVEIN = @as(u32, 2); pub const MM_PHONET_PP_MIXER = @as(u32, 3); pub const MM_FTR_ENCODER_WAVEIN = @as(u32, 1); pub const MM_FTR_ACM = @as(u32, 2); pub const MM_ENET_T2000_LINEIN = @as(u32, 1); pub const MM_ENET_T2000_LINEOUT = @as(u32, 2); pub const MM_ENET_T2000_HANDSETIN = @as(u32, 3); pub const MM_ENET_T2000_HANDSETOUT = @as(u32, 4); pub const MM_EMAGIC_UNITOR8 = @as(u32, 1); pub const MM_SIPROLAB_ACELPNET = @as(u32, 1); pub const MM_DICTAPHONE_G726 = @as(u32, 1); pub const MM_RZS_ACM_TUBGSM = @as(u32, 1); pub const MM_EES_PCMIDI14 = @as(u32, 1); pub const MM_EES_PCMIDI14_IN = @as(u32, 2); pub const MM_EES_PCMIDI14_OUT1 = @as(u32, 3); pub const MM_EES_PCMIDI14_OUT2 = @as(u32, 4); pub const MM_EES_PCMIDI14_OUT3 = @as(u32, 5); pub const MM_EES_PCMIDI14_OUT4 = @as(u32, 6); pub const MM_HAFTMANN_LPTDAC2 = @as(u32, 1); pub const MM_LUCID_PCI24WAVEIN = @as(u32, 1); pub const MM_LUCID_PCI24WAVEOUT = @as(u32, 2); pub const MM_HEADSPACE_HAESYNTH = @as(u32, 1); pub const MM_HEADSPACE_HAEWAVEOUT = @as(u32, 2); pub const MM_HEADSPACE_HAEWAVEIN = @as(u32, 3); pub const MM_HEADSPACE_HAEMIXER = @as(u32, 4); pub const MM_UNISYS_ACM_NAP = @as(u32, 1); pub const MM_LUMINOSITI_SCWAVEIN = @as(u32, 1); pub const MM_LUMINOSITI_SCWAVEOUT = @as(u32, 2); pub const MM_LUMINOSITI_SCWAVEMIX = @as(u32, 3); pub const MM_ACTIVEVOICE_ACM_VOXADPCM = @as(u32, 1); pub const MM_DTS_DS = @as(u32, 1); pub const MM_SOFTLAB_NSK_FRW_WAVEIN = @as(u32, 1); pub const MM_SOFTLAB_NSK_FRW_WAVEOUT = @as(u32, 2); pub const MM_SOFTLAB_NSK_FRW_MIXER = @as(u32, 3); pub const MM_SOFTLAB_NSK_FRW_AUX = @as(u32, 4); pub const MM_FORTEMEDIA_WAVEIN = @as(u32, 1); pub const MM_FORTEMEDIA_WAVEOUT = @as(u32, 2); pub const MM_FORTEMEDIA_FMSYNC = @as(u32, 3); pub const MM_FORTEMEDIA_MIXER = @as(u32, 4); pub const MM_FORTEMEDIA_AUX = @as(u32, 5); pub const MM_SONORUS_STUDIO = @as(u32, 1); pub const MM_I_LINK_VOICE_CODER = @as(u32, 1); pub const MM_SELSIUS_SYSTEMS_RTPWAVEOUT = @as(u32, 1); pub const MM_SELSIUS_SYSTEMS_RTPWAVEIN = @as(u32, 2); pub const MM_ADMOS_FM_SYNTH = @as(u32, 1); pub const MM_ADMOS_QS3AMIDIOUT = @as(u32, 2); pub const MM_ADMOS_QS3AMIDIIN = @as(u32, 3); pub const MM_ADMOS_QS3AWAVEOUT = @as(u32, 4); pub const MM_ADMOS_QS3AWAVEIN = @as(u32, 5); pub const MM_LEXICON_STUDIO_WAVE_OUT = @as(u32, 1); pub const MM_LEXICON_STUDIO_WAVE_IN = @as(u32, 2); pub const MM_SGI_320_WAVEIN = @as(u32, 1); pub const MM_SGI_320_WAVEOUT = @as(u32, 2); pub const MM_SGI_320_MIXER = @as(u32, 3); pub const MM_SGI_540_WAVEIN = @as(u32, 4); pub const MM_SGI_540_WAVEOUT = @as(u32, 5); pub const MM_SGI_540_MIXER = @as(u32, 6); pub const MM_SGI_RAD_ADATMONO1_WAVEIN = @as(u32, 7); pub const MM_SGI_RAD_ADATMONO2_WAVEIN = @as(u32, 8); pub const MM_SGI_RAD_ADATMONO3_WAVEIN = @as(u32, 9); pub const MM_SGI_RAD_ADATMONO4_WAVEIN = @as(u32, 10); pub const MM_SGI_RAD_ADATMONO5_WAVEIN = @as(u32, 11); pub const MM_SGI_RAD_ADATMONO6_WAVEIN = @as(u32, 12); pub const MM_SGI_RAD_ADATMONO7_WAVEIN = @as(u32, 13); pub const MM_SGI_RAD_ADATMONO8_WAVEIN = @as(u32, 14); pub const MM_SGI_RAD_ADATSTEREO12_WAVEIN = @as(u32, 15); pub const MM_SGI_RAD_ADATSTEREO34_WAVEIN = @as(u32, 16); pub const MM_SGI_RAD_ADATSTEREO56_WAVEIN = @as(u32, 17); pub const MM_SGI_RAD_ADATSTEREO78_WAVEIN = @as(u32, 18); pub const MM_SGI_RAD_ADAT8CHAN_WAVEIN = @as(u32, 19); pub const MM_SGI_RAD_ADATMONO1_WAVEOUT = @as(u32, 20); pub const MM_SGI_RAD_ADATMONO2_WAVEOUT = @as(u32, 21); pub const MM_SGI_RAD_ADATMONO3_WAVEOUT = @as(u32, 22); pub const MM_SGI_RAD_ADATMONO4_WAVEOUT = @as(u32, 23); pub const MM_SGI_RAD_ADATMONO5_WAVEOUT = @as(u32, 24); pub const MM_SGI_RAD_ADATMONO6_WAVEOUT = @as(u32, 25); pub const MM_SGI_RAD_ADATMONO7_WAVEOUT = @as(u32, 26); pub const MM_SGI_RAD_ADATMONO8_WAVEOUT = @as(u32, 27); pub const MM_SGI_RAD_ADATSTEREO12_WAVEOUT = @as(u32, 28); pub const MM_SGI_RAD_ADATSTEREO32_WAVEOUT = @as(u32, 29); pub const MM_SGI_RAD_ADATSTEREO56_WAVEOUT = @as(u32, 30); pub const MM_SGI_RAD_ADATSTEREO78_WAVEOUT = @as(u32, 31); pub const MM_SGI_RAD_ADAT8CHAN_WAVEOUT = @as(u32, 32); pub const MM_SGI_RAD_AESMONO1_WAVEIN = @as(u32, 33); pub const MM_SGI_RAD_AESMONO2_WAVEIN = @as(u32, 34); pub const MM_SGI_RAD_AESSTEREO_WAVEIN = @as(u32, 35); pub const MM_SGI_RAD_AESMONO1_WAVEOUT = @as(u32, 36); pub const MM_SGI_RAD_AESMONO2_WAVEOUT = @as(u32, 37); pub const MM_SGI_RAD_AESSTEREO_WAVEOUT = @as(u32, 38); pub const MM_IPI_ACM_HSX = @as(u32, 1); pub const MM_IPI_ACM_RPELP = @as(u32, 2); pub const MM_IPI_WF_ASSS = @as(u32, 3); pub const MM_IPI_AT_WAVEOUT = @as(u32, 4); pub const MM_IPI_AT_WAVEIN = @as(u32, 5); pub const MM_IPI_AT_MIXER = @as(u32, 6); pub const MM_ICE_WAVEOUT = @as(u32, 1); pub const MM_ICE_WAVEIN = @as(u32, 2); pub const MM_ICE_MTWAVEOUT = @as(u32, 3); pub const MM_ICE_MTWAVEIN = @as(u32, 4); pub const MM_ICE_MIDIOUT1 = @as(u32, 5); pub const MM_ICE_MIDIIN1 = @as(u32, 6); pub const MM_ICE_MIDIOUT2 = @as(u32, 7); pub const MM_ICE_MIDIIN2 = @as(u32, 8); pub const MM_ICE_SYNTH = @as(u32, 9); pub const MM_ICE_MIXER = @as(u32, 10); pub const MM_ICE_AUX = @as(u32, 11); pub const MM_VQST_VQC1 = @as(u32, 1); pub const MM_VQST_VQC2 = @as(u32, 2); pub const MM_ETEK_KWIKMIDI_MIDIIN = @as(u32, 1); pub const MM_ETEK_KWIKMIDI_MIDIOUT = @as(u32, 2); pub const MM_INTERNET_SSW_MIDIOUT = @as(u32, 10); pub const MM_INTERNET_SSW_MIDIIN = @as(u32, 11); pub const MM_INTERNET_SSW_WAVEOUT = @as(u32, 12); pub const MM_INTERNET_SSW_WAVEIN = @as(u32, 13); pub const MM_SONY_ACM_SCX = @as(u32, 1); pub const MM_UH_ACM_ADPCM = @as(u32, 1); pub const MM_SYDEC_NV_WAVEIN = @as(u32, 1); pub const MM_SYDEC_NV_WAVEOUT = @as(u32, 2); pub const MM_FLEXION_X300_WAVEIN = @as(u32, 1); pub const MM_FLEXION_X300_WAVEOUT = @as(u32, 2); pub const MM_VIA_WAVEOUT = @as(u32, 1); pub const MM_VIA_WAVEIN = @as(u32, 2); pub const MM_VIA_MIXER = @as(u32, 3); pub const MM_VIA_AUX = @as(u32, 4); pub const MM_VIA_MPU401_MIDIOUT = @as(u32, 5); pub const MM_VIA_MPU401_MIDIIN = @as(u32, 6); pub const MM_VIA_SWFM_SYNTH = @as(u32, 7); pub const MM_VIA_WDM_WAVEOUT = @as(u32, 8); pub const MM_VIA_WDM_WAVEIN = @as(u32, 9); pub const MM_VIA_WDM_MIXER = @as(u32, 10); pub const MM_VIA_WDM_MPU401_MIDIOUT = @as(u32, 11); pub const MM_VIA_WDM_MPU401_MIDIIN = @as(u32, 12); pub const MM_MICRONAS_SC4 = @as(u32, 1); pub const MM_MICRONAS_CLP833 = @as(u32, 2); pub const MM_HP_WAVEOUT = @as(u32, 1); pub const MM_HP_WAVEIN = @as(u32, 2); pub const MM_QUICKAUDIO_MINIMIDI = @as(u32, 1); pub const MM_QUICKAUDIO_MAXIMIDI = @as(u32, 2); pub const MM_ICCC_UNA3_WAVEIN = @as(u32, 1); pub const MM_ICCC_UNA3_WAVEOUT = @as(u32, 2); pub const MM_ICCC_UNA3_AUX = @as(u32, 3); pub const MM_ICCC_UNA3_MIXER = @as(u32, 4); pub const MM_3COM_CB_MIXER = @as(u32, 1); pub const MM_3COM_CB_WAVEIN = @as(u32, 2); pub const MM_3COM_CB_WAVEOUT = @as(u32, 3); pub const MM_MINDMAKER_GC_WAVEIN = @as(u32, 1); pub const MM_MINDMAKER_GC_WAVEOUT = @as(u32, 2); pub const MM_MINDMAKER_GC_MIXER = @as(u32, 3); pub const MM_TELEKOL_WAVEOUT = @as(u32, 1); pub const MM_TELEKOL_WAVEIN = @as(u32, 2); pub const MM_ALGOVISION_VB80WAVEOUT = @as(u32, 1); pub const MM_ALGOVISION_VB80WAVEIN = @as(u32, 2); pub const MM_ALGOVISION_VB80MIXER = @as(u32, 3); pub const MM_ALGOVISION_VB80AUX = @as(u32, 4); pub const MM_ALGOVISION_VB80AUX2 = @as(u32, 5); pub const WAVE_FORMAT_UNKNOWN = @as(u32, 0); pub const WAVE_FORMAT_ADPCM = @as(u32, 2); pub const WAVE_FORMAT_IEEE_FLOAT = @as(u32, 3); pub const WAVE_FORMAT_VSELP = @as(u32, 4); pub const WAVE_FORMAT_IBM_CVSD = @as(u32, 5); pub const WAVE_FORMAT_ALAW = @as(u32, 6); pub const WAVE_FORMAT_MULAW = @as(u32, 7); pub const WAVE_FORMAT_DTS = @as(u32, 8); pub const WAVE_FORMAT_DRM = @as(u32, 9); pub const WAVE_FORMAT_WMAVOICE9 = @as(u32, 10); pub const WAVE_FORMAT_WMAVOICE10 = @as(u32, 11); pub const WAVE_FORMAT_OKI_ADPCM = @as(u32, 16); pub const WAVE_FORMAT_DVI_ADPCM = @as(u32, 17); pub const WAVE_FORMAT_IMA_ADPCM = @as(u32, 17); pub const WAVE_FORMAT_MEDIASPACE_ADPCM = @as(u32, 18); pub const WAVE_FORMAT_SIERRA_ADPCM = @as(u32, 19); pub const WAVE_FORMAT_G723_ADPCM = @as(u32, 20); pub const WAVE_FORMAT_DIGISTD = @as(u32, 21); pub const WAVE_FORMAT_DIGIFIX = @as(u32, 22); pub const WAVE_FORMAT_DIALOGIC_OKI_ADPCM = @as(u32, 23); pub const WAVE_FORMAT_MEDIAVISION_ADPCM = @as(u32, 24); pub const WAVE_FORMAT_CU_CODEC = @as(u32, 25); pub const WAVE_FORMAT_HP_DYN_VOICE = @as(u32, 26); pub const WAVE_FORMAT_YAMAHA_ADPCM = @as(u32, 32); pub const WAVE_FORMAT_SONARC = @as(u32, 33); pub const WAVE_FORMAT_DSPGROUP_TRUESPEECH = @as(u32, 34); pub const WAVE_FORMAT_ECHOSC1 = @as(u32, 35); pub const WAVE_FORMAT_AUDIOFILE_AF36 = @as(u32, 36); pub const WAVE_FORMAT_APTX = @as(u32, 37); pub const WAVE_FORMAT_AUDIOFILE_AF10 = @as(u32, 38); pub const WAVE_FORMAT_PROSODY_1612 = @as(u32, 39); pub const WAVE_FORMAT_LRC = @as(u32, 40); pub const WAVE_FORMAT_DOLBY_AC2 = @as(u32, 48); pub const WAVE_FORMAT_GSM610 = @as(u32, 49); pub const WAVE_FORMAT_MSNAUDIO = @as(u32, 50); pub const WAVE_FORMAT_ANTEX_ADPCME = @as(u32, 51); pub const WAVE_FORMAT_CONTROL_RES_VQLPC = @as(u32, 52); pub const WAVE_FORMAT_DIGIREAL = @as(u32, 53); pub const WAVE_FORMAT_DIGIADPCM = @as(u32, 54); pub const WAVE_FORMAT_CONTROL_RES_CR10 = @as(u32, 55); pub const WAVE_FORMAT_NMS_VBXADPCM = @as(u32, 56); pub const WAVE_FORMAT_CS_IMAADPCM = @as(u32, 57); pub const WAVE_FORMAT_ECHOSC3 = @as(u32, 58); pub const WAVE_FORMAT_ROCKWELL_ADPCM = @as(u32, 59); pub const WAVE_FORMAT_ROCKWELL_DIGITALK = @as(u32, 60); pub const WAVE_FORMAT_XEBEC = @as(u32, 61); pub const WAVE_FORMAT_G721_ADPCM = @as(u32, 64); pub const WAVE_FORMAT_G728_CELP = @as(u32, 65); pub const WAVE_FORMAT_MSG723 = @as(u32, 66); pub const WAVE_FORMAT_INTEL_G723_1 = @as(u32, 67); pub const WAVE_FORMAT_INTEL_G729 = @as(u32, 68); pub const WAVE_FORMAT_SHARP_G726 = @as(u32, 69); pub const WAVE_FORMAT_MPEG = @as(u32, 80); pub const WAVE_FORMAT_RT24 = @as(u32, 82); pub const WAVE_FORMAT_PAC = @as(u32, 83); pub const WAVE_FORMAT_MPEGLAYER3 = @as(u32, 85); pub const WAVE_FORMAT_LUCENT_G723 = @as(u32, 89); pub const WAVE_FORMAT_CIRRUS = @as(u32, 96); pub const WAVE_FORMAT_ESPCM = @as(u32, 97); pub const WAVE_FORMAT_VOXWARE = @as(u32, 98); pub const WAVE_FORMAT_CANOPUS_ATRAC = @as(u32, 99); pub const WAVE_FORMAT_G726_ADPCM = @as(u32, 100); pub const WAVE_FORMAT_G722_ADPCM = @as(u32, 101); pub const WAVE_FORMAT_DSAT = @as(u32, 102); pub const WAVE_FORMAT_DSAT_DISPLAY = @as(u32, 103); pub const WAVE_FORMAT_VOXWARE_BYTE_ALIGNED = @as(u32, 105); pub const WAVE_FORMAT_VOXWARE_AC8 = @as(u32, 112); pub const WAVE_FORMAT_VOXWARE_AC10 = @as(u32, 113); pub const WAVE_FORMAT_VOXWARE_AC16 = @as(u32, 114); pub const WAVE_FORMAT_VOXWARE_AC20 = @as(u32, 115); pub const WAVE_FORMAT_VOXWARE_RT24 = @as(u32, 116); pub const WAVE_FORMAT_VOXWARE_RT29 = @as(u32, 117); pub const WAVE_FORMAT_VOXWARE_RT29HW = @as(u32, 118); pub const WAVE_FORMAT_VOXWARE_VR12 = @as(u32, 119); pub const WAVE_FORMAT_VOXWARE_VR18 = @as(u32, 120); pub const WAVE_FORMAT_VOXWARE_TQ40 = @as(u32, 121); pub const WAVE_FORMAT_VOXWARE_SC3 = @as(u32, 122); pub const WAVE_FORMAT_VOXWARE_SC3_1 = @as(u32, 123); pub const WAVE_FORMAT_SOFTSOUND = @as(u32, 128); pub const WAVE_FORMAT_VOXWARE_TQ60 = @as(u32, 129); pub const WAVE_FORMAT_MSRT24 = @as(u32, 130); pub const WAVE_FORMAT_G729A = @as(u32, 131); pub const WAVE_FORMAT_MVI_MVI2 = @as(u32, 132); pub const WAVE_FORMAT_DF_G726 = @as(u32, 133); pub const WAVE_FORMAT_DF_GSM610 = @as(u32, 134); pub const WAVE_FORMAT_ISIAUDIO = @as(u32, 136); pub const WAVE_FORMAT_ONLIVE = @as(u32, 137); pub const WAVE_FORMAT_MULTITUDE_FT_SX20 = @as(u32, 138); pub const WAVE_FORMAT_INFOCOM_ITS_G721_ADPCM = @as(u32, 139); pub const WAVE_FORMAT_CONVEDIA_G729 = @as(u32, 140); pub const WAVE_FORMAT_CONGRUENCY = @as(u32, 141); pub const WAVE_FORMAT_SBC24 = @as(u32, 145); pub const WAVE_FORMAT_DOLBY_AC3_SPDIF = @as(u32, 146); pub const WAVE_FORMAT_MEDIASONIC_G723 = @as(u32, 147); pub const WAVE_FORMAT_PROSODY_8KBPS = @as(u32, 148); pub const WAVE_FORMAT_ZYXEL_ADPCM = @as(u32, 151); pub const WAVE_FORMAT_PHILIPS_LPCBB = @as(u32, 152); pub const WAVE_FORMAT_PACKED = @as(u32, 153); pub const WAVE_FORMAT_MALDEN_PHONYTALK = @as(u32, 160); pub const WAVE_FORMAT_RACAL_RECORDER_GSM = @as(u32, 161); pub const WAVE_FORMAT_RACAL_RECORDER_G720_A = @as(u32, 162); pub const WAVE_FORMAT_RACAL_RECORDER_G723_1 = @as(u32, 163); pub const WAVE_FORMAT_RACAL_RECORDER_TETRA_ACELP = @as(u32, 164); pub const WAVE_FORMAT_NEC_AAC = @as(u32, 176); pub const WAVE_FORMAT_RAW_AAC1 = @as(u32, 255); pub const WAVE_FORMAT_RHETOREX_ADPCM = @as(u32, 256); pub const WAVE_FORMAT_IRAT = @as(u32, 257); pub const WAVE_FORMAT_VIVO_G723 = @as(u32, 273); pub const WAVE_FORMAT_VIVO_SIREN = @as(u32, 274); pub const WAVE_FORMAT_PHILIPS_CELP = @as(u32, 288); pub const WAVE_FORMAT_PHILIPS_GRUNDIG = @as(u32, 289); pub const WAVE_FORMAT_DIGITAL_G723 = @as(u32, 291); pub const WAVE_FORMAT_SANYO_LD_ADPCM = @as(u32, 293); pub const WAVE_FORMAT_SIPROLAB_ACEPLNET = @as(u32, 304); pub const WAVE_FORMAT_SIPROLAB_ACELP4800 = @as(u32, 305); pub const WAVE_FORMAT_SIPROLAB_ACELP8V3 = @as(u32, 306); pub const WAVE_FORMAT_SIPROLAB_G729 = @as(u32, 307); pub const WAVE_FORMAT_SIPROLAB_G729A = @as(u32, 308); pub const WAVE_FORMAT_SIPROLAB_KELVIN = @as(u32, 309); pub const WAVE_FORMAT_VOICEAGE_AMR = @as(u32, 310); pub const WAVE_FORMAT_G726ADPCM = @as(u32, 320); pub const WAVE_FORMAT_DICTAPHONE_CELP68 = @as(u32, 321); pub const WAVE_FORMAT_DICTAPHONE_CELP54 = @as(u32, 322); pub const WAVE_FORMAT_QUALCOMM_PUREVOICE = @as(u32, 336); pub const WAVE_FORMAT_QUALCOMM_HALFRATE = @as(u32, 337); pub const WAVE_FORMAT_TUBGSM = @as(u32, 341); pub const WAVE_FORMAT_MSAUDIO1 = @as(u32, 352); pub const WAVE_FORMAT_WMAUDIO2 = @as(u32, 353); pub const WAVE_FORMAT_WMAUDIO3 = @as(u32, 354); pub const WAVE_FORMAT_WMAUDIO_LOSSLESS = @as(u32, 355); pub const WAVE_FORMAT_WMASPDIF = @as(u32, 356); pub const WAVE_FORMAT_UNISYS_NAP_ADPCM = @as(u32, 368); pub const WAVE_FORMAT_UNISYS_NAP_ULAW = @as(u32, 369); pub const WAVE_FORMAT_UNISYS_NAP_ALAW = @as(u32, 370); pub const WAVE_FORMAT_UNISYS_NAP_16K = @as(u32, 371); pub const WAVE_FORMAT_SYCOM_ACM_SYC008 = @as(u32, 372); pub const WAVE_FORMAT_SYCOM_ACM_SYC701_G726L = @as(u32, 373); pub const WAVE_FORMAT_SYCOM_ACM_SYC701_CELP54 = @as(u32, 374); pub const WAVE_FORMAT_SYCOM_ACM_SYC701_CELP68 = @as(u32, 375); pub const WAVE_FORMAT_KNOWLEDGE_ADVENTURE_ADPCM = @as(u32, 376); pub const WAVE_FORMAT_FRAUNHOFER_IIS_MPEG2_AAC = @as(u32, 384); pub const WAVE_FORMAT_DTS_DS = @as(u32, 400); pub const WAVE_FORMAT_CREATIVE_ADPCM = @as(u32, 512); pub const WAVE_FORMAT_CREATIVE_FASTSPEECH8 = @as(u32, 514); pub const WAVE_FORMAT_CREATIVE_FASTSPEECH10 = @as(u32, 515); pub const WAVE_FORMAT_UHER_ADPCM = @as(u32, 528); pub const WAVE_FORMAT_ULEAD_DV_AUDIO = @as(u32, 533); pub const WAVE_FORMAT_ULEAD_DV_AUDIO_1 = @as(u32, 534); pub const WAVE_FORMAT_QUARTERDECK = @as(u32, 544); pub const WAVE_FORMAT_ILINK_VC = @as(u32, 560); pub const WAVE_FORMAT_RAW_SPORT = @as(u32, 576); pub const WAVE_FORMAT_ESST_AC3 = @as(u32, 577); pub const WAVE_FORMAT_GENERIC_PASSTHRU = @as(u32, 585); pub const WAVE_FORMAT_IPI_HSX = @as(u32, 592); pub const WAVE_FORMAT_IPI_RPELP = @as(u32, 593); pub const WAVE_FORMAT_CS2 = @as(u32, 608); pub const WAVE_FORMAT_SONY_SCX = @as(u32, 624); pub const WAVE_FORMAT_SONY_SCY = @as(u32, 625); pub const WAVE_FORMAT_SONY_ATRAC3 = @as(u32, 626); pub const WAVE_FORMAT_SONY_SPC = @as(u32, 627); pub const WAVE_FORMAT_TELUM_AUDIO = @as(u32, 640); pub const WAVE_FORMAT_TELUM_IA_AUDIO = @as(u32, 641); pub const WAVE_FORMAT_NORCOM_VOICE_SYSTEMS_ADPCM = @as(u32, 645); pub const WAVE_FORMAT_FM_TOWNS_SND = @as(u32, 768); pub const WAVE_FORMAT_MICRONAS = @as(u32, 848); pub const WAVE_FORMAT_MICRONAS_CELP833 = @as(u32, 849); pub const WAVE_FORMAT_BTV_DIGITAL = @as(u32, 1024); pub const WAVE_FORMAT_INTEL_MUSIC_CODER = @as(u32, 1025); pub const WAVE_FORMAT_INDEO_AUDIO = @as(u32, 1026); pub const WAVE_FORMAT_QDESIGN_MUSIC = @as(u32, 1104); pub const WAVE_FORMAT_ON2_VP7_AUDIO = @as(u32, 1280); pub const WAVE_FORMAT_ON2_VP6_AUDIO = @as(u32, 1281); pub const WAVE_FORMAT_VME_VMPCM = @as(u32, 1664); pub const WAVE_FORMAT_TPC = @as(u32, 1665); pub const WAVE_FORMAT_LIGHTWAVE_LOSSLESS = @as(u32, 2222); pub const WAVE_FORMAT_OLIGSM = @as(u32, 4096); pub const WAVE_FORMAT_OLIADPCM = @as(u32, 4097); pub const WAVE_FORMAT_OLICELP = @as(u32, 4098); pub const WAVE_FORMAT_OLISBC = @as(u32, 4099); pub const WAVE_FORMAT_OLIOPR = @as(u32, 4100); pub const WAVE_FORMAT_LH_CODEC = @as(u32, 4352); pub const WAVE_FORMAT_LH_CODEC_CELP = @as(u32, 4353); pub const WAVE_FORMAT_LH_CODEC_SBC8 = @as(u32, 4354); pub const WAVE_FORMAT_LH_CODEC_SBC12 = @as(u32, 4355); pub const WAVE_FORMAT_LH_CODEC_SBC16 = @as(u32, 4356); pub const WAVE_FORMAT_NORRIS = @as(u32, 5120); pub const WAVE_FORMAT_ISIAUDIO_2 = @as(u32, 5121); pub const WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS = @as(u32, 5376); pub const WAVE_FORMAT_MPEG_ADTS_AAC = @as(u32, 5632); pub const WAVE_FORMAT_MPEG_RAW_AAC = @as(u32, 5633); pub const WAVE_FORMAT_MPEG_LOAS = @as(u32, 5634); pub const WAVE_FORMAT_NOKIA_MPEG_ADTS_AAC = @as(u32, 5640); pub const WAVE_FORMAT_NOKIA_MPEG_RAW_AAC = @as(u32, 5641); pub const WAVE_FORMAT_VODAFONE_MPEG_ADTS_AAC = @as(u32, 5642); pub const WAVE_FORMAT_VODAFONE_MPEG_RAW_AAC = @as(u32, 5643); pub const WAVE_FORMAT_MPEG_HEAAC = @as(u32, 5648); pub const WAVE_FORMAT_VOXWARE_RT24_SPEECH = @as(u32, 6172); pub const WAVE_FORMAT_SONICFOUNDRY_LOSSLESS = @as(u32, 6513); pub const WAVE_FORMAT_INNINGS_TELECOM_ADPCM = @as(u32, 6521); pub const WAVE_FORMAT_LUCENT_SX8300P = @as(u32, 7175); pub const WAVE_FORMAT_LUCENT_SX5363S = @as(u32, 7180); pub const WAVE_FORMAT_CUSEEME = @as(u32, 7939); pub const WAVE_FORMAT_NTCSOFT_ALF2CM_ACM = @as(u32, 8132); pub const WAVE_FORMAT_DVM = @as(u32, 8192); pub const WAVE_FORMAT_DTS2 = @as(u32, 8193); pub const WAVE_FORMAT_MAKEAVIS = @as(u32, 13075); pub const WAVE_FORMAT_DIVIO_MPEG4_AAC = @as(u32, 16707); pub const WAVE_FORMAT_NOKIA_ADAPTIVE_MULTIRATE = @as(u32, 16897); pub const WAVE_FORMAT_DIVIO_G726 = @as(u32, 16963); pub const WAVE_FORMAT_LEAD_SPEECH = @as(u32, 17228); pub const WAVE_FORMAT_LEAD_VORBIS = @as(u32, 22092); pub const WAVE_FORMAT_WAVPACK_AUDIO = @as(u32, 22358); pub const WAVE_FORMAT_ALAC = @as(u32, 27745); pub const WAVE_FORMAT_OGG_VORBIS_MODE_1 = @as(u32, 26447); pub const WAVE_FORMAT_OGG_VORBIS_MODE_2 = @as(u32, 26448); pub const WAVE_FORMAT_OGG_VORBIS_MODE_3 = @as(u32, 26449); pub const WAVE_FORMAT_OGG_VORBIS_MODE_1_PLUS = @as(u32, 26479); pub const WAVE_FORMAT_OGG_VORBIS_MODE_2_PLUS = @as(u32, 26480); pub const WAVE_FORMAT_OGG_VORBIS_MODE_3_PLUS = @as(u32, 26481); pub const WAVE_FORMAT_3COM_NBX = @as(u32, 28672); pub const WAVE_FORMAT_OPUS = @as(u32, 28751); pub const WAVE_FORMAT_FAAD_AAC = @as(u32, 28781); pub const WAVE_FORMAT_AMR_NB = @as(u32, 29537); pub const WAVE_FORMAT_AMR_WB = @as(u32, 29538); pub const WAVE_FORMAT_AMR_WP = @as(u32, 29539); pub const WAVE_FORMAT_GSM_AMR_CBR = @as(u32, 31265); pub const WAVE_FORMAT_GSM_AMR_VBR_SID = @as(u32, 31266); pub const WAVE_FORMAT_COMVERSE_INFOSYS_G723_1 = @as(u32, 41216); pub const WAVE_FORMAT_COMVERSE_INFOSYS_AVQSBC = @as(u32, 41217); pub const WAVE_FORMAT_COMVERSE_INFOSYS_SBC = @as(u32, 41218); pub const WAVE_FORMAT_SYMBOL_G729_A = @as(u32, 41219); pub const WAVE_FORMAT_VOICEAGE_AMR_WB = @as(u32, 41220); pub const WAVE_FORMAT_INGENIENT_G726 = @as(u32, 41221); pub const WAVE_FORMAT_MPEG4_AAC = @as(u32, 41222); pub const WAVE_FORMAT_ENCORE_G726 = @as(u32, 41223); pub const WAVE_FORMAT_ZOLL_ASAO = @as(u32, 41224); pub const WAVE_FORMAT_SPEEX_VOICE = @as(u32, 41225); pub const WAVE_FORMAT_VIANIX_MASC = @as(u32, 41226); pub const WAVE_FORMAT_WM9_SPECTRUM_ANALYZER = @as(u32, 41227); pub const WAVE_FORMAT_WMF_SPECTRUM_ANAYZER = @as(u32, 41228); pub const WAVE_FORMAT_GSM_610 = @as(u32, 41229); pub const WAVE_FORMAT_GSM_620 = @as(u32, 41230); pub const WAVE_FORMAT_GSM_660 = @as(u32, 41231); pub const WAVE_FORMAT_GSM_690 = @as(u32, 41232); pub const WAVE_FORMAT_GSM_ADAPTIVE_MULTIRATE_WB = @as(u32, 41233); pub const WAVE_FORMAT_POLYCOM_G722 = @as(u32, 41234); pub const WAVE_FORMAT_POLYCOM_G728 = @as(u32, 41235); pub const WAVE_FORMAT_POLYCOM_G729_A = @as(u32, 41236); pub const WAVE_FORMAT_POLYCOM_SIREN = @as(u32, 41237); pub const WAVE_FORMAT_GLOBAL_IP_ILBC = @as(u32, 41238); pub const WAVE_FORMAT_RADIOTIME_TIME_SHIFT_RADIO = @as(u32, 41239); pub const WAVE_FORMAT_NICE_ACA = @as(u32, 41240); pub const WAVE_FORMAT_NICE_ADPCM = @as(u32, 41241); pub const WAVE_FORMAT_VOCORD_G721 = @as(u32, 41242); pub const WAVE_FORMAT_VOCORD_G726 = @as(u32, 41243); pub const WAVE_FORMAT_VOCORD_G722_1 = @as(u32, 41244); pub const WAVE_FORMAT_VOCORD_G728 = @as(u32, 41245); pub const WAVE_FORMAT_VOCORD_G729 = @as(u32, 41246); pub const WAVE_FORMAT_VOCORD_G729_A = @as(u32, 41247); pub const WAVE_FORMAT_VOCORD_G723_1 = @as(u32, 41248); pub const WAVE_FORMAT_VOCORD_LBC = @as(u32, 41249); pub const WAVE_FORMAT_NICE_G728 = @as(u32, 41250); pub const WAVE_FORMAT_FRACE_TELECOM_G729 = @as(u32, 41251); pub const WAVE_FORMAT_CODIAN = @as(u32, 41252); pub const WAVE_FORMAT_DOLBY_AC4 = @as(u32, 44096); pub const WAVE_FORMAT_FLAC = @as(u32, 61868); pub const WAVE_FORMAT_DEVELOPMENT = @as(u32, 65535); pub const ACM_MPEG_LAYER1 = @as(u32, 1); pub const ACM_MPEG_LAYER2 = @as(u32, 2); pub const ACM_MPEG_LAYER3 = @as(u32, 4); pub const ACM_MPEG_STEREO = @as(u32, 1); pub const ACM_MPEG_JOINTSTEREO = @as(u32, 2); pub const ACM_MPEG_DUALCHANNEL = @as(u32, 4); pub const ACM_MPEG_SINGLECHANNEL = @as(u32, 8); pub const ACM_MPEG_PRIVATEBIT = @as(u32, 1); pub const ACM_MPEG_COPYRIGHT = @as(u32, 2); pub const ACM_MPEG_ORIGINALHOME = @as(u32, 4); pub const ACM_MPEG_PROTECTIONBIT = @as(u32, 8); pub const ACM_MPEG_ID_MPEG1 = @as(u32, 16); pub const MPEGLAYER3_WFX_EXTRA_BYTES = @as(u32, 12); pub const MPEGLAYER3_ID_UNKNOWN = @as(u32, 0); pub const MPEGLAYER3_ID_MPEG = @as(u32, 1); pub const MPEGLAYER3_ID_CONSTANTFRAMESIZE = @as(u32, 2); pub const MM_MSFT_ACM_WMAUDIO = @as(u32, 39); pub const WMAUDIO_BITS_PER_SAMPLE = @as(u32, 16); pub const WMAUDIO_MAX_CHANNELS = @as(u32, 2); pub const MM_MSFT_ACM_MSAUDIO1 = @as(u32, 39); pub const MSAUDIO1_BITS_PER_SAMPLE = @as(u32, 16); pub const MSAUDIO1_MAX_CHANNELS = @as(u32, 2); pub const MM_MSFT_ACM_WMAUDIO2 = @as(u32, 101); pub const WMAUDIO2_BITS_PER_SAMPLE = @as(u32, 16); pub const WMAUDIO2_MAX_CHANNELS = @as(u32, 2); pub const WAVE_FILTER_UNKNOWN = @as(u32, 0); pub const WAVE_FILTER_DEVELOPMENT = @as(u32, 65535); pub const WAVE_FILTER_VOLUME = @as(u32, 1); pub const WAVE_FILTER_ECHO = @as(u32, 2); pub const JPEG_PROCESS_BASELINE = @as(u32, 0); pub const AVIIF_CONTROLFRAME = @as(i32, 512); pub const JIFMK_SOF0 = @as(u32, 65472); pub const JIFMK_SOF1 = @as(u32, 65473); pub const JIFMK_SOF2 = @as(u32, 65474); pub const JIFMK_SOF3 = @as(u32, 65475); pub const JIFMK_SOF5 = @as(u32, 65477); pub const JIFMK_SOF6 = @as(u32, 65478); pub const JIFMK_SOF7 = @as(u32, 65479); pub const JIFMK_JPG = @as(u32, 65480); pub const JIFMK_SOF9 = @as(u32, 65481); pub const JIFMK_SOF10 = @as(u32, 65482); pub const JIFMK_SOF11 = @as(u32, 65483); pub const JIFMK_SOF13 = @as(u32, 65485); pub const JIFMK_SOF14 = @as(u32, 65486); pub const JIFMK_SOF15 = @as(u32, 65487); pub const JIFMK_DHT = @as(u32, 65476); pub const JIFMK_DAC = @as(u32, 65484); pub const JIFMK_RST0 = @as(u32, 65488); pub const JIFMK_RST1 = @as(u32, 65489); pub const JIFMK_RST2 = @as(u32, 65490); pub const JIFMK_RST3 = @as(u32, 65491); pub const JIFMK_RST4 = @as(u32, 65492); pub const JIFMK_RST5 = @as(u32, 65493); pub const JIFMK_RST6 = @as(u32, 65494); pub const JIFMK_RST7 = @as(u32, 65495); pub const JIFMK_SOI = @as(u32, 65496); pub const JIFMK_EOI = @as(u32, 65497); pub const JIFMK_SOS = @as(u32, 65498); pub const JIFMK_DQT = @as(u32, 65499); pub const JIFMK_DNL = @as(u32, 65500); pub const JIFMK_DRI = @as(u32, 65501); pub const JIFMK_DHP = @as(u32, 65502); pub const JIFMK_EXP = @as(u32, 65503); pub const JIFMK_APP0 = @as(u32, 65504); pub const JIFMK_APP1 = @as(u32, 65505); pub const JIFMK_APP2 = @as(u32, 65506); pub const JIFMK_APP3 = @as(u32, 65507); pub const JIFMK_APP4 = @as(u32, 65508); pub const JIFMK_APP5 = @as(u32, 65509); pub const JIFMK_APP6 = @as(u32, 65510); pub const JIFMK_APP7 = @as(u32, 65511); pub const JIFMK_JPG0 = @as(u32, 65520); pub const JIFMK_JPG1 = @as(u32, 65521); pub const JIFMK_JPG2 = @as(u32, 65522); pub const JIFMK_JPG3 = @as(u32, 65523); pub const JIFMK_JPG4 = @as(u32, 65524); pub const JIFMK_JPG5 = @as(u32, 65525); pub const JIFMK_JPG6 = @as(u32, 65526); pub const JIFMK_JPG7 = @as(u32, 65527); pub const JIFMK_JPG8 = @as(u32, 65528); pub const JIFMK_JPG9 = @as(u32, 65529); pub const JIFMK_JPG10 = @as(u32, 65530); pub const JIFMK_JPG11 = @as(u32, 65531); pub const JIFMK_JPG12 = @as(u32, 65532); pub const JIFMK_JPG13 = @as(u32, 65533); pub const JIFMK_COM = @as(u32, 65534); pub const JIFMK_TEM = @as(u32, 65281); pub const JIFMK_RES = @as(u32, 65282); pub const JIFMK_00 = @as(u32, 65280); pub const JIFMK_FF = @as(u32, 65535); pub const JPEG_Y = @as(u32, 1); pub const JPEG_YCbCr = @as(u32, 2); pub const JPEG_RGB = @as(u32, 3); pub const MIXERCONTROL_CONTROLTYPE_SRS_MTS = @as(u32, 536936454); pub const MIXERCONTROL_CONTROLTYPE_SRS_ONOFF = @as(u32, 536936455); pub const MIXERCONTROL_CONTROLTYPE_SRS_SYNTHSELECT = @as(u32, 536936456); pub const VP_COMMAND_GET = @as(u32, 1); pub const VP_COMMAND_SET = @as(u32, 2); pub const VP_FLAGS_TV_MODE = @as(u32, 1); pub const VP_FLAGS_TV_STANDARD = @as(u32, 2); pub const VP_FLAGS_FLICKER = @as(u32, 4); pub const VP_FLAGS_OVERSCAN = @as(u32, 8); pub const VP_FLAGS_MAX_UNSCALED = @as(u32, 16); pub const VP_FLAGS_POSITION = @as(u32, 32); pub const VP_FLAGS_BRIGHTNESS = @as(u32, 64); pub const VP_FLAGS_CONTRAST = @as(u32, 128); pub const VP_FLAGS_COPYPROTECT = @as(u32, 256); pub const VP_MODE_WIN_GRAPHICS = @as(u32, 1); pub const VP_MODE_TV_PLAYBACK = @as(u32, 2); pub const VP_TV_STANDARD_NTSC_M = @as(u32, 1); pub const VP_TV_STANDARD_NTSC_M_J = @as(u32, 2); pub const VP_TV_STANDARD_PAL_B = @as(u32, 4); pub const VP_TV_STANDARD_PAL_D = @as(u32, 8); pub const VP_TV_STANDARD_PAL_H = @as(u32, 16); pub const VP_TV_STANDARD_PAL_I = @as(u32, 32); pub const VP_TV_STANDARD_PAL_M = @as(u32, 64); pub const VP_TV_STANDARD_PAL_N = @as(u32, 128); pub const VP_TV_STANDARD_SECAM_B = @as(u32, 256); pub const VP_TV_STANDARD_SECAM_D = @as(u32, 512); pub const VP_TV_STANDARD_SECAM_G = @as(u32, 1024); pub const VP_TV_STANDARD_SECAM_H = @as(u32, 2048); pub const VP_TV_STANDARD_SECAM_K = @as(u32, 4096); pub const VP_TV_STANDARD_SECAM_K1 = @as(u32, 8192); pub const VP_TV_STANDARD_SECAM_L = @as(u32, 16384); pub const VP_TV_STANDARD_WIN_VGA = @as(u32, 32768); pub const VP_TV_STANDARD_NTSC_433 = @as(u32, 65536); pub const VP_TV_STANDARD_PAL_G = @as(u32, 131072); pub const VP_TV_STANDARD_PAL_60 = @as(u32, 262144); pub const VP_TV_STANDARD_SECAM_L1 = @as(u32, 524288); pub const VP_CP_TYPE_APS_TRIGGER = @as(u32, 1); pub const VP_CP_TYPE_MACROVISION = @as(u32, 2); pub const VP_CP_CMD_ACTIVATE = @as(u32, 1); pub const VP_CP_CMD_DEACTIVATE = @as(u32, 2); pub const VP_CP_CMD_CHANGE = @as(u32, 4); pub const ICVERSION = @as(u32, 260); pub const BI_1632 = @as(u32, 842217009); pub const ICERR_OK = @as(i32, 0); pub const ICERR_DONTDRAW = @as(i32, 1); pub const ICERR_NEWPALETTE = @as(i32, 2); pub const ICERR_GOTOKEYFRAME = @as(i32, 3); pub const ICERR_STOPDRAWING = @as(i32, 4); pub const ICERR_UNSUPPORTED = @as(i32, -1); pub const ICERR_BADFORMAT = @as(i32, -2); pub const ICERR_MEMORY = @as(i32, -3); pub const ICERR_INTERNAL = @as(i32, -4); pub const ICERR_BADFLAGS = @as(i32, -5); pub const ICERR_BADPARAM = @as(i32, -6); pub const ICERR_BADSIZE = @as(i32, -7); pub const ICERR_BADHANDLE = @as(i32, -8); pub const ICERR_CANTUPDATE = @as(i32, -9); pub const ICERR_ABORT = @as(i32, -10); pub const ICERR_ERROR = @as(i32, -100); pub const ICERR_BADBITDEPTH = @as(i32, -200); pub const ICERR_BADIMAGESIZE = @as(i32, -201); pub const ICERR_CUSTOM = @as(i32, -400); pub const ICMODE_COMPRESS = @as(u32, 1); pub const ICMODE_DECOMPRESS = @as(u32, 2); pub const ICMODE_FASTDECOMPRESS = @as(u32, 3); pub const ICMODE_QUERY = @as(u32, 4); pub const ICMODE_FASTCOMPRESS = @as(u32, 5); pub const ICMODE_DRAW = @as(u32, 8); pub const ICMODE_INTERNALF_FUNCTION32 = @as(u32, 32768); pub const ICMODE_INTERNALF_MASK = @as(u32, 32768); pub const AVIIF_TWOCC = @as(i32, 2); pub const ICQUALITY_LOW = @as(u32, 0); pub const ICQUALITY_HIGH = @as(u32, 10000); pub const ICQUALITY_DEFAULT = @as(i32, -1); pub const ICM_USER = @as(u32, 16384); pub const ICM_RESERVED_LOW = @as(u32, 20480); pub const ICM_RESERVED_HIGH = @as(u32, 24576); pub const ICM_GETSTATE = @as(u32, 20480); pub const ICM_SETSTATE = @as(u32, 20481); pub const ICM_GETINFO = @as(u32, 20482); pub const ICM_CONFIGURE = @as(u32, 20490); pub const ICM_ABOUT = @as(u32, 20491); pub const ICM_GETERRORTEXT = @as(u32, 20492); pub const ICM_GETFORMATNAME = @as(u32, 20500); pub const ICM_ENUMFORMATS = @as(u32, 20501); pub const ICM_GETDEFAULTQUALITY = @as(u32, 20510); pub const ICM_GETQUALITY = @as(u32, 20511); pub const ICM_SETQUALITY = @as(u32, 20512); pub const ICM_SET = @as(u32, 20520); pub const ICM_GET = @as(u32, 20521); pub const ICM_COMPRESS_GET_FORMAT = @as(u32, 16388); pub const ICM_COMPRESS_GET_SIZE = @as(u32, 16389); pub const ICM_COMPRESS_QUERY = @as(u32, 16390); pub const ICM_COMPRESS_BEGIN = @as(u32, 16391); pub const ICM_COMPRESS = @as(u32, 16392); pub const ICM_COMPRESS_END = @as(u32, 16393); pub const ICM_DECOMPRESS_GET_FORMAT = @as(u32, 16394); pub const ICM_DECOMPRESS_QUERY = @as(u32, 16395); pub const ICM_DECOMPRESS_BEGIN = @as(u32, 16396); pub const ICM_DECOMPRESS = @as(u32, 16397); pub const ICM_DECOMPRESS_END = @as(u32, 16398); pub const ICM_DECOMPRESS_SET_PALETTE = @as(u32, 16413); pub const ICM_DECOMPRESS_GET_PALETTE = @as(u32, 16414); pub const ICM_DRAW_QUERY = @as(u32, 16415); pub const ICM_DRAW_BEGIN = @as(u32, 16399); pub const ICM_DRAW_GET_PALETTE = @as(u32, 16400); pub const ICM_DRAW_UPDATE = @as(u32, 16401); pub const ICM_DRAW_START = @as(u32, 16402); pub const ICM_DRAW_STOP = @as(u32, 16403); pub const ICM_DRAW_BITS = @as(u32, 16404); pub const ICM_DRAW_END = @as(u32, 16405); pub const ICM_DRAW_GETTIME = @as(u32, 16416); pub const ICM_DRAW = @as(u32, 16417); pub const ICM_DRAW_WINDOW = @as(u32, 16418); pub const ICM_DRAW_SETTIME = @as(u32, 16419); pub const ICM_DRAW_REALIZE = @as(u32, 16420); pub const ICM_DRAW_FLUSH = @as(u32, 16421); pub const ICM_DRAW_RENDERBUFFER = @as(u32, 16422); pub const ICM_DRAW_START_PLAY = @as(u32, 16423); pub const ICM_DRAW_STOP_PLAY = @as(u32, 16424); pub const ICM_DRAW_SUGGESTFORMAT = @as(u32, 16434); pub const ICM_DRAW_CHANGEPALETTE = @as(u32, 16435); pub const ICM_DRAW_IDLE = @as(u32, 16436); pub const ICM_GETBUFFERSWANTED = @as(u32, 16425); pub const ICM_GETDEFAULTKEYFRAMERATE = @as(u32, 16426); pub const ICM_DECOMPRESSEX_BEGIN = @as(u32, 16444); pub const ICM_DECOMPRESSEX_QUERY = @as(u32, 16445); pub const ICM_DECOMPRESSEX = @as(u32, 16446); pub const ICM_DECOMPRESSEX_END = @as(u32, 16447); pub const ICM_COMPRESS_FRAMES_INFO = @as(u32, 16454); pub const ICM_COMPRESS_FRAMES = @as(u32, 16455); pub const ICM_SET_STATUS_PROC = @as(u32, 16456); pub const VIDCF_QUALITY = @as(u32, 1); pub const VIDCF_CRUNCH = @as(u32, 2); pub const VIDCF_TEMPORAL = @as(u32, 4); pub const VIDCF_COMPRESSFRAMES = @as(u32, 8); pub const VIDCF_DRAW = @as(u32, 16); pub const VIDCF_FASTTEMPORALC = @as(u32, 32); pub const VIDCF_FASTTEMPORALD = @as(u32, 128); pub const ICCOMPRESS_KEYFRAME = @as(i32, 1); pub const ICCOMPRESSFRAMES_PADDING = @as(u32, 1); pub const ICSTATUS_START = @as(u32, 0); pub const ICSTATUS_STATUS = @as(u32, 1); pub const ICSTATUS_END = @as(u32, 2); pub const ICSTATUS_ERROR = @as(u32, 3); pub const ICSTATUS_YIELD = @as(u32, 4); pub const ICDECOMPRESS_HURRYUP = @as(i32, -2147483648); pub const ICDECOMPRESS_UPDATE = @as(i32, 1073741824); pub const ICDECOMPRESS_PREROLL = @as(i32, 536870912); pub const ICDECOMPRESS_NULLFRAME = @as(i32, 268435456); pub const ICDECOMPRESS_NOTKEYFRAME = @as(i32, 134217728); pub const ICDRAW_QUERY = @as(i32, 1); pub const ICDRAW_FULLSCREEN = @as(i32, 2); pub const ICDRAW_HDC = @as(i32, 4); pub const ICDRAW_ANIMATE = @as(i32, 8); pub const ICDRAW_CONTINUE = @as(i32, 16); pub const ICDRAW_MEMORYDC = @as(i32, 32); pub const ICDRAW_UPDATING = @as(i32, 64); pub const ICDRAW_RENDER = @as(i32, 128); pub const ICDRAW_BUFFER = @as(i32, 256); pub const ICDRAW_HURRYUP = @as(i32, -2147483648); pub const ICDRAW_UPDATE = @as(i32, 1073741824); pub const ICDRAW_PREROLL = @as(i32, 536870912); pub const ICDRAW_NULLFRAME = @as(i32, 268435456); pub const ICDRAW_NOTKEYFRAME = @as(i32, 134217728); pub const ICINSTALL_UNICODE = @as(u32, 32768); pub const ICINSTALL_FUNCTION = @as(u32, 1); pub const ICINSTALL_DRIVER = @as(u32, 2); pub const ICINSTALL_HDRV = @as(u32, 4); pub const ICINSTALL_DRIVERW = @as(u32, 32770); pub const ICMF_CONFIGURE_QUERY = @as(u32, 1); pub const ICMF_ABOUT_QUERY = @as(u32, 1); pub const ICMF_COMPVARS_VALID = @as(u32, 1); pub const ICMF_CHOOSE_KEYFRAME = @as(u32, 1); pub const ICMF_CHOOSE_DATARATE = @as(u32, 2); pub const ICMF_CHOOSE_PREVIEW = @as(u32, 4); pub const ICMF_CHOOSE_ALLCOMPRESSORS = @as(u32, 8); pub const DDF_0001 = @as(u32, 1); pub const DDF_UPDATE = @as(u32, 2); pub const DDF_SAME_HDC = @as(u32, 4); pub const DDF_SAME_DRAW = @as(u32, 8); pub const DDF_DONTDRAW = @as(u32, 16); pub const DDF_ANIMATE = @as(u32, 32); pub const DDF_BUFFER = @as(u32, 64); pub const DDF_JUSTDRAWIT = @as(u32, 128); pub const DDF_FULLSCREEN = @as(u32, 256); pub const DDF_BACKGROUNDPAL = @as(u32, 512); pub const DDF_NOTKEYFRAME = @as(u32, 1024); pub const DDF_HURRYUP = @as(u32, 2048); pub const DDF_HALFTONE = @as(u32, 4096); pub const DDF_2000 = @as(u32, 8192); pub const DDF_PREROLL = @as(u32, 16); pub const DDF_SAME_DIB = @as(u32, 8); pub const DDF_SAME_SIZE = @as(u32, 8); pub const PD_CAN_DRAW_DIB = @as(u32, 1); pub const PD_CAN_STRETCHDIB = @as(u32, 2); pub const PD_STRETCHDIB_1_1_OK = @as(u32, 4); pub const PD_STRETCHDIB_1_2_OK = @as(u32, 8); pub const PD_STRETCHDIB_1_N_OK = @as(u32, 16); pub const AVIGETFRAMEF_BESTDISPLAYFMT = @as(u32, 1); pub const AVISTREAMINFO_DISABLED = @as(u32, 1); pub const AVISTREAMINFO_FORMATCHANGES = @as(u32, 65536); pub const AVIFILEINFO_HASINDEX = @as(u32, 16); pub const AVIFILEINFO_MUSTUSEINDEX = @as(u32, 32); pub const AVIFILEINFO_ISINTERLEAVED = @as(u32, 256); pub const AVIFILEINFO_WASCAPTUREFILE = @as(u32, 65536); pub const AVIFILEINFO_COPYRIGHTED = @as(u32, 131072); pub const AVIFILECAPS_CANREAD = @as(u32, 1); pub const AVIFILECAPS_CANWRITE = @as(u32, 2); pub const AVIFILECAPS_ALLKEYFRAMES = @as(u32, 16); pub const AVIFILECAPS_NOCOMPRESSION = @as(u32, 32); pub const AVICOMPRESSF_INTERLEAVE = @as(u32, 1); pub const AVICOMPRESSF_DATARATE = @as(u32, 2); pub const AVICOMPRESSF_KEYFRAMES = @as(u32, 4); pub const AVICOMPRESSF_VALID = @as(u32, 8); pub const CLSID_AVISimpleUnMarshal = Guid.initString("00020009-0000-0000-c000-000000000046"); pub const CLSID_AVIFile = Guid.initString("00020000-0000-0000-c000-000000000046"); pub const AVIFILEHANDLER_CANREAD = @as(u32, 1); pub const AVIFILEHANDLER_CANWRITE = @as(u32, 2); pub const AVIFILEHANDLER_CANACCEPTNONRGB = @as(u32, 4); pub const AVISTREAMREAD_CONVENIENT = @as(i32, -1); pub const FIND_DIR = @as(i32, 15); pub const FIND_NEXT = @as(i32, 1); pub const FIND_PREV = @as(i32, 4); pub const FIND_FROM_START = @as(i32, 8); pub const FIND_TYPE = @as(i32, 240); pub const FIND_KEY = @as(i32, 16); pub const FIND_ANY = @as(i32, 32); pub const FIND_FORMAT = @as(i32, 64); pub const FIND_RET = @as(i32, 61440); pub const FIND_POS = @as(i32, 0); pub const FIND_LENGTH = @as(i32, 4096); pub const FIND_OFFSET = @as(i32, 8192); pub const FIND_SIZE = @as(i32, 12288); pub const FIND_INDEX = @as(i32, 16384); pub const SEARCH_NEAREST = @as(i32, 4); pub const SEARCH_BACKWARD = @as(i32, 4); pub const SEARCH_FORWARD = @as(i32, 1); pub const SEARCH_KEY = @as(i32, 16); pub const SEARCH_ANY = @as(i32, 32); pub const AVIERR_OK = @as(i32, 0); pub const MCIWNDOPENF_NEW = @as(u32, 1); pub const MCIWNDF_NOAUTOSIZEWINDOW = @as(u32, 1); pub const MCIWNDF_NOPLAYBAR = @as(u32, 2); pub const MCIWNDF_NOAUTOSIZEMOVIE = @as(u32, 4); pub const MCIWNDF_NOMENU = @as(u32, 8); pub const MCIWNDF_SHOWNAME = @as(u32, 16); pub const MCIWNDF_SHOWPOS = @as(u32, 32); pub const MCIWNDF_SHOWMODE = @as(u32, 64); pub const MCIWNDF_SHOWALL = @as(u32, 112); pub const MCIWNDF_NOTIFYMODE = @as(u32, 256); pub const MCIWNDF_NOTIFYPOS = @as(u32, 512); pub const MCIWNDF_NOTIFYSIZE = @as(u32, 1024); pub const MCIWNDF_NOTIFYERROR = @as(u32, 4096); pub const MCIWNDF_NOTIFYALL = @as(u32, 7936); pub const MCIWNDF_NOTIFYANSI = @as(u32, 128); pub const MCIWNDF_NOTIFYMEDIAA = @as(u32, 2176); pub const MCIWNDF_NOTIFYMEDIAW = @as(u32, 2048); pub const MCIWNDF_NOTIFYMEDIA = @as(u32, 2048); pub const MCIWNDF_RECORD = @as(u32, 8192); pub const MCIWNDF_NOERRORDLG = @as(u32, 16384); pub const MCIWNDF_NOOPEN = @as(u32, 32768); pub const MCIWNDM_GETDEVICEID = @as(u32, 1124); pub const MCIWNDM_GETSTART = @as(u32, 1127); pub const MCIWNDM_GETLENGTH = @as(u32, 1128); pub const MCIWNDM_GETEND = @as(u32, 1129); pub const MCIWNDM_EJECT = @as(u32, 1131); pub const MCIWNDM_SETZOOM = @as(u32, 1132); pub const MCIWNDM_GETZOOM = @as(u32, 1133); pub const MCIWNDM_SETVOLUME = @as(u32, 1134); pub const MCIWNDM_GETVOLUME = @as(u32, 1135); pub const MCIWNDM_SETSPEED = @as(u32, 1136); pub const MCIWNDM_GETSPEED = @as(u32, 1137); pub const MCIWNDM_SETREPEAT = @as(u32, 1138); pub const MCIWNDM_GETREPEAT = @as(u32, 1139); pub const MCIWNDM_REALIZE = @as(u32, 1142); pub const MCIWNDM_VALIDATEMEDIA = @as(u32, 1145); pub const MCIWNDM_PLAYFROM = @as(u32, 1146); pub const MCIWNDM_PLAYTO = @as(u32, 1147); pub const MCIWNDM_GETPALETTE = @as(u32, 1150); pub const MCIWNDM_SETPALETTE = @as(u32, 1151); pub const MCIWNDM_SETTIMERS = @as(u32, 1153); pub const MCIWNDM_SETACTIVETIMER = @as(u32, 1154); pub const MCIWNDM_SETINACTIVETIMER = @as(u32, 1155); pub const MCIWNDM_GETACTIVETIMER = @as(u32, 1156); pub const MCIWNDM_GETINACTIVETIMER = @as(u32, 1157); pub const MCIWNDM_CHANGESTYLES = @as(u32, 1159); pub const MCIWNDM_GETSTYLES = @as(u32, 1160); pub const MCIWNDM_GETALIAS = @as(u32, 1161); pub const MCIWNDM_PLAYREVERSE = @as(u32, 1163); pub const MCIWNDM_GET_SOURCE = @as(u32, 1164); pub const MCIWNDM_PUT_SOURCE = @as(u32, 1165); pub const MCIWNDM_GET_DEST = @as(u32, 1166); pub const MCIWNDM_PUT_DEST = @as(u32, 1167); pub const MCIWNDM_CAN_PLAY = @as(u32, 1168); pub const MCIWNDM_CAN_WINDOW = @as(u32, 1169); pub const MCIWNDM_CAN_RECORD = @as(u32, 1170); pub const MCIWNDM_CAN_SAVE = @as(u32, 1171); pub const MCIWNDM_CAN_EJECT = @as(u32, 1172); pub const MCIWNDM_CAN_CONFIG = @as(u32, 1173); pub const MCIWNDM_PALETTEKICK = @as(u32, 1174); pub const MCIWNDM_OPENINTERFACE = @as(u32, 1175); pub const MCIWNDM_SETOWNER = @as(u32, 1176); pub const MCIWNDM_SENDSTRINGA = @as(u32, 1125); pub const MCIWNDM_GETPOSITIONA = @as(u32, 1126); pub const MCIWNDM_GETMODEA = @as(u32, 1130); pub const MCIWNDM_SETTIMEFORMATA = @as(u32, 1143); pub const MCIWNDM_GETTIMEFORMATA = @as(u32, 1144); pub const MCIWNDM_GETFILENAMEA = @as(u32, 1148); pub const MCIWNDM_GETDEVICEA = @as(u32, 1149); pub const MCIWNDM_GETERRORA = @as(u32, 1152); pub const MCIWNDM_NEWA = @as(u32, 1158); pub const MCIWNDM_RETURNSTRINGA = @as(u32, 1162); pub const MCIWNDM_OPENA = @as(u32, 1177); pub const MCIWNDM_SENDSTRINGW = @as(u32, 1225); pub const MCIWNDM_GETPOSITIONW = @as(u32, 1226); pub const MCIWNDM_GETMODEW = @as(u32, 1230); pub const MCIWNDM_SETTIMEFORMATW = @as(u32, 1243); pub const MCIWNDM_GETTIMEFORMATW = @as(u32, 1244); pub const MCIWNDM_GETFILENAMEW = @as(u32, 1248); pub const MCIWNDM_GETDEVICEW = @as(u32, 1249); pub const MCIWNDM_GETERRORW = @as(u32, 1252); pub const MCIWNDM_NEWW = @as(u32, 1258); pub const MCIWNDM_RETURNSTRINGW = @as(u32, 1262); pub const MCIWNDM_OPENW = @as(u32, 1276); pub const MCIWNDM_SENDSTRING = @as(u32, 1225); pub const MCIWNDM_GETPOSITION = @as(u32, 1226); pub const MCIWNDM_GETMODE = @as(u32, 1230); pub const MCIWNDM_SETTIMEFORMAT = @as(u32, 1243); pub const MCIWNDM_GETTIMEFORMAT = @as(u32, 1244); pub const MCIWNDM_GETFILENAME = @as(u32, 1248); pub const MCIWNDM_GETDEVICE = @as(u32, 1249); pub const MCIWNDM_GETERROR = @as(u32, 1252); pub const MCIWNDM_NEW = @as(u32, 1258); pub const MCIWNDM_RETURNSTRING = @as(u32, 1262); pub const MCIWNDM_OPEN = @as(u32, 1276); pub const MCIWNDM_NOTIFYMODE = @as(u32, 1224); pub const MCIWNDM_NOTIFYPOS = @as(u32, 1225); pub const MCIWNDM_NOTIFYSIZE = @as(u32, 1226); pub const MCIWNDM_NOTIFYMEDIA = @as(u32, 1227); pub const MCIWNDM_NOTIFYERROR = @as(u32, 1229); pub const MCIWND_START = @as(i32, -1); pub const MCIWND_END = @as(i32, -2); pub const MCI_OPEN = @as(u32, 2051); pub const MCI_CLOSE = @as(u32, 2052); pub const MCI_PLAY = @as(u32, 2054); pub const MCI_SEEK = @as(u32, 2055); pub const MCI_STOP = @as(u32, 2056); pub const MCI_PAUSE = @as(u32, 2057); pub const MCI_STEP = @as(u32, 2062); pub const MCI_RECORD = @as(u32, 2063); pub const MCI_SAVE = @as(u32, 2067); pub const MCI_CUT = @as(u32, 2129); pub const MCI_COPY = @as(u32, 2130); pub const MCI_PASTE = @as(u32, 2131); pub const MCI_RESUME = @as(u32, 2133); pub const MCI_DELETE = @as(u32, 2134); pub const MCI_MODE_NOT_READY = @as(u32, 524); pub const MCI_MODE_STOP = @as(u32, 525); pub const MCI_MODE_PLAY = @as(u32, 526); pub const MCI_MODE_RECORD = @as(u32, 527); pub const MCI_MODE_SEEK = @as(u32, 528); pub const MCI_MODE_PAUSE = @as(u32, 529); pub const MCI_MODE_OPEN = @as(u32, 530); pub const DV_ERR_OK = @as(u32, 0); pub const DV_ERR_BASE = @as(u32, 1); pub const DV_ERR_NONSPECIFIC = @as(u32, 1); pub const DV_ERR_BADFORMAT = @as(u32, 2); pub const DV_ERR_STILLPLAYING = @as(u32, 3); pub const DV_ERR_UNPREPARED = @as(u32, 4); pub const DV_ERR_SYNC = @as(u32, 5); pub const DV_ERR_TOOMANYCHANNELS = @as(u32, 6); pub const DV_ERR_NOTDETECTED = @as(u32, 7); pub const DV_ERR_BADINSTALL = @as(u32, 8); pub const DV_ERR_CREATEPALETTE = @as(u32, 9); pub const DV_ERR_SIZEFIELD = @as(u32, 10); pub const DV_ERR_PARAM1 = @as(u32, 11); pub const DV_ERR_PARAM2 = @as(u32, 12); pub const DV_ERR_CONFIG1 = @as(u32, 13); pub const DV_ERR_CONFIG2 = @as(u32, 14); pub const DV_ERR_FLAGS = @as(u32, 15); pub const DV_ERR_13 = @as(u32, 16); pub const DV_ERR_NOTSUPPORTED = @as(u32, 17); pub const DV_ERR_NOMEM = @as(u32, 18); pub const DV_ERR_ALLOCATED = @as(u32, 19); pub const DV_ERR_BADDEVICEID = @as(u32, 20); pub const DV_ERR_INVALHANDLE = @as(u32, 21); pub const DV_ERR_BADERRNUM = @as(u32, 22); pub const DV_ERR_NO_BUFFERS = @as(u32, 23); pub const DV_ERR_MEM_CONFLICT = @as(u32, 24); pub const DV_ERR_IO_CONFLICT = @as(u32, 25); pub const DV_ERR_DMA_CONFLICT = @as(u32, 26); pub const DV_ERR_INT_CONFLICT = @as(u32, 27); pub const DV_ERR_PROTECT_ONLY = @as(u32, 28); pub const DV_ERR_LASTERROR = @as(u32, 28); pub const DV_ERR_USER_MSG = @as(u32, 1001); pub const DV_VM_OPEN = @as(u32, 976); pub const DV_VM_CLOSE = @as(u32, 977); pub const DV_VM_DATA = @as(u32, 978); pub const DV_VM_ERROR = @as(u32, 979); pub const VHDR_DONE = @as(u32, 1); pub const VHDR_PREPARED = @as(u32, 2); pub const VHDR_INQUEUE = @as(u32, 4); pub const VHDR_KEYFRAME = @as(u32, 8); pub const VHDR_VALID = @as(u32, 15); pub const VCAPS_OVERLAY = @as(u32, 1); pub const VCAPS_SRC_CAN_CLIP = @as(u32, 2); pub const VCAPS_DST_CAN_CLIP = @as(u32, 4); pub const VCAPS_CAN_SCALE = @as(u32, 8); pub const VIDEO_EXTERNALIN = @as(u32, 1); pub const VIDEO_EXTERNALOUT = @as(u32, 2); pub const VIDEO_IN = @as(u32, 4); pub const VIDEO_OUT = @as(u32, 8); pub const VIDEO_DLG_QUERY = @as(u32, 16); pub const VIDEO_CONFIGURE_QUERY = @as(u32, 32768); pub const VIDEO_CONFIGURE_SET = @as(u32, 4096); pub const VIDEO_CONFIGURE_GET = @as(u32, 8192); pub const VIDEO_CONFIGURE_QUERYSIZE = @as(u32, 1); pub const VIDEO_CONFIGURE_CURRENT = @as(u32, 16); pub const VIDEO_CONFIGURE_NOMINAL = @as(u32, 32); pub const VIDEO_CONFIGURE_MIN = @as(u32, 64); pub const VIDEO_CONFIGURE_MAX = @as(u32, 128); pub const DVM_USER = @as(u32, 16384); pub const DVM_CONFIGURE_START = @as(u32, 4096); pub const DVM_CONFIGURE_END = @as(u32, 8191); pub const DVM_PALETTE = @as(u32, 4097); pub const DVM_FORMAT = @as(u32, 4098); pub const DVM_PALETTERGB555 = @as(u32, 4099); pub const DVM_SRC_RECT = @as(u32, 4100); pub const DVM_DST_RECT = @as(u32, 4101); pub const WM_CAP_UNICODE_START = @as(u32, 1124); pub const WM_CAP_GET_CAPSTREAMPTR = @as(u32, 1025); pub const WM_CAP_SET_CALLBACK_ERRORW = @as(u32, 1126); pub const WM_CAP_SET_CALLBACK_STATUSW = @as(u32, 1127); pub const WM_CAP_SET_CALLBACK_ERRORA = @as(u32, 1026); pub const WM_CAP_SET_CALLBACK_STATUSA = @as(u32, 1027); pub const WM_CAP_SET_CALLBACK_ERROR = @as(u32, 1126); pub const WM_CAP_SET_CALLBACK_STATUS = @as(u32, 1127); pub const WM_CAP_SET_CALLBACK_YIELD = @as(u32, 1028); pub const WM_CAP_SET_CALLBACK_FRAME = @as(u32, 1029); pub const WM_CAP_SET_CALLBACK_VIDEOSTREAM = @as(u32, 1030); pub const WM_CAP_SET_CALLBACK_WAVESTREAM = @as(u32, 1031); pub const WM_CAP_GET_USER_DATA = @as(u32, 1032); pub const WM_CAP_SET_USER_DATA = @as(u32, 1033); pub const WM_CAP_DRIVER_CONNECT = @as(u32, 1034); pub const WM_CAP_DRIVER_DISCONNECT = @as(u32, 1035); pub const WM_CAP_DRIVER_GET_NAMEA = @as(u32, 1036); pub const WM_CAP_DRIVER_GET_VERSIONA = @as(u32, 1037); pub const WM_CAP_DRIVER_GET_NAMEW = @as(u32, 1136); pub const WM_CAP_DRIVER_GET_VERSIONW = @as(u32, 1137); pub const WM_CAP_DRIVER_GET_NAME = @as(u32, 1136); pub const WM_CAP_DRIVER_GET_VERSION = @as(u32, 1137); pub const WM_CAP_DRIVER_GET_CAPS = @as(u32, 1038); pub const WM_CAP_FILE_SET_CAPTURE_FILEA = @as(u32, 1044); pub const WM_CAP_FILE_GET_CAPTURE_FILEA = @as(u32, 1045); pub const WM_CAP_FILE_SAVEASA = @as(u32, 1047); pub const WM_CAP_FILE_SAVEDIBA = @as(u32, 1049); pub const WM_CAP_FILE_SET_CAPTURE_FILEW = @as(u32, 1144); pub const WM_CAP_FILE_GET_CAPTURE_FILEW = @as(u32, 1145); pub const WM_CAP_FILE_SAVEASW = @as(u32, 1147); pub const WM_CAP_FILE_SAVEDIBW = @as(u32, 1149); pub const WM_CAP_FILE_SET_CAPTURE_FILE = @as(u32, 1144); pub const WM_CAP_FILE_GET_CAPTURE_FILE = @as(u32, 1145); pub const WM_CAP_FILE_SAVEAS = @as(u32, 1147); pub const WM_CAP_FILE_SAVEDIB = @as(u32, 1149); pub const WM_CAP_FILE_ALLOCATE = @as(u32, 1046); pub const WM_CAP_FILE_SET_INFOCHUNK = @as(u32, 1048); pub const WM_CAP_EDIT_COPY = @as(u32, 1054); pub const WM_CAP_SET_AUDIOFORMAT = @as(u32, 1059); pub const WM_CAP_GET_AUDIOFORMAT = @as(u32, 1060); pub const WM_CAP_DLG_VIDEOFORMAT = @as(u32, 1065); pub const WM_CAP_DLG_VIDEOSOURCE = @as(u32, 1066); pub const WM_CAP_DLG_VIDEODISPLAY = @as(u32, 1067); pub const WM_CAP_GET_VIDEOFORMAT = @as(u32, 1068); pub const WM_CAP_SET_VIDEOFORMAT = @as(u32, 1069); pub const WM_CAP_DLG_VIDEOCOMPRESSION = @as(u32, 1070); pub const WM_CAP_SET_PREVIEW = @as(u32, 1074); pub const WM_CAP_SET_OVERLAY = @as(u32, 1075); pub const WM_CAP_SET_PREVIEWRATE = @as(u32, 1076); pub const WM_CAP_SET_SCALE = @as(u32, 1077); pub const WM_CAP_GET_STATUS = @as(u32, 1078); pub const WM_CAP_SET_SCROLL = @as(u32, 1079); pub const WM_CAP_GRAB_FRAME = @as(u32, 1084); pub const WM_CAP_GRAB_FRAME_NOSTOP = @as(u32, 1085); pub const WM_CAP_SEQUENCE = @as(u32, 1086); pub const WM_CAP_SEQUENCE_NOFILE = @as(u32, 1087); pub const WM_CAP_SET_SEQUENCE_SETUP = @as(u32, 1088); pub const WM_CAP_GET_SEQUENCE_SETUP = @as(u32, 1089); pub const WM_CAP_SET_MCI_DEVICEA = @as(u32, 1090); pub const WM_CAP_GET_MCI_DEVICEA = @as(u32, 1091); pub const WM_CAP_SET_MCI_DEVICEW = @as(u32, 1190); pub const WM_CAP_GET_MCI_DEVICEW = @as(u32, 1191); pub const WM_CAP_SET_MCI_DEVICE = @as(u32, 1190); pub const WM_CAP_GET_MCI_DEVICE = @as(u32, 1191); pub const WM_CAP_STOP = @as(u32, 1092); pub const WM_CAP_ABORT = @as(u32, 1093); pub const WM_CAP_SINGLE_FRAME_OPEN = @as(u32, 1094); pub const WM_CAP_SINGLE_FRAME_CLOSE = @as(u32, 1095); pub const WM_CAP_SINGLE_FRAME = @as(u32, 1096); pub const WM_CAP_PAL_OPENA = @as(u32, 1104); pub const WM_CAP_PAL_SAVEA = @as(u32, 1105); pub const WM_CAP_PAL_OPENW = @as(u32, 1204); pub const WM_CAP_PAL_SAVEW = @as(u32, 1205); pub const WM_CAP_PAL_OPEN = @as(u32, 1204); pub const WM_CAP_PAL_SAVE = @as(u32, 1205); pub const WM_CAP_PAL_PASTE = @as(u32, 1106); pub const WM_CAP_PAL_AUTOCREATE = @as(u32, 1107); pub const WM_CAP_PAL_MANUALCREATE = @as(u32, 1108); pub const WM_CAP_SET_CALLBACK_CAPCONTROL = @as(u32, 1109); pub const WM_CAP_UNICODE_END = @as(u32, 1205); pub const WM_CAP_END = @as(u32, 1205); pub const AVSTREAMMASTER_AUDIO = @as(u32, 0); pub const AVSTREAMMASTER_NONE = @as(u32, 1); pub const CONTROLCALLBACK_PREROLL = @as(u32, 1); pub const CONTROLCALLBACK_CAPTURING = @as(u32, 2); pub const IDS_CAP_BEGIN = @as(u32, 300); pub const IDS_CAP_END = @as(u32, 301); pub const IDS_CAP_INFO = @as(u32, 401); pub const IDS_CAP_OUTOFMEM = @as(u32, 402); pub const IDS_CAP_FILEEXISTS = @as(u32, 403); pub const IDS_CAP_ERRORPALOPEN = @as(u32, 404); pub const IDS_CAP_ERRORPALSAVE = @as(u32, 405); pub const IDS_CAP_ERRORDIBSAVE = @as(u32, 406); pub const IDS_CAP_DEFAVIEXT = @as(u32, 407); pub const IDS_CAP_DEFPALEXT = @as(u32, 408); pub const IDS_CAP_CANTOPEN = @as(u32, 409); pub const IDS_CAP_SEQ_MSGSTART = @as(u32, 410); pub const IDS_CAP_SEQ_MSGSTOP = @as(u32, 411); pub const IDS_CAP_VIDEDITERR = @as(u32, 412); pub const IDS_CAP_READONLYFILE = @as(u32, 413); pub const IDS_CAP_WRITEERROR = @as(u32, 414); pub const IDS_CAP_NODISKSPACE = @as(u32, 415); pub const IDS_CAP_SETFILESIZE = @as(u32, 416); pub const IDS_CAP_SAVEASPERCENT = @as(u32, 417); pub const IDS_CAP_DRIVER_ERROR = @as(u32, 418); pub const IDS_CAP_WAVE_OPEN_ERROR = @as(u32, 419); pub const IDS_CAP_WAVE_ALLOC_ERROR = @as(u32, 420); pub const IDS_CAP_WAVE_PREPARE_ERROR = @as(u32, 421); pub const IDS_CAP_WAVE_ADD_ERROR = @as(u32, 422); pub const IDS_CAP_WAVE_SIZE_ERROR = @as(u32, 423); pub const IDS_CAP_VIDEO_OPEN_ERROR = @as(u32, 424); pub const IDS_CAP_VIDEO_ALLOC_ERROR = @as(u32, 425); pub const IDS_CAP_VIDEO_PREPARE_ERROR = @as(u32, 426); pub const IDS_CAP_VIDEO_ADD_ERROR = @as(u32, 427); pub const IDS_CAP_VIDEO_SIZE_ERROR = @as(u32, 428); pub const IDS_CAP_FILE_OPEN_ERROR = @as(u32, 429); pub const IDS_CAP_FILE_WRITE_ERROR = @as(u32, 430); pub const IDS_CAP_RECORDING_ERROR = @as(u32, 431); pub const IDS_CAP_RECORDING_ERROR2 = @as(u32, 432); pub const IDS_CAP_AVI_INIT_ERROR = @as(u32, 433); pub const IDS_CAP_NO_FRAME_CAP_ERROR = @as(u32, 434); pub const IDS_CAP_NO_PALETTE_WARN = @as(u32, 435); pub const IDS_CAP_MCI_CONTROL_ERROR = @as(u32, 436); pub const IDS_CAP_MCI_CANT_STEP_ERROR = @as(u32, 437); pub const IDS_CAP_NO_AUDIO_CAP_ERROR = @as(u32, 438); pub const IDS_CAP_AVI_DRAWDIB_ERROR = @as(u32, 439); pub const IDS_CAP_COMPRESSOR_ERROR = @as(u32, 440); pub const IDS_CAP_AUDIO_DROP_ERROR = @as(u32, 441); pub const IDS_CAP_AUDIO_DROP_COMPERROR = @as(u32, 442); pub const IDS_CAP_STAT_LIVE_MODE = @as(u32, 500); pub const IDS_CAP_STAT_OVERLAY_MODE = @as(u32, 501); pub const IDS_CAP_STAT_CAP_INIT = @as(u32, 502); pub const IDS_CAP_STAT_CAP_FINI = @as(u32, 503); pub const IDS_CAP_STAT_PALETTE_BUILD = @as(u32, 504); pub const IDS_CAP_STAT_OPTPAL_BUILD = @as(u32, 505); pub const IDS_CAP_STAT_I_FRAMES = @as(u32, 506); pub const IDS_CAP_STAT_L_FRAMES = @as(u32, 507); pub const IDS_CAP_STAT_CAP_L_FRAMES = @as(u32, 508); pub const IDS_CAP_STAT_CAP_AUDIO = @as(u32, 509); pub const IDS_CAP_STAT_VIDEOCURRENT = @as(u32, 510); pub const IDS_CAP_STAT_VIDEOAUDIO = @as(u32, 511); pub const IDS_CAP_STAT_VIDEOONLY = @as(u32, 512); pub const IDS_CAP_STAT_FRAMESDROPPED = @as(u32, 513); pub const JOYERR_NOERROR = @as(u32, 0); pub const JOYERR_PARMS = @as(u32, 165); pub const JOYERR_NOCANDO = @as(u32, 166); pub const JOYERR_UNPLUGGED = @as(u32, 167); pub const JOY_BUTTON1 = @as(u32, 1); pub const JOY_BUTTON2 = @as(u32, 2); pub const JOY_BUTTON3 = @as(u32, 4); pub const JOY_BUTTON4 = @as(u32, 8); pub const JOY_BUTTON1CHG = @as(u32, 256); pub const JOY_BUTTON2CHG = @as(u32, 512); pub const JOY_BUTTON3CHG = @as(u32, 1024); pub const JOY_BUTTON4CHG = @as(u32, 2048); pub const JOY_BUTTON5 = @as(i32, 16); pub const JOY_BUTTON6 = @as(i32, 32); pub const JOY_BUTTON7 = @as(i32, 64); pub const JOY_BUTTON8 = @as(i32, 128); pub const JOY_BUTTON9 = @as(i32, 256); pub const JOY_BUTTON10 = @as(i32, 512); pub const JOY_BUTTON11 = @as(i32, 1024); pub const JOY_BUTTON12 = @as(i32, 2048); pub const JOY_BUTTON13 = @as(i32, 4096); pub const JOY_BUTTON14 = @as(i32, 8192); pub const JOY_BUTTON15 = @as(i32, 16384); pub const JOY_BUTTON16 = @as(i32, 32768); pub const JOY_BUTTON17 = @as(i32, 65536); pub const JOY_BUTTON18 = @as(i32, 131072); pub const JOY_BUTTON19 = @as(i32, 262144); pub const JOY_BUTTON20 = @as(i32, 524288); pub const JOY_BUTTON21 = @as(i32, 1048576); pub const JOY_BUTTON22 = @as(i32, 2097152); pub const JOY_BUTTON23 = @as(i32, 4194304); pub const JOY_BUTTON24 = @as(i32, 8388608); pub const JOY_BUTTON25 = @as(i32, 16777216); pub const JOY_BUTTON26 = @as(i32, 33554432); pub const JOY_BUTTON27 = @as(i32, 67108864); pub const JOY_BUTTON28 = @as(i32, 134217728); pub const JOY_BUTTON29 = @as(i32, 268435456); pub const JOY_BUTTON30 = @as(i32, 536870912); pub const JOY_BUTTON31 = @as(i32, 1073741824); pub const JOY_BUTTON32 = @as(i32, -2147483648); pub const JOY_POVFORWARD = @as(u32, 0); pub const JOY_POVRIGHT = @as(u32, 9000); pub const JOY_POVBACKWARD = @as(u32, 18000); pub const JOY_POVLEFT = @as(u32, 27000); pub const JOY_RETURNX = @as(i32, 1); pub const JOY_RETURNY = @as(i32, 2); pub const JOY_RETURNZ = @as(i32, 4); pub const JOY_RETURNR = @as(i32, 8); pub const JOY_RETURNU = @as(i32, 16); pub const JOY_RETURNV = @as(i32, 32); pub const JOY_RETURNPOV = @as(i32, 64); pub const JOY_RETURNBUTTONS = @as(i32, 128); pub const JOY_RETURNRAWDATA = @as(i32, 256); pub const JOY_RETURNPOVCTS = @as(i32, 512); pub const JOY_RETURNCENTERED = @as(i32, 1024); pub const JOY_USEDEADZONE = @as(i32, 2048); pub const JOY_CAL_READALWAYS = @as(i32, 65536); pub const JOY_CAL_READXYONLY = @as(i32, 131072); pub const JOY_CAL_READ3 = @as(i32, 262144); pub const JOY_CAL_READ4 = @as(i32, 524288); pub const JOY_CAL_READXONLY = @as(i32, 1048576); pub const JOY_CAL_READYONLY = @as(i32, 2097152); pub const JOY_CAL_READ5 = @as(i32, 4194304); pub const JOY_CAL_READ6 = @as(i32, 8388608); pub const JOY_CAL_READZONLY = @as(i32, 16777216); pub const JOY_CAL_READRONLY = @as(i32, 33554432); pub const JOY_CAL_READUONLY = @as(i32, 67108864); pub const JOY_CAL_READVONLY = @as(i32, 134217728); pub const JOYSTICKID1 = @as(u32, 0); pub const JOYSTICKID2 = @as(u32, 1); pub const JOYCAPS_HASZ = @as(u32, 1); pub const JOYCAPS_HASR = @as(u32, 2); pub const JOYCAPS_HASU = @as(u32, 4); pub const JOYCAPS_HASV = @as(u32, 8); pub const JOYCAPS_HASPOV = @as(u32, 16); pub const JOYCAPS_POV4DIR = @as(u32, 32); pub const JOYCAPS_POVCTS = @as(u32, 64); pub const DRV_LOAD = @as(u32, 1); pub const DRV_ENABLE = @as(u32, 2); pub const DRV_OPEN = @as(u32, 3); pub const DRV_CLOSE = @as(u32, 4); pub const DRV_DISABLE = @as(u32, 5); pub const DRV_FREE = @as(u32, 6); pub const DRV_CONFIGURE = @as(u32, 7); pub const DRV_QUERYCONFIGURE = @as(u32, 8); pub const DRV_INSTALL = @as(u32, 9); pub const DRV_REMOVE = @as(u32, 10); pub const DRV_RESERVED = @as(u32, 2048); pub const DRV_USER = @as(u32, 16384); pub const DCB_NOSWITCH = @as(u32, 8); pub const DCB_TYPEMASK = @as(u32, 7); pub const DCB_NULL = @as(u32, 0); pub const DCB_WINDOW = @as(u32, 1); pub const DCB_TASK = @as(u32, 2); pub const DCB_FUNCTION = @as(u32, 3); pub const DCB_EVENT = @as(u32, 5); pub const DRVM_INIT = @as(u32, 100); pub const DRVM_EXIT = @as(u32, 101); pub const DRVM_DISABLE = @as(u32, 102); pub const DRVM_ENABLE = @as(u32, 103); pub const DRVM_INIT_EX = @as(u32, 104); pub const DRVM_USER = @as(u32, 16384); pub const DRVM_MAPPER_RECONFIGURE = @as(u32, 8193); pub const DRVM_MAPPER_PREFERRED_GET = @as(u32, 8213); pub const DRVM_MAPPER_CONSOLEVOICECOM_GET = @as(u32, 8215); pub const DRV_QUERYDEVNODE = @as(u32, 2050); pub const DRV_QUERYMAPPABLE = @as(u32, 2053); pub const DRV_QUERYMODULE = @as(u32, 2057); pub const DRV_PNPINSTALL = @as(u32, 2059); pub const DRV_QUERYDEVICEINTERFACE = @as(u32, 2060); pub const DRV_QUERYDEVICEINTERFACESIZE = @as(u32, 2061); pub const DRV_QUERYSTRINGID = @as(u32, 2062); pub const DRV_QUERYSTRINGIDSIZE = @as(u32, 2063); pub const DRV_QUERYIDFROMSTRINGID = @as(u32, 2064); pub const DRV_QUERYFUNCTIONINSTANCEID = @as(u32, 2065); pub const DRV_QUERYFUNCTIONINSTANCEIDSIZE = @as(u32, 2066); pub const DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY = @as(u32, 1); pub const DRVM_IOCTL = @as(u32, 256); pub const DRVM_ADD_THRU = @as(u32, 257); pub const DRVM_REMOVE_THRU = @as(u32, 258); pub const DRVM_IOCTL_LAST = @as(u32, 261); pub const DRVM_IOCTL_CMD_USER = @as(i32, 0); pub const DRVM_IOCTL_CMD_SYSTEM = @as(i32, -2147483648); pub const VADMAD_Device_ID = @as(u32, 1092); pub const WODM_INIT = @as(u32, 100); pub const WIDM_INIT = @as(u32, 100); pub const WODM_INIT_EX = @as(u32, 104); pub const WIDM_INIT_EX = @as(u32, 104); pub const WODM_GETNUMDEVS = @as(u32, 3); pub const WODM_GETDEVCAPS = @as(u32, 4); pub const WODM_OPEN = @as(u32, 5); pub const WODM_CLOSE = @as(u32, 6); pub const WODM_PREPARE = @as(u32, 7); pub const WODM_UNPREPARE = @as(u32, 8); pub const WODM_WRITE = @as(u32, 9); pub const WODM_PAUSE = @as(u32, 10); pub const WODM_RESTART = @as(u32, 11); pub const WODM_RESET = @as(u32, 12); pub const WODM_GETPOS = @as(u32, 13); pub const WODM_GETPITCH = @as(u32, 14); pub const WODM_SETPITCH = @as(u32, 15); pub const WODM_GETVOLUME = @as(u32, 16); pub const WODM_SETVOLUME = @as(u32, 17); pub const WODM_GETPLAYBACKRATE = @as(u32, 18); pub const WODM_SETPLAYBACKRATE = @as(u32, 19); pub const WODM_BREAKLOOP = @as(u32, 20); pub const WODM_PREFERRED = @as(u32, 21); pub const WODM_BUSY = @as(u32, 21); pub const WIDM_GETNUMDEVS = @as(u32, 50); pub const WIDM_GETDEVCAPS = @as(u32, 51); pub const WIDM_OPEN = @as(u32, 52); pub const WIDM_CLOSE = @as(u32, 53); pub const WIDM_PREPARE = @as(u32, 54); pub const WIDM_UNPREPARE = @as(u32, 55); pub const WIDM_ADDBUFFER = @as(u32, 56); pub const WIDM_START = @as(u32, 57); pub const WIDM_STOP = @as(u32, 58); pub const WIDM_RESET = @as(u32, 59); pub const WIDM_GETPOS = @as(u32, 60); pub const WIDM_PREFERRED = @as(u32, 61); pub const MIDI_IO_PACKED = @as(i32, 0); pub const MIDI_IO_COOKED = @as(i32, 2); pub const MODM_GETNUMDEVS = @as(u32, 1); pub const MODM_GETDEVCAPS = @as(u32, 2); pub const MODM_OPEN = @as(u32, 3); pub const MODM_CLOSE = @as(u32, 4); pub const MODM_PREPARE = @as(u32, 5); pub const MODM_UNPREPARE = @as(u32, 6); pub const MODM_DATA = @as(u32, 7); pub const MODM_LONGDATA = @as(u32, 8); pub const MODM_RESET = @as(u32, 9); pub const MODM_GETVOLUME = @as(u32, 10); pub const MODM_SETVOLUME = @as(u32, 11); pub const MODM_CACHEPATCHES = @as(u32, 12); pub const MODM_CACHEDRUMPATCHES = @as(u32, 13); pub const MODM_STRMDATA = @as(u32, 14); pub const MODM_GETPOS = @as(u32, 17); pub const MODM_PAUSE = @as(u32, 18); pub const MODM_RESTART = @as(u32, 19); pub const MODM_STOP = @as(u32, 20); pub const MODM_PROPERTIES = @as(u32, 21); pub const MODM_PREFERRED = @as(u32, 22); pub const MODM_RECONFIGURE = @as(u32, 18280); pub const MIDM_GETNUMDEVS = @as(u32, 53); pub const MIDM_GETDEVCAPS = @as(u32, 54); pub const MIDM_OPEN = @as(u32, 55); pub const MIDM_CLOSE = @as(u32, 56); pub const MIDM_PREPARE = @as(u32, 57); pub const MIDM_UNPREPARE = @as(u32, 58); pub const MIDM_ADDBUFFER = @as(u32, 59); pub const MIDM_START = @as(u32, 60); pub const MIDM_STOP = @as(u32, 61); pub const MIDM_RESET = @as(u32, 62); pub const AUXM_INIT = @as(u32, 100); pub const AUXM_INIT_EX = @as(u32, 104); pub const AUXDM_GETNUMDEVS = @as(u32, 3); pub const AUXDM_GETDEVCAPS = @as(u32, 4); pub const AUXDM_GETVOLUME = @as(u32, 5); pub const AUXDM_SETVOLUME = @as(u32, 6); pub const MXDM_INIT = @as(u32, 100); pub const MXDM_INIT_EX = @as(u32, 104); pub const MXDM_USER = @as(u32, 16384); pub const MXDM_BASE = @as(u32, 1); pub const MXDM_GETNUMDEVS = @as(u32, 1); pub const MXDM_GETDEVCAPS = @as(u32, 2); pub const MXDM_OPEN = @as(u32, 3); pub const MXDM_CLOSE = @as(u32, 4); pub const MXDM_GETLINEINFO = @as(u32, 5); pub const MXDM_GETLINECONTROLS = @as(u32, 6); pub const MXDM_GETCONTROLDETAILS = @as(u32, 7); pub const MXDM_SETCONTROLDETAILS = @as(u32, 8); pub const TDD_KILLTIMEREVENT = @as(u32, 2048); pub const TDD_SETTIMEREVENT = @as(u32, 2052); pub const TDD_GETSYSTEMTIME = @as(u32, 2056); pub const TDD_GETDEVCAPS = @as(u32, 2060); pub const TDD_BEGINMINPERIOD = @as(u32, 2064); pub const TDD_ENDMINPERIOD = @as(u32, 2068); pub const JDD_GETNUMDEVS = @as(u32, 2049); pub const JDD_GETDEVCAPS = @as(u32, 2050); pub const JDD_GETPOS = @as(u32, 2305); pub const JDD_SETCALIBRATION = @as(u32, 2306); pub const JDD_CONFIGCHANGED = @as(u32, 2307); pub const JDD_GETPOSEX = @as(u32, 2308); pub const MCI_OPEN_DRIVER = @as(u32, 2049); pub const MCI_CLOSE_DRIVER = @as(u32, 2050); pub const MCI_FALSE = @as(u32, 531); pub const MCI_TRUE = @as(u32, 532); pub const MCI_FORMAT_MILLISECONDS_S = @as(u32, 533); pub const MCI_FORMAT_HMS_S = @as(u32, 534); pub const MCI_FORMAT_MSF_S = @as(u32, 535); pub const MCI_FORMAT_FRAMES_S = @as(u32, 536); pub const MCI_FORMAT_SMPTE_24_S = @as(u32, 537); pub const MCI_FORMAT_SMPTE_25_S = @as(u32, 538); pub const MCI_FORMAT_SMPTE_30_S = @as(u32, 539); pub const MCI_FORMAT_SMPTE_30DROP_S = @as(u32, 540); pub const MCI_FORMAT_BYTES_S = @as(u32, 541); pub const MCI_FORMAT_SAMPLES_S = @as(u32, 542); pub const MCI_FORMAT_TMSF_S = @as(u32, 543); pub const MCI_VD_FORMAT_TRACK_S = @as(u32, 1029); pub const WAVE_FORMAT_PCM_S = @as(u32, 1152); pub const WAVE_MAPPER_S = @as(u32, 1153); pub const MCI_SEQ_MAPPER_S = @as(u32, 1221); pub const MCI_SEQ_FILE_S = @as(u32, 1222); pub const MCI_SEQ_MIDI_S = @as(u32, 1223); pub const MCI_SEQ_SMPTE_S = @as(u32, 1224); pub const MCI_SEQ_FORMAT_SONGPTR_S = @as(u32, 1225); pub const MCI_SEQ_NONE_S = @as(u32, 1226); pub const MIDIMAPPER_S = @as(u32, 1227); pub const MCI_MAX_DEVICE_TYPE_LENGTH = @as(u32, 80); pub const MCI_RESOURCE_RETURNED = @as(u32, 65536); pub const MCI_COLONIZED3_RETURN = @as(u32, 131072); pub const MCI_COLONIZED4_RETURN = @as(u32, 262144); pub const MCI_INTEGER_RETURNED = @as(u32, 524288); pub const MCI_RESOURCE_DRIVER = @as(u32, 1048576); pub const MCI_COMMAND_HEAD = @as(u32, 0); pub const MCI_STRING = @as(u32, 1); pub const MCI_INTEGER = @as(u32, 2); pub const MCI_END_COMMAND = @as(u32, 3); pub const MCI_RETURN = @as(u32, 4); pub const MCI_FLAG = @as(u32, 5); pub const MCI_END_COMMAND_LIST = @as(u32, 6); pub const MCI_RECT = @as(u32, 7); pub const MCI_CONSTANT = @as(u32, 8); pub const MCI_END_CONSTANT = @as(u32, 9); pub const MCI_HWND = @as(u32, 10); pub const MCI_HPAL = @as(u32, 11); pub const MCI_HDC = @as(u32, 12); pub const MCI_INTEGER64 = @as(u32, 13); pub const TASKERR_NOTASKSUPPORT = @as(u32, 1); pub const TASKERR_OUTOFMEMORY = @as(u32, 2); pub const DRV_EXITSESSION = @as(u32, 11); pub const DRV_POWER = @as(u32, 15); pub const DRVCNF_CANCEL = @as(u32, 0); pub const DRVCNF_OK = @as(u32, 1); pub const DRVCNF_RESTART = @as(u32, 2); pub const DRV_CANCEL = @as(u32, 0); pub const DRV_OK = @as(u32, 1); pub const DRV_RESTART = @as(u32, 2); pub const DRV_MCI_LAST = @as(u32, 6143); pub const MMIOERR_BASE = @as(u32, 256); pub const MMIOERR_FILENOTFOUND = @as(u32, 257); pub const MMIOERR_OUTOFMEMORY = @as(u32, 258); pub const MMIOERR_CANNOTOPEN = @as(u32, 259); pub const MMIOERR_CANNOTCLOSE = @as(u32, 260); pub const MMIOERR_CANNOTREAD = @as(u32, 261); pub const MMIOERR_CANNOTWRITE = @as(u32, 262); pub const MMIOERR_CANNOTSEEK = @as(u32, 263); pub const MMIOERR_CANNOTEXPAND = @as(u32, 264); pub const MMIOERR_CHUNKNOTFOUND = @as(u32, 265); pub const MMIOERR_UNBUFFERED = @as(u32, 266); pub const MMIOERR_PATHNOTFOUND = @as(u32, 267); pub const MMIOERR_ACCESSDENIED = @as(u32, 268); pub const MMIOERR_SHARINGVIOLATION = @as(u32, 269); pub const MMIOERR_NETWORKERROR = @as(u32, 270); pub const MMIOERR_TOOMANYOPENFILES = @as(u32, 271); pub const MMIOERR_INVALIDFILE = @as(u32, 272); pub const MMIO_RWMODE = @as(u32, 3); pub const MMIO_SHAREMODE = @as(u32, 112); pub const MMIO_CREATE = @as(u32, 4096); pub const MMIO_PARSE = @as(u32, 256); pub const MMIO_DELETE = @as(u32, 512); pub const MMIO_EXIST = @as(u32, 16384); pub const MMIO_ALLOCBUF = @as(u32, 65536); pub const MMIO_GETTEMP = @as(u32, 131072); pub const MMIO_DIRTY = @as(u32, 268435456); pub const MMIO_READ = @as(u32, 0); pub const MMIO_WRITE = @as(u32, 1); pub const MMIO_READWRITE = @as(u32, 2); pub const MMIO_COMPAT = @as(u32, 0); pub const MMIO_EXCLUSIVE = @as(u32, 16); pub const MMIO_DENYWRITE = @as(u32, 32); pub const MMIO_DENYREAD = @as(u32, 48); pub const MMIO_DENYNONE = @as(u32, 64); pub const MMIO_FHOPEN = @as(u32, 16); pub const MMIO_EMPTYBUF = @as(u32, 16); pub const MMIO_TOUPPER = @as(u32, 16); pub const MMIO_INSTALLPROC = @as(u32, 65536); pub const MMIO_GLOBALPROC = @as(u32, 268435456); pub const MMIO_REMOVEPROC = @as(u32, 131072); pub const MMIO_UNICODEPROC = @as(u32, 16777216); pub const MMIO_FINDPROC = @as(u32, 262144); pub const MMIO_FINDCHUNK = @as(u32, 16); pub const MMIO_FINDRIFF = @as(u32, 32); pub const MMIO_FINDLIST = @as(u32, 64); pub const MMIO_CREATERIFF = @as(u32, 32); pub const MMIO_CREATELIST = @as(u32, 64); pub const MMIOM_READ = @as(u32, 0); pub const MMIOM_WRITE = @as(u32, 1); pub const MMIOM_SEEK = @as(u32, 2); pub const MMIOM_OPEN = @as(u32, 3); pub const MMIOM_CLOSE = @as(u32, 4); pub const MMIOM_WRITEFLUSH = @as(u32, 5); pub const MMIOM_RENAME = @as(u32, 6); pub const MMIOM_USER = @as(u32, 32768); pub const SEEK_SET = @as(u32, 0); pub const SEEK_CUR = @as(u32, 1); pub const SEEK_END = @as(u32, 2); pub const MMIO_DEFAULTBUFFER = @as(u32, 8192); pub const FACILITY_NS = @as(u32, 13); pub const MCI_MCIAVI_PLAY_WINDOW = @as(i32, 16777216); pub const MCI_MCIAVI_PLAY_FULLSCREEN = @as(i32, 33554432); pub const MCI_MCIAVI_PLAY_FULLBY2 = @as(i32, 67108864); pub const MCI_AVI_STATUS_FRAMES_SKIPPED = @as(i32, 32769); pub const MCI_AVI_STATUS_LAST_PLAY_SPEED = @as(i32, 32770); pub const MCI_AVI_STATUS_AUDIO_BREAKS = @as(i32, 32771); pub const MCI_AVI_SETVIDEO_DRAW_PROCEDURE = @as(i32, 32768); pub const MCI_AVI_SETVIDEO_PALETTE_COLOR = @as(i32, 33024); pub const MCI_AVI_SETVIDEO_PALETTE_HALFTONE = @as(i32, 65535); pub const MCIERR_AVI_OLDAVIFORMAT = @as(u32, 612); pub const MCIERR_AVI_NOTINTERLEAVED = @as(u32, 613); pub const MCIERR_AVI_NODISPDIB = @as(u32, 614); pub const MCIERR_AVI_CANTPLAYFULLSCREEN = @as(u32, 615); pub const MCIERR_AVI_TOOBIGFORVGA = @as(u32, 616); pub const MCIERR_AVI_NOCOMPRESSOR = @as(u32, 617); pub const MCIERR_AVI_DISPLAYERROR = @as(u32, 618); pub const MCIERR_AVI_AUDIOERROR = @as(u32, 619); pub const MCIERR_AVI_BADPALETTE = @as(u32, 620); pub const DLG_ACMFORMATCHOOSE_ID = @as(u32, 70); pub const IDD_ACMFORMATCHOOSE_BTN_HELP = @as(u32, 9); pub const IDD_ACMFORMATCHOOSE_CMB_CUSTOM = @as(u32, 100); pub const IDD_ACMFORMATCHOOSE_CMB_FORMATTAG = @as(u32, 101); pub const IDD_ACMFORMATCHOOSE_CMB_FORMAT = @as(u32, 102); pub const IDD_ACMFORMATCHOOSE_BTN_SETNAME = @as(u32, 103); pub const IDD_ACMFORMATCHOOSE_BTN_DELNAME = @as(u32, 104); pub const DLG_ACMFILTERCHOOSE_ID = @as(u32, 71); pub const IDD_ACMFILTERCHOOSE_BTN_HELP = @as(u32, 9); pub const IDD_ACMFILTERCHOOSE_CMB_CUSTOM = @as(u32, 100); pub const IDD_ACMFILTERCHOOSE_CMB_FILTERTAG = @as(u32, 101); pub const IDD_ACMFILTERCHOOSE_CMB_FILTER = @as(u32, 102); pub const IDD_ACMFILTERCHOOSE_BTN_SETNAME = @as(u32, 103); pub const IDD_ACMFILTERCHOOSE_BTN_DELNAME = @as(u32, 104); pub const FACILITY_NS_WIN32 = @as(u32, 7); pub const NS_S_CALLPENDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 851968)); pub const NS_S_CALLABORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 851969)); pub const NS_S_STREAM_TRUNCATED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 851970)); pub const NS_W_SERVER_BANDWIDTH_LIMIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146631677)); pub const NS_W_FILE_BANDWIDTH_LIMIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146631676)); pub const NS_E_NOCONNECTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889851)); pub const NS_E_CANNOTCONNECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889850)); pub const NS_E_CANNOTDESTROYTITLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889849)); pub const NS_E_CANNOTRENAMETITLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889848)); pub const NS_E_CANNOTOFFLINEDISK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889847)); pub const NS_E_CANNOTONLINEDISK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889846)); pub const NS_E_NOREGISTEREDWALKER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889845)); pub const NS_E_NOFUNNEL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889844)); pub const NS_E_NO_LOCALPLAY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889843)); pub const NS_E_NETWORK_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889842)); pub const NS_E_TOO_MANY_SESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889841)); pub const NS_E_ALREADY_CONNECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889840)); pub const NS_E_INVALID_INDEX = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889839)); pub const NS_E_PROTOCOL_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889838)); pub const NS_E_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889837)); pub const NS_E_NET_WRITE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889836)); pub const NS_E_NET_READ = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889835)); pub const NS_E_DISK_WRITE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889834)); pub const NS_E_DISK_READ = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889833)); pub const NS_E_FILE_WRITE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889832)); pub const NS_E_FILE_READ = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889831)); pub const NS_E_FILE_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889830)); pub const NS_E_FILE_EXISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889829)); pub const NS_E_INVALID_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889828)); pub const NS_E_FILE_OPEN_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889827)); pub const NS_E_FILE_ALLOCATION_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889826)); pub const NS_E_FILE_INIT_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889825)); pub const NS_E_FILE_PLAY_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889824)); pub const NS_E_SET_DISK_UID_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889823)); pub const NS_E_INDUCED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889822)); pub const NS_E_CCLINK_DOWN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889821)); pub const NS_E_INTERNAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889820)); pub const NS_E_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889819)); pub const NS_E_UNRECOGNIZED_STREAM_TYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889818)); pub const NS_E_NETWORK_SERVICE_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889817)); pub const NS_E_NETWORK_RESOURCE_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889816)); pub const NS_E_CONNECTION_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889815)); pub const NS_E_SHUTDOWN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889814)); pub const NS_E_INVALID_REQUEST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889813)); pub const NS_E_INSUFFICIENT_BANDWIDTH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889812)); pub const NS_E_NOT_REBUILDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889811)); pub const NS_E_LATE_OPERATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889810)); pub const NS_E_INVALID_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889809)); pub const NS_E_FILE_BANDWIDTH_LIMIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889808)); pub const NS_E_OPEN_FILE_LIMIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889807)); pub const NS_E_BAD_CONTROL_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889806)); pub const NS_E_NO_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889805)); pub const NS_E_STREAM_END = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889804)); pub const NS_E_SERVER_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889803)); pub const NS_E_DUPLICATE_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889802)); pub const NS_E_DUPLICATE_ADDRESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889801)); pub const NS_E_BAD_MULTICAST_ADDRESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889800)); pub const NS_E_BAD_ADAPTER_ADDRESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889799)); pub const NS_E_BAD_DELIVERY_MODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889798)); pub const NS_E_INVALID_CHANNEL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889797)); pub const NS_E_INVALID_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889796)); pub const NS_E_INVALID_ARCHIVE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889795)); pub const NS_E_NOTITLES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889794)); pub const NS_E_INVALID_CLIENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889793)); pub const NS_E_INVALID_BLACKHOLE_ADDRESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889792)); pub const NS_E_INCOMPATIBLE_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889791)); pub const NS_E_INVALID_KEY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889790)); pub const NS_E_INVALID_PORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889789)); pub const NS_E_INVALID_TTL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889788)); pub const NS_E_STRIDE_REFUSED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889787)); pub const NS_E_MMSAUTOSERVER_CANTFINDWALKER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889786)); pub const NS_E_MAX_BITRATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889785)); pub const NS_E_LOGFILEPERIOD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889784)); pub const NS_E_MAX_CLIENTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889783)); pub const NS_E_LOG_FILE_SIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889782)); pub const NS_E_MAX_FILERATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889781)); pub const NS_E_WALKER_UNKNOWN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889780)); pub const NS_E_WALKER_SERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889779)); pub const NS_E_WALKER_USAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889778)); pub const NS_I_TIGER_START = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593871)); pub const NS_E_TIGER_FAIL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889776)); pub const NS_I_CUB_START = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593873)); pub const NS_I_CUB_RUNNING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593874)); pub const NS_E_CUB_FAIL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889773)); pub const NS_I_DISK_START = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593876)); pub const NS_E_DISK_FAIL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889771)); pub const NS_I_DISK_REBUILD_STARTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593878)); pub const NS_I_DISK_REBUILD_FINISHED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593879)); pub const NS_I_DISK_REBUILD_ABORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593880)); pub const NS_I_LIMIT_FUNNELS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593881)); pub const NS_I_START_DISK = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593882)); pub const NS_I_STOP_DISK = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593883)); pub const NS_I_STOP_CUB = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593884)); pub const NS_I_KILL_USERSESSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593885)); pub const NS_I_KILL_CONNECTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593886)); pub const NS_I_REBUILD_DISK = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593887)); pub const NS_W_UNKNOWN_EVENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146631584)); pub const NS_E_MAX_FUNNELS_ALERT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889760)); pub const NS_E_ALLOCATE_FILE_FAIL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889759)); pub const NS_E_PAGING_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889758)); pub const NS_E_BAD_BLOCK0_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889757)); pub const NS_E_BAD_DISK_UID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889756)); pub const NS_E_BAD_FSMAJOR_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889755)); pub const NS_E_BAD_STAMPNUMBER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889754)); pub const NS_E_PARTIALLY_REBUILT_DISK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889753)); pub const NS_E_ENACTPLAN_GIVEUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889752)); pub const MCMADM_I_NO_EVENTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593897)); pub const MCMADM_E_REGKEY_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889750)); pub const NS_E_NO_FORMATS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889749)); pub const NS_E_NO_REFERENCES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889748)); pub const NS_E_WAVE_OPEN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889747)); pub const NS_I_LOGGING_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593902)); pub const NS_E_CANNOTCONNECTEVENTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889745)); pub const NS_I_LIMIT_BANDWIDTH = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074593904)); pub const NS_E_NO_DEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889743)); pub const NS_E_NO_SPECIFIED_DEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889742)); pub const NS_E_NOTHING_TO_DO = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072887823)); pub const NS_E_NO_MULTICAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072887822)); pub const NS_E_MONITOR_GIVEUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889656)); pub const NS_E_REMIRRORED_DISK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889655)); pub const NS_E_INSUFFICIENT_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889654)); pub const NS_E_ASSERT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889653)); pub const NS_E_BAD_ADAPTER_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889652)); pub const NS_E_NOT_LICENSED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889651)); pub const NS_E_NO_SERVER_CONTACT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889650)); pub const NS_E_TOO_MANY_TITLES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889649)); pub const NS_E_TITLE_SIZE_EXCEEDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889648)); pub const NS_E_UDP_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889647)); pub const NS_E_TCP_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889646)); pub const NS_E_HTTP_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889645)); pub const NS_E_LICENSE_EXPIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889644)); pub const NS_E_TITLE_BITRATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889643)); pub const NS_E_EMPTY_PROGRAM_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889642)); pub const NS_E_MISSING_CHANNEL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889641)); pub const NS_E_NO_CHANNELS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889640)); pub const NS_E_INVALID_INDEX2 = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889639)); pub const NS_E_CUB_FAIL_LINK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889456)); pub const NS_I_CUB_UNFAIL_LINK = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074594193)); pub const NS_E_BAD_CUB_UID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889454)); pub const NS_I_RESTRIPE_START = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074594195)); pub const NS_I_RESTRIPE_DONE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074594196)); pub const NS_E_GLITCH_MODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889451)); pub const NS_I_RESTRIPE_DISK_OUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074594198)); pub const NS_I_RESTRIPE_CUB_OUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074594199)); pub const NS_I_DISK_STOP = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074594200)); pub const NS_I_CATATONIC_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146631271)); pub const NS_I_CATATONIC_AUTO_UNFAIL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146631270)); pub const NS_E_NO_MEDIA_PROTOCOL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072889445)); pub const NS_E_INVALID_INPUT_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886856)); pub const NS_E_MSAUDIO_NOT_INSTALLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886855)); pub const NS_E_UNEXPECTED_MSAUDIO_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886854)); pub const NS_E_INVALID_OUTPUT_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886853)); pub const NS_E_NOT_CONFIGURED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886852)); pub const NS_E_PROTECTED_CONTENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886851)); pub const NS_E_LICENSE_REQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886850)); pub const NS_E_TAMPERED_CONTENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886849)); pub const NS_E_LICENSE_OUTOFDATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886848)); pub const NS_E_LICENSE_INCORRECT_RIGHTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886847)); pub const NS_E_AUDIO_CODEC_NOT_INSTALLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886846)); pub const NS_E_AUDIO_CODEC_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886845)); pub const NS_E_VIDEO_CODEC_NOT_INSTALLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886844)); pub const NS_E_VIDEO_CODEC_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886843)); pub const NS_E_INVALIDPROFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886842)); pub const NS_E_INCOMPATIBLE_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886841)); pub const NS_S_REBUFFERING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 854984)); pub const NS_S_DEGRADING_QUALITY = @import("../zig.zig").typedConst(HRESULT, @as(i32, 854985)); pub const NS_E_OFFLINE_MODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886838)); pub const NS_E_NOT_CONNECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886837)); pub const NS_E_TOO_MUCH_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886836)); pub const NS_E_UNSUPPORTED_PROPERTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886835)); pub const NS_E_8BIT_WAVE_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886834)); pub const NS_E_NO_MORE_SAMPLES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886833)); pub const NS_E_INVALID_SAMPLING_RATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886832)); pub const NS_E_MAX_PACKET_SIZE_TOO_SMALL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886831)); pub const NS_E_LATE_PACKET = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886830)); pub const NS_E_DUPLICATE_PACKET = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886829)); pub const NS_E_SDK_BUFFERTOOSMALL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886828)); pub const NS_E_INVALID_NUM_PASSES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886827)); pub const NS_E_ATTRIBUTE_READ_ONLY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886826)); pub const NS_E_ATTRIBUTE_NOT_ALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886825)); pub const NS_E_INVALID_EDL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886824)); pub const NS_E_DATA_UNIT_EXTENSION_TOO_LARGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886823)); pub const NS_E_CODEC_DMO_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886822)); pub const NS_S_TRANSCRYPTOR_EOF = @import("../zig.zig").typedConst(HRESULT, @as(i32, 855003)); pub const NS_E_FEATURE_DISABLED_BY_GROUP_POLICY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886820)); pub const NS_E_FEATURE_DISABLED_IN_SKU = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886819)); pub const NS_E_WMDRM_DEPRECATED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072886818)); pub const NS_E_NO_CD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885856)); pub const NS_E_CANT_READ_DIGITAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885855)); pub const NS_E_DEVICE_DISCONNECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885854)); pub const NS_E_DEVICE_NOT_SUPPORT_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885853)); pub const NS_E_SLOW_READ_DIGITAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885852)); pub const NS_E_MIXER_INVALID_LINE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885851)); pub const NS_E_MIXER_INVALID_CONTROL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885850)); pub const NS_E_MIXER_INVALID_VALUE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885849)); pub const NS_E_MIXER_UNKNOWN_MMRESULT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885848)); pub const NS_E_USER_STOP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885847)); pub const NS_E_MP3_FORMAT_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885846)); pub const NS_E_CD_READ_ERROR_NO_CORRECTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885845)); pub const NS_E_CD_READ_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885844)); pub const NS_E_CD_SLOW_COPY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885843)); pub const NS_E_CD_COPYTO_CD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885842)); pub const NS_E_MIXER_NODRIVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885841)); pub const NS_E_REDBOOK_ENABLED_WHILE_COPYING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885840)); pub const NS_E_CD_REFRESH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885839)); pub const NS_E_CD_DRIVER_PROBLEM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885838)); pub const NS_E_WONT_DO_DIGITAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885837)); pub const NS_E_WMPXML_NOERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885836)); pub const NS_E_WMPXML_ENDOFDATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885835)); pub const NS_E_WMPXML_PARSEERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885834)); pub const NS_E_WMPXML_ATTRIBUTENOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885833)); pub const NS_E_WMPXML_PINOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885832)); pub const NS_E_WMPXML_EMPTYDOC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885831)); pub const NS_E_WMP_PATH_ALREADY_IN_LIBRARY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885830)); pub const NS_E_WMP_FILESCANALREADYSTARTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885826)); pub const NS_E_WMP_HME_INVALIDOBJECTID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885825)); pub const NS_E_WMP_MF_CODE_EXPIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885824)); pub const NS_E_WMP_HME_NOTSEARCHABLEFORITEMS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885823)); pub const NS_E_WMP_HME_STALEREQUEST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885822)); pub const NS_E_WMP_ADDTOLIBRARY_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885817)); pub const NS_E_WMP_WINDOWSAPIFAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885816)); pub const NS_E_WMP_RECORDING_NOT_ALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885815)); pub const NS_E_DEVICE_NOT_READY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885814)); pub const NS_E_DAMAGED_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885813)); pub const NS_E_MPDB_GENERIC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885812)); pub const NS_E_FILE_FAILED_CHECKS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885811)); pub const NS_E_MEDIA_LIBRARY_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885810)); pub const NS_E_SHARING_VIOLATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885809)); pub const NS_E_NO_ERROR_STRING_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885808)); pub const NS_E_WMPOCX_NO_REMOTE_CORE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885807)); pub const NS_E_WMPOCX_NO_ACTIVE_CORE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885806)); pub const NS_E_WMPOCX_NOT_RUNNING_REMOTELY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885805)); pub const NS_E_WMPOCX_NO_REMOTE_WINDOW = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885804)); pub const NS_E_WMPOCX_ERRORMANAGERNOTAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885803)); pub const NS_E_PLUGIN_NOTSHUTDOWN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885802)); pub const NS_E_WMP_CANNOT_FIND_FOLDER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885801)); pub const NS_E_WMP_STREAMING_RECORDING_NOT_ALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885800)); pub const NS_E_WMP_PLUGINDLL_NOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885799)); pub const NS_E_NEED_TO_ASK_USER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885798)); pub const NS_E_WMPOCX_PLAYER_NOT_DOCKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885797)); pub const NS_E_WMP_EXTERNAL_NOTREADY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885796)); pub const NS_E_WMP_MLS_STALE_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885795)); pub const NS_E_WMP_UI_SUBCONTROLSNOTSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885794)); pub const NS_E_WMP_UI_VERSIONMISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885793)); pub const NS_E_WMP_UI_NOTATHEMEFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885792)); pub const NS_E_WMP_UI_SUBELEMENTNOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885791)); pub const NS_E_WMP_UI_VERSIONPARSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885790)); pub const NS_E_WMP_UI_VIEWIDNOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885789)); pub const NS_E_WMP_UI_PASSTHROUGH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885788)); pub const NS_E_WMP_UI_OBJECTNOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885787)); pub const NS_E_WMP_UI_SECONDHANDLER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885786)); pub const NS_E_WMP_UI_NOSKININZIP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885785)); pub const NS_S_WMP_UI_VERSIONMISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856040)); pub const NS_S_WMP_EXCEPTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856041)); pub const NS_E_WMP_URLDOWNLOADFAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885782)); pub const NS_E_WMPOCX_UNABLE_TO_LOAD_SKIN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885781)); pub const NS_E_WMP_INVALID_SKIN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885780)); pub const NS_E_WMP_SENDMAILFAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885779)); pub const NS_E_WMP_LOCKEDINSKINMODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885778)); pub const NS_E_WMP_FAILED_TO_SAVE_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885777)); pub const NS_E_WMP_SAVEAS_READONLY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885776)); pub const NS_E_WMP_FAILED_TO_SAVE_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885775)); pub const NS_E_WMP_FAILED_TO_OPEN_WMD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885774)); pub const NS_E_WMP_CANT_PLAY_PROTECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885773)); pub const NS_E_SHARING_STATE_OUT_OF_SYNC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885772)); pub const NS_E_WMPOCX_REMOTE_PLAYER_ALREADY_RUNNING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885766)); pub const NS_E_WMP_RBC_JPGMAPPINGIMAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885756)); pub const NS_E_WMP_JPGTRANSPARENCY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885755)); pub const NS_E_WMP_INVALID_MAX_VAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885751)); pub const NS_E_WMP_INVALID_MIN_VAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885750)); pub const NS_E_WMP_CS_JPGPOSITIONIMAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885746)); pub const NS_E_WMP_CS_NOTEVENLYDIVISIBLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885745)); pub const NS_E_WMPZIP_NOTAZIPFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885736)); pub const NS_E_WMPZIP_CORRUPT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885735)); pub const NS_E_WMPZIP_FILENOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885734)); pub const NS_E_WMP_IMAGE_FILETYPE_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885726)); pub const NS_E_WMP_IMAGE_INVALID_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885725)); pub const NS_E_WMP_GIF_UNEXPECTED_ENDOFFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885724)); pub const NS_E_WMP_GIF_INVALID_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885723)); pub const NS_E_WMP_GIF_BAD_VERSION_NUMBER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885722)); pub const NS_E_WMP_GIF_NO_IMAGE_IN_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885721)); pub const NS_E_WMP_PNG_INVALIDFORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885720)); pub const NS_E_WMP_PNG_UNSUPPORTED_BITDEPTH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885719)); pub const NS_E_WMP_PNG_UNSUPPORTED_COMPRESSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885718)); pub const NS_E_WMP_PNG_UNSUPPORTED_FILTER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885717)); pub const NS_E_WMP_PNG_UNSUPPORTED_INTERLACE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885716)); pub const NS_E_WMP_PNG_UNSUPPORTED_BAD_CRC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885715)); pub const NS_E_WMP_BMP_INVALID_BITMASK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885714)); pub const NS_E_WMP_BMP_TOPDOWN_DIB_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885713)); pub const NS_E_WMP_BMP_BITMAP_NOT_CREATED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885712)); pub const NS_E_WMP_BMP_COMPRESSION_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885711)); pub const NS_E_WMP_BMP_INVALID_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885710)); pub const NS_E_WMP_JPG_JERR_ARITHCODING_NOTIMPL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885709)); pub const NS_E_WMP_JPG_INVALID_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885708)); pub const NS_E_WMP_JPG_BAD_DCTSIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885707)); pub const NS_E_WMP_JPG_BAD_VERSION_NUMBER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885706)); pub const NS_E_WMP_JPG_BAD_PRECISION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885705)); pub const NS_E_WMP_JPG_CCIR601_NOTIMPL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885704)); pub const NS_E_WMP_JPG_NO_IMAGE_IN_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885703)); pub const NS_E_WMP_JPG_READ_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885702)); pub const NS_E_WMP_JPG_FRACT_SAMPLE_NOTIMPL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885701)); pub const NS_E_WMP_JPG_IMAGE_TOO_BIG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885700)); pub const NS_E_WMP_JPG_UNEXPECTED_ENDOFFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885699)); pub const NS_E_WMP_JPG_SOF_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885698)); pub const NS_E_WMP_JPG_UNKNOWN_MARKER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885697)); pub const NS_S_WMP_LOADED_GIF_IMAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856128)); pub const NS_S_WMP_LOADED_PNG_IMAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856129)); pub const NS_S_WMP_LOADED_BMP_IMAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856130)); pub const NS_S_WMP_LOADED_JPG_IMAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856131)); pub const NS_E_WMP_FAILED_TO_OPEN_IMAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885692)); pub const NS_E_WMP_DAI_SONGTOOSHORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885687)); pub const NS_E_WMG_RATEUNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885686)); pub const NS_E_WMG_PLUGINUNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885685)); pub const NS_E_WMG_CANNOTQUEUE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885684)); pub const NS_E_WMG_PREROLLLICENSEACQUISITIONNOTALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885683)); pub const NS_E_WMG_UNEXPECTEDPREROLLSTATUS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885682)); pub const NS_S_WMG_FORCE_DROP_FRAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856143)); pub const NS_E_WMG_INVALID_COPP_CERTIFICATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885679)); pub const NS_E_WMG_COPP_SECURITY_INVALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885678)); pub const NS_E_WMG_COPP_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885677)); pub const NS_E_WMG_INVALIDSTATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885676)); pub const NS_E_WMG_SINKALREADYEXISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885675)); pub const NS_E_WMG_NOSDKINTERFACE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885674)); pub const NS_E_WMG_NOTALLOUTPUTSRENDERED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885673)); pub const NS_E_WMG_FILETRANSFERNOTALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885672)); pub const NS_E_WMR_UNSUPPORTEDSTREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885671)); pub const NS_E_WMR_PINNOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885670)); pub const NS_E_WMR_WAITINGONFORMATSWITCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885669)); pub const NS_E_WMR_NOSOURCEFILTER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885668)); pub const NS_E_WMR_PINTYPENOMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885667)); pub const NS_E_WMR_NOCALLBACKAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885666)); pub const NS_S_WMR_ALREADYRENDERED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856159)); pub const NS_S_WMR_PINTYPEPARTIALMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856160)); pub const NS_S_WMR_PINTYPEFULLMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856161)); pub const NS_E_WMR_SAMPLEPROPERTYNOTSET = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885662)); pub const NS_E_WMR_CANNOT_RENDER_BINARY_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885661)); pub const NS_E_WMG_LICENSE_TAMPERED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885660)); pub const NS_E_WMR_WILLNOT_RENDER_BINARY_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885659)); pub const NS_S_WMG_ADVISE_DROP_FRAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856166)); pub const NS_S_WMG_ADVISE_DROP_TO_KEYFRAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856167)); pub const NS_E_WMX_UNRECOGNIZED_PLAYLIST_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885656)); pub const NS_E_ASX_INVALIDFORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885655)); pub const NS_E_ASX_INVALIDVERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885654)); pub const NS_E_ASX_INVALID_REPEAT_BLOCK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885653)); pub const NS_E_ASX_NOTHING_TO_WRITE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885652)); pub const NS_E_URLLIST_INVALIDFORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885651)); pub const NS_E_WMX_ATTRIBUTE_DOES_NOT_EXIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885650)); pub const NS_E_WMX_ATTRIBUTE_ALREADY_EXISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885649)); pub const NS_E_WMX_ATTRIBUTE_UNRETRIEVABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885648)); pub const NS_E_WMX_ITEM_DOES_NOT_EXIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885647)); pub const NS_E_WMX_ITEM_TYPE_ILLEGAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885646)); pub const NS_E_WMX_ITEM_UNSETTABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885645)); pub const NS_E_WMX_PLAYLIST_EMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885644)); pub const NS_E_MLS_SMARTPLAYLIST_FILTER_NOT_REGISTERED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885643)); pub const NS_E_WMX_INVALID_FORMAT_OVER_NESTING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885642)); pub const NS_E_WMPCORE_NOSOURCEURLSTRING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885636)); pub const NS_E_WMPCORE_COCREATEFAILEDFORGITOBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885635)); pub const NS_E_WMPCORE_FAILEDTOGETMARSHALLEDEVENTHANDLERINTERFACE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885634)); pub const NS_E_WMPCORE_BUFFERTOOSMALL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885633)); pub const NS_E_WMPCORE_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885632)); pub const NS_E_WMPCORE_INVALIDPLAYLISTMODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885631)); pub const NS_E_WMPCORE_ITEMNOTINPLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885626)); pub const NS_E_WMPCORE_PLAYLISTEMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885625)); pub const NS_E_WMPCORE_NOBROWSER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885624)); pub const NS_E_WMPCORE_UNRECOGNIZED_MEDIA_URL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885623)); pub const NS_E_WMPCORE_GRAPH_NOT_IN_LIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885622)); pub const NS_E_WMPCORE_PLAYLIST_EMPTY_OR_SINGLE_MEDIA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885621)); pub const NS_E_WMPCORE_ERRORSINKNOTREGISTERED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885620)); pub const NS_E_WMPCORE_ERRORMANAGERNOTAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885619)); pub const NS_E_WMPCORE_WEBHELPFAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885618)); pub const NS_E_WMPCORE_MEDIA_ERROR_RESUME_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885617)); pub const NS_E_WMPCORE_NO_REF_IN_ENTRY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885616)); pub const NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_NAME_EMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885615)); pub const NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_NAME_ILLEGAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885614)); pub const NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_VALUE_EMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885613)); pub const NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_VALUE_ILLEGAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885612)); pub const NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_NAME_EMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885611)); pub const NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_NAME_ILLEGAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885610)); pub const NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_VALUE_EMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885609)); pub const NS_E_WMPCORE_LIST_ENTRY_NO_REF = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885608)); pub const NS_E_WMPCORE_MISNAMED_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885607)); pub const NS_E_WMPCORE_CODEC_NOT_TRUSTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885606)); pub const NS_E_WMPCORE_CODEC_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885605)); pub const NS_E_WMPCORE_CODEC_DOWNLOAD_NOT_ALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885604)); pub const NS_E_WMPCORE_ERROR_DOWNLOADING_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885603)); pub const NS_E_WMPCORE_FAILED_TO_BUILD_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885602)); pub const NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_NONE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885601)); pub const NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_EXHAUSTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885600)); pub const NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_NAME_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885599)); pub const NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_MORPH_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885598)); pub const NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_INIT_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885597)); pub const NS_E_WMPCORE_MEDIA_ALTERNATE_REF_EMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885596)); pub const NS_E_WMPCORE_PLAYLIST_NO_EVENT_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885595)); pub const NS_E_WMPCORE_PLAYLIST_EVENT_ATTRIBUTE_ABSENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885594)); pub const NS_E_WMPCORE_PLAYLIST_EVENT_EMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885593)); pub const NS_E_WMPCORE_PLAYLIST_STACK_EMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885592)); pub const NS_E_WMPCORE_CURRENT_MEDIA_NOT_ACTIVE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885591)); pub const NS_E_WMPCORE_USER_CANCEL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885589)); pub const NS_E_WMPCORE_PLAYLIST_REPEAT_EMPTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885588)); pub const NS_E_WMPCORE_PLAYLIST_REPEAT_START_MEDIA_NONE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885587)); pub const NS_E_WMPCORE_PLAYLIST_REPEAT_END_MEDIA_NONE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885586)); pub const NS_E_WMPCORE_INVALID_PLAYLIST_URL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885585)); pub const NS_E_WMPCORE_MISMATCHED_RUNTIME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885584)); pub const NS_E_WMPCORE_PLAYLIST_IMPORT_FAILED_NO_ITEMS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885583)); pub const NS_E_WMPCORE_VIDEO_TRANSFORM_FILTER_INSERTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885582)); pub const NS_E_WMPCORE_MEDIA_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885581)); pub const NS_E_WMPCORE_WMX_ENTRYREF_NO_REF = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885580)); pub const NS_E_WMPCORE_NO_PLAYABLE_MEDIA_IN_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885579)); pub const NS_E_WMPCORE_PLAYLIST_EMPTY_NESTED_PLAYLIST_SKIPPED_ITEMS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885578)); pub const NS_E_WMPCORE_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885577)); pub const NS_E_WMPCORE_MEDIA_CHILD_PLAYLIST_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885576)); pub const NS_E_WMPCORE_MEDIA_NO_CHILD_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885575)); pub const NS_E_WMPCORE_FILE_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885574)); pub const NS_E_WMPCORE_TEMP_FILE_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885573)); pub const NS_E_WMDM_REVOKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885572)); pub const NS_E_DDRAW_GENERIC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885571)); pub const NS_E_DISPLAY_MODE_CHANGE_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885570)); pub const NS_E_PLAYLIST_CONTAINS_ERRORS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885569)); pub const NS_E_CHANGING_PROXY_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885568)); pub const NS_E_CHANGING_PROXY_PORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885567)); pub const NS_E_CHANGING_PROXY_EXCEPTIONLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885566)); pub const NS_E_CHANGING_PROXYBYPASS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885565)); pub const NS_E_CHANGING_PROXY_PROTOCOL_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885564)); pub const NS_E_GRAPH_NOAUDIOLANGUAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885563)); pub const NS_E_GRAPH_NOAUDIOLANGUAGESELECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885562)); pub const NS_E_CORECD_NOTAMEDIACD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885561)); pub const NS_E_WMPCORE_MEDIA_URL_TOO_LONG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885560)); pub const NS_E_WMPFLASH_CANT_FIND_COM_SERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885559)); pub const NS_E_WMPFLASH_INCOMPATIBLEVERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885558)); pub const NS_E_WMPOCXGRAPH_IE_DISALLOWS_ACTIVEX_CONTROLS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885557)); pub const NS_E_NEED_CORE_REFERENCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885556)); pub const NS_E_MEDIACD_READ_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885555)); pub const NS_E_IE_DISALLOWS_ACTIVEX_CONTROLS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885554)); pub const NS_E_FLASH_PLAYBACK_NOT_ALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885553)); pub const NS_E_UNABLE_TO_CREATE_RIP_LOCATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885552)); pub const NS_E_WMPCORE_SOME_CODECS_MISSING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885551)); pub const NS_E_WMP_RIP_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885550)); pub const NS_E_WMP_FAILED_TO_RIP_TRACK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885549)); pub const NS_E_WMP_ERASE_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885548)); pub const NS_E_WMP_FORMAT_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885547)); pub const NS_E_WMP_CANNOT_BURN_NON_LOCAL_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885546)); pub const NS_E_WMP_FILE_TYPE_CANNOT_BURN_TO_AUDIO_CD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885545)); pub const NS_E_WMP_FILE_DOES_NOT_FIT_ON_CD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885544)); pub const NS_E_WMP_FILE_NO_DURATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885543)); pub const NS_E_PDA_FAILED_TO_BURN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885542)); pub const NS_S_NEED_TO_BUY_BURN_RIGHTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856283)); pub const NS_E_FAILED_DOWNLOAD_ABORT_BURN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885540)); pub const NS_E_WMPCORE_DEVICE_DRIVERS_MISSING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885539)); pub const NS_S_WMPCORE_PLAYLISTCLEARABORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856318)); pub const NS_S_WMPCORE_PLAYLISTREMOVEITEMABORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856319)); pub const NS_S_WMPCORE_PLAYLIST_CREATION_PENDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856322)); pub const NS_S_WMPCORE_MEDIA_VALIDATION_PENDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856323)); pub const NS_S_WMPCORE_PLAYLIST_REPEAT_SECONDARY_SEGMENTS_IGNORED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856324)); pub const NS_S_WMPCORE_COMMAND_NOT_AVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856325)); pub const NS_S_WMPCORE_PLAYLIST_NAME_AUTO_GENERATED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856326)); pub const NS_S_WMPCORE_PLAYLIST_IMPORT_MISSING_ITEMS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856327)); pub const NS_S_WMPCORE_PLAYLIST_COLLAPSED_TO_SINGLE_MEDIA = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856328)); pub const NS_S_WMPCORE_MEDIA_CHILD_PLAYLIST_OPEN_PENDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856329)); pub const NS_S_WMPCORE_MORE_NODES_AVAIABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856330)); pub const NS_E_WMPIM_USEROFFLINE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885466)); pub const NS_E_WMPIM_USERCANCELED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885465)); pub const NS_E_WMPIM_DIALUPFAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885464)); pub const NS_E_WINSOCK_ERROR_STRING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885463)); pub const NS_E_WMPBR_NOLISTENER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885456)); pub const NS_E_WMPBR_BACKUPCANCEL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885455)); pub const NS_E_WMPBR_RESTORECANCEL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885454)); pub const NS_E_WMPBR_ERRORWITHURL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885453)); pub const NS_E_WMPBR_NAMECOLLISION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885452)); pub const NS_S_WMPBR_SUCCESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856373)); pub const NS_S_WMPBR_PARTIALSUCCESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856374)); pub const NS_E_WMPBR_DRIVE_INVALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885449)); pub const NS_E_WMPBR_BACKUPRESTOREFAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885448)); pub const NS_S_WMPEFFECT_TRANSPARENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856388)); pub const NS_S_WMPEFFECT_OPAQUE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856389)); pub const NS_S_OPERATION_PENDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856398)); pub const NS_E_WMP_CONVERT_FILE_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885416)); pub const NS_E_WMP_CONVERT_NO_RIGHTS_ERRORURL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885415)); pub const NS_E_WMP_CONVERT_NO_RIGHTS_NOERRORURL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885414)); pub const NS_E_WMP_CONVERT_FILE_CORRUPT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885413)); pub const NS_E_WMP_CONVERT_PLUGIN_UNAVAILABLE_ERRORURL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885412)); pub const NS_E_WMP_CONVERT_PLUGIN_UNAVAILABLE_NOERRORURL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885411)); pub const NS_E_WMP_CONVERT_PLUGIN_UNKNOWN_FILE_OWNER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885410)); pub const NS_E_DVD_DISC_COPY_PROTECT_OUTPUT_NS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885408)); pub const NS_E_DVD_DISC_COPY_PROTECT_OUTPUT_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885407)); pub const NS_E_DVD_NO_SUBPICTURE_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885406)); pub const NS_E_DVD_COPY_PROTECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885405)); pub const NS_E_DVD_AUTHORING_PROBLEM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885404)); pub const NS_E_DVD_INVALID_DISC_REGION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885403)); pub const NS_E_DVD_COMPATIBLE_VIDEO_CARD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885402)); pub const NS_E_DVD_MACROVISION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885401)); pub const NS_E_DVD_SYSTEM_DECODER_REGION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885400)); pub const NS_E_DVD_DISC_DECODER_REGION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885399)); pub const NS_E_DVD_NO_VIDEO_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885398)); pub const NS_E_DVD_NO_AUDIO_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885397)); pub const NS_E_DVD_GRAPH_BUILDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885396)); pub const NS_E_DVD_NO_DECODER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885395)); pub const NS_E_DVD_PARENTAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885394)); pub const NS_E_DVD_CANNOT_JUMP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885393)); pub const NS_E_DVD_DEVICE_CONTENTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885392)); pub const NS_E_DVD_NO_VIDEO_MEMORY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885391)); pub const NS_E_DVD_CANNOT_COPY_PROTECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885390)); pub const NS_E_DVD_REQUIRED_PROPERTY_NOT_SET = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885389)); pub const NS_E_DVD_INVALID_TITLE_CHAPTER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885388)); pub const NS_E_NO_CD_BURNER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885386)); pub const NS_E_DEVICE_IS_NOT_READY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885385)); pub const NS_E_PDA_UNSUPPORTED_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885384)); pub const NS_E_NO_PDA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885383)); pub const NS_E_PDA_UNSPECIFIED_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885382)); pub const NS_E_MEMSTORAGE_BAD_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885381)); pub const NS_E_PDA_FAIL_SELECT_DEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885380)); pub const NS_E_PDA_FAIL_READ_WAVE_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885379)); pub const NS_E_IMAPI_LOSSOFSTREAMING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885378)); pub const NS_E_PDA_DEVICE_FULL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885377)); pub const NS_E_FAIL_LAUNCH_ROXIO_PLUGIN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885376)); pub const NS_E_PDA_DEVICE_FULL_IN_SESSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885375)); pub const NS_E_IMAPI_MEDIUM_INVALIDTYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885374)); pub const NS_E_PDA_MANUALDEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885373)); pub const NS_E_PDA_PARTNERSHIPNOTEXIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885372)); pub const NS_E_PDA_CANNOT_CREATE_ADDITIONAL_SYNC_RELATIONSHIP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885371)); pub const NS_E_PDA_NO_TRANSCODE_OF_DRM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885370)); pub const NS_E_PDA_TRANSCODECACHEFULL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885369)); pub const NS_E_PDA_TOO_MANY_FILE_COLLISIONS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885368)); pub const NS_E_PDA_CANNOT_TRANSCODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885367)); pub const NS_E_PDA_TOO_MANY_FILES_IN_DIRECTORY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885366)); pub const NS_E_PROCESSINGSHOWSYNCWIZARD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885365)); pub const NS_E_PDA_TRANSCODE_NOT_PERMITTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885364)); pub const NS_E_PDA_INITIALIZINGDEVICES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885363)); pub const NS_E_PDA_OBSOLETE_SP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885362)); pub const NS_E_PDA_TITLE_COLLISION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885361)); pub const NS_E_PDA_DEVICESUPPORTDISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885360)); pub const NS_E_PDA_NO_LONGER_AVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885359)); pub const NS_E_PDA_ENCODER_NOT_RESPONDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885358)); pub const NS_E_PDA_CANNOT_SYNC_FROM_LOCATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885357)); pub const NS_E_WMP_PROTOCOL_PROBLEM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885356)); pub const NS_E_WMP_NO_DISK_SPACE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885355)); pub const NS_E_WMP_LOGON_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885354)); pub const NS_E_WMP_CANNOT_FIND_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885353)); pub const NS_E_WMP_SERVER_INACCESSIBLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885352)); pub const NS_E_WMP_UNSUPPORTED_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885351)); pub const NS_E_WMP_DSHOW_UNSUPPORTED_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885350)); pub const NS_E_WMP_PLAYLIST_EXISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885349)); pub const NS_E_WMP_NONMEDIA_FILES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885348)); pub const NS_E_WMP_INVALID_ASX = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885347)); pub const NS_E_WMP_ALREADY_IN_USE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885346)); pub const NS_E_WMP_IMAPI_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885345)); pub const NS_E_WMP_WMDM_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885344)); pub const NS_E_WMP_CODEC_NEEDED_WITH_4CC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885343)); pub const NS_E_WMP_CODEC_NEEDED_WITH_FORMATTAG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885342)); pub const NS_E_WMP_MSSAP_NOT_AVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885341)); pub const NS_E_WMP_WMDM_INTERFACEDEAD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885340)); pub const NS_E_WMP_WMDM_NOTCERTIFIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885339)); pub const NS_E_WMP_WMDM_LICENSE_NOTEXIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885338)); pub const NS_E_WMP_WMDM_LICENSE_EXPIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885337)); pub const NS_E_WMP_WMDM_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885336)); pub const NS_E_WMP_WMDM_NORIGHTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885335)); pub const NS_E_WMP_WMDM_INCORRECT_RIGHTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885334)); pub const NS_E_WMP_IMAPI_GENERIC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885333)); pub const NS_E_WMP_IMAPI_DEVICE_NOTPRESENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885331)); pub const NS_E_WMP_IMAPI_DEVICE_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885330)); pub const NS_E_WMP_IMAPI_LOSS_OF_STREAMING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885329)); pub const NS_E_WMP_SERVER_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885328)); pub const NS_E_WMP_FILE_OPEN_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885327)); pub const NS_E_WMP_VERIFY_ONLINE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885326)); pub const NS_E_WMP_SERVER_NOT_RESPONDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885325)); pub const NS_E_WMP_DRM_CORRUPT_BACKUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885324)); pub const NS_E_WMP_DRM_LICENSE_SERVER_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885323)); pub const NS_E_WMP_NETWORK_FIREWALL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885322)); pub const NS_E_WMP_NO_REMOVABLE_MEDIA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885321)); pub const NS_E_WMP_PROXY_CONNECT_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885320)); pub const NS_E_WMP_NEED_UPGRADE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885319)); pub const NS_E_WMP_AUDIO_HW_PROBLEM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885318)); pub const NS_E_WMP_INVALID_PROTOCOL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885317)); pub const NS_E_WMP_INVALID_LIBRARY_ADD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885316)); pub const NS_E_WMP_MMS_NOT_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885315)); pub const NS_E_WMP_NO_PROTOCOLS_SELECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885314)); pub const NS_E_WMP_GOFULLSCREEN_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885313)); pub const NS_E_WMP_NETWORK_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885312)); pub const NS_E_WMP_CONNECT_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885311)); pub const NS_E_WMP_MULTICAST_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885310)); pub const NS_E_WMP_SERVER_DNS_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885309)); pub const NS_E_WMP_PROXY_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885308)); pub const NS_E_WMP_TAMPERED_CONTENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885307)); pub const NS_E_WMP_OUTOFMEMORY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885306)); pub const NS_E_WMP_AUDIO_CODEC_NOT_INSTALLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885305)); pub const NS_E_WMP_VIDEO_CODEC_NOT_INSTALLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885304)); pub const NS_E_WMP_IMAPI_DEVICE_INVALIDTYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885303)); pub const NS_E_WMP_DRM_DRIVER_AUTH_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885302)); pub const NS_E_WMP_NETWORK_RESOURCE_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885301)); pub const NS_E_WMP_UPGRADE_APPLICATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885300)); pub const NS_E_WMP_UNKNOWN_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885299)); pub const NS_E_WMP_INVALID_KEY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885298)); pub const NS_E_WMP_CD_ANOTHER_USER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885297)); pub const NS_E_WMP_DRM_NEEDS_AUTHORIZATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885296)); pub const NS_E_WMP_BAD_DRIVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885295)); pub const NS_E_WMP_ACCESS_DENIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885294)); pub const NS_E_WMP_LICENSE_RESTRICTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885293)); pub const NS_E_WMP_INVALID_REQUEST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885292)); pub const NS_E_WMP_CD_STASH_NO_SPACE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885291)); pub const NS_E_WMP_DRM_NEW_HARDWARE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885290)); pub const NS_E_WMP_DRM_INVALID_SIG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885289)); pub const NS_E_WMP_DRM_CANNOT_RESTORE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885288)); pub const NS_E_WMP_BURN_DISC_OVERFLOW = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885287)); pub const NS_E_WMP_DRM_GENERIC_LICENSE_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885286)); pub const NS_E_WMP_DRM_NO_SECURE_CLOCK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885285)); pub const NS_E_WMP_DRM_NO_RIGHTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885284)); pub const NS_E_WMP_DRM_INDIV_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885283)); pub const NS_E_WMP_SERVER_NONEWCONNECTIONS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885282)); pub const NS_E_WMP_MULTIPLE_ERROR_IN_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885281)); pub const NS_E_WMP_IMAPI2_ERASE_FAIL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885280)); pub const NS_E_WMP_IMAPI2_ERASE_DEVICE_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885279)); pub const NS_E_WMP_DRM_COMPONENT_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885278)); pub const NS_E_WMP_DRM_NO_DEVICE_CERT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885277)); pub const NS_E_WMP_SERVER_SECURITY_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885276)); pub const NS_E_WMP_AUDIO_DEVICE_LOST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885275)); pub const NS_E_WMP_IMAPI_MEDIA_INCOMPATIBLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885274)); pub const NS_E_SYNCWIZ_DEVICE_FULL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885266)); pub const NS_E_SYNCWIZ_CANNOT_CHANGE_SETTINGS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885265)); pub const NS_E_TRANSCODE_DELETECACHEERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885264)); pub const NS_E_CD_NO_BUFFERS_READ = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885256)); pub const NS_E_CD_EMPTY_TRACK_QUEUE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885255)); pub const NS_E_CD_NO_READER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885254)); pub const NS_E_CD_ISRC_INVALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885253)); pub const NS_E_CD_MEDIA_CATALOG_NUMBER_INVALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885252)); pub const NS_E_SLOW_READ_DIGITAL_WITH_ERRORCORRECTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885251)); pub const NS_E_CD_SPEEDDETECT_NOT_ENOUGH_READS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885250)); pub const NS_E_CD_QUEUEING_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885249)); pub const NS_E_WMP_DRM_ACQUIRING_LICENSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885246)); pub const NS_E_WMP_DRM_LICENSE_EXPIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885245)); pub const NS_E_WMP_DRM_LICENSE_NOTACQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885244)); pub const NS_E_WMP_DRM_LICENSE_NOTENABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885243)); pub const NS_E_WMP_DRM_LICENSE_UNUSABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885242)); pub const NS_E_WMP_DRM_LICENSE_CONTENT_REVOKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885241)); pub const NS_E_WMP_DRM_LICENSE_NOSAP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885240)); pub const NS_E_WMP_DRM_UNABLE_TO_ACQUIRE_LICENSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885239)); pub const NS_E_WMP_LICENSE_REQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885238)); pub const NS_E_WMP_PROTECTED_CONTENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885237)); pub const NS_E_WMP_POLICY_VALUE_NOT_CONFIGURED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885206)); pub const NS_E_PDA_CANNOT_SYNC_FROM_INTERNET = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885196)); pub const NS_E_PDA_CANNOT_SYNC_INVALID_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885195)); pub const NS_E_PDA_FAILED_TO_SYNCHRONIZE_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885194)); pub const NS_E_PDA_SYNC_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885193)); pub const NS_E_PDA_DELETE_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885192)); pub const NS_E_PDA_FAILED_TO_RETRIEVE_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885191)); pub const NS_E_PDA_DEVICE_NOT_RESPONDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885190)); pub const NS_E_PDA_FAILED_TO_TRANSCODE_PHOTO = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885189)); pub const NS_E_PDA_FAILED_TO_ENCRYPT_TRANSCODED_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885188)); pub const NS_E_PDA_CANNOT_TRANSCODE_TO_AUDIO = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885187)); pub const NS_E_PDA_CANNOT_TRANSCODE_TO_VIDEO = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885186)); pub const NS_E_PDA_CANNOT_TRANSCODE_TO_IMAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885185)); pub const NS_E_PDA_RETRIEVED_FILE_FILENAME_TOO_LONG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885184)); pub const NS_E_PDA_CEWMDM_DRM_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885183)); pub const NS_E_INCOMPLETE_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885182)); pub const NS_E_PDA_SYNC_RUNNING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885181)); pub const NS_E_PDA_SYNC_LOGIN_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885180)); pub const NS_E_PDA_TRANSCODE_CODEC_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885179)); pub const NS_E_CANNOT_SYNC_DRM_TO_NON_JANUS_DEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885178)); pub const NS_E_CANNOT_SYNC_PREVIOUS_SYNC_RUNNING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885177)); pub const NS_E_WMP_HWND_NOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885156)); pub const NS_E_BKGDOWNLOAD_WRONG_NO_FILES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885155)); pub const NS_E_BKGDOWNLOAD_COMPLETECANCELLEDJOB = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885154)); pub const NS_E_BKGDOWNLOAD_CANCELCOMPLETEDJOB = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885153)); pub const NS_E_BKGDOWNLOAD_NOJOBPOINTER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885152)); pub const NS_E_BKGDOWNLOAD_INVALIDJOBSIGNATURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885151)); pub const NS_E_BKGDOWNLOAD_FAILED_TO_CREATE_TEMPFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885150)); pub const NS_E_BKGDOWNLOAD_PLUGIN_FAILEDINITIALIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885149)); pub const NS_E_BKGDOWNLOAD_PLUGIN_FAILEDTOMOVEFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885148)); pub const NS_E_BKGDOWNLOAD_CALLFUNCFAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885147)); pub const NS_E_BKGDOWNLOAD_CALLFUNCTIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885146)); pub const NS_E_BKGDOWNLOAD_CALLFUNCENDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885145)); pub const NS_E_BKGDOWNLOAD_WMDUNPACKFAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885144)); pub const NS_E_BKGDOWNLOAD_FAILEDINITIALIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885143)); pub const NS_E_INTERFACE_NOT_REGISTERED_IN_GIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885142)); pub const NS_E_BKGDOWNLOAD_INVALID_FILE_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885141)); pub const NS_E_IMAGE_DOWNLOAD_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885106)); pub const NS_E_WMP_UDRM_NOUSERLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885056)); pub const NS_E_WMP_DRM_NOT_ACQUIRING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885055)); pub const NS_E_WMP_BSTR_TOO_LONG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072885006)); pub const NS_E_WMP_AUTOPLAY_INVALID_STATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884996)); pub const NS_E_WMP_COMPONENT_REVOKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884986)); pub const NS_E_CURL_NOTSAFE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884956)); pub const NS_E_CURL_INVALIDCHAR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884955)); pub const NS_E_CURL_INVALIDHOSTNAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884954)); pub const NS_E_CURL_INVALIDPATH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884953)); pub const NS_E_CURL_INVALIDSCHEME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884952)); pub const NS_E_CURL_INVALIDURL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884951)); pub const NS_E_CURL_CANTWALK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884949)); pub const NS_E_CURL_INVALIDPORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884948)); pub const NS_E_CURLHELPER_NOTADIRECTORY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884947)); pub const NS_E_CURLHELPER_NOTAFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884946)); pub const NS_E_CURL_CANTDECODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884945)); pub const NS_E_CURLHELPER_NOTRELATIVE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884944)); pub const NS_E_CURL_INVALIDBUFFERSIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884943)); pub const NS_E_SUBSCRIPTIONSERVICE_PLAYBACK_DISALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884906)); pub const NS_E_CANNOT_BUY_OR_DOWNLOAD_FROM_MULTIPLE_SERVICES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884905)); pub const NS_E_CANNOT_BUY_OR_DOWNLOAD_CONTENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884904)); pub const NS_S_TRACK_BUY_REQUIRES_ALBUM_PURCHASE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856921)); pub const NS_E_NOT_CONTENT_PARTNER_TRACK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884902)); pub const NS_E_TRACK_DOWNLOAD_REQUIRES_ALBUM_PURCHASE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884901)); pub const NS_E_TRACK_DOWNLOAD_REQUIRES_PURCHASE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884900)); pub const NS_E_TRACK_PURCHASE_MAXIMUM_EXCEEDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884899)); pub const NS_S_NAVIGATION_COMPLETE_WITH_ERRORS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856926)); pub const NS_E_SUBSCRIPTIONSERVICE_LOGIN_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884897)); pub const NS_E_SUBSCRIPTIONSERVICE_DOWNLOAD_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884896)); pub const NS_S_TRACK_ALREADY_DOWNLOADED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 856929)); pub const NS_E_CONTENT_PARTNER_STILL_INITIALIZING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884894)); pub const NS_E_OPEN_CONTAINING_FOLDER_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884893)); pub const NS_E_ADVANCEDEDIT_TOO_MANY_PICTURES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884886)); pub const NS_E_REDIRECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884856)); pub const NS_E_STALE_PRESENTATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884855)); pub const NS_E_NAMESPACE_WRONG_PERSIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884854)); pub const NS_E_NAMESPACE_WRONG_TYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884853)); pub const NS_E_NAMESPACE_NODE_CONFLICT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884852)); pub const NS_E_NAMESPACE_NODE_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884851)); pub const NS_E_NAMESPACE_BUFFER_TOO_SMALL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884850)); pub const NS_E_NAMESPACE_TOO_MANY_CALLBACKS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884849)); pub const NS_E_NAMESPACE_DUPLICATE_CALLBACK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884848)); pub const NS_E_NAMESPACE_CALLBACK_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884847)); pub const NS_E_NAMESPACE_NAME_TOO_LONG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884846)); pub const NS_E_NAMESPACE_DUPLICATE_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884845)); pub const NS_E_NAMESPACE_EMPTY_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884844)); pub const NS_E_NAMESPACE_INDEX_TOO_LARGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884843)); pub const NS_E_NAMESPACE_BAD_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884842)); pub const NS_E_NAMESPACE_WRONG_SECURITY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884841)); pub const NS_E_CACHE_ARCHIVE_CONFLICT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884756)); pub const NS_E_CACHE_ORIGIN_SERVER_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884755)); pub const NS_E_CACHE_ORIGIN_SERVER_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884754)); pub const NS_E_CACHE_NOT_BROADCAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884753)); pub const NS_E_CACHE_CANNOT_BE_CACHED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884752)); pub const NS_E_CACHE_NOT_MODIFIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884751)); pub const NS_E_CANNOT_REMOVE_PUBLISHING_POINT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884656)); pub const NS_E_CANNOT_REMOVE_PLUGIN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884655)); pub const NS_E_WRONG_PUBLISHING_POINT_TYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884654)); pub const NS_E_UNSUPPORTED_LOAD_TYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884653)); pub const NS_E_INVALID_PLUGIN_LOAD_TYPE_CONFIGURATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884652)); pub const NS_E_INVALID_PUBLISHING_POINT_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884651)); pub const NS_E_TOO_MANY_MULTICAST_SINKS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884650)); pub const NS_E_PUBLISHING_POINT_INVALID_REQUEST_WHILE_STARTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884649)); pub const NS_E_MULTICAST_PLUGIN_NOT_ENABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884648)); pub const NS_E_INVALID_OPERATING_SYSTEM_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884647)); pub const NS_E_PUBLISHING_POINT_REMOVED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884646)); pub const NS_E_INVALID_PUSH_PUBLISHING_POINT_START_REQUEST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884645)); pub const NS_E_UNSUPPORTED_LANGUAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884644)); pub const NS_E_WRONG_OS_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884643)); pub const NS_E_PUBLISHING_POINT_STOPPED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884642)); pub const NS_E_PLAYLIST_ENTRY_ALREADY_PLAYING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884556)); pub const NS_E_EMPTY_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884555)); pub const NS_E_PLAYLIST_PARSE_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884554)); pub const NS_E_PLAYLIST_UNSUPPORTED_ENTRY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884553)); pub const NS_E_PLAYLIST_ENTRY_NOT_IN_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884552)); pub const NS_E_PLAYLIST_ENTRY_SEEK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884551)); pub const NS_E_PLAYLIST_RECURSIVE_PLAYLISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884550)); pub const NS_E_PLAYLIST_TOO_MANY_NESTED_PLAYLISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884549)); pub const NS_E_PLAYLIST_SHUTDOWN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884548)); pub const NS_E_PLAYLIST_END_RECEDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884547)); pub const NS_I_PLAYLIST_CHANGE_RECEDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074599102)); pub const NS_E_DATAPATH_NO_SINK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884456)); pub const NS_S_PUBLISHING_POINT_STARTED_WITH_FAILED_SINKS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 857369)); pub const NS_E_INVALID_PUSH_TEMPLATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884454)); pub const NS_E_INVALID_PUSH_PUBLISHING_POINT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884453)); pub const NS_E_CRITICAL_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884452)); pub const NS_E_NO_NEW_CONNECTIONS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884451)); pub const NS_E_WSX_INVALID_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884450)); pub const NS_E_HEADER_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884449)); pub const NS_E_PUSH_DUPLICATE_PUBLISHING_POINT_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884448)); pub const NS_E_NO_SCRIPT_ENGINE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884356)); pub const NS_E_PLUGIN_ERROR_REPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884355)); pub const NS_E_SOURCE_PLUGIN_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884354)); pub const NS_E_PLAYLIST_PLUGIN_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884353)); pub const NS_E_DATA_SOURCE_ENUMERATION_NOT_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884352)); pub const NS_E_MEDIA_PARSER_INVALID_FORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884351)); pub const NS_E_SCRIPT_DEBUGGER_NOT_INSTALLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884350)); pub const NS_E_FEATURE_REQUIRES_ENTERPRISE_SERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884349)); pub const NS_E_WIZARD_RUNNING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884348)); pub const NS_E_INVALID_LOG_URL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884347)); pub const NS_E_INVALID_MTU_RANGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884346)); pub const NS_E_INVALID_PLAY_STATISTICS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884345)); pub const NS_E_LOG_NEED_TO_BE_SKIPPED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884344)); pub const NS_E_HTTP_TEXT_DATACONTAINER_SIZE_LIMIT_EXCEEDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884343)); pub const NS_E_PORT_IN_USE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884342)); pub const NS_E_PORT_IN_USE_HTTP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884341)); pub const NS_E_HTTP_TEXT_DATACONTAINER_INVALID_SERVER_RESPONSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884340)); pub const NS_E_ARCHIVE_REACH_QUOTA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884339)); pub const NS_E_ARCHIVE_ABORT_DUE_TO_BCAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884338)); pub const NS_E_ARCHIVE_GAP_DETECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884337)); pub const NS_E_AUTHORIZATION_FILE_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072884336)); pub const NS_E_BAD_MARKIN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882856)); pub const NS_E_BAD_MARKOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882855)); pub const NS_E_NOMATCHING_MEDIASOURCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882854)); pub const NS_E_UNSUPPORTED_SOURCETYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882853)); pub const NS_E_TOO_MANY_AUDIO = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882852)); pub const NS_E_TOO_MANY_VIDEO = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882851)); pub const NS_E_NOMATCHING_ELEMENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882850)); pub const NS_E_MISMATCHED_MEDIACONTENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882849)); pub const NS_E_CANNOT_DELETE_ACTIVE_SOURCEGROUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882848)); pub const NS_E_AUDIODEVICE_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882847)); pub const NS_E_AUDIODEVICE_UNEXPECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882846)); pub const NS_E_AUDIODEVICE_BADFORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882845)); pub const NS_E_VIDEODEVICE_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882844)); pub const NS_E_VIDEODEVICE_UNEXPECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882843)); pub const NS_E_INVALIDCALL_WHILE_ENCODER_RUNNING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882842)); pub const NS_E_NO_PROFILE_IN_SOURCEGROUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882841)); pub const NS_E_VIDEODRIVER_UNSTABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882840)); pub const NS_E_VIDCAPSTARTFAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882839)); pub const NS_E_VIDSOURCECOMPRESSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882838)); pub const NS_E_VIDSOURCESIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882837)); pub const NS_E_ICMQUERYFORMAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882836)); pub const NS_E_VIDCAPCREATEWINDOW = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882835)); pub const NS_E_VIDCAPDRVINUSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882834)); pub const NS_E_NO_MEDIAFORMAT_IN_SOURCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882833)); pub const NS_E_NO_VALID_OUTPUT_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882832)); pub const NS_E_NO_VALID_SOURCE_PLUGIN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882831)); pub const NS_E_NO_ACTIVE_SOURCEGROUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882830)); pub const NS_E_NO_SCRIPT_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882829)); pub const NS_E_INVALIDCALL_WHILE_ARCHIVAL_RUNNING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882828)); pub const NS_E_INVALIDPACKETSIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882827)); pub const NS_E_PLUGIN_CLSID_INVALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882826)); pub const NS_E_UNSUPPORTED_ARCHIVETYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882825)); pub const NS_E_UNSUPPORTED_ARCHIVEOPERATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882824)); pub const NS_E_ARCHIVE_FILENAME_NOTSET = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882823)); pub const NS_E_SOURCEGROUP_NOTPREPARED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882822)); pub const NS_E_PROFILE_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882821)); pub const NS_E_INCORRECTCLIPSETTINGS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882820)); pub const NS_E_NOSTATSAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882819)); pub const NS_E_NOTARCHIVING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882818)); pub const NS_E_INVALIDCALL_WHILE_ENCODER_STOPPED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882817)); pub const NS_E_NOSOURCEGROUPS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882816)); pub const NS_E_INVALIDINPUTFPS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882815)); pub const NS_E_NO_DATAVIEW_SUPPORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882814)); pub const NS_E_CODEC_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882813)); pub const NS_E_ARCHIVE_SAME_AS_INPUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882812)); pub const NS_E_SOURCE_NOTSPECIFIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882811)); pub const NS_E_NO_REALTIME_TIMECOMPRESSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882810)); pub const NS_E_UNSUPPORTED_ENCODER_DEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882809)); pub const NS_E_UNEXPECTED_DISPLAY_SETTINGS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882808)); pub const NS_E_NO_AUDIODATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882807)); pub const NS_E_INPUTSOURCE_PROBLEM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882806)); pub const NS_E_WME_VERSION_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882805)); pub const NS_E_NO_REALTIME_PREPROCESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882804)); pub const NS_E_NO_REPEAT_PREPROCESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882803)); pub const NS_E_CANNOT_PAUSE_LIVEBROADCAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882802)); pub const NS_E_DRM_PROFILE_NOT_SET = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882801)); pub const NS_E_DUPLICATE_DRMPROFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882800)); pub const NS_E_INVALID_DEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882799)); pub const NS_E_SPEECHEDL_ON_NON_MIXEDMODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882798)); pub const NS_E_DRM_PASSWORD_TOO_LONG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882797)); pub const NS_E_DEVCONTROL_FAILED_SEEK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882796)); pub const NS_E_INTERLACE_REQUIRE_SAMESIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882795)); pub const NS_E_TOO_MANY_DEVICECONTROL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882794)); pub const NS_E_NO_MULTIPASS_FOR_LIVEDEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882793)); pub const NS_E_MISSING_AUDIENCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882792)); pub const NS_E_AUDIENCE_CONTENTTYPE_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882791)); pub const NS_E_MISSING_SOURCE_INDEX = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882790)); pub const NS_E_NUM_LANGUAGE_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882789)); pub const NS_E_LANGUAGE_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882788)); pub const NS_E_VBRMODE_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882787)); pub const NS_E_INVALID_INPUT_AUDIENCE_INDEX = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882786)); pub const NS_E_INVALID_INPUT_LANGUAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882785)); pub const NS_E_INVALID_INPUT_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882784)); pub const NS_E_EXPECT_MONO_WAV_INPUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882783)); pub const NS_E_INPUT_WAVFORMAT_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882782)); pub const NS_E_RECORDQ_DISK_FULL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882781)); pub const NS_E_NO_PAL_INVERSE_TELECINE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882780)); pub const NS_E_ACTIVE_SG_DEVICE_DISCONNECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882779)); pub const NS_E_ACTIVE_SG_DEVICE_CONTROL_DISCONNECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882778)); pub const NS_E_NO_FRAMES_SUBMITTED_TO_ANALYZER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882777)); pub const NS_E_INPUT_DOESNOT_SUPPORT_SMPTE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882776)); pub const NS_E_NO_SMPTE_WITH_MULTIPLE_SOURCEGROUPS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882775)); pub const NS_E_BAD_CONTENTEDL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882774)); pub const NS_E_INTERLACEMODE_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882773)); pub const NS_E_NONSQUAREPIXELMODE_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882772)); pub const NS_E_SMPTEMODE_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882771)); pub const NS_E_END_OF_TAPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882770)); pub const NS_E_NO_MEDIA_IN_AUDIENCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882769)); pub const NS_E_NO_AUDIENCES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882768)); pub const NS_E_NO_AUDIO_COMPAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882767)); pub const NS_E_INVALID_VBR_COMPAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882766)); pub const NS_E_NO_PROFILE_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882765)); pub const NS_E_INVALID_VBR_WITH_UNCOMP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882764)); pub const NS_E_MULTIPLE_VBR_AUDIENCES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882763)); pub const NS_E_UNCOMP_COMP_COMBINATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882762)); pub const NS_E_MULTIPLE_AUDIO_CODECS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882761)); pub const NS_E_MULTIPLE_AUDIO_FORMATS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882760)); pub const NS_E_AUDIO_BITRATE_STEPDOWN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882759)); pub const NS_E_INVALID_AUDIO_PEAKRATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882758)); pub const NS_E_INVALID_AUDIO_PEAKRATE_2 = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882757)); pub const NS_E_INVALID_AUDIO_BUFFERMAX = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882756)); pub const NS_E_MULTIPLE_VIDEO_CODECS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882755)); pub const NS_E_MULTIPLE_VIDEO_SIZES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882754)); pub const NS_E_INVALID_VIDEO_BITRATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882753)); pub const NS_E_VIDEO_BITRATE_STEPDOWN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882752)); pub const NS_E_INVALID_VIDEO_PEAKRATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882751)); pub const NS_E_INVALID_VIDEO_PEAKRATE_2 = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882750)); pub const NS_E_INVALID_VIDEO_WIDTH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882749)); pub const NS_E_INVALID_VIDEO_HEIGHT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882748)); pub const NS_E_INVALID_VIDEO_FPS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882747)); pub const NS_E_INVALID_VIDEO_KEYFRAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882746)); pub const NS_E_INVALID_VIDEO_IQUALITY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882745)); pub const NS_E_INVALID_VIDEO_CQUALITY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882744)); pub const NS_E_INVALID_VIDEO_BUFFER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882743)); pub const NS_E_INVALID_VIDEO_BUFFERMAX = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882742)); pub const NS_E_INVALID_VIDEO_BUFFERMAX_2 = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882741)); pub const NS_E_INVALID_VIDEO_WIDTH_ALIGN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882740)); pub const NS_E_INVALID_VIDEO_HEIGHT_ALIGN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882739)); pub const NS_E_MULTIPLE_SCRIPT_BITRATES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882738)); pub const NS_E_INVALID_SCRIPT_BITRATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882737)); pub const NS_E_MULTIPLE_FILE_BITRATES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882736)); pub const NS_E_INVALID_FILE_BITRATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882735)); pub const NS_E_SAME_AS_INPUT_COMBINATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882734)); pub const NS_E_SOURCE_CANNOT_LOOP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882733)); pub const NS_E_INVALID_FOLDDOWN_COEFFICIENTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882732)); pub const NS_E_DRMPROFILE_NOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882731)); pub const NS_E_INVALID_TIMECODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882730)); pub const NS_E_NO_AUDIO_TIMECOMPRESSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882729)); pub const NS_E_NO_TWOPASS_TIMECOMPRESSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882728)); pub const NS_E_TIMECODE_REQUIRES_VIDEOSTREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882727)); pub const NS_E_NO_MBR_WITH_TIMECODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882726)); pub const NS_E_INVALID_INTERLACEMODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882725)); pub const NS_E_INVALID_INTERLACE_COMPAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882724)); pub const NS_E_INVALID_NONSQUAREPIXEL_COMPAT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882723)); pub const NS_E_INVALID_SOURCE_WITH_DEVICE_CONTROL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882722)); pub const NS_E_CANNOT_GENERATE_BROADCAST_INFO_FOR_QUALITYVBR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882721)); pub const NS_E_EXCEED_MAX_DRM_PROFILE_LIMIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882720)); pub const NS_E_DEVICECONTROL_UNSTABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882719)); pub const NS_E_INVALID_PIXEL_ASPECT_RATIO = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882718)); pub const NS_E_AUDIENCE__LANGUAGE_CONTENTTYPE_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882717)); pub const NS_E_INVALID_PROFILE_CONTENTTYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882716)); pub const NS_E_TRANSFORM_PLUGIN_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882715)); pub const NS_E_TRANSFORM_PLUGIN_INVALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882714)); pub const NS_E_EDL_REQUIRED_FOR_DEVICE_MULTIPASS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882713)); pub const NS_E_INVALID_VIDEO_WIDTH_FOR_INTERLACED_ENCODING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882712)); pub const NS_E_MARKIN_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072882711)); pub const NS_E_DRM_INVALID_APPLICATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879855)); pub const NS_E_DRM_LICENSE_STORE_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879854)); pub const NS_E_DRM_SECURE_STORE_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879853)); pub const NS_E_DRM_LICENSE_STORE_SAVE_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879852)); pub const NS_E_DRM_SECURE_STORE_UNLOCK_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879851)); pub const NS_E_DRM_INVALID_CONTENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879850)); pub const NS_E_DRM_UNABLE_TO_OPEN_LICENSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879849)); pub const NS_E_DRM_INVALID_LICENSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879848)); pub const NS_E_DRM_INVALID_MACHINE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879847)); pub const NS_E_DRM_ENUM_LICENSE_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879845)); pub const NS_E_DRM_INVALID_LICENSE_REQUEST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879844)); pub const NS_E_DRM_UNABLE_TO_INITIALIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879843)); pub const NS_E_DRM_UNABLE_TO_ACQUIRE_LICENSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879842)); pub const NS_E_DRM_INVALID_LICENSE_ACQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879841)); pub const NS_E_DRM_NO_RIGHTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879840)); pub const NS_E_DRM_KEY_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879839)); pub const NS_E_DRM_ENCRYPT_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879838)); pub const NS_E_DRM_DECRYPT_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879837)); pub const NS_E_DRM_LICENSE_INVALID_XML = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879835)); pub const NS_S_DRM_LICENSE_ACQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 861990)); pub const NS_S_DRM_INDIVIDUALIZED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 861991)); pub const NS_E_DRM_NEEDS_INDIVIDUALIZATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879832)); pub const NS_E_DRM_ALREADY_INDIVIDUALIZED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879831)); pub const NS_E_DRM_ACTION_NOT_QUERIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879830)); pub const NS_E_DRM_ACQUIRING_LICENSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879829)); pub const NS_E_DRM_INDIVIDUALIZING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879828)); pub const NS_E_BACKUP_RESTORE_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879827)); pub const NS_E_BACKUP_RESTORE_BAD_REQUEST_ID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879826)); pub const NS_E_DRM_PARAMETERS_MISMATCHED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879825)); pub const NS_E_DRM_UNABLE_TO_CREATE_LICENSE_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879824)); pub const NS_E_DRM_UNABLE_TO_CREATE_INDI_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879823)); pub const NS_E_DRM_UNABLE_TO_CREATE_ENCRYPT_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879822)); pub const NS_E_DRM_UNABLE_TO_CREATE_DECRYPT_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879821)); pub const NS_E_DRM_UNABLE_TO_CREATE_PROPERTIES_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879820)); pub const NS_E_DRM_UNABLE_TO_CREATE_BACKUP_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879819)); pub const NS_E_DRM_INDIVIDUALIZE_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879818)); pub const NS_E_DRM_LICENSE_OPEN_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879817)); pub const NS_E_DRM_LICENSE_CLOSE_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879816)); pub const NS_E_DRM_GET_LICENSE_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879815)); pub const NS_E_DRM_QUERY_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879814)); pub const NS_E_DRM_REPORT_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879813)); pub const NS_E_DRM_GET_LICENSESTRING_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879812)); pub const NS_E_DRM_GET_CONTENTSTRING_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879811)); pub const NS_E_DRM_MONITOR_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879810)); pub const NS_E_DRM_UNABLE_TO_SET_PARAMETER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879809)); pub const NS_E_DRM_INVALID_APPDATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879808)); pub const NS_E_DRM_INVALID_APPDATA_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879807)); pub const NS_E_DRM_BACKUP_EXISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879806)); pub const NS_E_DRM_BACKUP_CORRUPT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879805)); pub const NS_E_DRM_BACKUPRESTORE_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879804)); pub const NS_E_BACKUP_RESTORE_BAD_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879803)); pub const NS_S_DRM_MONITOR_CANCELLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 862022)); pub const NS_S_DRM_ACQUIRE_CANCELLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 862023)); pub const NS_E_DRM_LICENSE_UNUSABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879800)); pub const NS_E_DRM_INVALID_PROPERTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879799)); pub const NS_E_DRM_SECURE_STORE_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879798)); pub const NS_E_DRM_CACHED_CONTENT_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879797)); pub const NS_E_DRM_INDIVIDUALIZATION_INCOMPLETE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879796)); pub const NS_E_DRM_DRIVER_AUTH_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879795)); pub const NS_E_DRM_NEED_UPGRADE_MSSAP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879794)); pub const NS_E_DRM_REOPEN_CONTENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879793)); pub const NS_E_DRM_DRIVER_DIGIOUT_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879792)); pub const NS_E_DRM_INVALID_SECURESTORE_PASSWORD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879791)); pub const NS_E_DRM_APPCERT_REVOKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879790)); pub const NS_E_DRM_RESTORE_FRAUD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879789)); pub const NS_E_DRM_HARDWARE_INCONSISTENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879788)); pub const NS_E_DRM_SDMI_TRIGGER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879787)); pub const NS_E_DRM_SDMI_NOMORECOPIES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879786)); pub const NS_E_DRM_UNABLE_TO_CREATE_HEADER_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879785)); pub const NS_E_DRM_UNABLE_TO_CREATE_KEYS_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879784)); pub const NS_E_DRM_LICENSE_NOTACQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879783)); pub const NS_E_DRM_UNABLE_TO_CREATE_CODING_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879782)); pub const NS_E_DRM_UNABLE_TO_CREATE_STATE_DATA_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879781)); pub const NS_E_DRM_BUFFER_TOO_SMALL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879780)); pub const NS_E_DRM_UNSUPPORTED_PROPERTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879779)); pub const NS_E_DRM_ERROR_BAD_NET_RESP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879778)); pub const NS_E_DRM_STORE_NOTALLSTORED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879777)); pub const NS_E_DRM_SECURITY_COMPONENT_SIGNATURE_INVALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879776)); pub const NS_E_DRM_INVALID_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879775)); pub const NS_E_DRM_POLICY_DISABLE_ONLINE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879774)); pub const NS_E_DRM_UNABLE_TO_CREATE_AUTHENTICATION_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879773)); pub const NS_E_DRM_NOT_CONFIGURED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879772)); pub const NS_E_DRM_DEVICE_ACTIVATION_CANCELED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879771)); pub const NS_E_BACKUP_RESTORE_TOO_MANY_RESETS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879770)); pub const NS_E_DRM_DEBUGGING_NOT_ALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879769)); pub const NS_E_DRM_OPERATION_CANCELED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879768)); pub const NS_E_DRM_RESTRICTIONS_NOT_RETRIEVED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879767)); pub const NS_E_DRM_UNABLE_TO_CREATE_PLAYLIST_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879766)); pub const NS_E_DRM_UNABLE_TO_CREATE_PLAYLIST_BURN_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879765)); pub const NS_E_DRM_UNABLE_TO_CREATE_DEVICE_REGISTRATION_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879764)); pub const NS_E_DRM_UNABLE_TO_CREATE_METERING_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879763)); pub const NS_S_DRM_BURNABLE_TRACK = @import("../zig.zig").typedConst(HRESULT, @as(i32, 862062)); pub const NS_S_DRM_BURNABLE_TRACK_WITH_PLAYLIST_RESTRICTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, 862063)); pub const NS_E_DRM_TRACK_EXCEEDED_PLAYLIST_RESTICTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879760)); pub const NS_E_DRM_TRACK_EXCEEDED_TRACKBURN_RESTRICTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879759)); pub const NS_E_DRM_UNABLE_TO_GET_DEVICE_CERT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879758)); pub const NS_E_DRM_UNABLE_TO_GET_SECURE_CLOCK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879757)); pub const NS_E_DRM_UNABLE_TO_SET_SECURE_CLOCK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879756)); pub const NS_E_DRM_UNABLE_TO_GET_SECURE_CLOCK_FROM_SERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879755)); pub const NS_E_DRM_POLICY_METERING_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879754)); pub const NS_E_DRM_TRANSFER_CHAINED_LICENSES_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879753)); pub const NS_E_DRM_SDK_VERSIONMISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879752)); pub const NS_E_DRM_LIC_NEEDS_DEVICE_CLOCK_SET = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879751)); pub const NS_E_LICENSE_HEADER_MISSING_URL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879750)); pub const NS_E_DEVICE_NOT_WMDRM_DEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879749)); pub const NS_E_DRM_INVALID_APPCERT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879748)); pub const NS_E_DRM_PROTOCOL_FORCEFUL_TERMINATION_ON_PETITION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879747)); pub const NS_E_DRM_PROTOCOL_FORCEFUL_TERMINATION_ON_CHALLENGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879746)); pub const NS_E_DRM_CHECKPOINT_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879745)); pub const NS_E_DRM_BB_UNABLE_TO_INITIALIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879744)); pub const NS_E_DRM_UNABLE_TO_LOAD_HARDWARE_ID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879743)); pub const NS_E_DRM_UNABLE_TO_OPEN_DATA_STORE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879742)); pub const NS_E_DRM_DATASTORE_CORRUPT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879741)); pub const NS_E_DRM_UNABLE_TO_CREATE_INMEMORYSTORE_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879740)); pub const NS_E_DRM_STUBLIB_REQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879739)); pub const NS_E_DRM_UNABLE_TO_CREATE_CERTIFICATE_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879738)); pub const NS_E_DRM_MIGRATION_TARGET_NOT_ONLINE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879737)); pub const NS_E_DRM_INVALID_MIGRATION_IMAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879736)); pub const NS_E_DRM_MIGRATION_TARGET_STATES_CORRUPTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879735)); pub const NS_E_DRM_MIGRATION_IMPORTER_NOT_AVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879734)); pub const NS_DRM_E_MIGRATION_UPGRADE_WITH_DIFF_SID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879733)); pub const NS_DRM_E_MIGRATION_SOURCE_MACHINE_IN_USE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879732)); pub const NS_DRM_E_MIGRATION_TARGET_MACHINE_LESS_THAN_LH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879731)); pub const NS_DRM_E_MIGRATION_IMAGE_ALREADY_EXISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879730)); pub const NS_E_DRM_HARDWAREID_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879729)); pub const NS_E_INVALID_DRMV2CLT_STUBLIB = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879728)); pub const NS_E_DRM_MIGRATION_INVALID_LEGACYV2_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879727)); pub const NS_E_DRM_MIGRATION_LICENSE_ALREADY_EXISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879726)); pub const NS_E_DRM_MIGRATION_INVALID_LEGACYV2_SST_PASSWORD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879725)); pub const NS_E_DRM_MIGRATION_NOT_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879724)); pub const NS_E_DRM_UNABLE_TO_CREATE_MIGRATION_IMPORTER_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879723)); pub const NS_E_DRM_CHECKPOINT_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879722)); pub const NS_E_DRM_CHECKPOINT_CORRUPT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879721)); pub const NS_E_REG_FLUSH_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879720)); pub const NS_E_HDS_KEY_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879719)); pub const NS_E_DRM_MIGRATION_OPERATION_CANCELLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879718)); pub const NS_E_DRM_MIGRATION_OBJECT_IN_USE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879717)); pub const NS_E_DRM_MALFORMED_CONTENT_HEADER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879716)); pub const NS_E_DRM_LICENSE_EXPIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879656)); pub const NS_E_DRM_LICENSE_NOTENABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879655)); pub const NS_E_DRM_LICENSE_APPSECLOW = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879654)); pub const NS_E_DRM_STORE_NEEDINDI = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879653)); pub const NS_E_DRM_STORE_NOTALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879652)); pub const NS_E_DRM_LICENSE_APP_NOTALLOWED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879651)); pub const NS_S_DRM_NEEDS_INDIVIDUALIZATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, 862174)); pub const NS_E_DRM_LICENSE_CERT_EXPIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879649)); pub const NS_E_DRM_LICENSE_SECLOW = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879648)); pub const NS_E_DRM_LICENSE_CONTENT_REVOKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879647)); pub const NS_E_DRM_DEVICE_NOT_REGISTERED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879646)); pub const NS_E_DRM_LICENSE_NOSAP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879606)); pub const NS_E_DRM_LICENSE_NOSVP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879605)); pub const NS_E_DRM_LICENSE_NOWDM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879604)); pub const NS_E_DRM_LICENSE_NOTRUSTEDCODEC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879603)); pub const NS_E_DRM_SOURCEID_NOT_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879602)); pub const NS_E_DRM_NEEDS_UPGRADE_TEMPFILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879555)); pub const NS_E_DRM_NEED_UPGRADE_PD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879554)); pub const NS_E_DRM_SIGNATURE_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879553)); pub const NS_E_DRM_LICENSE_SERVER_INFO_MISSING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879552)); pub const NS_E_DRM_BUSY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879551)); pub const NS_E_DRM_PD_TOO_MANY_DEVICES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879550)); pub const NS_E_DRM_INDIV_FRAUD = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879549)); pub const NS_E_DRM_INDIV_NO_CABS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879548)); pub const NS_E_DRM_INDIV_SERVICE_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879547)); pub const NS_E_DRM_RESTORE_SERVICE_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879546)); pub const NS_E_DRM_CLIENT_CODE_EXPIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879545)); pub const NS_E_DRM_NO_UPLINK_LICENSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879544)); pub const NS_E_DRM_INVALID_KID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879543)); pub const NS_E_DRM_LICENSE_INITIALIZATION_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879542)); pub const NS_E_DRM_CHAIN_TOO_LONG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879540)); pub const NS_E_DRM_UNSUPPORTED_ALGORITHM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879539)); pub const NS_E_DRM_LICENSE_DELETION_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879538)); pub const NS_E_DRM_INVALID_CERTIFICATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879456)); pub const NS_E_DRM_CERTIFICATE_REVOKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879455)); pub const NS_E_DRM_LICENSE_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879454)); pub const NS_E_DRM_DEVICE_LIMIT_REACHED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879453)); pub const NS_E_DRM_UNABLE_TO_VERIFY_PROXIMITY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879452)); pub const NS_E_DRM_MUST_REGISTER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879451)); pub const NS_E_DRM_MUST_APPROVE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879450)); pub const NS_E_DRM_MUST_REVALIDATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879449)); pub const NS_E_DRM_INVALID_PROXIMITY_RESPONSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879448)); pub const NS_E_DRM_INVALID_SESSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879447)); pub const NS_E_DRM_DEVICE_NOT_OPEN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879446)); pub const NS_E_DRM_DEVICE_ALREADY_REGISTERED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879445)); pub const NS_E_DRM_UNSUPPORTED_PROTOCOL_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879444)); pub const NS_E_DRM_UNSUPPORTED_ACTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879443)); pub const NS_E_DRM_CERTIFICATE_SECURITY_LEVEL_INADEQUATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879442)); pub const NS_E_DRM_UNABLE_TO_OPEN_PORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879441)); pub const NS_E_DRM_BAD_REQUEST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879440)); pub const NS_E_DRM_INVALID_CRL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879439)); pub const NS_E_DRM_ATTRIBUTE_TOO_LONG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879438)); pub const NS_E_DRM_EXPIRED_LICENSEBLOB = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879437)); pub const NS_E_DRM_INVALID_LICENSEBLOB = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879436)); pub const NS_E_DRM_INCLUSION_LIST_REQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879435)); pub const NS_E_DRM_DRMV2CLT_REVOKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879434)); pub const NS_E_DRM_RIV_TOO_SMALL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879433)); pub const NS_E_OUTPUT_PROTECTION_LEVEL_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879356)); pub const NS_E_COMPRESSED_DIGITAL_VIDEO_PROTECTION_LEVEL_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879355)); pub const NS_E_UNCOMPRESSED_DIGITAL_VIDEO_PROTECTION_LEVEL_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879354)); pub const NS_E_ANALOG_VIDEO_PROTECTION_LEVEL_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879353)); pub const NS_E_COMPRESSED_DIGITAL_AUDIO_PROTECTION_LEVEL_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879352)); pub const NS_E_UNCOMPRESSED_DIGITAL_AUDIO_PROTECTION_LEVEL_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879351)); pub const NS_E_OUTPUT_PROTECTION_SCHEME_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072879350)); pub const NS_S_REBOOT_RECOMMENDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 862968)); pub const NS_S_REBOOT_REQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 862969)); pub const NS_E_REBOOT_RECOMMENDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072878854)); pub const NS_E_REBOOT_REQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072878853)); pub const NS_E_SETUP_INCOMPLETE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072878852)); pub const NS_E_SETUP_DRM_MIGRATION_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072878851)); pub const NS_E_SETUP_IGNORABLE_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072878850)); pub const NS_E_SETUP_DRM_MIGRATION_FAILED_AND_IGNORABLE_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072878849)); pub const NS_E_SETUP_BLOCKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072878848)); pub const NS_E_UNKNOWN_PROTOCOL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877856)); pub const NS_E_REDIRECT_TO_PROXY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877855)); pub const NS_E_INTERNAL_SERVER_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877854)); pub const NS_E_BAD_REQUEST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877853)); pub const NS_E_ERROR_FROM_PROXY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877852)); pub const NS_E_PROXY_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877851)); pub const NS_E_SERVER_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877850)); pub const NS_E_REFUSED_BY_SERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877849)); pub const NS_E_INCOMPATIBLE_SERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877848)); pub const NS_E_MULTICAST_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877847)); pub const NS_E_INVALID_REDIRECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877846)); pub const NS_E_ALL_PROTOCOLS_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877845)); pub const NS_E_MSBD_NO_LONGER_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877844)); pub const NS_E_PROXY_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877843)); pub const NS_E_CANNOT_CONNECT_TO_PROXY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877842)); pub const NS_E_SERVER_DNS_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877841)); pub const NS_E_PROXY_DNS_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877840)); pub const NS_E_CLOSED_ON_SUSPEND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877839)); pub const NS_E_CANNOT_READ_PLAYLIST_FROM_MEDIASERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877838)); pub const NS_E_SESSION_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877837)); pub const NS_E_REQUIRE_STREAMING_CLIENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877836)); pub const NS_E_PLAYLIST_ENTRY_HAS_CHANGED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877835)); pub const NS_E_PROXY_ACCESSDENIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877834)); pub const NS_E_PROXY_SOURCE_ACCESSDENIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877833)); pub const NS_E_NETWORK_SINK_WRITE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877832)); pub const NS_E_FIREWALL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877831)); pub const NS_E_MMS_NOT_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877830)); pub const NS_E_SERVER_ACCESSDENIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877829)); pub const NS_E_RESOURCE_GONE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877828)); pub const NS_E_NO_EXISTING_PACKETIZER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877827)); pub const NS_E_BAD_SYNTAX_IN_SERVER_RESPONSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877826)); pub const NS_I_RECONNECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074605823)); pub const NS_E_RESET_SOCKET_CONNECTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877824)); pub const NS_I_NOLOG_STOP = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074605825)); pub const NS_E_TOO_MANY_HOPS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877822)); pub const NS_I_EXISTING_PACKETIZER = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074605827)); pub const NS_I_MANUAL_PROXY = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1074605828)); pub const NS_E_TOO_MUCH_DATA_FROM_SERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877819)); pub const NS_E_CONNECT_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877818)); pub const NS_E_PROXY_CONNECT_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877817)); pub const NS_E_SESSION_INVALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877816)); pub const NS_S_EOSRECEDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 864009)); pub const NS_E_PACKETSINK_UNKNOWN_FEC_STREAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877814)); pub const NS_E_PUSH_CANNOTCONNECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877813)); pub const NS_E_INCOMPATIBLE_PUSH_SERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072877812)); pub const NS_S_CHANGENOTICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 864013)); pub const NS_E_END_OF_PLAYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876856)); pub const NS_E_USE_FILE_SOURCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876855)); pub const NS_E_PROPERTY_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876854)); pub const NS_E_PROPERTY_READ_ONLY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876852)); pub const NS_E_TABLE_KEY_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876851)); pub const NS_E_INVALID_QUERY_OPERATOR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876849)); pub const NS_E_INVALID_QUERY_PROPERTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876848)); pub const NS_E_PROPERTY_NOT_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876846)); pub const NS_E_SCHEMA_CLASSIFY_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876844)); pub const NS_E_METADATA_FORMAT_NOT_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876843)); pub const NS_E_METADATA_NO_EDITING_CAPABILITY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876842)); pub const NS_E_METADATA_CANNOT_SET_LOCALE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876841)); pub const NS_E_METADATA_LANGUAGE_NOT_SUPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876840)); pub const NS_E_METADATA_NO_RFC1766_NAME_FOR_LOCALE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876839)); pub const NS_E_METADATA_NOT_AVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876838)); pub const NS_E_METADATA_CACHE_DATA_NOT_AVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876837)); pub const NS_E_METADATA_INVALID_DOCUMENT_TYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876836)); pub const NS_E_METADATA_IDENTIFIER_NOT_AVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876835)); pub const NS_E_METADATA_CANNOT_RETRIEVE_FROM_OFFLINE_CACHE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1072876834)); pub const VFW_HIDE_SETTINGS_PAGE = @as(u32, 1); pub const VFW_HIDE_VIDEOSRC_PAGE = @as(u32, 2); pub const VFW_HIDE_CAMERACONTROL_PAGE = @as(u32, 4); pub const VFW_OEM_ADD_PAGE = @as(u32, 2147483648); pub const VFW_USE_DEVICE_HANDLE = @as(u32, 1); pub const VFW_USE_STREAM_HANDLE = @as(u32, 2); pub const VFW_QUERY_DEV_CHANGED = @as(u32, 256); pub const MCIERR_INVALID_DEVICE_ID = @as(u32, 257); pub const MCIERR_UNRECOGNIZED_KEYWORD = @as(u32, 259); pub const MCIERR_UNRECOGNIZED_COMMAND = @as(u32, 261); pub const MCIERR_HARDWARE = @as(u32, 262); pub const MCIERR_INVALID_DEVICE_NAME = @as(u32, 263); pub const MCIERR_OUT_OF_MEMORY = @as(u32, 264); pub const MCIERR_DEVICE_OPEN = @as(u32, 265); pub const MCIERR_CANNOT_LOAD_DRIVER = @as(u32, 266); pub const MCIERR_MISSING_COMMAND_STRING = @as(u32, 267); pub const MCIERR_PARAM_OVERFLOW = @as(u32, 268); pub const MCIERR_MISSING_STRING_ARGUMENT = @as(u32, 269); pub const MCIERR_BAD_INTEGER = @as(u32, 270); pub const MCIERR_PARSER_INTERNAL = @as(u32, 271); pub const MCIERR_DRIVER_INTERNAL = @as(u32, 272); pub const MCIERR_MISSING_PARAMETER = @as(u32, 273); pub const MCIERR_UNSUPPORTED_FUNCTION = @as(u32, 274); pub const MCIERR_FILE_NOT_FOUND = @as(u32, 275); pub const MCIERR_DEVICE_NOT_READY = @as(u32, 276); pub const MCIERR_INTERNAL = @as(u32, 277); pub const MCIERR_DRIVER = @as(u32, 278); pub const MCIERR_CANNOT_USE_ALL = @as(u32, 279); pub const MCIERR_MULTIPLE = @as(u32, 280); pub const MCIERR_EXTENSION_NOT_FOUND = @as(u32, 281); pub const MCIERR_OUTOFRANGE = @as(u32, 282); pub const MCIERR_FLAGS_NOT_COMPATIBLE = @as(u32, 284); pub const MCIERR_FILE_NOT_SAVED = @as(u32, 286); pub const MCIERR_DEVICE_TYPE_REQUIRED = @as(u32, 287); pub const MCIERR_DEVICE_LOCKED = @as(u32, 288); pub const MCIERR_DUPLICATE_ALIAS = @as(u32, 289); pub const MCIERR_BAD_CONSTANT = @as(u32, 290); pub const MCIERR_MUST_USE_SHAREABLE = @as(u32, 291); pub const MCIERR_MISSING_DEVICE_NAME = @as(u32, 292); pub const MCIERR_BAD_TIME_FORMAT = @as(u32, 293); pub const MCIERR_NO_CLOSING_QUOTE = @as(u32, 294); pub const MCIERR_DUPLICATE_FLAGS = @as(u32, 295); pub const MCIERR_INVALID_FILE = @as(u32, 296); pub const MCIERR_NULL_PARAMETER_BLOCK = @as(u32, 297); pub const MCIERR_UNNAMED_RESOURCE = @as(u32, 298); pub const MCIERR_NEW_REQUIRES_ALIAS = @as(u32, 299); pub const MCIERR_NOTIFY_ON_AUTO_OPEN = @as(u32, 300); pub const MCIERR_NO_ELEMENT_ALLOWED = @as(u32, 301); pub const MCIERR_NONAPPLICABLE_FUNCTION = @as(u32, 302); pub const MCIERR_ILLEGAL_FOR_AUTO_OPEN = @as(u32, 303); pub const MCIERR_FILENAME_REQUIRED = @as(u32, 304); pub const MCIERR_EXTRA_CHARACTERS = @as(u32, 305); pub const MCIERR_DEVICE_NOT_INSTALLED = @as(u32, 306); pub const MCIERR_GET_CD = @as(u32, 307); pub const MCIERR_SET_CD = @as(u32, 308); pub const MCIERR_SET_DRIVE = @as(u32, 309); pub const MCIERR_DEVICE_LENGTH = @as(u32, 310); pub const MCIERR_DEVICE_ORD_LENGTH = @as(u32, 311); pub const MCIERR_NO_INTEGER = @as(u32, 312); pub const MCIERR_WAVE_OUTPUTSINUSE = @as(u32, 320); pub const MCIERR_WAVE_SETOUTPUTINUSE = @as(u32, 321); pub const MCIERR_WAVE_INPUTSINUSE = @as(u32, 322); pub const MCIERR_WAVE_SETINPUTINUSE = @as(u32, 323); pub const MCIERR_WAVE_OUTPUTUNSPECIFIED = @as(u32, 324); pub const MCIERR_WAVE_INPUTUNSPECIFIED = @as(u32, 325); pub const MCIERR_WAVE_OUTPUTSUNSUITABLE = @as(u32, 326); pub const MCIERR_WAVE_SETOUTPUTUNSUITABLE = @as(u32, 327); pub const MCIERR_WAVE_INPUTSUNSUITABLE = @as(u32, 328); pub const MCIERR_WAVE_SETINPUTUNSUITABLE = @as(u32, 329); pub const MCIERR_SEQ_DIV_INCOMPATIBLE = @as(u32, 336); pub const MCIERR_SEQ_PORT_INUSE = @as(u32, 337); pub const MCIERR_SEQ_PORT_NONEXISTENT = @as(u32, 338); pub const MCIERR_SEQ_PORT_MAPNODEVICE = @as(u32, 339); pub const MCIERR_SEQ_PORT_MISCERROR = @as(u32, 340); pub const MCIERR_SEQ_TIMER = @as(u32, 341); pub const MCIERR_SEQ_PORTUNSPECIFIED = @as(u32, 342); pub const MCIERR_SEQ_NOMIDIPRESENT = @as(u32, 343); pub const MCIERR_NO_WINDOW = @as(u32, 346); pub const MCIERR_CREATEWINDOW = @as(u32, 347); pub const MCIERR_FILE_READ = @as(u32, 348); pub const MCIERR_FILE_WRITE = @as(u32, 349); pub const MCIERR_NO_IDENTITY = @as(u32, 350); pub const MCIERR_CUSTOM_DRIVER_BASE = @as(u32, 512); pub const MCI_FIRST = @as(u32, 2048); pub const MCI_ESCAPE = @as(u32, 2053); pub const MCI_INFO = @as(u32, 2058); pub const MCI_GETDEVCAPS = @as(u32, 2059); pub const MCI_SPIN = @as(u32, 2060); pub const MCI_SET = @as(u32, 2061); pub const MCI_SYSINFO = @as(u32, 2064); pub const MCI_BREAK = @as(u32, 2065); pub const MCI_STATUS = @as(u32, 2068); pub const MCI_CUE = @as(u32, 2096); pub const MCI_REALIZE = @as(u32, 2112); pub const MCI_WINDOW = @as(u32, 2113); pub const MCI_PUT = @as(u32, 2114); pub const MCI_WHERE = @as(u32, 2115); pub const MCI_FREEZE = @as(u32, 2116); pub const MCI_UNFREEZE = @as(u32, 2117); pub const MCI_LOAD = @as(u32, 2128); pub const MCI_UPDATE = @as(u32, 2132); pub const MCI_USER_MESSAGES = @as(u32, 3072); pub const MCI_LAST = @as(u32, 4095); pub const MCI_DEVTYPE_VCR = @as(u32, 513); pub const MCI_DEVTYPE_VIDEODISC = @as(u32, 514); pub const MCI_DEVTYPE_OVERLAY = @as(u32, 515); pub const MCI_DEVTYPE_CD_AUDIO = @as(u32, 516); pub const MCI_DEVTYPE_DAT = @as(u32, 517); pub const MCI_DEVTYPE_SCANNER = @as(u32, 518); pub const MCI_DEVTYPE_ANIMATION = @as(u32, 519); pub const MCI_DEVTYPE_DIGITAL_VIDEO = @as(u32, 520); pub const MCI_DEVTYPE_OTHER = @as(u32, 521); pub const MCI_DEVTYPE_WAVEFORM_AUDIO = @as(u32, 522); pub const MCI_DEVTYPE_SEQUENCER = @as(u32, 523); pub const MCI_DEVTYPE_FIRST = @as(u32, 513); pub const MCI_DEVTYPE_LAST = @as(u32, 523); pub const MCI_DEVTYPE_FIRST_USER = @as(u32, 4096); pub const MCI_FORMAT_MILLISECONDS = @as(u32, 0); pub const MCI_FORMAT_HMS = @as(u32, 1); pub const MCI_FORMAT_MSF = @as(u32, 2); pub const MCI_FORMAT_FRAMES = @as(u32, 3); pub const MCI_FORMAT_SMPTE_24 = @as(u32, 4); pub const MCI_FORMAT_SMPTE_25 = @as(u32, 5); pub const MCI_FORMAT_SMPTE_30 = @as(u32, 6); pub const MCI_FORMAT_SMPTE_30DROP = @as(u32, 7); pub const MCI_FORMAT_BYTES = @as(u32, 8); pub const MCI_FORMAT_SAMPLES = @as(u32, 9); pub const MCI_FORMAT_TMSF = @as(u32, 10); pub const MCI_NOTIFY_SUCCESSFUL = @as(u32, 1); pub const MCI_NOTIFY_SUPERSEDED = @as(u32, 2); pub const MCI_NOTIFY_ABORTED = @as(u32, 4); pub const MCI_NOTIFY_FAILURE = @as(u32, 8); pub const MCI_NOTIFY = @as(i32, 1); pub const MCI_WAIT = @as(i32, 2); pub const MCI_FROM = @as(i32, 4); pub const MCI_TO = @as(i32, 8); pub const MCI_TRACK = @as(i32, 16); pub const MCI_OPEN_SHAREABLE = @as(i32, 256); pub const MCI_OPEN_ELEMENT = @as(i32, 512); pub const MCI_OPEN_ALIAS = @as(i32, 1024); pub const MCI_OPEN_ELEMENT_ID = @as(i32, 2048); pub const MCI_OPEN_TYPE_ID = @as(i32, 4096); pub const MCI_OPEN_TYPE = @as(i32, 8192); pub const MCI_SEEK_TO_START = @as(i32, 256); pub const MCI_SEEK_TO_END = @as(i32, 512); pub const MCI_STATUS_ITEM = @as(i32, 256); pub const MCI_STATUS_START = @as(i32, 512); pub const MCI_STATUS_LENGTH = @as(i32, 1); pub const MCI_STATUS_POSITION = @as(i32, 2); pub const MCI_STATUS_NUMBER_OF_TRACKS = @as(i32, 3); pub const MCI_STATUS_MODE = @as(i32, 4); pub const MCI_STATUS_MEDIA_PRESENT = @as(i32, 5); pub const MCI_STATUS_TIME_FORMAT = @as(i32, 6); pub const MCI_STATUS_READY = @as(i32, 7); pub const MCI_STATUS_CURRENT_TRACK = @as(i32, 8); pub const MCI_INFO_PRODUCT = @as(i32, 256); pub const MCI_INFO_FILE = @as(i32, 512); pub const MCI_INFO_MEDIA_UPC = @as(i32, 1024); pub const MCI_INFO_MEDIA_IDENTITY = @as(i32, 2048); pub const MCI_INFO_NAME = @as(i32, 4096); pub const MCI_INFO_COPYRIGHT = @as(i32, 8192); pub const MCI_GETDEVCAPS_ITEM = @as(i32, 256); pub const MCI_GETDEVCAPS_CAN_RECORD = @as(i32, 1); pub const MCI_GETDEVCAPS_HAS_AUDIO = @as(i32, 2); pub const MCI_GETDEVCAPS_HAS_VIDEO = @as(i32, 3); pub const MCI_GETDEVCAPS_DEVICE_TYPE = @as(i32, 4); pub const MCI_GETDEVCAPS_USES_FILES = @as(i32, 5); pub const MCI_GETDEVCAPS_COMPOUND_DEVICE = @as(i32, 6); pub const MCI_GETDEVCAPS_CAN_EJECT = @as(i32, 7); pub const MCI_GETDEVCAPS_CAN_PLAY = @as(i32, 8); pub const MCI_GETDEVCAPS_CAN_SAVE = @as(i32, 9); pub const MCI_SYSINFO_QUANTITY = @as(i32, 256); pub const MCI_SYSINFO_OPEN = @as(i32, 512); pub const MCI_SYSINFO_NAME = @as(i32, 1024); pub const MCI_SYSINFO_INSTALLNAME = @as(i32, 2048); pub const MCI_SET_DOOR_OPEN = @as(i32, 256); pub const MCI_SET_DOOR_CLOSED = @as(i32, 512); pub const MCI_SET_TIME_FORMAT = @as(i32, 1024); pub const MCI_SET_AUDIO = @as(i32, 2048); pub const MCI_SET_VIDEO = @as(i32, 4096); pub const MCI_SET_ON = @as(i32, 8192); pub const MCI_SET_OFF = @as(i32, 16384); pub const MCI_SET_AUDIO_ALL = @as(i32, 0); pub const MCI_SET_AUDIO_LEFT = @as(i32, 1); pub const MCI_SET_AUDIO_RIGHT = @as(i32, 2); pub const MCI_BREAK_KEY = @as(i32, 256); pub const MCI_BREAK_HWND = @as(i32, 512); pub const MCI_BREAK_OFF = @as(i32, 1024); pub const MCI_RECORD_INSERT = @as(i32, 256); pub const MCI_RECORD_OVERWRITE = @as(i32, 512); pub const MCI_SAVE_FILE = @as(i32, 256); pub const MCI_LOAD_FILE = @as(i32, 256); pub const MCI_VD_MODE_PARK = @as(u32, 1025); pub const MCI_VD_MEDIA_CLV = @as(u32, 1026); pub const MCI_VD_MEDIA_CAV = @as(u32, 1027); pub const MCI_VD_MEDIA_OTHER = @as(u32, 1028); pub const MCI_VD_FORMAT_TRACK = @as(u32, 16385); pub const MCI_VD_PLAY_REVERSE = @as(i32, 65536); pub const MCI_VD_PLAY_FAST = @as(i32, 131072); pub const MCI_VD_PLAY_SPEED = @as(i32, 262144); pub const MCI_VD_PLAY_SCAN = @as(i32, 524288); pub const MCI_VD_PLAY_SLOW = @as(i32, 1048576); pub const MCI_VD_SEEK_REVERSE = @as(i32, 65536); pub const MCI_VD_STATUS_SPEED = @as(i32, 16386); pub const MCI_VD_STATUS_FORWARD = @as(i32, 16387); pub const MCI_VD_STATUS_MEDIA_TYPE = @as(i32, 16388); pub const MCI_VD_STATUS_SIDE = @as(i32, 16389); pub const MCI_VD_STATUS_DISC_SIZE = @as(i32, 16390); pub const MCI_VD_GETDEVCAPS_CLV = @as(i32, 65536); pub const MCI_VD_GETDEVCAPS_CAV = @as(i32, 131072); pub const MCI_VD_SPIN_UP = @as(i32, 65536); pub const MCI_VD_SPIN_DOWN = @as(i32, 131072); pub const MCI_VD_GETDEVCAPS_CAN_REVERSE = @as(i32, 16386); pub const MCI_VD_GETDEVCAPS_FAST_RATE = @as(i32, 16387); pub const MCI_VD_GETDEVCAPS_SLOW_RATE = @as(i32, 16388); pub const MCI_VD_GETDEVCAPS_NORMAL_RATE = @as(i32, 16389); pub const MCI_VD_STEP_FRAMES = @as(i32, 65536); pub const MCI_VD_STEP_REVERSE = @as(i32, 131072); pub const MCI_VD_ESCAPE_STRING = @as(i32, 256); pub const MCI_CDA_STATUS_TYPE_TRACK = @as(i32, 16385); pub const MCI_CDA_TRACK_AUDIO = @as(u32, 1088); pub const MCI_CDA_TRACK_OTHER = @as(u32, 1089); pub const MCI_WAVE_PCM = @as(u32, 1152); pub const MCI_WAVE_MAPPER = @as(u32, 1153); pub const MCI_WAVE_OPEN_BUFFER = @as(i32, 65536); pub const MCI_WAVE_SET_FORMATTAG = @as(i32, 65536); pub const MCI_WAVE_SET_CHANNELS = @as(i32, 131072); pub const MCI_WAVE_SET_SAMPLESPERSEC = @as(i32, 262144); pub const MCI_WAVE_SET_AVGBYTESPERSEC = @as(i32, 524288); pub const MCI_WAVE_SET_BLOCKALIGN = @as(i32, 1048576); pub const MCI_WAVE_SET_BITSPERSAMPLE = @as(i32, 2097152); pub const MCI_WAVE_INPUT = @as(i32, 4194304); pub const MCI_WAVE_OUTPUT = @as(i32, 8388608); pub const MCI_WAVE_STATUS_FORMATTAG = @as(i32, 16385); pub const MCI_WAVE_STATUS_CHANNELS = @as(i32, 16386); pub const MCI_WAVE_STATUS_SAMPLESPERSEC = @as(i32, 16387); pub const MCI_WAVE_STATUS_AVGBYTESPERSEC = @as(i32, 16388); pub const MCI_WAVE_STATUS_BLOCKALIGN = @as(i32, 16389); pub const MCI_WAVE_STATUS_BITSPERSAMPLE = @as(i32, 16390); pub const MCI_WAVE_STATUS_LEVEL = @as(i32, 16391); pub const MCI_WAVE_SET_ANYINPUT = @as(i32, 67108864); pub const MCI_WAVE_SET_ANYOUTPUT = @as(i32, 134217728); pub const MCI_WAVE_GETDEVCAPS_INPUTS = @as(i32, 16385); pub const MCI_WAVE_GETDEVCAPS_OUTPUTS = @as(i32, 16386); pub const MCI_SEQ_FORMAT_SONGPTR = @as(u32, 16385); pub const MCI_SEQ_FILE = @as(u32, 16386); pub const MCI_SEQ_MIDI = @as(u32, 16387); pub const MCI_SEQ_SMPTE = @as(u32, 16388); pub const MCI_SEQ_NONE = @as(u32, 65533); pub const MCI_SEQ_MAPPER = @as(u32, 65535); pub const MCI_SEQ_STATUS_TEMPO = @as(i32, 16386); pub const MCI_SEQ_STATUS_PORT = @as(i32, 16387); pub const MCI_SEQ_STATUS_SLAVE = @as(i32, 16391); pub const MCI_SEQ_STATUS_MASTER = @as(i32, 16392); pub const MCI_SEQ_STATUS_OFFSET = @as(i32, 16393); pub const MCI_SEQ_STATUS_DIVTYPE = @as(i32, 16394); pub const MCI_SEQ_STATUS_NAME = @as(i32, 16395); pub const MCI_SEQ_STATUS_COPYRIGHT = @as(i32, 16396); pub const MCI_SEQ_SET_TEMPO = @as(i32, 65536); pub const MCI_SEQ_SET_PORT = @as(i32, 131072); pub const MCI_SEQ_SET_SLAVE = @as(i32, 262144); pub const MCI_SEQ_SET_MASTER = @as(i32, 524288); pub const MCI_SEQ_SET_OFFSET = @as(i32, 16777216); pub const MCI_ANIM_OPEN_WS = @as(i32, 65536); pub const MCI_ANIM_OPEN_PARENT = @as(i32, 131072); pub const MCI_ANIM_OPEN_NOSTATIC = @as(i32, 262144); pub const MCI_ANIM_PLAY_SPEED = @as(i32, 65536); pub const MCI_ANIM_PLAY_REVERSE = @as(i32, 131072); pub const MCI_ANIM_PLAY_FAST = @as(i32, 262144); pub const MCI_ANIM_PLAY_SLOW = @as(i32, 524288); pub const MCI_ANIM_PLAY_SCAN = @as(i32, 1048576); pub const MCI_ANIM_STEP_REVERSE = @as(i32, 65536); pub const MCI_ANIM_STEP_FRAMES = @as(i32, 131072); pub const MCI_ANIM_STATUS_SPEED = @as(i32, 16385); pub const MCI_ANIM_STATUS_FORWARD = @as(i32, 16386); pub const MCI_ANIM_STATUS_HWND = @as(i32, 16387); pub const MCI_ANIM_STATUS_HPAL = @as(i32, 16388); pub const MCI_ANIM_STATUS_STRETCH = @as(i32, 16389); pub const MCI_ANIM_INFO_TEXT = @as(i32, 65536); pub const MCI_ANIM_GETDEVCAPS_CAN_REVERSE = @as(i32, 16385); pub const MCI_ANIM_GETDEVCAPS_FAST_RATE = @as(i32, 16386); pub const MCI_ANIM_GETDEVCAPS_SLOW_RATE = @as(i32, 16387); pub const MCI_ANIM_GETDEVCAPS_NORMAL_RATE = @as(i32, 16388); pub const MCI_ANIM_GETDEVCAPS_PALETTES = @as(i32, 16390); pub const MCI_ANIM_GETDEVCAPS_CAN_STRETCH = @as(i32, 16391); pub const MCI_ANIM_GETDEVCAPS_MAX_WINDOWS = @as(i32, 16392); pub const MCI_ANIM_REALIZE_NORM = @as(i32, 65536); pub const MCI_ANIM_REALIZE_BKGD = @as(i32, 131072); pub const MCI_ANIM_WINDOW_HWND = @as(i32, 65536); pub const MCI_ANIM_WINDOW_STATE = @as(i32, 262144); pub const MCI_ANIM_WINDOW_TEXT = @as(i32, 524288); pub const MCI_ANIM_WINDOW_ENABLE_STRETCH = @as(i32, 1048576); pub const MCI_ANIM_WINDOW_DISABLE_STRETCH = @as(i32, 2097152); pub const MCI_ANIM_WINDOW_DEFAULT = @as(i32, 0); pub const MCI_ANIM_RECT = @as(i32, 65536); pub const MCI_ANIM_PUT_SOURCE = @as(i32, 131072); pub const MCI_ANIM_PUT_DESTINATION = @as(i32, 262144); pub const MCI_ANIM_WHERE_SOURCE = @as(i32, 131072); pub const MCI_ANIM_WHERE_DESTINATION = @as(i32, 262144); pub const MCI_ANIM_UPDATE_HDC = @as(i32, 131072); pub const MCI_OVLY_OPEN_WS = @as(i32, 65536); pub const MCI_OVLY_OPEN_PARENT = @as(i32, 131072); pub const MCI_OVLY_STATUS_HWND = @as(i32, 16385); pub const MCI_OVLY_STATUS_STRETCH = @as(i32, 16386); pub const MCI_OVLY_INFO_TEXT = @as(i32, 65536); pub const MCI_OVLY_GETDEVCAPS_CAN_STRETCH = @as(i32, 16385); pub const MCI_OVLY_GETDEVCAPS_CAN_FREEZE = @as(i32, 16386); pub const MCI_OVLY_GETDEVCAPS_MAX_WINDOWS = @as(i32, 16387); pub const MCI_OVLY_WINDOW_HWND = @as(i32, 65536); pub const MCI_OVLY_WINDOW_STATE = @as(i32, 262144); pub const MCI_OVLY_WINDOW_TEXT = @as(i32, 524288); pub const MCI_OVLY_WINDOW_ENABLE_STRETCH = @as(i32, 1048576); pub const MCI_OVLY_WINDOW_DISABLE_STRETCH = @as(i32, 2097152); pub const MCI_OVLY_WINDOW_DEFAULT = @as(i32, 0); pub const MCI_OVLY_RECT = @as(i32, 65536); pub const MCI_OVLY_PUT_SOURCE = @as(i32, 131072); pub const MCI_OVLY_PUT_DESTINATION = @as(i32, 262144); pub const MCI_OVLY_PUT_FRAME = @as(i32, 524288); pub const MCI_OVLY_PUT_VIDEO = @as(i32, 1048576); pub const MCI_OVLY_WHERE_SOURCE = @as(i32, 131072); pub const MCI_OVLY_WHERE_DESTINATION = @as(i32, 262144); pub const MCI_OVLY_WHERE_FRAME = @as(i32, 524288); pub const MCI_OVLY_WHERE_VIDEO = @as(i32, 1048576); //-------------------------------------------------------------------------------- // Section: Types (190) //-------------------------------------------------------------------------------- pub const HMMIO = *opaque{}; pub const HDRVR = *opaque{}; pub const HIC = *opaque{}; pub const HVIDEO = *opaque{}; const CLSID_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_Value = Guid.initString("00000003-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = &CLSID_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_Value; pub const ADPCMCOEFSET = packed struct { iCoef1: i16, iCoef2: i16, }; pub const ADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, wNumCoef: u16, aCoef: [1]ADPCMCOEFSET, }; pub const DRMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wReserved: u16, ulContentId: u32, wfxSecure: WAVEFORMATEX, }; pub const DVIADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, }; pub const IMAADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, }; pub const MEDIASPACEADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wRevision: u16, }; pub const SIERRAADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wRevision: u16, }; pub const G723_ADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, cbExtraSize: u16, nAuxBlockSize: u16, }; pub const DIGISTDWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const DIGIFIXWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const DIALOGICOKIADPCMWAVEFORMAT = packed struct { ewf: WAVEFORMATEX, }; pub const YAMAHA_ADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const SONARCWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wCompType: u16, }; pub const TRUESPEECHWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wRevision: u16, nSamplesPerBlock: u16, abReserved: [28]u8, }; pub const ECHOSC1WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const AUDIOFILE_AF36WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const APTXWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const AUDIOFILE_AF10WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const DOLBYAC2WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, nAuxBitsCode: u16, }; pub const GSM610WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, }; pub const ADPCMEWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, }; pub const CONTRESVQLPCWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, }; pub const DIGIREALWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, }; pub const DIGIADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, }; pub const CONTRESCR10WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, }; pub const NMS_VBXADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, }; pub const G721_ADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, nAuxBlockSize: u16, }; pub const MSAUDIO1WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wSamplesPerBlock: u16, wEncodeOptions: u16, }; pub const WMAUDIO2WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, dwSamplesPerBlock: u32, wEncodeOptions: u16, dwSuperBlockAlign: u32, }; pub const WMAUDIO3WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wValidBitsPerSample: u16, dwChannelMask: u32, dwReserved1: u32, dwReserved2: u32, wEncodeOptions: u16, wReserved3: u16, }; pub const CREATIVEADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wRevision: u16, }; pub const CREATIVEFASTSPEECH8WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wRevision: u16, }; pub const CREATIVEFASTSPEECH10WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wRevision: u16, }; pub const FMTOWNS_SND_WAVEFORMAT = packed struct { wfx: WAVEFORMATEX, wRevision: u16, }; pub const OLIGSMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const OLIADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const OLICELPWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const OLISBCWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const OLIOPRWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const CSIMAADPCMWAVEFORMAT = packed struct { wfx: WAVEFORMATEX, }; pub const s_RIFFWAVE_inst = extern struct { bUnshiftedNote: u8, chFineTune: CHAR, chGain: CHAR, bLowNote: u8, bHighNote: u8, bLowVelocity: u8, bHighVelocity: u8, }; pub const EXBMINFOHEADER = packed struct { bmi: BITMAPINFOHEADER, biExtDataOffset: u32, }; pub const JPEGINFOHEADER = packed struct { JPEGSize: u32, JPEGProcess: u32, JPEGColorSpaceID: u32, JPEGBitsPerSample: u32, JPEGHSubSampling: u32, JPEGVSubSampling: u32, }; pub const YIELDPROC = fn( mciId: u32, dwYieldData: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const MCI_GENERIC_PARMS = packed struct { dwCallback: usize, }; pub const MCI_OPEN_PARMSA = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u8, lpstrElementName: ?[*:0]const u8, lpstrAlias: ?[*:0]const u8, }; pub const MCI_OPEN_PARMSW = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u16, lpstrElementName: ?[*:0]const u16, lpstrAlias: ?[*:0]const u16, }; pub const MCI_PLAY_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, }; pub const MCI_SEEK_PARMS = packed struct { dwCallback: usize, dwTo: u32, }; pub const MCI_STATUS_PARMS = packed struct { dwCallback: usize, dwReturn: usize, dwItem: u32, dwTrack: u32, }; pub const MCI_INFO_PARMSA = packed struct { dwCallback: usize, lpstrReturn: ?PSTR, dwRetSize: u32, }; pub const MCI_INFO_PARMSW = packed struct { dwCallback: usize, lpstrReturn: ?PWSTR, dwRetSize: u32, }; pub const MCI_GETDEVCAPS_PARMS = packed struct { dwCallback: usize, dwReturn: u32, dwItem: u32, }; pub const MCI_SYSINFO_PARMSA = packed struct { dwCallback: usize, lpstrReturn: ?PSTR, dwRetSize: u32, dwNumber: u32, wDeviceType: u32, }; pub const MCI_SYSINFO_PARMSW = packed struct { dwCallback: usize, lpstrReturn: ?PWSTR, dwRetSize: u32, dwNumber: u32, wDeviceType: u32, }; pub const MCI_SET_PARMS = packed struct { dwCallback: usize, dwTimeFormat: u32, dwAudio: u32, }; pub const MCI_BREAK_PARMS = packed struct { dwCallback: usize, nVirtKey: i32, hwndBreak: ?HWND, }; pub const MCI_SAVE_PARMSA = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u8, }; pub const MCI_SAVE_PARMSW = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u16, }; pub const MCI_LOAD_PARMSA = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u8, }; pub const MCI_LOAD_PARMSW = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u16, }; pub const MCI_RECORD_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, }; pub const MCI_VD_PLAY_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, dwSpeed: u32, }; pub const MCI_VD_STEP_PARMS = packed struct { dwCallback: usize, dwFrames: u32, }; pub const MCI_VD_ESCAPE_PARMSA = packed struct { dwCallback: usize, lpstrCommand: ?[*:0]const u8, }; pub const MCI_VD_ESCAPE_PARMSW = packed struct { dwCallback: usize, lpstrCommand: ?[*:0]const u16, }; pub const MCI_WAVE_OPEN_PARMSA = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u8, lpstrElementName: ?[*:0]const u8, lpstrAlias: ?[*:0]const u8, dwBufferSeconds: u32, }; pub const MCI_WAVE_OPEN_PARMSW = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u16, lpstrElementName: ?[*:0]const u16, lpstrAlias: ?[*:0]const u16, dwBufferSeconds: u32, }; pub const MCI_WAVE_DELETE_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, }; pub const MCI_WAVE_SET_PARMS = packed struct { dwCallback: usize, dwTimeFormat: u32, dwAudio: u32, wInput: u32, wOutput: u32, wFormatTag: u16, wReserved2: u16, nChannels: u16, wReserved3: u16, nSamplesPerSec: u32, nAvgBytesPerSec: u32, nBlockAlign: u16, wReserved4: u16, wBitsPerSample: u16, wReserved5: u16, }; pub const MCI_SEQ_SET_PARMS = packed struct { dwCallback: usize, dwTimeFormat: u32, dwAudio: u32, dwTempo: u32, dwPort: u32, dwSlave: u32, dwMaster: u32, dwOffset: u32, }; pub const MCI_ANIM_OPEN_PARMSA = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u8, lpstrElementName: ?[*:0]const u8, lpstrAlias: ?[*:0]const u8, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_ANIM_OPEN_PARMSW = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u16, lpstrElementName: ?[*:0]const u16, lpstrAlias: ?[*:0]const u16, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_ANIM_PLAY_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, dwSpeed: u32, }; pub const MCI_ANIM_STEP_PARMS = packed struct { dwCallback: usize, dwFrames: u32, }; pub const MCI_ANIM_WINDOW_PARMSA = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?[*:0]const u8, }; pub const MCI_ANIM_WINDOW_PARMSW = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?[*:0]const u16, }; pub const MCI_ANIM_RECT_PARMS = packed struct { dwCallback: usize, rc: RECT, }; pub const MCI_ANIM_UPDATE_PARMS = packed struct { dwCallback: usize, rc: RECT, hDC: ?HDC, }; pub const MCI_OVLY_OPEN_PARMSA = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u8, lpstrElementName: ?[*:0]const u8, lpstrAlias: ?[*:0]const u8, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_OVLY_OPEN_PARMSW = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u16, lpstrElementName: ?[*:0]const u16, lpstrAlias: ?[*:0]const u16, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_OVLY_WINDOW_PARMSA = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?[*:0]const u8, }; pub const MCI_OVLY_WINDOW_PARMSW = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?[*:0]const u16, }; pub const MCI_OVLY_RECT_PARMS = packed struct { dwCallback: usize, rc: RECT, }; pub const MCI_OVLY_SAVE_PARMSA = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u8, rc: RECT, }; pub const MCI_OVLY_SAVE_PARMSW = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u16, rc: RECT, }; pub const MCI_OVLY_LOAD_PARMSA = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u8, rc: RECT, }; pub const MCI_OVLY_LOAD_PARMSW = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u16, rc: RECT, }; pub const DRVCONFIGINFOEX = packed struct { dwDCISize: u32, lpszDCISectionName: ?[*:0]const u16, lpszDCIAliasName: ?[*:0]const u16, dnDevNode: u32, }; pub const DRVCONFIGINFO = packed struct { dwDCISize: u32, lpszDCISectionName: ?[*:0]const u16, lpszDCIAliasName: ?[*:0]const u16, }; pub const DRIVERPROC = fn( param0: usize, param1: ?HDRVR, param2: u32, param3: LPARAM, param4: LPARAM, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const DRIVERMSGPROC = fn( param0: u32, param1: u32, param2: usize, param3: usize, param4: usize, ) callconv(@import("std").os.windows.WINAPI) u32; pub const LPMMIOPROC = fn( lpmmioinfo: ?PSTR, uMsg: u32, lParam1: LPARAM, lParam2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const MMIOINFO = packed struct { dwFlags: u32, fccIOProc: u32, pIOProc: ?LPMMIOPROC, wErrorRet: u32, htask: ?HTASK, cchBuffer: i32, pchBuffer: ?*i8, pchNext: ?*i8, pchEndRead: ?*i8, pchEndWrite: ?*i8, lBufOffset: i32, lDiskOffset: i32, adwInfo: [3]u32, dwReserved1: u32, dwReserved2: u32, hmmio: ?HMMIO, }; pub const MMCKINFO = packed struct { ckid: u32, cksize: u32, fccType: u32, dwDataOffset: u32, dwFlags: u32, }; pub const JOYCAPSA = packed struct { wMid: u16, wPid: u16, szPname: [32]CHAR, wXmin: u32, wXmax: u32, wYmin: u32, wYmax: u32, wZmin: u32, wZmax: u32, wNumButtons: u32, wPeriodMin: u32, wPeriodMax: u32, wRmin: u32, wRmax: u32, wUmin: u32, wUmax: u32, wVmin: u32, wVmax: u32, wCaps: u32, wMaxAxes: u32, wNumAxes: u32, wMaxButtons: u32, szRegKey: [32]CHAR, szOEMVxD: [260]CHAR, }; pub const JOYCAPSW = packed struct { wMid: u16, wPid: u16, szPname: [32]u16, wXmin: u32, wXmax: u32, wYmin: u32, wYmax: u32, wZmin: u32, wZmax: u32, wNumButtons: u32, wPeriodMin: u32, wPeriodMax: u32, wRmin: u32, wRmax: u32, wUmin: u32, wUmax: u32, wVmin: u32, wVmax: u32, wCaps: u32, wMaxAxes: u32, wNumAxes: u32, wMaxButtons: u32, szRegKey: [32]u16, szOEMVxD: [260]u16, }; pub const JOYCAPS2A = packed struct { wMid: u16, wPid: u16, szPname: [32]CHAR, wXmin: u32, wXmax: u32, wYmin: u32, wYmax: u32, wZmin: u32, wZmax: u32, wNumButtons: u32, wPeriodMin: u32, wPeriodMax: u32, wRmin: u32, wRmax: u32, wUmin: u32, wUmax: u32, wVmin: u32, wVmax: u32, wCaps: u32, wMaxAxes: u32, wNumAxes: u32, wMaxButtons: u32, szRegKey: [32]CHAR, szOEMVxD: [260]CHAR, ManufacturerGuid: Guid, ProductGuid: Guid, NameGuid: Guid, }; pub const JOYCAPS2W = packed struct { wMid: u16, wPid: u16, szPname: [32]u16, wXmin: u32, wXmax: u32, wYmin: u32, wYmax: u32, wZmin: u32, wZmax: u32, wNumButtons: u32, wPeriodMin: u32, wPeriodMax: u32, wRmin: u32, wRmax: u32, wUmin: u32, wUmax: u32, wVmin: u32, wVmax: u32, wCaps: u32, wMaxAxes: u32, wNumAxes: u32, wMaxButtons: u32, szRegKey: [32]u16, szOEMVxD: [260]u16, ManufacturerGuid: Guid, ProductGuid: Guid, NameGuid: Guid, }; pub const JOYINFO = packed struct { wXpos: u32, wYpos: u32, wZpos: u32, wButtons: u32, }; pub const JOYINFOEX = packed struct { dwSize: u32, dwFlags: u32, dwXpos: u32, dwYpos: u32, dwZpos: u32, dwRpos: u32, dwUpos: u32, dwVpos: u32, dwButtons: u32, dwButtonNumber: u32, dwPOV: u32, dwReserved1: u32, dwReserved2: u32, }; pub const MCI_DGV_RECT_PARMS = packed struct { dwCallback: usize, rc: RECT, }; pub const MCI_DGV_CAPTURE_PARMSA = packed struct { dwCallback: usize, lpstrFileName: ?PSTR, rc: RECT, }; pub const MCI_DGV_CAPTURE_PARMSW = packed struct { dwCallback: usize, lpstrFileName: ?PWSTR, rc: RECT, }; pub const MCI_DGV_COPY_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, rc: RECT, dwAudioStream: u32, dwVideoStream: u32, }; pub const MCI_DGV_CUE_PARMS = packed struct { dwCallback: usize, dwTo: u32, }; pub const MCI_DGV_CUT_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, rc: RECT, dwAudioStream: u32, dwVideoStream: u32, }; pub const MCI_DGV_DELETE_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, rc: RECT, dwAudioStream: u32, dwVideoStream: u32, }; pub const MCI_DGV_INFO_PARMSA = packed struct { dwCallback: usize, lpstrReturn: ?PSTR, dwRetSize: u32, dwItem: u32, }; pub const MCI_DGV_INFO_PARMSW = packed struct { dwCallback: usize, lpstrReturn: ?PWSTR, dwRetSize: u32, dwItem: u32, }; pub const MCI_DGV_LIST_PARMSA = packed struct { dwCallback: usize, lpstrReturn: ?PSTR, dwLength: u32, dwNumber: u32, dwItem: u32, lpstrAlgorithm: ?PSTR, }; pub const MCI_DGV_LIST_PARMSW = packed struct { dwCallback: usize, lpstrReturn: ?PWSTR, dwLength: u32, dwNumber: u32, dwItem: u32, lpstrAlgorithm: ?PWSTR, }; pub const MCI_DGV_MONITOR_PARMS = packed struct { dwCallback: usize, dwSource: u32, dwMethod: u32, }; pub const MCI_DGV_OPEN_PARMSA = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?PSTR, lpstrElementName: ?PSTR, lpstrAlias: ?PSTR, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_DGV_OPEN_PARMSW = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?PWSTR, lpstrElementName: ?PWSTR, lpstrAlias: ?PWSTR, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_DGV_PASTE_PARMS = packed struct { dwCallback: usize, dwTo: u32, rc: RECT, dwAudioStream: u32, dwVideoStream: u32, }; pub const MCI_DGV_QUALITY_PARMSA = packed struct { dwCallback: usize, dwItem: u32, lpstrName: ?PSTR, lpstrAlgorithm: u32, dwHandle: u32, }; pub const MCI_DGV_QUALITY_PARMSW = packed struct { dwCallback: usize, dwItem: u32, lpstrName: ?PWSTR, lpstrAlgorithm: u32, dwHandle: u32, }; pub const MCI_DGV_RECORD_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, rc: RECT, dwAudioStream: u32, dwVideoStream: u32, }; pub const MCI_DGV_RESERVE_PARMSA = packed struct { dwCallback: usize, lpstrPath: ?PSTR, dwSize: u32, }; pub const MCI_DGV_RESERVE_PARMSW = packed struct { dwCallback: usize, lpstrPath: ?PWSTR, dwSize: u32, }; pub const MCI_DGV_RESTORE_PARMSA = packed struct { dwCallback: usize, lpstrFileName: ?PSTR, rc: RECT, }; pub const MCI_DGV_RESTORE_PARMSW = packed struct { dwCallback: usize, lpstrFileName: ?PWSTR, rc: RECT, }; pub const MCI_DGV_SAVE_PARMSA = packed struct { dwCallback: usize, lpstrFileName: ?PSTR, rc: RECT, }; pub const MCI_DGV_SAVE_PARMSW = packed struct { dwCallback: usize, lpstrFileName: ?PWSTR, rc: RECT, }; pub const MCI_DGV_SET_PARMS = packed struct { dwCallback: usize, dwTimeFormat: u32, dwAudio: u32, dwFileFormat: u32, dwSpeed: u32, }; pub const MCI_DGV_SETAUDIO_PARMSA = packed struct { dwCallback: usize, dwItem: u32, dwValue: u32, dwOver: u32, lpstrAlgorithm: ?PSTR, lpstrQuality: ?PSTR, }; pub const MCI_DGV_SETAUDIO_PARMSW = packed struct { dwCallback: usize, dwItem: u32, dwValue: u32, dwOver: u32, lpstrAlgorithm: ?PWSTR, lpstrQuality: ?PWSTR, }; pub const MCI_DGV_SIGNAL_PARMS = packed struct { dwCallback: usize, dwPosition: u32, dwPeriod: u32, dwUserParm: u32, }; pub const MCI_DGV_SETVIDEO_PARMSA = packed struct { dwCallback: usize, dwItem: u32, dwValue: u32, dwOver: u32, lpstrAlgorithm: ?PSTR, lpstrQuality: ?PSTR, dwSourceNumber: u32, }; pub const MCI_DGV_SETVIDEO_PARMSW = packed struct { dwCallback: usize, dwItem: u32, dwValue: u32, dwOver: u32, lpstrAlgorithm: ?PWSTR, lpstrQuality: ?PWSTR, dwSourceNumber: u32, }; pub const MCI_DGV_STATUS_PARMSA = packed struct { dwCallback: usize, dwReturn: usize, dwItem: u32, dwTrack: u32, lpstrDrive: ?PSTR, dwReference: u32, }; pub const MCI_DGV_STATUS_PARMSW = packed struct { dwCallback: usize, dwReturn: usize, dwItem: u32, dwTrack: u32, lpstrDrive: ?PWSTR, dwReference: u32, }; pub const MCI_DGV_STEP_PARMS = packed struct { dwCallback: usize, dwFrames: u32, }; pub const MCI_DGV_UPDATE_PARMS = packed struct { dwCallback: usize, rc: RECT, hDC: ?HDC, }; pub const MCI_DGV_WINDOW_PARMSA = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?PSTR, }; pub const MCI_DGV_WINDOW_PARMSW = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?PWSTR, }; pub const ICOPEN = extern struct { dwSize: u32, fccType: u32, fccHandler: u32, dwVersion: u32, dwFlags: u32, dwError: LRESULT, pV1Reserved: ?*anyopaque, pV2Reserved: ?*anyopaque, dnDevNode: u32, }; pub const ICINFO = extern struct { dwSize: u32, fccType: u32, fccHandler: u32, dwFlags: u32, dwVersion: u32, dwVersionICM: u32, szName: [16]u16, szDescription: [128]u16, szDriver: [128]u16, }; pub const ICCOMPRESS = extern struct { dwFlags: u32, lpbiOutput: ?*BITMAPINFOHEADER, lpOutput: ?*anyopaque, lpbiInput: ?*BITMAPINFOHEADER, lpInput: ?*anyopaque, lpckid: ?*u32, lpdwFlags: ?*u32, lFrameNum: i32, dwFrameSize: u32, dwQuality: u32, lpbiPrev: ?*BITMAPINFOHEADER, lpPrev: ?*anyopaque, }; pub const ICCOMPRESSFRAMES = extern struct { dwFlags: u32, lpbiOutput: ?*BITMAPINFOHEADER, lOutput: LPARAM, lpbiInput: ?*BITMAPINFOHEADER, lInput: LPARAM, lStartFrame: i32, lFrameCount: i32, lQuality: i32, lDataRate: i32, lKeyRate: i32, dwRate: u32, dwScale: u32, dwOverheadPerFrame: u32, dwReserved2: u32, GetData: isize, PutData: isize, }; pub const ICSETSTATUSPROC = extern struct { dwFlags: u32, lParam: LPARAM, Status: isize, }; pub const ICDECOMPRESS = extern struct { dwFlags: u32, lpbiInput: ?*BITMAPINFOHEADER, lpInput: ?*anyopaque, lpbiOutput: ?*BITMAPINFOHEADER, lpOutput: ?*anyopaque, ckid: u32, }; pub const ICDECOMPRESSEX = extern struct { dwFlags: u32, lpbiSrc: ?*BITMAPINFOHEADER, lpSrc: ?*anyopaque, lpbiDst: ?*BITMAPINFOHEADER, lpDst: ?*anyopaque, xDst: i32, yDst: i32, dxDst: i32, dyDst: i32, xSrc: i32, ySrc: i32, dxSrc: i32, dySrc: i32, }; pub const ICDRAWBEGIN = extern struct { dwFlags: u32, hpal: ?HPALETTE, hwnd: ?HWND, hdc: ?HDC, xDst: i32, yDst: i32, dxDst: i32, dyDst: i32, lpbi: ?*BITMAPINFOHEADER, xSrc: i32, ySrc: i32, dxSrc: i32, dySrc: i32, dwRate: u32, dwScale: u32, }; pub const ICDRAW = extern struct { dwFlags: u32, lpFormat: ?*anyopaque, lpData: ?*anyopaque, cbData: u32, lTime: i32, }; pub const ICDRAWSUGGEST = extern struct { lpbiIn: ?*BITMAPINFOHEADER, lpbiSuggest: ?*BITMAPINFOHEADER, dxSrc: i32, dySrc: i32, dxDst: i32, dyDst: i32, hicDecompressor: ?HIC, }; pub const ICPALETTE = extern struct { dwFlags: u32, iStart: i32, iLen: i32, lppe: ?*PALETTEENTRY, }; pub const COMPVARS = extern struct { cbSize: i32, dwFlags: u32, hic: ?HIC, fccType: u32, fccHandler: u32, lpbiIn: ?*BITMAPINFO, lpbiOut: ?*BITMAPINFO, lpBitsOut: ?*anyopaque, lpBitsPrev: ?*anyopaque, lFrame: i32, lKey: i32, lDataRate: i32, lQ: i32, lKeyCount: i32, lpState: ?*anyopaque, cbState: i32, }; pub const DRAWDIBTIME = extern struct { timeCount: i32, timeDraw: i32, timeDecompress: i32, timeDither: i32, timeStretch: i32, timeBlt: i32, timeSetDIBits: i32, }; pub const AVISTREAMINFOW = extern struct { fccType: u32, fccHandler: u32, dwFlags: u32, dwCaps: u32, wPriority: u16, wLanguage: u16, dwScale: u32, dwRate: u32, dwStart: u32, dwLength: u32, dwInitialFrames: u32, dwSuggestedBufferSize: u32, dwQuality: u32, dwSampleSize: u32, rcFrame: RECT, dwEditCount: u32, dwFormatChangeCount: u32, szName: [64]u16, }; pub const AVISTREAMINFOA = extern struct { fccType: u32, fccHandler: u32, dwFlags: u32, dwCaps: u32, wPriority: u16, wLanguage: u16, dwScale: u32, dwRate: u32, dwStart: u32, dwLength: u32, dwInitialFrames: u32, dwSuggestedBufferSize: u32, dwQuality: u32, dwSampleSize: u32, rcFrame: RECT, dwEditCount: u32, dwFormatChangeCount: u32, szName: [64]CHAR, }; pub const AVIFILEINFOW = extern struct { dwMaxBytesPerSec: u32, dwFlags: u32, dwCaps: u32, dwStreams: u32, dwSuggestedBufferSize: u32, dwWidth: u32, dwHeight: u32, dwScale: u32, dwRate: u32, dwLength: u32, dwEditCount: u32, szFileType: [64]u16, }; pub const AVIFILEINFOA = extern struct { dwMaxBytesPerSec: u32, dwFlags: u32, dwCaps: u32, dwStreams: u32, dwSuggestedBufferSize: u32, dwWidth: u32, dwHeight: u32, dwScale: u32, dwRate: u32, dwLength: u32, dwEditCount: u32, szFileType: [64]CHAR, }; pub const AVISAVECALLBACK = fn( param0: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const AVICOMPRESSOPTIONS = extern struct { fccType: u32, fccHandler: u32, dwKeyFrameEvery: u32, dwQuality: u32, dwBytesPerSecond: u32, dwFlags: u32, lpFormat: ?*anyopaque, cbFormat: u32, lpParms: ?*anyopaque, cbParms: u32, dwInterleaveEvery: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IAVIStream_Value = Guid.initString("00020021-0000-0000-c000-000000000046"); pub const IID_IAVIStream = &IID_IAVIStream_Value; pub const IAVIStream = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Create: fn( self: *const IAVIStream, lParam1: LPARAM, lParam2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Info: fn( self: *const IAVIStream, // TODO: what to do with BytesParamIndex 1? psi: ?*AVISTREAMINFOW, lSize: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindSample: fn( self: *const IAVIStream, lPos: i32, lFlags: i32, ) callconv(@import("std").os.windows.WINAPI) i32, ReadFormat: fn( self: *const IAVIStream, lPos: i32, // TODO: what to do with BytesParamIndex 2? lpFormat: ?*anyopaque, lpcbFormat: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFormat: fn( self: *const IAVIStream, lPos: i32, // TODO: what to do with BytesParamIndex 2? lpFormat: ?*anyopaque, cbFormat: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Read: fn( self: *const IAVIStream, lStart: i32, lSamples: i32, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, cbBuffer: i32, plBytes: ?*i32, plSamples: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Write: fn( self: *const IAVIStream, lStart: i32, lSamples: i32, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, cbBuffer: i32, dwFlags: u32, plSampWritten: ?*i32, plBytesWritten: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IAVIStream, lStart: i32, lSamples: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReadData: fn( self: *const IAVIStream, fcc: u32, // TODO: what to do with BytesParamIndex 2? lp: ?*anyopaque, lpcb: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteData: fn( self: *const IAVIStream, fcc: u32, // TODO: what to do with BytesParamIndex 2? lp: ?*anyopaque, cb: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetInfo: fn( self: *const IAVIStream, // TODO: what to do with BytesParamIndex 1? lpInfo: ?*AVISTREAMINFOW, cbInfo: 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 IAVIStream_Create(self: *const T, lParam1: LPARAM, lParam2: LPARAM) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).Create(@ptrCast(*const IAVIStream, self), lParam1, lParam2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_Info(self: *const T, psi: ?*AVISTREAMINFOW, lSize: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).Info(@ptrCast(*const IAVIStream, self), psi, lSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_FindSample(self: *const T, lPos: i32, lFlags: i32) callconv(.Inline) i32 { return @ptrCast(*const IAVIStream.VTable, self.vtable).FindSample(@ptrCast(*const IAVIStream, self), lPos, lFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_ReadFormat(self: *const T, lPos: i32, lpFormat: ?*anyopaque, lpcbFormat: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).ReadFormat(@ptrCast(*const IAVIStream, self), lPos, lpFormat, lpcbFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_SetFormat(self: *const T, lPos: i32, lpFormat: ?*anyopaque, cbFormat: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).SetFormat(@ptrCast(*const IAVIStream, self), lPos, lpFormat, cbFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_Read(self: *const T, lStart: i32, lSamples: i32, lpBuffer: ?*anyopaque, cbBuffer: i32, plBytes: ?*i32, plSamples: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).Read(@ptrCast(*const IAVIStream, self), lStart, lSamples, lpBuffer, cbBuffer, plBytes, plSamples); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_Write(self: *const T, lStart: i32, lSamples: i32, lpBuffer: ?*anyopaque, cbBuffer: i32, dwFlags: u32, plSampWritten: ?*i32, plBytesWritten: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).Write(@ptrCast(*const IAVIStream, self), lStart, lSamples, lpBuffer, cbBuffer, dwFlags, plSampWritten, plBytesWritten); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_Delete(self: *const T, lStart: i32, lSamples: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).Delete(@ptrCast(*const IAVIStream, self), lStart, lSamples); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_ReadData(self: *const T, fcc: u32, lp: ?*anyopaque, lpcb: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).ReadData(@ptrCast(*const IAVIStream, self), fcc, lp, lpcb); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_WriteData(self: *const T, fcc: u32, lp: ?*anyopaque, cb: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).WriteData(@ptrCast(*const IAVIStream, self), fcc, lp, cb); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStream_SetInfo(self: *const T, lpInfo: ?*AVISTREAMINFOW, cbInfo: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStream.VTable, self.vtable).SetInfo(@ptrCast(*const IAVIStream, self), lpInfo, cbInfo); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IAVIStreaming_Value = Guid.initString("00020022-0000-0000-c000-000000000046"); pub const IID_IAVIStreaming = &IID_IAVIStreaming_Value; pub const IAVIStreaming = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin: fn( self: *const IAVIStreaming, lStart: i32, lEnd: i32, lRate: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, End: fn( self: *const IAVIStreaming, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStreaming_Begin(self: *const T, lStart: i32, lEnd: i32, lRate: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStreaming.VTable, self.vtable).Begin(@ptrCast(*const IAVIStreaming, self), lStart, lEnd, lRate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIStreaming_End(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIStreaming.VTable, self.vtable).End(@ptrCast(*const IAVIStreaming, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IAVIEditStream_Value = Guid.initString("00020024-0000-0000-c000-000000000046"); pub const IID_IAVIEditStream = &IID_IAVIEditStream_Value; pub const IAVIEditStream = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Cut: fn( self: *const IAVIEditStream, plStart: ?*i32, plLength: ?*i32, ppResult: ?*?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Copy: fn( self: *const IAVIEditStream, plStart: ?*i32, plLength: ?*i32, ppResult: ?*?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Paste: fn( self: *const IAVIEditStream, plPos: ?*i32, plLength: ?*i32, pstream: ?*IAVIStream, lStart: i32, lEnd: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IAVIEditStream, ppResult: ?*?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetInfo: fn( self: *const IAVIEditStream, // TODO: what to do with BytesParamIndex 1? lpInfo: ?*AVISTREAMINFOW, cbInfo: 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 IAVIEditStream_Cut(self: *const T, plStart: ?*i32, plLength: ?*i32, ppResult: ?*?*IAVIStream) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIEditStream.VTable, self.vtable).Cut(@ptrCast(*const IAVIEditStream, self), plStart, plLength, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIEditStream_Copy(self: *const T, plStart: ?*i32, plLength: ?*i32, ppResult: ?*?*IAVIStream) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIEditStream.VTable, self.vtable).Copy(@ptrCast(*const IAVIEditStream, self), plStart, plLength, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIEditStream_Paste(self: *const T, plPos: ?*i32, plLength: ?*i32, pstream: ?*IAVIStream, lStart: i32, lEnd: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIEditStream.VTable, self.vtable).Paste(@ptrCast(*const IAVIEditStream, self), plPos, plLength, pstream, lStart, lEnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIEditStream_Clone(self: *const T, ppResult: ?*?*IAVIStream) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIEditStream.VTable, self.vtable).Clone(@ptrCast(*const IAVIEditStream, self), ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIEditStream_SetInfo(self: *const T, lpInfo: ?*AVISTREAMINFOW, cbInfo: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIEditStream.VTable, self.vtable).SetInfo(@ptrCast(*const IAVIEditStream, self), lpInfo, cbInfo); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAVIPersistFile_Value = Guid.initString("00020025-0000-0000-c000-000000000046"); pub const IID_IAVIPersistFile = &IID_IAVIPersistFile_Value; pub const IAVIPersistFile = extern struct { pub const VTable = extern struct { base: IPersistFile.VTable, Reserved1: fn( self: *const IAVIPersistFile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersistFile.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIPersistFile_Reserved1(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIPersistFile.VTable, self.vtable).Reserved1(@ptrCast(*const IAVIPersistFile, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IAVIFile_Value = Guid.initString("00020020-0000-0000-c000-000000000046"); pub const IID_IAVIFile = &IID_IAVIFile_Value; pub const IAVIFile = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Info: fn( self: *const IAVIFile, // TODO: what to do with BytesParamIndex 1? pfi: ?*AVIFILEINFOW, lSize: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStream: fn( self: *const IAVIFile, ppStream: ?*?*IAVIStream, fccType: u32, lParam: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateStream: fn( self: *const IAVIFile, ppStream: ?*?*IAVIStream, psi: ?*AVISTREAMINFOW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteData: fn( self: *const IAVIFile, ckid: u32, // TODO: what to do with BytesParamIndex 2? lpData: ?*anyopaque, cbData: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReadData: fn( self: *const IAVIFile, ckid: u32, // TODO: what to do with BytesParamIndex 2? lpData: ?*anyopaque, lpcbData: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EndRecord: fn( self: *const IAVIFile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteStream: fn( self: *const IAVIFile, fccType: u32, lParam: 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 IAVIFile_Info(self: *const T, pfi: ?*AVIFILEINFOW, lSize: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIFile.VTable, self.vtable).Info(@ptrCast(*const IAVIFile, self), pfi, lSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIFile_GetStream(self: *const T, ppStream: ?*?*IAVIStream, fccType: u32, lParam: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIFile.VTable, self.vtable).GetStream(@ptrCast(*const IAVIFile, self), ppStream, fccType, lParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIFile_CreateStream(self: *const T, ppStream: ?*?*IAVIStream, psi: ?*AVISTREAMINFOW) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIFile.VTable, self.vtable).CreateStream(@ptrCast(*const IAVIFile, self), ppStream, psi); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIFile_WriteData(self: *const T, ckid: u32, lpData: ?*anyopaque, cbData: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIFile.VTable, self.vtable).WriteData(@ptrCast(*const IAVIFile, self), ckid, lpData, cbData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIFile_ReadData(self: *const T, ckid: u32, lpData: ?*anyopaque, lpcbData: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIFile.VTable, self.vtable).ReadData(@ptrCast(*const IAVIFile, self), ckid, lpData, lpcbData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIFile_EndRecord(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIFile.VTable, self.vtable).EndRecord(@ptrCast(*const IAVIFile, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAVIFile_DeleteStream(self: *const T, fccType: u32, lParam: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAVIFile.VTable, self.vtable).DeleteStream(@ptrCast(*const IAVIFile, self), fccType, lParam); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IGetFrame_Value = Guid.initString("00020023-0000-0000-c000-000000000046"); pub const IID_IGetFrame = &IID_IGetFrame_Value; pub const IGetFrame = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetFrame: fn( self: *const IGetFrame, lPos: i32, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque, Begin: fn( self: *const IGetFrame, lStart: i32, lEnd: i32, lRate: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, End: fn( self: *const IGetFrame, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFormat: fn( self: *const IGetFrame, lpbi: ?*BITMAPINFOHEADER, lpBits: ?*anyopaque, x: i32, y: i32, dx: i32, dy: 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 IGetFrame_GetFrame(self: *const T, lPos: i32) callconv(.Inline) ?*anyopaque { return @ptrCast(*const IGetFrame.VTable, self.vtable).GetFrame(@ptrCast(*const IGetFrame, self), lPos); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetFrame_Begin(self: *const T, lStart: i32, lEnd: i32, lRate: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IGetFrame.VTable, self.vtable).Begin(@ptrCast(*const IGetFrame, self), lStart, lEnd, lRate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetFrame_End(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IGetFrame.VTable, self.vtable).End(@ptrCast(*const IGetFrame, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetFrame_SetFormat(self: *const T, lpbi: ?*BITMAPINFOHEADER, lpBits: ?*anyopaque, x: i32, y: i32, dx: i32, dy: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IGetFrame.VTable, self.vtable).SetFormat(@ptrCast(*const IGetFrame, self), lpbi, lpBits, x, y, dx, dy); } };} pub usingnamespace MethodMixin(@This()); }; pub const VIDEOHDR = extern struct { lpData: ?*u8, dwBufferLength: u32, dwBytesUsed: u32, dwTimeCaptured: u32, dwUser: usize, dwFlags: u32, dwReserved: [4]usize, }; pub const CHANNEL_CAPS = extern struct { dwFlags: u32, dwSrcRectXMod: u32, dwSrcRectYMod: u32, dwSrcRectWidthMod: u32, dwSrcRectHeightMod: u32, dwDstRectXMod: u32, dwDstRectYMod: u32, dwDstRectWidthMod: u32, dwDstRectHeightMod: u32, }; pub const CAPDRIVERCAPS = extern struct { wDeviceIndex: u32, fHasOverlay: BOOL, fHasDlgVideoSource: BOOL, fHasDlgVideoFormat: BOOL, fHasDlgVideoDisplay: BOOL, fCaptureInitialized: BOOL, fDriverSuppliesPalettes: BOOL, hVideoIn: ?HANDLE, hVideoOut: ?HANDLE, hVideoExtIn: ?HANDLE, hVideoExtOut: ?HANDLE, }; pub const CAPSTATUS = extern struct { uiImageWidth: u32, uiImageHeight: u32, fLiveWindow: BOOL, fOverlayWindow: BOOL, fScale: BOOL, ptScroll: POINT, fUsingDefaultPalette: BOOL, fAudioHardware: BOOL, fCapFileExists: BOOL, dwCurrentVideoFrame: u32, dwCurrentVideoFramesDropped: u32, dwCurrentWaveSamples: u32, dwCurrentTimeElapsedMS: u32, hPalCurrent: ?HPALETTE, fCapturingNow: BOOL, dwReturn: u32, wNumVideoAllocated: u32, wNumAudioAllocated: u32, }; pub const CAPTUREPARMS = extern struct { dwRequestMicroSecPerFrame: u32, fMakeUserHitOKToCapture: BOOL, wPercentDropForError: u32, fYield: BOOL, dwIndexSize: u32, wChunkGranularity: u32, fUsingDOSMemory: BOOL, wNumVideoRequested: u32, fCaptureAudio: BOOL, wNumAudioRequested: u32, vKeyAbort: u32, fAbortLeftMouse: BOOL, fAbortRightMouse: BOOL, fLimitEnabled: BOOL, wTimeLimit: u32, fMCIControl: BOOL, fStepMCIDevice: BOOL, dwMCIStartTime: u32, dwMCIStopTime: u32, fStepCaptureAt2x: BOOL, wStepCaptureAverageFrames: u32, dwAudioBufferSize: u32, fDisableWriteCache: BOOL, AVStreamMaster: u32, }; pub const CAPINFOCHUNK = extern struct { fccInfoID: u32, lpData: ?*anyopaque, cbData: i32, }; pub const CAPYIELDCALLBACK = fn( hWnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const CAPSTATUSCALLBACKW = fn( hWnd: ?HWND, nID: i32, lpsz: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const CAPERRORCALLBACKW = fn( hWnd: ?HWND, nID: i32, lpsz: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const CAPSTATUSCALLBACKA = fn( hWnd: ?HWND, nID: i32, lpsz: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const CAPERRORCALLBACKA = fn( hWnd: ?HWND, nID: i32, lpsz: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const CAPVIDEOCALLBACK = fn( hWnd: ?HWND, lpVHdr: ?*VIDEOHDR, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const CAPWAVECALLBACK = fn( hWnd: ?HWND, lpWHdr: ?*WAVEHDR, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const CAPCONTROLCALLBACK = fn( hWnd: ?HWND, nState: i32, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub const DRVM_IOCTL_DATA = packed struct { dwSize: u32, dwCmd: u32, }; pub const WAVEOPENDESC = packed struct { hWave: ?HWAVE, lpFormat: ?*WAVEFORMAT, dwCallback: usize, dwInstance: usize, uMappedDeviceID: u32, dnDevNode: usize, }; pub const MIDIOPENSTRMID = packed struct { dwStreamID: u32, uDeviceID: u32, }; pub const MIXEROPENDESC = packed struct { hmx: ?HMIXER, pReserved0: ?*anyopaque, dwCallback: usize, dwInstance: usize, dnDevNode: usize, }; pub const TIMEREVENT = packed struct { wDelay: u16, wResolution: u16, lpFunction: ?LPTIMECALLBACK, dwUser: u32, wFlags: u16, wReserved1: u16, }; pub const MCI_OPEN_DRIVER_PARMS = packed struct { wDeviceID: u32, lpstrParams: ?[*:0]const u16, wCustomCommandTable: u32, wType: u32, }; pub const LPTASKCALLBACK = fn( dwInst: usize, ) callconv(@import("std").os.windows.WINAPI) void; pub const VFWWDMExtensionProc = fn( pfnDeviceIoControl: ?*anyopaque, pfnAddPropertyPage: ?LPFNSVADDPROPSHEETPAGE, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const LPFNEXTDEVIO = fn( lParam: LPARAM, dwFlags: u32, dwIoControlCode: u32, lpInBuffer: ?*anyopaque, nInBufferSize: u32, lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, lpOverlapped: ?*OVERLAPPED, ) callconv(@import("std").os.windows.WINAPI) BOOL; //-------------------------------------------------------------------------------- // Section: Functions (170) //-------------------------------------------------------------------------------- pub extern "WINMM" fn mciSendCommandA( mciId: u32, uMsg: u32, dwParam1: usize, dwParam2: usize, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciSendCommandW( mciId: u32, uMsg: u32, dwParam1: usize, dwParam2: usize, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciSendStringA( lpstrCommand: ?[*:0]const u8, lpstrReturnString: ?[*:0]u8, uReturnLength: u32, hwndCallback: ?HWND, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciSendStringW( lpstrCommand: ?[*:0]const u16, lpstrReturnString: ?[*:0]u16, uReturnLength: u32, hwndCallback: ?HWND, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetDeviceIDA( pszDevice: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetDeviceIDW( pszDevice: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetDeviceIDFromElementIDA( dwElementID: u32, lpstrType: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetDeviceIDFromElementIDW( dwElementID: u32, lpstrType: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetErrorStringA( mcierr: u32, pszText: [*:0]u8, cchText: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciGetErrorStringW( mcierr: u32, pszText: [*:0]u16, cchText: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciSetYieldProc( mciId: u32, fpYieldProc: ?YIELDPROC, dwYieldData: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciGetCreatorTask( mciId: u32, ) callconv(@import("std").os.windows.WINAPI) ?HTASK; pub extern "WINMM" fn mciGetYieldProc( mciId: u32, pdwYieldData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?YIELDPROC; pub extern "WINMM" fn mciGetDriverData( wDeviceID: u32, ) callconv(@import("std").os.windows.WINAPI) usize; pub extern "WINMM" fn mciLoadCommandResource( hInstance: ?HANDLE, lpResName: ?[*:0]const u16, wType: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciSetDriverData( wDeviceID: u32, dwData: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciDriverYield( wDeviceID: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciDriverNotify( hwndCallback: ?HANDLE, wDeviceID: u32, uStatus: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciFreeCommandResource( wTable: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn CloseDriver( hDriver: ?HDRVR, lParam1: LPARAM, lParam2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn OpenDriver( szDriverName: ?[*:0]const u16, szSectionName: ?[*:0]const u16, lParam2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) ?HDRVR; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn SendDriverMessage( hDriver: ?HDRVR, message: u32, lParam1: LPARAM, lParam2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn DrvGetModuleHandle( hDriver: ?HDRVR, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn GetDriverModuleHandle( hDriver: ?HDRVR, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn DefDriverProc( dwDriverIdentifier: usize, hdrvr: ?HDRVR, uMsg: u32, lParam1: LPARAM, lParam2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn DriverCallback( dwCallback: usize, dwFlags: u32, hDevice: ?HDRVR, dwMsg: u32, dwUser: usize, dwParam1: usize, dwParam2: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "api-ms-win-mm-misc-l1-1-1" fn sndOpenSound( EventName: ?[*:0]const u16, AppName: ?[*:0]const u16, Flags: i32, FileHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "WINMM" fn mmDrvInstall( hDriver: ?HDRVR, wszDrvEntry: ?[*:0]const u16, drvMessage: ?DRIVERMSGPROC, wFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioStringToFOURCCA( sz: ?[*:0]const u8, uFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioStringToFOURCCW( sz: ?[*:0]const u16, uFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioInstallIOProcA( fccIOProc: u32, pIOProc: ?LPMMIOPROC, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?LPMMIOPROC; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioInstallIOProcW( fccIOProc: u32, pIOProc: ?LPMMIOPROC, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?LPMMIOPROC; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioOpenA( pszFileName: ?*[128]u8, pmmioinfo: ?*MMIOINFO, fdwOpen: u32, ) callconv(@import("std").os.windows.WINAPI) ?HMMIO; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioOpenW( pszFileName: ?*[128]u16, pmmioinfo: ?*MMIOINFO, fdwOpen: u32, ) callconv(@import("std").os.windows.WINAPI) ?HMMIO; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioRenameA( pszFileName: ?[*:0]const u8, pszNewFileName: ?[*:0]const u8, pmmioinfo: ?*MMIOINFO, fdwRename: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioRenameW( pszFileName: ?[*:0]const u16, pszNewFileName: ?[*:0]const u16, pmmioinfo: ?*MMIOINFO, fdwRename: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioClose( hmmio: ?HMMIO, fuClose: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioRead( hmmio: ?HMMIO, // TODO: what to do with BytesParamIndex 2? pch: ?*i8, cch: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioWrite( hmmio: ?HMMIO, // TODO: what to do with BytesParamIndex 2? pch: ?[*:0]const u8, cch: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioSeek( hmmio: ?HMMIO, lOffset: i32, iOrigin: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioGetInfo( hmmio: ?HMMIO, pmmioinfo: ?*MMIOINFO, fuInfo: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioSetInfo( hmmio: ?HMMIO, pmmioinfo: ?*MMIOINFO, fuInfo: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioSetBuffer( hmmio: ?HMMIO, pchBuffer: ?[*:0]u8, cchBuffer: i32, fuBuffer: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioFlush( hmmio: ?HMMIO, fuFlush: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioAdvance( hmmio: ?HMMIO, pmmioinfo: ?*MMIOINFO, fuAdvance: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioSendMessage( hmmio: ?HMMIO, uMsg: u32, lParam1: LPARAM, lParam2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioDescend( hmmio: ?HMMIO, pmmcki: ?*MMCKINFO, pmmckiParent: ?*const MMCKINFO, fuDescend: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioAscend( hmmio: ?HMMIO, pmmcki: ?*MMCKINFO, fuAscend: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn mmioCreateChunk( hmmio: ?HMMIO, pmmcki: ?*MMCKINFO, fuCreate: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn joyGetPosEx( uJoyID: u32, pji: ?*JOYINFOEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn joyGetNumDevs( ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn joyGetDevCapsA( uJoyID: usize, // TODO: what to do with BytesParamIndex 2? pjc: ?*JOYCAPSA, cbjc: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn joyGetDevCapsW( uJoyID: usize, // TODO: what to do with BytesParamIndex 2? pjc: ?*JOYCAPSW, cbjc: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn joyGetPos( uJoyID: u32, pji: ?*JOYINFO, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn joyGetThreshold( uJoyID: u32, puThreshold: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn joyReleaseCapture( uJoyID: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn joySetCapture( hwnd: ?HWND, uJoyID: u32, uPeriod: u32, fChanged: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn joySetThreshold( uJoyID: u32, uThreshold: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "MSVFW32" fn VideoForWindowsVersion( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICInfo( fccType: u32, fccHandler: u32, lpicinfo: ?*ICINFO, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICInstall( fccType: u32, fccHandler: u32, lParam: LPARAM, szDesc: ?PSTR, wFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICRemove( fccType: u32, fccHandler: u32, wFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICGetInfo( hic: ?HIC, // TODO: what to do with BytesParamIndex 2? picinfo: ?*ICINFO, cb: u32, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICOpen( fccType: u32, fccHandler: u32, wMode: u32, ) callconv(@import("std").os.windows.WINAPI) ?HIC; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICOpenFunction( fccType: u32, fccHandler: u32, wMode: u32, lpfnHandler: ?FARPROC, ) callconv(@import("std").os.windows.WINAPI) ?HIC; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICClose( hic: ?HIC, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICSendMessage( hic: ?HIC, msg: u32, dw1: usize, dw2: usize, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICCompress( hic: ?HIC, dwFlags: u32, lpbiOutput: ?*BITMAPINFOHEADER, lpData: ?*anyopaque, lpbiInput: ?*BITMAPINFOHEADER, lpBits: ?*anyopaque, lpckid: ?*u32, lpdwFlags: ?*u32, lFrameNum: i32, dwFrameSize: u32, dwQuality: u32, lpbiPrev: ?*BITMAPINFOHEADER, lpPrev: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICDecompress( hic: ?HIC, dwFlags: u32, lpbiFormat: ?*BITMAPINFOHEADER, lpData: ?*anyopaque, lpbi: ?*BITMAPINFOHEADER, lpBits: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICDrawBegin( hic: ?HIC, dwFlags: u32, hpal: ?HPALETTE, hwnd: ?HWND, hdc: ?HDC, xDst: i32, yDst: i32, dxDst: i32, dyDst: i32, lpbi: ?*BITMAPINFOHEADER, xSrc: i32, ySrc: i32, dxSrc: i32, dySrc: i32, dwRate: u32, dwScale: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICDraw( hic: ?HIC, dwFlags: u32, lpFormat: ?*anyopaque, // TODO: what to do with BytesParamIndex 4? lpData: ?*anyopaque, cbData: u32, lTime: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICLocate( fccType: u32, fccHandler: u32, lpbiIn: ?*BITMAPINFOHEADER, lpbiOut: ?*BITMAPINFOHEADER, wFlags: u16, ) callconv(@import("std").os.windows.WINAPI) ?HIC; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICGetDisplayFormat( hic: ?HIC, lpbiIn: ?*BITMAPINFOHEADER, lpbiOut: ?*BITMAPINFOHEADER, BitDepth: i32, dx: i32, dy: i32, ) callconv(@import("std").os.windows.WINAPI) ?HIC; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICImageCompress( hic: ?HIC, uiFlags: u32, lpbiIn: ?*BITMAPINFO, lpBits: ?*anyopaque, lpbiOut: ?*BITMAPINFO, lQuality: i32, plSize: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICImageDecompress( hic: ?HIC, uiFlags: u32, lpbiIn: ?*BITMAPINFO, lpBits: ?*anyopaque, lpbiOut: ?*BITMAPINFO, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICCompressorChoose( hwnd: ?HWND, uiFlags: u32, pvIn: ?*anyopaque, lpData: ?*anyopaque, pc: ?*COMPVARS, lpszTitle: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICSeqCompressFrameStart( pc: ?*COMPVARS, lpbiIn: ?*BITMAPINFO, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICSeqCompressFrameEnd( pc: ?*COMPVARS, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICSeqCompressFrame( pc: ?*COMPVARS, uiFlags: u32, lpBits: ?*anyopaque, pfKey: ?*BOOL, plSize: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn ICCompressorFree( pc: ?*COMPVARS, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibOpen( ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibClose( hdd: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibGetBuffer( hdd: isize, lpbi: ?*BITMAPINFOHEADER, dwSize: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibGetPalette( hdd: isize, ) callconv(@import("std").os.windows.WINAPI) ?HPALETTE; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibSetPalette( hdd: isize, hpal: ?HPALETTE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibChangePalette( hdd: isize, iStart: i32, iLen: i32, lppe: [*]PALETTEENTRY, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibRealize( hdd: isize, hdc: ?HDC, fBackground: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibStart( hdd: isize, rate: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibStop( hdd: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibBegin( hdd: isize, hdc: ?HDC, dxDst: i32, dyDst: i32, lpbi: ?*BITMAPINFOHEADER, dxSrc: i32, dySrc: i32, wFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibDraw( hdd: isize, hdc: ?HDC, xDst: i32, yDst: i32, dxDst: i32, dyDst: i32, lpbi: ?*BITMAPINFOHEADER, lpBits: ?*anyopaque, xSrc: i32, ySrc: i32, dxSrc: i32, dySrc: i32, wFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibEnd( hdd: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibTime( hdd: isize, lpddtime: ?*DRAWDIBTIME, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn DrawDibProfileDisplay( lpbi: ?*BITMAPINFOHEADER, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileInit( ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileExit( ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileAddRef( pfile: ?*IAVIFile, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileRelease( pfile: ?*IAVIFile, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileOpenA( ppfile: ?*?*IAVIFile, szFile: ?[*:0]const u8, uMode: u32, lpHandler: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileOpenW( ppfile: ?*?*IAVIFile, szFile: ?[*:0]const u16, uMode: u32, lpHandler: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileInfoW( pfile: ?*IAVIFile, // TODO: what to do with BytesParamIndex 2? pfi: ?*AVIFILEINFOW, lSize: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileInfoA( pfile: ?*IAVIFile, // TODO: what to do with BytesParamIndex 2? pfi: ?*AVIFILEINFOA, lSize: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileGetStream( pfile: ?*IAVIFile, ppavi: ?*?*IAVIStream, fccType: u32, lParam: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileCreateStreamW( pfile: ?*IAVIFile, ppavi: ?*?*IAVIStream, psi: ?*AVISTREAMINFOW, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileCreateStreamA( pfile: ?*IAVIFile, ppavi: ?*?*IAVIStream, psi: ?*AVISTREAMINFOA, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileWriteData( pfile: ?*IAVIFile, ckid: u32, // TODO: what to do with BytesParamIndex 3? lpData: ?*anyopaque, cbData: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileReadData( pfile: ?*IAVIFile, ckid: u32, // TODO: what to do with BytesParamIndex 3? lpData: ?*anyopaque, lpcbData: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIFileEndRecord( pfile: ?*IAVIFile, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamAddRef( pavi: ?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamRelease( pavi: ?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamInfoW( pavi: ?*IAVIStream, // TODO: what to do with BytesParamIndex 2? psi: ?*AVISTREAMINFOW, lSize: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamInfoA( pavi: ?*IAVIStream, // TODO: what to do with BytesParamIndex 2? psi: ?*AVISTREAMINFOA, lSize: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamFindSample( pavi: ?*IAVIStream, lPos: i32, lFlags: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamReadFormat( pavi: ?*IAVIStream, lPos: i32, // TODO: what to do with BytesParamIndex 3? lpFormat: ?*anyopaque, lpcbFormat: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamSetFormat( pavi: ?*IAVIStream, lPos: i32, // TODO: what to do with BytesParamIndex 3? lpFormat: ?*anyopaque, cbFormat: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamReadData( pavi: ?*IAVIStream, fcc: u32, // TODO: what to do with BytesParamIndex 3? lp: ?*anyopaque, lpcb: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamWriteData( pavi: ?*IAVIStream, fcc: u32, // TODO: what to do with BytesParamIndex 3? lp: ?*anyopaque, cb: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamRead( pavi: ?*IAVIStream, lStart: i32, lSamples: i32, // TODO: what to do with BytesParamIndex 4? lpBuffer: ?*anyopaque, cbBuffer: i32, plBytes: ?*i32, plSamples: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamWrite( pavi: ?*IAVIStream, lStart: i32, lSamples: i32, // TODO: what to do with BytesParamIndex 4? lpBuffer: ?*anyopaque, cbBuffer: i32, dwFlags: u32, plSampWritten: ?*i32, plBytesWritten: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamStart( pavi: ?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamLength( pavi: ?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamTimeToSample( pavi: ?*IAVIStream, lTime: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamSampleToTime( pavi: ?*IAVIStream, lSample: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamBeginStreaming( pavi: ?*IAVIStream, lStart: i32, lEnd: i32, lRate: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamEndStreaming( pavi: ?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamGetFrameOpen( pavi: ?*IAVIStream, lpbiWanted: ?*BITMAPINFOHEADER, ) callconv(@import("std").os.windows.WINAPI) ?*IGetFrame; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamGetFrame( pg: ?*IGetFrame, lPos: i32, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamGetFrameClose( pg: ?*IGetFrame, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamOpenFromFileA( ppavi: ?*?*IAVIStream, szFile: ?[*:0]const u8, fccType: u32, lParam: i32, mode: u32, pclsidHandler: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamOpenFromFileW( ppavi: ?*?*IAVIStream, szFile: ?[*:0]const u16, fccType: u32, lParam: i32, mode: u32, pclsidHandler: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIStreamCreate( ppavi: ?*?*IAVIStream, lParam1: i32, lParam2: i32, pclsidHandler: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIMakeCompressedStream( ppsCompressed: ?*?*IAVIStream, ppsSource: ?*IAVIStream, lpOptions: ?*AVICOMPRESSOPTIONS, pclsidHandler: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVISaveA( szFile: ?[*:0]const u8, pclsidHandler: ?*Guid, lpfnCallback: ?AVISAVECALLBACK, nStreams: i32, pfile: ?*IAVIStream, lpOptions: ?*AVICOMPRESSOPTIONS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVISaveVA( szFile: ?[*:0]const u8, pclsidHandler: ?*Guid, lpfnCallback: ?AVISAVECALLBACK, nStreams: i32, ppavi: [*]?*IAVIStream, plpOptions: [*]?*AVICOMPRESSOPTIONS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVISaveW( szFile: ?[*:0]const u16, pclsidHandler: ?*Guid, lpfnCallback: ?AVISAVECALLBACK, nStreams: i32, pfile: ?*IAVIStream, lpOptions: ?*AVICOMPRESSOPTIONS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVISaveVW( szFile: ?[*:0]const u16, pclsidHandler: ?*Guid, lpfnCallback: ?AVISAVECALLBACK, nStreams: i32, ppavi: [*]?*IAVIStream, plpOptions: [*]?*AVICOMPRESSOPTIONS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVISaveOptions( hwnd: ?HWND, uiFlags: u32, nStreams: i32, ppavi: [*]?*IAVIStream, plpOptions: [*]?*AVICOMPRESSOPTIONS, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVISaveOptionsFree( nStreams: i32, plpOptions: [*]?*AVICOMPRESSOPTIONS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIBuildFilterW( lpszFilter: [*:0]u16, cbFilter: i32, fSaving: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIBuildFilterA( lpszFilter: [*:0]u8, cbFilter: i32, fSaving: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIMakeFileFromStreams( ppfile: ?*?*IAVIFile, nStreams: i32, papStreams: [*]?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIMakeStreamFromClipboard( cfFormat: u32, hGlobal: ?HANDLE, ppstream: ?*?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIPutFileOnClipboard( pf: ?*IAVIFile, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIGetFromClipboard( lppf: ?*?*IAVIFile, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn AVIClearClipboard( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn CreateEditableStream( ppsEditable: ?*?*IAVIStream, psSource: ?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn EditStreamCut( pavi: ?*IAVIStream, plStart: ?*i32, plLength: ?*i32, ppResult: ?*?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn EditStreamCopy( pavi: ?*IAVIStream, plStart: ?*i32, plLength: ?*i32, ppResult: ?*?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn EditStreamPaste( pavi: ?*IAVIStream, plPos: ?*i32, plLength: ?*i32, pstream: ?*IAVIStream, lStart: i32, lEnd: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn EditStreamClone( pavi: ?*IAVIStream, ppResult: ?*?*IAVIStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn EditStreamSetNameA( pavi: ?*IAVIStream, lpszName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn EditStreamSetNameW( pavi: ?*IAVIStream, lpszName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn EditStreamSetInfoW( pavi: ?*IAVIStream, // TODO: what to do with BytesParamIndex 2? lpInfo: ?*AVISTREAMINFOW, cbInfo: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "AVIFIL32" fn EditStreamSetInfoA( pavi: ?*IAVIStream, // TODO: what to do with BytesParamIndex 2? lpInfo: ?*AVISTREAMINFOA, cbInfo: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn MCIWndCreateA( hwndParent: ?HWND, hInstance: ?HINSTANCE, dwStyle: u32, szFile: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?HWND; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn MCIWndCreateW( hwndParent: ?HWND, hInstance: ?HINSTANCE, dwStyle: u32, szFile: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?HWND; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn MCIWndRegisterClass( ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "AVICAP32" fn capCreateCaptureWindowA( lpszWindowName: ?[*:0]const u8, dwStyle: u32, x: i32, y: i32, nWidth: i32, nHeight: i32, hwndParent: ?HWND, nID: i32, ) callconv(@import("std").os.windows.WINAPI) ?HWND; // TODO: this type is limited to platform 'windows5.0' pub extern "AVICAP32" fn capGetDriverDescriptionA( wDriverIndex: u32, lpszName: [*:0]u8, cbName: i32, lpszVer: [*:0]u8, cbVer: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "AVICAP32" fn capCreateCaptureWindowW( lpszWindowName: ?[*:0]const u16, dwStyle: u32, x: i32, y: i32, nWidth: i32, nHeight: i32, hwndParent: ?HWND, nID: i32, ) callconv(@import("std").os.windows.WINAPI) ?HWND; // TODO: this type is limited to platform 'windows5.0' pub extern "AVICAP32" fn capGetDriverDescriptionW( wDriverIndex: u32, lpszName: [*:0]u16, cbName: i32, lpszVer: [*:0]u16, cbVer: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn GetOpenFileNamePreviewA( lpofn: ?*OPENFILENAMEA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn GetSaveFileNamePreviewA( lpofn: ?*OPENFILENAMEA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn GetOpenFileNamePreviewW( lpofn: ?*OPENFILENAMEW, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "MSVFW32" fn GetSaveFileNamePreviewW( lpofn: ?*OPENFILENAMEW, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mmTaskCreate( lpfn: ?LPTASKCALLBACK, lph: ?*?HANDLE, dwInst: usize, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mmTaskBlock( h: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "WINMM" fn mmTaskSignal( h: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mmTaskYield( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "WINMM" fn mmGetCurrentTask( ) callconv(@import("std").os.windows.WINAPI) u32; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (56) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const MCI_OPEN_PARMS = thismodule.MCI_OPEN_PARMSA; pub const MCI_INFO_PARMS = thismodule.MCI_INFO_PARMSA; pub const MCI_SYSINFO_PARMS = thismodule.MCI_SYSINFO_PARMSA; pub const MCI_SAVE_PARMS = thismodule.MCI_SAVE_PARMSA; pub const MCI_LOAD_PARMS = thismodule.MCI_LOAD_PARMSA; pub const MCI_VD_ESCAPE_PARMS = thismodule.MCI_VD_ESCAPE_PARMSA; pub const MCI_WAVE_OPEN_PARMS = thismodule.MCI_WAVE_OPEN_PARMSA; pub const MCI_ANIM_OPEN_PARMS = thismodule.MCI_ANIM_OPEN_PARMSA; pub const MCI_ANIM_WINDOW_PARMS = thismodule.MCI_ANIM_WINDOW_PARMSA; pub const MCI_OVLY_OPEN_PARMS = thismodule.MCI_OVLY_OPEN_PARMSA; pub const MCI_OVLY_WINDOW_PARMS = thismodule.MCI_OVLY_WINDOW_PARMSA; pub const MCI_OVLY_SAVE_PARMS = thismodule.MCI_OVLY_SAVE_PARMSA; pub const MCI_OVLY_LOAD_PARMS = thismodule.MCI_OVLY_LOAD_PARMSA; pub const JOYCAPS = thismodule.JOYCAPSA; pub const JOYCAPS2 = thismodule.JOYCAPS2A; pub const MCI_DGV_CAPTURE_PARMS = thismodule.MCI_DGV_CAPTURE_PARMSA; pub const MCI_DGV_INFO_PARMS = thismodule.MCI_DGV_INFO_PARMSA; pub const MCI_DGV_LIST_PARMS = thismodule.MCI_DGV_LIST_PARMSA; pub const MCI_DGV_OPEN_PARMS = thismodule.MCI_DGV_OPEN_PARMSA; pub const MCI_DGV_QUALITY_PARMS = thismodule.MCI_DGV_QUALITY_PARMSA; pub const MCI_DGV_RESERVE_PARMS = thismodule.MCI_DGV_RESERVE_PARMSA; pub const MCI_DGV_RESTORE_PARMS = thismodule.MCI_DGV_RESTORE_PARMSA; pub const MCI_DGV_SAVE_PARMS = thismodule.MCI_DGV_SAVE_PARMSA; pub const MCI_DGV_SETAUDIO_PARMS = thismodule.MCI_DGV_SETAUDIO_PARMSA; pub const MCI_DGV_SETVIDEO_PARMS = thismodule.MCI_DGV_SETVIDEO_PARMSA; pub const MCI_DGV_STATUS_PARMS = thismodule.MCI_DGV_STATUS_PARMSA; pub const MCI_DGV_WINDOW_PARMS = thismodule.MCI_DGV_WINDOW_PARMSA; pub const AVISTREAMINFO = thismodule.AVISTREAMINFOA; pub const AVIFILEINFO = thismodule.AVIFILEINFOA; pub const CAPSTATUSCALLBACK = thismodule.CAPSTATUSCALLBACKA; pub const CAPERRORCALLBACK = thismodule.CAPERRORCALLBACKA; pub const mciSendCommand = thismodule.mciSendCommandA; pub const mciSendString = thismodule.mciSendStringA; pub const mciGetDeviceID = thismodule.mciGetDeviceIDA; pub const mciGetDeviceIDFromElementID = thismodule.mciGetDeviceIDFromElementIDA; pub const mciGetErrorString = thismodule.mciGetErrorStringA; pub const mmioStringToFOURCC = thismodule.mmioStringToFOURCCA; pub const mmioInstallIOProc = thismodule.mmioInstallIOProcA; pub const mmioOpen = thismodule.mmioOpenA; pub const mmioRename = thismodule.mmioRenameA; pub const joyGetDevCaps = thismodule.joyGetDevCapsA; pub const AVIFileOpen = thismodule.AVIFileOpenA; pub const AVIFileInfo = thismodule.AVIFileInfoA; pub const AVIFileCreateStream = thismodule.AVIFileCreateStreamA; pub const AVIStreamInfo = thismodule.AVIStreamInfoA; pub const AVIStreamOpenFromFile = thismodule.AVIStreamOpenFromFileA; pub const AVISave = thismodule.AVISaveA; pub const AVISaveV = thismodule.AVISaveVA; pub const AVIBuildFilter = thismodule.AVIBuildFilterA; pub const EditStreamSetName = thismodule.EditStreamSetNameA; pub const EditStreamSetInfo = thismodule.EditStreamSetInfoA; pub const MCIWndCreate = thismodule.MCIWndCreateA; pub const capCreateCaptureWindow = thismodule.capCreateCaptureWindowA; pub const capGetDriverDescription = thismodule.capGetDriverDescriptionA; pub const GetOpenFileNamePreview = thismodule.GetOpenFileNamePreviewA; pub const GetSaveFileNamePreview = thismodule.GetSaveFileNamePreviewA; }, .wide => struct { pub const MCI_OPEN_PARMS = thismodule.MCI_OPEN_PARMSW; pub const MCI_INFO_PARMS = thismodule.MCI_INFO_PARMSW; pub const MCI_SYSINFO_PARMS = thismodule.MCI_SYSINFO_PARMSW; pub const MCI_SAVE_PARMS = thismodule.MCI_SAVE_PARMSW; pub const MCI_LOAD_PARMS = thismodule.MCI_LOAD_PARMSW; pub const MCI_VD_ESCAPE_PARMS = thismodule.MCI_VD_ESCAPE_PARMSW; pub const MCI_WAVE_OPEN_PARMS = thismodule.MCI_WAVE_OPEN_PARMSW; pub const MCI_ANIM_OPEN_PARMS = thismodule.MCI_ANIM_OPEN_PARMSW; pub const MCI_ANIM_WINDOW_PARMS = thismodule.MCI_ANIM_WINDOW_PARMSW; pub const MCI_OVLY_OPEN_PARMS = thismodule.MCI_OVLY_OPEN_PARMSW; pub const MCI_OVLY_WINDOW_PARMS = thismodule.MCI_OVLY_WINDOW_PARMSW; pub const MCI_OVLY_SAVE_PARMS = thismodule.MCI_OVLY_SAVE_PARMSW; pub const MCI_OVLY_LOAD_PARMS = thismodule.MCI_OVLY_LOAD_PARMSW; pub const JOYCAPS = thismodule.JOYCAPSW; pub const JOYCAPS2 = thismodule.JOYCAPS2W; pub const MCI_DGV_CAPTURE_PARMS = thismodule.MCI_DGV_CAPTURE_PARMSW; pub const MCI_DGV_INFO_PARMS = thismodule.MCI_DGV_INFO_PARMSW; pub const MCI_DGV_LIST_PARMS = thismodule.MCI_DGV_LIST_PARMSW; pub const MCI_DGV_OPEN_PARMS = thismodule.MCI_DGV_OPEN_PARMSW; pub const MCI_DGV_QUALITY_PARMS = thismodule.MCI_DGV_QUALITY_PARMSW; pub const MCI_DGV_RESERVE_PARMS = thismodule.MCI_DGV_RESERVE_PARMSW; pub const MCI_DGV_RESTORE_PARMS = thismodule.MCI_DGV_RESTORE_PARMSW; pub const MCI_DGV_SAVE_PARMS = thismodule.MCI_DGV_SAVE_PARMSW; pub const MCI_DGV_SETAUDIO_PARMS = thismodule.MCI_DGV_SETAUDIO_PARMSW; pub const MCI_DGV_SETVIDEO_PARMS = thismodule.MCI_DGV_SETVIDEO_PARMSW; pub const MCI_DGV_STATUS_PARMS = thismodule.MCI_DGV_STATUS_PARMSW; pub const MCI_DGV_WINDOW_PARMS = thismodule.MCI_DGV_WINDOW_PARMSW; pub const AVISTREAMINFO = thismodule.AVISTREAMINFOW; pub const AVIFILEINFO = thismodule.AVIFILEINFOW; pub const CAPSTATUSCALLBACK = thismodule.CAPSTATUSCALLBACKW; pub const CAPERRORCALLBACK = thismodule.CAPERRORCALLBACKW; pub const mciSendCommand = thismodule.mciSendCommandW; pub const mciSendString = thismodule.mciSendStringW; pub const mciGetDeviceID = thismodule.mciGetDeviceIDW; pub const mciGetDeviceIDFromElementID = thismodule.mciGetDeviceIDFromElementIDW; pub const mciGetErrorString = thismodule.mciGetErrorStringW; pub const mmioStringToFOURCC = thismodule.mmioStringToFOURCCW; pub const mmioInstallIOProc = thismodule.mmioInstallIOProcW; pub const mmioOpen = thismodule.mmioOpenW; pub const mmioRename = thismodule.mmioRenameW; pub const joyGetDevCaps = thismodule.joyGetDevCapsW; pub const AVIFileOpen = thismodule.AVIFileOpenW; pub const AVIFileInfo = thismodule.AVIFileInfoW; pub const AVIFileCreateStream = thismodule.AVIFileCreateStreamW; pub const AVIStreamInfo = thismodule.AVIStreamInfoW; pub const AVIStreamOpenFromFile = thismodule.AVIStreamOpenFromFileW; pub const AVISave = thismodule.AVISaveW; pub const AVISaveV = thismodule.AVISaveVW; pub const AVIBuildFilter = thismodule.AVIBuildFilterW; pub const EditStreamSetName = thismodule.EditStreamSetNameW; pub const EditStreamSetInfo = thismodule.EditStreamSetInfoW; pub const MCIWndCreate = thismodule.MCIWndCreateW; pub const capCreateCaptureWindow = thismodule.capCreateCaptureWindowW; pub const capGetDriverDescription = thismodule.capGetDriverDescriptionW; pub const GetOpenFileNamePreview = thismodule.GetOpenFileNamePreviewW; pub const GetSaveFileNamePreview = thismodule.GetSaveFileNamePreviewW; }, .unspecified => if (@import("builtin").is_test) struct { pub const MCI_OPEN_PARMS = *opaque{}; pub const MCI_INFO_PARMS = *opaque{}; pub const MCI_SYSINFO_PARMS = *opaque{}; pub const MCI_SAVE_PARMS = *opaque{}; pub const MCI_LOAD_PARMS = *opaque{}; pub const MCI_VD_ESCAPE_PARMS = *opaque{}; pub const MCI_WAVE_OPEN_PARMS = *opaque{}; pub const MCI_ANIM_OPEN_PARMS = *opaque{}; pub const MCI_ANIM_WINDOW_PARMS = *opaque{}; pub const MCI_OVLY_OPEN_PARMS = *opaque{}; pub const MCI_OVLY_WINDOW_PARMS = *opaque{}; pub const MCI_OVLY_SAVE_PARMS = *opaque{}; pub const MCI_OVLY_LOAD_PARMS = *opaque{}; pub const JOYCAPS = *opaque{}; pub const JOYCAPS2 = *opaque{}; pub const MCI_DGV_CAPTURE_PARMS = *opaque{}; pub const MCI_DGV_INFO_PARMS = *opaque{}; pub const MCI_DGV_LIST_PARMS = *opaque{}; pub const MCI_DGV_OPEN_PARMS = *opaque{}; pub const MCI_DGV_QUALITY_PARMS = *opaque{}; pub const MCI_DGV_RESERVE_PARMS = *opaque{}; pub const MCI_DGV_RESTORE_PARMS = *opaque{}; pub const MCI_DGV_SAVE_PARMS = *opaque{}; pub const MCI_DGV_SETAUDIO_PARMS = *opaque{}; pub const MCI_DGV_SETVIDEO_PARMS = *opaque{}; pub const MCI_DGV_STATUS_PARMS = *opaque{}; pub const MCI_DGV_WINDOW_PARMS = *opaque{}; pub const AVISTREAMINFO = *opaque{}; pub const AVIFILEINFO = *opaque{}; pub const CAPSTATUSCALLBACK = *opaque{}; pub const CAPERRORCALLBACK = *opaque{}; pub const mciSendCommand = *opaque{}; pub const mciSendString = *opaque{}; pub const mciGetDeviceID = *opaque{}; pub const mciGetDeviceIDFromElementID = *opaque{}; pub const mciGetErrorString = *opaque{}; pub const mmioStringToFOURCC = *opaque{}; pub const mmioInstallIOProc = *opaque{}; pub const mmioOpen = *opaque{}; pub const mmioRename = *opaque{}; pub const joyGetDevCaps = *opaque{}; pub const AVIFileOpen = *opaque{}; pub const AVIFileInfo = *opaque{}; pub const AVIFileCreateStream = *opaque{}; pub const AVIStreamInfo = *opaque{}; pub const AVIStreamOpenFromFile = *opaque{}; pub const AVISave = *opaque{}; pub const AVISaveV = *opaque{}; pub const AVIBuildFilter = *opaque{}; pub const EditStreamSetName = *opaque{}; pub const EditStreamSetInfo = *opaque{}; pub const MCIWndCreate = *opaque{}; pub const capCreateCaptureWindow = *opaque{}; pub const capGetDriverDescription = *opaque{}; pub const GetOpenFileNamePreview = *opaque{}; pub const GetSaveFileNamePreview = *opaque{}; } else struct { pub const MCI_OPEN_PARMS = @compileError("'MCI_OPEN_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_INFO_PARMS = @compileError("'MCI_INFO_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_SYSINFO_PARMS = @compileError("'MCI_SYSINFO_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_SAVE_PARMS = @compileError("'MCI_SAVE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_LOAD_PARMS = @compileError("'MCI_LOAD_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_VD_ESCAPE_PARMS = @compileError("'MCI_VD_ESCAPE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_WAVE_OPEN_PARMS = @compileError("'MCI_WAVE_OPEN_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_ANIM_OPEN_PARMS = @compileError("'MCI_ANIM_OPEN_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_ANIM_WINDOW_PARMS = @compileError("'MCI_ANIM_WINDOW_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_OVLY_OPEN_PARMS = @compileError("'MCI_OVLY_OPEN_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_OVLY_WINDOW_PARMS = @compileError("'MCI_OVLY_WINDOW_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_OVLY_SAVE_PARMS = @compileError("'MCI_OVLY_SAVE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_OVLY_LOAD_PARMS = @compileError("'MCI_OVLY_LOAD_PARMS' requires that UNICODE be set to true or false in the root module"); pub const JOYCAPS = @compileError("'JOYCAPS' requires that UNICODE be set to true or false in the root module"); pub const JOYCAPS2 = @compileError("'JOYCAPS2' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_CAPTURE_PARMS = @compileError("'MCI_DGV_CAPTURE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_INFO_PARMS = @compileError("'MCI_DGV_INFO_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_LIST_PARMS = @compileError("'MCI_DGV_LIST_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_OPEN_PARMS = @compileError("'MCI_DGV_OPEN_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_QUALITY_PARMS = @compileError("'MCI_DGV_QUALITY_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_RESERVE_PARMS = @compileError("'MCI_DGV_RESERVE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_RESTORE_PARMS = @compileError("'MCI_DGV_RESTORE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_SAVE_PARMS = @compileError("'MCI_DGV_SAVE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_SETAUDIO_PARMS = @compileError("'MCI_DGV_SETAUDIO_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_SETVIDEO_PARMS = @compileError("'MCI_DGV_SETVIDEO_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_STATUS_PARMS = @compileError("'MCI_DGV_STATUS_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_DGV_WINDOW_PARMS = @compileError("'MCI_DGV_WINDOW_PARMS' requires that UNICODE be set to true or false in the root module"); pub const AVISTREAMINFO = @compileError("'AVISTREAMINFO' requires that UNICODE be set to true or false in the root module"); pub const AVIFILEINFO = @compileError("'AVIFILEINFO' requires that UNICODE be set to true or false in the root module"); pub const CAPSTATUSCALLBACK = @compileError("'CAPSTATUSCALLBACK' requires that UNICODE be set to true or false in the root module"); pub const CAPERRORCALLBACK = @compileError("'CAPERRORCALLBACK' requires that UNICODE be set to true or false in the root module"); pub const mciSendCommand = @compileError("'mciSendCommand' requires that UNICODE be set to true or false in the root module"); pub const mciSendString = @compileError("'mciSendString' requires that UNICODE be set to true or false in the root module"); pub const mciGetDeviceID = @compileError("'mciGetDeviceID' requires that UNICODE be set to true or false in the root module"); pub const mciGetDeviceIDFromElementID = @compileError("'mciGetDeviceIDFromElementID' requires that UNICODE be set to true or false in the root module"); pub const mciGetErrorString = @compileError("'mciGetErrorString' requires that UNICODE be set to true or false in the root module"); pub const mmioStringToFOURCC = @compileError("'mmioStringToFOURCC' requires that UNICODE be set to true or false in the root module"); pub const mmioInstallIOProc = @compileError("'mmioInstallIOProc' requires that UNICODE be set to true or false in the root module"); pub const mmioOpen = @compileError("'mmioOpen' requires that UNICODE be set to true or false in the root module"); pub const mmioRename = @compileError("'mmioRename' requires that UNICODE be set to true or false in the root module"); pub const joyGetDevCaps = @compileError("'joyGetDevCaps' requires that UNICODE be set to true or false in the root module"); pub const AVIFileOpen = @compileError("'AVIFileOpen' requires that UNICODE be set to true or false in the root module"); pub const AVIFileInfo = @compileError("'AVIFileInfo' requires that UNICODE be set to true or false in the root module"); pub const AVIFileCreateStream = @compileError("'AVIFileCreateStream' requires that UNICODE be set to true or false in the root module"); pub const AVIStreamInfo = @compileError("'AVIStreamInfo' requires that UNICODE be set to true or false in the root module"); pub const AVIStreamOpenFromFile = @compileError("'AVIStreamOpenFromFile' requires that UNICODE be set to true or false in the root module"); pub const AVISave = @compileError("'AVISave' requires that UNICODE be set to true or false in the root module"); pub const AVISaveV = @compileError("'AVISaveV' requires that UNICODE be set to true or false in the root module"); pub const AVIBuildFilter = @compileError("'AVIBuildFilter' requires that UNICODE be set to true or false in the root module"); pub const EditStreamSetName = @compileError("'EditStreamSetName' requires that UNICODE be set to true or false in the root module"); pub const EditStreamSetInfo = @compileError("'EditStreamSetInfo' requires that UNICODE be set to true or false in the root module"); pub const MCIWndCreate = @compileError("'MCIWndCreate' requires that UNICODE be set to true or false in the root module"); pub const capCreateCaptureWindow = @compileError("'capCreateCaptureWindow' requires that UNICODE be set to true or false in the root module"); pub const capGetDriverDescription = @compileError("'capGetDriverDescription' requires that UNICODE be set to true or false in the root module"); pub const GetOpenFileNamePreview = @compileError("'GetOpenFileNamePreview' requires that UNICODE be set to true or false in the root module"); pub const GetSaveFileNamePreview = @compileError("'GetSaveFileNamePreview' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (32) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BITMAPINFO = @import("../graphics/gdi.zig").BITMAPINFO; const BITMAPINFOHEADER = @import("../graphics/gdi.zig").BITMAPINFOHEADER; const BOOL = @import("../foundation.zig").BOOL; const CHAR = @import("../foundation.zig").CHAR; const FARPROC = @import("../foundation.zig").FARPROC; const HANDLE = @import("../foundation.zig").HANDLE; const HDC = @import("../graphics/gdi.zig").HDC; const HINSTANCE = @import("../foundation.zig").HINSTANCE; const HMIXER = @import("../media/audio.zig").HMIXER; const HPALETTE = @import("../graphics/gdi.zig").HPALETTE; const HRESULT = @import("../foundation.zig").HRESULT; const HTASK = @import("../media.zig").HTASK; const HWAVE = @import("../media/audio.zig").HWAVE; const HWND = @import("../foundation.zig").HWND; const IPersistFile = @import("../system/com.zig").IPersistFile; const IUnknown = @import("../system/com.zig").IUnknown; const LPARAM = @import("../foundation.zig").LPARAM; const LPFNSVADDPROPSHEETPAGE = @import("../ui/controls.zig").LPFNSVADDPROPSHEETPAGE; const LPTIMECALLBACK = @import("../media.zig").LPTIMECALLBACK; const LRESULT = @import("../foundation.zig").LRESULT; const OPENFILENAMEA = @import("../ui/controls/dialogs.zig").OPENFILENAMEA; const OPENFILENAMEW = @import("../ui/controls/dialogs.zig").OPENFILENAMEW; const OVERLAPPED = @import("../system/io.zig").OVERLAPPED; const PALETTEENTRY = @import("../graphics/gdi.zig").PALETTEENTRY; const POINT = @import("../foundation.zig").POINT; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const RECT = @import("../foundation.zig").RECT; const WAVEFORMAT = @import("../media/audio.zig").WAVEFORMAT; const WAVEFORMATEX = @import("../media/audio.zig").WAVEFORMATEX; const WAVEHDR = @import("../media/audio.zig").WAVEHDR; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "YIELDPROC")) { _ = YIELDPROC; } if (@hasDecl(@This(), "DRIVERPROC")) { _ = DRIVERPROC; } if (@hasDecl(@This(), "DRIVERMSGPROC")) { _ = DRIVERMSGPROC; } if (@hasDecl(@This(), "LPMMIOPROC")) { _ = LPMMIOPROC; } if (@hasDecl(@This(), "AVISAVECALLBACK")) { _ = AVISAVECALLBACK; } if (@hasDecl(@This(), "CAPYIELDCALLBACK")) { _ = CAPYIELDCALLBACK; } if (@hasDecl(@This(), "CAPSTATUSCALLBACKW")) { _ = CAPSTATUSCALLBACKW; } if (@hasDecl(@This(), "CAPERRORCALLBACKW")) { _ = CAPERRORCALLBACKW; } if (@hasDecl(@This(), "CAPSTATUSCALLBACKA")) { _ = CAPSTATUSCALLBACKA; } if (@hasDecl(@This(), "CAPERRORCALLBACKA")) { _ = CAPERRORCALLBACKA; } if (@hasDecl(@This(), "CAPVIDEOCALLBACK")) { _ = CAPVIDEOCALLBACK; } if (@hasDecl(@This(), "CAPWAVECALLBACK")) { _ = CAPWAVECALLBACK; } if (@hasDecl(@This(), "CAPCONTROLCALLBACK")) { _ = CAPCONTROLCALLBACK; } if (@hasDecl(@This(), "LPTASKCALLBACK")) { _ = LPTASKCALLBACK; } if (@hasDecl(@This(), "VFWWDMExtensionProc")) { _ = VFWWDMExtensionProc; } if (@hasDecl(@This(), "LPFNEXTDEVIO")) { _ = LPFNEXTDEVIO; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/media/multimedia.zig
const std = @import("std"); const testing = std.testing; const allocator = std.testing.allocator; pub const Crab = struct { pub const Mode = enum { Unit, Sum, }; mode: Mode, pMin: isize, pMax: isize, pos: std.ArrayList(isize), pub fn init(mode: Mode) Crab { var self = Crab{ .mode = mode, .pMin = std.math.maxInt(isize), .pMax = std.math.minInt(isize), .pos = std.ArrayList(isize).init(allocator), }; return self; } pub fn deinit(self: *Crab) void { self.pos.deinit(); } pub fn process_line(self: *Crab, data: []const u8) void { var it = std.mem.split(u8, data, ","); while (it.next()) |num| { const n = std.fmt.parseInt(isize, num, 10) catch unreachable; if (self.pMin > n) { self.pMin = n; } if (self.pMax < n) { self.pMax = n; } self.pos.append(n) catch unreachable; } // std.debug.warn("COUNT {}, MIN {}, MAX {}\n", .{ self.pos.items.len, self.pMin, self.pMax }); } pub fn find_min_fuel_consumption(self: Crab) usize { var min: usize = std.math.maxInt(usize); var target = self.pMin; while (target <= self.pMax) : (target += 1) { const fuel = self.compute_total_fuel_to_target(target); if (min > fuel) { min = fuel; } } return min; } fn compute_total_fuel_to_target(self: Crab, target: isize) usize { var total: usize = 0; for (self.pos.items) |pos| { const dist = @intCast(usize, std.math.absInt(target - pos) catch unreachable); const fuel = switch (self.mode) { .Unit => dist, .Sum => dist * (dist + 1) / 2, }; // std.debug.warn("FROM {} to {}: {} {}\n", .{ target, pos, dist, fuel }); total += fuel; } // std.debug.warn("TOTAL FROM {}: {}\n", .{ target, total }); return total; } }; test "sample part a" { const data: []const u8 = \\16,1,2,0,4,2,7,1,2,14 ; var crab = Crab.init(Crab.Mode.Unit); defer crab.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { crab.process_line(line); } const min = crab.find_min_fuel_consumption(); try testing.expect(min == 37); } test "sample part b" { const data: []const u8 = \\16,1,2,0,4,2,7,1,2,14 ; var crab = Crab.init(Crab.Mode.Sum); defer crab.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { crab.process_line(line); } const min = crab.find_min_fuel_consumption(); try testing.expect(min == 168); }
2021/p07/crab.zig
const std = @import("std"); const mem = std.mem; const time = std.time; const math = std.math; const inf = math.inf; const nan = math.nan; const warn = std.debug.warn; inline fn toDigit(ch: u8) !u8 { if (ch >= '0' and ch <= '9') return ch - '0'; return error.InvalidCharacter; } fn parseFloat(comptime T: type, slice: []const u8) error{ Empty, InvalidCharacter, TooManyDigits }!T { var s = mem.separate(slice, " ").next() orelse return error.Empty; if (s.len == 0) return error.Empty; var is_neg = s[0] == '-'; if (is_neg) { if (s.len == 1) return error.Empty; s = s[1..]; } if (mem.eql(u8, s[0..3], "inf")) return if (is_neg) -inf(T) else inf(T); if (mem.eql(u8, s[0..3], "nan")) return nan(T); // -nan makes no sense. // Read the digits into an integer and note // where the decimal point is. var n: u64 = 0; var decimal_point_index: isize = -1; var decimal_places: usize = 0; var numeral_places: usize = 0; for (s) |ch, i| { if (ch == '.') { decimal_point_index = @intCast(isize, i); continue; } if (decimal_point_index == -1) numeral_places += 1 else decimal_places += 1; n += try toDigit(ch); n *= 10; } if (decimal_places + numeral_places > 18) return error.TooManyDigits; // f64 has 18 s.f. // Shift the decimal point into the right place. var n_as_float = @intToFloat(f64, n) / 10; if (decimal_point_index != -1) { // We counted from the front, we'll insert the decimal point from the back. const decimal_point_index_from_back = @intCast(isize, s.len) - decimal_point_index - 1; { var i: isize = 0; while (i < decimal_point_index_from_back) : (i += 1) { n_as_float /= 10; } } } var res = @floatCast(T, n_as_float); if (is_neg) res *= -1; return res; } pub fn main() !void { { var total: u64 = 0; const its = 10240000; var i: u64 = 0; while (i < its) : (i += 1) { var t = try time.Timer.start(); var f = try parseFloat(f64, "4.77777777777777777"); var took = t.read(); // warn("f is {d}\n", f); // break; total += took; } warn("average time: {d} ns\n", @intToFloat(f64, total) / @intToFloat(f64, its)); } { var total: u64 = 0; const its = 10240000; var i: u64 = 0; while (i < its) : (i += 1) { var t = try time.Timer.start(); var f = try std.fmt.parseFloat(f64, "4.77777777777777778"); var took = t.read(); total += took; } warn("average time: {d} ns\n", @intToFloat(f64, total) / @intToFloat(f64, its)); } }
src/lib/float.zig
pub const SYS = enum(usize) { read = 0x00, write = 0x01, open = 0x02, close = 0x03, stat = 0x04, fstat = 0x05, lstat = 0x06, poll = 0x07, lseek = 0x08, mmap = 0x09, mprotect = 0x0a, munmap = 0x0b, brk = 0x0c, rt_sigaction = 0x0d, rt_sigprocmask = 0x0e, rt_sigreturn = 0x0f, ioctl = 0x10, pread64 = 0x11, pwrite64 = 0x12, readv = 0x13, writev = 0x14, access = 0x15, pipe = 0x16, select = 0x17, sched_yield = 0x18, mremap = 0x19, msync = 0x1a, mincore = 0x1b, madvise = 0x1c, shmget = 0x1d, shmat = 0x1e, shmctl = 0x1f, dup = 0x20, dup2 = 0x21, pause = 0x22, nanosleep = 0x23, getitimer = 0x24, alarm = 0x25, setitimer = 0x26, getpid = 0x27, sendfile = 0x28, socket = 0x29, connect = 0x2a, accept = 0x2b, sendto = 0x2c, recvfrom = 0x2d, sendmsg = 0x2e, recvmsg = 0x2f, shutdown = 0x30, bind = 0x31, listen = 0x32, getsockname = 0x33, getpeername = 0x34, socketpair = 0x35, setsockopt = 0x36, getsockopt = 0x37, clone = 0x38, fork = 0x39, vfork = 0x3a, execve = 0x3b, exit = 0x3c, wait4 = 0x3d, kill = 0x3e, uname = 0x3f, semget = 0x40, semop = 0x41, semctl = 0x42, shmdt = 0x43, msgget = 0x44, msgsnd = 0x45, msgrcv = 0x46, msgctl = 0x47, fcntl = 0x48, flock = 0x49, fsync = 0x4a, fdatasync = 0x4b, truncate = 0x4c, ftruncate = 0x4d, getdents = 0x4e, getcwd = 0x4f, chdir = 0x50, fchdir = 0x51, rename = 0x52, mkdir = 0x53, rmdir = 0x54, creat = 0x55, link = 0x56, unlink = 0x57, symlink = 0x58, readlink = 0x59, chmod = 0x5a, fchmod = 0x5b, chown = 0x5c, fchown = 0x5d, lchown = 0x5e, umask = 0x5f, gettimeofday = 0x60, getrlimit = 0x61, getrusage = 0x62, sysinfo = 0x63, times = 0x64, ptrace = 0x65, getuid = 0x66, syslog = 0x67, getgid = 0x68, setuid = 0x69, setgid = 0x6a, geteuid = 0x6b, getegid = 0x6c, setpgid = 0x6d, getppid = 0x6e, getpgrp = 0x6f, setsid = 0x70, setreuid = 0x71, setregid = 0x72, getgroups = 0x73, setgroups = 0x74, setresuid = 0x75, getresuid = 0x76, setresgid = 0x77, getresgid = 0x78, getpgid = 0x79, setfsuid = 0x7a, setfsgid = 0x7b, getsid = 0x7c, capget = 0x7d, capset = 0x7e, rt_sigpending = 0x7f, rt_sigtimedwait = 0x80, rt_sigqueueinfo = 0x81, rt_sigsuspend = 0x82, sigaltstack = 0x83, utime = 0x84, mknod = 0x85, uselib = 0x86, personality = 0x87, ustat = 0x88, statfs = 0x89, fstatfs = 0x8a, sysfs = 0x8b, getpriority = 0x8c, setpriority = 0x8d, sched_setparam = 0x8e, sched_getparam = 0x8f, sched_setscheduler = 0x90, sched_getscheduler = 0x91, sched_get_priority_max = 0x92, sched_get_priority_min = 0x93, sched_rr_get_interval = 0x94, mlock = 0x95, munlock = 0x96, mlockall = 0x97, munlockall = 0x98, vhangup = 0x99, modify_ldt = 0x9a, pivot_root = 0x9b, _sysctl = 0x9c, prctl = 0x9d, arch_prctl = 0x9e, adjtimex = 0x9f, setrlimit = 0xa0, chroot = 0xa1, sync = 0xa2, acct = 0xa3, settimeofday = 0xa4, mount = 0xa5, umount2 = 0xa6, swapon = 0xa7, swapoff = 0xa8, reboot = 0xa9, sethostname = 0xaa, setdomainname = 0xab, iopl = 0xac, ioperm = 0xad, create_module = 0xae, init_module = 0xaf, delete_module = 0xb0, get_kernel_syms = 0xb1, query_module = 0xb2, quotactl = 0xb3, nfsservctl = 0xb4, getpmsg = 0xb5, putpmsg = 0xb6, afs_syscall = 0xb7, tuxcall = 0xb8, security = 0xb9, gettid = 0xba, readahead = 0xbb, setxattr = 0xbc, lsetxattr = 0xbd, fsetxattr = 0xbe, getxattr = 0xbf, lgetxattr = 0xc0, fgetxattr = 0xc1, listxattr = 0xc2, llistxattr = 0xc3, flistxattr = 0xc4, removexattr = 0xc5, lremovexattr = 0xc6, fremovexattr = 0xc7, tkill = 0xc8, time = 0xc9, futex = 0xca, sched_setaffinity = 0xcb, sched_getaffinity = 0xcc, set_thread_area = 0xcd, io_setup = 0xce, io_destroy = 0xcf, io_getevents = 0xd0, io_submit = 0xd1, io_cancel = 0xd2, get_thread_area = 0xd3, lookup_dcookie = 0xd4, epoll_create = 0xd5, epoll_ctl_old = 0xd6, epoll_wait_old = 0xd7, remap_file_pages = 0xd8, getdents64 = 0xd9, set_tid_address = 0xda, restart_syscall = 0xdb, semtimedop = 0xdc, fadvise64 = 0xdd, timer_create = 0xde, timer_settime = 0xdf, timer_gettime = 0xe0, timer_getoverrun = 0xe1, timer_delete = 0xe2, clock_settime = 0xe3, clock_gettime = 0xe4, clock_getres = 0xe5, clock_nanosleep = 0xe6, exit_group = 0xe7, epoll_wait = 0xe8, epoll_ctl = 0xe9, tgkill = 0xea, utimes = 0xeb, vserver = 0xec, mbind = 0xed, set_mempolicy = 0xee, get_mempolicy = 0xef, mq_open = 0xf0, mq_unlink = 0xf1, mq_timedsend = 0xf2, mq_timedreceive = 0xf3, mq_notify = 0xf4, mq_getsetattr = 0xf5, kexec_load = 0xf6, waitid = 0xf7, add_key = 0xf8, request_key = 0xf9, keyctl = 0xfa, ioprio_set = 0xfb, ioprio_get = 0xfc, inotify_init = 0xfd, inotify_add_watch = 0xfe, inotify_rm_watch = 0xff, migrate_pages = 0x100, openat = 0x101, mkdirat = 0x102, mknodat = 0x103, fchownat = 0x104, futimesat = 0x105, newfstatat = 0x106, unlinkat = 0x107, renameat = 0x108, linkat = 0x109, symlinkat = 0x10a, readlinkat = 0x10b, fchmodat = 0x10c, faccessat = 0x10d, pselect6 = 0x10e, ppoll = 0x10f, unshare = 0x110, set_robust_list = 0x111, get_robust_list = 0x112, splice = 0x113, tee = 0x114, sync_file_range = 0x115, vmsplice = 0x116, move_pages = 0x117, utimensat = 0x118, epoll_pwait = 0x119, signalfd = 0x11a, timerfd_create = 0x11b, eventfd = 0x11c, fallocate = 0x11d, timerfd_settime = 0x11e, timerfd_gettime = 0x11f, accept4 = 0x120, signalfd4 = 0x121, eventfd2 = 0x122, epoll_create1 = 0x123, dup3 = 0x124, pipe2 = 0x125, inotify_init1 = 0x126, preadv = 0x127, pwritev = 0x128, rt_tgsigqueueinfo = 0x129, perf_event_open = 0x12a, recvmmsg = 0x12b, fanotify_init = 0x12c, fanotify_mark = 0x12d, prlimit64 = 0x12e, name_to_handle_at = 0x12f, open_by_handle_at = 0x130, clock_adjtime = 0x131, syncfs = 0x132, sendmmsg = 0x133, setns = 0x134, getcpu = 0x135, process_vm_readv = 0x136, process_vm_writev = 0x137, kcmp = 0x138, finit_module = 0x139, sched_setattr = 0x13a, sched_getattr = 0x13b, renameat2 = 0x13c, seccomp = 0x13d, getrandom = 0x13e, memfd_create = 0x13f, kexec_file_load = 0x140, bpf = 0x141, execveat = 0x142, userfaultfd = 0x143, membarrier = 0x144, mlock2 = 0x145, copy_file_range = 0x146, preadv2 = 0x147, pwritev2 = 0x148, pkey_mprotect = 0x149, pkey_alloc = 0x14a, pkey_free = 0x14b, statx = 0x14c, };
src/linux/x86_64/consts.zig
const std = @import("std"); const SplitResult = struct { lower: ?*Node, equal: ?*Node, greater: ?*Node, }; const NodePair = struct { first: ?*Node, second: ?*Node, }; const Node = struct { x: usize, y: usize, left: ?*Node = null, right: ?*Node = null, var rng = std.rand.DefaultPrng.init(0x1234); fn init(x: usize) Node { return .{ .x = x, .y = rng.random.int(usize) }; } fn merge(lower: ?*Node, greater: ?*Node) ?*Node { if (lower == null) return greater; if (greater == null) return lower; const lower_ = lower.?; const greater_ = greater.?; if (lower_.y < greater_.y) { lower_.right = merge(lower_.right, greater); return lower; } else { greater_.left = merge(lower, greater_.left); return greater; } } fn splitBinary(orig: ?*Node, value: usize) NodePair { if (orig) |orig_| { if (orig_.x < value) { const split_pair = splitBinary(orig_.right, value); orig_.right = split_pair.first; return .{ .first = orig, .second = split_pair.second }; } else { const split_pair = splitBinary(orig_.left, value); orig_.left = split_pair.second; return .{ .first = split_pair.first, .second = orig }; } } else { return .{ .first = null, .second = null }; } } fn merge3(lower: ?*Node, equal: ?*Node, greater: ?*Node) ?*Node { return merge(merge(lower, equal), greater); } fn split(orig: ?*Node, value: usize) SplitResult { const lower_other = splitBinary(orig, value); const equal_greater = splitBinary(lower_other.second, value + 1); return .{ .lower = lower_other.first, .equal = equal_greater.first, .greater = equal_greater.second }; } }; const Tree = struct { root: ?*Node = null, allocator: *std.mem.Allocator, fn init(allocator: *std.mem.Allocator) Tree { return .{ .allocator = allocator }; } fn hasValue(self: *Tree, x: usize) bool { const splited = Node.split(self.root, x); const result = splited.equal != null; self.root = Node.merge3(splited.lower, splited.equal, splited.greater); return result; } fn insert(self: *Tree, x: usize) !void { var splited = Node.split(self.root, x); if (splited.equal == null) { const node = try self.allocator.create(Node); node.* = Node.init(x); splited.equal = node; } self.root = Node.merge3(splited.lower, splited.equal, splited.greater); } fn erase(self: *Tree, x: usize) void { const splited = Node.split(self.root, x); self.root = Node.merge(splited.lower, splited.greater); } }; pub fn main() !void { Node.rng.seed(std.time.milliTimestamp()); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); var tree = Tree.init(&arena.allocator); var cur: usize = 5; var res: usize = 0; var i: usize = 1; while (i < 1000000) : (i += 1) { cur = (cur * 57 + 43) % 10007; switch (i % 3) { 0 => try tree.insert(cur), 1 => tree.erase(cur), 2 => { const hasVal = tree.hasValue(cur); if (hasVal) res += 1; }, else => unreachable, } } std.debug.warn("{}\n", .{res}); }
zig/main.zig
const std = @import("std"); const builtin = @import("builtin"); const build_options = @import("build_options"); const utils = @import("utils"); const georgios = @import("georgios"); pub const platform = @import("platform.zig"); pub const fprint = @import("fprint.zig"); pub const print = @import("print.zig"); pub const memory = @import("memory.zig"); pub const io = @import("io.zig"); pub const elf = @import("elf.zig"); pub const devices = @import("devices.zig"); pub const threading = @import("threading.zig"); pub const fs = @import("fs.zig"); pub const sync = @import("sync.zig"); pub const keys = @import("keys.zig"); pub const font = @import("font.zig"); pub const Console = @import("Console.zig"); pub var panic_message: []const u8 = ""; pub fn panic(msg: []const u8, trace: ?*std.builtin.StackTrace) noreturn { print.format("panic: {}\n", .{msg}); platform.impl.ps2.anykey(); panic_message = msg; if (trace) |t| { print.format("index: {}\n", .{t.index}); for (t.instruction_addresses) |addr| { if (addr == 0) break; print.format(" - {:a}\n", .{addr}); } } else { print.string("No Stack Trace\n"); } platform.panic(msg, trace); } pub var memory_mgr = memory.Manager{}; pub var device_mgr = devices.Manager{}; pub var threading_mgr = threading.Manager{}; pub var alloc: *memory.Allocator = undefined; pub var big_alloc: *memory.Allocator = undefined; pub var console: *Console = undefined; pub var console_file = io.File{}; pub var raw_block_store: ?*io.BlockStore = null; pub var block_store: io.CachedBlockStore = .{}; pub var filesystem: fs.Filesystem = .{}; pub fn platform_init() !void { print.init(&console_file, build_options.debug_log); try platform.init(); } pub fn init() !void { try platform_init(); // Filesystem if (raw_block_store) |raw| { block_store.init(alloc, raw, 128); try filesystem.init(alloc, &block_store.block_store); } else { print.string(" - No Disk Found\n"); } } pub fn exec(info: *const georgios.ProcessInfo) georgios.ExecError!threading.Process.Id { const process = try threading_mgr.new_process(info); // print.format("exec: {}\n", .{info.path}); var file = try filesystem.open(info.path); // TODO: better way to close the file!! defer filesystem.file_id_close(file.io_file.id.?) catch @panic("file_id_close"); var elf_object = try elf.Object.from_file(alloc, big_alloc, &file.io_file); var segments = elf_object.segments.iterator(); while (segments.next()) |segment| { switch (segment.what) { .Data => |data| try process.address_space_copy(segment.address, data), .UndefinedMemory => |size| try process.address_space_set(segment.address, 0, size), } } process.entry = elf_object.header.entry; try elf_object.teardown(); try threading_mgr.start_process(process); return process.id; } pub fn run() !void { try init(); print.string("\x1bc"); // Reset Console // try @import("sync.zig").system_tests(); // Read and execute the path in the rc file var rc_file = try filesystem.open("/etc/rc"); // TODO: better way to close the file!! defer filesystem.file_id_close(rc_file.io_file.id.?) catch @panic("file_id_close"); var rc_buffer: [128]u8 = undefined; var rc_path: []const u8 = rc_buffer[0..try rc_file.io_file.read(rc_buffer[0..])]; rc_path = rc_path[0..utils.stripped_string_size(rc_path)]; threading_mgr.wait_for_process(try exec(&georgios.ProcessInfo{.path = rc_path})); } pub fn kernel_main() void { if (run()) |_| {} else |e| { panic(@errorName(e), @errorReturnTrace()); } print.string("Done\n"); platform.done(); }
kernel/kernel.zig
const sf = struct { pub usingnamespace @import("../sfml.zig"); pub usingnamespace sf.system; pub usingnamespace sf.graphics; }; const std = @import("std"); const assert = std.debug.assert; const TextureType = enum { _ptr, _const_ptr }; pub const Texture = union(TextureType) { // Constructor/destructor /// Creates a texture from nothing pub fn create(size: sf.Vector2u) !Texture { const tex = sf.c.sfTexture_create(@intCast(c_uint, size.x), @intCast(c_uint, size.y)); if (tex == null) return sf.Error.nullptrUnknownReason; return Texture{ ._ptr = tex.? }; } /// Loads a texture from a file pub fn createFromFile(path: [:0]const u8) !Texture { const tex = sf.c.sfTexture_createFromFile(path, null); if (tex == null) return sf.Error.resourceLoadingError; return Texture{ ._ptr = tex.? }; } /// Creates an texture from an image pub fn createFromImage(image: sf.Image, area: ?sf.IntRect) !Texture { const tex = if (area) |a| sf.c.sfTexture_createFromImage(image._ptr, &a._toCSFML()) else sf.c.sfTexture_createFromImage(image._ptr, null); if (tex == null) return sf.Error.nullptrUnknownReason; return Texture{ ._ptr = tex.? }; } /// Destroys a texture /// Be careful, you can only destroy non const textures pub fn destroy(self: *Texture) void { // TODO : is it possible to detect that comptime? // Should this panic? if (self.* == ._const_ptr) @panic("Can't destroy a const texture pointer"); sf.c.sfTexture_destroy(self._ptr); } // Getters/Setters /// Gets a const pointer to this texture /// For inner workings pub fn _get(self: Texture) *const sf.c.sfTexture { return switch (self) { ._ptr => self._ptr, ._const_ptr => self._const_ptr, }; } /// Clones this texture (the clone won't be const) pub fn copy(self: Texture) !Texture { const cpy = sf.c.sfTexture_copy(self._get()); if (cpy == null) return sf.Error.nullptrUnknownReason; return Texture{ ._ptr = cpy.? }; } /// Copy this texture to an image in ram pub fn copyToImage(self: Texture) sf.Image { return .{ ._ptr = sf.c.sfTexture_copyToImage(self._get()).? }; } /// Makes this texture constant (I don't know why you would do that) pub fn makeConst(self: *Texture) void { self.* = Texture{ ._const_ptr = self._get() }; } /// Gets the size of this image pub fn getSize(self: Texture) sf.Vector2u { const size = sf.c.sfTexture_getSize(self._get()); return sf.Vector2u{ .x = size.x, .y = size.y }; } /// Gets the pixel count of this image pub fn getPixelCount(self: Texture) usize { const dim = self.getSize(); return dim.x * dim.y; } /// Updates the pixels of the image from an array of pixels (colors) pub fn updateFromPixels(self: *Texture, pixels: []const sf.Color, zone: ?sf.Rect(c_uint)) !void { if (self.* == ._const_ptr) @panic("Can't set pixels on a const texture"); if (self.isSrgb()) @panic("Updating an srgb from a pixel array isn't implemented"); var real_zone: sf.Rect(c_uint) = undefined; var size = self.getSize(); if (zone) |z| { // Check if the given zone is fully inside the image var intersection = z.intersects(sf.Rect(c_uint).init(0, 0, size.x, size.y)); if (intersection) |i| { if (!i.equals(z)) return sf.Error.areaDoesNotFit; } else return sf.Error.areaDoesNotFit; real_zone = z; } else { real_zone.left = 0; real_zone.top = 0; real_zone.width = size.x; real_zone.height = size.y; } // Check if there is enough data if (pixels.len < real_zone.width * real_zone.height) return sf.Error.notEnoughData; sf.c.sfTexture_updateFromPixels(self._ptr, @ptrCast([*]const u8, pixels.ptr), real_zone.width, real_zone.height, real_zone.left, real_zone.top); } /// Updates the pixels of the image from an other texture pub fn updateFromTexture(self: *Texture, other: Texture, copy_pos: ?sf.Vector2u) void { if (self == ._const_ptr) @panic("Can't set pixels on a const texture"); var pos = if (copy_pos) |a| a else sf.Vector2u{ .x = 0, .y = 0 }; var max = other.getSize().add(pos); var size = self.getSize(); assert(max.x <= size.x and max.y <= size.y); sf.c.sfTexture_updateFromTexture(self._ptr, other._get(), pos.x, pos.y); } /// Updates the pixels of the image from an image pub fn updateFromImage(self: *Texture, image: sf.Image, copy_pos: ?sf.Vector2u) void { if (self.* == ._const_ptr) @panic("Can't set pixels on a const texture"); var pos = if (copy_pos) |a| a else sf.Vector2u{ .x = 0, .y = 0 }; var max = image.getSize().add(pos); var size = self.getSize(); assert(max.x <= size.x and max.y <= size.y); sf.c.sfTexture_updateFromImage(self._ptr, image._ptr, pos.x, pos.y); } /// Tells whether or not this texture is to be smoothed pub fn isSmooth(self: Texture) bool { return sf.c.sfTexture_isSmooth(self._ptr) != 0; } /// Enables or disables texture smoothing pub fn setSmooth(self: *Texture, smooth: bool) void { if (self.* == ._const_ptr) @panic("Can't set properties on a const texture"); sf.c.sfTexture_setSmooth(self._ptr, @boolToInt(smooth)); } /// Tells whether or not this texture should repeat when rendering outside its bounds pub fn isRepeated(self: Texture) bool { return sf.c.sfTexture_isRepeated(self._ptr) != 0; } /// Enables or disables texture repeating pub fn setRepeated(self: *Texture, repeated: bool) void { if (self.* == ._const_ptr) @panic("Can't set properties on a const texture"); sf.c.sfTexture_setRepeated(self._ptr, @boolToInt(repeated)); } /// Tells whether or not this texture has colors in the SRGB format /// SRGB functions arent implemented yet pub fn isSrgb(self: Texture) bool { return sf.c.sfTexture_isSrgb(self._ptr) != 0; } /// Enables or disables SRGB pub fn setSrgb(self: *Texture, srgb: bool) void { if (self.* == ._const_ptr) @panic("Can't set properties on a const texture"); sf.c.sfTexture_setSrgb(self._ptr, @boolToInt(srgb)); } /// Swaps this texture's contents with an other texture pub fn swap(self: *Texture, other: *Texture) void { if (self.* == ._const_ptr or other.* == ._const_ptr) @panic("Texture swapping must be done between two non const textures"); sf.c.sfTexture_swap(self._ptr, other._ptr); } // Others /// Generates a mipmap for the current texture data, returns true if the operation succeeded pub fn generateMipmap(self: *Texture) bool { if (self == ._const_ptr) @panic("Can't act on a const texture"); return sf.c.sfTexture_generateMipmap(self._ptr) != 0; } /// Pointer to the csfml texture _ptr: *sf.c.sfTexture, /// Const pointer to the csfml texture _const_ptr: *const sf.c.sfTexture }; test "texture: sane getters and setters" { const tst = std.testing; const allocator = std.heap.page_allocator; var tex = try Texture.create(.{ .x = 12, .y = 10 }); defer tex.destroy(); var size = tex.getSize(); tex.setSrgb(false); tex.setSmooth(true); tex.setRepeated(true); try tst.expectEqual(@as(u32, 12), size.x); try tst.expectEqual(@as(u32, 10), size.y); try tst.expectEqual(@as(usize, 120), tex.getPixelCount()); var pixel_data = try allocator.alloc(sf.Color, 120); defer allocator.free(pixel_data); for (pixel_data) |*c, i| { c.* = sf.graphics.Color.fromHSVA(@intToFloat(f32, i) / 144 * 360, 100, 100, 1); } pixel_data[0] = sf.Color.Green; try tex.updateFromPixels(pixel_data, null); try tst.expect(!tex.isSrgb()); try tst.expect(tex.isSmooth()); try tst.expect(tex.isRepeated()); var img = tex.copyToImage(); defer img.destroy(); try tst.expectEqual(sf.Color.Green, img.getPixel(.{ .x = 0, .y = 0 })); tex.updateFromImage(img, null); var t = tex; t.makeConst(); var copy = try t.copy(); try tst.expectEqual(@as(usize, 120), copy.getPixelCount()); var tex2 = try Texture.create(.{ .x = 100, .y = 100 }); defer tex2.destroy(); copy.swap(&tex2); try tst.expectEqual(@as(usize, 100 * 100), copy.getPixelCount()); try tst.expectEqual(@as(usize, 120), tex2.getPixelCount()); }
src/sfml/graphics/texture.zig
const std = @import("std"); test "" { std.meta.refAllDecls(@This()); } pub inline fn __enable_irq() void { asm volatile ("cpsie i"); } pub inline fn __disable_irq() void { asm volatile ("cpsid i"); } pub inline fn __enable_fault_irq() void { asm volatile ("cpsie f"); } pub inline fn __disable_fault_irq() void { asm volatile ("cpsid f"); } pub inline fn __NOP() void { asm volatile ("nop"); } pub inline fn __WFI() void { asm volatile ("wfi"); } pub inline fn __WFE() void { asm volatile ("wfe"); } pub inline fn __SEV() void { asm volatile ("sev"); } pub inline fn __ISB() void { asm volatile ("isb"); } pub inline fn __DSB() void { asm volatile ("dsb"); } pub inline fn __DMB() void { asm volatile ("dmb"); } pub inline fn __CLREX() void { asm volatile ("clrex"); } pub const NonMaskableInt_IRQn = @enumToInt(IRQn.NonMaskableInt); pub const MemoryManagement_IRQn = @enumToInt(IRQn.MemoryManagement); pub const BusFault_IRQn = @enumToInt(IRQn.BusFault); pub const UsageFault_IRQn = @enumToInt(IRQn.UsageFault); pub const SVCall_IRQn = @enumToInt(IRQn.SVCall); pub const DebugMonitor_IRQn = @enumToInt(IRQn.DebugMonitor); pub const PendSV_IRQn = @enumToInt(IRQn.PendSV); pub const SysTick_IRQn = @enumToInt(IRQn.SysTick); pub const WDT_IRQn = @enumToInt(IRQn.WDT); pub const TIMER0_IRQn = @enumToInt(IRQn.TIMER0); pub const TIMER1_IRQn = @enumToInt(IRQn.TIMER1); pub const TIMER2_IRQn = @enumToInt(IRQn.TIMER2); pub const TIMER3_IRQn = @enumToInt(IRQn.TIMER3); pub const UART0_IRQn = @enumToInt(IRQn.UART0); pub const UART1_IRQn = @enumToInt(IRQn.UART1); pub const UART2_IRQn = @enumToInt(IRQn.UART2); pub const UART3_IRQn = @enumToInt(IRQn.UART3); pub const PWM1_IRQn = @enumToInt(IRQn.PWM1); pub const I2C0_IRQn = @enumToInt(IRQn.I2C0); pub const I2C1_IRQn = @enumToInt(IRQn.I2C1); pub const I2C2_IRQn = @enumToInt(IRQn.I2C2); pub const SPI_IRQn = @enumToInt(IRQn.SPI); pub const SSP0_IRQn = @enumToInt(IRQn.SSP0); pub const SSP1_IRQn = @enumToInt(IRQn.SSP1); pub const PLL0_IRQn = @enumToInt(IRQn.PLL0); pub const RTC_IRQn = @enumToInt(IRQn.RTC); pub const EINT0_IRQn = @enumToInt(IRQn.EINT0); pub const EINT1_IRQn = @enumToInt(IRQn.EINT1); pub const EINT2_IRQn = @enumToInt(IRQn.EINT2); pub const EINT3_IRQn = @enumToInt(IRQn.EINT3); pub const ADC_IRQn = @enumToInt(IRQn.ADC); pub const BOD_IRQn = @enumToInt(IRQn.BOD); pub const USB_IRQn = @enumToInt(IRQn.USB); pub const CAN_IRQn = @enumToInt(IRQn.CAN); pub const DMA_IRQn = @enumToInt(IRQn.DMA); pub const I2S_IRQn = @enumToInt(IRQn.I2S); pub const ENET_IRQn = @enumToInt(IRQn.ENET); pub const RIT_IRQn = @enumToInt(IRQn.RIT); pub const MCPWM_IRQn = @enumToInt(IRQn.MCPWM); pub const QEI_IRQn = @enumToInt(IRQn.QEI); pub const PLL1_IRQn = @enumToInt(IRQn.PLL1); pub const IRQn = extern enum(isize) { NonMaskableInt = -14, MemoryManagement = -12, BusFault = -11, UsageFault = -10, SVCall = -5, DebugMonitor = -4, PendSV = -2, SysTick = -1, WDT = 0, TIMER0 = 1, TIMER1 = 2, TIMER2 = 3, TIMER3 = 4, UART0 = 5, UART1 = 6, UART2 = 7, UART3 = 8, PWM1 = 9, I2C0 = 10, I2C1 = 11, I2C2 = 12, SPI = 13, SSP0 = 14, SSP1 = 15, PLL0 = 16, RTC = 17, EINT0 = 18, EINT1 = 19, EINT2 = 20, EINT3 = 21, ADC = 22, BOD = 23, USB = 24, CAN = 25, DMA = 26, I2S = 27, ENET = 28, RIT = 29, MCPWM = 30, QEI = 31, PLL1 = 32, _, }; pub const NVIC_Type = extern struct { ISER: [8]u32, RESERVED0: [24]u32, ICER: [8]u32, RSERVED1: [24]u32, ISPR: [8]u32, RESERVED2: [24]u32, ICPR: [8]u32, RESERVED3: [24]u32, IABR: [8]u32, RESERVED4: [56]u32, IP: [240]u8, RESERVED5: [644]u32, STIR: u32, }; pub const SCB_Type = extern struct { CPUID: u32, ICSR: u32, VTOR: u32, AIRCR: u32, SCR: u32, CCR: u32, SHP: [12]u8, SHCSR: u32, CFSR: u32, HFSR: u32, DFSR: u32, MMFAR: u32, BFAR: u32, AFSR: u32, PFR: [2]u32, DFR: u32, ADR: u32, MMFR: [4]u32, ISAR: [5]u32, }; pub const SysTick_Type = extern struct { CTRL: u32, LOAD: u32, VAL: u32, CALIB: u32, }; const union_unnamed_5 = extern union { u8: u8, u16: u16, u32: u32, }; pub const ITM_Type = extern struct { PORT: [32]union_unnamed_5, RESERVED0: [864]u32, TER: u32, RESERVED1: [15]u32, TPR: u32, RESERVED2: [15]u32, TCR: u32, RESERVED3: [29]u32, IWR: u32, IRR: u32, IMCR: u32, RESERVED4: [43]u32, LAR: u32, LSR: u32, RESERVED5: [6]u32, PID4: u32, PID5: u32, PID6: u32, PID7: u32, PID0: u32, PID1: u32, PID2: u32, PID3: u32, CID0: u32, CID1: u32, CID2: u32, CID3: u32, }; pub const InterruptType_Type = extern struct { RESERVED0: u32, ICTR: u32, RESERVED1: u32, }; pub const MPU_Type = extern struct { TYPE: u32, CTRL: u32, RNR: u32, RBAR: u32, RASR: u32, RBAR_A1: u32, RASR_A1: u32, RBAR_A2: u32, RASR_A2: u32, RBAR_A3: u32, RASR_A3: u32, }; pub const CoreDebug_Type = extern struct { DHCSR: u32, DCRSR: u32, DCRDR: u32, DEMCR: u32, }; pub extern fn __get_PSP() u32; pub extern fn __set_PSP(topOfProcStack: u32) void; pub extern fn __get_MSP() u32; pub extern fn __set_MSP(topOfMainStack: u32) void; pub extern fn __get_BASEPRI() u32; pub extern fn __set_BASEPRI(basePri: u32) void; pub extern fn __get_PRIMASK() u32; pub extern fn __set_PRIMASK(priMask: u32) void; pub extern fn __get_FAULTMASK() u32; pub extern fn __set_FAULTMASK(faultMask: u32) void; pub extern fn __get_CONTROL() u32; pub extern fn __set_CONTROL(control: u32) void; pub extern fn __REV(value: u32) u32; pub extern fn __REV16(value: u16) u32; pub extern fn __REVSH(value: i16) i32; pub extern fn __RBIT(value: u32) u32; pub extern fn __LDREXB(addr: [*c]u8) u8; pub extern fn __LDREXH(addr: [*c]u16) u16; pub extern fn __LDREXW(addr: [*c]u32) u32; pub extern fn __STREXB(value: u8, addr: [*c]u8) u32; pub extern fn __STREXH(value: u16, addr: [*c]u16) u32; pub extern fn __STREXW(value: u32, addr: [*c]u32) u32; pub inline fn NVIC_SetPriorityGrouping(PriorityGroup: u32) void { const PriorityGroupTmp = (PriorityGroup & 0x07); // only values 0..7 are used var reg_value = SCB.AIRCR; // read old register configuration reg_value &= ~((0xFFFF << 16) | (0x0F << 8)); // clear bits to change reg_value = ((reg_value | NVIC_AIRCR_VECTKEY | (PriorityGroupTmp << 8))); // Insert write key and priorty group SCB.AIRCR = reg_value; } // pub fn NVIC_GetPriorityGrouping() callconv(.C) u32 { // return (((@intToPtr([*c]SCB_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 3328))))).*.AIRCR >> @intCast(u5, 8)) & @bitCast(c_uint, @as(c_int, 7))); // } pub inline fn NVIC_SetHandler(irq: IRQn, handler: *allowzero const c_void) void { const base = @intToPtr([*]u32, SCB.VTOR); const offset = @intCast(usize, 16 + @enumToInt(irq)); base[offset] = @bitCast(u32, @ptrToInt(handler)); } // pub fn NVIC_EnableIRQ(arg_IRQn_1: IRQn) callconv(.C) void { // var IRQn_1 = arg_IRQn_1; // (@intToPtr([*c]NVIC_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 256))))).*.ISER[(@enumToInt((IRQn_1)) >> @intCast(u5, 5))] = @bitCast(u32, (@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (@enumToInt((IRQn_1)) & @bitCast(c_uint, @as(c_int, 31)))))); // } // pub fn NVIC_DisableIRQ(arg_IRQn_1: IRQn) callconv(.C) void { // var IRQn_1 = arg_IRQn_1; // (@intToPtr([*c]NVIC_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 256))))).*.ICER[(@enumToInt((IRQn_1)) >> @intCast(u5, 5))] = @bitCast(u32, (@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (@enumToInt((IRQn_1)) & @bitCast(c_uint, @as(c_int, 31)))))); // } // pub fn NVIC_GetPendingIRQ(arg_IRQn_1: IRQn) callconv(.C) u32 { // var IRQn_1 = arg_IRQn_1; // return (@bitCast(u32, (if (((@intToPtr([*c]NVIC_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 256))))).*.ISPR[@enumToInt((IRQn_1)) >> @intCast(u5, 5)] & @bitCast(c_uint, (@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (@enumToInt((IRQn_1)) & @bitCast(c_uint, @as(c_int, 31))))))) != 0) @as(c_int, 1) else @as(c_int, 0)))); // } // pub fn NVIC_SetPendingIRQ(arg_IRQn_1: IRQn) callconv(.C) void { // var IRQn_1 = arg_IRQn_1; // (@intToPtr([*c]NVIC_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 256))))).*.ISPR[(@enumToInt((IRQn_1)) >> @intCast(u5, 5))] = @bitCast(u32, (@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (@enumToInt((IRQn_1)) & @bitCast(c_uint, @as(c_int, 31)))))); // } // pub fn NVIC_ClearPendingIRQ(arg_IRQn_1: IRQn) callconv(.C) void { // var IRQn_1 = arg_IRQn_1; // (@intToPtr([*c]NVIC_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 256))))).*.ICPR[(@enumToInt((IRQn_1)) >> @intCast(u5, 5))] = @bitCast(u32, (@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (@enumToInt((IRQn_1)) & @bitCast(c_uint, @as(c_int, 31)))))); // } // pub fn NVIC_GetActive(arg_IRQn_1: IRQn) callconv(.C) u32 { // var IRQn_1 = arg_IRQn_1; // return (@bitCast(u32, (if (((@intToPtr([*c]NVIC_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 256))))).*.IABR[@enumToInt((IRQn_1)) >> @intCast(u5, 5)] & @bitCast(c_uint, (@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (@enumToInt((IRQn_1)) & @bitCast(c_uint, @as(c_int, 31))))))) != 0) @as(c_int, 1) else @as(c_int, 0)))); // } const __MPU_PRESENT = 1; const __NVIC_PRIO_BITS = 5; const __Vendor_SysTickConfig = 0; pub inline fn NVIC_SetPriority(irq: IRQn, priority: u32) void { const irq_number = @enumToInt(irq); if (irq_number < 0) { // set Priority for Cortex-M3 System Interrupts SCB.SHP[@intCast(u32, irq_number & 0xF) - 4] = @truncate(u8, priority << (8 - __NVIC_PRIO_BITS)); } else { // set Priority for device specific Interrupts NVIC.IP[@intCast(u32, irq_number)] = @truncate(u8, priority << (8 - __NVIC_PRIO_BITS)); } } // pub fn NVIC_GetPriority(arg_IRQn_1: IRQn) callconv(.C) u32 { // var IRQn_1 = arg_IRQn_1; // if (@enumToInt(IRQn_1) < @as(c_int, 0)) { // return (@bitCast(u32, (@bitCast(c_int, @as(c_uint, (@intToPtr([*c]SCB_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 3328))))).*.SHP[((@enumToInt((IRQn_1)) & @bitCast(c_uint, @as(c_int, 15))) -% @bitCast(c_uint, @as(c_int, 4)))])) >> @intCast(std.math.Log2Int(c_int), (@as(c_int, 8) - @as(c_int, 5)))))); // } else { // return (@bitCast(u32, (@bitCast(c_int, @as(c_uint, (@intToPtr([*c]NVIC_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 256))))).*.IP[@enumToInt((IRQn_1))])) >> @intCast(std.math.Log2Int(c_int), (@as(c_int, 8) - @as(c_int, 5)))))); // } // return 0; // } // pub fn NVIC_EncodePriority(arg_PriorityGroup: u32, arg_PreemptPriority: u32, arg_SubPriority: u32) callconv(.C) u32 { // var PriorityGroup = arg_PriorityGroup; // var PreemptPriority = arg_PreemptPriority; // var SubPriority = arg_SubPriority; // var PriorityGroupTmp: u32 = (PriorityGroup & @bitCast(c_uint, @as(c_int, 7))); // var PreemptPriorityBits: u32 = undefined; // var SubPriorityBits: u32 = undefined; // PreemptPriorityBits = if ((@bitCast(c_uint, @as(c_int, 7)) -% PriorityGroupTmp) > @bitCast(c_uint, @as(c_int, 5))) @bitCast(c_uint, @as(c_int, 5)) else (@bitCast(c_uint, @as(c_int, 7)) -% PriorityGroupTmp); // SubPriorityBits = if ((PriorityGroupTmp +% @bitCast(c_uint, @as(c_int, 5))) < @bitCast(c_uint, @as(c_int, 7))) @bitCast(c_uint, @as(c_int, 0)) else ((PriorityGroupTmp -% @bitCast(c_uint, @as(c_int, 7))) +% @bitCast(c_uint, @as(c_int, 5))); // return (((PreemptPriority & @bitCast(c_uint, ((@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (PreemptPriorityBits))) - @as(c_int, 1)))) << @intCast(std.math.Log2Int(c_uint), SubPriorityBits)) | (SubPriority & @bitCast(c_uint, ((@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (SubPriorityBits))) - @as(c_int, 1))))); // } // pub fn NVIC_DecodePriority(arg_Priority: u32, arg_PriorityGroup: u32, arg_pPreemptPriority: [*c]u32, arg_pSubPriority: [*c]u32) callconv(.C) void { // var Priority = arg_Priority; // var PriorityGroup = arg_PriorityGroup; // var pPreemptPriority = arg_pPreemptPriority; // var pSubPriority = arg_pSubPriority; // var PriorityGroupTmp: u32 = (PriorityGroup & @bitCast(c_uint, @as(c_int, 7))); // var PreemptPriorityBits: u32 = undefined; // var SubPriorityBits: u32 = undefined; // PreemptPriorityBits = if ((@bitCast(c_uint, @as(c_int, 7)) -% PriorityGroupTmp) > @bitCast(c_uint, @as(c_int, 5))) @bitCast(c_uint, @as(c_int, 5)) else (@bitCast(c_uint, @as(c_int, 7)) -% PriorityGroupTmp); // SubPriorityBits = if ((PriorityGroupTmp +% @bitCast(c_uint, @as(c_int, 5))) < @bitCast(c_uint, @as(c_int, 7))) @bitCast(c_uint, @as(c_int, 0)) else ((PriorityGroupTmp -% @bitCast(c_uint, @as(c_int, 7))) +% @bitCast(c_uint, @as(c_int, 5))); // pPreemptPriority.?.* = ((Priority >> @intCast(u5, SubPriorityBits)) & @bitCast(c_uint, ((@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (PreemptPriorityBits))) - @as(c_int, 1)))); // pSubPriority.?.* = ((Priority) & @bitCast(c_uint, ((@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), (SubPriorityBits))) - @as(c_int, 1)))); // } pub inline fn SysTick_Config(ticks: u24) !void { if (ticks > SYSTICK_MAXCOUNT) // Reload value impossible return error.OutOfRange; SysTick.LOAD = (ticks & SYSTICK_MAXCOUNT) - 1; // set reload register NVIC_SetPriority(.SysTick, (1 << __NVIC_PRIO_BITS) - 1); // set Priority for Cortex-M0 System Interrupts SysTick.VAL = 0x00; // Load the SysTick Counter Value SysTick.CTRL = (1 << SYSTICK_CLKSOURCE) | (1 << SYSTICK_ENABLE) | (1 << SYSTICK_TICKINT); // Enable SysTick IRQ and SysTick Timer } // pub fn NVIC_SystemReset() callconv(.C) void { // (@intToPtr([*c]SCB_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 3328))))).*.AIRCR = ((@bitCast(c_uint, (@as(c_int, 1530) << @intCast(std.math.Log2Int(c_int), 16))) | ((@intToPtr([*c]SCB_Type, ((@as(c_uint, 3758153728)) +% @bitCast(c_uint, @as(c_int, 3328))))).*.AIRCR & @bitCast(c_uint, (@as(c_int, 1792))))) | @bitCast(c_uint, (@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), 2)))); // __DSB(); // while (true) {} // } // pub fn ITM_SendChar(arg_ch: u32) callconv(.C) u32 { // var ch = arg_ch; // if (ch == @bitCast(c_uint, @as(c_int, '\n'))) _ = ITM_SendChar(@bitCast(u32, @as(c_int, '\r'))); // if (((((@intToPtr([*c]CoreDebug_Type, (@as(c_uint, 3758157296)))).*.DEMCR & @bitCast(c_uint, (@as(c_int, 1) << @intCast(std.math.Log2Int(c_int), 24)))) != 0) and (((@intToPtr([*c]ITM_Type, (@as(c_uint, 3758096384)))).*.TCR & @bitCast(c_uint, @as(c_int, 1))) != 0)) and ((@bitCast(c_ulong, @as(c_ulong, (@intToPtr([*c]ITM_Type, (@as(c_uint, 3758096384)))).*.TER)) & (@as(c_ulong, 1) << @intCast(std.math.Log2Int(c_ulong), 0))) != 0)) { // while ((@intToPtr([*c]ITM_Type, (@as(c_uint, 3758096384)))).*.PORT[@intCast(c_uint, @as(c_int, 0))].u32 == @bitCast(c_uint, @as(c_int, 0))) {} // (@intToPtr([*c]ITM_Type, (@as(c_uint, 3758096384)))).*.PORT[@intCast(c_uint, @as(c_int, 0))].u8 = @bitCast(u8, @truncate(u8, ch)); // } // return (ch); // } pub const LPC_SC_TypeDef = extern struct { const Self = @This(); pub const Peripherial = enum(u5) { tim0 = 1, tim1 = 2, uart0 = 3, uart1 = 4, pwm1 = 6, i2c0 = 7, spi = 8, rtc = 9, ssp1 = 10, adc = 12, can1 = 13, can2 = 14, gpio = 15, rit = 16, mcpwm = 17, qei = 18, i2c1 = 19, ssp0 = 21, tim2 = 22, tim3 = 23, uart2 = 24, uart3 = 25, i2c2 = 26, i2s = 27, gpdma = 29, enet = 30, usb = 31, }; pub const Power = packed enum(u1) { off = 0, on = 1 }; pub fn setPeripherialPower(self: *volatile Self, peripherial: Peripherial, power: Power) void { switch (power) { .on => self.PCONP |= (@as(u32, 1) << @enumToInt(peripherial)), .off => self.PCONP &= ~(@as(u32, 1) << @enumToInt(peripherial)), } } FLASHCFG: u32, RESERVED0: [31]u32, PLL0CON: u32, PLL0CFG: u32, PLL0STAT: u32, PLL0FEED: u32, RESERVED1: [4]u32, PLL1CON: u32, PLL1CFG: u32, PLL1STAT: u32, PLL1FEED: u32, RESERVED2: [4]u32, PCON: u32, PCONP: u32, RESERVED3: [15]u32, CCLKCFG: u32, USBCLKCFG: u32, CLKSRCSEL: u32, RESERVED4: [12]u32, EXTINT: u32, RESERVED5: u32, EXTMODE: u32, EXTPOLAR: u32, RESERVED6: [12]u32, RSID: u32, RESERVED7: [7]u32, SCS: u32, IRCTRIM: u32, PCLKSEL0: u32, PCLKSEL1: u32, RESERVED8: [4]u32, USBIntSt: u32, RESERVED9: u32, CLKOUTCFG: u32, }; pub const LPC_PINCON_TypeDef = extern struct { PINSEL: [10]u32, RESERVED0: [5]u32, PINMODE: [10]u32, PINMODE_OD: [5]u32, I2CPADCFG: u32, }; pub const LPC_GPIO_TypeDef = extern struct { FIODIR: u32, RESERVED0: [3]u32, FIOMASK: u32, FIOPIN: u32, FIOSET: u32, FIOCLR: u32, }; pub const LPC_GPIOINT_TypeDef = extern struct { IntStatus: u32, IO0IntStatR: u32, IO0IntStatF: u32, IO0IntClr: u32, IO0IntEnR: u32, IO0IntEnF: u32, RESERVED0: [3]u32, IO2IntStatR: u32, IO2IntStatF: u32, IO2IntClr: u32, IO2IntEnR: u32, IO2IntEnF: u32, }; pub const LPC_TIM_TypeDef = extern struct { IR: u32, TCR: u32, TC: u32, PR: u32, PC: u32, MCR: u32, MR0: u32, MR1: u32, MR2: u32, MR3: u32, CCR: u32, CR0: u32, CR1: u32, RESERVED0: [2]u32, EMR: u32, RESERVED1: [12]u32, CTCR: u32, }; pub const LPC_PWM_TypeDef = extern struct { IR: u32, TCR: u32, TC: u32, PR: u32, PC: u32, MCR: u32, MR0: u32, MR1: u32, MR2: u32, MR3: u32, CCR: u32, CR0: u32, CR1: u32, CR2: u32, CR3: u32, RESERVED0: u32, MR4: u32, MR5: u32, MR6: u32, PCR: u32, LER: u32, RESERVED1: [7]u32, CTCR: u32, }; pub const LPC_UART_TypeDef = extern struct { unnamed_0: extern union { RBR: u8, THR: u8, DLL: u8, RESERVED0: u32, }, unnamed_1: extern union { DLM: u8, IER: u32, }, unnamed_2: extern union { IIR: u32, FCR: u8, }, LCR: u8, RESERVED1: [7]u8, LSR: u8, RESERVED2: [7]u8, SCR: u8, RESERVED3: [3]u8, ACR: u32, ICR: u8, RESERVED4: [3]u8, FDR: u8, RESERVED5: [7]u8, TER: u8, RESERVED6: [39]u8, FIFOLVL: u8, }; pub const LPC_UART0_TypeDef = extern struct { uart: LPC_UART_TypeDef, RESERVED7: [363]u8, DMAREQSEL: u32, }; pub const LPC_UART1_TypeDef = extern struct { unnamed_0: extern union { RBR: u8, THR: u8, DLL: u8, RESERVED0: u32, }, unnamed_1: extern union { DLM: u8, IER: u32, }, unnamed_2: extern union { IIR: u32, FCR: u8, }, LCR: u8, RESERVED1: [3]u8, MCR: u8, RESERVED2: [3]u8, LSR: u8, RESERVED3: [3]u8, MSR: u8, RESERVED4: [3]u8, SCR: u8, RESERVED5: [3]u8, ACR: u32, RESERVED6: u32, FDR: u32, RESERVED7: u32, TER: u8, RESERVED8: [27]u8, RS485CTRL: u8, RESERVED9: [3]u8, ADRMATCH: u8, RESERVED10: [3]u8, RS485DLY: u8, RESERVED11: [3]u8, FIFOLVL: u8, }; pub const LPC_SPI_TypeDef = extern struct { SPCR: u32, SPSR: u32, SPDR: u32, SPCCR: u32, RESERVED0: [3]u32, SPINT: u32, }; pub const LPC_SSP_TypeDef = extern struct { CR0: u32, CR1: u32, DR: u32, SR: u32, CPSR: u32, IMSC: u32, RIS: u32, MIS: u32, ICR: u32, DMACR: u32, }; pub const LPC_I2C_TypeDef = extern struct { I2CONSET: u32, I2STAT: u32, I2DAT: u32, I2ADR0: u32, I2SCLH: u32, I2SCLL: u32, I2CONCLR: u32, MMCTRL: u32, I2ADR1: u32, I2ADR2: u32, I2ADR3: u32, I2DATA_BUFFER: u32, I2MASK0: u32, I2MASK1: u32, I2MASK2: u32, I2MASK3: u32, }; pub const LPC_I2S_TypeDef = extern struct { I2SDAO: u32, I2SDAI: u32, I2STXFIFO: u32, I2SRXFIFO: u32, I2SSTATE: u32, I2SDMA1: u32, I2SDMA2: u32, I2SIRQ: u32, I2STXRATE: u32, I2SRXRATE: u32, I2STXBITRATE: u32, I2SRXBITRATE: u32, I2STXMODE: u32, I2SRXMODE: u32, }; pub const LPC_RIT_TypeDef = extern struct { RICOMPVAL: u32, RIMASK: u32, RICTRL: u8, RESERVED0: [3]u8, RICOUNTER: u32, }; pub const LPC_RTC_TypeDef = extern struct { ILR: u8, RESERVED0: [7]u8, CCR: u8, RESERVED1: [3]u8, CIIR: u8, RESERVED2: [3]u8, AMR: u8, RESERVED3: [3]u8, CTIME0: u32, CTIME1: u32, CTIME2: u32, SEC: u8, RESERVED4: [3]u8, MIN: u8, RESERVED5: [3]u8, HOUR: u8, RESERVED6: [3]u8, DOM: u8, RESERVED7: [3]u8, DOW: u8, RESERVED8: [3]u8, DOY: u16, RESERVED9: u16, MONTH: u8, RESERVED10: [3]u8, YEAR: u16, RESERVED11: u16, CALIBRATION: u32, GPREG0: u32, GPREG1: u32, GPREG2: u32, GPREG3: u32, GPREG4: u32, RTC_AUXEN: u8, RESERVED12: [3]u8, RTC_AUX: u8, RESERVED13: [3]u8, ALSEC: u8, RESERVED14: [3]u8, ALMIN: u8, RESERVED15: [3]u8, ALHOUR: u8, RESERVED16: [3]u8, ALDOM: u8, RESERVED17: [3]u8, ALDOW: u8, RESERVED18: [3]u8, ALDOY: u16, RESERVED19: u16, ALMON: u8, RESERVED20: [3]u8, ALYEAR: u16, RESERVED21: u16, }; pub const LPC_WDT_TypeDef = extern struct { WDMOD: u8, RESERVED0: [3]u8, WDTC: u32, WDFEED: u8, RESERVED1: [3]u8, WDTV: u32, WDCLKSEL: u32, }; pub const LPC_ADC_TypeDef = extern struct { ADCR: u32, ADGDR: u32, RESERVED0: u32, ADINTEN: u32, ADDR0: u32, ADDR1: u32, ADDR2: u32, ADDR3: u32, ADDR4: u32, ADDR5: u32, ADDR6: u32, ADDR7: u32, ADSTAT: u32, ADTRM: u32, }; pub const LPC_DAC_TypeDef = extern struct { DACR: u32, DACCTRL: u32, DACCNTVAL: u16, }; pub const LPC_MCPWM_TypeDef = extern struct { MCCON: u32, MCCON_SET: u32, MCCON_CLR: u32, MCCAPCON: u32, MCCAPCON_SET: u32, MCCAPCON_CLR: u32, MCTIM0: u32, MCTIM1: u32, MCTIM2: u32, MCPER0: u32, MCPER1: u32, MCPER2: u32, MCPW0: u32, MCPW1: u32, MCPW2: u32, MCDEADTIME: u32, MCCCP: u32, MCCR0: u32, MCCR1: u32, MCCR2: u32, MCINTEN: u32, MCINTEN_SET: u32, MCINTEN_CLR: u32, MCCNTCON: u32, MCCNTCON_SET: u32, MCCNTCON_CLR: u32, MCINTFLAG: u32, MCINTFLAG_SET: u32, MCINTFLAG_CLR: u32, MCCAP_CLR: u32, }; pub const LPC_QEI_TypeDef = extern struct { QEICON: u32, QEISTAT: u32, QEICONF: u32, QEIPOS: u32, QEIMAXPOS: u32, CMPOS0: u32, CMPOS1: u32, CMPOS2: u32, INXCNT: u32, INXCMP: u32, QEILOAD: u32, QEITIME: u32, QEIVEL: u32, QEICAP: u32, VELCOMP: u32, FILTER: u32, RESERVED0: [998]u32, QEIIEC: u32, QEIIES: u32, QEIINTSTAT: u32, QEIIE: u32, QEICLR: u32, QEISET: u32, }; pub const LPC_CANAF_RAM_TypeDef = extern struct { mask: [512]u32, }; pub const LPC_CANAF_TypeDef = extern struct { AFMR: u32, SFF_sa: u32, SFF_GRP_sa: u32, EFF_sa: u32, EFF_GRP_sa: u32, ENDofTable: u32, LUTerrAd: u32, LUTerr: u32, FCANIE: u32, FCANIC0: u32, FCANIC1: u32, }; pub const LPC_CANCR_TypeDef = extern struct { CANTxSR: u32, CANRxSR: u32, CANMSR: u32, }; pub const LPC_CAN_TypeDef = extern struct { MOD: u32, CMR: u32, GSR: u32, ICR: u32, IER: u32, BTR: u32, EWL: u32, SR: u32, RFS: u32, RID: u32, RDA: u32, RDB: u32, TFI1: u32, TID1: u32, TDA1: u32, TDB1: u32, TFI2: u32, TID2: u32, TDA2: u32, TDB2: u32, TFI3: u32, TID3: u32, TDA3: u32, TDB3: u32, }; pub const LPC_GPDMA_TypeDef = extern struct { DMACIntStat: u32, DMACIntTCStat: u32, DMACIntTCClear: u32, DMACIntErrStat: u32, DMACIntErrClr: u32, DMACRawIntTCStat: u32, DMACRawIntErrStat: u32, DMACEnbldChns: u32, DMACSoftBReq: u32, DMACSoftSReq: u32, DMACSoftLBReq: u32, DMACSoftLSReq: u32, DMACConfig: u32, DMACSync: u32, }; pub const LPC_GPDMACH_TypeDef = extern struct { DMACCSrcAddr: u32, DMACCDestAddr: u32, DMACCLLI: u32, DMACCControl: u32, DMACCConfig: u32, }; const union_unnamed_45 = extern union { USBClkCtrl: u32, OTGClkCtrl: u32, }; const union_unnamed_46 = extern union { USBClkSt: u32, OTGClkSt: u32, }; pub const LPC_USB_TypeDef = extern struct { HcRevision: u32, HcControl: u32, HcCommandStatus: u32, HcInterruptStatus: u32, HcInterruptEnable: u32, HcInterruptDisable: u32, HcHCCA: u32, HcPeriodCurrentED: u32, HcControlHeadED: u32, HcControlCurrentED: u32, HcBulkHeadED: u32, HcBulkCurrentED: u32, HcDoneHead: u32, HcFmInterval: u32, HcFmRemaining: u32, HcFmNumber: u32, HcPeriodicStart: u32, HcLSTreshold: u32, HcRhDescriptorA: u32, HcRhDescriptorB: u32, HcRhStatus: u32, HcRhPortStatus1: u32, HcRhPortStatus2: u32, RESERVED0: [40]u32, Module_ID: u32, OTGIntSt: u32, OTGIntEn: u32, OTGIntSet: u32, OTGIntClr: u32, OTGStCtrl: u32, OTGTmr: u32, RESERVED1: [58]u32, USBDevIntSt: u32, USBDevIntEn: u32, USBDevIntClr: u32, USBDevIntSet: u32, USBCmdCode: u32, USBCmdData: u32, USBRxData: u32, USBTxData: u32, USBRxPLen: u32, USBTxPLen: u32, USBCtrl: u32, USBDevIntPri: u32, USBEpIntSt: u32, USBEpIntEn: u32, USBEpIntClr: u32, USBEpIntSet: u32, USBEpIntPri: u32, USBReEp: u32, USBEpInd: u32, USBMaxPSize: u32, USBDMARSt: u32, USBDMARClr: u32, USBDMARSet: u32, RESERVED2: [9]u32, USBUDCAH: u32, USBEpDMASt: u32, USBEpDMAEn: u32, USBEpDMADis: u32, USBDMAIntSt: u32, USBDMAIntEn: u32, RESERVED3: [2]u32, USBEoTIntSt: u32, USBEoTIntClr: u32, USBEoTIntSet: u32, USBNDDRIntSt: u32, USBNDDRIntClr: u32, USBNDDRIntSet: u32, USBSysErrIntSt: u32, USBSysErrIntClr: u32, USBSysErrIntSet: u32, RESERVED4: [15]u32, I2C_RX: u32, I2C_WO: u32, I2C_STS: u32, I2C_CTL: u32, I2C_CLKHI: u32, I2C_CLKLO: u32, RESERVED5: [823]u32, unnamed_0: union_unnamed_45, unnamed_1: union_unnamed_46, }; pub const LPC_EMAC_TypeDef = extern struct { MAC1: u32, MAC2: u32, IPGT: u32, IPGR: u32, CLRT: u32, MAXF: u32, SUPP: u32, TEST: u32, MCFG: u32, MCMD: u32, MADR: u32, MWTD: u32, MRDD: u32, MIND: u32, RESERVED0: [2]u32, SA0: u32, SA1: u32, SA2: u32, RESERVED1: [45]u32, Command: u32, Status: u32, RxDescriptor: u32, RxStatus: u32, RxDescriptorNumber: u32, RxProduceIndex: u32, RxConsumeIndex: u32, TxDescriptor: u32, TxStatus: u32, TxDescriptorNumber: u32, TxProduceIndex: u32, TxConsumeIndex: u32, RESERVED2: [10]u32, TSV0: u32, TSV1: u32, RSV: u32, RESERVED3: [3]u32, FlowControlCounter: u32, FlowControlStatus: u32, RESERVED4: [34]u32, RxFilterCtrl: u32, RxFilterWoLStatus: u32, RxFilterWoLClear: u32, RESERVED5: u32, HashFilterL: u32, HashFilterH: u32, RESERVED6: [882]u32, IntStatus: u32, IntEnable: u32, IntClear: u32, IntSet: u32, RESERVED7: u32, PowerDown: u32, RESERVED8: u32, Module_ID: u32, }; pub const NVIC_VECTRESET = 0; pub const NVIC_SYSRESETREQ = 2; pub const NVIC_AIRCR_VECTKEY = 0x5FA << 16; pub const NVIC_AIRCR_ENDIANESS = 15; pub const CoreDebug_DEMCR_TRCENA = 1 << 24; pub const ITM_TCR_ITMENA = 1; pub const SCS_BASE = 0xE000E000; pub const ITM_BASE = 0xE0000000; pub const CoreDebug_BASE = 0xE000EDF0; pub const SysTick_BASE = SCS_BASE + 0x0010; pub const NVIC_BASE = SCS_BASE + 0x0100; pub const SCB_BASE = SCS_BASE + 0x0D00; pub const InterruptType = @intToPtr(*volatile InterruptType_Type, SCS_BASE); pub const SCB = @intToPtr(*volatile SCB_Type, SCB_BASE); pub const SysTick = @intToPtr(*volatile SysTick_Type, SysTick_BASE); pub const NVIC = @intToPtr(*volatile NVIC_Type, NVIC_BASE); pub const ITM = @intToPtr(*volatile ITM_Type, ITM_BASE); pub const CoreDebug = @intToPtr(*volatile CoreDebug_Type, CoreDebug_BASE); pub const MPU_BASE = SCS_BASE + 0x0D90; pub const MPU = @intToPtr(*volatile MPU_Type, MPU_BASE); pub const SYSTICK_ENABLE = 0; pub const SYSTICK_TICKINT = 1; pub const SYSTICK_CLKSOURCE = 2; pub const SYSTICK_MAXCOUNT = (1 << 24) - 1; pub const FLASH_BASE = 0x00000000; pub const RAM_BASE = 0x10000000; pub const GPIO_BASE = 0x2009C000; pub const APB0_BASE = 0x40000000; pub const APB1_BASE = 0x40080000; pub const AHB_BASE = 0x50000000; pub const CM3_BASE = 0xE0000000; pub const WDT_BASE = APB0_BASE + 0x00000; pub const TIM0_BASE = APB0_BASE + 0x04000; pub const TIM1_BASE = APB0_BASE + 0x08000; pub const UART0_BASE = APB0_BASE + 0x0C000; pub const UART1_BASE = APB0_BASE + 0x10000; pub const PWM1_BASE = APB0_BASE + 0x18000; pub const I2C0_BASE = APB0_BASE + 0x1C000; pub const SPI_BASE = APB0_BASE + 0x20000; pub const RTC_BASE = APB0_BASE + 0x24000; pub const GPIOINT_BASE = APB0_BASE + 0x28080; pub const PINCON_BASE = APB0_BASE + 0x2C000; pub const SSP1_BASE = APB0_BASE + 0x30000; pub const ADC_BASE = APB0_BASE + 0x34000; pub const CANAF_RAM_BASE = APB0_BASE + 0x38000; pub const CANAF_BASE = APB0_BASE + 0x3C000; pub const CANCR_BASE = APB0_BASE + 0x40000; pub const CAN1_BASE = APB0_BASE + 0x44000; pub const CAN2_BASE = APB0_BASE + 0x48000; pub const I2C1_BASE = APB0_BASE + 0x5C000; pub const SSP0_BASE = APB1_BASE + 0x08000; pub const DAC_BASE = APB1_BASE + 0x0C000; pub const TIM2_BASE = APB1_BASE + 0x10000; pub const TIM3_BASE = APB1_BASE + 0x14000; pub const UART2_BASE = APB1_BASE + 0x18000; pub const UART3_BASE = APB1_BASE + 0x1C000; pub const I2C2_BASE = APB1_BASE + 0x20000; pub const I2S_BASE = APB1_BASE + 0x28000; pub const RIT_BASE = APB1_BASE + 0x30000; pub const MCPWM_BASE = PB1_BASE + 0x38000; pub const QEI_BASE = APB1_BASE + 0x3C000; pub const SC_BASE = APB1_BASE + 0x7C000; pub const EMAC_BASE = AHB_BASE + 0x00000; pub const GPDMA_BASE = AHB_BASE + 0x04000; pub const GPDMACH0_BASE = AHB_BASE + 0x04100; pub const GPDMACH1_BASE = AHB_BASE + 0x04120; pub const GPDMACH2_BASE = AHB_BASE + 0x04140; pub const GPDMACH3_BASE = AHB_BASE + 0x04160; pub const GPDMACH4_BASE = AHB_BASE + 0x04180; pub const GPDMACH5_BASE = AHB_BASE + 0x041A0; pub const GPDMACH6_BASE = AHB_BASE + 0x041C0; pub const GPDMACH7_BASE = AHB_BASE + 0x041E0; pub const USB_BASE = AHB_BASE + 0x0C000; pub const GPIO0_BASE = GPIO_BASE + 0x00000; pub const GPIO1_BASE = GPIO_BASE + 0x00020; pub const GPIO2_BASE = GPIO_BASE + 0x00040; pub const GPIO3_BASE = GPIO_BASE + 0x00060; pub const GPIO4_BASE = GPIO_BASE + 0x00080; pub inline fn __LPC_MODULE(comptime _Type: type, comptime _Base: u32) *volatile _Type { return @intToPtr(*volatile _Type, _Base); } pub const sc = __LPC_MODULE(LPC_SC_TypeDef, SC_BASE); pub const gpio0 = __LPC_MODULE(LPC_GPIO_TypeDef, GPIO0_BASE); pub const gpio1 = __LPC_MODULE(LPC_GPIO_TypeDef, GPIO1_BASE); pub const gpio2 = __LPC_MODULE(LPC_GPIO_TypeDef, GPIO2_BASE); pub const gpio3 = __LPC_MODULE(LPC_GPIO_TypeDef, GPIO3_BASE); pub const gpio4 = __LPC_MODULE(LPC_GPIO_TypeDef, GPIO4_BASE); pub const wdt = __LPC_MODULE(LPC_WDT_TypeDef, WDT_BASE); pub const tim0 = __LPC_MODULE(LPC_TIM_TypeDef, TIM0_BASE); pub const tim1 = __LPC_MODULE(LPC_TIM_TypeDef, TIM1_BASE); pub const tim2 = __LPC_MODULE(LPC_TIM_TypeDef, TIM2_BASE); pub const tim3 = __LPC_MODULE(LPC_TIM_TypeDef, TIM3_BASE); pub const rit = __LPC_MODULE(LPC_RIT_TypeDef, RIT_BASE); pub const uart0 = __LPC_MODULE(LPC_UART0_TypeDef, UART0_BASE); pub const uart1 = __LPC_MODULE(LPC_UART1_TypeDef, UART1_BASE); pub const uart2 = __LPC_MODULE(LPC_UART_TypeDef, UART2_BASE); pub const uart3 = __LPC_MODULE(LPC_UART_TypeDef, UART3_BASE); pub const pwm1 = __LPC_MODULE(LPC_PWM_TypeDef, PWM1_BASE); pub const i2c0 = __LPC_MODULE(LPC_I2C_TypeDef, I2C0_BASE); pub const i2c1 = __LPC_MODULE(LPC_I2C_TypeDef, I2C1_BASE); pub const i2c2 = __LPC_MODULE(LPC_I2C_TypeDef, I2C2_BASE); pub const i2s = __LPC_MODULE(LPC_I2S_TypeDef, I2S_BASE); pub const spi = __LPC_MODULE(LPC_SPI_TypeDef, SPI_BASE); pub const rtc = __LPC_MODULE(LPC_RTC_TypeDef, RTC_BASE); pub const gpioint = __LPC_MODULE(LPC_GPIOINT_TypeDef, GPIOINT_BASE); pub const pincon = __LPC_MODULE(LPC_PINCON_TypeDef, PINCON_BASE); pub const ssp0 = __LPC_MODULE(LPC_SSP_TypeDef, SSP0_BASE); pub const ssp1 = __LPC_MODULE(LPC_SSP_TypeDef, SSP1_BASE); pub const adc = __LPC_MODULE(LPC_ADC_TypeDef, ADC_BASE); pub const dac = __LPC_MODULE(LPC_DAC_TypeDef, DAC_BASE); pub const canaf_ram = __LPC_MODULE(LPC_CANAF_RAM_TypeDef, CANAF_RAM_BASE); pub const canaf = __LPC_MODULE(LPC_CANAF_TypeDef, CANAF_BASE); pub const cancr = __LPC_MODULE(LPC_CANCR_TypeDef, CANCR_BASE); pub const can1 = __LPC_MODULE(LPC_CAN_TypeDef, CAN1_BASE); pub const can2 = __LPC_MODULE(LPC_CAN_TypeDef, CAN2_BASE); pub const mcpwm = __LPC_MODULE(LPC_MCPWM_TypeDef, MCPWM_BASE); pub const qei = __LPC_MODULE(LPC_QEI_TypeDef, QEI_BASE); pub const emac = __LPC_MODULE(LPC_EMAC_TypeDef, EMAC_BASE); pub const gpdma = __LPC_MODULE(LPC_GPDMA_TypeDef, GPDMA_BASE); pub const gpdmach0 = __LPC_MODULE(LPC_GPDMACH_TypeDef, GPDMACH0_BASE); pub const gpdmach1 = __LPC_MODULE(LPC_GPDMACH_TypeDef, GPDMACH1_BASE); pub const gpdmach2 = __LPC_MODULE(LPC_GPDMACH_TypeDef, GPDMACH2_BASE); pub const gpdmach3 = __LPC_MODULE(LPC_GPDMACH_TypeDef, GPDMACH3_BASE); pub const gpdmach4 = __LPC_MODULE(LPC_GPDMACH_TypeDef, GPDMACH4_BASE); pub const gpdmach5 = __LPC_MODULE(LPC_GPDMACH_TypeDef, GPDMACH5_BASE); pub const gpdmach6 = __LPC_MODULE(LPC_GPDMACH_TypeDef, GPDMACH6_BASE); pub const gpdmach7 = __LPC_MODULE(LPC_GPDMACH_TypeDef, GPDMACH7_BASE); pub const usb = __LPC_MODULE(LPC_USB_TypeDef, USB_BASE);
research-chamber/libs/lpc1768/lpc1768.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"); /// Representation of a reference log pub const Reflog = opaque { /// Free the reflog pub fn deinit(self: *Reflog) void { log.debug("Reflog.deinit called", .{}); c.git_reflog_free(@ptrCast(*c.git_reflog, self)); log.debug("reflog freed successfully", .{}); } /// Write an existing in-memory reflog object back to disk using an atomic file lock. pub fn write(self: *Reflog) !void { log.debug("Reflog.write called", .{}); try internal.wrapCall("git_reflog_write", .{ @ptrCast(*c.git_reflog, self), }); log.debug("successfully wrote reflog", .{}); } /// Add a new entry to the in-memory reflog. /// /// ## Parameters /// * `id` - The OID the reference is now pointing to /// * `signature` - The signature of the committer /// * `msg` - The reflog message, optional pub fn append( self: *Reflog, id: git.Oid, signature: git.Signature, msg: ?[:0]const u8, ) !void { // This check is to prevent formating the oid when we are not going to print anything if (@enumToInt(std.log.Level.debug) <= @enumToInt(std.log.level)) { var buf: [git.Oid.hex_buffer_size]u8 = undefined; const slice = try id.formatHex(&buf); log.debug("Reflog.append called, id: {s}, signature: {}, msg: {s}", .{ slice, signature, msg, }); } const c_msg = if (msg) |s| s.ptr else null; try internal.wrapCall("git_reflog_append", .{ @ptrCast(*c.git_reflog, self), @ptrCast(*const c.git_oid, &id), @ptrCast(*const c.git_signature, &signature), c_msg, }); log.debug("appended successfully", .{}); } /// Get the number of log entries in a reflog pub fn entryCount(self: *Reflog) usize { log.debug("Reflog.entryCount called", .{}); const ret = c.git_reflog_entrycount( @ptrCast(*c.git_reflog, self), ); log.debug("entry count: {}", .{ret}); return ret; } /// Lookup an entry by its index /// /// Requesting the reflog entry with an index of 0 (zero) will return the most recently created entry. /// /// ## Parameters /// * `index` - The position of the entry to lookup. Should be less than `Reflog.entryCount()` pub fn getEntry(self: *const Reflog, index: usize) ?*const ReflogEntry { log.debug("Reflog.getEntry called, index: {}", .{index}); return @ptrCast( ?*const ReflogEntry, c.git_reflog_entry_byindex( @ptrCast(*const c.git_reflog, self), index, ), ); } /// Remove an entry from the reflog by its index /// /// To ensure there's no gap in the log history, set `rewrite_previous_entry` param value to `true`. /// When deleting entry `n`, member old_oid of entry `n-1` (if any) will be updated with the value of member new_oid of entry /// `n+1`. /// /// ## Parameters /// * `index` - The position of the entry to lookup. Should be less than `Reflog.entryCount()` /// * `rewrite_previous_entry` - `true` to rewrite the history; `false` otherwise pub fn removeEntry(self: *Reflog, index: usize, rewrite_previous_entry: bool) !void { log.debug("Reflog.removeEntry called, index: {}, rewrite_previous_entry: {}", .{ index, rewrite_previous_entry }); try internal.wrapCall("git_reflog_drop", .{ @ptrCast(*c.git_reflog, self), index, @boolToInt(rewrite_previous_entry), }); log.debug("successfully removed entry", .{}); } /// Representation of a reference log entry pub const ReflogEntry = opaque { /// Get the old oid pub fn oldId(self: *const ReflogEntry) *const git.Oid { log.debug("ReflogEntry.oldId called", .{}); const ret = @ptrCast(*const git.Oid, c.git_reflog_entry_id_old( @ptrCast(*const c.git_reflog_entry, self), )); // This check is to prevent formating the oid when we are not going to print anything if (@enumToInt(std.log.Level.debug) <= @enumToInt(std.log.level)) { var buf: [git.Oid.hex_buffer_size]u8 = undefined; if (ret.formatHex(&buf)) |slice| { log.debug("old id: {s}", .{slice}); } else |_| {} } return ret; } /// Get the new oid pub fn newId(self: *const ReflogEntry) *const git.Oid { log.debug("ReflogEntry.newId called", .{}); const ret = @ptrCast(*const git.Oid, c.git_reflog_entry_id_new( @ptrCast(*const c.git_reflog_entry, self), )); // This check is to prevent formating the oid when we are not going to print anything if (@enumToInt(std.log.Level.debug) <= @enumToInt(std.log.level)) { var buf: [git.Oid.hex_buffer_size]u8 = undefined; if (ret.formatHex(&buf)) |slice| { log.debug("new id: {s}", .{slice}); } else |_| {} } return ret; } /// Get the committer of this entry pub fn commiter(self: *const ReflogEntry) *const git.Signature { log.debug("ReflogEntry.commiter called", .{}); const ret = @ptrCast(*const git.Signature, c.git_reflog_entry_committer( @ptrCast(*const c.git_reflog_entry, self), )); log.debug("commiter: {*}", .{ret}); return ret; } /// Get the log message pub fn message(self: *const ReflogEntry) ?[:0]const u8 { log.debug("ReflogEntry.message called", .{}); const opt_ret = @ptrCast(?[*:0]const u8, c.git_reflog_entry_message( @ptrCast(*const c.git_reflog_entry, self), )); if (opt_ret) |ret| { const slice = std.mem.sliceTo(ret, 0); log.debug("message: {s}", .{slice}); return slice; } log.debug("no message", .{}); return null; } comptime { std.testing.refAllDecls(@This()); } }; comptime { std.testing.refAllDecls(@This()); } }; comptime { std.testing.refAllDecls(@This()); }
src/reflog.zig
const std = @import("std"); const log = std.log; const ascii = std.ascii; const mem = std.mem; const testing = std.testing; const Allocator = mem.Allocator; const web = @import("zhp.zig"); const util = web.util; const Request = web.Request; const Headers = web.Headers; const simd = @import("simd.zig"); // Represents a file uploaded via a form. pub const FileUpload = struct { filename: []const u8, content_type: []const u8, body: []const u8, }; pub const ArgMap = util.StringArrayMap([]const u8); pub const FileMap = util.StringArrayMap(FileUpload); const WS = " \t\r\n"; pub const Form = struct { allocator: *Allocator, fields: ArgMap, files: FileMap, pub fn init(allocator: *Allocator) Form { return Form{ .allocator = allocator, .fields = ArgMap.init(allocator), .files = FileMap.init(allocator), }; } pub fn deinit(self: *Form) void { self.fields.deinit(); self.files.deinit(); } pub fn parse(self: *Form, request: *Request) !void { const content_type = try request.headers.get("Content-Type"); if (!request.read_finished) { if (request.stream) |stream| { try request.readBody(stream); } } if (request.content) |content| { switch (content.type) { .TempFile => { return error.NotImplemented; // TODO: Parsing should use a stream }, .Buffer => { try self.parseMultipart(content_type, content.data.buffer); }, } } } pub fn parseMultipart(self: *Form, content_type: []const u8, data: []const u8) !void { var iter = mem.split(content_type, ";"); while (iter.next()) |part| { const pair = mem.trim(u8, part, WS); const key = "boundary="; if (pair.len > key.len and mem.startsWith(u8, pair, key)) { const boundary = pair[key.len..]; try self.parseMultipartFormData(boundary, data); } } } pub fn parseMultipartFormData(self: *Form, boundary: []const u8, data: []const u8) !void { var bounds = boundary[0..]; if (mem.startsWith(u8, boundary, "\"") and mem.endsWith(u8, boundary, "\"")) { bounds = boundary[1 .. bounds.len - 1]; } if (bounds.len > 70) { return error.MultipartBoundaryTooLong; } var buf: [74]u8 = undefined; // Check final boundary const final_boundary = try std.fmt.bufPrint(&buf, "--{s}--", .{bounds}); const final_boundary_index = mem.lastIndexOf(u8, data, final_boundary); if (final_boundary_index == null) { log.warn("Invalid multipart/form-data: no final boundary", .{}); return error.MultipartFinalBoundaryMissing; } const separator = try std.fmt.bufPrint(&buf, "--{s}\r\n", .{bounds}); var fields = simd.split(data[0..final_boundary_index.?], separator); // TODO: Make these default capacities configurable var headers = try Headers.initCapacity(self.allocator, 8); defer headers.deinit(); var disp_params = try Headers.initCapacity(self.allocator, 8); defer disp_params.deinit(); while (fields.next()) |part| { if (part.len == 0) { continue; } const header_sep = "\r\n\r\n"; const eoh = mem.lastIndexOf(u8, part, header_sep); if (eoh == null) { log.warn("multipart/form-data missing headers: {s}", .{part}); continue; } const body = part[0 .. eoh.? + header_sep.len]; // NOTE: Do not free, data is assumed to be owned // also do not do this after parsing or the it will cause a memory leak headers.reset(); try headers.parseBuffer(body, body.len + 1); const disp_header = headers.getDefault("Content-Disposition", ""); disp_params.reset(); // NOTE: Do not free, data is assumed to be owned const disposition = try parseHeader(self.allocator, disp_header, &disp_params); if (!ascii.eqlIgnoreCase(disposition, "form-data")) { log.warn("Invalid multipart/form-data", .{}); continue; } var field_name = disp_params.getDefault("name", ""); if (field_name.len == 0) { log.warn("multipart/form-data value missing name", .{}); continue; } const field_value = part[body.len..part.len]; if (disp_params.contains("filename")) { const content_type = disp_params.getDefault("Content-Type", "application/octet-stream"); try self.files.append(field_name, FileUpload{ .filename = disp_params.getDefault("filename", ""), .body = field_value, .content_type = content_type, }); } else { try self.fields.append(field_name, field_value); } } } }; test "simple-form" { const content_type = "multipart/form-data; boundary=---------------------------389538318911445707002572116565"; const body = "-----------------------------389538318911445707002572116565\r\n" ++ "Content-Disposition: form-data; name=\"name\"\r\n" ++ "\r\n" ++ "Your name" ++ "-----------------------------389538318911445707002572116565\r\n" ++ "Content-Disposition: form-data; name=\"action\"\r\n" ++ "\r\n" ++ "1" ++ "-----------------------------389538318911445707002572116565--\r\n"; var form = Form.init(std.testing.allocator); defer form.deinit(); try form.parseMultipart(content_type, body); try testing.expectEqualStrings("Your name", form.fields.get("name").?); try testing.expectEqualStrings("1", form.fields.get("action").?); } test "simple-file-form" { const content_type = "multipart/form-data; boundary=1234"; const body = "--1234\r\n" ++ "Content-Disposition: form-data; name=files; filename=ab.txt\r\n" ++ "\r\n" ++ "Hello!\n" ++ "--1234--\r\n"; var form = Form.init(std.testing.allocator); defer form.deinit(); try form.parseMultipart(content_type, body); const f = form.files.get("files").?; try testing.expectEqualStrings(f.filename, "ab.txt"); try testing.expectEqualStrings(f.body, "Hello!\n"); } test "multi-file-form" { const content_type = "multipart/form-data; boundary=1234"; const body = "--1234\r\n" ++ "Content-Disposition: form-data; name=files; filename=ab.txt\r\n" ++ "\r\n" ++ "Hello!\n" ++ "--1234\r\n" ++ "Content-Disposition: form-data; name=files; filename=data.json; content-type=application/json\r\n" ++ "\r\n" ++ "{\"status\": \"OK\"}\n" ++ "--1234--\r\n"; var form = Form.init(std.testing.allocator); defer form.deinit(); try form.parseMultipart(content_type, body); const f = form.files.getArray("files").?; try testing.expect(f.items.len == 2); try testing.expectEqualStrings(f.items[0].filename, "ab.txt"); try testing.expectEqualStrings(f.items[0].body, "Hello!\n"); try testing.expectEqualStrings(f.items[1].filename, "data.json"); try testing.expectEqualStrings(f.items[1].content_type, "application/json"); } // Parse a header. // return the first value and update the params with everything else fn parseHeader(allocator: *Allocator, line: []const u8, params: *Headers) ![]const u8 { if (line.len == 0) return ""; var it = mem.split(line, ";"); // First part is returned as the main header value const value = if (it.next()) |p| mem.trim(u8, p, " \r\n") else ""; // Now get the rest of the parameters while (it.next()) |p| { // Split on = var i = mem.indexOf(u8, p, "="); if (i == null) continue; const name = mem.trim(u8, p[0..i.?], " \r\n"); const encoded_value = mem.trim(u8, p[i.? + 1 ..], " \r\n"); const decoded_value = try collapseRfc2231Value(allocator, encoded_value); try params.append(name, decoded_value); } try decodeRfc2231Params(allocator, params); return value; } fn collapseRfc2231Value(allocator: *Allocator, value: []const u8) ![]const u8 { _ = allocator; // TODO: Implement this.. return mem.trim(u8, value, "\""); } fn decodeRfc2231Params(allocator: *Allocator, params: *Headers) !void { _ = allocator; _ = params; // TODO: Implement this.. } test "parse-content-disposition-header" { const allocator = std.testing.allocator; const d = " form-data; name=\"fieldName\"; filename=\"filename.jpg\""; var params = try Headers.initCapacity(allocator, 5); defer params.deinit(); var v = try parseHeader(allocator, d, &params); try testing.expectEqualSlices(u8, "form-data", v); try testing.expectEqualSlices(u8, "fieldName", try params.get("name")); try testing.expectEqualSlices(u8, "filename.jpg", try params.get("filename")); } /// Inverse of parseHeader. /// This always returns a copy so it must be cleaned up! pub fn encodeHeader(allocator: *Allocator, key: []const u8, params: Headers) ![]const u8 { if (params.headers.items.len == 0) { return try mem.dupe(allocator, u8, key); } // I'm lazy var arena = std.heap.ArenaAllocator.init(allocator); defer arena.deinit(); var out = std.ArrayList([]const u8).init(&arena.allocator); try out.append(key); // Sort the parameters just to make it easy to test. for (params.headers.items) |entry| { if (entry.value.len == 0) { try out.append(entry.key); } else { // TODO: quote if necessary. try out.append(try std.fmt.allocPrint(&arena.allocator, "{}={}", .{ entry.key, entry.value })); } } return try mem.join(allocator, "; ", out.items); } test "encode-header" { const allocator = std.testing.allocator; var params = Headers.init(allocator); defer params.deinit(); var r = try encodeHeader(allocator, "permessage-deflate", params); try testing.expectEqualSlices(u8, "permessage-deflate", r); allocator.free(r); try params.append("client_no_context_takeover", ""); try params.append("client_max_window_bits", "15"); r = try encodeHeader(allocator, "permessage-deflate", params); try testing.expectEqualSlices(u8, r, "permessage-deflate; client_no_context_takeover; client_max_window_bits=15"); allocator.free(r); }
src/forms.zig
const getty = @import("../../../lib.zig"); const std = @import("std"); pub fn Visitor(comptime Pointer: type) type { if (@typeInfo(Pointer) != .Pointer or @typeInfo(Pointer).Pointer.size != .One) { @compileError("expected one pointer, found `" ++ @typeName(Pointer) ++ "`"); } return struct { const Self = @This(); pub usingnamespace getty.de.Visitor( Self, Value, visitBool, visitEnum, visitFloat, visitInt, visitMap, visitNull, visitSeq, visitString, visitSome, visitVoid, ); const Value = Pointer; fn visitBool(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type, input: bool) Deserializer.Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(Deserializer, Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitBool(allocator, Deserializer, input); return value; } fn visitEnum(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type, input: anytype) Deserializer.Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(Deserializer, Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitEnum(allocator, Deserializer, input); return value; } fn visitFloat(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type, input: anytype) Deserializer.Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(Deserializer, Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitFloat(allocator, Deserializer, input); return value; } fn visitInt(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type, input: anytype) Deserializer.Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(Deserializer, Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitInt(allocator, Deserializer, input); return value; } fn visitMap(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type, map: anytype) Deserializer.Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(Deserializer, Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitMap(allocator, Deserializer, map); return value; } fn visitNull(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type) Deserializer.Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(Deserializer, Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitNull(allocator, Deserializer); return value; } fn visitSeq(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type, seq: anytype) Deserializer.Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(Deserializer, Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitSeq(allocator, Deserializer, seq); return value; } fn visitString(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type, input: anytype) Deserializer.Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(Deserializer, Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitString(allocator, Deserializer, input); return value; } fn visitSome(_: Self, allocator: ?std.mem.Allocator, deserializer: anytype) @TypeOf(deserializer).Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(@TypeOf(deserializer), Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitSome(allocator, deserializer); return value; } fn visitVoid(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type) Deserializer.Error!Value { const value = try allocator.?.create(Child); errdefer getty.de.free(allocator.?, value); var child_visitor = getty.de.find_db(Deserializer, Child).Visitor(Child){}; value.* = try child_visitor.visitor().visitVoid(allocator, Deserializer); return value; } const Child = std.meta.Child(Pointer); }; }
src/de/impl/visitor/pointer.zig
const std = @import("std"); const mem = std.mem; const TerminalPunctuation = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 33, hi: u21 = 121482, pub fn init(allocator: *mem.Allocator) !TerminalPunctuation { var instance = TerminalPunctuation{ .allocator = allocator, .array = try allocator.alloc(bool, 121450), }; mem.set(bool, instance.array, false); var index: u21 = 0; instance.array[0] = true; instance.array[11] = true; instance.array[13] = true; index = 25; while (index <= 26) : (index += 1) { instance.array[index] = true; } instance.array[30] = true; instance.array[861] = true; instance.array[870] = true; instance.array[1384] = true; instance.array[1442] = true; instance.array[1515] = true; instance.array[1530] = true; index = 1533; while (index <= 1534) : (index += 1) { instance.array[index] = true; } instance.array[1715] = true; index = 1759; while (index <= 1769) : (index += 1) { instance.array[index] = true; } instance.array[1771] = true; index = 2007; while (index <= 2008) : (index += 1) { instance.array[index] = true; } index = 2063; while (index <= 2077) : (index += 1) { instance.array[index] = true; } instance.array[2109] = true; index = 2371; while (index <= 2372) : (index += 1) { instance.array[index] = true; } index = 3641; while (index <= 3642) : (index += 1) { instance.array[index] = true; } instance.array[3815] = true; index = 3820; while (index <= 3825) : (index += 1) { instance.array[index] = true; } index = 4137; while (index <= 4138) : (index += 1) { instance.array[index] = true; } index = 4928; while (index <= 4935) : (index += 1) { instance.array[index] = true; } instance.array[5709] = true; index = 5834; while (index <= 5836) : (index += 1) { instance.array[index] = true; } index = 5908; while (index <= 5909) : (index += 1) { instance.array[index] = true; } index = 6067; while (index <= 6069) : (index += 1) { instance.array[index] = true; } instance.array[6073] = true; index = 6113; while (index <= 6116) : (index += 1) { instance.array[index] = true; } index = 6119; while (index <= 6120) : (index += 1) { instance.array[index] = true; } index = 6435; while (index <= 6436) : (index += 1) { instance.array[index] = true; } index = 6791; while (index <= 6794) : (index += 1) { instance.array[index] = true; } index = 6969; while (index <= 6970) : (index += 1) { instance.array[index] = true; } index = 6972; while (index <= 6974) : (index += 1) { instance.array[index] = true; } index = 7194; while (index <= 7198) : (index += 1) { instance.array[index] = true; } index = 7261; while (index <= 7262) : (index += 1) { instance.array[index] = true; } index = 8219; while (index <= 8220) : (index += 1) { instance.array[index] = true; } index = 8230; while (index <= 8232) : (index += 1) { instance.array[index] = true; } instance.array[11789] = true; instance.array[11803] = true; instance.array[11808] = true; instance.array[11819] = true; index = 11821; while (index <= 11822) : (index += 1) { instance.array[index] = true; } index = 12256; while (index <= 12257) : (index += 1) { instance.array[index] = true; } index = 42205; while (index <= 42206) : (index += 1) { instance.array[index] = true; } index = 42476; while (index <= 42478) : (index += 1) { instance.array[index] = true; } index = 42706; while (index <= 42710) : (index += 1) { instance.array[index] = true; } index = 43093; while (index <= 43094) : (index += 1) { instance.array[index] = true; } index = 43181; while (index <= 43182) : (index += 1) { instance.array[index] = true; } instance.array[43278] = true; index = 43430; while (index <= 43432) : (index += 1) { instance.array[index] = true; } index = 43580; while (index <= 43582) : (index += 1) { instance.array[index] = true; } instance.array[43710] = true; index = 43727; while (index <= 43728) : (index += 1) { instance.array[index] = true; } instance.array[43978] = true; index = 65071; while (index <= 65073) : (index += 1) { instance.array[index] = true; } index = 65075; while (index <= 65078) : (index += 1) { instance.array[index] = true; } instance.array[65248] = true; instance.array[65259] = true; instance.array[65261] = true; index = 65273; while (index <= 65274) : (index += 1) { instance.array[index] = true; } instance.array[65278] = true; instance.array[65344] = true; instance.array[65347] = true; instance.array[66430] = true; instance.array[66479] = true; instance.array[67638] = true; instance.array[67838] = true; index = 68149; while (index <= 68150) : (index += 1) { instance.array[index] = true; } index = 68303; while (index <= 68308) : (index += 1) { instance.array[index] = true; } index = 68377; while (index <= 68382) : (index += 1) { instance.array[index] = true; } index = 68472; while (index <= 68475) : (index += 1) { instance.array[index] = true; } index = 69428; while (index <= 69432) : (index += 1) { instance.array[index] = true; } index = 69670; while (index <= 69676) : (index += 1) { instance.array[index] = true; } index = 69789; while (index <= 69792) : (index += 1) { instance.array[index] = true; } index = 69920; while (index <= 69922) : (index += 1) { instance.array[index] = true; } index = 70052; while (index <= 70053) : (index += 1) { instance.array[index] = true; } instance.array[70060] = true; index = 70077; while (index <= 70078) : (index += 1) { instance.array[index] = true; } index = 70167; while (index <= 70171) : (index += 1) { instance.array[index] = true; } instance.array[70280] = true; index = 70698; while (index <= 70700) : (index += 1) { instance.array[index] = true; } index = 70713; while (index <= 70714) : (index += 1) { instance.array[index] = true; } index = 71073; while (index <= 71076) : (index += 1) { instance.array[index] = true; } index = 71080; while (index <= 71094) : (index += 1) { instance.array[index] = true; } index = 71200; while (index <= 71201) : (index += 1) { instance.array[index] = true; } index = 71451; while (index <= 71453) : (index += 1) { instance.array[index] = true; } instance.array[71971] = true; instance.array[71973] = true; index = 72225; while (index <= 72226) : (index += 1) { instance.array[index] = true; } index = 72314; while (index <= 72315) : (index += 1) { instance.array[index] = true; } index = 72320; while (index <= 72321) : (index += 1) { instance.array[index] = true; } index = 72736; while (index <= 72738) : (index += 1) { instance.array[index] = true; } instance.array[72784] = true; index = 73430; while (index <= 73431) : (index += 1) { instance.array[index] = true; } index = 74831; while (index <= 74835) : (index += 1) { instance.array[index] = true; } index = 92749; while (index <= 92750) : (index += 1) { instance.array[index] = true; } instance.array[92884] = true; index = 92950; while (index <= 92952) : (index += 1) { instance.array[index] = true; } instance.array[92963] = true; index = 93814; while (index <= 93815) : (index += 1) { instance.array[index] = true; } instance.array[113790] = true; index = 121446; while (index <= 121449) : (index += 1) { instance.array[index] = true; } // Placeholder: 0. Struct name, 1. Code point kind return instance; } pub fn deinit(self: *TerminalPunctuation) void { self.allocator.free(self.array); } // isTerminalPunctuation checks if cp is of the kind Terminal_Punctuation. pub fn isTerminalPunctuation(self: TerminalPunctuation, cp: u21) bool { if (cp < self.lo or cp > self.hi) return false; const index = cp - self.lo; return if (index >= self.array.len) false else self.array[index]; }
src/components/autogen/PropList/TerminalPunctuation.zig
pub const WNGETCON_CONNECTED = @as(u32, 0); pub const WNGETCON_DISCONNECTED = @as(u32, 1); pub const WNNC_SPEC_VERSION = @as(u32, 1); pub const WNNC_SPEC_VERSION51 = @as(u32, 327681); pub const WNNC_NET_TYPE = @as(u32, 2); pub const WNNC_NET_NONE = @as(u32, 0); pub const WNNC_DRIVER_VERSION = @as(u32, 3); pub const WNNC_USER = @as(u32, 4); pub const WNNC_USR_GETUSER = @as(u32, 1); pub const WNNC_CONNECTION = @as(u32, 6); pub const WNNC_CON_ADDCONNECTION = @as(u32, 1); pub const WNNC_CON_CANCELCONNECTION = @as(u32, 2); pub const WNNC_CON_GETCONNECTIONS = @as(u32, 4); pub const WNNC_CON_ADDCONNECTION3 = @as(u32, 8); pub const WNNC_CON_ADDCONNECTION4 = @as(u32, 16); pub const WNNC_CON_CANCELCONNECTION2 = @as(u32, 32); pub const WNNC_CON_GETPERFORMANCE = @as(u32, 64); pub const WNNC_CON_DEFER = @as(u32, 128); pub const WNNC_DIALOG = @as(u32, 8); pub const WNNC_DLG_DEVICEMODE = @as(u32, 1); pub const WNNC_DLG_PROPERTYDIALOG = @as(u32, 32); pub const WNNC_DLG_SEARCHDIALOG = @as(u32, 64); pub const WNNC_DLG_FORMATNETWORKNAME = @as(u32, 128); pub const WNNC_DLG_PERMISSIONEDITOR = @as(u32, 256); pub const WNNC_DLG_GETRESOURCEPARENT = @as(u32, 512); pub const WNNC_DLG_GETRESOURCEINFORMATION = @as(u32, 2048); pub const WNNC_ADMIN = @as(u32, 9); pub const WNNC_ADM_GETDIRECTORYTYPE = @as(u32, 1); pub const WNNC_ADM_DIRECTORYNOTIFY = @as(u32, 2); pub const WNNC_ENUMERATION = @as(u32, 11); pub const WNNC_ENUM_GLOBAL = @as(u32, 1); pub const WNNC_ENUM_LOCAL = @as(u32, 2); pub const WNNC_ENUM_CONTEXT = @as(u32, 4); pub const WNNC_ENUM_SHAREABLE = @as(u32, 8); pub const WNNC_START = @as(u32, 12); pub const WNNC_WAIT_FOR_START = @as(u32, 1); pub const WNNC_CONNECTION_FLAGS = @as(u32, 13); pub const WNTYPE_DRIVE = @as(u32, 1); pub const WNTYPE_FILE = @as(u32, 2); pub const WNTYPE_PRINTER = @as(u32, 3); pub const WNTYPE_COMM = @as(u32, 4); pub const WNSRCH_REFRESH_FIRST_LEVEL = @as(u32, 1); pub const WNDT_NORMAL = @as(u32, 0); pub const WNDT_NETWORK = @as(u32, 1); pub const WN_NETWORK_CLASS = @as(u32, 1); pub const WN_CREDENTIAL_CLASS = @as(u32, 2); pub const WN_PRIMARY_AUTHENT_CLASS = @as(u32, 4); pub const WN_SERVICE_CLASS = @as(u32, 8); pub const WN_VALID_LOGON_ACCOUNT = @as(u32, 1); pub const WN_NT_PASSWORD_CHANGED = @as(u32, 2); pub const NOTIFY_PRE = @as(u32, 1); pub const NOTIFY_POST = @as(u32, 2); pub const WNPERMC_PERM = @as(u32, 1); pub const WNPERMC_AUDIT = @as(u32, 2); pub const WNPERMC_OWNER = @as(u32, 4); pub const RESOURCE_RECENT = @as(u32, 4); pub const RESOURCETYPE_RESERVED = @as(u32, 8); pub const RESOURCETYPE_UNKNOWN = @as(u32, 4294967295); pub const RESOURCEUSAGE_NOLOCALDEVICE = @as(u32, 4); pub const RESOURCEUSAGE_SIBLING = @as(u32, 8); pub const RESOURCEUSAGE_RESERVED = @as(u32, 2147483648); pub const RESOURCEDISPLAYTYPE_NETWORK = @as(u32, 6); pub const RESOURCEDISPLAYTYPE_ROOT = @as(u32, 7); pub const RESOURCEDISPLAYTYPE_SHAREADMIN = @as(u32, 8); pub const RESOURCEDISPLAYTYPE_DIRECTORY = @as(u32, 9); pub const RESOURCEDISPLAYTYPE_NDSCONTAINER = @as(u32, 11); pub const NETPROPERTY_PERSISTENT = @as(u32, 1); pub const CONNECT_NEED_DRIVE = @as(u32, 32); pub const CONNECT_REFCOUNT = @as(u32, 64); pub const CONNECT_LOCALDRIVE = @as(u32, 256); pub const CONNECT_CURRENT_MEDIA = @as(u32, 512); pub const CONNECT_RESERVED = @as(u32, 4278190080); pub const CONNECT_CRED_RESET = @as(u32, 8192); pub const CONNECT_REQUIRE_INTEGRITY = @as(u32, 16384); pub const CONNECT_REQUIRE_PRIVACY = @as(u32, 32768); pub const CONNECT_WRITE_THROUGH_SEMANTICS = @as(u32, 65536); pub const CONNECT_GLOBAL_MAPPING = @as(u32, 262144); pub const WNFMT_INENUM = @as(u32, 16); pub const WNFMT_CONNECTION = @as(u32, 32); pub const WNCON_FORNETCARD = @as(u32, 1); pub const WNCON_NOTROUTED = @as(u32, 2); pub const WNCON_SLOWLINK = @as(u32, 4); pub const WNCON_DYNAMIC = @as(u32, 8); //-------------------------------------------------------------------------------- // Section: Types (59) //-------------------------------------------------------------------------------- pub const UNC_INFO_LEVEL = enum(u32) { UNIVERSAL_NAME_INFO_LEVEL = 1, REMOTE_NAME_INFO_LEVEL = 2, }; pub const UNIVERSAL_NAME_INFO_LEVEL = UNC_INFO_LEVEL.UNIVERSAL_NAME_INFO_LEVEL; pub const REMOTE_NAME_INFO_LEVEL = UNC_INFO_LEVEL.REMOTE_NAME_INFO_LEVEL; pub const WNPERM_DLG = enum(u32) { PERM = 0, AUDIT = 1, OWNER = 2, }; pub const WNPERM_DLG_PERM = WNPERM_DLG.PERM; pub const WNPERM_DLG_AUDIT = WNPERM_DLG.AUDIT; pub const WNPERM_DLG_OWNER = WNPERM_DLG.OWNER; pub const WNET_OPEN_ENUM_USAGE = enum(u32) { NONE = 0, CONNECTABLE = 1, CONTAINER = 2, ATTACHED = 16, ALL = 19, _, pub fn initFlags(o: struct { NONE: u1 = 0, CONNECTABLE: u1 = 0, CONTAINER: u1 = 0, ATTACHED: u1 = 0, ALL: u1 = 0, }) WNET_OPEN_ENUM_USAGE { return @intToEnum(WNET_OPEN_ENUM_USAGE, (if (o.NONE == 1) @enumToInt(WNET_OPEN_ENUM_USAGE.NONE) else 0) | (if (o.CONNECTABLE == 1) @enumToInt(WNET_OPEN_ENUM_USAGE.CONNECTABLE) else 0) | (if (o.CONTAINER == 1) @enumToInt(WNET_OPEN_ENUM_USAGE.CONTAINER) else 0) | (if (o.ATTACHED == 1) @enumToInt(WNET_OPEN_ENUM_USAGE.ATTACHED) else 0) | (if (o.ALL == 1) @enumToInt(WNET_OPEN_ENUM_USAGE.ALL) else 0) ); } }; pub const RESOURCEUSAGE_NONE = WNET_OPEN_ENUM_USAGE.NONE; pub const RESOURCEUSAGE_CONNECTABLE = WNET_OPEN_ENUM_USAGE.CONNECTABLE; pub const RESOURCEUSAGE_CONTAINER = WNET_OPEN_ENUM_USAGE.CONTAINER; pub const RESOURCEUSAGE_ATTACHED = WNET_OPEN_ENUM_USAGE.ATTACHED; pub const RESOURCEUSAGE_ALL = WNET_OPEN_ENUM_USAGE.ALL; pub const NET_USE_CONNECT_FLAGS = enum(u32) { INTERACTIVE = 8, PROMPT = 16, REDIRECT = 128, UPDATE_PROFILE = 1, COMMANDLINE = 2048, CMD_SAVECRED = 4096, TEMPORARY = 4, DEFERRED = 1024, UPDATE_RECENT = 2, _, pub fn initFlags(o: struct { INTERACTIVE: u1 = 0, PROMPT: u1 = 0, REDIRECT: u1 = 0, UPDATE_PROFILE: u1 = 0, COMMANDLINE: u1 = 0, CMD_SAVECRED: u1 = 0, TEMPORARY: u1 = 0, DEFERRED: u1 = 0, UPDATE_RECENT: u1 = 0, }) NET_USE_CONNECT_FLAGS { return @intToEnum(NET_USE_CONNECT_FLAGS, (if (o.INTERACTIVE == 1) @enumToInt(NET_USE_CONNECT_FLAGS.INTERACTIVE) else 0) | (if (o.PROMPT == 1) @enumToInt(NET_USE_CONNECT_FLAGS.PROMPT) else 0) | (if (o.REDIRECT == 1) @enumToInt(NET_USE_CONNECT_FLAGS.REDIRECT) else 0) | (if (o.UPDATE_PROFILE == 1) @enumToInt(NET_USE_CONNECT_FLAGS.UPDATE_PROFILE) else 0) | (if (o.COMMANDLINE == 1) @enumToInt(NET_USE_CONNECT_FLAGS.COMMANDLINE) else 0) | (if (o.CMD_SAVECRED == 1) @enumToInt(NET_USE_CONNECT_FLAGS.CMD_SAVECRED) else 0) | (if (o.TEMPORARY == 1) @enumToInt(NET_USE_CONNECT_FLAGS.TEMPORARY) else 0) | (if (o.DEFERRED == 1) @enumToInt(NET_USE_CONNECT_FLAGS.DEFERRED) else 0) | (if (o.UPDATE_RECENT == 1) @enumToInt(NET_USE_CONNECT_FLAGS.UPDATE_RECENT) else 0) ); } }; pub const CONNECT_INTERACTIVE = NET_USE_CONNECT_FLAGS.INTERACTIVE; pub const CONNECT_PROMPT = NET_USE_CONNECT_FLAGS.PROMPT; pub const CONNECT_REDIRECT = NET_USE_CONNECT_FLAGS.REDIRECT; pub const CONNECT_UPDATE_PROFILE = NET_USE_CONNECT_FLAGS.UPDATE_PROFILE; pub const CONNECT_COMMANDLINE = NET_USE_CONNECT_FLAGS.COMMANDLINE; pub const CONNECT_CMD_SAVECRED = NET_USE_CONNECT_FLAGS.CMD_SAVECRED; pub const CONNECT_TEMPORARY = NET_USE_CONNECT_FLAGS.TEMPORARY; pub const CONNECT_DEFERRED = NET_USE_CONNECT_FLAGS.DEFERRED; pub const CONNECT_UPDATE_RECENT = NET_USE_CONNECT_FLAGS.UPDATE_RECENT; pub const NP_PROPERTY_DIALOG_SELECTION = enum(u32) { FILE = 0, DIR = 1, MULT = 2, }; pub const WNPS_FILE = NP_PROPERTY_DIALOG_SELECTION.FILE; pub const WNPS_DIR = NP_PROPERTY_DIALOG_SELECTION.DIR; pub const WNPS_MULT = NP_PROPERTY_DIALOG_SELECTION.MULT; pub const NPDIRECTORY_NOTIFY_OPERATION = enum(u32) { MKDIR = 1, RMDIR = 2, MVDIR = 3, }; pub const WNDN_MKDIR = NPDIRECTORY_NOTIFY_OPERATION.MKDIR; pub const WNDN_RMDIR = NPDIRECTORY_NOTIFY_OPERATION.RMDIR; pub const WNDN_MVDIR = NPDIRECTORY_NOTIFY_OPERATION.MVDIR; pub const NET_RESOURCE_TYPE = enum(u32) { ANY = 0, DISK = 1, PRINT = 2, _, pub fn initFlags(o: struct { ANY: u1 = 0, DISK: u1 = 0, PRINT: u1 = 0, }) NET_RESOURCE_TYPE { return @intToEnum(NET_RESOURCE_TYPE, (if (o.ANY == 1) @enumToInt(NET_RESOURCE_TYPE.ANY) else 0) | (if (o.DISK == 1) @enumToInt(NET_RESOURCE_TYPE.DISK) else 0) | (if (o.PRINT == 1) @enumToInt(NET_RESOURCE_TYPE.PRINT) else 0) ); } }; pub const RESOURCETYPE_ANY = NET_RESOURCE_TYPE.ANY; pub const RESOURCETYPE_DISK = NET_RESOURCE_TYPE.DISK; pub const RESOURCETYPE_PRINT = NET_RESOURCE_TYPE.PRINT; pub const NETWORK_NAME_FORMAT_FLAGS = enum(u32) { MULTILINE = 1, ABBREVIATED = 2, }; pub const WNFMT_MULTILINE = NETWORK_NAME_FORMAT_FLAGS.MULTILINE; pub const WNFMT_ABBREVIATED = NETWORK_NAME_FORMAT_FLAGS.ABBREVIATED; pub const NET_RESOURCE_SCOPE = enum(u32) { CONNECTED = 1, CONTEXT = 5, GLOBALNET = 2, REMEMBERED = 3, }; pub const RESOURCE_CONNECTED = NET_RESOURCE_SCOPE.CONNECTED; pub const RESOURCE_CONTEXT = NET_RESOURCE_SCOPE.CONTEXT; pub const RESOURCE_GLOBALNET = NET_RESOURCE_SCOPE.GLOBALNET; pub const RESOURCE_REMEMBERED = NET_RESOURCE_SCOPE.REMEMBERED; pub const NETINFOSTRUCT_CHARACTERISTICS = enum(u32) { DLL16 = 1, DISKRED = 4, PRINTERRED = 8, _, pub fn initFlags(o: struct { DLL16: u1 = 0, DISKRED: u1 = 0, PRINTERRED: u1 = 0, }) NETINFOSTRUCT_CHARACTERISTICS { return @intToEnum(NETINFOSTRUCT_CHARACTERISTICS, (if (o.DLL16 == 1) @enumToInt(NETINFOSTRUCT_CHARACTERISTICS.DLL16) else 0) | (if (o.DISKRED == 1) @enumToInt(NETINFOSTRUCT_CHARACTERISTICS.DISKRED) else 0) | (if (o.PRINTERRED == 1) @enumToInt(NETINFOSTRUCT_CHARACTERISTICS.PRINTERRED) else 0) ); } }; pub const NETINFO_DLL16 = NETINFOSTRUCT_CHARACTERISTICS.DLL16; pub const NETINFO_DISKRED = NETINFOSTRUCT_CHARACTERISTICS.DISKRED; pub const NETINFO_PRINTERRED = NETINFOSTRUCT_CHARACTERISTICS.PRINTERRED; pub const CONNECTDLGSTRUCT_FLAGS = enum(u32) { RO_PATH = 1, CONN_POINT = 2, USE_MRU = 4, HIDE_BOX = 8, PERSIST = 16, NOT_PERSIST = 32, _, pub fn initFlags(o: struct { RO_PATH: u1 = 0, CONN_POINT: u1 = 0, USE_MRU: u1 = 0, HIDE_BOX: u1 = 0, PERSIST: u1 = 0, NOT_PERSIST: u1 = 0, }) CONNECTDLGSTRUCT_FLAGS { return @intToEnum(CONNECTDLGSTRUCT_FLAGS, (if (o.RO_PATH == 1) @enumToInt(CONNECTDLGSTRUCT_FLAGS.RO_PATH) else 0) | (if (o.CONN_POINT == 1) @enumToInt(CONNECTDLGSTRUCT_FLAGS.CONN_POINT) else 0) | (if (o.USE_MRU == 1) @enumToInt(CONNECTDLGSTRUCT_FLAGS.USE_MRU) else 0) | (if (o.HIDE_BOX == 1) @enumToInt(CONNECTDLGSTRUCT_FLAGS.HIDE_BOX) else 0) | (if (o.PERSIST == 1) @enumToInt(CONNECTDLGSTRUCT_FLAGS.PERSIST) else 0) | (if (o.NOT_PERSIST == 1) @enumToInt(CONNECTDLGSTRUCT_FLAGS.NOT_PERSIST) else 0) ); } }; pub const CONNDLG_RO_PATH = CONNECTDLGSTRUCT_FLAGS.RO_PATH; pub const CONNDLG_CONN_POINT = CONNECTDLGSTRUCT_FLAGS.CONN_POINT; pub const CONNDLG_USE_MRU = CONNECTDLGSTRUCT_FLAGS.USE_MRU; pub const CONNDLG_HIDE_BOX = CONNECTDLGSTRUCT_FLAGS.HIDE_BOX; pub const CONNDLG_PERSIST = CONNECTDLGSTRUCT_FLAGS.PERSIST; pub const CONNDLG_NOT_PERSIST = CONNECTDLGSTRUCT_FLAGS.NOT_PERSIST; pub const DISCDLGSTRUCT_FLAGS = enum(u32) { UPDATE_PROFILE = 1, NO_FORCE = 64, _, pub fn initFlags(o: struct { UPDATE_PROFILE: u1 = 0, NO_FORCE: u1 = 0, }) DISCDLGSTRUCT_FLAGS { return @intToEnum(DISCDLGSTRUCT_FLAGS, (if (o.UPDATE_PROFILE == 1) @enumToInt(DISCDLGSTRUCT_FLAGS.UPDATE_PROFILE) else 0) | (if (o.NO_FORCE == 1) @enumToInt(DISCDLGSTRUCT_FLAGS.NO_FORCE) else 0) ); } }; pub const DISC_UPDATE_PROFILE = DISCDLGSTRUCT_FLAGS.UPDATE_PROFILE; pub const DISC_NO_FORCE = DISCDLGSTRUCT_FLAGS.NO_FORCE; // TODO: this type has a FreeFunc 'WNetCloseEnum', what can Zig do with this information? pub const NetEnumHandle = isize; pub const NETRESOURCEA = extern struct { dwScope: NET_RESOURCE_SCOPE, dwType: NET_RESOURCE_TYPE, dwDisplayType: u32, dwUsage: u32, lpLocalName: ?PSTR, lpRemoteName: ?PSTR, lpComment: ?PSTR, lpProvider: ?PSTR, }; pub const NETRESOURCEW = extern struct { dwScope: NET_RESOURCE_SCOPE, dwType: NET_RESOURCE_TYPE, dwDisplayType: u32, dwUsage: u32, lpLocalName: ?PWSTR, lpRemoteName: ?PWSTR, lpComment: ?PWSTR, lpProvider: ?PWSTR, }; pub const CONNECTDLGSTRUCTA = extern struct { cbStructure: u32, hwndOwner: ?HWND, lpConnRes: ?*NETRESOURCEA, dwFlags: CONNECTDLGSTRUCT_FLAGS, dwDevNum: u32, }; pub const CONNECTDLGSTRUCTW = extern struct { cbStructure: u32, hwndOwner: ?HWND, lpConnRes: ?*NETRESOURCEW, dwFlags: CONNECTDLGSTRUCT_FLAGS, dwDevNum: u32, }; pub const DISCDLGSTRUCTA = extern struct { cbStructure: u32, hwndOwner: ?HWND, lpLocalName: ?PSTR, lpRemoteName: ?PSTR, dwFlags: DISCDLGSTRUCT_FLAGS, }; pub const DISCDLGSTRUCTW = extern struct { cbStructure: u32, hwndOwner: ?HWND, lpLocalName: ?PWSTR, lpRemoteName: ?PWSTR, dwFlags: DISCDLGSTRUCT_FLAGS, }; pub const UNIVERSAL_NAME_INFOA = extern struct { lpUniversalName: ?PSTR, }; pub const UNIVERSAL_NAME_INFOW = extern struct { lpUniversalName: ?PWSTR, }; pub const REMOTE_NAME_INFOA = extern struct { lpUniversalName: ?PSTR, lpConnectionName: ?PSTR, lpRemainingPath: ?PSTR, }; pub const REMOTE_NAME_INFOW = extern struct { lpUniversalName: ?PWSTR, lpConnectionName: ?PWSTR, lpRemainingPath: ?PWSTR, }; pub const NETINFOSTRUCT = extern struct { cbStructure: u32, dwProviderVersion: u32, dwStatus: WIN32_ERROR, dwCharacteristics: NETINFOSTRUCT_CHARACTERISTICS, dwHandle: usize, wNetType: u16, dwPrinters: u32, dwDrives: u32, }; pub const NETCONNECTINFOSTRUCT = extern struct { cbStructure: u32, dwFlags: u32, dwSpeed: u32, dwDelay: u32, dwOptDataSize: u32, }; pub const PF_NPAddConnection = fn( lpNetResource: ?*NETRESOURCEW, lpPassword: ?PWSTR, lpUserName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPAddConnection3 = fn( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEW, lpPassword: ?PWSTR, lpUserName: ?PWSTR, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPAddConnection4 = fn( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 3? lpAuthBuffer: ?*anyopaque, cbAuthBuffer: u32, dwFlags: u32, // TODO: what to do with BytesParamIndex 6? lpUseOptions: ?*u8, cbUseOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPCancelConnection = fn( lpName: ?PWSTR, fForce: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPCancelConnection2 = fn( lpName: ?PWSTR, fForce: BOOL, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetConnection = fn( lpLocalName: ?PWSTR, lpRemoteName: ?[*:0]u16, lpnBufferLen: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetConnection3 = fn( lpLocalName: ?[*:0]const u16, dwLevel: u32, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetUniversalName = fn( lpLocalPath: ?[*:0]const u16, dwInfoLevel: u32, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpnBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetConnectionPerformance = fn( lpRemoteName: ?[*:0]const u16, lpNetConnectInfo: ?*NETCONNECTINFOSTRUCT, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPOpenEnum = fn( dwScope: u32, dwType: u32, dwUsage: u32, lpNetResource: ?*NETRESOURCEW, lphEnum: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPEnumResource = fn( hEnum: ?HANDLE, lpcCount: ?*u32, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPCloseEnum = fn( hEnum: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetCaps = fn( ndex: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetUser = fn( lpName: ?PWSTR, lpUserName: [*:0]u16, lpnBufferLen: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetPersistentUseOptionsForConnection = fn( lpRemotePath: ?PWSTR, // TODO: what to do with BytesParamIndex 2? lpReadUseOptions: ?*u8, cbReadUseOptions: u32, // TODO: what to do with BytesParamIndex 4? lpWriteUseOptions: ?*u8, lpSizeWriteUseOptions: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPDeviceMode = fn( hParent: ?HWND, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPSearchDialog = fn( hwndParent: ?HWND, lpNetResource: ?*NETRESOURCEW, lpBuffer: [*]u8, cbBuffer: u32, lpnFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetResourceParent = fn( lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 2? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetResourceInformation = fn( lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 2? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, lplpSystem: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPFormatNetworkName = fn( lpRemoteName: ?PWSTR, lpFormattedName: [*:0]u16, lpnLength: ?*u32, dwFlags: u32, dwAveCharPerLine: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetPropertyText = fn( iButton: u32, nPropSel: u32, lpName: ?PWSTR, lpButtonName: [*:0]u16, nButtonNameLen: u32, nType: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPPropertyDialog = fn( hwndParent: ?HWND, iButtonDlg: u32, nPropSel: u32, lpFileName: ?PWSTR, nType: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPGetDirectoryType = fn( lpName: ?PWSTR, lpType: ?*i32, bFlushCache: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPDirectoryNotify = fn( hwnd: ?HWND, lpDir: ?PWSTR, dwOper: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPLogonNotify = fn( lpLogonId: ?*LUID, lpAuthentInfoType: ?[*:0]const u16, lpAuthentInfo: ?*anyopaque, lpPreviousAuthentInfoType: ?[*:0]const u16, lpPreviousAuthentInfo: ?*anyopaque, lpStationName: ?PWSTR, StationHandle: ?*anyopaque, lpLogonScript: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPPasswordChangeNotify = fn( lpAuthentInfoType: ?[*:0]const u16, lpAuthentInfo: ?*anyopaque, lpPreviousAuthentInfoType: ?[*:0]const u16, lpPreviousAuthentInfo: ?*anyopaque, lpStationName: ?PWSTR, StationHandle: ?*anyopaque, dwChangeInfo: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const NOTIFYINFO = extern struct { dwNotifyStatus: u32, dwOperationStatus: u32, lpContext: ?*anyopaque, }; pub const NOTIFYADD = extern struct { hwndOwner: ?HWND, NetResource: NETRESOURCEA, dwAddFlags: NET_USE_CONNECT_FLAGS, }; pub const NOTIFYCANCEL = extern struct { lpName: ?PWSTR, lpProvider: ?PWSTR, dwFlags: u32, fForce: BOOL, }; pub const PF_AddConnectNotify = fn( lpNotifyInfo: ?*NOTIFYINFO, lpAddInfo: ?*NOTIFYADD, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_CancelConnectNotify = fn( lpNotifyInfo: ?*NOTIFYINFO, lpCancelInfo: ?*NOTIFYCANCEL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPFMXGetPermCaps = fn( lpDriveName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPFMXEditPerm = fn( lpDriveName: ?PWSTR, hwndFMX: ?HWND, nDialogType: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_NPFMXGetPermHelp = fn( lpDriveName: ?PWSTR, nDialogType: u32, fDirectory: BOOL, lpFileNameBuffer: [*]u8, lpBufferSize: ?*u32, lpnHelpContext: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; //-------------------------------------------------------------------------------- // Section: Functions (65) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetAddConnectionA( lpRemoteName: ?[*:0]const u8, lpPassword: ?[*:0]const u8, lpLocalName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetAddConnectionW( lpRemoteName: ?[*:0]const u16, lpPassword: ?[*:0]const u16, lpLocalName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetAddConnection2A( lpNetResource: ?*NETRESOURCEA, lpPassword: ?[*:0]const u8, lpUserName: ?[*:0]const u8, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetAddConnection2W( lpNetResource: ?*NETRESOURCEW, lpPassword: ?[*:0]const u16, lpUserName: ?[*:0]const u16, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetAddConnection3A( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEA, lpPassword: ?[*:0]const u8, lpUserName: ?[*:0]const u8, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetAddConnection3W( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEW, lpPassword: ?[*:0]const u16, lpUserName: ?[*:0]const u16, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "MPR" fn WNetAddConnection4A( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEA, // TODO: what to do with BytesParamIndex 3? pAuthBuffer: ?*anyopaque, cbAuthBuffer: u32, dwFlags: u32, // TODO: what to do with BytesParamIndex 6? lpUseOptions: ?*u8, cbUseOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "MPR" fn WNetAddConnection4W( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 3? pAuthBuffer: ?*anyopaque, cbAuthBuffer: u32, dwFlags: u32, // TODO: what to do with BytesParamIndex 6? lpUseOptions: ?*u8, cbUseOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetCancelConnectionA( lpName: ?[*:0]const u8, fForce: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetCancelConnectionW( lpName: ?[*:0]const u16, fForce: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetCancelConnection2A( lpName: ?[*:0]const u8, dwFlags: u32, fForce: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetCancelConnection2W( lpName: ?[*:0]const u16, dwFlags: u32, fForce: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetConnectionA( lpLocalName: ?[*:0]const u8, lpRemoteName: ?[*:0]u8, lpnLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetConnectionW( lpLocalName: ?[*:0]const u16, lpRemoteName: ?[*:0]u16, lpnLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetUseConnectionA( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEA, lpPassword: ?[*:0]const u8, lpUserId: ?[*:0]const u8, dwFlags: NET_USE_CONNECT_FLAGS, lpAccessName: ?[*:0]u8, lpBufferSize: ?*u32, lpResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetUseConnectionW( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEW, lpPassword: ?[*:0]const u16, lpUserId: ?[*:0]const u16, dwFlags: NET_USE_CONNECT_FLAGS, lpAccessName: ?[*:0]u16, lpBufferSize: ?*u32, lpResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "MPR" fn WNetUseConnection4A( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEA, // TODO: what to do with BytesParamIndex 3? pAuthBuffer: ?*anyopaque, cbAuthBuffer: u32, dwFlags: u32, // TODO: what to do with BytesParamIndex 6? lpUseOptions: ?*u8, cbUseOptions: u32, lpAccessName: ?[*:0]u8, lpBufferSize: ?*u32, lpResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "MPR" fn WNetUseConnection4W( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 3? pAuthBuffer: ?*anyopaque, cbAuthBuffer: u32, dwFlags: u32, // TODO: what to do with BytesParamIndex 6? lpUseOptions: ?*u8, cbUseOptions: u32, lpAccessName: ?[*:0]u16, lpBufferSize: ?*u32, lpResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetConnectionDialog( hwnd: ?HWND, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetDisconnectDialog( hwnd: ?HWND, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetConnectionDialog1A( lpConnDlgStruct: ?*CONNECTDLGSTRUCTA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetConnectionDialog1W( lpConnDlgStruct: ?*CONNECTDLGSTRUCTW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetDisconnectDialog1A( lpConnDlgStruct: ?*DISCDLGSTRUCTA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetDisconnectDialog1W( lpConnDlgStruct: ?*DISCDLGSTRUCTW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetOpenEnumA( dwScope: NET_RESOURCE_SCOPE, dwType: NET_RESOURCE_TYPE, dwUsage: WNET_OPEN_ENUM_USAGE, lpNetResource: ?*NETRESOURCEA, lphEnum: ?*NetEnumHandle, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetOpenEnumW( dwScope: NET_RESOURCE_SCOPE, dwType: NET_RESOURCE_TYPE, dwUsage: WNET_OPEN_ENUM_USAGE, lpNetResource: ?*NETRESOURCEW, lphEnum: ?*NetEnumHandle, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetEnumResourceA( hEnum: ?HANDLE, lpcCount: ?*u32, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetEnumResourceW( hEnum: ?HANDLE, lpcCount: ?*u32, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetCloseEnum( hEnum: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetResourceParentA( lpNetResource: ?*NETRESOURCEA, // TODO: what to do with BytesParamIndex 2? lpBuffer: ?*anyopaque, lpcbBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetResourceParentW( lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 2? lpBuffer: ?*anyopaque, lpcbBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetResourceInformationA( lpNetResource: ?*NETRESOURCEA, // TODO: what to do with BytesParamIndex 2? lpBuffer: ?*anyopaque, lpcbBuffer: ?*u32, lplpSystem: ?*?PSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetResourceInformationW( lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 2? lpBuffer: ?*anyopaque, lpcbBuffer: ?*u32, lplpSystem: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetUniversalNameA( lpLocalPath: ?[*:0]const u8, dwInfoLevel: UNC_INFO_LEVEL, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetUniversalNameW( lpLocalPath: ?[*:0]const u16, dwInfoLevel: UNC_INFO_LEVEL, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetUserA( lpName: ?[*:0]const u8, lpUserName: [*:0]u8, lpnLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetUserW( lpName: ?[*:0]const u16, lpUserName: [*:0]u16, lpnLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetProviderNameA( dwNetType: u32, lpProviderName: [*:0]u8, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetProviderNameW( dwNetType: u32, lpProviderName: [*:0]u16, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetNetworkInformationA( lpProvider: ?[*:0]const u8, lpNetInfoStruct: ?*NETINFOSTRUCT, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetNetworkInformationW( lpProvider: ?[*:0]const u16, lpNetInfoStruct: ?*NETINFOSTRUCT, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetLastErrorA( lpError: ?*u32, lpErrorBuf: [*:0]u8, nErrorBufSize: u32, lpNameBuf: [*:0]u8, nNameBufSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn WNetGetLastErrorW( lpError: ?*u32, lpErrorBuf: [*:0]u16, nErrorBufSize: u32, lpNameBuf: [*:0]u16, nNameBufSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn MultinetGetConnectionPerformanceA( lpNetResource: ?*NETRESOURCEA, lpNetConnectInfoStruct: ?*NETCONNECTINFOSTRUCT, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "MPR" fn MultinetGetConnectionPerformanceW( lpNetResource: ?*NETRESOURCEW, lpNetConnectInfoStruct: ?*NETCONNECTINFOSTRUCT, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPAddConnection( lpNetResource: ?*NETRESOURCEW, lpPassword: ?PWSTR, lpUserName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPAddConnection3( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEW, lpPassword: ?PWSTR, lpUserName: ?PWSTR, dwFlags: NET_USE_CONNECT_FLAGS, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "NTLANMAN" fn NPAddConnection4( hwndOwner: ?HWND, lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 3? lpAuthBuffer: ?*anyopaque, cbAuthBuffer: u32, dwFlags: u32, // TODO: what to do with BytesParamIndex 6? lpUseOptions: ?*u8, cbUseOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPCancelConnection( lpName: ?PWSTR, fForce: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "NTLANMAN" fn NPCancelConnection2( lpName: ?PWSTR, fForce: BOOL, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPGetConnection( lpLocalName: ?PWSTR, lpRemoteName: ?[*:0]u16, lpnBufferLen: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "NTLANMAN" fn NPGetConnection3( lpLocalName: ?[*:0]const u16, dwLevel: u32, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPGetUniversalName( lpLocalPath: ?[*:0]const u16, dwInfoLevel: UNC_INFO_LEVEL, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "NTLANMAN" fn NPGetConnectionPerformance( lpRemoteName: ?[*:0]const u16, lpNetConnectInfo: ?*NETCONNECTINFOSTRUCT, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPOpenEnum( dwScope: u32, dwType: u32, dwUsage: u32, lpNetResource: ?*NETRESOURCEW, lphEnum: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPEnumResource( hEnum: ?HANDLE, lpcCount: ?*u32, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPCloseEnum( hEnum: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPGetCaps( ndex: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPGetUser( lpName: ?PWSTR, lpUserName: [*:0]u16, lpnBufferLen: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "NTLANMAN" fn NPGetPersistentUseOptionsForConnection( lpRemotePath: ?PWSTR, // TODO: what to do with BytesParamIndex 2? lpReadUseOptions: ?*u8, cbReadUseOptions: u32, // TODO: what to do with BytesParamIndex 4? lpWriteUseOptions: ?*u8, lpSizeWriteUseOptions: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPGetResourceParent( lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 2? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPGetResourceInformation( lpNetResource: ?*NETRESOURCEW, // TODO: what to do with BytesParamIndex 2? lpBuffer: ?*anyopaque, lpBufferSize: ?*u32, lplpSystem: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "davclnt" fn NPFormatNetworkName( lpRemoteName: ?PWSTR, lpFormattedName: [*:0]u16, lpnLength: ?*u32, dwFlags: NETWORK_NAME_FORMAT_FLAGS, dwAveCharPerLine: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "MPR" fn WNetSetLastErrorA( err: u32, lpError: ?PSTR, lpProviders: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "MPR" fn WNetSetLastErrorW( err: u32, lpError: ?PWSTR, lpProviders: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) void; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (27) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const NETRESOURCE = thismodule.NETRESOURCEA; pub const CONNECTDLGSTRUCT = thismodule.CONNECTDLGSTRUCTA; pub const DISCDLGSTRUCT = thismodule.DISCDLGSTRUCTA; pub const UNIVERSAL_NAME_INFO = thismodule.UNIVERSAL_NAME_INFOA; pub const REMOTE_NAME_INFO = thismodule.REMOTE_NAME_INFOA; pub const WNetAddConnection = thismodule.WNetAddConnectionA; pub const WNetAddConnection2 = thismodule.WNetAddConnection2A; pub const WNetAddConnection3 = thismodule.WNetAddConnection3A; pub const WNetAddConnection4 = thismodule.WNetAddConnection4A; pub const WNetCancelConnection = thismodule.WNetCancelConnectionA; pub const WNetCancelConnection2 = thismodule.WNetCancelConnection2A; pub const WNetGetConnection = thismodule.WNetGetConnectionA; pub const WNetUseConnection = thismodule.WNetUseConnectionA; pub const WNetUseConnection4 = thismodule.WNetUseConnection4A; pub const WNetConnectionDialog1 = thismodule.WNetConnectionDialog1A; pub const WNetDisconnectDialog1 = thismodule.WNetDisconnectDialog1A; pub const WNetOpenEnum = thismodule.WNetOpenEnumA; pub const WNetEnumResource = thismodule.WNetEnumResourceA; pub const WNetGetResourceParent = thismodule.WNetGetResourceParentA; pub const WNetGetResourceInformation = thismodule.WNetGetResourceInformationA; pub const WNetGetUniversalName = thismodule.WNetGetUniversalNameA; pub const WNetGetUser = thismodule.WNetGetUserA; pub const WNetGetProviderName = thismodule.WNetGetProviderNameA; pub const WNetGetNetworkInformation = thismodule.WNetGetNetworkInformationA; pub const WNetGetLastError = thismodule.WNetGetLastErrorA; pub const MultinetGetConnectionPerformance = thismodule.MultinetGetConnectionPerformanceA; pub const WNetSetLastError = thismodule.WNetSetLastErrorA; }, .wide => struct { pub const NETRESOURCE = thismodule.NETRESOURCEW; pub const CONNECTDLGSTRUCT = thismodule.CONNECTDLGSTRUCTW; pub const DISCDLGSTRUCT = thismodule.DISCDLGSTRUCTW; pub const UNIVERSAL_NAME_INFO = thismodule.UNIVERSAL_NAME_INFOW; pub const REMOTE_NAME_INFO = thismodule.REMOTE_NAME_INFOW; pub const WNetAddConnection = thismodule.WNetAddConnectionW; pub const WNetAddConnection2 = thismodule.WNetAddConnection2W; pub const WNetAddConnection3 = thismodule.WNetAddConnection3W; pub const WNetAddConnection4 = thismodule.WNetAddConnection4W; pub const WNetCancelConnection = thismodule.WNetCancelConnectionW; pub const WNetCancelConnection2 = thismodule.WNetCancelConnection2W; pub const WNetGetConnection = thismodule.WNetGetConnectionW; pub const WNetUseConnection = thismodule.WNetUseConnectionW; pub const WNetUseConnection4 = thismodule.WNetUseConnection4W; pub const WNetConnectionDialog1 = thismodule.WNetConnectionDialog1W; pub const WNetDisconnectDialog1 = thismodule.WNetDisconnectDialog1W; pub const WNetOpenEnum = thismodule.WNetOpenEnumW; pub const WNetEnumResource = thismodule.WNetEnumResourceW; pub const WNetGetResourceParent = thismodule.WNetGetResourceParentW; pub const WNetGetResourceInformation = thismodule.WNetGetResourceInformationW; pub const WNetGetUniversalName = thismodule.WNetGetUniversalNameW; pub const WNetGetUser = thismodule.WNetGetUserW; pub const WNetGetProviderName = thismodule.WNetGetProviderNameW; pub const WNetGetNetworkInformation = thismodule.WNetGetNetworkInformationW; pub const WNetGetLastError = thismodule.WNetGetLastErrorW; pub const MultinetGetConnectionPerformance = thismodule.MultinetGetConnectionPerformanceW; pub const WNetSetLastError = thismodule.WNetSetLastErrorW; }, .unspecified => if (@import("builtin").is_test) struct { pub const NETRESOURCE = *opaque{}; pub const CONNECTDLGSTRUCT = *opaque{}; pub const DISCDLGSTRUCT = *opaque{}; pub const UNIVERSAL_NAME_INFO = *opaque{}; pub const REMOTE_NAME_INFO = *opaque{}; pub const WNetAddConnection = *opaque{}; pub const WNetAddConnection2 = *opaque{}; pub const WNetAddConnection3 = *opaque{}; pub const WNetAddConnection4 = *opaque{}; pub const WNetCancelConnection = *opaque{}; pub const WNetCancelConnection2 = *opaque{}; pub const WNetGetConnection = *opaque{}; pub const WNetUseConnection = *opaque{}; pub const WNetUseConnection4 = *opaque{}; pub const WNetConnectionDialog1 = *opaque{}; pub const WNetDisconnectDialog1 = *opaque{}; pub const WNetOpenEnum = *opaque{}; pub const WNetEnumResource = *opaque{}; pub const WNetGetResourceParent = *opaque{}; pub const WNetGetResourceInformation = *opaque{}; pub const WNetGetUniversalName = *opaque{}; pub const WNetGetUser = *opaque{}; pub const WNetGetProviderName = *opaque{}; pub const WNetGetNetworkInformation = *opaque{}; pub const WNetGetLastError = *opaque{}; pub const MultinetGetConnectionPerformance = *opaque{}; pub const WNetSetLastError = *opaque{}; } else struct { pub const NETRESOURCE = @compileError("'NETRESOURCE' requires that UNICODE be set to true or false in the root module"); pub const CONNECTDLGSTRUCT = @compileError("'CONNECTDLGSTRUCT' requires that UNICODE be set to true or false in the root module"); pub const DISCDLGSTRUCT = @compileError("'DISCDLGSTRUCT' requires that UNICODE be set to true or false in the root module"); pub const UNIVERSAL_NAME_INFO = @compileError("'UNIVERSAL_NAME_INFO' requires that UNICODE be set to true or false in the root module"); pub const REMOTE_NAME_INFO = @compileError("'REMOTE_NAME_INFO' requires that UNICODE be set to true or false in the root module"); pub const WNetAddConnection = @compileError("'WNetAddConnection' requires that UNICODE be set to true or false in the root module"); pub const WNetAddConnection2 = @compileError("'WNetAddConnection2' requires that UNICODE be set to true or false in the root module"); pub const WNetAddConnection3 = @compileError("'WNetAddConnection3' requires that UNICODE be set to true or false in the root module"); pub const WNetAddConnection4 = @compileError("'WNetAddConnection4' requires that UNICODE be set to true or false in the root module"); pub const WNetCancelConnection = @compileError("'WNetCancelConnection' requires that UNICODE be set to true or false in the root module"); pub const WNetCancelConnection2 = @compileError("'WNetCancelConnection2' requires that UNICODE be set to true or false in the root module"); pub const WNetGetConnection = @compileError("'WNetGetConnection' requires that UNICODE be set to true or false in the root module"); pub const WNetUseConnection = @compileError("'WNetUseConnection' requires that UNICODE be set to true or false in the root module"); pub const WNetUseConnection4 = @compileError("'WNetUseConnection4' requires that UNICODE be set to true or false in the root module"); pub const WNetConnectionDialog1 = @compileError("'WNetConnectionDialog1' requires that UNICODE be set to true or false in the root module"); pub const WNetDisconnectDialog1 = @compileError("'WNetDisconnectDialog1' requires that UNICODE be set to true or false in the root module"); pub const WNetOpenEnum = @compileError("'WNetOpenEnum' requires that UNICODE be set to true or false in the root module"); pub const WNetEnumResource = @compileError("'WNetEnumResource' requires that UNICODE be set to true or false in the root module"); pub const WNetGetResourceParent = @compileError("'WNetGetResourceParent' requires that UNICODE be set to true or false in the root module"); pub const WNetGetResourceInformation = @compileError("'WNetGetResourceInformation' requires that UNICODE be set to true or false in the root module"); pub const WNetGetUniversalName = @compileError("'WNetGetUniversalName' requires that UNICODE be set to true or false in the root module"); pub const WNetGetUser = @compileError("'WNetGetUser' requires that UNICODE be set to true or false in the root module"); pub const WNetGetProviderName = @compileError("'WNetGetProviderName' requires that UNICODE be set to true or false in the root module"); pub const WNetGetNetworkInformation = @compileError("'WNetGetNetworkInformation' requires that UNICODE be set to true or false in the root module"); pub const WNetGetLastError = @compileError("'WNetGetLastError' requires that UNICODE be set to true or false in the root module"); pub const MultinetGetConnectionPerformance = @compileError("'MultinetGetConnectionPerformance' requires that UNICODE be set to true or false in the root module"); pub const WNetSetLastError = @compileError("'WNetSetLastError' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (7) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const HANDLE = @import("../foundation.zig").HANDLE; const HWND = @import("../foundation.zig").HWND; const LUID = @import("../foundation.zig").LUID; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const WIN32_ERROR = @import("../foundation.zig").WIN32_ERROR; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PF_NPAddConnection")) { _ = PF_NPAddConnection; } if (@hasDecl(@This(), "PF_NPAddConnection3")) { _ = PF_NPAddConnection3; } if (@hasDecl(@This(), "PF_NPAddConnection4")) { _ = PF_NPAddConnection4; } if (@hasDecl(@This(), "PF_NPCancelConnection")) { _ = PF_NPCancelConnection; } if (@hasDecl(@This(), "PF_NPCancelConnection2")) { _ = PF_NPCancelConnection2; } if (@hasDecl(@This(), "PF_NPGetConnection")) { _ = PF_NPGetConnection; } if (@hasDecl(@This(), "PF_NPGetConnection3")) { _ = PF_NPGetConnection3; } if (@hasDecl(@This(), "PF_NPGetUniversalName")) { _ = PF_NPGetUniversalName; } if (@hasDecl(@This(), "PF_NPGetConnectionPerformance")) { _ = PF_NPGetConnectionPerformance; } if (@hasDecl(@This(), "PF_NPOpenEnum")) { _ = PF_NPOpenEnum; } if (@hasDecl(@This(), "PF_NPEnumResource")) { _ = PF_NPEnumResource; } if (@hasDecl(@This(), "PF_NPCloseEnum")) { _ = PF_NPCloseEnum; } if (@hasDecl(@This(), "PF_NPGetCaps")) { _ = PF_NPGetCaps; } if (@hasDecl(@This(), "PF_NPGetUser")) { _ = PF_NPGetUser; } if (@hasDecl(@This(), "PF_NPGetPersistentUseOptionsForConnection")) { _ = PF_NPGetPersistentUseOptionsForConnection; } if (@hasDecl(@This(), "PF_NPDeviceMode")) { _ = PF_NPDeviceMode; } if (@hasDecl(@This(), "PF_NPSearchDialog")) { _ = PF_NPSearchDialog; } if (@hasDecl(@This(), "PF_NPGetResourceParent")) { _ = PF_NPGetResourceParent; } if (@hasDecl(@This(), "PF_NPGetResourceInformation")) { _ = PF_NPGetResourceInformation; } if (@hasDecl(@This(), "PF_NPFormatNetworkName")) { _ = PF_NPFormatNetworkName; } if (@hasDecl(@This(), "PF_NPGetPropertyText")) { _ = PF_NPGetPropertyText; } if (@hasDecl(@This(), "PF_NPPropertyDialog")) { _ = PF_NPPropertyDialog; } if (@hasDecl(@This(), "PF_NPGetDirectoryType")) { _ = PF_NPGetDirectoryType; } if (@hasDecl(@This(), "PF_NPDirectoryNotify")) { _ = PF_NPDirectoryNotify; } if (@hasDecl(@This(), "PF_NPLogonNotify")) { _ = PF_NPLogonNotify; } if (@hasDecl(@This(), "PF_NPPasswordChangeNotify")) { _ = PF_NPPasswordChangeNotify; } if (@hasDecl(@This(), "PF_AddConnectNotify")) { _ = PF_AddConnectNotify; } if (@hasDecl(@This(), "PF_CancelConnectNotify")) { _ = PF_CancelConnectNotify; } if (@hasDecl(@This(), "PF_NPFMXGetPermCaps")) { _ = PF_NPFMXGetPermCaps; } if (@hasDecl(@This(), "PF_NPFMXEditPerm")) { _ = PF_NPFMXEditPerm; } if (@hasDecl(@This(), "PF_NPFMXGetPermHelp")) { _ = PF_NPFMXGetPermHelp; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/network_management/wnet.zig
const std = @import("std"); const testing = std.testing; pub const Customs = struct { const SIZE: usize = 26; count_any: bool, count: [SIZE]usize, line_count: usize, total_sum: usize, pub fn init(count_any: bool) Customs { var self = Customs{ .count_any = count_any, .count = [_]usize{0} ** SIZE, .line_count = 0, .total_sum = 0, }; return self; } pub fn deinit(self: *Customs) void { _ = self; } pub fn add_line(self: *Customs, line: []const u8) void { // std.debug.warn("LINE [{}]\n", .{line}); if (line.len == 0) { self.done(); return; } self.line_count += 1; for (line) |c| { var pos: usize = 0; if (c >= 'a' or c <= 'z') { pos = c - 'a'; } else if (c >= 'A' or c <= 'Z') { pos = c - 'A'; } else { continue; } self.count[pos] += 1; } } pub fn done(self: *Customs) void { // std.debug.warn("DONE\n", .{}); for (self.count) |count| { if (self.count_any and count > 0) { self.total_sum += 1; } else if (!self.count_any and count == self.line_count) { self.total_sum += 1; } } self.line_count = 0; for (self.count) |_, pos| { self.count[pos] = 0; } } pub fn get_total_sum(self: Customs) usize { return self.total_sum; } }; test "sample any" { const data: []const u8 = \\abc \\ \\a \\b \\c \\ \\ab \\ac \\ \\a \\a \\a \\a \\ \\b ; var customs = Customs.init(true); defer customs.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { customs.add_line(line); } customs.done(); const total_sum = customs.get_total_sum(); try testing.expect(total_sum == 11); } test "sample all" { const data: []const u8 = \\abc \\ \\a \\b \\c \\ \\ab \\ac \\ \\a \\a \\a \\a \\ \\b ; var customs = Customs.init(false); defer customs.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { customs.add_line(line); } customs.done(); const total_sum = customs.get_total_sum(); try testing.expect(total_sum == 6); }
2020/p06/customs.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; const Allocator = std.mem.Allocator; const geo = @import("modules/zig-geometry/index.zig"); const json = @import("json.zig"); const parseJsonFile = @import("parse_json_file.zig").parseJsonFile; const DBG = false; const DBG1 = false; pub fn createMeshFromBabylonJson(pAllocator: *Allocator, name: []const u8, tree: json.ValueTree) !geo.Mesh { var root = tree.root; var meshes = root.Object.get("meshes").?.value.Array; var positions = meshes.items[0].Object.get("positions").?.value.Array; if (DBG) warn("positions.len={}\n", positions.len); var normals = meshes.items[0].Object.get("normals").?.value.Array; if (DBG) warn("normals.len={}\n", normals.len); // If uvs isn't available then an empyt list var uvs = if (meshes.items[0].Object.get("uvs")) |pUvs| pUvs.value.Array else std.ArrayList(json.Value).init(pAllocator); if (DBG) warn("uvs.len={}\n", uvs.len); var indices = meshes.items[0].Object.get("indices").?.value.Array; if (DBG) warn("indices.len={}\n", indices.len); var vertices_count = positions.len / 3; var faces_count = indices.len / 3; if (DBG) warn("vertices_count={} faces_count={}\n", vertices_count, faces_count); var mesh = try geo.Mesh.init(pAllocator, name, vertices_count, faces_count); var i: usize = 0; var pos_iter = positions.iterator(); var nrml_iter = normals.iterator(); var uvs_iter = uvs.iterator(); while (i < vertices_count) : (i += 1) { var x = try pos_iter.next().?.asFloat(f32); var y = try pos_iter.next().?.asFloat(f32); var z = try pos_iter.next().?.asFloat(f32); var nx = try nrml_iter.next().?.asFloat(f32); var ny = try nrml_iter.next().?.asFloat(f32); var nz = try nrml_iter.next().?.asFloat(f32); // Len of uvs maybe zero var u: f32 = if (uvs_iter.next()) |nu| try nu.asFloat(f32) else 0.0; var v: f32 = if (uvs_iter.next()) |nv| try nv.asFloat(f32) else 0.0; mesh.vertices[i] = geo.Vertex { .coord = geo.V3f32.init(x, y, z), .world_coord = geo.V3f32.init(0, 0, 0), .normal_coord = geo.V3f32.init(nx, ny, nz), .texture_coord = geo.V2f32.init(u, v), }; } i = 0; var indicies_iter = indices.iterator(); while (i < faces_count) : (i += 1) { // Get the indexes for a,b,c var a = @intCast(usize, indicies_iter.next().?.Integer); var b = @intCast(usize, indicies_iter.next().?.Integer); var c = @intCast(usize, indicies_iter.next().?.Integer); var normal = geo.computeFaceNormal(mesh.vertices, a, b, c); mesh.faces[i] = geo.Face { .a=a, .b=b, .c=c, .normal=normal }; if (DBG1) warn("face[{}]={{ .a={} .b={} .c={} .normal={} }}\n", i, mesh.faces[i].a, mesh.faces[i].b, mesh.faces[i].c, mesh.faces[i].normal); } return mesh; } test "create_mesh_from_babylon_json.cube" { var file_name = "modules/3d-test-resources/cube.babylon"; var pAllocator = std.heap.c_allocator; var tree = try parseJsonFile(pAllocator, file_name); defer tree.deinit(); var mesh = try createMeshFromBabylonJson(pAllocator, "cube", tree); if (DBG) warn("mesh.vertices.len={} faces.len={}\n", mesh.vertices.len, mesh.faces.len); assert(mesh.vertices.len == 8); assert(mesh.faces.len == 12); } test "create_mesh_from_babylon_json.suzanne" { var file_name = "modules/3d-test-resources/suzanne.babylon"; var pAllocator = std.heap.c_allocator; var tree = try parseJsonFile(pAllocator, file_name); defer tree.deinit(); var mesh = try createMeshFromBabylonJson(pAllocator, "suzanne", tree); if (DBG) warn("mesh.vertices.len={} faces.len={}\n", mesh.vertices.len, mesh.faces.len); assert(mesh.vertices.len == 507); assert(mesh.faces.len == 968); }
create_mesh_from_babylon_json.zig
const clap = @import("clap"); const std = @import("std"); const util = @import("util"); const gen3 = @import("gen3.zig"); const gen4 = @import("gen4.zig"); const gen5 = @import("gen5.zig"); const rom = @import("rom.zig"); const script = @import("script.zig"); 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 li16 = rom.int.li16; const li32 = rom.int.li32; const lu16 = rom.int.lu16; const lu32 = rom.int.lu32; const nds = rom.nds; const Program = @This(); allocator: mem.Allocator, file: []const u8, pub const main = util.generateMain(Program); pub const version = "0.0.0"; pub const description = \\Finds all scripts in a Pokemon game, disassembles them and writes them to stdout. \\ ; pub const params = &[_]clap.Param(clap.Help){ clap.parseParam("-h, --help Display this help text and exit. ") catch unreachable, clap.parseParam("-v, --version Output version information and exit.") catch unreachable, clap.parseParam("<ROM>") catch unreachable, }; pub fn init(allocator: mem.Allocator, args: anytype) !Program { const pos = args.positionals(); const file_name = if (pos.len > 0) pos[0] else return error.MissingFile; return Program{ .allocator = allocator, .file = file_name, }; } pub fn run( program: *Program, comptime Reader: type, comptime Writer: type, stdio: util.CustomStdIoStreams(Reader, Writer), ) anyerror!void { const allocator = program.allocator; const file = try fs.cwd().openFile(program.file, .{}); defer file.close(); const gen3_error = if (gen3.Game.fromFile(file, allocator)) |*game| { defer game.deinit(); try outputGen3GameScripts(game.*, stdio.out); return; } else |err| err; try file.seekTo(0); if (nds.Rom.fromFile(file, allocator)) |*nds_rom| { const gen4_error = if (gen4.Game.fromRom(allocator, nds_rom)) |*game| { defer game.deinit(); try outputGen4GameScripts(game.*, allocator, stdio.out); return; } else |err| err; const gen5_error = if (gen5.Game.fromRom(allocator, nds_rom)) |*game| { defer game.deinit(); try outputGen5GameScripts(game.*, allocator, stdio.out); return; } else |err| err; log.info("Successfully loaded '{s}' as a nds rom.", .{program.file}); log.err("Failed to load '{s}' as a gen4 game: {}", .{ program.file, gen4_error }); log.err("Failed to load '{s}' as a gen5 game: {}", .{ program.file, gen5_error }); return gen5_error; } else |nds_error| { log.err("Failed to load '{s}' as a gen3 game: {}", .{ program.file, gen3_error }); log.err("Failed to load '{s}' as a gen4/gen5 game: {}", .{ program.file, nds_error }); return nds_error; } } fn outputGen3GameScripts(game: gen3.Game, writer: anytype) !void { @setEvalBranchQuota(100000); for (game.map_headers) |map_header, map_id| { const scripts = try map_header.map_scripts.toSliceEnd(game.data); for (scripts) |s, script_id| { if (s.@"type" == 0) break; if (s.@"type" == 2 or s.@"type" == 4) continue; const script_data = try s.addr.other.toSliceEnd(game.data); var decoder = gen3.script.CommandDecoder{ .bytes = script_data }; try writer.print("map_header[{}].map_script[{}]:\n", .{ map_id, script_id }); while (try decoder.next()) |command| try printCommand(writer, command.*, decoder); try writer.writeAll("\n"); } const events = try map_header.map_events.toPtr(game.data); for (try events.obj_events.toSlice(game.data, events.obj_events_len)) |obj_event, script_id| { const script_data = obj_event.script.toSliceEnd(game.data) catch continue; var decoder = gen3.script.CommandDecoder{ .bytes = script_data }; try writer.print("map_header[{}].obj_events[{}]:\n", .{ map_id, script_id }); while (try decoder.next()) |command| try printCommand(writer, command.*, decoder); try writer.writeAll("\n"); } for (try events.coord_events.toSlice(game.data, events.coord_events_len)) |coord_event, script_id| { const script_data = coord_event.scripts.toSliceEnd(game.data) catch continue; var decoder = gen3.script.CommandDecoder{ .bytes = script_data }; try writer.print("map_header[{}].coord_event[{}]:\n", .{ map_id, script_id }); while (try decoder.next()) |command| try printCommand(writer, command.*, decoder); try writer.writeAll("\n"); } } } fn outputGen4GameScripts(game: gen4.Game, allocator: mem.Allocator, writer: anytype) anyerror!void { @setEvalBranchQuota(100000); for (game.ptrs.scripts.fat) |_, script_i| { const script_data = game.ptrs.scripts.fileData(.{ .i = @intCast(u32, script_i) }); var offsets = std.ArrayList(isize).init(allocator); defer offsets.deinit(); for (gen4.script.getScriptOffsets(script_data)) |relative_offset, i| { const offset = relative_offset.value() + @intCast(isize, i + 1) * @sizeOf(lu32); if (@intCast(isize, script_data.len) < offset) continue; if (offset < 0) continue; try offsets.append(offset); } var offset_i: usize = 0; while (offset_i < offsets.items.len) : (offset_i += 1) { const offset = offsets.items[offset_i]; try writer.print("script[{}]@0x{x}:\n", .{ script_i, offset }); if (@intCast(isize, script_data.len) < offset) continue; if (offset < 0) continue; var decoder = gen4.script.CommandDecoder{ .bytes = script_data, .i = @intCast(usize, offset), }; while (decoder.next() catch { const rest = decoder.bytes[decoder.i..]; try writer.print("\tUnknown(0x{x})\t@0x{x}\n", .{ std.fmt.fmtSliceHexLower(rest[0..math.min(rest.len, 2)]), decoder.i, }); continue; }) |command| { try printCommand(writer, command.*, decoder); switch (command.tag) { .jump, .compare_last_result_jump, .call, .compare_last_result_call => { const off = switch (command.tag) { .compare_last_result_call => command.data().compare_last_result_call.adr.value(), .call => command.data().call.adr.value(), .jump => command.data().jump.adr.value(), .compare_last_result_jump => command.data().compare_last_result_jump.adr.value(), else => unreachable, }; const location = off + @intCast(isize, decoder.i); if (mem.indexOfScalar(isize, offsets.items, location) == null) try offsets.append(location); }, else => {}, } } } } } fn outputGen5GameScripts(game: gen5.Game, allocator: mem.Allocator, writer: anytype) anyerror!void { @setEvalBranchQuota(100000); for (game.ptrs.scripts.fat) |_, script_i| { const script_data = game.ptrs.scripts.fileData(.{ .i = @intCast(u32, script_i) }); var offsets = std.ArrayList(usize).init(allocator); defer offsets.deinit(); for (gen5.script.getScriptOffsets(script_data)) |relative, i| { const position = @intCast(isize, i + 1) * @sizeOf(lu32); const offset = math.cast(usize, relative.value() + position) orelse continue; if (script_data.len < offset) continue; try offsets.append(offset); } var offset_i: usize = 0; while (offset_i < offsets.items.len) : (offset_i += 1) { const offset = offsets.items[offset_i]; try writer.print("script[{}]@0x{x}:\n", .{ script_i, offset }); var decoder = gen5.script.CommandDecoder{ .bytes = script_data, .i = offset, }; while (decoder.next() catch { const rest = decoder.bytes[decoder.i..]; try writer.print("\tUnknown(0x{x})\t@0x{x}\n", .{ std.fmt.fmtSliceHexLower(rest[0..math.min(rest.len, 2)]), decoder.i, }); continue; }) |command| { try printCommand(writer, command.*, decoder); switch (command.tag) { .jump, .@"if", .call_routine => { const off = switch (command.tag) { .jump => command.data().jump.offset.value(), .@"if" => command.data().@"if".offset.value(), .call_routine => command.data().call_routine.offset.value(), else => unreachable, }; if (math.cast(usize, off + @intCast(isize, decoder.i))) |loc| { if (loc < script_data.len and mem.indexOfScalar(usize, offsets.items, loc) == null) try offsets.append(loc); } }, else => {}, } } } } } fn printCommand(writer: anytype, command: anytype, decoder: anytype) !void { try writer.writeAll("\t"); try printCommandHelper(writer, command); try writer.print("\t@0x{x}\n", .{decoder.i - try script.packedLength(command)}); } fn printCommandHelper(writer: anytype, value: anytype) !void { const T = @TypeOf(value); // Infered error sets enforce us to have to return an error somewhere. This // messes up with the below comptime branch selection, where some branches // does not return any errors. try writer.writeAll(""); switch (@typeInfo(T)) { .Void => {}, .Int => try writer.print("{}", .{value}), .Enum => try writer.print("{s}", .{@tagName(value)}), .Array => for (value) |v| { try printCommandHelper(writer, v); }, .Struct => |s| { // lu16 and lu16 are seen as structs, but really they should be treated // the same as int values. if (T == lu16) return printCommandHelper(writer, value.value()); if (T == lu32) return printCommandHelper(writer, value.value()); if (T == li16) return printCommandHelper(writer, value.value()); if (T == li32) return printCommandHelper(writer, value.value()); inline for (s.fields) |struct_field, i| { switch (@typeInfo(struct_field.field_type)) { .Union => |u| { if (u.tag_type != null) @compileError(@typeName(struct_field.field_type) ++ " cannot have a tag."); // Find the field most likly to be this unions tag. const tag_field = (comptime script.findTagFieldName(T, struct_field.name)) orelse @compileError("Could not find a tag for " ++ struct_field.name); const tag = @field(value, tag_field); const union_value = @field(value, struct_field.name); const TagEnum = @TypeOf(tag); var found: bool = true; inline for (@typeInfo(TagEnum).Enum.fields) |enum_field| { if (@field(TagEnum, enum_field.name) == tag) { try printCommandHelper(writer, @field(union_value, enum_field.name)); found = true; } } // @"if" no member of 'TagEnum' match, then 'tag' must be a value // it is not suppose to be. if (!found) return error.InvalidTag; }, else => try printCommandHelper(writer, @field(value, struct_field.name)), } if (i + 1 != s.fields.len) try writer.writeAll(" "); } }, else => @compileError(@typeName(T) ++ " not supported"), } }
src/core/tm35-disassemble-scripts.zig
const std = @import("std"); const TaskMod = @import("task.zig"); const Task = TaskMod.Task; const TaskState = TaskMod.TaskState; const platform = @import("platform.zig"); const serial = @import("debug/serial.zig"); const Allocator = std.mem.Allocator; const TailQueue = std.TailQueue; const TaskQueue = TailQueue(*Task); const E_SOON_DELAY_NS: u64 = 10 * 1000 * 1000; const E_LATE_DELAY_NS: u64 = 1000 * 1000 * 1000; var current_task: *Task = undefined; var current_task_node: *TaskQueue.Node = undefined; var tasks: [256]TaskQueue = undefined; var can_switch: bool = true; var curTaskPriority: u8 = 0; var taskNodeByPid: [TaskMod.PidBitmap.NUM_ENTRIES]?*TaskQueue.Node = undefined; // Based on how the L4 microkernel works var elapsed_ns: u64 = 0; var e_soon = E_SOON_DELAY_NS; var e_late = E_LATE_DELAY_NS; var soonTimeouts: TaskQueue = TaskQueue{}; // Sorted var lateTimeouts: TaskQueue = TaskQueue{}; // Unsorted var farFutureTimeouts: TaskQueue = TaskQueue{}; // Unsorted fn idle() void { // platform.ioWait(); platform.hlt(); } pub fn setTaskSwitching(enabled: bool) void { can_switch = enabled; } // *** Timeouts *** fn insertSoonTimeout(task_node: *TaskQueue.Node) void { const timeout = task_node.data.timeout; var ptr: ?*TaskQueue.Node = soonTimeouts.first; while (ptr) |inq_task_node| { if (inq_task_node.data.timeout >= timeout) { soonTimeouts.insertBefore(inq_task_node, task_node); return; } ptr = task_node.next; } soonTimeouts.append(task_node); } pub fn putTaskToSleep(task_node: *TaskQueue.Node, timeout_delay: u64) void { var timeout = elapsed_ns + timeout_delay; forceUnschedule(task_node); // Because we need to use the task_node task_node.data.state = TaskState.Sleep; task_node.data.timeout = timeout; if (timeout <= e_soon) { insertSoonTimeout(task_node); } else if (timeout <= e_late) { lateTimeouts.append(task_node); } else { farFutureTimeouts.append(task_node); } } fn organizeTimeoutQueues() void { if (e_late <= elapsed_ns) { e_late = elapsed_ns + E_LATE_DELAY_NS; var ptr: ?*TaskQueue.Node = farFutureTimeouts.first; while (ptr) |task_node| { ptr = task_node.next; if (task_node.data.timeout <= e_late) { farFutureTimeouts.remove(task_node); lateTimeouts.append(task_node); } } } if (e_soon <= elapsed_ns) { e_soon = elapsed_ns + E_SOON_DELAY_NS; var ptr: ?*TaskQueue.Node = lateTimeouts.first; while (ptr) |task_node| { ptr = task_node.next; if (task_node.data.timeout <= e_soon) { lateTimeouts.remove(task_node); insertSoonTimeout(task_node); } } } } fn rescheduleTimeouts() void { organizeTimeoutQueues(); while (soonTimeouts.first) |task_node| { if (task_node.data.timeout > elapsed_ns) { break; } var task_node_ptr = soonTimeouts.popFirst(); task_node.data.timeout = 0; scheduleBack(task_node); // TODO : the task was interupted. Should we provide some informations to the task ? (On the stack, registers ?) } } fn removeTaskTimeout(task_node: *TaskQueue.Node) void { var task = task_node.data; if (task.timeout != 0) { organizeTimeoutQueues(); if (task.timeout <= e_soon) { soonTimeouts.remove(task_node); } else if (task.timeout <= e_late) { lateTimeouts.remove(task_node); } else { farFutureTimeouts.remove(task_node); } task.timeout = 0; } } // *** Scheduler *** fn forceUnschedule(task_node: *TaskQueue.Node) void { // The task state still must be set manually var task = task_node.data; if (task.scheduled) { task.scheduled = false; tasks[task.priority].remove(task_node); } } // The idle task must always be running and at the priority 255 pub fn pickNextTask(ctx: *platform.Context) usize { current_task.stack_pointer = @ptrToInt(ctx); if (!can_switch) { return current_task.stack_pointer; } elapsed_ns += platform.getClockInterval(); rescheduleTimeouts(); var curStopped = false; if (current_task.state != TaskState.Runnable) { curStopped = true; } while (curStopped or curTaskPriority <= current_task.priority) { if (tasks[curTaskPriority].pop()) |next_task_node| { const next_task = next_task_node.data; if (next_task.state == TaskState.Runnable) { tasks[current_task.priority].prepend(current_task_node); // next_task_node.prev = null; // next_task_node.next = null; current_task_node = next_task_node; current_task = next_task; break; // Ok, new task scheduled } else { // The "next_task" can't be scheduled and has been paused for a at least round of the scheduler. It will be awoken by a timer or an event next_task.scheduled = false; } } else if (!curStopped and curTaskPriority == current_task.priority) { break; // Keep the current task if no task with the same priority is scheduled } else if (curTaskPriority >= tasks.len) { serial.ppanic("No task can be scheduled, missing idle task!", .{}); } else { curTaskPriority += 1; } } return current_task.stack_pointer; } fn scheduleTaskNode(task_node: *TaskQueue.Node) void { var task = task_node.data; tasks[task.priority].prepend(task_node); task.scheduled = true; if (task.priority < curTaskPriority) { curTaskPriority = task.priority; } } pub fn scheduleNewTask(new_task: *Task, allocator: *Allocator) Allocator.Error!void { var task_node = try allocator.create(TaskQueue.Node); if (new_task.priority < curTaskPriority) { curTaskPriority = new_task.priority; } task_node.* = .{ .data = new_task }; taskNodeByPid[new_task.pid] = task_node; scheduleTaskNode(task_node); } pub fn scheduleBack(task_node: *TaskQueue.Node) void { // Put back into the tasks array a task node removeTaskTimeout(task_node); task_node.data.state = TaskState.Runnable; if (!task_node.data.scheduled) { // If the task was unscheduled for a short time, may stil be in the queue scheduleTaskNode(task_node); } } pub fn initialize(kStackStart: usize, kStackSize: usize, allocator: *Allocator) Allocator.Error!void { serial.writeText("scheduler initialization...\n"); defer serial.writeText("scheduler initialized\n"); var iTaskQueue: u32 = 0; while (iTaskQueue < tasks.len) : (iTaskQueue += 1) { tasks[iTaskQueue] = TaskQueue{}; } current_task = try allocator.create(Task); errdefer allocator.destroy(current_task); current_task_node = try allocator.create(TaskQueue.Node); errdefer allocator.destroy(current_task_node); // init kernel task. current_task.* = .{ .pid = 0, .kernel_stack = @intToPtr([*]usize, @ptrToInt(&kStackStart))[0..kStackSize], .user_stack = &[_]usize{}, .kernel = true, .stack_pointer = undefined, .priority = 0, .state = TaskState.Runnable, .scheduled = false, .timeout = 0, }; current_task_node.data = current_task; var idle_task = try Task.create(@ptrToInt(idle), true, allocator, tasks.len - 1); errdefer idle_task.destroy(allocator); try scheduleNewTask(idle_task, allocator); } pub fn getTaskNode(pid: TaskMod.PidBitmap.IndexType) ?*TaskQueue.Node { return taskNodeByPid[pid]; } pub fn remove(task_node: *TaskQueue.Node, allocator: *Allocator) void { removeTaskTimeout(task_node); forceUnschedule(task_node); taskNodeByPid[task_node.data.pid] = null; task_node.data.destroy(allocator); allocator.destroy(task_node); } // Test var fn1_stop: bool = false; fn self_test_fn1() noreturn { serial.writeText("FN1 - 0\n"); asm volatile ("hlt"); serial.writeText("FN1 - 1\n"); fn1_stop = true; asm volatile ("hlt"); while (true) { serial.writeText("FN1\n"); asm volatile ("hlt"); } } fn self_test_fn2() noreturn { while (true) { serial.writeText("FN2\n"); asm volatile ("hlt"); } } fn self_test_fn3() noreturn { while (true) { serial.writeText("FN3\n"); asm volatile ("hlt"); } } fn self_test_timeout() noreturn { while (true) { serial.writeText("==== TIMEOUT OK ===\n"); asm volatile ("hlt"); } } var task_fn_1: *Task = undefined; var task_fn_2: *Task = undefined; var task_fn_3: *Task = undefined; var task_fn_timeout: *Task = undefined; pub fn self_test_init(allocator: *Allocator) Allocator.Error!void { serial.writeText("scheduler self_test_init initialization...\n"); defer serial.writeText("scheduler self_test_init initialized\n"); task_fn_1 = try Task.create(@ptrToInt(self_test_fn1), true, allocator, 0); task_fn_2 = try Task.create(@ptrToInt(self_test_fn2), true, allocator, 4); task_fn_3 = try Task.create(@ptrToInt(self_test_fn3), true, allocator, 4); task_fn_timeout = try Task.create(@ptrToInt(self_test_timeout), true, allocator, 4); try scheduleNewTask(task_fn_1, allocator); try scheduleNewTask(task_fn_2, allocator); try scheduleNewTask(task_fn_3, allocator); try scheduleNewTask(task_fn_timeout, allocator); // remove(getTaskNode(task_fn_3.pid).?, allocator); } pub fn selfTest() void { var timeout_node = getTaskNode(task_fn_timeout.pid).?; putTaskToSleep(timeout_node, 2 * 1000 * 1000 * 1000); while (!fn1_stop) { asm volatile ("hlt"); } task_fn_1.state = TaskState.Stopped; current_task.state = TaskState.Stopped; while (true) { asm volatile ("hlt"); } }
src/kernel/scheduler.zig
const x86_64 = @import("../index.zig"); const bitjuggle = @import("bitjuggle"); const std = @import("std"); const formatWithoutFields = @import("../common.zig").formatWithoutFields; /// The RFLAGS register. pub const RFlags = packed struct { /// Set by hardware if last arithmetic operation generated a carry out of the /// most-significant bit of the result. carry: bool, z_reserved1: bool, /// Set by hardware if last result has an even number of 1 bits (only for some operations). parity: bool, z_reserved3: bool, /// Set by hardware if last arithmetic operation generated a carry ouf of bit 3 of the /// result. auxiliary_carry: bool, z_reserved5: bool, /// Set by hardware if last arithmetic operation resulted in a zero value. zero: bool, /// Set by hardware if last arithmetic operation resulted in a negative value. sign: bool, /// Enable single-step mode for debugging. trap: bool, /// Enable interrupts. interrupt: bool, /// Determines the order in which strings are processed. direction: bool, /// Set by hardware to indicate that the sign bit of the result of the last signed integer /// operation differs from the source operands. overflow: bool, /// Specifies the privilege level required for executing I/O address-space instructions. iopl: u2, /// Used by `iret` in hardware task switch mode to determine if current task is nested. nested: bool, z_reserved15: bool, /// Allows to restart an instruction following an instrucion breakpoint. @"resume": bool, /// Enable the virtual-8086 mode. virtual_8086: bool, /// Enable automatic alignment checking if CR0.AM is set. Only works if CPL is 3. alignment_check: bool, /// Virtual image of the INTERRUPT_FLAG bit. /// /// Used when virtual-8086 mode extensions (CR4.VME) or protected-mode virtual /// interrupts (CR4.PVI) are activated. virtual_interrupt: bool, /// Indicates that an external, maskable interrupt is pending. /// /// Used when virtual-8086 mode extensions (CR4.VME) or protected-mode virtual /// interrupts (CR4.PVI) are activated. virtual_interrupt_pending: bool, /// Processor feature identification flag. /// /// If this flag is modifiable, the CPU supports CPUID. id: bool, z_reserved22_31: u10, z_reserved32_63: u32, /// Returns the current value of the RFLAGS register. pub fn read() RFlags { return RFlags.fromU64(readRaw()); } /// Returns the raw current value of the RFLAGS register. fn readRaw() u64 { return asm ("pushfq; popq %[ret]" : [ret] "=r" (-> u64), : : "memory" ); } /// Writes the RFLAGS register, preserves reserved bits. pub fn write(self: RFlags) void { writeRaw(self.toU64() | (readRaw() & ALL_RESERVED)); } /// Writes the RFLAGS register. /// Does not preserve any bits fn writeRaw(value: u64) void { asm volatile ("pushq %[val]; popfq" : : [val] "r" (value), : "memory", "flags" ); } const ALL_RESERVED: u64 = blk: { var flags = std.mem.zeroes(RFlags); flags.z_reserved1 = true; flags.z_reserved15 = true; flags.z_reserved22_31 = std.math.maxInt(u10); flags.z_reserved3 = true; flags.z_reserved32_63 = std.math.maxInt(u32); flags.z_reserved5 = true; break :blk @bitCast(u64, flags); }; const ALL_NOT_RESERVED: u64 = ~ALL_RESERVED; pub fn fromU64(value: u64) RFlags { return @bitCast(RFlags, value & ALL_NOT_RESERVED); } pub fn toU64(self: RFlags) u64 { return @bitCast(u64, self) & ALL_NOT_RESERVED; } pub fn format(value: RFlags, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = fmt; return formatWithoutFields( value, options, writer, &.{ "z_reserved1", "z_reserved15", "z_reserved22_31", "z_reserved3", "z_reserved32_63", "z_reserved5" }, ); } test { try std.testing.expectEqual(@as(usize, 64), @bitSizeOf(RFlags)); try std.testing.expectEqual(@as(usize, 8), @sizeOf(RFlags)); } comptime { std.testing.refAllDecls(@This()); } }; comptime { std.testing.refAllDecls(@This()); }
src/registers/rflags.zig
const std = @import("std"); const cuda_sdk = @import("cudaz/sdk.zig"); const CUDA_PATH = "/usr/local/cuda"; const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; const RunStep = std.build.RunStep; var target: std.zig.CrossTarget = undefined; var mode: std.builtin.Mode = undefined; pub fn build(b: *Builder) void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for restricting supported target set are available. target = b.standardTargetOptions(.{}); // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. mode = b.standardReleaseOptions(); var tests = b.step("test", "Tests"); const test_png = b.addTest("src/png.zig"); addLodePng(test_png); tests.dependOn(&test_png.step); // CS344 lessons and home works const hw1 = addHomework(b, tests, "hw1"); addLesson(b, "lesson2"); const hw2 = addHomework(b, tests, "hw2"); addLesson(b, "lesson3"); const hw3 = addHomework(b, tests, "hw3"); const hw4 = addHomework(b, tests, "hw4"); addZigLesson(b, "lesson5"); _ = hw1; _ = hw2; _ = hw3; _ = hw4; const run_step = b.step("run", "Run the example"); const run_hw1 = hw1.run(); run_hw1.step.dependOn(b.getInstallStep()); run_step.dependOn(&run_hw1.step); const run_hw2 = hw2.run(); run_hw2.step.dependOn(b.getInstallStep()); run_step.dependOn(&run_hw2.step); const run_hw3 = hw3.run(); run_hw3.step.dependOn(b.getInstallStep()); run_step.dependOn(&run_hw3.step); const run_hw4 = hw4.run(); run_hw4.step.dependOn(b.getInstallStep()); run_step.dependOn(&run_hw4.step); // Pure const run_pure_step = b.step("run_pure", "Run the example"); const hw1_pure = addZigHomework(b, tests, "hw1_pure"); run_pure_step.dependOn(&hw1_pure.step); const hw2_pure = addZigHomework(b, tests, "hw2_pure"); run_pure_step.dependOn(&hw2_pure.step); const hw5 = addZigHomework(b, tests, "hw5"); run_pure_step.dependOn(&hw5.step); } fn addLodePng(exe: *LibExeObjStep) void { // TODO remove libc dependency exe.linkLibC(); const lodepng_flags = [_][]const u8{ "-DLODEPNG_COMPILE_ERROR_TEXT", }; exe.addIncludeDir("lodepng/"); exe.addCSourceFile("lodepng/lodepng.c", &lodepng_flags); } fn addHomework(b: *Builder, tests: *std.build.Step, comptime name: []const u8) *LibExeObjStep { const hw = b.addExecutable(name, "src/" ++ name ++ ".zig"); hw.setTarget(target); hw.setBuildMode(mode); cuda_sdk.addCudaz(b, hw, CUDA_PATH, "src/" ++ name ++ ".cu"); addLodePng(hw); hw.install(); const test_hw = b.addTest("src/" ++ name ++ ".zig"); cuda_sdk.addCudaz(b, test_hw, CUDA_PATH, "src/" ++ name ++ ".cu"); tests.dependOn(&test_hw.step); return hw; } fn addZigHomework(b: *Builder, tests: *std.build.Step, comptime name: []const u8) *RunStep { const hw = b.addExecutable(name, "src/" ++ name ++ ".zig"); hw.setTarget(target); hw.setBuildMode(mode); cuda_sdk.addCudazWithZigKernel(b, hw, CUDA_PATH, "src/" ++ name ++ "_kernel.zig"); addLodePng(hw); hw.install(); const hw_run = hw.run(); hw_run.step.dependOn(b.getInstallStep()); const test_hw = b.addTest("src/" ++ name ++ ".zig"); cuda_sdk.addCudazWithZigKernel(b, test_hw, CUDA_PATH, "src/" ++ name ++ "_kernel.zig"); tests.dependOn(&test_hw.step); return hw_run; } fn addLesson(b: *Builder, comptime name: []const u8) void { const lesson = b.addExecutable(name, "src/" ++ name ++ ".zig"); cuda_sdk.addCudaz(b, lesson, CUDA_PATH, "src/" ++ name ++ ".cu"); lesson.setTarget(target); lesson.setBuildMode(mode); lesson.install(); const run_lesson_step = b.step(name, "Run " ++ name); const run_lesson = lesson.run(); run_lesson.step.dependOn(b.getInstallStep()); run_lesson_step.dependOn(&run_lesson.step); } fn addZigLesson(b: *Builder, comptime name: []const u8) void { const lesson = b.addExecutable(name, "src/" ++ name ++ ".zig"); cuda_sdk.addCudazWithZigKernel(b, lesson, CUDA_PATH, "src/" ++ name ++ "_kernel.zig"); lesson.setTarget(target); lesson.setBuildMode(mode); lesson.install(); const run_lesson_step = b.step(name, "Run " ++ name); const run_lesson = lesson.run(); run_lesson.step.dependOn(b.getInstallStep()); run_lesson_step.dependOn(&run_lesson.step); }
CS344/build.zig
const std = @import("std"); const panic = std.debug.panic; const dpmi = @import("dpmi.zig"); const FarPtr = @import("far_ptr.zig").FarPtr; pub const fd_t = u16; pub const mode_t = u8; pub const off_t = i32; pub const E = @import("errno.zig").E; pub const PATH_MAX = 260; pub const STDIN_FILENO = 0; pub const STDOUT_FILENO = 1; pub const STDERR_FILENO = 2; pub const O_RDONLY = 0; pub const O_WRONLY = 1; pub const O_RDWR = 2; pub const SEEK_SET = 0; pub const SEEK_CUR = 1; pub const SEEK_END = 2; /// Error code of the last DOS system call. pub threadlocal var error_code: u16 = 0; /// Buffer in DOS memory for transferring data with system calls. pub var transfer_buffer: dpmi.DosMemBlock = undefined; fn int21(registers: dpmi.RealModeRegisters) dpmi.RealModeRegisters { var regs = registers; dpmi.simulateInterrupt(0x21, &regs); error_code = if (regs.flags & 1 != 0) int21(.{ .eax = 0x5900, .ebx = 0 }).ax() // Extended error code. else 0; return regs; } pub fn getErrno(rc: anytype) E { _ = rc; return switch (error_code) { // TODO: Map known DOS error codes to C-style error codes. 0 => E.SUCCESS, 2 => E.NOENT, else => panic("Unmapped DOS error code: {}", .{error_code}), }; } pub fn abort() noreturn { exit(1); } pub fn exit(status: u8) noreturn { const func: u16 = 0x4c00; asm volatile ("int $0x21" : // No outputs : [_] "{ax}" (func | status), ); unreachable; } pub fn open(file_path: [*:0]const u8, flags: u32, mode: mode_t) fd_t { _ = mode; // TODO: Can mode be reasonably mapped onto DOS 3.1 sharing mode bits? // TODO: Use long filename open (int 0x21, ax=0x716c) if it's available. const len = std.mem.len(file_path) + 1; // TODO: Fail if len exceeds transfer buffer size. transfer_buffer.write(file_path[0..len]); const regs = int21(.{ .eax = 0x3d00 | (flags & 3), .edx = 0, .ds = transfer_buffer.real_mode_segment, }); return regs.ax(); } pub fn close(handle: fd_t) void { _ = int21(.{ .eax = 0x3e00, .ebx = handle, }); } pub fn read(handle: fd_t, buf: [*]u8, count: usize) u16 { const len = std.math.min(count, transfer_buffer.len); const regs = int21(.{ .eax = 0x3f00, .ebx = handle, .ecx = len, .edx = 0, .ds = transfer_buffer.real_mode_segment, }); const actual_read_len = regs.ax(); if (error_code == 0) { transfer_buffer.read(buf[0..actual_read_len]); } return actual_read_len; } pub fn write(handle: fd_t, buf: [*]const u8, count: usize) u16 { const len = std.math.min(count, transfer_buffer.len); transfer_buffer.write(buf[0..len]); const regs = int21(.{ .eax = 0x4000, .ebx = handle, .ecx = len, .edx = 0, .ds = transfer_buffer.real_mode_segment, }); return regs.ax(); } pub fn fsync(handle: fd_t) u16 { const regs = int21(.{ .eax = 0x6800, .ebx = handle, }); return regs.ax(); } pub fn lseek(handle: fd_t, offset: off_t, whence: u8) off_t { const regs = int21(.{ .eax = @as(u16, 0x4200) | whence, .ebx = handle, .ecx = @intCast(u16, offset >> 16), .edx = @intCast(u16, offset), }); return @intCast(off_t, (regs.edx << 16) | regs.ax()); } pub fn pread(handle: fd_t, buf: [*]u8, count: usize, offset: u64) u16 { // TODO: Handle errors. const original_offset = lseek(handle, 0, SEEK_CUR); defer _ = lseek(handle, original_offset, SEEK_SET); _ = lseek(handle, @intCast(off_t, offset), SEEK_SET); return read(handle, buf, count); } pub fn sched_yield() void { // TODO: Yield via DPMI (if present). // See: http://www.delorie.com/djgpp/doc/dpmi/api/2f1680.html }
src/dos/system.zig
const windows = @import("windows.zig"); const UINT = windows.UINT; const UINT64 = windows.UINT64; const DWORD = windows.DWORD; const FLOAT = windows.FLOAT; const BOOL = windows.BOOL; const GUID = windows.GUID; const WINAPI = windows.WINAPI; const IUnknown = windows.IUnknown; const HRESULT = windows.HRESULT; const WCHAR = windows.WCHAR; const RECT = windows.RECT; const INT = windows.INT; const BYTE = windows.BYTE; const HMONITOR = windows.HMONITOR; const LARGE_INTEGER = windows.LARGE_INTEGER; const HWND = windows.HWND; const SIZE_T = windows.SIZE_T; const LUID = windows.LUID; const HANDLE = windows.HANDLE; const POINT = windows.POINT; pub const FORMAT = enum(UINT) { UNKNOWN = 0, R32G32B32A32_TYPELESS = 1, R32G32B32A32_FLOAT = 2, R32G32B32A32_UINT = 3, R32G32B32A32_SINT = 4, R32G32B32_TYPELESS = 5, R32G32B32_FLOAT = 6, R32G32B32_UINT = 7, R32G32B32_SINT = 8, R16G16B16A16_TYPELESS = 9, R16G16B16A16_FLOAT = 10, R16G16B16A16_UNORM = 11, R16G16B16A16_UINT = 12, R16G16B16A16_SNORM = 13, R16G16B16A16_SINT = 14, R32G32_TYPELESS = 15, R32G32_FLOAT = 16, R32G32_UINT = 17, R32G32_SINT = 18, R32G8X24_TYPELESS = 19, D32_FLOAT_S8X24_UINT = 20, R32_FLOAT_X8X24_TYPELESS = 21, X32_TYPELESS_G8X24_UINT = 22, R10G10B10A2_TYPELESS = 23, R10G10B10A2_UNORM = 24, R10G10B10A2_UINT = 25, R11G11B10_FLOAT = 26, R8G8B8A8_TYPELESS = 27, R8G8B8A8_UNORM = 28, R8G8B8A8_UNORM_SRGB = 29, R8G8B8A8_UINT = 30, R8G8B8A8_SNORM = 31, R8G8B8A8_SINT = 32, R16G16_TYPELESS = 33, R16G16_FLOAT = 34, R16G16_UNORM = 35, R16G16_UINT = 36, R16G16_SNORM = 37, R16G16_SINT = 38, R32_TYPELESS = 39, D32_FLOAT = 40, R32_FLOAT = 41, R32_UINT = 42, R32_SINT = 43, R24G8_TYPELESS = 44, D24_UNORM_S8_UINT = 45, R24_UNORM_X8_TYPELESS = 46, X24_TYPELESS_G8_UINT = 47, R8G8_TYPELESS = 48, R8G8_UNORM = 49, R8G8_UINT = 50, R8G8_SNORM = 51, R8G8_SINT = 52, R16_TYPELESS = 53, R16_FLOAT = 54, D16_UNORM = 55, R16_UNORM = 56, R16_UINT = 57, R16_SNORM = 58, R16_SINT = 59, R8_TYPELESS = 60, R8_UNORM = 61, R8_UINT = 62, R8_SNORM = 63, R8_SINT = 64, A8_UNORM = 65, R1_UNORM = 66, R9G9B9E5_SHAREDEXP = 67, R8G8_B8G8_UNORM = 68, G8R8_G8B8_UNORM = 69, BC1_TYPELESS = 70, BC1_UNORM = 71, BC1_UNORM_SRGB = 72, BC2_TYPELESS = 73, BC2_UNORM = 74, BC2_UNORM_SRGB = 75, BC3_TYPELESS = 76, BC3_UNORM = 77, BC3_UNORM_SRGB = 78, BC4_TYPELESS = 79, BC4_UNORM = 80, BC4_SNORM = 81, BC5_TYPELESS = 82, BC5_UNORM = 83, BC5_SNORM = 84, B5G6R5_UNORM = 85, B5G5R5A1_UNORM = 86, B8G8R8A8_UNORM = 87, B8G8R8X8_UNORM = 88, R10G10B10_XR_BIAS_A2_UNORM = 89, B8G8R8A8_TYPELESS = 90, B8G8R8A8_UNORM_SRGB = 91, B8G8R8X8_TYPELESS = 92, B8G8R8X8_UNORM_SRGB = 93, BC6H_TYPELESS = 94, BC6H_UF16 = 95, BC6H_SF16 = 96, BC7_TYPELESS = 97, BC7_UNORM = 98, BC7_UNORM_SRGB = 99, AYUV = 100, Y410 = 101, Y416 = 102, NV12 = 103, P010 = 104, P016 = 105, _420_OPAQUE = 106, YUY2 = 107, Y210 = 108, Y216 = 109, NV11 = 110, AI44 = 111, IA44 = 112, P8 = 113, A8P8 = 114, B4G4R4A4_UNORM = 115, P208 = 130, V208 = 131, V408 = 132, SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189, SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190, pub fn pixelSizeInBytes(format: FORMAT) u32 { return switch (format) { .R32G32B32A32_TYPELESS, .R32G32B32A32_FLOAT, .R32G32B32A32_UINT, .R32G32B32A32_SINT, => 128 / 8, .R32G32B32_TYPELESS, .R32G32B32_FLOAT, .R32G32B32_UINT, .R32G32B32_SINT, => 96 / 8, .R16G16B16A16_TYPELESS, .R16G16B16A16_FLOAT, .R16G16B16A16_UNORM, .R16G16B16A16_UINT, .R16G16B16A16_SNORM, .R16G16B16A16_SINT, .R32G32_TYPELESS, .R32G32_FLOAT, .R32G32_UINT, .R32G32_SINT, .R32G8X24_TYPELESS, .D32_FLOAT_S8X24_UINT, .R32_FLOAT_X8X24_TYPELESS, .X32_TYPELESS_G8X24_UINT, .Y416, .Y210, .Y216, => 64 / 8, .R10G10B10A2_TYPELESS, .R10G10B10A2_UNORM, .R10G10B10A2_UINT, .R11G11B10_FLOAT, .R8G8B8A8_TYPELESS, .R8G8B8A8_UNORM, .R8G8B8A8_UNORM_SRGB, .R8G8B8A8_UINT, .R8G8B8A8_SNORM, .R8G8B8A8_SINT, .R16G16_TYPELESS, .R16G16_FLOAT, .R16G16_UNORM, .R16G16_UINT, .R16G16_SNORM, .R16G16_SINT, .R32_TYPELESS, .D32_FLOAT, .R32_FLOAT, .R32_UINT, .R32_SINT, .R24G8_TYPELESS, .D24_UNORM_S8_UINT, .R24_UNORM_X8_TYPELESS, .X24_TYPELESS_G8_UINT, .R9G9B9E5_SHAREDEXP, .R8G8_B8G8_UNORM, .G8R8_G8B8_UNORM, .B8G8R8A8_UNORM, .B8G8R8X8_UNORM, .R10G10B10_XR_BIAS_A2_UNORM, .B8G8R8A8_TYPELESS, .B8G8R8A8_UNORM_SRGB, .B8G8R8X8_TYPELESS, .B8G8R8X8_UNORM_SRGB, .AYUV, .Y410, .YUY2, => 32 / 8, .P010, .P016, => 24 / 8, .R8G8_TYPELESS, .R8G8_UNORM, .R8G8_UINT, .R8G8_SNORM, .R8G8_SINT, .R16_TYPELESS, .R16_FLOAT, .D16_UNORM, .R16_UNORM, .R16_UINT, .R16_SNORM, .R16_SINT, .B5G6R5_UNORM, .B5G5R5A1_UNORM, .A8P8, .B4G4R4A4_UNORM, => 16 / 8, .R8_TYPELESS, .R8_UNORM, .R8_UINT, .R8_SNORM, .R8_SINT, .A8_UNORM, .AI44, .IA44, .P8, => 8 / 8, .BC2_TYPELESS, .BC2_UNORM, .BC2_UNORM_SRGB, .BC3_TYPELESS, .BC3_UNORM, .BC3_UNORM_SRGB, .BC5_TYPELESS, .BC5_UNORM, .BC5_SNORM, .BC6H_TYPELESS, .BC6H_UF16, .BC6H_SF16, .BC7_TYPELESS, .BC7_UNORM, .BC7_UNORM_SRGB, => 8 / 8, .UNKNOWN, .R1_UNORM, .BC1_TYPELESS, .BC1_UNORM, .BC1_UNORM_SRGB, .BC4_TYPELESS, .BC4_UNORM, .BC4_SNORM, ._420_OPAQUE, .NV11, .NV12, .P208, .V208, .V408, .SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE, .SAMPLER_FEEDBACK_MIN_MIP_OPAQUE, => unreachable, }; } }; pub const RATIONAL = extern struct { Numerator: UINT, Denominator: UINT, }; // The following values are used with SAMPLE_DESC::Quality: pub const STANDARD_MULTISAMPLE_QUALITY_PATTERN: UINT = 0xffffffff; pub const CENTER_MULTISAMPLE_QUALITY_PATTERN: UINT = 0xfffffffe; pub const SAMPLE_DESC = extern struct { Count: UINT, Quality: UINT, }; pub const COLOR_SPACE_TYPE = enum(UINT) { RGB_FULL_G22_NONE_P709 = 0, RGB_FULL_G10_NONE_P709 = 1, RGB_STUDIO_G22_NONE_P709 = 2, RGB_STUDIO_G22_NONE_P2020 = 3, RESERVED = 4, YCBCR_FULL_G22_NONE_P709_X601 = 5, YCBCR_STUDIO_G22_LEFT_P601 = 6, YCBCR_FULL_G22_LEFT_P601 = 7, YCBCR_STUDIO_G22_LEFT_P709 = 8, YCBCR_FULL_G22_LEFT_P709 = 9, YCBCR_STUDIO_G22_LEFT_P2020 = 10, YCBCR_FULL_G22_LEFT_P2020 = 11, RGB_FULL_G2084_NONE_P2020 = 12, YCBCR_STUDIO_G2084_LEFT_P2020 = 13, RGB_STUDIO_G2084_NONE_P2020 = 14, YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15, YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16, RGB_FULL_G22_NONE_P2020 = 17, YCBCR_STUDIO_GHLG_TOPLEFT_P2020 = 18, YCBCR_FULL_GHLG_TOPLEFT_P2020 = 19, RGB_STUDIO_G24_NONE_P709 = 20, RGB_STUDIO_G24_NONE_P2020 = 21, YCBCR_STUDIO_G24_LEFT_P709 = 22, YCBCR_STUDIO_G24_LEFT_P2020 = 23, YCBCR_STUDIO_G24_TOPLEFT_P2020 = 24, CUSTOM = 0xFFFFFFFF, }; pub const CPU_ACCESS = enum(UINT) { NONE = 0, DYNAMIC = 1, READ_WRITE = 2, SCRATCH = 3, FIELD = 15, }; pub const RGB = extern struct { Red: FLOAT, Green: FLOAT, Blue: FLOAT, }; pub const D3DCOLORVALUE = extern struct { r: FLOAT, g: FLOAT, b: FLOAT, a: FLOAT, }; pub const RGBA = D3DCOLORVALUE; pub const GAMMA_CONTROL = extern struct { Scale: RGB, Offset: RGB, GammaCurve: [1025]RGB, }; pub const GAMMA_CONTROL_CAPABILITIES = extern struct { ScaleAndOffsetSupported: BOOL, MaxConvertedValue: FLOAT, MinConvertedValue: FLOAT, NumGammaControlPoints: UINT, ControlPointPositions: [1025]FLOAT, }; pub const MODE_SCANLINE_ORDER = enum(UINT) { UNSPECIFIED = 0, PROGRESSIVE = 1, UPPER_FIELD_FIRST = 2, LOWER_FIELD_FIRST = 3, }; pub const MODE_SCALING = enum(UINT) { UNSPECIFIED = 0, CENTERED = 1, STRETCHED = 2, }; pub const MODE_ROTATION = enum(UINT) { UNSPECIFIED = 0, IDENTITY = 1, ROTATE90 = 2, ROTATE180 = 3, ROTATE270 = 4, }; pub const MODE_DESC = extern struct { Width: UINT, Height: UINT, RefreshRate: RATIONAL, Format: FORMAT, ScanlineOrdering: MODE_SCANLINE_ORDER, Scaling: MODE_SCALING, }; pub const USAGE = UINT; pub const USAGE_SHADER_INPUT: USAGE = 0x00000010; pub const USAGE_RENDER_TARGET_OUTPUT: USAGE = 0x00000020; pub const USAGE_BACK_BUFFER: USAGE = 0x00000040; pub const USAGE_SHARED: USAGE = 0x00000080; pub const USAGE_READ_ONLY: USAGE = 0x00000100; pub const USAGE_DISCARD_ON_PRESENT: USAGE = 0x00000200; pub const USAGE_UNORDERED_ACCESS: USAGE = 0x00000400; pub const FRAME_STATISTICS = extern struct { PresentCount: UINT, PresentRefreshCount: UINT, SyncRefreshCount: UINT, SyncQPCTime: LARGE_INTEGER, SyncGPUTime: LARGE_INTEGER, }; pub const MAPPED_RECT = extern struct { Pitch: INT, pBits: *BYTE, }; pub const ADAPTER_DESC = extern struct { Description: [128]WCHAR, VendorId: UINT, DeviceId: UINT, SubSysId: UINT, Revision: UINT, DedicatedVideoMemory: SIZE_T, DedicatedSystemMemory: SIZE_T, SharedSystemMemory: SIZE_T, AdapterLuid: LUID, }; pub const OUTPUT_DESC = extern struct { DeviceName: [32]WCHAR, DesktopCoordinates: RECT, AttachedToDesktop: BOOL, Rotation: MODE_ROTATION, Monitor: HMONITOR, }; pub const SHARED_RESOURCE = extern struct { Handle: HANDLE, }; pub const RESOURCE_PRIORITY = enum(UINT) { MINIMUM = 0x28000000, LOW = 0x50000000, NORMAL = 0x78000000, HIGH = 0xa0000000, MAXIMUM = 0xc8000000, }; pub const RESIDENCY = enum(UINT) { FULLY_RESIDENT = 1, RESIDENT_IN_SHARED_MEMORY = 2, EVICTED_TO_DISK = 3, }; pub const SURFACE_DESC = extern struct { Width: UINT, Height: UINT, Format: FORMAT, SampleDesc: SAMPLE_DESC, }; pub const SWAP_EFFECT = enum(UINT) { DISCARD = 0, SEQUENTIAL = 1, FLIP_SEQUENTIAL = 3, FLIP_DISCARD = 4, }; pub const SWAP_CHAIN_FLAG = UINT; pub const SWAP_CHAIN_FLAG_NONPREROTATED: SWAP_CHAIN_FLAG = 1; pub const SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH: SWAP_CHAIN_FLAG = 2; pub const SWAP_CHAIN_FLAG_GDI_COMPATIBLE: SWAP_CHAIN_FLAG = 4; pub const SWAP_CHAIN_FLAG_RESTRICTED_CONTENT: SWAP_CHAIN_FLAG = 8; pub const SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER: SWAP_CHAIN_FLAG = 16; pub const SWAP_CHAIN_FLAG_DISPLAY_ONLY: SWAP_CHAIN_FLAG = 32; pub const SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT: SWAP_CHAIN_FLAG = 64; pub const SWAP_CHAIN_FLAG_FOREGROUND_LAYER: SWAP_CHAIN_FLAG = 128; pub const SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO: SWAP_CHAIN_FLAG = 256; pub const SWAP_CHAIN_FLAG_YUV_VIDEO: SWAP_CHAIN_FLAG = 512; pub const SWAP_CHAIN_FLAG_HW_PROTECTED: SWAP_CHAIN_FLAG = 1024; pub const SWAP_CHAIN_FLAG_ALLOW_TEARING: SWAP_CHAIN_FLAG = 2048; pub const SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS: SWAP_CHAIN_FLAG = 4096; pub const SWAP_CHAIN_DESC = extern struct { BufferDesc: MODE_DESC, SampleDesc: SAMPLE_DESC, BufferUsage: USAGE, BufferCount: UINT, OutputWindow: HWND, Windowed: BOOL, SwapEffect: SWAP_EFFECT, Flags: SWAP_CHAIN_FLAG, }; pub const IObject = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn SetPrivateData(self: *T, guid: *const GUID, data_size: UINT, data: *const anyopaque) HRESULT { return self.v.object.SetPrivateData(self, guid, data_size, data); } pub inline fn SetPrivateDataInterface(self: *T, guid: *const GUID, data: ?*const IUnknown) HRESULT { return self.v.object.SetPrivateDataInterface(self, guid, data); } pub inline fn GetPrivateData(self: *T, guid: *const GUID, data_size: *UINT, data: *anyopaque) HRESULT { return self.v.object.GetPrivateData(self, guid, data_size, data); } pub inline fn GetParent(self: *T, guid: *const GUID, parent: *?*anyopaque) HRESULT { return self.v.object.GetParent(self, guid, parent); } }; } pub fn VTable(comptime T: type) type { return extern struct { SetPrivateData: fn (*T, *const GUID, UINT, *const anyopaque) callconv(WINAPI) HRESULT, SetPrivateDataInterface: fn (*T, *const GUID, ?*const IUnknown) callconv(WINAPI) HRESULT, GetPrivateData: fn (*T, *const GUID, *UINT, *anyopaque) callconv(WINAPI) HRESULT, GetParent: fn (*T, *const GUID, *?*anyopaque) callconv(WINAPI) HRESULT, }; } }; pub const IDeviceSubObject = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), devsubobj: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn GetDevice(self: *T, guid: *const GUID, parent: *?*anyopaque) HRESULT { return self.v.devsubobj.GetDevice(self, guid, parent); } }; } pub fn VTable(comptime T: type) type { return extern struct { GetDevice: fn (*T, *const GUID, *?*anyopaque) callconv(WINAPI) HRESULT, }; } }; pub const IResource = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), devsubobj: IDeviceSubObject.VTable(Self), resource: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IDeviceSubObject.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn GetSharedHandle(self: *T, handle: *HANDLE) HRESULT { return self.v.resource.GetSharedHandle(self, handle); } pub inline fn GetUsage(self: *T, usage: *USAGE) HRESULT { return self.v.resource.GetUsage(self, usage); } pub inline fn SetEvictionPriority(self: *T, priority: UINT) HRESULT { return self.v.resource.SetEvictionPriority(self, priority); } pub inline fn GetEvictionPriority(self: *T, priority: *UINT) HRESULT { return self.v.resource.GetEvictionPriority(self, priority); } }; } pub fn VTable(comptime T: type) type { return extern struct { GetSharedHandle: fn (*T, *HANDLE) callconv(WINAPI) HRESULT, GetUsage: fn (*T, *USAGE) callconv(WINAPI) HRESULT, SetEvictionPriority: fn (*T, UINT) callconv(WINAPI) HRESULT, GetEvictionPriority: fn (*T, *UINT) callconv(WINAPI) HRESULT, }; } }; pub const IKeyedMutex = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), devsubobj: IDeviceSubObject.VTable(Self), mutex: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IDeviceSubObject.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn AcquireSync(self: *T, key: UINT64, milliseconds: DWORD) HRESULT { return self.v.mutex.AcquireSync(self, key, milliseconds); } pub inline fn ReleaseSync(self: *T, key: UINT64) HRESULT { return self.v.mutex.ReleaseSync(self, key); } }; } pub fn VTable(comptime T: type) type { return extern struct { AcquireSync: fn (*T, UINT64, DWORD) callconv(WINAPI) HRESULT, ReleaseSync: fn (*T, UINT64) callconv(WINAPI) HRESULT, }; } }; pub const MAP_READ: UINT = 0x1; pub const MAP_WRITE: UINT = 0x2; pub const MAP_DISCARD: UINT = 0x4; pub const ISurface = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), devsubobj: IDeviceSubObject.VTable(Self), surface: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IDeviceSubObject.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn GetDesc(self: *T, desc: *SURFACE_DESC) HRESULT { return self.v.surface.GetDesc(self, desc); } pub inline fn Map(self: *T, locked_rect: *MAPPED_RECT, flags: UINT) HRESULT { return self.v.surface.Map(self, locked_rect, flags); } pub inline fn Unmap(self: *T) HRESULT { return self.v.surface.Unmap(self); } }; } pub fn VTable(comptime T: type) type { return extern struct { GetDesc: fn (*T, *SURFACE_DESC) callconv(WINAPI) HRESULT, Map: fn (*T, *MAPPED_RECT, UINT) callconv(WINAPI) HRESULT, Unmap: fn (*T) callconv(WINAPI) HRESULT, }; } }; pub const IAdapter = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), adapter: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn EnumOutputs(self: *T, index: UINT, output: *?*IOutput) HRESULT { return self.v.adapter.EnumOutputs(self, index, output); } pub inline fn GetDesc(self: *T, desc: *ADAPTER_DESC) HRESULT { return self.v.adapter.GetDesc(self, desc); } pub inline fn CheckInterfaceSupport(self: *T, guid: *const GUID, umd_ver: *LARGE_INTEGER) HRESULT { return self.v.adapter.CheckInterfaceSupport(self, guid, umd_ver); } }; } pub fn VTable(comptime T: type) type { return extern struct { EnumOutputs: fn (*T, UINT, *?*IOutput) callconv(WINAPI) HRESULT, GetDesc: fn (*T, *ADAPTER_DESC) callconv(WINAPI) HRESULT, CheckInterfaceSupport: fn (*T, *const GUID, *LARGE_INTEGER) callconv(WINAPI) HRESULT, }; } }; pub const ENUM_MODES_INTERLACED: UINT = 0x1; pub const ENUM_MODES_SCALING: UINT = 0x2; pub const ENUM_MODES_STEREO: UINT = 0x4; pub const ENUM_MODES_DISABLED_STEREO: UINT = 0x8; pub const IOutput = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), output: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn GetDesc(self: *T, desc: *OUTPUT_DESC) HRESULT { return self.v.output.GetDesc(self, desc); } pub inline fn GetDisplayModeList( self: *T, enum_format: FORMAT, flags: UINT, num_nodes: *UINT, desc: ?*MODE_DESC, ) HRESULT { return self.v.output.GetDisplayModeList(self, enum_format, flags, num_nodes, desc); } pub inline fn FindClosestMatchingMode( self: *T, mode_to_match: *const MODE_DESC, closest_match: *MODE_DESC, concerned_device: ?*IUnknown, ) HRESULT { return self.v.output.FindClosestMatchingMode(self, mode_to_match, closest_match, concerned_device); } pub inline fn WaitForVBlank(self: *T) HRESULT { return self.v.output.WaitForVBlank(self); } pub inline fn TakeOwnership(self: *T, device: *IUnknown, exclusive: BOOL) HRESULT { return self.v.output.TakeOwnership(self, device, exclusive); } pub inline fn ReleaseOwnership(self: *T) void { self.v.output.ReleaseOwnership(self); } pub inline fn GetGammaControlCapabilities(self: *T, gamma_caps: *GAMMA_CONTROL_CAPABILITIES) HRESULT { return self.v.output.GetGammaControlCapabilities(self, gamma_caps); } pub inline fn SetGammaControl(self: *T, array: *const GAMMA_CONTROL) HRESULT { return self.v.output.SetGammaControl(self, array); } pub inline fn GetGammaControl(self: *T, array: *GAMMA_CONTROL) HRESULT { return self.v.output.GetGammaControl(self, array); } pub inline fn SetDisplaySurface(self: *T, scanout_surface: *ISurface) HRESULT { return self.v.output.SetDisplaySurface(self, scanout_surface); } pub inline fn GetDisplaySurfaceData(self: *T, destination: *ISurface) HRESULT { return self.v.output.GetDisplaySurfaceData(self, destination); } pub inline fn GetFrameStatistics(self: *T, stats: *FRAME_STATISTICS) HRESULT { return self.v.output.GetFrameStatistics(self, stats); } }; } pub fn VTable(comptime T: type) type { return extern struct { GetDesc: fn (self: *T, desc: *OUTPUT_DESC) callconv(WINAPI) HRESULT, GetDisplayModeList: fn (*T, FORMAT, UINT, *UINT, ?*MODE_DESC) callconv(WINAPI) HRESULT, FindClosestMatchingMode: fn (*T, *const MODE_DESC, *MODE_DESC, ?*IUnknown) callconv(WINAPI) HRESULT, WaitForVBlank: fn (*T) callconv(WINAPI) HRESULT, TakeOwnership: fn (*T, *IUnknown, BOOL) callconv(WINAPI) HRESULT, ReleaseOwnership: fn (*T) callconv(WINAPI) void, GetGammaControlCapabilities: fn (*T, *GAMMA_CONTROL_CAPABILITIES) callconv(WINAPI) HRESULT, SetGammaControl: fn (*T, *const GAMMA_CONTROL) callconv(WINAPI) HRESULT, GetGammaControl: fn (*T, *GAMMA_CONTROL) callconv(WINAPI) HRESULT, SetDisplaySurface: fn (*T, *ISurface) callconv(WINAPI) HRESULT, GetDisplaySurfaceData: fn (*T, *ISurface) callconv(WINAPI) HRESULT, GetFrameStatistics: fn (*T, *FRAME_STATISTICS) callconv(WINAPI) HRESULT, }; } }; pub const MAX_SWAP_CHAIN_BUFFERS = 16; pub const PRESENT_TEST: UINT = 0x00000001; pub const PRESENT_DO_NOT_SEQUENCE: UINT = 0x00000002; pub const PRESENT_RESTART: UINT = 0x00000004; pub const PRESENT_DO_NOT_WAIT: UINT = 0x00000008; pub const PRESENT_STEREO_PREFER_RIGHT: UINT = 0x00000010; pub const PRESENT_STEREO_TEMPORARY_MONO: UINT = 0x00000020; pub const PRESENT_RESTRICT_TO_OUTPUT: UINT = 0x00000040; pub const PRESENT_USE_DURATION: UINT = 0x00000100; pub const PRESENT_ALLOW_TEARING: UINT = 0x00000200; pub const ISwapChain = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), devsubobj: IDeviceSubObject.VTable(Self), swapchain: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IDeviceSubObject.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn Present(self: *T, sync_interval: UINT, flags: UINT) HRESULT { return self.v.swapchain.Present(self, sync_interval, flags); } pub inline fn GetBuffer(self: *T, index: u32, guid: *const GUID, surface: *?*anyopaque) HRESULT { return self.v.swapchain.GetBuffer(self, index, guid, surface); } pub inline fn SetFullscreenState(self: *T, target: ?*IOutput) HRESULT { return self.v.swapchain.SetFullscreenState(self, target); } pub inline fn GetFullscreenState(self: *T, fullscreen: ?*BOOL, target: ?*?*IOutput) HRESULT { return self.v.swapchain.GetFullscreenState(self, fullscreen, target); } pub inline fn GetDesc(self: *T, desc: *SWAP_CHAIN_DESC) HRESULT { return self.v.swapchain.GetDesc(self, desc); } pub inline fn ResizeBuffers( self: *T, count: UINT, width: UINT, height: UINT, format: FORMAT, flags: SWAP_CHAIN_FLAG, ) HRESULT { return self.v.swapchain.ResizeBuffers(self, count, width, height, format, flags); } pub inline fn ResizeTarget(self: *T, params: *const MODE_DESC) HRESULT { return self.v.swapchain.ResizeTarget(self, params); } pub inline fn GetContainingOutput(self: *T, output: *?*IOutput) HRESULT { return self.v.swapchain.GetContainingOutput(self, output); } pub inline fn GetFrameStatistics(self: *T, stats: *FRAME_STATISTICS) HRESULT { return self.v.swapchain.GetFrameStatistics(self, stats); } pub inline fn GetLastPresentCount(self: *T, count: *UINT) HRESULT { return self.v.swapchain.GetLastPresentCount(self, count); } }; } pub fn VTable(comptime T: type) type { return extern struct { Present: fn (*T, UINT, UINT) callconv(WINAPI) HRESULT, GetBuffer: fn (*T, u32, *const GUID, *?*anyopaque) callconv(WINAPI) HRESULT, SetFullscreenState: fn (*T, ?*IOutput) callconv(WINAPI) HRESULT, GetFullscreenState: fn (*T, ?*BOOL, ?*?*IOutput) callconv(WINAPI) HRESULT, GetDesc: fn (*T, *SWAP_CHAIN_DESC) callconv(WINAPI) HRESULT, ResizeBuffers: fn (*T, UINT, UINT, UINT, FORMAT, SWAP_CHAIN_FLAG) callconv(WINAPI) HRESULT, ResizeTarget: fn (*T, *const MODE_DESC) callconv(WINAPI) HRESULT, GetContainingOutput: fn (*T, *?*IOutput) callconv(WINAPI) HRESULT, GetFrameStatistics: fn (*T, *FRAME_STATISTICS) callconv(WINAPI) HRESULT, GetLastPresentCount: fn (*T, *UINT) callconv(WINAPI) HRESULT, }; } }; pub const IFactory = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), factory: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn EnumAdapters(self: *T, index: UINT, adapter: *?*IAdapter) HRESULT { return self.v.factory.EnumAdapters(self, index, adapter); } pub inline fn MakeWindowAssociation(self: *T, window: HWND, flags: UINT) HRESULT { return self.v.factory.MakeWindowAssociation(self, window, flags); } pub inline fn GetWindowAssociation(self: *T, window: *HWND) HRESULT { return self.v.factory.GetWindowAssociation(self, window); } pub inline fn CreateSwapChain( self: *T, device: *IUnknown, desc: *SWAP_CHAIN_DESC, swapchain: *?*ISwapChain, ) HRESULT { return self.v.factory.CreateSwapChain(self, device, desc, swapchain); } pub inline fn CreateSoftwareAdapter(self: *T, adapter: *?*IAdapter) HRESULT { return self.v.factory.CreateSoftwareAdapter(self, adapter); } }; } pub fn VTable(comptime T: type) type { return extern struct { EnumAdapters: fn (*T, UINT, *?*IAdapter) callconv(WINAPI) HRESULT, MakeWindowAssociation: fn (*T, HWND, UINT) callconv(WINAPI) HRESULT, GetWindowAssociation: fn (*T, *HWND) callconv(WINAPI) HRESULT, CreateSwapChain: fn (*T, *IUnknown, *SWAP_CHAIN_DESC, *?*ISwapChain) callconv(WINAPI) HRESULT, CreateSoftwareAdapter: fn (*T, *?*IAdapter) callconv(WINAPI) HRESULT, }; } }; pub const IDevice = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), device: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn GetAdapter(self: *T, adapter: *?*IAdapter) HRESULT { return self.v.device.GetAdapter(self, adapter); } pub inline fn CreateSurface( self: *T, desc: *const SURFACE_DESC, num_surfaces: UINT, usage: USAGE, shared_resource: ?*const SHARED_RESOURCE, surface: *?*ISurface, ) HRESULT { return self.v.device.CreateSurface(self, desc, num_surfaces, usage, shared_resource, surface); } pub inline fn QueryResourceResidency( self: *T, resources: *const *IUnknown, status: [*]RESIDENCY, num_resources: UINT, ) HRESULT { return self.v.device.QueryResourceResidency(self, resources, status, num_resources); } pub inline fn SetGPUThreadPriority(self: *T, priority: INT) HRESULT { return self.v.device.SetGPUThreadPriority(self, priority); } pub inline fn GetGPUThreadPriority(self: *T, priority: *INT) HRESULT { return self.v.device.GetGPUThreadPriority(self, priority); } }; } pub fn VTable(comptime T: type) type { return extern struct { GetAdapter: fn (self: *T, adapter: *?*IAdapter) callconv(WINAPI) HRESULT, CreateSurface: fn ( *T, *const SURFACE_DESC, UINT, USAGE, ?*const SHARED_RESOURCE, *?*ISurface, ) callconv(WINAPI) HRESULT, QueryResourceResidency: fn ( *T, *const *IUnknown, [*]RESIDENCY, UINT, ) callconv(WINAPI) HRESULT, SetGPUThreadPriority: fn (self: *T, priority: INT) callconv(WINAPI) HRESULT, GetGPUThreadPriority: fn (self: *T, priority: *INT) callconv(WINAPI) HRESULT, }; } }; pub const ADAPTER_FLAGS = UINT; pub const ADAPTER_FLAG_NONE: ADAPTER_FLAGS = 0; pub const ADAPTER_FLAG_REMOTE: ADAPTER_FLAGS = 0x1; pub const ADAPTER_FLAG_SOFTWARE: ADAPTER_FLAGS = 0x2; pub const ADAPTER_DESC1 = extern struct { Description: [128]WCHAR, VendorId: UINT, DeviceId: UINT, SubSysId: UINT, Revision: UINT, DedicatedVideoMemory: SIZE_T, DedicatedSystemMemory: SIZE_T, SharedSystemMemory: SIZE_T, AdapterLuid: LUID, Flags: ADAPTER_FLAGS, }; pub const IFactory1 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), factory: IFactory.VTable(Self), factory1: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IFactory.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn EnumAdapters1(self: *T, index: UINT, adapter: *?*IAdapter1) HRESULT { return self.v.factory1.EnumAdapters1(self, index, adapter); } pub inline fn IsCurrent(self: *T) BOOL { return self.v.factory1.IsCurrent(self); } }; } pub fn VTable(comptime T: type) type { return extern struct { EnumAdapters1: fn (*T, UINT, *?*IAdapter1) callconv(WINAPI) HRESULT, IsCurrent: fn (*T) callconv(WINAPI) BOOL, }; } }; pub const IFactory2 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), factory: IFactory.VTable(Self), factory1: IFactory1.VTable(Self), factory2: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IFactory.Methods(Self); usingnamespace IFactory1.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { _ = T; return extern struct {}; } pub fn VTable(comptime T: type) type { _ = T; return extern struct { IsWindowedStereoEnabled: *anyopaque, CreateSwapChainForHwnd: *anyopaque, CreateSwapChainForCoreWindow: *anyopaque, GetSharedResourceAdapterLuid: *anyopaque, RegisterStereoStatusWindow: *anyopaque, RegisterStereoStatusEvent: *anyopaque, UnregisterStereoStatus: *anyopaque, RegisterOcclusionStatusWindow: *anyopaque, RegisterOcclusionStatusEvent: *anyopaque, UnregisterOcclusionStatus: *anyopaque, CreateSwapChainForComposition: *anyopaque, }; } }; pub const IFactory3 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), factory: IFactory.VTable(Self), factory1: IFactory1.VTable(Self), factory2: IFactory2.VTable(Self), factory3: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IFactory.Methods(Self); usingnamespace IFactory1.Methods(Self); usingnamespace IFactory2.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { _ = T; return extern struct {}; } pub fn VTable(comptime T: type) type { _ = T; return extern struct { GetCreationFlags: *anyopaque, }; } }; pub const IFactory4 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), factory: IFactory.VTable(Self), factory1: IFactory1.VTable(Self), factory2: IFactory2.VTable(Self), factory3: IFactory3.VTable(Self), factory4: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IFactory.Methods(Self); usingnamespace IFactory1.Methods(Self); usingnamespace IFactory2.Methods(Self); usingnamespace IFactory3.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { _ = T; return extern struct {}; } pub fn VTable(comptime T: type) type { _ = T; return extern struct { EnumAdapterByLuid: *anyopaque, EnumWarpAdapter: *anyopaque, }; } }; pub const FEATURE = enum(UINT) { PRESENT_ALLOW_TEARING = 0, }; pub const IID_IFactory5 = GUID.parse("{7632e1f5-ee65-4dca-87fd-84cd75f8838d}"); pub const IFactory5 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), factory: IFactory.VTable(Self), factory1: IFactory1.VTable(Self), factory2: IFactory2.VTable(Self), factory3: IFactory3.VTable(Self), factory4: IFactory4.VTable(Self), factory5: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IFactory.Methods(Self); usingnamespace IFactory1.Methods(Self); usingnamespace IFactory2.Methods(Self); usingnamespace IFactory3.Methods(Self); usingnamespace IFactory4.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn CheckFeatureSupport( self: *T, feature: FEATURE, support_data: *anyopaque, support_data_size: UINT, ) HRESULT { return self.v.factory5.CheckFeatureSupport(self, feature, support_data, support_data_size); } }; } pub fn VTable(comptime T: type) type { return extern struct { CheckFeatureSupport: fn (*T, FEATURE, *anyopaque, UINT) callconv(WINAPI) HRESULT, }; } }; pub const GPU_PREFERENCE = UINT; pub const GPU_PREFERENCE_UNSPECIFIED: GPU_PREFERENCE = 0; pub const GPU_PREFERENCE_MINIMUM: GPU_PREFERENCE = 1; pub const GPU_PREFERENCE_HIGH_PERFORMANCE: GPU_PREFERENCE = 2; pub const IID_IFactory6 = GUID.parse("{c1b6694f-ff09-44a9-b03c-77900a0a1d17}"); pub const IFactory6 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), factory: IFactory.VTable(Self), factory1: IFactory1.VTable(Self), factory2: IFactory2.VTable(Self), factory3: IFactory3.VTable(Self), factory4: IFactory4.VTable(Self), factory5: IFactory5.VTable(Self), factory6: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IFactory.Methods(Self); usingnamespace IFactory1.Methods(Self); usingnamespace IFactory2.Methods(Self); usingnamespace IFactory3.Methods(Self); usingnamespace IFactory4.Methods(Self); usingnamespace IFactory5.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn EnumAdapterByGpuPreference( self: *T, adapter_index: UINT, gpu_preference: GPU_PREFERENCE, riid: *const GUID, adapter: *?*IAdapter1, ) HRESULT { return self.v.factory6.EnumAdapterByGpuPreference(self, adapter_index, gpu_preference, riid, adapter); } }; } pub fn VTable(comptime T: type) type { return extern struct { EnumAdapterByGpuPreference: fn (*T, UINT, GPU_PREFERENCE, *const GUID, *?*IAdapter1) callconv(WINAPI) HRESULT, }; } }; pub const IID_IAdapter1 = GUID.parse("{29038f61-3839-4626-91fd-086879011a05}"); pub const IAdapter1 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), adapter: IAdapter.VTable(Self), adapter1: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IAdapter.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn GetDesc1(self: *T, desc: *ADAPTER_DESC1) HRESULT { return self.v.adapter1.GetDesc1(self, desc); } }; } pub fn VTable(comptime T: type) type { return extern struct { GetDesc1: fn (*T, *ADAPTER_DESC1) callconv(WINAPI) HRESULT, }; } }; pub const IDevice1 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), device: IDevice.VTable(Self), device1: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IDevice.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn SetMaximumFrameLatency(self: *T, max_latency: UINT) HRESULT { return self.v.device1.SetMaximumFrameLatency(self, max_latency); } pub inline fn GetMaximumFrameLatency(self: *T, max_latency: *UINT) HRESULT { return self.v.device1.GetMaximumFrameLatency(self, max_latency); } }; } pub fn VTable(comptime T: type) type { return extern struct { SetMaximumFrameLatency: fn (self: *T, max_latency: UINT) callconv(WINAPI) HRESULT, GetMaximumFrameLatency: fn (self: *T, max_latency: *UINT) callconv(WINAPI) HRESULT, }; } }; pub const IID_IFactory1 = GUID{ .Data1 = 0x770aae78, .Data2 = 0xf26f, .Data3 = 0x4dba, .Data4 = .{ 0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87 }, }; pub const IID_IDevice = GUID{ .Data1 = 0x54ec77fa, .Data2 = 0x1377, .Data3 = 0x44e6, .Data4 = .{ 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c }, }; pub const IID_ISurface = GUID{ .Data1 = 0xcafcb56c, .Data2 = 0x6ac3, .Data3 = 0x4889, .Data4 = .{ 0xbf, 0x47, 0x9e, 0x23, 0xbb, 0xd2, 0x60, 0xec }, }; pub const CREATE_FACTORY_DEBUG: UINT = 0x1; pub extern "dxgi" fn CreateDXGIFactory2(UINT, *const GUID, *?*anyopaque) callconv(WINAPI) HRESULT; pub const SCALING = enum(UINT) { STRETCH = 0, NONE = 1, ASPECT_RATIO_STRETCH = 2, }; pub const ALPHA_MODE = enum(UINT) { UNSPECIFIED = 0, PREMULTIPLIED = 1, STRAIGHT = 2, IGNORE = 3, }; pub const SWAP_CHAIN_DESC1 = extern struct { Width: UINT, Height: UINT, Format: FORMAT, Stereo: BOOL, SampleDesc: SAMPLE_DESC, BufferUsage: USAGE, BufferCount: UINT, Scaling: SCALING, SwapEffect: SWAP_EFFECT, AlphaMode: ALPHA_MODE, Flags: SWAP_CHAIN_FLAG, }; pub const SWAP_CHAIN_FULLSCREEN_DESC = extern struct { RefreshRate: RATIONAL, ScanlineOrdering: MODE_SCANLINE_ORDER, Scaling: MODE_SCALING, Windowed: BOOL, }; pub const PRESENT_PARAMETERS = extern struct { DirtyRectsCount: UINT, pDirtyRects: ?*RECT, pScrollRect: *RECT, pScrollOffset: *POINT, }; pub const ISwapChain1 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), devsubobj: IDeviceSubObject.VTable(Self), swapchain: ISwapChain.VTable(Self), swapchain1: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IDeviceSubObject.Methods(Self); usingnamespace ISwapChain.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn GetDesc1(self: *T, desc: *SWAP_CHAIN_DESC1) HRESULT { return self.v.swapchain1.GetDesc1(self, desc); } pub inline fn GetFullscreenDesc(self: *T, desc: *SWAP_CHAIN_FULLSCREEN_DESC) HRESULT { return self.v.swapchain1.GetFullscreenDesc(self, desc); } pub inline fn GetHwnd(self: *T, hwnd: *HWND) HRESULT { return self.v.swapchain1.GetHwnd(self, hwnd); } pub inline fn GetCoreWindow(self: *T, guid: *const GUID, unknown: *?*anyopaque) HRESULT { return self.v.swapchain1.GetCoreWindow(self, guid, unknown); } pub inline fn Present1( self: *T, sync_interval: UINT, flags: UINT, params: *const PRESENT_PARAMETERS, ) HRESULT { return self.v.swapchain1.Present1(self, sync_interval, flags, params); } pub inline fn IsTemporaryMonoSupported(self: *T) BOOL { return self.v.swapchain1.IsTemporaryMonoSupported(self); } pub inline fn GetRestrictToOutput(self: *T, output: *?*IOutput) HRESULT { return self.v.swapchain1.GetRestrictToOutput(self, output); } pub inline fn SetBackgroundColor(self: *T, color: *const RGBA) HRESULT { return self.v.swapchain1.SetBackgroundColor(self, color); } pub inline fn GetBackgroundColor(self: *T, color: *RGBA) HRESULT { return self.v.swapchain1.GetBackgroundColor(self, color); } pub inline fn SetRotation(self: *T, rotation: MODE_ROTATION) HRESULT { return self.v.swapchain1.SetRotation(self, rotation); } pub inline fn GetRotation(self: *T, rotation: *MODE_ROTATION) HRESULT { return self.v.swapchain1.GetRotation(self, rotation); } }; } pub fn VTable(comptime T: type) type { return extern struct { GetDesc1: fn (*T, *SWAP_CHAIN_DESC1) callconv(WINAPI) HRESULT, GetFullscreenDesc: fn (*T, *SWAP_CHAIN_FULLSCREEN_DESC) callconv(WINAPI) HRESULT, GetHwnd: fn (*T, *HWND) callconv(WINAPI) HRESULT, GetCoreWindow: fn (*T, *const GUID, *?*anyopaque) callconv(WINAPI) HRESULT, Present1: fn (*T, UINT, UINT, *const PRESENT_PARAMETERS) callconv(WINAPI) HRESULT, IsTemporaryMonoSupported: fn (*T) callconv(WINAPI) BOOL, GetRestrictToOutput: fn (*T, *?*IOutput) callconv(WINAPI) HRESULT, SetBackgroundColor: fn (*T, *const RGBA) callconv(WINAPI) HRESULT, GetBackgroundColor: fn (*T, *RGBA) callconv(WINAPI) HRESULT, SetRotation: fn (*T, MODE_ROTATION) callconv(WINAPI) HRESULT, GetRotation: fn (*T, *MODE_ROTATION) callconv(WINAPI) HRESULT, }; } }; pub const IID_ISwapChain1 = GUID{ .Data1 = 0x790a45f7, .Data2 = 0x0d41, .Data3 = 0x4876, .Data4 = .{ 0x98, 0x3a, 0x0a, 0x55, 0xcf, 0xe6, 0xf4, 0xaa }, }; pub const MATRIX_3X2_F = extern struct { _11: FLOAT, _12: FLOAT, _21: FLOAT, _22: FLOAT, _31: FLOAT, _32: FLOAT, }; pub const ISwapChain2 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), devsubobj: IDeviceSubObject.VTable(Self), swapchain: ISwapChain.VTable(Self), swapchain1: ISwapChain1.VTable(Self), swapchain2: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IDeviceSubObject.Methods(Self); usingnamespace ISwapChain.Methods(Self); usingnamespace ISwapChain1.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn SetSourceSize(self: *T, width: UINT, height: UINT) HRESULT { return self.v.swapchain2.SetSourceSize(self, width, height); } pub inline fn GetSourceSize(self: *T, width: *UINT, height: *UINT) HRESULT { return self.v.swapchain2.GetSourceSize(self, width, height); } pub inline fn SetMaximumFrameLatency(self: *T, max_latency: UINT) HRESULT { return self.v.swapchain2.SetMaximumFrameLatency(self, max_latency); } pub inline fn GetMaximumFrameLatency(self: *T, max_latency: *UINT) HRESULT { return self.v.swapchain2.GetMaximumFrameLatency(self, max_latency); } pub inline fn GetFrameLatencyWaitableObject(self: *T) HANDLE { return self.v.swapchain2.GetFrameLatencyWaitableObject(self); } pub inline fn SetMatrixTransform(self: *T, matrix: *const MATRIX_3X2_F) HRESULT { return self.v.swapchain2.SetMatrixTransform(self, matrix); } pub inline fn GetMatrixTransform(self: *T, matrix: *MATRIX_3X2_F) HRESULT { return self.v.swapchain2.GetMatrixTransform(self, matrix); } }; } pub fn VTable(comptime T: type) type { return extern struct { SetSourceSize: fn (*T, UINT, UINT) callconv(WINAPI) HRESULT, GetSourceSize: fn (*T, *UINT, *UINT) callconv(WINAPI) HRESULT, SetMaximumFrameLatency: fn (*T, UINT) callconv(WINAPI) HRESULT, GetMaximumFrameLatency: fn (*T, *UINT) callconv(WINAPI) HRESULT, GetFrameLatencyWaitableObject: fn (*T) callconv(WINAPI) HANDLE, SetMatrixTransform: fn (*T, *const MATRIX_3X2_F) callconv(WINAPI) HRESULT, GetMatrixTransform: fn (*T, *MATRIX_3X2_F) callconv(WINAPI) HRESULT, }; } }; pub const IID_ISwapChain2 = GUID{ .Data1 = 0xa8be2ac4, .Data2 = 0x199f, .Data3 = 0x4946, .Data4 = .{ 0xb3, 0x31, 0x79, 0x59, 0x9f, 0xb9, 0x8d, 0xe7 }, }; pub const ISwapChain3 = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), object: IObject.VTable(Self), devsubobj: IDeviceSubObject.VTable(Self), swapchain: ISwapChain.VTable(Self), swapchain1: ISwapChain1.VTable(Self), swapchain2: ISwapChain2.VTable(Self), swapchain3: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace IObject.Methods(Self); usingnamespace IDeviceSubObject.Methods(Self); usingnamespace ISwapChain.Methods(Self); usingnamespace ISwapChain1.Methods(Self); usingnamespace ISwapChain2.Methods(Self); usingnamespace Methods(Self); pub fn Methods(comptime T: type) type { return extern struct { pub inline fn GetCurrentBackBufferIndex(self: *T) UINT { return self.v.swapchain3.GetCurrentBackBufferIndex(self); } pub inline fn CheckColorSpaceSupport(self: *T, space: COLOR_SPACE_TYPE, support: *UINT) HRESULT { return self.v.swapchain3.CheckColorSpaceSupport(self, space, support); } pub inline fn SetColorSpace1(self: *T, space: COLOR_SPACE_TYPE) HRESULT { return self.v.swapchain3.SetColorSpace1(self, space); } pub inline fn ResizeBuffers1( self: *T, buffer_count: UINT, width: UINT, height: UINT, format: FORMAT, swap_chain_flags: UINT, creation_node_mask: [*]const UINT, present_queue: [*]const *IUnknown, ) HRESULT { return self.v.swapchain3.ResizeBuffers1( self, buffer_count, width, height, format, swap_chain_flags, creation_node_mask, present_queue, ); } }; } pub fn VTable(comptime T: type) type { return extern struct { GetCurrentBackBufferIndex: fn (*T) callconv(WINAPI) UINT, CheckColorSpaceSupport: fn (*T, COLOR_SPACE_TYPE, *UINT) callconv(WINAPI) HRESULT, SetColorSpace1: fn (*T, COLOR_SPACE_TYPE) callconv(WINAPI) HRESULT, ResizeBuffers1: fn ( *T, UINT, UINT, UINT, FORMAT, UINT, [*]const UINT, [*]const *IUnknown, ) callconv(WINAPI) HRESULT, }; } }; pub const IID_ISwapChain3 = GUID{ .Data1 = 0x94d99bdb, .Data2 = 0xf1f8, .Data3 = 0x4ab0, .Data4 = .{ 0xb2, 0x36, 0x7d, 0xa0, 0x17, 0x0e, 0xda, 0xb1 }, }; // Status return codes as defined here: https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-status pub const STATUS_OCCLUDED = @bitCast(HRESULT, @as(c_ulong, 0x087A0001)); pub const STATUS_MODE_CHANGED = @bitCast(HRESULT, @as(c_ulong, 0x087A0007)); pub const STATUS_MODE_CHANGE_IN_PROGRESS = @bitCast(HRESULT, @as(c_ulong, 0x087A0008)); // Return codes as defined here: https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-error pub const ERROR_ACCESS_DENIED = @bitCast(HRESULT, @as(c_ulong, 0x887A002B)); pub const ERROR_ACCESS_LOST = @bitCast(HRESULT, @as(c_ulong, 0x887A0026)); pub const ERROR_ALREADY_EXISTS = @bitCast(HRESULT, @as(c_ulong, 0x887A0036)); pub const ERROR_CANNOT_PROTECT_CONTENT = @bitCast(HRESULT, @as(c_ulong, 0x887A002A)); pub const ERROR_DEVICE_HUNG = @bitCast(HRESULT, @as(c_ulong, 0x887A0006)); pub const ERROR_DEVICE_REMOVED = @bitCast(HRESULT, @as(c_ulong, 0x887A0005)); pub const ERROR_DEVICE_RESET = @bitCast(HRESULT, @as(c_ulong, 0x887A0007)); pub const ERROR_DRIVER_INTERNAL_ERROR = @bitCast(HRESULT, @as(c_ulong, 0x887A0020)); pub const ERROR_FRAME_STATISTICS_DISJOINT = @bitCast(HRESULT, @as(c_ulong, 0x887A000B)); pub const ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE = @bitCast(HRESULT, @as(c_ulong, 0x887A000C)); pub const ERROR_INVALID_CALL = @bitCast(HRESULT, @as(c_ulong, 0x887A0001)); pub const ERROR_MORE_DATA = @bitCast(HRESULT, @as(c_ulong, 0x887A0003)); pub const ERROR_NAME_ALREADY_EXISTS = @bitCast(HRESULT, @as(c_ulong, 0x887A002C)); pub const ERROR_NONEXCLUSIVE = @bitCast(HRESULT, @as(c_ulong, 0x887A0021)); pub const ERROR_NOT_CURRENTLY_AVAILABLE = @bitCast(HRESULT, @as(c_ulong, 0x887A0022)); pub const ERROR_NOT_FOUND = @bitCast(HRESULT, @as(c_ulong, 0x887A0002)); pub const ERROR_REMOTE_CLIENT_DISCONNECTED = @bitCast(HRESULT, @as(c_ulong, 0x887A0023)); pub const ERROR_REMOTE_OUTOFMEMORY = @bitCast(HRESULT, @as(c_ulong, 0x887A0024)); pub const ERROR_RESTRICT_TO_OUTPUT_STALE = @bitCast(HRESULT, @as(c_ulong, 0x887A0029)); pub const ERROR_SDK_COMPONENT_MISSING = @bitCast(HRESULT, @as(c_ulong, 0x887A002D)); pub const ERROR_SESSION_DISCONNECTED = @bitCast(HRESULT, @as(c_ulong, 0x887A0028)); pub const ERROR_UNSUPPORTED = @bitCast(HRESULT, @as(c_ulong, 0x887A0004)); pub const ERROR_WAIT_TIMEOUT = @bitCast(HRESULT, @as(c_ulong, 0x887A0027)); pub const ERROR_WAS_STILL_DRAWING = @bitCast(HRESULT, @as(c_ulong, 0x887A000A)); // Error set corresponding to the above error return codes pub const Error = error{ ACCESS_DENIED, ACCESS_LOST, ALREADY_EXISTS, CANNOT_PROTECT_CONTENT, DEVICE_HUNG, DEVICE_REMOVED, DEVICE_RESET, DRIVER_INTERNAL_ERROR, FRAME_STATISTICS_DISJOINT, GRAPHICS_VIDPN_SOURCE_IN_USE, INVALID_CALL, MORE_DATA, NAME_ALREADY_EXISTS, NONEXCLUSIVE, NOT_CURRENTLY_AVAILABLE, NOT_FOUND, REMOTE_CLIENT_DISCONNECTED, REMOTE_OUTOFMEMORY, RESTRICT_TO_OUTPUT_STALE, SDK_COMPONENT_MISSING, SESSION_DISCONNECTED, UNSUPPORTED, WAIT_TIMEOUT, WAS_STILL_DRAWING, };
modules/platform/vendored/zwin32/src/dxgi.zig
const std = @import("std"); const IguanaTLS = @import("iguanaTLS"); const Definitions = @import("./definitions.zig"); const Helpers = @import("./helpers.zig"); pub const Result = @import("./result.zig"); const Allocator = std.mem.Allocator; const Address = std.net.Address; const ArrayList = std.ArrayList; const Stream = std.net.Stream; const print = std.debug.print; const x509 = IguanaTLS.x509; const File = std.fs; const Errors = Definitions.Errors; const Types = Definitions.Types; const NULL_BYTE = &[_]u8{0}; const Certs = struct { ca: []const u8, client: []const u8, }; pub const ConnectParams = struct { user: []const u8 = "root", password: []const u8 = "<PASSWORD>", database: []const u8 = "root", host: []const u8, port: u16, tls: ?Certs = null }; allocator: *Allocator, queryReady: bool, socket: Stream, const Self = @This(); pub fn connect(comptime params: ConnectParams, allocator: *Allocator) !Self { var socket = try std.net.tcpConnectToHost(allocator, params.host, params.port); var connection = Self{ .allocator = allocator, .queryReady = false, .socket = socket }; if (params.tls) |tls| { // const ca = try File.openFileAbsolute(tls.ca, .{}); // const client = try File.openFileAbsolute(tls.client, .{}); // const TLSStream = IguanaTLS.Client(std.net.Stream.Reader, std.net.Stream.Writer, IguanaTLS.ciphersuites.all, true); // var randBuf: [32]u8 = undefined; // try std.os.getrandom(&randBuf); // var rng = std.rand.DefaultCsprng.init(randBuf); // var rand = blk: { // var seed: [std.rand.DefaultCsprng.secret_seed_length]u8 = undefined; // try std.os.getrandom(&seed); // break :blk &std.rand.DefaultCsprng.init(seed).random; // }; // var ca_chain = try x509.CertificateChain.from_pem(allocator, ca.reader()); // defer ca_chain.deinit(); // var client_chain = try x509.ClientCertificateChain.from_pem(allocator, client.reader()); // defer client_chain.deinit(allocator); // var tls_connection = IguanaTLS.client_connect(.{ // .rand = rand, // .reader = socket.reader(), // .writer = socket.writer(), // .cert_verifier = .default, // .temp_allocator = std.testing.allocator, // .trusted_certificates = ca_chain.data.items, // .client_certificates = &[1]x509.ClientCertificateChain{client_chain}, // }, params.host); } else {} var buffer = ArrayList(u8).init(allocator); defer buffer.deinit(); // Write protocol version _ = try buffer.writer().writeIntBig(u32, std.meta.cast(u32, 196608)); // Write connection parameters _ = try buffer.writer().write("user" ++ NULL_BYTE ++ params.user ++ NULL_BYTE); _ = try buffer.writer().write("password" ++ NULL_BYTE ++ params.password ++ NULL_BYTE); _ = try buffer.writer().write("database" ++ NULL_BYTE ++ params.database ++ NULL_BYTE); _ = try buffer.writer().write(&[_]u8{ 0x0, 0x0 }); var payload = ArrayList(u8).init(allocator); defer payload.deinit(); // Write message length + full message _ = try payload.writer().writeIntBig(u32, std.meta.cast(u32, buffer.items.len + 4)); _ = try payload.writer().writeAll(buffer.items); _ = try connection.send(payload.items); return connection; } pub fn send(self: *Self, message: []const u8) !Result { var result = Result.new(self.allocator); // Write message to DB _ = try self.socket.writer().writeAll(message); // Read response from DB var response = ArrayList(u8).init(self.allocator); defer response.deinit(); const buffer_end = &[_]u8{ 0, 5, 73 }; while (true) { var buffer: [1024]u8 = undefined; var len: usize = try self.socket.read(&buffer); _ = try response.writer().write(buffer[0..len]); // When the 3 buffer-end bytes are read, break reading process if (std.mem.eql(u8, buffer[len - 3 .. len], buffer_end)) break; } try self.parseResponse(response.items, &result); if (result.rowCount < 1) result.deinit(); return result; } pub fn exec(self: *Self, query: []const u8) !Result { if (!self.queryReady) return Errors.DatabaseNotReady; const length = 4 + query.len + 1; var buffer = try ArrayList(u8).initCapacity(self.allocator, length + 1); defer buffer.deinit(); _ = try buffer.writer().write("Q"); _ = try buffer.writer().writeIntBig(u32, std.meta.cast(u32, length)); _ = try buffer.writer().writeAll(query); _ = try buffer.writer().write(NULL_BYTE); return try self.send(buffer.items); } pub fn parseResponse(self: *Self, message: []const u8, result: *Result) !void { // Start from first byte var bytes_parsed: usize = 0; // The loop parses message bytes and moves constantly forward until all bytes are parsed. while (bytes_parsed < message.len) { // First byte is message type const message_type = message[bytes_parsed]; bytes_parsed += 1; // Next 4 bytes is message size const message_size = std.mem.readInt(u32, message[bytes_parsed .. bytes_parsed + 4][0..4], .Big); bytes_parsed += 4; switch (message_type) { 'p' => {}, 'X' => {}, 'R' => { const password_type = message[bytes_parsed]; switch (password_type) { 0 => { print("Authentication ok \n", .{}); }, 5 => { //MD5 Hashing required }, else => {}, } }, 'D' => { result.rowCount += 1; var temp_offset = bytes_parsed; // Read 2 bytes of columns in row const row_columns = std.mem.readInt(u16, message[temp_offset .. temp_offset + 2][0..2], .Big); temp_offset += 2; // For each column read it's value var column_counter: usize = 0; while (column_counter < row_columns) : (column_counter += 1) { // Read column value size const value_len = std.mem.readInt(u32, message[temp_offset .. temp_offset + 4][0..4], .Big); temp_offset += 4; const row_value = message[temp_offset .. temp_offset + value_len]; // Write value data to result try result.rows.append(.{ .len = value_len, .offset = std.meta.cast(u32, result.bytes.items.len) }); _ = try result.bytes.writer().writeAll(row_value); temp_offset += value_len; } }, 'T' => { // Make copy of main bytes_parsed, because T and D message data comes in single buffer var temp_offset = bytes_parsed; const total_columns = std.mem.readInt(u16, message[temp_offset .. temp_offset + 2][0..2], .Big); temp_offset += 2; result.columnCount = total_columns; var column_counter: usize = 0; while (column_counter < total_columns) : (column_counter += 1) { // Find the index of the first null byte const NULL_BYTE_index: ?usize = Helpers.findNullByte(message[temp_offset - 1 .. message_size]); if (NULL_BYTE_index) |index| { // Column name size is 2 bytes back from null byte const name = message[temp_offset .. temp_offset + index - 2]; const name_len = (temp_offset + index - 2) - temp_offset; _ = try result.bytes.writer().writeAll(name); temp_offset += index; // After column size there comes column index const column_index = message[temp_offset]; temp_offset += 1; // After column index read 4 next bytes, thats the column type const column_type = std.mem.readInt(u32, message[temp_offset .. temp_offset + 4][0..4], .Big); temp_offset += 4; // Save column info to result try result.columns.append(.{ .offset = std.meta.cast(u32, result.bytes.items.len - name_len), .len = std.meta.cast(u32, name_len), .type = @intToEnum(Types, column_type) }); // Skip not used attributes temp_offset += 8; } } }, 'Q' => {}, 'C' => { // print("Query result {s} \n", .{message[0..message_size]}); }, 'Z' => { self.queryReady = true; // Database is ready for next query }, 'E' => { print("Connection error {s} \n", .{message}); }, 'S' => {}, else => {}, } // Add message size to bytes_parsed, because we are done parsing the message // - 4 is because because size bytes are already inside message_size bytes_parsed += message_size - 4; } } pub fn deinit(self: *Self) void { // Write X + buffer size (5) const end_buffer: [5]u8 = .{ 88, 0, 0, 0, 5 }; _ = self.socket.write(end_buffer[0..5]) catch unreachable; self.socket.close(); }
src/driver.zig
const std = @import("std"); const logger = std.log.scoped(.website); const Date = @import("zig-date/src/main.zig").Date; pub const log_level = if (std.builtin.mode == .Debug) std.log.Level.debug else std.log.Level.info; /// Global variables aren't too hard to keep track of when you only have one file. var include_private = false; var env_map: std.BufMap = undefined; var silent = false; pub fn log( comptime message_level: std.log.Level, comptime scope: @Type(.EnumLiteral), comptime format: []const u8, args: anytype, ) void { const held = std.debug.getStderrMutex().acquire(); defer held.release(); const stderr = std.io.getStdErr().writer(); comptime const color: []const u8 = switch (message_level) { .emerg, .alert, .crit, .err => "\x1B[1;91m", // red .warn => "\x1B[1;93m", // yellow .debug => "\x1B[36m", // blue .info => "\x1B[37m", // gray else => "", }; comptime const reset = if (color.len > 0) "\x1B[0m" else ""; nosuspend stderr.print(color ++ format ++ "\n" ++ reset, args) catch return; } pub fn main() u8 { mainWrapped() catch |err| { if (std.builtin.mode == .Debug) { std.debug.warn("{}{s}\n", .{ @errorReturnTrace(), @errorName(err) }); } else return @intCast(u8, @errorToInt(err)) + 1; }; return 0; } /// Entry point for the application fn mainWrapped() anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer if (gpa.deinit()) logger.debug("Detected memory leak.", .{}); env_map = try std.process.getEnvMap(&gpa.allocator); defer env_map.deinit(); var args = try getArgs(&gpa.allocator); defer gpa.allocator.free(args); defer for (args) |arg| gpa.allocator.free(arg); const exe_name = args[0]; comptime const usage = \\usage: \\ {s} <command> [<args>] \\ ; comptime const help = usage ++ \\ \\commands: \\ make The main generation tool \\ index Outputs site indexes in various formats \\ docs Print the sitegen documentation in sitegen format \\ html_template Print the default html template \\ gmi_template Print the default gmi template ; const stdout = std.io.getStdOut().writer(); if (args.len <= 1) { try stdout.print(help, .{exe_name}); return; } if (std.mem.eql(u8, args[1], "make")) { try make(exe_name, args[2..], &gpa.allocator); } else if (std.mem.eql(u8, args[1], "index")) { try buildIndex(exe_name, args[2..], &gpa.allocator); } else if (std.mem.endsWith(u8, args[1], "help")) { try stdout.print(help, .{exe_name}); } else if (std.mem.eql(u8, args[1], "docs")) { try stdout.writeAll(@embedFile("docs.txt")); } else if (std.mem.eql(u8, args[1], "html_template")) { try stdout.writeAll(@embedFile("default_template.html")); } else if (std.mem.eql(u8, args[1], "gmi_template")) { try stdout.writeAll(@embedFile("default_template.gmi")); } else { logger.alert("Unknown command {s}", .{args[1]}); try stdout.print(help, .{exe_name}); } } // ---- MAKE ---- /// Generate the site for all targets fn make( exe_name: []const u8, args: []const []const u8, allocator: *std.mem.Allocator, ) !void { var cwd = std.fs.cwd(); var index: usize = 0; const usage = \\usage: \\ {0s} make [<options>] [--] <out_dir> [<site_dir>] \\ {0s} make [--help] \\ ; const help = usage ++ \\ \\arguments: \\ out_dir the output folder for all generated content \\ site_dir the input folder for the site itself, defaults to cwd \\options: \\ --help show this text \\ -p, --private include private content in the build \\ --html <template> render html output with the template \\ --gmi <template> render gmi output with the given template \\ -s, --silent don't output filenames as they are rendered \\ -P, --path appended to the PATH when running shell commands ; if (args.len == 0) { try std.io.getStdOut().writer().print(usage, .{exe_name}); return; } var arena = std.heap.ArenaAllocator.init(allocator); defer arena.deinit(); var gmi_template_file: ?[]const u8 = null; var html_template_file: ?[]const u8 = null; while (index < args.len) : (index += 1) { if (getOpt(args[index], "private", 'p')) { include_private = true; try env_map.set("INCLUDE_PRIVATE", "--private"); } else if (getOpt(args[index], "help", null)) { @setEvalBranchQuota(2000); try std.io.getStdOut().writer().print(help, .{exe_name}); return; } else if (getOpt(args[index], "html", null)) { index += 1; html_template_file = args[index]; } else if (getOpt(args[index], "gmi", null)) { index += 1; gmi_template_file = args[index]; } else if (getOpt(args[index], "silent", 's')) { silent = true; } else if (getOpt(args[index], "path", 'P')) { index += 1; const parts: [][]const u8 = &[_][]const u8{ args[index], env_map.get("PATH") orelse "", }; const new_path = try std.mem.join(allocator, ":", parts); defer allocator.free(new_path); try env_map.set("PATH", new_path); } else if (getOpt(args[index], "", null)) { index += 1; break; } else if (std.mem.startsWith(u8, args[index], "-")) { logger.alert("Unknown arg {s}", .{args[index]}); return error.BadArgs; } else { break; } } const html_template = try getTemplate(&cwd, &arena.allocator, html_template_file, .html); const gmi_template = try getTemplate(&cwd, &arena.allocator, gmi_template_file, .gmi); if (index >= args.len) { logger.alert("Missing <out_dir> argument.", .{}); try std.io.getStdOut().writer().print(usage, .{exe_name}); return error.BadArgs; } try cwd.makePath(args[index]); var out_dir = try cwd.openDir(args[index], .{}); defer out_dir.close(); var html_dir = try out_dir.makeOpenPath("html", .{}); defer html_dir.close(); var gmi_dir = try out_dir.makeOpenPath("gmi", .{}); defer gmi_dir.close(); index += 1; var site_dir = try cwd.openDir( if (index < args.len) args[index] else ".", .{ .iterate = true }, ); // Ensures that child processes work as you might expect try site_dir.setAsCwd(); defer site_dir.close(); const render_options: RenderOptions = .{ .html_template = &html_template, .gmi_template = &gmi_template, .allocator = allocator, }; const targets: RenderTargets = .{ .dirname = null, .src = &site_dir, .gmi = &gmi_dir, .html = &html_dir, }; try renderDir(render_options, targets, null); } pub const RenderOptions = struct { html_template: *const Template, gmi_template: *const Template, allocator: *std.mem.Allocator, }; pub const RenderTargets = struct { dirname: ?[]const u8, src: *std.fs.Dir, gmi: *std.fs.Dir, html: *std.fs.Dir, }; const RenderError = ParseError || ParseInfoError || std.fs.File.OpenError || std.fs.Dir.OpenError || error{ LinkQuotaExceeded, ReadOnlyFileSystem, StreamTooLong }; /// Iterate over all files in a directory and render their output for each target fn renderDir(options: RenderOptions, targets: RenderTargets, parent_title: ?[]const u8) RenderError!void { try targets.src.setAsCwd(); var it = targets.src.iterate(); const index_title: ?[]const u8 = blk: { const index = targets.src.openFile("index.txt", .{}) catch |err| switch (err) { error.FileNotFound => break :blk null, else => |other_err| return other_err, }; defer index.close(); break :blk try index.reader().readUntilDelimiterAlloc( options.allocator, '\n', 1024 * 1024, ); }; defer if (index_title) |title| options.allocator.free(title); while (try it.next()) |item| switch (item.kind) { .File => try renderFile( options, targets, if (std.mem.eql(u8, item.name, "index.txt")) parent_title else index_title, item.name, ), .Directory => { var src_subdir = try targets.src.openDir(item.name, .{ .iterate = true }); try src_subdir.setAsCwd(); defer targets.src.setAsCwd() catch unreachable; defer src_subdir.close(); var html_subdir = try targets.html.makeOpenPath(item.name, .{}); defer html_subdir.close(); var gmi_subdir = try targets.gmi.makeOpenPath(item.name, .{}); defer gmi_subdir.close(); const subdir_name = if (targets.dirname) |dirname| try std.fs.path.join(options.allocator, &[_][]const u8{ dirname, item.name, }) else item.name; defer if (targets.dirname != null) options.allocator.free(subdir_name); const subtargets = RenderTargets{ .dirname = subdir_name, .html = &html_subdir, .gmi = &gmi_subdir, .src = &src_subdir, }; try renderDir(options, subtargets, index_title); }, else => {}, }; } fn renderFile( options: RenderOptions, targets: RenderTargets, parent_name: ?[]const u8, filename: []const u8, ) RenderError!void { if (!std.mem.endsWith(u8, filename, ".txt")) return; var arena = std.heap.ArenaAllocator.init(options.allocator); defer arena.deinit(); const filename_no_ext = filename[0 .. filename.len - 4]; const file_info = FileInfo{ .name = filename_no_ext, .dir = targets.dirname, .parent_title = parent_name, }; const src_file = try targets.src.openFile(filename, .{}); defer src_file.close(); const lines = try readLines(src_file.reader(), &arena.allocator); const doc = try parseDocument(lines, &arena.allocator, file_info); if (doc.info.private and !include_private) return; const stdout = std.io.getStdOut().writer(); if (!silent) { if (targets.dirname) |dirname| { try stdout.print("{s}{s}{s}\n", .{ dirname, std.fs.path.sep_str, filename_no_ext }); } else { try stdout.print("{s}\n", .{filename_no_ext}); } } inline for (@typeInfo(Ext).Enum.fields) |field| { comptime const ext = @field(Ext, field.name); const dir = @field(targets, field.name); const template = @field(options, field.name ++ "_template"); const out_filename = try std.mem.concat( &arena.allocator, u8, &[_][]const u8{ filename_no_ext, "." ++ field.name }, ); defer arena.allocator.free(out_filename); const out_file = try dir.createFile( out_filename, .{ .truncate = true }, ); defer out_file.close(); const writer = out_file.writer(); try formatTemplate(template.header, doc.info, file_info, writer); for (doc.blocks) |block| switch (ext) { .html => try formatBlockHtml(block, writer), .gmi => try formatBlockGmi(block, writer), }; try formatTemplate(template.footer, doc.info, file_info, writer); } } // ---- MODELS ---- /// The possible rendering targets const Ext = enum { html, gmi }; /// A parsed document const Document = struct { blocks: []const Block, info: Info }; /// The metadata at the top of the document const Info = struct { title: []const u8, created: Date, changes: []const Change, private: bool = false, unlisted: bool = false, shell: ?[]const u8 = null, }; const FileInfo = struct { name: []const u8, dir: ?[]const u8, parent_title: ?[]const u8 }; const ParseContext = struct { info: Info, file: FileInfo, allocator: *std.mem.Allocator, }; const Change = struct { date: Date, what_changed: ?[]const u8 = null }; /// A line-level block of text const Block = union(enum) { paragraph: []const Span, raw: Raw, heading: []const u8, subheading: []const u8, quote: []const []const Span, list: []const []const Span, link: Link, preformatted: []const []const u8, empty, image: Image, }; const Image = struct { source: []const u8, alt: []const u8, title: []const u8 }; /// Text that should be copied as-is into the output IF the current rendering /// target matches the extension const Raw = struct { ext: Ext, lines: []const []const u8 }; /// A line-level link const Link = struct { url: []const u8, text: ?[]const u8 = null, auto_ext: bool = false, hash: ?[]const u8 = null, }; /// Inline formatting. Ignored entirely by gemini. const Span = union(enum) { text: []const u8, strong: []const Span, emphasis: []const Span, anchor: Anchor, br, }; /// An inline link. const Anchor = struct { url: []const u8, text: []const Span }; // ---- PARSING ---- /// I have a specific parsing model I like to use that works pretty well for me. /// First, all of the document is split into a span of text lines. If a parsing /// function could consume multiple lines, it takes all of the lines (including /// those already consumed) along with a start index, then returns the resulting /// structure along with the new index if it found a match. If no match was found /// it returns null. /// What I like about this is that we always have the context of the current line /// number close on hand so that if we need to put out helpful log messages, we /// can, and it's easy to write "speculative parsers" that go along doing their /// to parse a format, but can "rewind" harmlessly if something goes wrong. /// In general, this also means that errors don't really happen, because if you /// mistype something it'll usually just fall back to raw text. fn parseDocument( lines: []const []const u8, allocator: *std.mem.Allocator, file: FileInfo, ) !Document { const info_res = try parseInfo(lines, file.name, allocator); const context = ParseContext{ .file = file, .allocator = allocator, .info = info_res.data }; const blocks = try parseBlocks(lines, info_res.new_pos + 1, context); const result: Document = .{ .blocks = blocks, .info = info_res.data, }; return result; } /// wow so many things can go wrong with computers const ParseError = error{ ProcessEndedUnexpectedly, SpanNotClosed, } || std.mem.Allocator.Error || std.process.GetEnvVarOwnedError || std.fs.File.ReadError || std.fs.File.WriteError || std.ChildProcess.SpawnError; const ParseInfoError = std.mem.Allocator.Error || error{ NoInfo, NoCreatedDate, UnexpectedInfo, FailedToMatchLiteral, EndOfStream, InvalidDay }; fn ParseResult(comptime Type: type) type { return struct { data: Type, new_pos: usize, }; } /// Shorthand for building ParseResults fn ok(data: anytype, new_pos: usize) ParseResult(@TypeOf(data)) { return .{ .data = data, .new_pos = new_pos, }; } fn parseInfo( lines: []const []const u8, filename: []const u8, allocator: *std.mem.Allocator, ) ParseInfoError!ParseResult(Info) { if (lines.len == 0) { logger.alert("File {s} has no info", .{filename}); return error.NoInfo; } const title = lines[0]; var created: ?Date = null; var changes = std.ArrayList(Change).init(allocator); errdefer changes.deinit(); var line: usize = 1; var private = false; var unlisted = false; var shell: ?[]const u8 = null; while (line < lines.len and lines[line].len > 0) : (line += 1) { if (parseLiteral(lines[line], 0, "Written ")) |index| { created = try Date.parse(lines[line][index..]); } else if (parseLiteral(lines[line], 0, "Updated ")) |index| { var date = try Date.parse(lines[line][index..]); const what_changed_start = index + "0000-00-00".len + 1; if (lines[line].len > what_changed_start) { try changes.append(.{ .date = date, .what_changed = lines[line][what_changed_start..], }); } else { try changes.append(.{ .date = date }); } } else if (std.mem.eql(u8, lines[line], "Private")) { private = true; } else if (std.mem.eql(u8, lines[line], "Unlisted")) { unlisted = true; } else if (parseLiteral(lines[line], 0, "Using ")) |index| { shell = lines[line][index..]; } else { logger.alert("\"{s}\" (at {s}) has unexpected info \"{s}\" on line {d}.", .{ title, filename, lines[line], line + 1 }); return error.UnexpectedInfo; } } return ok(Info{ .title = title, .created = created orelse { logger.alert("\"{s}\" (at {s}) has no written date", .{ title, filename }); return error.NoCreatedDate; }, .changes = changes.toOwnedSlice(), .private = private, .unlisted = unlisted, .shell = shell, }, line); } /// The basic idea for blocks is: if it's not anything else, it's a paragraph. /// So, we try to parse various block patterns, and if nothing matches, we /// add a line of paragraph text which will be "flushed out" as soon as something /// DOES match (or the end of the file). fn parseBlocks( lines: []const []const u8, start: usize, context: ParseContext, ) ParseError![]const Block { var index = start; var blocks = std.ArrayList(Block).init(context.allocator); var spans = std.ArrayList(Span).init(context.allocator); while (index < lines.len) { if (try parseCommand(lines, index, context)) |res| { if (spans.items.len > 0) { try blocks.append(.{ .paragraph = spans.toOwnedSlice() }); } try blocks.appendSlice(res.data); index = res.new_pos; } else if (try parseBlock(lines, index, context.allocator)) |res| { if (spans.items.len > 0) { try blocks.append(.{ .paragraph = spans.toOwnedSlice() }); } try blocks.append(res.data); index = res.new_pos; } else if (try parseSpans(lines[index], 0, null, null, context.allocator)) |res| { index += 1; if (spans.items.len > 0) { try spans.append(.{ .br = {} }); } try spans.appendSlice(res.data); } else { index += 1; } } if (spans.items.len > 0) { try blocks.append(.{ .paragraph = spans.toOwnedSlice() }); } return blocks.toOwnedSlice(); } /// This is the fun stuff. Everything written inside of a command block is piped /// into the shell, and the output is then parsed as blocks like any other /// content. Not very much code and A LOT of power. fn parseCommand( lines: []const []const u8, start: usize, context: ParseContext, ) !?ParseResult([]const Block) { if (try parsePrefixedLines( lines, start, ":", context.allocator, )) |res| { defer context.allocator.free(res.data); const shell = context.info.shell orelse try std.process.getEnvVarOwned(context.allocator, "SHELL"); var process = try std.ChildProcess.init( &[_][]const u8{shell}, context.allocator, ); defer process.deinit(); try env_map.set("FILE", context.file.name); process.env_map = &env_map; process.stdin_behavior = .Pipe; process.stdout_behavior = .Pipe; try process.spawn(); errdefer _ = process.kill() catch |err| { logger.warn("Had trouble cleaning up process: {}", .{err}); }; const writer = process.stdin.?.writer(); for (res.data) |line| { try writer.print("{s}\n", .{line}); } process.stdin.?.close(); process.stdin = null; const result_lines = try readLines( process.stdout.?.reader(), context.allocator, ); switch (try process.wait()) { .Exited => |status| { if (status != 0) { logger.alert("Process ended unexpectedly on line {d}", .{ res.new_pos, }); return error.ProcessEndedUnexpectedly; } return ok( try parseBlocks(result_lines, 0, context), res.new_pos, ); }, else => return error.ProcessEndedUnexpectedly, } } return null; } fn parseBlock( lines: []const []const u8, line: usize, allocator: *std.mem.Allocator, ) !?ParseResult(Block) { if (lines[line].len == 0) { return ok(Block{ .empty = {} }, line + 1); } else if (try parseRaw(lines, line, allocator)) |res| { return ok(Block{ .raw = res.data }, res.new_pos); } else if (try parsePrefixedLines(lines, line, " ", allocator)) |res| { return ok(Block{ .preformatted = res.data }, res.new_pos); } else if (try parseWrapper(lines, line, "> ", allocator)) |res| { return ok(Block{ .quote = res.data }, res.new_pos); } else if (parseHeading(lines[line])) |heading| { return ok(Block{ .heading = heading }, line + 1); } else if (parseSubheading(lines[line])) |subheading| { return ok(Block{ .subheading = subheading }, line + 1); } else if (try parseLink(lines[line])) |link| { return ok(Block{ .link = link }, line + 1); } else if (try parseList(lines, line, allocator, "- ")) |res| { return ok(Block{ .list = res.data }, res.new_pos); } else if (try parseImage(lines, line)) |res| { return ok(Block{ .image = res.data }, res.new_pos); } else return null; } fn parseRaw(lines: []const []const u8, start: usize, allocator: *std.mem.Allocator) !?ParseResult(Raw) { inline for (@typeInfo(Ext).Enum.fields) |fld| { if (try parsePrefixedLines(lines, start, "." ++ fld.name, allocator)) |res| { return ok( Raw{ .ext = @field(Ext, fld.name), .lines = res.data }, res.new_pos, ); } } return null; } fn parsePrefixedLines( lines: []const []const u8, start: usize, comptime prefix: []const u8, allocator: *std.mem.Allocator, ) !?ParseResult([]const []const u8) { if (!std.mem.startsWith(u8, lines[start], prefix ++ " ")) return null; var line = start; var result = std.ArrayList([]const u8).init(allocator); while (line < lines.len) : (line += 1) { if (parseLiteral(lines[line], 0, prefix ++ " ")) |index| { try result.append(lines[line][index..]); } else break; } return ok(@as([]const []const u8, result.toOwnedSlice()), line); } fn parseHeading(line: []const u8) ?[]const u8 { if (parseLiteral(line, 0, "# ")) |index| return line[index..]; return null; } fn parseSubheading(line: []const u8) ?[]const u8 { if (parseLiteral(line, 0, "## ")) |index| return line[index..]; return null; } fn parseList( lines: []const []const u8, start: usize, allocator: *std.mem.Allocator, comptime symbol: []const u8, ) ParseError!?ParseResult([]const []const Span) { var ll = start; if (!std.mem.startsWith(u8, lines[ll], symbol)) return null; var items = std.ArrayList([]const Span).init(allocator); while (ll < lines.len and std.mem.startsWith(u8, lines[ll], symbol)) : (ll += 1) { if (try parseSpans( lines[ll], symbol.len, null, null, allocator, )) |result| { try items.append(result.data); } else { try items.append(&[0]Span{}); } } errdefer items.deinit(); return ok(@as([]const []const Span, items.toOwnedSlice()), ll); } fn parseLink(line: []const u8) !?Link { const url_start = parseLiteral(line, 0, "=> ") orelse return null; const url_end = std.mem.indexOfPos( u8, line, url_start, " ", ) orelse return null; const hash_start = std.mem.indexOfPos(u8, line[0..url_end], url_start, "#"); const hash = if (hash_start) |start| line[start + 1 .. url_end] else null; const text = line[url_end + 1 ..]; const url = line[url_start .. hash_start orelse url_end]; if (std.mem.endsWith(u8, url, ".*")) { return Link{ .url = url[0 .. url.len - 2], .text = text, .auto_ext = true, .hash = hash, }; } else { return Link{ .url = url, .text = text, .hash = hash, }; } } fn parseImage(lines: []const []const u8, start: usize) !?ParseResult(Image) { if (start + 1 >= lines.len) return null; const url_start = parseLiteral(lines[start], 0, "!> ") orelse return null; const alt_start = parseLiteral(lines[start + 1], 0, " ") orelse return null; const url_end = std.mem.indexOfPos(u8, lines[start], url_start, " ") orelse return null; return ok(Image{ .source = lines[start][url_start..url_end], .title = lines[start][url_end + 1 ..], .alt = lines[start + 1][alt_start..], }, start + 2); } fn parseWrapper( lines: []const []const u8, start: usize, comptime prefix: []const u8, allocator: *std.mem.Allocator, ) !?ParseResult([]const []const Span) { if (!std.mem.startsWith(u8, lines[start], prefix)) return null; var line = start; var paragraphs = std.ArrayList([]const Span).init(allocator); var spans = std.ArrayList(Span).init(allocator); while (line < lines.len and std.mem.startsWith(u8, lines[line], prefix)) : (line += 1) { if (lines[line].len == prefix.len) { if (spans.items.len > 0) { try paragraphs.append(spans.toOwnedSlice()); } } else if (try parseSpans( lines[line], prefix.len, null, null, allocator, )) |res| { if (spans.items.len > 0) { try spans.append(.br); } try spans.appendSlice(res.data); } } if (spans.items.len > 0) { try paragraphs.append(spans.toOwnedSlice()); } return ok(@as([]const []const Span, paragraphs.toOwnedSlice()), line); } /// Parsing spans applies the exact same principles as parsing blocks, except /// using column indexes in single lines instead of row index in lists of lines. /// With the exception of the outermost content, spans are usually wrapped in /// something (like *bold text*), and so you can provide the open and close /// arguments to nest span parsing so that something silly like *_*IMPORTANT*_* /// actually applies nested <strong><em><strong> tags. fn parseSpans( line: []const u8, start: usize, comptime open: ?[]const u8, comptime close: ?[]const u8, allocator: *std.mem.Allocator, ) ParseError!?ParseResult([]const Span) { var col = start; if (open) |match| { col = parseLiteral(line, col, match) orelse return null; } var spans = std.ArrayList(Span).init(allocator); var text = std.ArrayList(u8).init(allocator); while (col < line.len) { if (close) |match| if (parseLiteral(line, col, match) != null) break; if (try parseSpan(line, col, allocator)) |res| { if (text.items.len > 0) { try spans.append(.{ .text = text.toOwnedSlice() }); } try spans.append(res.data); col = res.new_pos; } else { try text.append(line[col]); col += 1; } } else if (close) |match| { // TODO there might be a minor memory leak here text.deinit(); spans.deinit(); return null; } if (text.items.len > 0) { try spans.append(.{ .text = text.toOwnedSlice() }); } const consumed = if (close) |match| col + match.len else col; if (spans.items.len == 0) return null; return ok(@as([]const Span, spans.toOwnedSlice()), consumed); } fn parseSpan( line: []const u8, start: usize, allocator: *std.mem.Allocator, ) ParseError!?ParseResult(Span) { if (try parseSpans(line, start, "_", "_", allocator)) |result| { return ok(Span{ .emphasis = result.data }, result.new_pos); } else if (try parseSpans(line, start, "*", "*", allocator)) |result| { return ok(Span{ .strong = result.data }, result.new_pos); } else if (try parseAnchor(line, start, allocator)) |result| { return ok(Span{ .anchor = result.data }, result.new_pos); } else return null; } fn parseAnchor( line: []const u8, start: usize, allocator: *std.mem.Allocator, ) ParseError!?ParseResult(Anchor) { if (try parseSpans(line, start, "[", "](", allocator)) |res| { const end_index = std.mem.indexOfPos( u8, line, res.new_pos, ")", ) orelse return null; return ok(Anchor{ .text = res.data, .url = line[res.new_pos..end_index], }, end_index + 1); } return null; } // ---- COMMON FORMATTING ---- /// Pretty typical, you probably wouldn't even need to change this if you were /// altering the template. const html_preamble = \\<!DOCTYPE html> \\<html> \\<head> \\<meta charset="UTF-8"/> \\<meta name="viewport" content="width=device-width, initial-scale=1.0"> \\<link rel="stylesheet" type="text/css" href="/style.css" /> \\<link rel="icon" type="image/png" href="assets/favicon.png" /> \\ ; // ---- HTML FORMATTING ---- fn formatBlockHtml( block: Block, writer: anytype, ) @TypeOf(writer).Error!void { switch (block) { .paragraph => |paragraph| { try writer.writeAll("<p>"); for (paragraph) |span| try formatSpanHtml(span, writer); try writer.writeAll("</p>\n"); }, .heading => |heading| { try writer.writeAll("<h2 id=\""); try formatId(heading, writer); const text = HtmlText.init(heading); try writer.print("\">{s}</h2>\n", .{text}); }, .subheading => |subheading| { try writer.writeAll("<h3 id=\""); try formatId(subheading, writer); const text = HtmlText.init(subheading); try writer.print("\">{s}</h2>\n", .{text}); }, .raw => |raw| switch (raw.ext) { .html => for (raw.lines) |line| { try writer.print("{s}\n", .{line}); }, else => {}, }, .link => |link| { const text = HtmlText.init(link.text orelse link.url); const url = HtmlText.init(link.url); try writer.print("<a href=\"{s}", .{url}); if (link.auto_ext) { try writer.writeAll(".html"); } if (link.hash) |hash| { try writer.print("#{s}", .{hash}); } try writer.print("\">{s}</a>\n", .{text}); }, .list => |list| { try writer.writeAll("<ul>\n"); for (list) |item| { try writer.writeAll(" <li>"); for (item) |span| try formatSpanHtml(span, writer); try writer.writeAll("</li>\n"); } try writer.writeAll("</ul>"); }, .quote => |paragraphs| { try writer.writeAll("<blockquote>\n"); for (paragraphs) |p| { try formatBlockHtml(Block{ .paragraph = p }, writer); } try writer.writeAll("</blockquote>\n"); }, .preformatted => |lines| { try writer.writeAll("<pre>\n"); for (lines) |line| { const text = HtmlText.init(line); try writer.print("{s}\n", .{text}); } try writer.writeAll("</pre>\n"); }, .image => |image| { try writer.print("<img src=\"{s}\" alt=\"{s}\">\n", .{ image.source, HtmlText.init(image.alt), }); }, .empty => {}, } } fn formatSpanHtml(span: Span, writer: anytype) @TypeOf(writer).Error!void { switch (span) { .text => |text| { const formatted = HtmlText.init(text); try writer.print("{}", .{formatted}); }, .emphasis => |spans| { try writer.writeAll("<em>"); for (spans) |sp| try formatSpanHtml(sp, writer); try writer.writeAll("</em>"); }, .strong => |spans| { try writer.writeAll("<strong>"); for (spans) |sp| try formatSpanHtml(sp, writer); try writer.writeAll("</strong>"); }, .anchor => |anchor| { try writer.print( \\<a href="{s}"> , .{anchor.url}); for (anchor.text) |sp| try formatSpanHtml(sp, writer); try writer.writeAll("</a>"); }, .br => try writer.writeAll("<br>\n"), } } pub fn formatId(string: []const u8, writer: anytype) !void { for (string) |char| switch (char) { ' ' => try writer.writeByte('-'), '?' => {}, else => try writer.writeByte(char), }; } pub const HtmlText = struct { text: []const u8, fn init(text: []const u8) @This() { return .{ .text = text }; } pub fn format( self: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) !void { for (self.text) |char| switch (char) { '>' => try writer.writeAll("&gt;"), '<' => try writer.writeAll("&lt;"), '\"' => try writer.writeAll("&quot;"), '&' => try writer.writeAll("&amp;"), else => try writer.writeByte(char), }; } }; // ---- GEMINI FORMATTING ---- fn formatParagraphGmi( spans: []const Span, comptime br: []const u8, writer: anytype, ) !void { for (spans) |span| { try formatSpanGmi(span, br, writer); } try writer.writeAll("\n"); } fn formatBlockGmi( block: Block, writer: anytype, ) @TypeOf(writer).Error!void { switch (block) { .paragraph => |paragraph| { try formatParagraphGmi(paragraph, "\n", writer); }, .heading => |heading| { try writer.print("## {s}\n", .{heading}); }, .subheading => |subheading| { try writer.print("### {s}\n", .{subheading}); }, .raw => |raw| switch (raw.ext) { .gmi => for (raw.lines) |line| { try writer.print("{s}\n", .{line}); }, else => {}, }, .link => |link| { try writer.print("=> {s}", .{link.url}); if (link.auto_ext) { try writer.writeAll(".gmi"); } if (link.text) |text| { try writer.print(" {s}", .{text}); } try writer.writeByte('\n'); }, .list => |list| { for (list) |item| { try writer.writeAll("* "); for (item) |span| try formatSpanGmi(span, " ", writer); try writer.writeAll("\n"); } }, .quote => |paragraphs| { for (paragraphs) |p, i| { if (i != 0) try writer.writeAll("> \n"); try writer.writeAll("> "); try formatParagraphGmi(p, "\n> ", writer); } }, .preformatted => |lines| { try writer.writeAll("```\n"); for (lines) |line| { try writer.print("{s}\n", .{line}); } try writer.writeAll("```\n"); }, .image => |image| { try writer.print("=> {s} {s}\n", .{ image.source, image.title }); }, .empty => try writer.writeAll("\n"), } } fn formatSpanGmiInternal( span: Span, comptime br: []const u8, writer: anytype, bold: bool, ) @TypeOf(writer).Error!void { switch (span) { .text => |text| { if (bold) { for (text) |char| { if (char >= 'a' and char <= 'z') { try writer.writeByte(char - ('a' - 'A')); } else { try writer.writeByte(char); } } } else { try writer.writeAll(text); } }, .strong => |spans| for (spans) |sp| try formatSpanGmiInternal(sp, "", writer, true), .emphasis => |spans| for (spans) |sp| try formatSpanGmiInternal(sp, "", writer, bold), .anchor => |anchor| for (anchor.text) |sp| try formatSpanGmiInternal(sp, "", writer, bold), .br => try writer.writeAll(br), } } fn formatSpanGmi(span: Span, comptime br: []const u8, writer: anytype) @TypeOf(writer).Error!void { return formatSpanGmiInternal(span, br, writer, false); } // ---- INDEXING ---- /// A document that has only had the metadata parsed, for indexing const IndexEntry = struct { filename: []const u8, date: Date, event: union(enum) { written, updated: ?[]const u8 }, info: Info, }; /// The 'sitegen index' command. Operates on collections of documents. Useful for /// building directories or feeds. fn buildIndex( exe_name: []const u8, args: []const []const u8, allocator: *std.mem.Allocator, ) !void { var arg_i: usize = 0; var arena = std.heap.ArenaAllocator.init(allocator); defer arena.deinit(); const usage = \\usage: \\ {0s} index [--help] \\ {0s} index [--private] [--limit <num>] [--updates | --additions] [--] \\ <file> [<file>...] ; const help = usage ++ \\ \\options: \\ -p, --private include private content in the list \\ -l <num>, --limit <num> limit the number of entries to the top num \\ -u, --updates only include updates (and not additions) \\ -a, --additions only include additions (and not updates) ; const stdout = std.io.getStdOut().writer(); if (args.len == 0) { try stdout.print(usage, .{exe_name}); return; } var limit: ?usize = null; var include_updates = true; var include_additions = true; while (arg_i < args.len) : (arg_i += 1) { const arg = args[arg_i]; if (getOpt(arg, "private", 'p')) { include_private = true; } else if (getOpt(arg, "help", null)) { @setEvalBranchQuota(2000); try stdout.print(help, .{exe_name}); return; } else if (getOpt(arg, "limit", 'l')) { arg_i += 1; limit = std.fmt.parseInt(usize, args[arg_i], 10) catch { logger.alert("Limit value must be positive integer, got: {s}", .{ args[arg_i], }); return error.BadArgs; }; } else if (getOpt(arg, "updates", 'u')) { include_additions = false; } else if (getOpt(arg, "additions", 'a')) { include_updates = false; } else if (getOpt(arg, "-", null)) { arg_i += 1; break; } else if (std.mem.startsWith(u8, arg, "-")) { logger.alert("Unknown argument {s}", .{arg}); return error.BadArgs; } else break; } if (arg_i >= args.len) { logger.alert("Missing argument <file>.", .{}); try stdout.print(usage, .{exe_name}); return; } const cwd = std.fs.cwd(); var pages = std.ArrayList(IndexEntry).init(&arena.allocator); for (args[arg_i..]) |filename| { if (!std.mem.endsWith(u8, filename, ".txt")) continue; var file = try cwd.openFile(filename, .{}); defer file.close(); const lines = blk: { var lines = std.ArrayList([]const u8).init( &arena.allocator, ); var line = std.ArrayList(u8).init(&arena.allocator); while (try readLine(file.reader(), &line)) { if (line.items.len == 0) break; try lines.append(line.toOwnedSlice()); } break :blk lines.toOwnedSlice(); }; // logger.debug("Adding {s} to index", .{filename}); var info = (try parseInfo(lines, filename, allocator)).data; defer allocator.free(info.changes); if (info.unlisted) continue; if (info.private and !include_private) continue; const filename_no_ext = filename[0 .. filename.len - 4]; if (include_updates) { for (info.changes) |change| { try pages.append(.{ .filename = filename_no_ext, .info = info, .event = .{ .updated = change.what_changed }, .date = change.date, }); } } if (include_additions) { try pages.append(.{ .filename = filename_no_ext, .info = info, .event = .written, .date = info.created, }); } } const sortFn = struct { fn laterThan(context: void, lhs: IndexEntry, rhs: IndexEntry) bool { const result = lhs.date.isAfter(rhs.date); return result; } }.laterThan; std.sort.sort(IndexEntry, pages.items, {}, sortFn); if (limit) |limit_val| { if (limit_val < pages.items.len) { pages.shrinkAndFree(limit_val); } } try formatIndexMarkup(stdout, pages.items); } fn formatIndexMarkup(writer: anytype, pages: []const IndexEntry) !void { for (pages) |page| { if (page.info.private) { try writer.writeAll("; "); } try writer.print("=> {s}.* {} – {s}", .{ page.filename, page.date, page.info.title, }); switch (page.event) { .written => {}, .updated => |what_changed| { const change = what_changed orelse "updated"; try writer.print(" – {s}", .{change}); }, } try writer.writeByte('\n'); } } // ---- TEMPLATES ---- const Template = struct { header: []const TemplateNode, footer: []const TemplateNode, }; const TemplateNode = union(enum) { text: []const u8, variable: TemplateVariable, conditional: TemplateConditional, }; const TemplateVariableName = enum { title, file, dir, written, updated, back_text, back, parent_name, parent, }; const TemplateVariable = struct { name: TemplateVariableName, format: ?[]const u8 = null, }; const TemplateConditional = struct { name: TemplateVariableName, output: []const TemplateNode, }; fn getTemplate(cwd: *std.fs.Dir, allocator: *std.mem.Allocator, template_file: ?[]const u8, comptime ext: Ext) !Template { return try parseTemplate( if (template_file) |file| try cwd.readFileAlloc( allocator, file, 1024 * 1024 * 1024, ) else @embedFile("default_template." ++ @tagName(ext)), allocator, ); } fn parseTemplate(text: []const u8, allocator: *std.mem.Allocator) !Template { var arena = std.heap.ArenaAllocator.init(allocator); errdefer arena.deinit(); var index: usize = 0; var text_start = index; var header = std.ArrayList(TemplateNode).init(&arena.allocator); var footer = std.ArrayList(TemplateNode).init(&arena.allocator); var parsed_header = false; var result = &header; while (index < text.len) { if (parseLiteral(text, index, "{{content}}")) |new_pos| { if (index > text_start) { try header.append(.{ .text = text[text_start..index] }); } index = new_pos; text_start = index; break; } else if (try parseTemplateVariable( text, index, &arena.allocator, )) |res| { if (index > text_start) { try header.append(.{ .text = text[text_start..index] }); } index = res.new_pos; text_start = index; try header.append(res.data); } else { index += 1; } } if (index > text_start) { try header.append(.{ .text = text[text_start..index] }); } while (index < text.len) { if (try parseTemplateVariable( text, index, &arena.allocator, )) |res| { if (index > text_start) { try footer.append(.{ .text = text[text_start..index] }); } index = res.new_pos; text_start = index; try footer.append(res.data); } else { index += 1; } } if (index > text_start) { try footer.append(.{ .text = text[text_start..index] }); } return Template{ .header = header.toOwnedSlice(), .footer = footer.toOwnedSlice(), }; } fn parseTemplateVariableName( text: []const u8, start: usize, ) ?ParseResult(TemplateVariableName) { if (start >= text.len) return null; inline for (@typeInfo(TemplateVariableName).Enum.fields) |fld| { if (parseLiteral(text, start, fld.name)) |index| { return ok(@field(TemplateVariableName, fld.name), index); } } return null; } fn parseTemplateVariableFormat( text: []const u8, start: usize, ) ?ParseResult([]const u8) { if (start >= text.len) return null; const text_start = parseLiteral(text, start, "|") orelse return null; const text_end = std.mem.indexOfPos(u8, text, text_start, "}}") orelse return null; return ok(text[text_start..text_end], text_end + 2); } fn parseTemplateConditional( text: []const u8, start: usize, allocator: *std.mem.Allocator, ) std.mem.Allocator.Error!?ParseResult([]const TemplateNode) { var index = parseLiteral(text, start, "?") orelse return null; var arena = std.heap.ArenaAllocator.init(allocator); errdefer arena.deinit(); var text_start = index; var result = std.ArrayList(TemplateNode).init(&arena.allocator); while (index < text.len) { if (parseLiteral(text, index, "}}")) |new_index| { if (index > text_start) { try result.append(.{ .text = text[text_start..index] }); } return ok( @as([]const TemplateNode, result.toOwnedSlice()), new_index, ); } else if (try parseTemplateVariable( text, index, &arena.allocator, )) |res| { if (index > text_start) { try result.append(.{ .text = text[text_start..index] }); } index = res.new_pos; text_start = index; try result.append(res.data); } else { index += 1; } } arena.deinit(); return null; } fn parseTemplateVariable( text: []const u8, start: usize, allocator: *std.mem.Allocator, ) std.mem.Allocator.Error!?ParseResult(TemplateNode) { var index = start; index = parseLiteral(text, index, "{{") orelse return null; const name_res = parseTemplateVariableName(text, index) orelse return null; index = name_res.new_pos; if (parseTemplateVariableFormat(text, index)) |format_res| { return ok(TemplateNode{ .variable = .{ .name = name_res.data, .format = format_res.data, }, }, format_res.new_pos); } else if (try parseTemplateConditional( text, index, allocator, )) |cond_res| { return ok(TemplateNode{ .conditional = .{ .name = name_res.data, .output = cond_res.data, }, }, cond_res.new_pos); } const end_index = parseLiteral(text, index, "}}") orelse return null; return ok(TemplateNode{ .variable = .{ .name = name_res.data } }, end_index); } fn formatTemplate( template: []const TemplateNode, info: Info, file: FileInfo, writer: anytype, ) @TypeOf(writer).Error!void { for (template) |node| switch (node) { .text => |text| try writer.writeAll(text), .variable => |variable| switch (variable.name) { .written => { try info.created.formatRuntime( variable.format orelse "", writer, ); }, .updated => { if (info.changes.len > 0) { try info.changes[info.changes.len - 1].date.formatRuntime( variable.format orelse "", writer, ); } }, .title => try writer.writeAll(info.title), .file => try writer.writeAll(file.name), .dir => if (file.dir) |dir| try writer.writeAll(dir), .back, .parent => { try writer.writeByte('.'); if (file.dir) |dir| { if (std.mem.eql(u8, file.name, "index")) { try writer.writeByte('.'); } } }, .back_text, .parent_name => { if (file.parent_title) |name| { try writer.writeAll(name); } }, }, .conditional => |conditional| { if (switch (conditional.name) { .written, .title, .file, .back_text => true, .dir => file.dir != null, .back, .parent => file.dir != null or !std.mem.eql(u8, file.name, "index"), .updated => info.changes.len > 0, .parent_name => file.parent_title != null, }) { try formatTemplate(conditional.output, info, file, writer); } }, }; } // ---- UTILS ---- /// Gets all of the process's args, kindly splitting shortform options like /// -oPt into -o -P -t to make parsing easier. /// Caller owns both the outer and inner slices fn getArgs( allocator: *std.mem.Allocator, ) ![]const []const u8 { var args = std.ArrayList([]const u8).init(allocator); errdefer args.deinit(); errdefer for (args.items) |arg| allocator.free(arg); var it = std.process.ArgIterator.init(); defer it.deinit(); while (it.next(allocator)) |next_or_err| { const arg = try next_or_err; defer allocator.free(arg); if (std.mem.startsWith(u8, arg, "-") and !std.mem.startsWith(u8, arg, "--") and arg.len > 2) { for (arg[1..]) |char| { const buffer = try allocator.alloc(u8, 2); buffer[0] = '-'; buffer[1] = char; try args.append(buffer[0..]); } } else { try args.append(try allocator.dupe(u8, arg)); } } return args.toOwnedSlice(); } /// Check if an arg equals the given longform or shortform fn getOpt( arg: []const u8, comptime long: []const u8, comptime short: ?u8, ) bool { if (short) |char| { if (std.mem.eql(u8, arg, "-" ++ &[1]u8{char})) { return true; } } return std.mem.eql(u8, arg, "--" ++ long); } /// Returns false if it hit the end of the stream fn readLine(reader: anytype, array_list: *std.ArrayList(u8)) !bool { while (reader.readByte()) |byte| { if (byte == '\n') return true; try array_list.append(byte); } else |err| switch (err) { error.EndOfStream => { if (array_list.items.len > 0) return true else return false; }, else => |other_err| return other_err, } } /// Using this line reader to consume documents is pretty important, because this /// is the stage where private lines are skipped over. /// Caller owns result fn readLines( reader: anytype, allocator: *std.mem.Allocator, ) ![]const []const u8 { var lines = std.ArrayList([]const u8).init(allocator); var current_line = std.ArrayList(u8).init(allocator); while (try readLine(reader, &current_line)) { if (std.mem.startsWith(u8, current_line.items, "; ")) { if (std.mem.endsWith(u8, current_line.items, "\r")) { // Fuck it, we can handle CRLF lines, it's fine. _ = current_line.pop(); } if (include_private) { try lines.append(current_line.toOwnedSlice()[2..]); } else { current_line.shrinkRetainingCapacity(0); } } else { try lines.append(current_line.toOwnedSlice()); } } return lines.toOwnedSlice(); } fn parseLiteral( text: []const u8, start: usize, literal: []const u8, ) ?usize { if (start >= text.len) return null; if (!std.mem.startsWith(u8, text[start..], literal)) return null; return start + literal.len; }
src/main.zig
const std = @import("std"); pub const out = std.log.scoped(.libressl); pub const tls = @cImport({ @cInclude("tls.h"); }); const tls_config = @import("tls_config.zig"); pub const TlsConfiguration = tls_config.TlsConfiguration; pub const TlsConfigurationParams = tls_config.TlsConfigurationParams; pub const SslStream = @import("SslStream.zig"); pub const SslServer = @import("SslServer.zig"); pub fn closeTlsContext(tls_context: *tls.tls) !void { var maybe_tls_close: ?c_int = null; while (maybe_tls_close == null or maybe_tls_close.? == tls.TLS_WANT_POLLIN or maybe_tls_close.? == tls.TLS_WANT_POLLOUT) : (maybe_tls_close = tls.tls_close(tls_context)) {} if (maybe_tls_close.? == -1) return error.TlsClose; } // TODO(haze): reuse tls session file https://man.openbsd.org/tls_config_set_session_id.3 // TODO(haze): tls noverify https://man.openbsd.org/tls_config_verify.3 // TODO(haze): investigate tls_client/tls_server NULL return as OOM // TODO(haze): tls_context reporting (tls version, issuer, expiry, etc) // TODO(haze): incorporate into event loop // TODO(haze): better error parsing // TODO(haze): tls keypair/oscp add // TODO(haze): debug annotations test "server & client" { const message = "bruh moment"; var params = TlsConfigurationParams{ .ca = .{ .memory = @embedFile("../test/CA/root.pem") }, .cert = .{ .memory = @embedFile("../test/CA/server.crt") }, .key = .{ .memory = @embedFile("../test/CA/server.key") }, }; const conf = try params.build(); var stream_server = std.net.StreamServer.init(.{}); try stream_server.listen(std.net.Address.parseIp("127.0.0.1", 0) catch unreachable); var ssl_stream_server = try SslServer.wrap(conf, stream_server); const serverFn = struct { fn serverFn(server: *SslServer, message_to_send: []const u8) !void { defer server.deinit(); var ssl_connection = try server.accept(); defer ssl_connection.deinit(); var writer = ssl_connection.writer(); try writer.writeAll(message_to_send); } }.serverFn; var thread = try std.Thread.spawn(.{}, serverFn, .{ &ssl_stream_server, message }); defer thread.join(); var client = try std.net.tcpConnectToAddress(stream_server.listen_address); var ssl_client = try SslStream.wrapClientStream(conf, client, "localhost"); defer ssl_client.deinit(); var client_buf: [11]u8 = undefined; var client_reader = ssl_client.reader(); _ = try client_reader.readAll(&client_buf); try std.testing.expectEqualStrings(message, &client_buf); }
src/main.zig
const inputFile = @embedFile("./input/day04.txt"); const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const assert = std.debug.assert; fn parseU32(buf: []const u8) std.fmt.ParseIntError!u32 { return std.fmt.parseInt(u32, buf, 10); } const BingoBoard = struct { const rowLen = 5; const boardLen = rowLen * rowLen; nums: [boardLen]u32, hits: [boardLen]bool = [_]bool{false} ** boardLen, // Returns true if the hit caused a win condition pub fn hit(self: *@This(), val: u32) bool { for (self.nums) |num, i| { if (num == val) { self.hits[i] = true; return self.checkWin(i); } } return false; } pub fn checkWin(self: @This(), x: usize) bool { const row = @divFloor(x, rowLen); const col = x % rowLen; // Check row const rowHit = std.mem.allEqual(bool, self.hits[(row * rowLen) .. (row + 1) * rowLen], true); if (rowHit) return true; // Check col var result = true; var i: usize = 0; while (i < rowLen) : (i += 1) { if (!self.hits[i * rowLen + col]) { result = false; } } if (result) return true; return false; } pub fn countUnmarked(self: @This()) u32 { // Count unmarked values * val var result: u32 = 0; for (self.nums) |num, i| { if (!self.hits[i]) { result += num; } } return result; } // printf implementation pub fn format(self: @This(), comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void { // print it in a board try writer.writeByte('\n'); var row: usize = 0; while (row < rowLen) : (row += 1) { var col: usize = 0; while (col < rowLen) : (col += 1) { const isHit = self.hits[row * rowLen + col]; const c = if (isHit) @as(u8, '.') else @as(u8, ' '); try std.fmt.format(writer, "{d: <2}{c} ", .{ self.nums[row * rowLen + col], c }); } try writer.writeByte('\n'); } } }; const BingoInput = struct { nums: ArrayList(u32), boards: ArrayList(BingoBoard), pub fn deinit(self: @This()) void { self.nums.deinit(); self.boards.deinit(); } }; fn parseInput(input: []const u8, allocator: Allocator) !BingoInput { var nums = ArrayList(u32).init(allocator); errdefer nums.deinit(); var boards = ArrayList(BingoBoard).init(allocator); errdefer boards.deinit(); // --------- Step 1: Parse a set of numbers ---------- // First line of input is a comma separated list of numbers var start: usize = 0; while (true) { // must succeed if not there is a bug in input const end = std.mem.indexOfAnyPos(u8, input, start, &.{ '\n', ',' }).?; defer start = end + 1; if (input[end] == '\n') break; // comma // std.debug.print("Parsing: {s} start {d} end {d} endChar {c}\n", .{ input[start..end], start, end, input[end] }); const num = try parseU32(input[start..end]); try nums.append(num); } // skip the extra newline that is here assert(input[start] == '\n'); start += 1; // --------- Step 2: Parse the boards ---------- // now that nums is filled out, begin parsing each board while (start < input.len) { // Parse a single board in this loop var boardNums = [_]u32{1000} ** 25; var row: usize = 0; var col: usize = 0; while (row < 5) { switch (input[start]) { ' ' => start += 1, '\n' => { start += 1; row += 1; col = 0; }, '0'...'9' => { // a number is anything that is not a space // start with a non space, skip to the space, then parse const end = std.mem.indexOfAnyPos(u8, input, start, &.{ '\n', ' ' }).?; const num = try parseU32(input[start..end]); boardNums[row * 5 + col] = num; col += 1; start = end; // next round, start on the delimter and let the loop take care of it }, else => unreachable, } } const board = BingoBoard{ .nums = boardNums }; try boards.append(board); // final newline if (start == input.len) break; // skip the extra newline at the end of each board assert(input[start] == '\n'); start += 1; } return BingoInput{ .nums = nums, .boards = boards, }; } fn playBingo(bingo: *BingoInput, returnFirstWinner: bool) u32 { for (bingo.nums.items) |num| { // Each round of bingo var boardNum: usize = 0; while (boardNum < bingo.boards.items.len) { var board = &bingo.boards.items[boardNum]; if (board.hit(num)) { if (returnFirstWinner) { const unmarked = board.countUnmarked(); return unmarked * num; } else if (bingo.boards.items.len == 1) { // Final board const unmarked = board.countUnmarked(); return unmarked * num; } else { _ = bingo.boards.orderedRemove(boardNum); // don't increment boardNum } } else { boardNum += 1; } } } @panic("Bingo must have a winner, right...? haha"); } 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 var bingo = try parseInput(inputFile, allocator); defer bingo.deinit(); // try stdout.print("Part 1: sum unmarked * final num: {d}\n", .{ playBingo(&bingo, true), playBingo(&bingo, false) }); try stdout.print("Part2: sum unmarked * final num: {d}\n", .{playBingo(&bingo, false)}); } test "Final winner" { const input = \\7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 \\ \\22 13 17 11 0 \\ 8 2 23 4 24 \\21 9 14 16 7 \\ 6 10 3 18 5 \\ 1 12 20 15 19 \\ \\ 3 15 0 2 22 \\ 9 18 13 17 5 \\19 8 7 25 23 \\20 11 10 24 4 \\14 21 16 12 6 \\ \\14 21 17 24 4 \\10 16 15 9 19 \\18 8 23 26 20 \\22 11 13 6 5 \\ 2 0 12 3 7 \\ ; var bingo = try parseInput(input, std.testing.allocator); defer bingo.deinit(); try std.testing.expectEqual(@as(u32, 1924), playBingo(&bingo, false)); }
src/day04.zig
const std = @import("std"); const clap = @import("zig-clap"); const cursesui = @import("cursesui.zig"); pub const Args = struct { width: u8, height: u8, nmines: u16, characters: cursesui.Characters, color: bool, }; fn parseSize(str: []const u8, width: *u8, height: *u8) !void { const i = std.mem.indexOfScalar(u8, str, 'x') orelse return error.CantFindTheX; width.* = try std.fmt.parseUnsigned(u8, str[0..i], 10); height.* = try std.fmt.parseUnsigned(u8, str[i+1..], 10); if (width.* == 0 or height.* == 0) { return error.MustNotBeZero; } } pub fn parse(allocator: *std.mem.Allocator) !Args { const params = comptime [_]clap.Param(clap.Help) { clap.parseParam("-h, --help Display this help and exit") catch unreachable, clap.parseParam("-s, --size <STR> How big to make minesweeper, e.g. 15x15") catch unreachable, clap.parseParam("-n, --mine-count <NUM> How many mines") catch unreachable, clap.parseParam("-a, --ascii-only Use ASCII characters only") catch unreachable, clap.parseParam("-c, --no-colors Do not use colors") catch unreachable, }; var diag = clap.Diagnostic{}; var args = clap.parse(clap.Help, &params, .{ .diagnostic = &diag }) catch |err| { diag.report(std.io.getStdErr().writer(), err) catch {}; std.os.exit(2); }; defer args.deinit(); var result = Args{ .width = 10, .height = 10, .nmines = 10, .characters = cursesui.unicode_characters, .color = true, }; if (args.flag("--help")) { try std.io.getStdErr().writer().print( "Usage: {s} [options]\n\nOptions:\n", .{ std.process.args().nextPosix().? }); try clap.help(std.io.getStdErr().writer(), params[0..]); std.os.exit(0); } if (args.option("--size")) |size| { parseSize(size, &result.width, &result.height) catch |err| { try std.io.getStdErr().writer().print( "{s}: invalid minesweeper size \"{s}\"", .{ std.process.args().nextPosix().?, size }); std.os.exit(2); }; } if (args.option("--mine-count")) |mineCount| { result.nmines = try std.fmt.parseUnsigned(u8, mineCount, 10); } if (args.flag("--ascii-only")) { result.characters = cursesui.ascii_characters; } if (args.flag("--no-colors")) { result.color = false; } if (result.nmines >= @intCast(u16, result.width) * @intCast(u16, result.height)) { try std.io.getStdErr().writer().print( "{s}: there must be less mines than places for mines\n", .{ std.process.args().nextPosix().? }); std.os.exit(2); } return result; }
src/argparser.zig
const std = @import("std"); const sdk = @import("sdk"); const ifaces = @import("interface.zig").ifaces; const font_manager = @import("font_manager.zig"); var scale_i: f32 = 1; var origin_i = std.meta.Vector(2, i32){ 0, 0 }; var units_per_pixel_i: f32 = 1; pub const scale = &scale_i; // TODO: this should affect text, but what else? pub const origin = &origin_i; pub const units_per_pixel = &units_per_pixel_i; var allocator: std.mem.Allocator = undefined; pub const Font = struct { name: [:0]const u8, tall: f32, }; fn translate(coords: std.meta.Vector(2, f32)) std.meta.Vector(2, i32) { const scaled = coords * @splat(2, scale_i / units_per_pixel_i); return std.meta.Vector(2, i32){ origin_i[0] + @floatToInt(i32, scaled[0]), origin_i[1] + @floatToInt(i32, scaled[1]), }; } pub fn init(allocator1: std.mem.Allocator) void { allocator = allocator1; } pub fn setColor(col: sdk.Color) void { ifaces.ISurface.drawSetColor(col); ifaces.ISurface.drawSetTextColor(col); } pub fn drawRect(a: std.meta.Vector(2, f32), b: std.meta.Vector(2, f32)) void { const a1 = translate(a); const b1 = translate(b); const xmin = std.math.min(a1[0], b1[0]); const xmax = std.math.max(a1[0], b1[0]); const ymin = std.math.min(a1[1], b1[1]); const ymax = std.math.max(a1[1], b1[1]); ifaces.ISurface.drawOutlinedRect(xmin, ymin, xmax, ymax); } pub fn fillRect(a: std.meta.Vector(2, f32), b: std.meta.Vector(2, f32)) void { const a1 = translate(a); const b1 = translate(b); const xmin = std.math.min(a1[0], b1[0]); const xmax = std.math.max(a1[0], b1[0]); const ymin = std.math.min(a1[1], b1[1]); const ymax = std.math.max(a1[1], b1[1]); ifaces.ISurface.drawFilledRect(xmin, ymin, xmax, ymax); } pub fn getFontHeight(f: Font) f32 { const font_id = font_manager.findRawFont(f.name, @floatToInt(u32, f.tall / units_per_pixel_i)) orelse 12; // TODO: default const tall = ifaces.ISurface.getFontTall(font_id); return @intToFloat(f32, tall) * units_per_pixel_i; } pub fn getTextLength(f: Font, str: []const u8) f32 { var len: u32 = 0; const font_id = font_manager.findRawFont(f.name, @floatToInt(u32, f.tall / units_per_pixel_i)) orelse 12; // TODO: default for (str) |ch, i| { const prev: sdk.wchar = if (i == 0) 0 else str[i - 1]; const next: sdk.wchar = if (i == str.len - 1) 0 else str[i + 1]; var wide: f32 = undefined; var a: f32 = undefined; var c: f32 = undefined; ifaces.ISurface.getKernedCharWidth(font_id, ch, prev, next, &wide, &a, &c); len += @floatToInt(u32, wide + 0.6); } return @intToFloat(f32, len) * units_per_pixel_i; } pub fn drawText(f: Font, pos: std.meta.Vector(2, f32), str: []const u8) void { const font_id = font_manager.findRawFont(f.name, @floatToInt(u32, f.tall * scale_i / units_per_pixel_i)) orelse 12; // TODO: default const pos1 = translate(pos); ifaces.ISurface.drawSetTextPos(@intCast(c_int, pos1[0]), @intCast(c_int, pos1[1])); ifaces.ISurface.drawSetTextFont(font_id); if (str.len <= 64) { var buf: [64]sdk.wchar = undefined; for (str) |c, i| buf[i] = c; ifaces.ISurface.drawPrintText(&buf, @intCast(c_int, str.len), .default); } else { var buf = allocator.alloc(sdk.wchar, str.len) catch return; // TODO: handle some other way? defer allocator.free(buf); for (str) |c, i| buf[i] = c; ifaces.ISurface.drawPrintText(buf.ptr, @intCast(c_int, str.len), .default); } }
src/surface.zig
const std = @import("std"); const zwin32 = @import("zwin32"); const w = zwin32.base; const wasapi = zwin32.wasapi; const hrErrorOnFail = zwin32.hrErrorOnFail; pub const WasapiInterface = @This(); client: *wasapi.IAudioClient3, render_client: *wasapi.IAudioRenderClient, buffer_ready_event: w.HANDLE, num_channels: u32, sample_rate: u32, bits_per_sample: u32, frame_size: u32, pub fn init(requested_sample_rate: u32) !WasapiInterface { var audio_device_enumerator: *wasapi.IMMDeviceEnumerator = undefined; try hrErrorOnFail(w.CoCreateInstance( &wasapi.CLSID_MMDeviceEnumerator, null, w.CLSCTX_INPROC_SERVER, &wasapi.IID_IMMDeviceEnumerator, @ptrCast(*?*anyopaque, &audio_device_enumerator), )); defer _ = audio_device_enumerator.Release(); var audio_device: *wasapi.IMMDevice = undefined; try hrErrorOnFail(audio_device_enumerator.GetDefaultAudioEndpoint( .eRender, .eConsole, @ptrCast(*?*wasapi.IMMDevice, &audio_device), )); defer _ = audio_device.Release(); var client: *wasapi.IAudioClient3 = undefined; try hrErrorOnFail(audio_device.Activate( &wasapi.IID_IAudioClient3, w.CLSCTX_INPROC_SERVER, null, @ptrCast(*?*anyopaque, &client), )); const channels = 2; const sample_rate = requested_sample_rate; const bits_per_sample = 32; const block_align = channels * bits_per_sample / 8; const wanted_format = wasapi.WAVEFORMATEX{ .wFormatTag = wasapi.WAVE_FORMAT_IEEE_FLOAT, .nChannels = channels, .nSamplesPerSec = sample_rate, .nAvgBytesPerSec = sample_rate * block_align, .nBlockAlign = block_align, .wBitsPerSample = bits_per_sample, .cbSize = 0, }; var closest_format: ?*wasapi.WAVEFORMATEX = null; try hrErrorOnFail(client.IsFormatSupported(.SHARED, &wanted_format, &closest_format)); const format = if (closest_format) |fmt| fmt.* else wanted_format; try hrErrorOnFail(client.Initialize( .SHARED, wasapi.AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 0, 0, &format, null, )); var render_client: *wasapi.IAudioRenderClient = undefined; try hrErrorOnFail(client.GetService( &wasapi.IID_IAudioRenderClient, @ptrCast(*?*anyopaque, &render_client), )); const buffer_ready_event = try zwin32.base.CreateEventEx( null, "audio_buffer_ready_event", 0, zwin32.base.EVENT_ALL_ACCESS, ); try hrErrorOnFail(client.SetEventHandle(buffer_ready_event)); return WasapiInterface{ .client = client, .render_client = render_client, .buffer_ready_event = buffer_ready_event, .num_channels = format.nChannels, .sample_rate = format.nSamplesPerSec, .bits_per_sample = format.wBitsPerSample, .frame_size = format.nBlockAlign, }; } pub fn deinit(self: *WasapiInterface) void { w.CloseHandle(self.buffer_ready_event); _ = self.client.Stop(); _ = self.render_client.Release(); _ = self.client.Release(); }
modules/platform/src/win32/WasapiInterface.zig
const std = @import("std"); const c = @import("../c.zig"); const vec3 = @import("vec3.zig"); pub const Sphere = struct { const Self = @This(); center: c.vec3, radius: f32, fn encode(self: Self, buf: *std.ArrayList(c.vec4)) !void { try buf.append(vec3.to_vec4(self.center, self.radius)); } fn draw_gui(self: *Self) bool { var changed = c.igDragFloat3("center", @ptrCast([*c]f32, &self.center), 0.05, -10, 10, "%.2f", 0); changed = c.igDragFloat("radius", &self.radius, 0.01, 0, 10, "%.2f", 0) or changed; return changed; } }; pub const InfinitePlane = struct { const Self = @This(); normal: c.vec3, offset: f32, fn encode(self: Self, buf: *std.ArrayList(c.vec4)) !void { try buf.append(vec3.norm_to_vec4(self.normal, self.offset)); } fn draw_gui(self: *Self) bool { var changed = c.igDragFloat3("normal", @ptrCast([*c]f32, &self.normal), 0.01, -1, 1, "%.2f", 0); changed = c.igDragFloat("offset", &self.offset, 0.01, -10, 10, "%.2f", 0) or changed; return changed; } }; pub const FinitePlane = struct { const Self = @This(); normal: c.vec3, offset: f32, q: c.vec3, bounds: c.vec4, fn encode(self: Self, buf: *std.ArrayList(c.vec4)) !void { try buf.append(vec3.norm_to_vec4(self.normal, self.offset)); try buf.append(vec3.norm_to_vec4(self.q, -1)); try buf.append(self.bounds); } fn draw_gui(self: *Self) bool { var changed = c.igDragFloat3("normal", @ptrCast([*c]f32, &self.normal), 0.01, -1, 1, "%.2f", 0); changed = c.igDragFloat("offset", &self.offset, 0.05, -10, 10, "%.2f", 0) or changed; changed = c.igDragFloat3("q", @ptrCast([*c]f32, &self.q), 0.01, -1, 1, "%.2f", 0) or changed; changed = c.igDragFloat4("bounds", @ptrCast([*c]f32, &self.bounds), 0.05, -10, 10, "%.2f", 0) or changed; return changed; } }; pub const Cylinder = struct { const Self = @This(); pos: c.vec3, dir: c.vec3, radius: f32, fn encode(self: Self, buf: *std.ArrayList(c.vec4)) !void { try buf.append(vec3.to_vec4(self.pos, self.radius)); try buf.append(vec3.norm_to_vec4(self.dir, -1)); } fn draw_gui(self: *Self) bool { var changed = c.igDragFloat3("pos", @ptrCast([*c]f32, &self.pos), 0.05, -10, 10, "%.2f", 0); changed = c.igDragFloat3("dir", @ptrCast([*c]f32, &self.dir), 0.01, -1, 1, "%.2f", 0) or changed; changed = c.igDragFloat("radius", &self.radius, 0.01, 0, 10, "%.2f", 0) or changed; return changed; } }; pub const CappedCylinder = struct { const Self = @This(); pos: c.vec3, end: c.vec3, radius: f32, fn encode(self: Self, buf: *std.ArrayList(c.vec4)) !void { try buf.append(vec3.to_vec4(self.pos, self.radius)); const delta = vec3.sub(self.end, self.pos); try buf.append(vec3.norm_to_vec4(delta, vec3.length(delta))); } fn draw_gui(self: *Self) bool { var changed = c.igDragFloat3("pos", @ptrCast([*c]f32, &self.pos), 0.05, -10, 10, "%.2f", 0); changed = c.igDragFloat3("end", @ptrCast([*c]f32, &self.end), 0.05, -10, 10, "%.2f", 0) or changed; changed = c.igDragFloat("radius", &self.radius, 0.01, 0, 10, "%.2f", 0) or changed; return changed; } }; pub const Primitive = union(enum) { const Self = @This(); Sphere: Sphere, InfinitePlane: InfinitePlane, FinitePlane: FinitePlane, Cylinder: Cylinder, CappedCylinder: CappedCylinder, pub fn tag(self: Self) u32 { return switch (self) { .Sphere => c.SHAPE_SPHERE, .InfinitePlane => c.SHAPE_INFINITE_PLANE, .FinitePlane => c.SHAPE_FINITE_PLANE, .Cylinder => c.SHAPE_CYLINDER, .CappedCylinder => c.SHAPE_CAPPED_CYLINDER, }; } pub fn new_sphere(p: c.vec3, radius: f32) Self { return .{ .Sphere = Sphere{ .center = p, .radius = radius, }, }; } pub fn new_infinite_plane(p: c.vec3, offset: f32) Self { return .{ .InfinitePlane = InfinitePlane{ .normal = p, .offset = offset, }, }; } pub fn new_finite_plane(p: c.vec3, offset: f32, q: c.vec3, bounds: c.vec4) Self { return .{ .FinitePlane = FinitePlane{ .normal = p, .offset = offset, .q = q, .bounds = bounds, }, }; } pub fn new_cylinder(pos: c.vec3, dir: c.vec3, r: f32) Self { return .{ .Cylinder = Cylinder{ .pos = pos, .dir = dir, .radius = r, }, }; } pub fn new_capped_cylinder(pos: c.vec3, end: c.vec3, r: f32) Self { return .{ .CappedCylinder = CappedCylinder{ .pos = pos, .end = end, .radius = r, }, }; } pub fn encode(self: Self, buf: *std.ArrayList(c.vec4)) !void { return switch (self) { .Sphere => |s| s.encode(buf), .InfinitePlane => |s| s.encode(buf), .FinitePlane => |s| s.encode(buf), .Cylinder => |s| s.encode(buf), .CappedCylinder => |s| s.encode(buf), }; } pub fn draw_gui(self: *Self) bool { return switch (self.*) { .Sphere => |*d| d.draw_gui(), .InfinitePlane => |*d| d.draw_gui(), .FinitePlane => |*d| d.draw_gui(), .Cylinder => |*d| d.draw_gui(), .CappedCylinder => |*d| d.draw_gui(), }; } };
src/scene/primitive.zig
usingnamespace @import("bits.zig"); pub extern "kernel32" fn AddVectoredExceptionHandler(First: c_ulong, Handler: ?VECTORED_EXCEPTION_HANDLER) callconv(WINAPI) ?*c_void; pub extern "kernel32" fn RemoveVectoredExceptionHandler(Handle: HANDLE) callconv(WINAPI) c_ulong; pub extern "kernel32" fn CancelIoEx(hFile: HANDLE, lpOverlapped: ?LPOVERLAPPED) callconv(WINAPI) BOOL; pub extern "kernel32" fn CloseHandle(hObject: HANDLE) callconv(WINAPI) BOOL; pub extern "kernel32" fn CreateDirectoryW(lpPathName: [*:0]const u16, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES) callconv(WINAPI) BOOL; pub extern "kernel32" fn SetEndOfFile(hFile: HANDLE) callconv(WINAPI) BOOL; pub extern "kernel32" fn CreateEventExW( lpEventAttributes: ?*SECURITY_ATTRIBUTES, lpName: [*:0]const u16, dwFlags: DWORD, dwDesiredAccess: DWORD, ) callconv(WINAPI) ?HANDLE; pub extern "kernel32" fn CreateFileW( lpFileName: [*:0]const u16, dwDesiredAccess: DWORD, dwShareMode: DWORD, lpSecurityAttributes: ?LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, dwFlagsAndAttributes: DWORD, hTemplateFile: ?HANDLE, ) callconv(WINAPI) HANDLE; pub extern "kernel32" fn CreatePipe( hReadPipe: *HANDLE, hWritePipe: *HANDLE, lpPipeAttributes: *const SECURITY_ATTRIBUTES, nSize: DWORD, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn CreateProcessW( lpApplicationName: ?LPWSTR, lpCommandLine: LPWSTR, lpProcessAttributes: ?*SECURITY_ATTRIBUTES, lpThreadAttributes: ?*SECURITY_ATTRIBUTES, bInheritHandles: BOOL, dwCreationFlags: DWORD, lpEnvironment: ?*c_void, lpCurrentDirectory: ?LPWSTR, lpStartupInfo: *STARTUPINFOW, lpProcessInformation: *PROCESS_INFORMATION, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn CreateSymbolicLinkW(lpSymlinkFileName: [*:0]const u16, lpTargetFileName: [*:0]const u16, dwFlags: DWORD) callconv(WINAPI) BOOLEAN; pub extern "kernel32" fn CreateIoCompletionPort(FileHandle: HANDLE, ExistingCompletionPort: ?HANDLE, CompletionKey: ULONG_PTR, NumberOfConcurrentThreads: DWORD) callconv(WINAPI) ?HANDLE; pub extern "kernel32" fn CreateThread(lpThreadAttributes: ?LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: ?LPVOID, dwCreationFlags: DWORD, lpThreadId: ?LPDWORD) callconv(WINAPI) ?HANDLE; pub extern "kernel32" fn DeviceIoControl( h: HANDLE, dwIoControlCode: DWORD, lpInBuffer: ?*const c_void, nInBufferSize: DWORD, lpOutBuffer: ?LPVOID, nOutBufferSize: DWORD, lpBytesReturned: ?*DWORD, lpOverlapped: ?*OVERLAPPED, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn DeleteFileW(lpFileName: [*:0]const u16) callconv(WINAPI) BOOL; pub extern "kernel32" fn DuplicateHandle(hSourceProcessHandle: HANDLE, hSourceHandle: HANDLE, hTargetProcessHandle: HANDLE, lpTargetHandle: *HANDLE, dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwOptions: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn ExitProcess(exit_code: UINT) callconv(WINAPI) noreturn; pub extern "kernel32" fn FindFirstFileW(lpFileName: [*:0]const u16, lpFindFileData: *WIN32_FIND_DATAW) callconv(WINAPI) HANDLE; pub extern "kernel32" fn FindClose(hFindFile: HANDLE) callconv(WINAPI) BOOL; pub extern "kernel32" fn FindNextFileW(hFindFile: HANDLE, lpFindFileData: *WIN32_FIND_DATAW) callconv(WINAPI) BOOL; pub extern "kernel32" fn FormatMessageW(dwFlags: DWORD, lpSource: ?LPVOID, dwMessageId: Win32Error, dwLanguageId: DWORD, lpBuffer: [*]u16, nSize: DWORD, Arguments: ?*va_list) callconv(WINAPI) DWORD; pub extern "kernel32" fn FreeEnvironmentStringsW(penv: [*:0]u16) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetCommandLineA() callconv(WINAPI) LPSTR; pub extern "kernel32" fn GetCommandLineW() callconv(WINAPI) LPWSTR; pub extern "kernel32" fn GetConsoleMode(in_hConsoleHandle: HANDLE, out_lpMode: *DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetConsoleScreenBufferInfo(hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: *CONSOLE_SCREEN_BUFFER_INFO) callconv(WINAPI) BOOL; pub extern "kernel32" fn FillConsoleOutputCharacterA(hConsoleOutput: HANDLE, cCharacter: TCHAR, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfCharsWritten: LPDWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn FillConsoleOutputAttribute(hConsoleOutput: HANDLE, wAttribute: WORD, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfAttrsWritten: LPDWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn SetConsoleCursorPosition(hConsoleOutput: HANDLE, dwCursorPosition: COORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: ?[*]WCHAR) callconv(WINAPI) DWORD; pub extern "kernel32" fn GetCurrentThread() callconv(WINAPI) HANDLE; pub extern "kernel32" fn GetCurrentThreadId() callconv(WINAPI) DWORD; pub extern "kernel32" fn GetCurrentProcess() callconv(WINAPI) HANDLE; pub extern "kernel32" fn GetEnvironmentStringsW() callconv(WINAPI) ?[*:0]u16; pub extern "kernel32" fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: [*]u16, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: *DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetFileSizeEx(hFile: HANDLE, lpFileSize: *LARGE_INTEGER) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetFileAttributesW(lpFileName: [*]const WCHAR) callconv(WINAPI) DWORD; pub extern "kernel32" fn GetModuleFileNameW(hModule: ?HMODULE, lpFilename: [*]u16, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn GetModuleHandleW(lpModuleName: ?[*:0]const WCHAR) callconv(WINAPI) ?HMODULE; pub extern "kernel32" fn GetLastError() callconv(WINAPI) Win32Error; pub extern "kernel32" fn SetLastError(dwErrCode: Win32Error) callconv(WINAPI) void; pub extern "kernel32" fn GetFileInformationByHandle( hFile: HANDLE, lpFileInformation: *BY_HANDLE_FILE_INFORMATION, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetFileInformationByHandleEx( in_hFile: HANDLE, in_FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, out_lpFileInformation: *c_void, in_dwBufferSize: DWORD, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetFinalPathNameByHandleW( hFile: HANDLE, lpszFilePath: [*]u16, cchFilePath: DWORD, dwFlags: DWORD, ) callconv(WINAPI) DWORD; pub extern "kernel32" fn GetOverlappedResult(hFile: HANDLE, lpOverlapped: *OVERLAPPED, lpNumberOfBytesTransferred: *DWORD, bWait: BOOL) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetProcessHeap() callconv(WINAPI) ?HANDLE; pub extern "kernel32" fn GetQueuedCompletionStatus(CompletionPort: HANDLE, lpNumberOfBytesTransferred: LPDWORD, lpCompletionKey: *ULONG_PTR, lpOverlapped: *?*OVERLAPPED, dwMilliseconds: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetQueuedCompletionStatusEx( CompletionPort: HANDLE, lpCompletionPortEntries: [*]OVERLAPPED_ENTRY, ulCount: ULONG, ulNumEntriesRemoved: *ULONG, dwMilliseconds: DWORD, fAlertable: BOOL, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetSystemInfo(lpSystemInfo: *SYSTEM_INFO) callconv(WINAPI) void; pub extern "kernel32" fn GetSystemTimeAsFileTime(*FILETIME) callconv(WINAPI) void; pub extern "kernel32" fn HeapCreate(flOptions: DWORD, dwInitialSize: SIZE_T, dwMaximumSize: SIZE_T) callconv(WINAPI) ?HANDLE; pub extern "kernel32" fn HeapDestroy(hHeap: HANDLE) callconv(WINAPI) BOOL; pub extern "kernel32" fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: *c_void, dwBytes: SIZE_T) callconv(WINAPI) ?*c_void; pub extern "kernel32" fn HeapSize(hHeap: HANDLE, dwFlags: DWORD, lpMem: *const c_void) callconv(WINAPI) SIZE_T; pub extern "kernel32" fn HeapCompact(hHeap: HANDLE, dwFlags: DWORD) callconv(WINAPI) SIZE_T; pub extern "kernel32" fn HeapSummary(hHeap: HANDLE, dwFlags: DWORD, lpSummary: LPHEAP_SUMMARY) callconv(WINAPI) BOOL; pub extern "kernel32" fn GetStdHandle(in_nStdHandle: DWORD) callconv(WINAPI) ?HANDLE; pub extern "kernel32" fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) callconv(WINAPI) ?*c_void; pub extern "kernel32" fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: *c_void) callconv(WINAPI) BOOL; pub extern "kernel32" fn HeapValidate(hHeap: HANDLE, dwFlags: DWORD, lpMem: ?*const c_void) callconv(WINAPI) BOOL; pub extern "kernel32" fn VirtualAlloc(lpAddress: ?LPVOID, dwSize: SIZE_T, flAllocationType: DWORD, flProtect: DWORD) callconv(WINAPI) ?LPVOID; pub extern "kernel32" fn VirtualFree(lpAddress: ?LPVOID, dwSize: SIZE_T, dwFreeType: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn MoveFileExW( lpExistingFileName: [*:0]const u16, lpNewFileName: [*:0]const u16, dwFlags: DWORD, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn PostQueuedCompletionStatus(CompletionPort: HANDLE, dwNumberOfBytesTransferred: DWORD, dwCompletionKey: ULONG_PTR, lpOverlapped: ?*OVERLAPPED) callconv(WINAPI) BOOL; pub extern "kernel32" fn QueryPerformanceCounter(lpPerformanceCount: *LARGE_INTEGER) callconv(WINAPI) BOOL; pub extern "kernel32" fn QueryPerformanceFrequency(lpFrequency: *LARGE_INTEGER) callconv(WINAPI) BOOL; pub extern "kernel32" fn ReadDirectoryChangesW( hDirectory: HANDLE, lpBuffer: [*]align(@alignOf(FILE_NOTIFY_INFORMATION)) u8, nBufferLength: DWORD, bWatchSubtree: BOOL, dwNotifyFilter: DWORD, lpBytesReturned: ?*DWORD, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn ReadFile( in_hFile: HANDLE, out_lpBuffer: [*]u8, in_nNumberOfBytesToRead: DWORD, out_lpNumberOfBytesRead: ?*DWORD, in_out_lpOverlapped: ?*OVERLAPPED, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn RemoveDirectoryW(lpPathName: [*:0]const u16) callconv(WINAPI) BOOL; pub extern "kernel32" fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn SetConsoleCtrlHandler( HandlerRoutine: ?HANDLER_ROUTINE, Add: BOOL, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn SetFileCompletionNotificationModes( FileHandle: HANDLE, Flags: UCHAR, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn SetFilePointerEx( in_fFile: HANDLE, in_liDistanceToMove: LARGE_INTEGER, out_opt_ldNewFilePointer: ?*LARGE_INTEGER, in_dwMoveMethod: DWORD, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn SetFileTime( hFile: HANDLE, lpCreationTime: ?*const FILETIME, lpLastAccessTime: ?*const FILETIME, lpLastWriteTime: ?*const FILETIME, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn Sleep(dwMilliseconds: DWORD) callconv(WINAPI) void; pub extern "kernel32" fn SwitchToThread() callconv(WINAPI) BOOL; pub extern "kernel32" fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) callconv(WINAPI) BOOL; pub extern "kernel32" fn TlsAlloc() callconv(WINAPI) DWORD; pub extern "kernel32" fn TlsFree(dwTlsIndex: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn WaitForSingleObjectEx(hHandle: HANDLE, dwMilliseconds: DWORD, bAlertable: BOOL) callconv(WINAPI) DWORD; pub extern "kernel32" fn WaitForMultipleObjects(nCount: DWORD, lpHandle: [*]const HANDLE, bWaitAll: BOOL, dwMilliseconds: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn WaitForMultipleObjectsEx( nCount: DWORD, lpHandle: [*]const HANDLE, bWaitAll: BOOL, dwMilliseconds: DWORD, bAlertable: BOOL, ) callconv(WINAPI) DWORD; pub extern "kernel32" fn WriteFile( in_hFile: HANDLE, in_lpBuffer: [*]const u8, in_nNumberOfBytesToWrite: DWORD, out_lpNumberOfBytesWritten: ?*DWORD, in_out_lpOverlapped: ?*OVERLAPPED, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn WriteFileEx(hFile: HANDLE, lpBuffer: [*]const u8, nNumberOfBytesToWrite: DWORD, lpOverlapped: LPOVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE) callconv(WINAPI) BOOL; pub extern "kernel32" fn LoadLibraryW(lpLibFileName: [*:0]const u16) callconv(WINAPI) ?HMODULE; pub extern "kernel32" fn GetProcAddress(hModule: HMODULE, lpProcName: [*]const u8) callconv(WINAPI) ?FARPROC; pub extern "kernel32" fn FreeLibrary(hModule: HMODULE) callconv(WINAPI) BOOL; pub extern "kernel32" fn InitializeCriticalSection(lpCriticalSection: *CRITICAL_SECTION) callconv(WINAPI) void; pub extern "kernel32" fn EnterCriticalSection(lpCriticalSection: *CRITICAL_SECTION) callconv(WINAPI) void; pub extern "kernel32" fn LeaveCriticalSection(lpCriticalSection: *CRITICAL_SECTION) callconv(WINAPI) void; pub extern "kernel32" fn DeleteCriticalSection(lpCriticalSection: *CRITICAL_SECTION) callconv(WINAPI) void; pub extern "kernel32" fn InitOnceExecuteOnce(InitOnce: *INIT_ONCE, InitFn: INIT_ONCE_FN, Parameter: ?*c_void, Context: ?*c_void) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32EmptyWorkingSet(hProcess: HANDLE) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32EnumProcessModules(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, dwFilterFlag: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32EnumProcesses(lpidProcess: [*]DWORD, cb: DWORD, cbNeeded: LPDWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetDeviceDriverBaseNameW(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetDeviceDriverFileNameW(ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetMappedFileNameA(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetMappedFileNameW(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetModuleBaseNameA(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetModuleBaseNameW(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetModuleFileNameExA(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetModuleFileNameExW(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32GetPerformanceInfo(pPerformanceInformation: PPERFORMACE_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32GetProcessImageFileNameA(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetProcessImageFileNameW(hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD; pub extern "kernel32" fn K32GetProcessMemoryInfo(Process: HANDLE, ppsmemCounters: PPROCESS_MEMORY_COUNTERS, cb: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32GetWsChanges(hProcess: HANDLE, lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32GetWsChangesEx(hProcess: HANDLE, lpWatchInfoEx: PPSAPI_WS_WATCH_INFORMATION_EX, cb: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32InitializeProcessForWsWatch(hProcess: HANDLE) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn K32QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL; pub extern "kernel32" fn FlushFileBuffers(hFile: HANDLE) callconv(WINAPI) BOOL; pub extern "kernel32" fn WakeAllConditionVariable(c: *CONDITION_VARIABLE) callconv(WINAPI) void; pub extern "kernel32" fn WakeConditionVariable(c: *CONDITION_VARIABLE) callconv(WINAPI) void; pub extern "kernel32" fn SleepConditionVariableSRW( c: *CONDITION_VARIABLE, s: *SRWLOCK, t: DWORD, f: ULONG, ) callconv(WINAPI) BOOL; pub extern "kernel32" fn TryAcquireSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) BOOLEAN; pub extern "kernel32" fn AcquireSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) void; pub extern "kernel32" fn ReleaseSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) void;
lib/std/os/windows/kernel32.zig
const std = @import("../std.zig"); const builtin = @import("builtin"); const Lock = std.event.Lock; const testing = std.testing; const Allocator = std.mem.Allocator; /// ReturnType must be `void` or `E!void` /// TODO This API was created back with the old design of async/await, when calling any /// async function required an allocator. There is an ongoing experiment to transition /// all uses of this API to the simpler and more resource-aware `std.event.Batch` API. /// If the transition goes well, all usages of `Group` will be gone, and this API /// will be deleted. pub fn Group(comptime ReturnType: type) type { return struct { frame_stack: Stack, alloc_stack: AllocStack, lock: Lock, allocator: *Allocator, const Self = @This(); const Error = switch (@typeInfo(ReturnType)) { .ErrorUnion => |payload| payload.error_set, else => void, }; const Stack = std.atomic.Stack(anyframe->ReturnType); const AllocStack = std.atomic.Stack(Node); pub const Node = struct { bytes: []const u8 = &[0]u8{}, handle: anyframe->ReturnType, }; pub fn init(allocator: *Allocator) Self { return Self{ .frame_stack = Stack.init(), .alloc_stack = AllocStack.init(), .lock = Lock.init(), .allocator = allocator, }; } /// Add a frame to the group. Thread-safe. pub fn add(self: *Self, handle: anyframe->ReturnType) (error{OutOfMemory}!void) { const node = try self.allocator.create(AllocStack.Node); node.* = AllocStack.Node{ .next = undefined, .data = Node{ .handle = handle, }, }; self.alloc_stack.push(node); } /// Add a node to the group. Thread-safe. Cannot fail. /// `node.data` should be the frame handle to add to the group. /// The node's memory should be in the function frame of /// the handle that is in the node, or somewhere guaranteed to live /// at least as long. pub fn addNode(self: *Self, node: *Stack.Node) void { self.frame_stack.push(node); } /// This is equivalent to adding a frame to the group but the memory of its frame is /// allocated by the group and freed by `wait`. /// `func` must be async and have return type `ReturnType`. /// Thread-safe. pub fn call(self: *Self, comptime func: anytype, args: anytype) error{OutOfMemory}!void { var frame = try self.allocator.create(@TypeOf(@call(.{ .modifier = .async_kw }, func, args))); errdefer self.allocator.destroy(frame); const node = try self.allocator.create(AllocStack.Node); errdefer self.allocator.destroy(node); node.* = AllocStack.Node{ .next = undefined, .data = Node{ .handle = frame, .bytes = std.mem.asBytes(frame), }, }; frame.* = @call(.{ .modifier = .async_kw }, func, args); self.alloc_stack.push(node); } /// Wait for all the calls and promises of the group to complete. /// Thread-safe. /// Safe to call any number of times. pub fn wait(self: *Self) callconv(.Async) ReturnType { const held = self.lock.acquire(); defer held.release(); var result: ReturnType = {}; while (self.frame_stack.pop()) |node| { if (Error == void) { await node.data; } else { (await node.data) catch |err| { result = err; }; } } while (self.alloc_stack.pop()) |node| { const handle = node.data.handle; if (Error == void) { await handle; } else { (await handle) catch |err| { result = err; }; } self.allocator.free(node.data.bytes); self.allocator.destroy(node); } return result; } }; } test "std.event.Group" { // https://github.com/ziglang/zig/issues/1908 if (builtin.single_threaded) return error.SkipZigTest; if (!std.io.is_async) return error.SkipZigTest; const handle = async testGroup(std.heap.page_allocator); } fn testGroup(allocator: *Allocator) callconv(.Async) void { var count: usize = 0; var group = Group(void).init(allocator); var sleep_a_little_frame = async sleepALittle(&count); group.add(&sleep_a_little_frame) catch @panic("memory"); var increase_by_ten_frame = async increaseByTen(&count); group.add(&increase_by_ten_frame) catch @panic("memory"); group.wait(); testing.expect(count == 11); var another = Group(anyerror!void).init(allocator); var something_else_frame = async somethingElse(); another.add(&something_else_frame) catch @panic("memory"); var something_that_fails_frame = async doSomethingThatFails(); another.add(&something_that_fails_frame) catch @panic("memory"); testing.expectError(error.ItBroke, another.wait()); } fn sleepALittle(count: *usize) callconv(.Async) void { std.time.sleep(1 * std.time.ns_per_ms); _ = @atomicRmw(usize, count, .Add, 1, .SeqCst); } fn increaseByTen(count: *usize) callconv(.Async) void { var i: usize = 0; while (i < 10) : (i += 1) { _ = @atomicRmw(usize, count, .Add, 1, .SeqCst); } } fn doSomethingThatFails() callconv(.Async) anyerror!void {} fn somethingElse() callconv(.Async) anyerror!void { return error.ItBroke; }
lib/std/event/group.zig
const std = @import("../../std.zig"); const os = std.os; const mem = std.mem; const time = std.time; pub fn Mixin(comptime Socket: type) type { return struct { /// Open a new socket. pub fn init(domain: u32, socket_type: u32, protocol: u32, flags: std.enums.EnumFieldStruct(Socket.InitFlags, bool, false)) !Socket { var raw_flags: u32 = socket_type; const set = std.EnumSet(Socket.InitFlags).init(flags); if (set.contains(.close_on_exec)) raw_flags |= os.SOCK_CLOEXEC; if (set.contains(.nonblocking)) raw_flags |= os.SOCK_NONBLOCK; return Socket{ .fd = try os.socket(domain, raw_flags, protocol) }; } /// Closes the socket. pub fn deinit(self: Socket) void { os.closeSocket(self.fd); } /// Shutdown either the read side, write side, or all side of the socket. pub fn shutdown(self: Socket, how: os.ShutdownHow) !void { return os.shutdown(self.fd, how); } /// Binds the socket to an address. pub fn bind(self: Socket, address: Socket.Address) !void { return os.bind(self.fd, @ptrCast(*const os.sockaddr, &address.toNative()), address.getNativeSize()); } /// Start listening for incoming connections on the socket. pub fn listen(self: Socket, max_backlog_size: u31) !void { return os.listen(self.fd, max_backlog_size); } /// Have the socket attempt to the connect to an address. pub fn connect(self: Socket, address: Socket.Address) !void { return os.connect(self.fd, @ptrCast(*const os.sockaddr, &address.toNative()), address.getNativeSize()); } /// Accept a pending incoming connection queued to the kernel backlog /// of the socket. pub fn accept(self: Socket, flags: std.enums.EnumFieldStruct(Socket.InitFlags, bool, false)) !Socket.Connection { var address: Socket.Address.Native.Storage = undefined; var address_len: u32 = @sizeOf(Socket.Address.Native.Storage); var raw_flags: u32 = 0; const set = std.EnumSet(Socket.InitFlags).init(flags); if (set.contains(.close_on_exec)) raw_flags |= os.SOCK_CLOEXEC; if (set.contains(.nonblocking)) raw_flags |= os.SOCK_NONBLOCK; const socket = Socket{ .fd = try os.accept(self.fd, @ptrCast(*os.sockaddr, &address), &address_len, raw_flags) }; const socket_address = Socket.Address.fromNative(@ptrCast(*os.sockaddr, &address)); return Socket.Connection.from(socket, socket_address); } /// Read data from the socket into the buffer provided with a set of flags /// specified. It returns the number of bytes read into the buffer provided. pub fn read(self: Socket, buf: []u8, flags: u32) !usize { return os.recv(self.fd, buf, flags); } /// Write a buffer of data provided to the socket with a set of flags specified. /// It returns the number of bytes that are written to the socket. pub fn write(self: Socket, buf: []const u8, flags: u32) !usize { return os.send(self.fd, buf, flags); } /// Writes multiple I/O vectors with a prepended message header to the socket /// with a set of flags specified. It returns the number of bytes that are /// written to the socket. pub fn writeMessage(self: Socket, msg: Socket.Message, flags: u32) !usize { while (true) { const rc = os.system.sendmsg(self.fd, &msg, @intCast(c_int, flags)); return switch (os.errno(rc)) { .SUCCESS => return @intCast(usize, rc), .ACCES => error.AccessDenied, .AGAIN => error.WouldBlock, .ALREADY => error.FastOpenAlreadyInProgress, .BADF => unreachable, // always a race condition .CONNRESET => error.ConnectionResetByPeer, .DESTADDRREQ => unreachable, // The socket is not connection-mode, and no peer address is set. .FAULT => unreachable, // An invalid user space address was specified for an argument. .INTR => continue, .INVAL => unreachable, // Invalid argument passed. .ISCONN => unreachable, // connection-mode socket was connected already but a recipient was specified .MSGSIZE => error.MessageTooBig, .NOBUFS => error.SystemResources, .NOMEM => error.SystemResources, .NOTSOCK => unreachable, // The file descriptor sockfd does not refer to a socket. .OPNOTSUPP => unreachable, // Some bit in the flags argument is inappropriate for the socket type. .PIPE => error.BrokenPipe, .AFNOSUPPORT => error.AddressFamilyNotSupported, .LOOP => error.SymLinkLoop, .NAMETOOLONG => error.NameTooLong, .NOENT => error.FileNotFound, .NOTDIR => error.NotDir, .HOSTUNREACH => error.NetworkUnreachable, .NETUNREACH => error.NetworkUnreachable, .NOTCONN => error.SocketNotConnected, .NETDOWN => error.NetworkSubsystemFailed, else => |err| os.unexpectedErrno(err), }; } } /// Read multiple I/O vectors with a prepended message header from the socket /// with a set of flags specified. It returns the number of bytes that were /// read into the buffer provided. pub fn readMessage(self: Socket, msg: *Socket.Message, flags: u32) !usize { while (true) { const rc = os.system.recvmsg(self.fd, msg, @intCast(c_int, flags)); return switch (os.errno(rc)) { .SUCCESS => @intCast(usize, rc), .BADF => unreachable, // always a race condition .FAULT => unreachable, .INVAL => unreachable, .NOTCONN => unreachable, .NOTSOCK => unreachable, .INTR => continue, .AGAIN => error.WouldBlock, .NOMEM => error.SystemResources, .CONNREFUSED => error.ConnectionRefused, .CONNRESET => error.ConnectionResetByPeer, else => |err| os.unexpectedErrno(err), }; } } /// Query the address that the socket is locally bounded to. pub fn getLocalAddress(self: Socket) !Socket.Address { var address: Socket.Address.Native.Storage = undefined; var address_len: u32 = @sizeOf(Socket.Address.Native.Storage); try os.getsockname(self.fd, @ptrCast(*os.sockaddr, &address), &address_len); return Socket.Address.fromNative(@ptrCast(*os.sockaddr, &address)); } /// Query the address that the socket is connected to. pub fn getRemoteAddress(self: Socket) !Socket.Address { var address: Socket.Address.Native.Storage = undefined; var address_len: u32 = @sizeOf(Socket.Address.Native.Storage); try os.getpeername(self.fd, @ptrCast(*os.sockaddr, &address), &address_len); return Socket.Address.fromNative(@ptrCast(*os.sockaddr, &address)); } /// Query and return the latest cached error on the socket. pub fn getError(self: Socket) !void { return os.getsockoptError(self.fd); } /// Query the read buffer size of the socket. pub fn getReadBufferSize(self: Socket) !u32 { var value: u32 = undefined; var value_len: u32 = @sizeOf(u32); const rc = os.system.getsockopt(self.fd, os.SOL_SOCKET, os.SO_RCVBUF, mem.asBytes(&value), &value_len); return switch (os.errno(rc)) { .SUCCESS => value, .BADF => error.BadFileDescriptor, .FAULT => error.InvalidAddressSpace, .INVAL => error.InvalidSocketOption, .NOPROTOOPT => error.UnknownSocketOption, .NOTSOCK => error.NotASocket, else => |err| os.unexpectedErrno(err), }; } /// Query the write buffer size of the socket. pub fn getWriteBufferSize(self: Socket) !u32 { var value: u32 = undefined; var value_len: u32 = @sizeOf(u32); const rc = os.system.getsockopt(self.fd, os.SOL_SOCKET, os.SO_SNDBUF, mem.asBytes(&value), &value_len); return switch (os.errno(rc)) { .SUCCESS => value, .BADF => error.BadFileDescriptor, .FAULT => error.InvalidAddressSpace, .INVAL => error.InvalidSocketOption, .NOPROTOOPT => error.UnknownSocketOption, .NOTSOCK => error.NotASocket, else => |err| os.unexpectedErrno(err), }; } /// Set a socket option. pub fn setOption(self: Socket, level: u32, code: u32, value: []const u8) !void { return os.setsockopt(self.fd, level, code, value); } /// Have close() or shutdown() syscalls block until all queued messages in the socket have been successfully /// sent, or if the timeout specified in seconds has been reached. It returns `error.UnsupportedSocketOption` /// if the host does not support the option for a socket to linger around up until a timeout specified in /// seconds. pub fn setLinger(self: Socket, timeout_seconds: ?u16) !void { if (comptime @hasDecl(os, "SO_LINGER")) { const settings = Socket.Linger.init(timeout_seconds); return self.setOption(os.SOL_SOCKET, os.SO_LINGER, mem.asBytes(&settings)); } return error.UnsupportedSocketOption; } /// On connection-oriented sockets, have keep-alive messages be sent periodically. The timing in which keep-alive /// messages are sent are dependant on operating system settings. It returns `error.UnsupportedSocketOption` if /// the host does not support periodically sending keep-alive messages on connection-oriented sockets. pub fn setKeepAlive(self: Socket, enabled: bool) !void { if (comptime @hasDecl(os, "SO_KEEPALIVE")) { return self.setOption(os.SOL_SOCKET, os.SO_KEEPALIVE, mem.asBytes(&@as(u32, @boolToInt(enabled)))); } return error.UnsupportedSocketOption; } /// Allow multiple sockets on the same host to listen on the same address. It returns `error.UnsupportedSocketOption` if /// the host does not support sockets listening the same address. pub fn setReuseAddress(self: Socket, enabled: bool) !void { if (comptime @hasDecl(os, "SO_REUSEADDR")) { return self.setOption(os.SOL_SOCKET, os.SO_REUSEADDR, mem.asBytes(&@as(u32, @boolToInt(enabled)))); } return error.UnsupportedSocketOption; } /// Allow multiple sockets on the same host to listen on the same port. It returns `error.UnsupportedSocketOption` if /// the host does not supports sockets listening on the same port. pub fn setReusePort(self: Socket, enabled: bool) !void { if (comptime @hasDecl(os, "SO_REUSEPORT")) { return self.setOption(os.SOL_SOCKET, os.SO_REUSEPORT, mem.asBytes(&@as(u32, @boolToInt(enabled)))); } return error.UnsupportedSocketOption; } /// Set the write buffer size of the socket. pub fn setWriteBufferSize(self: Socket, size: u32) !void { return self.setOption(os.SOL_SOCKET, os.SO_SNDBUF, mem.asBytes(&size)); } /// Set the read buffer size of the socket. pub fn setReadBufferSize(self: Socket, size: u32) !void { return self.setOption(os.SOL_SOCKET, os.SO_RCVBUF, mem.asBytes(&size)); } /// WARNING: Timeouts only affect blocking sockets. It is undefined behavior if a timeout is /// set on a non-blocking socket. /// /// Set a timeout on the socket that is to occur if no messages are successfully written /// to its bound destination after a specified number of milliseconds. A subsequent write /// to the socket will thereafter return `error.WouldBlock` should the timeout be exceeded. pub fn setWriteTimeout(self: Socket, milliseconds: usize) !void { const timeout = os.timeval{ .tv_sec = @intCast(i32, milliseconds / time.ms_per_s), .tv_usec = @intCast(i32, (milliseconds % time.ms_per_s) * time.us_per_ms), }; return self.setOption(os.SOL_SOCKET, os.SO_SNDTIMEO, mem.asBytes(&timeout)); } /// WARNING: Timeouts only affect blocking sockets. It is undefined behavior if a timeout is /// set on a non-blocking socket. /// /// Set a timeout on the socket that is to occur if no messages are successfully read /// from its bound destination after a specified number of milliseconds. A subsequent /// read from the socket will thereafter return `error.WouldBlock` should the timeout be /// exceeded. pub fn setReadTimeout(self: Socket, milliseconds: usize) !void { const timeout = os.timeval{ .tv_sec = @intCast(i32, milliseconds / time.ms_per_s), .tv_usec = @intCast(i32, (milliseconds % time.ms_per_s) * time.us_per_ms), }; return self.setOption(os.SOL_SOCKET, os.SO_RCVTIMEO, mem.asBytes(&timeout)); } }; }
lib/std/x/os/socket_posix.zig
const ser = @import("../../../lib.zig").ser; /// Map serialization interface. /// /// Getty maps are only partially serialized by `getty.Serializer` /// implementations due to the fact that there are many different ways to /// iterate over and access the keys and values of a map. As such, this /// interface is provided so that serialization may be driven and completed by /// the user of a serializer. /// /// The interface specifies the following: /// /// - How to serialize a key of a map. /// - How to serialize a value of a map. /// - How to finish serialization for a map. /// /// Parameters /// ========== /// /// Context /// ------- /// /// This is the type that implements `getty.ser.Map` (or a pointer to it). /// /// Ok /// -- /// /// The successful return type for all of `getty.ser.Map`'s methods. /// /// Error /// ----- /// /// The error set used by all of `getty.ser.Map`'s methods upon failure. /// /// serializeKey /// ------------ /// /// A method that serializes a key of a map. /// /// serializeValue /// -------------- /// /// A method that serializes a value of a map. /// /// end /// --- /// /// A method that ends the serialization of a map. /// /// Examples /// ======== /// /// ```zig /// const map_sb = struct { /// pub fn is(comptime T: type) bool { /// return T == struct { x: i32, y: i32 }; /// } /// /// pub fn serialize(value: anytype, serializer: anytype) !@TypeOf(serializer).Ok { /// // Begin map serialization. /// const map = (try serializer.serializeMap(2)).map(); /// /// // Serialize map entries. /// try map.serializeKey("x"); /// try map.serializeValue(map.x); /// try map.serializeKey("y"); /// try map.serializeValue(map.y); /// /// // End map serialization. /// return try map.end(); /// } /// }; /// ``` pub fn Map( comptime Context: type, comptime Ok: type, comptime Error: type, comptime serializeKey: fn (Context, anytype) Error!void, comptime serializeValue: fn (Context, anytype) Error!void, comptime end: fn (Context) Error!Ok, ) type { return struct { pub const @"getty.ser.Map" = struct { context: Context, const Self = @This(); /// Successful return type. pub const Ok = Ok; /// The error set used upon failure. pub const Error = Error; /// Serialize a map key. pub fn serializeKey(self: Self, key: anytype) Error!void { try serializeKey(self.context, key); } /// Serialize a map value. pub fn serializeValue(self: Self, value: anytype) Error!void { try serializeValue(self.context, value); } /// Serialize a map entry consisting of a key and a value. pub fn serializeEntry(self: Self, key: anytype, value: anytype) Error!void { try self.serializeKey(key); try self.serializeValue(value); } /// Finish serializing a struct. pub fn end(self: Self) Error!Ok { return try end(self.context); } }; pub fn map(self: Context) @"getty.ser.Map" { return .{ .context = self }; } }; }
src/ser/interface/map.zig
const std = @import("std"); const fs = std.fs; const io = std.io; const info = std.log.info; const print = std.debug.print; const fmt = std.fmt; const utils = @import("utils.zig"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; pub fn parseBusId(data: []const u8) ?usize { if (std.mem.eql(u8, data, "x")) { return null; } const bus_id = fmt.parseInt(usize, data, 10) catch unreachable; return bus_id; } pub fn main() !void { const begin = @divTrunc(std.time.nanoTimestamp(), 1000); // setup // defer _ = gpa.deinit(); var allo = &gpa.allocator; var lines: std.mem.TokenIterator = try utils.readInputLines(allo, "./input1"); defer allo.free(lines.buffer); const first_line = lines.next() orelse unreachable; const second_line = lines.next() orelse unreachable; var p1_low = fmt.parseInt(usize, first_line, 10) catch unreachable; const sched: []const u8 = second_line; // p1 // var i = p1_low; const res: usize = outer: while (true) : (i += 1) { var iter = std.mem.tokenize(sched, ","); while (iter.next()) |token| { const bus_id = parseBusId(token) orelse continue; if (i % bus_id == 0) { const res = bus_id * (i - p1_low); break :outer res; } } } else unreachable; print("p1: {}\n", .{res}); // p2 // var idx: usize = 0; var product: usize = 1; var interval: usize = 0; var iter = std.mem.tokenize(sched, ","); var prev_product: usize = 0; while (iter.next()) |next| : (idx += 1) { const bus_id = parseBusId(next) orelse continue; info(">> bus: {} @ {} / product: {} inter {} ", .{ bus_id, idx, product, interval }); if (product == 1) { product = bus_id; interval = bus_id; continue; } var from: usize = 0; while (true) { if ((product + idx) % bus_id == 0) { if (from == 0) { prev_product = product; from = product; } else { interval = product - from; break; } } product += interval; } } print("p2: {}\n", .{prev_product}); const delta = @divTrunc(std.time.nanoTimestamp(), 1000) - begin; print("all done in {} microseconds\n", .{delta}); }
day_13/src/main.zig
const std = @import("std.zig"); const builtin = @import("builtin"); const os = std.os; const assert = std.debug.assert; const target = builtin.target; const Atomic = std.atomic.Atomic; pub const AutoResetEvent = @import("Thread/AutoResetEvent.zig"); pub const Futex = @import("Thread/Futex.zig"); pub const ResetEvent = @import("Thread/ResetEvent.zig"); pub const StaticResetEvent = @import("Thread/StaticResetEvent.zig"); pub const Mutex = @import("Thread/Mutex.zig"); pub const Semaphore = @import("Thread/Semaphore.zig"); pub const Condition = @import("Thread/Condition.zig"); pub const use_pthreads = target.os.tag != .windows and target.os.tag != .wasi and builtin.link_libc; const is_gnu = target.abi.isGnu(); const Thread = @This(); const Impl = if (target.os.tag == .windows) WindowsThreadImpl else if (use_pthreads) PosixThreadImpl else if (target.os.tag == .linux) LinuxThreadImpl else UnsupportedImpl; impl: Impl, pub const max_name_len = switch (target.os.tag) { .linux => 15, .windows => 31, .macos, .ios, .watchos, .tvos => 63, .netbsd => 31, .freebsd => 15, .openbsd => 31, .dragonfly => 1023, .solaris => 31, else => 0, }; pub const SetNameError = error{ NameTooLong, Unsupported, Unexpected, } || os.PrctlError || os.WriteError || std.fs.File.OpenError || std.fmt.BufPrintError; pub fn setName(self: Thread, name: []const u8) SetNameError!void { if (name.len > max_name_len) return error.NameTooLong; const name_with_terminator = blk: { var name_buf: [max_name_len:0]u8 = undefined; std.mem.copy(u8, &name_buf, name); name_buf[name.len] = 0; break :blk name_buf[0..name.len :0]; }; switch (target.os.tag) { .linux => if (use_pthreads) { const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr); switch (err) { .SUCCESS => return, .RANGE => unreachable, else => |e| return os.unexpectedErrno(e), } } else if (use_pthreads and self.getHandle() == std.c.pthread_self()) { // TODO: this is dead code. what did the author of this code intend to happen here? const err = try os.prctl(.SET_NAME, .{@ptrToInt(name_with_terminator.ptr)}); switch (@intToEnum(os.E, err)) { .SUCCESS => return, else => |e| return os.unexpectedErrno(e), } } else { var buf: [32]u8 = undefined; const path = try std.fmt.bufPrint(&buf, "/proc/self/task/{d}/comm", .{self.getHandle()}); const file = try std.fs.cwd().openFile(path, .{ .write = true }); defer file.close(); try file.writer().writeAll(name); return; }, .windows => if (target.os.isAtLeast(.windows, .win10_rs1)) |res| { // SetThreadDescription is only available since version 1607, which is 10.0.14393.795 // See https://en.wikipedia.org/wiki/Microsoft_Windows_SDK if (!res) return error.Unsupported; var name_buf_w: [max_name_len:0]u16 = undefined; const length = try std.unicode.utf8ToUtf16Le(&name_buf_w, name); name_buf_w[length] = 0; try os.windows.SetThreadDescription( self.getHandle(), @ptrCast(os.windows.LPWSTR, &name_buf_w), ); return; }, .macos, .ios, .watchos, .tvos => if (use_pthreads) { // There doesn't seem to be a way to set the name for an arbitrary thread, only the current one. if (self.getHandle() != std.c.pthread_self()) return error.Unsupported; const err = std.c.pthread_setname_np(name_with_terminator.ptr); switch (err) { .SUCCESS => return, else => |e| return os.unexpectedErrno(e), } }, .netbsd, .solaris => if (use_pthreads) { const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr, null); switch (err) { .SUCCESS => return, .INVAL => unreachable, .SRCH => unreachable, .NOMEM => unreachable, else => |e| return os.unexpectedErrno(e), } }, .freebsd, .openbsd => if (use_pthreads) { // Use pthread_set_name_np for FreeBSD because pthread_setname_np is FreeBSD 12.2+ only. // TODO maybe revisit this if depending on FreeBSD 12.2+ is acceptable because // pthread_setname_np can return an error. std.c.pthread_set_name_np(self.getHandle(), name_with_terminator.ptr); return; }, .dragonfly => if (use_pthreads) { const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr); switch (err) { .SUCCESS => return, .INVAL => unreachable, .FAULT => unreachable, .NAMETOOLONG => unreachable, // already checked .SRCH => unreachable, else => |e| return os.unexpectedErrno(e), } }, else => {}, } return error.Unsupported; } pub const GetNameError = error{ // For Windows, the name is converted from UTF16 to UTF8 CodepointTooLarge, Utf8CannotEncodeSurrogateHalf, DanglingSurrogateHalf, ExpectedSecondSurrogateHalf, UnexpectedSecondSurrogateHalf, Unsupported, Unexpected, } || os.PrctlError || os.ReadError || std.fs.File.OpenError || std.fmt.BufPrintError; pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]const u8 { buffer_ptr[max_name_len] = 0; var buffer = std.mem.span(buffer_ptr); switch (target.os.tag) { .linux => if (use_pthreads and is_gnu) { const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); switch (err) { .SUCCESS => return std.mem.sliceTo(buffer, 0), .RANGE => unreachable, else => |e| return os.unexpectedErrno(e), } } else if (use_pthreads and self.getHandle() == std.c.pthread_self()) { const err = try os.prctl(.GET_NAME, .{@ptrToInt(buffer.ptr)}); switch (@intToEnum(os.E, err)) { .SUCCESS => return std.mem.sliceTo(buffer, 0), else => |e| return os.unexpectedErrno(e), } } else if (!use_pthreads) { var buf: [32]u8 = undefined; const path = try std.fmt.bufPrint(&buf, "/proc/self/task/{d}/comm", .{self.getHandle()}); const file = try std.fs.cwd().openFile(path, .{}); defer file.close(); const data_len = try file.reader().readAll(buffer_ptr[0 .. max_name_len + 1]); return if (data_len >= 1) buffer[0 .. data_len - 1] else null; } else { // musl doesn't provide pthread_getname_np and there's no way to retrieve the thread id of an arbitrary thread. return error.Unsupported; }, .windows => if (target.os.isAtLeast(.windows, .win10_rs1)) |res| { // GetThreadDescription is only available since version 1607, which is 10.0.14393.795 // See https://en.wikipedia.org/wiki/Microsoft_Windows_SDK if (!res) return error.Unsupported; var name_w: os.windows.LPWSTR = undefined; try os.windows.GetThreadDescription(self.getHandle(), &name_w); defer os.windows.LocalFree(name_w); const data_len = try std.unicode.utf16leToUtf8(buffer, std.mem.sliceTo(name_w, 0)); return if (data_len >= 1) buffer[0..data_len] else null; }, .macos, .ios, .watchos, .tvos => if (use_pthreads) { const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); switch (err) { .SUCCESS => return std.mem.sliceTo(buffer, 0), .SRCH => unreachable, else => |e| return os.unexpectedErrno(e), } }, .netbsd, .solaris => if (use_pthreads) { const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); switch (err) { .SUCCESS => return std.mem.sliceTo(buffer, 0), .INVAL => unreachable, .SRCH => unreachable, else => |e| return os.unexpectedErrno(e), } }, .freebsd, .openbsd => if (use_pthreads) { // Use pthread_get_name_np for FreeBSD because pthread_getname_np is FreeBSD 12.2+ only. // TODO maybe revisit this if depending on FreeBSD 12.2+ is acceptable because pthread_getname_np can return an error. std.c.pthread_get_name_np(self.getHandle(), buffer.ptr, max_name_len + 1); return std.mem.sliceTo(buffer, 0); }, .dragonfly => if (use_pthreads) { const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); switch (err) { .SUCCESS => return std.mem.sliceTo(buffer, 0), .INVAL => unreachable, .FAULT => unreachable, .SRCH => unreachable, else => |e| return os.unexpectedErrno(e), } }, else => {}, } return error.Unsupported; } /// Represents a unique ID per thread. pub const Id = u64; /// Returns the platform ID of the callers thread. /// Attempts to use thread locals and avoid syscalls when possible. pub fn getCurrentId() Id { return Impl.getCurrentId(); } pub const CpuCountError = error{ PermissionDenied, SystemResources, Unexpected, }; /// Returns the platforms view on the number of logical CPU cores available. pub fn getCpuCount() CpuCountError!usize { return Impl.getCpuCount(); } /// Configuration options for hints on how to spawn threads. pub const SpawnConfig = struct { // TODO compile-time call graph analysis to determine stack upper bound // https://github.com/ziglang/zig/issues/157 /// Size in bytes of the Thread's stack stack_size: usize = 16 * 1024 * 1024, }; pub const SpawnError = error{ /// A system-imposed limit on the number of threads was encountered. /// There are a number of limits that may trigger this error: /// * the RLIMIT_NPROC soft resource limit (set via setrlimit(2)), /// which limits the number of processes and threads for a real /// user ID, was reached; /// * the kernel's system-wide limit on the number of processes and /// threads, /proc/sys/kernel/threads-max, was reached (see /// proc(5)); /// * the maximum number of PIDs, /proc/sys/kernel/pid_max, was /// reached (see proc(5)); or /// * the PID limit (pids.max) imposed by the cgroup "process num‐ /// ber" (PIDs) controller was reached. ThreadQuotaExceeded, /// The kernel cannot allocate sufficient memory to allocate a task structure /// for the child, or to copy those parts of the caller's context that need to /// be copied. SystemResources, /// Not enough userland memory to spawn the thread. OutOfMemory, /// `mlockall` is enabled, and the memory needed to spawn the thread /// would exceed the limit. LockedMemoryLimitExceeded, Unexpected, }; /// Spawns a new thread which executes `function` using `args` and returns a handle the spawned thread. /// `config` can be used as hints to the platform for now to spawn and execute the `function`. /// The caller must eventually either call `join()` to wait for the thread to finish and free its resources /// or call `detach()` to excuse the caller from calling `join()` and have the thread clean up its resources on completion`. pub fn spawn(config: SpawnConfig, comptime function: anytype, args: anytype) SpawnError!Thread { if (builtin.single_threaded) { @compileError("Cannot spawn thread when building in single-threaded mode"); } const impl = try Impl.spawn(config, function, args); return Thread{ .impl = impl }; } /// Represents a kernel thread handle. /// May be an integer or a pointer depending on the platform. pub const Handle = Impl.ThreadHandle; /// Retrns the handle of this thread pub fn getHandle(self: Thread) Handle { return self.impl.getHandle(); } /// Release the obligation of the caller to call `join()` and have the thread clean up its own resources on completion. /// Once called, this consumes the Thread object and invoking any other functions on it is considered undefined behavior. pub fn detach(self: Thread) void { return self.impl.detach(); } /// Waits for the thread to complete, then deallocates any resources created on `spawn()`. /// Once called, this consumes the Thread object and invoking any other functions on it is considered undefined behavior. pub fn join(self: Thread) void { return self.impl.join(); } /// State to synchronize detachment of spawner thread to spawned thread const Completion = Atomic(enum(u8) { running, detached, completed, }); /// Used by the Thread implementations to call the spawned function with the arguments. fn callFn(comptime f: anytype, args: anytype) switch (Impl) { WindowsThreadImpl => std.os.windows.DWORD, LinuxThreadImpl => u8, PosixThreadImpl => ?*anyopaque, else => unreachable, } { const default_value = if (Impl == PosixThreadImpl) null else 0; const bad_fn_ret = "expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'"; // Hack to work around stage1 compiler limitations if (@typeInfo(@TypeOf(f)).Fn.return_type == null) { @call(.{}, f, args); return default_value; } else { switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) { .NoReturn => { @call(.{}, f, args); }, .Void => { @call(.{}, f, args); return default_value; }, .Int => |info| { if (info.bits != 8) { @compileError(bad_fn_ret); } const status = @call(.{}, f, args); if (Impl != PosixThreadImpl) { return status; } // pthreads don't support exit status, ignore value _ = status; return default_value; }, .ErrorUnion => |info| { if (info.payload != void) { @compileError(bad_fn_ret); } @call(.{}, f, args) catch |err| { std.debug.print("error: {s}\n", .{@errorName(err)}); if (@errorReturnTrace()) |trace| { std.debug.dumpStackTrace(trace.*); } }; return default_value; }, else => { @compileError(bad_fn_ret); }, } } } /// We can't compile error in the `Impl` switch statement as its eagerly evaluated. /// So instead, we compile-error on the methods themselves for platforms which don't support threads. const UnsupportedImpl = struct { pub const ThreadHandle = void; fn getCurrentId() u64 { return unsupported({}); } fn getCpuCount() !usize { return unsupported({}); } fn spawn(config: SpawnConfig, comptime f: anytype, args: anytype) !Impl { return unsupported(.{ config, f, args }); } fn getHandle(self: Impl) ThreadHandle { return unsupported(self); } fn detach(self: Impl) void { return unsupported(self); } fn join(self: Impl) void { return unsupported(self); } fn unsupported(unusued: anytype) noreturn { @compileLog("Unsupported operating system", target.os.tag); _ = unusued; unreachable; } }; const WindowsThreadImpl = struct { const windows = os.windows; pub const ThreadHandle = windows.HANDLE; fn getCurrentId() u64 { return windows.kernel32.GetCurrentThreadId(); } fn getCpuCount() !usize { // Faster than calling into GetSystemInfo(), even if amortized. return windows.peb().NumberOfProcessors; } thread: *ThreadCompletion, const ThreadCompletion = struct { completion: Completion, heap_ptr: windows.PVOID, heap_handle: windows.HANDLE, thread_handle: windows.HANDLE = undefined, fn free(self: ThreadCompletion) void { const status = windows.kernel32.HeapFree(self.heap_handle, 0, self.heap_ptr); assert(status != 0); } }; fn spawn(config: SpawnConfig, comptime f: anytype, args: anytype) !Impl { const Args = @TypeOf(args); const Instance = struct { fn_args: Args, thread: ThreadCompletion, fn entryFn(raw_ptr: windows.PVOID) callconv(.C) windows.DWORD { const self = @ptrCast(*@This(), @alignCast(@alignOf(@This()), raw_ptr)); defer switch (self.thread.completion.swap(.completed, .SeqCst)) { .running => {}, .completed => unreachable, .detached => self.thread.free(), }; return callFn(f, self.fn_args); } }; const heap_handle = windows.kernel32.GetProcessHeap() orelse return error.OutOfMemory; const alloc_bytes = @alignOf(Instance) + @sizeOf(Instance); const alloc_ptr = windows.kernel32.HeapAlloc(heap_handle, 0, alloc_bytes) orelse return error.OutOfMemory; errdefer assert(windows.kernel32.HeapFree(heap_handle, 0, alloc_ptr) != 0); const instance_bytes = @ptrCast([*]u8, alloc_ptr)[0..alloc_bytes]; const instance = std.heap.FixedBufferAllocator.init(instance_bytes).allocator().create(Instance) catch unreachable; instance.* = .{ .fn_args = args, .thread = .{ .completion = Completion.init(.running), .heap_ptr = alloc_ptr, .heap_handle = heap_handle, }, }; // Windows appears to only support SYSTEM_INFO.dwAllocationGranularity minimum stack size. // Going lower makes it default to that specified in the executable (~1mb). // Its also fine if the limit here is incorrect as stack size is only a hint. var stack_size = std.math.cast(u32, config.stack_size) catch std.math.maxInt(u32); stack_size = std.math.max(64 * 1024, stack_size); instance.thread.thread_handle = windows.kernel32.CreateThread( null, stack_size, Instance.entryFn, @ptrCast(*anyopaque, instance), 0, null, ) orelse { const errno = windows.kernel32.GetLastError(); return windows.unexpectedError(errno); }; return Impl{ .thread = &instance.thread }; } fn getHandle(self: Impl) ThreadHandle { return self.thread.thread_handle; } fn detach(self: Impl) void { windows.CloseHandle(self.thread.thread_handle); switch (self.thread.completion.swap(.detached, .SeqCst)) { .running => {}, .completed => self.thread.free(), .detached => unreachable, } } fn join(self: Impl) void { windows.WaitForSingleObjectEx(self.thread.thread_handle, windows.INFINITE, false) catch unreachable; windows.CloseHandle(self.thread.thread_handle); assert(self.thread.completion.load(.SeqCst) == .completed); self.thread.free(); } }; const PosixThreadImpl = struct { const c = std.c; pub const ThreadHandle = c.pthread_t; fn getCurrentId() Id { switch (target.os.tag) { .linux => { return LinuxThreadImpl.getCurrentId(); }, .macos, .ios, .watchos, .tvos => { var thread_id: u64 = undefined; // Pass thread=null to get the current thread ID. assert(c.pthread_threadid_np(null, &thread_id) == 0); return thread_id; }, .dragonfly => { return @bitCast(u32, c.lwp_gettid()); }, .netbsd => { return @bitCast(u32, c._lwp_self()); }, .freebsd => { return @bitCast(u32, c.pthread_getthreadid_np()); }, .openbsd => { return @bitCast(u32, c.getthrid()); }, .haiku => { return @bitCast(u32, c.find_thread(null)); }, else => { return @ptrToInt(c.pthread_self()); }, } } fn getCpuCount() !usize { switch (target.os.tag) { .linux => { return LinuxThreadImpl.getCpuCount(); }, .openbsd => { var count: c_int = undefined; var count_size: usize = @sizeOf(c_int); const mib = [_]c_int{ os.CTL.HW, os.system.HW_NCPUONLINE }; os.sysctl(&mib, &count, &count_size, null, 0) catch |err| switch (err) { error.NameTooLong, error.UnknownName => unreachable, else => |e| return e, }; return @intCast(usize, count); }, .solaris => { // The "proper" way to get the cpu count would be to query // /dev/kstat via ioctls, and traverse a linked list for each // cpu. const rc = c.sysconf(os._SC.NPROCESSORS_ONLN); return switch (os.errno(rc)) { .SUCCESS => @intCast(usize, rc), else => |err| os.unexpectedErrno(err), }; }, .haiku => { var system_info: os.system.system_info = undefined; const rc = os.system.get_system_info(&system_info); // always returns B_OK return switch (os.errno(rc)) { .SUCCESS => @intCast(usize, system_info.cpu_count), else => |err| os.unexpectedErrno(err), }; }, else => { var count: c_int = undefined; var count_len: usize = @sizeOf(c_int); const name = if (comptime target.isDarwin()) "hw.logicalcpu" else "hw.ncpu"; os.sysctlbynameZ(name, &count, &count_len, null, 0) catch |err| switch (err) { error.NameTooLong, error.UnknownName => unreachable, else => |e| return e, }; return @intCast(usize, count); }, } } handle: ThreadHandle, fn spawn(config: SpawnConfig, comptime f: anytype, args: anytype) !Impl { const Args = @TypeOf(args); const allocator = std.heap.c_allocator; const Instance = struct { fn entryFn(raw_arg: ?*anyopaque) callconv(.C) ?*anyopaque { // @alignCast() below doesn't support zero-sized-types (ZST) if (@sizeOf(Args) < 1) { return callFn(f, @as(Args, undefined)); } const args_ptr = @ptrCast(*Args, @alignCast(@alignOf(Args), raw_arg)); defer allocator.destroy(args_ptr); return callFn(f, args_ptr.*); } }; const args_ptr = try allocator.create(Args); args_ptr.* = args; errdefer allocator.destroy(args_ptr); var attr: c.pthread_attr_t = undefined; if (c.pthread_attr_init(&attr) != .SUCCESS) return error.SystemResources; defer assert(c.pthread_attr_destroy(&attr) == .SUCCESS); // Use the same set of parameters used by the libc-less impl. const stack_size = std.math.max(config.stack_size, 16 * 1024); assert(c.pthread_attr_setstacksize(&attr, stack_size) == .SUCCESS); assert(c.pthread_attr_setguardsize(&attr, std.mem.page_size) == .SUCCESS); var handle: c.pthread_t = undefined; switch (c.pthread_create( &handle, &attr, Instance.entryFn, if (@sizeOf(Args) > 1) @ptrCast(*anyopaque, args_ptr) else undefined, )) { .SUCCESS => return Impl{ .handle = handle }, .AGAIN => return error.SystemResources, .PERM => unreachable, .INVAL => unreachable, else => |err| return os.unexpectedErrno(err), } } fn getHandle(self: Impl) ThreadHandle { return self.handle; } fn detach(self: Impl) void { switch (c.pthread_detach(self.handle)) { .SUCCESS => {}, .INVAL => unreachable, // thread handle is not joinable .SRCH => unreachable, // thread handle is invalid else => unreachable, } } fn join(self: Impl) void { switch (c.pthread_join(self.handle, null)) { .SUCCESS => {}, .INVAL => unreachable, // thread handle is not joinable (or another thread is already joining in) .SRCH => unreachable, // thread handle is invalid .DEADLK => unreachable, // two threads tried to join each other else => unreachable, } } }; const LinuxThreadImpl = struct { const linux = os.linux; pub const ThreadHandle = i32; threadlocal var tls_thread_id: ?Id = null; fn getCurrentId() Id { return tls_thread_id orelse { const tid = @bitCast(u32, linux.gettid()); tls_thread_id = tid; return tid; }; } fn getCpuCount() !usize { const cpu_set = try os.sched_getaffinity(0); // TODO: should not need this usize cast return @as(usize, os.CPU_COUNT(cpu_set)); } thread: *ThreadCompletion, const ThreadCompletion = struct { completion: Completion = Completion.init(.running), child_tid: Atomic(i32) = Atomic(i32).init(1), parent_tid: i32 = undefined, mapped: []align(std.mem.page_size) u8, /// Calls `munmap(mapped.ptr, mapped.len)` then `exit(1)` without touching the stack (which lives in `mapped.ptr`). /// Ported over from musl libc's pthread detached implementation: /// https://github.com/ifduyue/musl/search?q=__unmapself fn freeAndExit(self: *ThreadCompletion) noreturn { switch (target.cpu.arch) { .i386 => asm volatile ( \\ movl $91, %%eax \\ movl %[ptr], %%ebx \\ movl %[len], %%ecx \\ int $128 \\ movl $1, %%eax \\ movl $0, %%ebx \\ int $128 : : [ptr] "r" (@ptrToInt(self.mapped.ptr)), [len] "r" (self.mapped.len), : "memory" ), .x86_64 => asm volatile ( \\ movq $11, %%rax \\ movq %[ptr], %%rbx \\ movq %[len], %%rcx \\ syscall \\ movq $60, %%rax \\ movq $1, %%rdi \\ syscall : : [ptr] "r" (@ptrToInt(self.mapped.ptr)), [len] "r" (self.mapped.len), : "memory" ), .arm, .armeb, .thumb, .thumbeb => asm volatile ( \\ mov r7, #91 \\ mov r0, %[ptr] \\ mov r1, %[len] \\ svc 0 \\ mov r7, #1 \\ mov r0, #0 \\ svc 0 : : [ptr] "r" (@ptrToInt(self.mapped.ptr)), [len] "r" (self.mapped.len), : "memory" ), .aarch64, .aarch64_be, .aarch64_32 => asm volatile ( \\ mov x8, #215 \\ mov x0, %[ptr] \\ mov x1, %[len] \\ svc 0 \\ mov x8, #93 \\ mov x0, #0 \\ svc 0 : : [ptr] "r" (@ptrToInt(self.mapped.ptr)), [len] "r" (self.mapped.len), : "memory" ), .mips, .mipsel => asm volatile ( \\ move $sp, $25 \\ li $2, 4091 \\ move $4, %[ptr] \\ move $5, %[len] \\ syscall \\ li $2, 4001 \\ li $4, 0 \\ syscall : : [ptr] "r" (@ptrToInt(self.mapped.ptr)), [len] "r" (self.mapped.len), : "memory" ), .mips64, .mips64el => asm volatile ( \\ li $2, 4091 \\ move $4, %[ptr] \\ move $5, %[len] \\ syscall \\ li $2, 4001 \\ li $4, 0 \\ syscall : : [ptr] "r" (@ptrToInt(self.mapped.ptr)), [len] "r" (self.mapped.len), : "memory" ), .powerpc, .powerpcle, .powerpc64, .powerpc64le => asm volatile ( \\ li 0, 91 \\ mr %[ptr], 3 \\ mr %[len], 4 \\ sc \\ li 0, 1 \\ li 3, 0 \\ sc \\ blr : : [ptr] "r" (@ptrToInt(self.mapped.ptr)), [len] "r" (self.mapped.len), : "memory" ), .riscv64 => asm volatile ( \\ li a7, 215 \\ mv a0, %[ptr] \\ mv a1, %[len] \\ ecall \\ li a7, 93 \\ mv a0, zero \\ ecall : : [ptr] "r" (@ptrToInt(self.mapped.ptr)), [len] "r" (self.mapped.len), : "memory" ), .sparcv9 => asm volatile ( \\ # SPARCs really don't like it when active stack frames \\ # is unmapped (it will result in a segfault), so we \\ # force-deactivate it by running `restore` until \\ # all frames are cleared. \\ 1: \\ cmp %%fp, 0 \\ beq 2f \\ nop \\ ba 1b \\ restore \\ 2: \\ mov 73, %%g1 \\ mov %[ptr], %%o0 \\ mov %[len], %%o1 \\ # Flush register window contents to prevent background \\ # memory access before unmapping the stack. \\ flushw \\ t 0x6d \\ mov 1, %%g1 \\ mov 1, %%o0 \\ t 0x6d : : [ptr] "r" (@ptrToInt(self.mapped.ptr)), [len] "r" (self.mapped.len), : "memory" ), else => |cpu_arch| @compileError("Unsupported linux arch: " ++ @tagName(cpu_arch)), } unreachable; } }; fn spawn(config: SpawnConfig, comptime f: anytype, args: anytype) !Impl { const Args = @TypeOf(args); const Instance = struct { fn_args: Args, thread: ThreadCompletion, fn entryFn(raw_arg: usize) callconv(.C) u8 { const self = @intToPtr(*@This(), raw_arg); defer switch (self.thread.completion.swap(.completed, .SeqCst)) { .running => {}, .completed => unreachable, .detached => self.thread.freeAndExit(), }; return callFn(f, self.fn_args); } }; var guard_offset: usize = undefined; var stack_offset: usize = undefined; var tls_offset: usize = undefined; var instance_offset: usize = undefined; const map_bytes = blk: { var bytes: usize = std.mem.page_size; guard_offset = bytes; bytes += std.math.max(std.mem.page_size, config.stack_size); bytes = std.mem.alignForward(bytes, std.mem.page_size); stack_offset = bytes; bytes = std.mem.alignForward(bytes, linux.tls.tls_image.alloc_align); tls_offset = bytes; bytes += linux.tls.tls_image.alloc_size; bytes = std.mem.alignForward(bytes, @alignOf(Instance)); instance_offset = bytes; bytes += @sizeOf(Instance); bytes = std.mem.alignForward(bytes, std.mem.page_size); break :blk bytes; }; // map all memory needed without read/write permissions // to avoid committing the whole region right away const mapped = os.mmap( null, map_bytes, os.PROT.NONE, os.MAP.PRIVATE | os.MAP.ANONYMOUS, -1, 0, ) catch |err| switch (err) { error.MemoryMappingNotSupported => unreachable, error.AccessDenied => unreachable, error.PermissionDenied => unreachable, else => |e| return e, }; assert(mapped.len >= map_bytes); errdefer os.munmap(mapped); // map everything but the guard page as read/write os.mprotect( mapped[guard_offset..], os.PROT.READ | os.PROT.WRITE, ) catch |err| switch (err) { error.AccessDenied => unreachable, else => |e| return e, }; // Prepare the TLS segment and prepare a user_desc struct when needed on i386 var tls_ptr = os.linux.tls.prepareTLS(mapped[tls_offset..]); var user_desc: if (target.cpu.arch == .i386) os.linux.user_desc else void = undefined; if (target.cpu.arch == .i386) { defer tls_ptr = @ptrToInt(&user_desc); user_desc = .{ .entry_number = os.linux.tls.tls_image.gdt_entry_number, .base_addr = tls_ptr, .limit = 0xfffff, .seg_32bit = 1, .contents = 0, // Data .read_exec_only = 0, .limit_in_pages = 1, .seg_not_present = 0, .useable = 1, }; } const instance = @ptrCast(*Instance, @alignCast(@alignOf(Instance), &mapped[instance_offset])); instance.* = .{ .fn_args = args, .thread = .{ .mapped = mapped }, }; const flags: u32 = linux.CLONE.THREAD | linux.CLONE.DETACHED | linux.CLONE.VM | linux.CLONE.FS | linux.CLONE.FILES | linux.CLONE.PARENT_SETTID | linux.CLONE.CHILD_CLEARTID | linux.CLONE.SIGHAND | linux.CLONE.SYSVSEM | linux.CLONE.SETTLS; switch (linux.getErrno(linux.clone( Instance.entryFn, @ptrToInt(&mapped[stack_offset]), flags, @ptrToInt(instance), &instance.thread.parent_tid, tls_ptr, &instance.thread.child_tid.value, ))) { .SUCCESS => return Impl{ .thread = &instance.thread }, .AGAIN => return error.ThreadQuotaExceeded, .INVAL => unreachable, .NOMEM => return error.SystemResources, .NOSPC => unreachable, .PERM => unreachable, .USERS => unreachable, else => |err| return os.unexpectedErrno(err), } } fn getHandle(self: Impl) ThreadHandle { return self.thread.parent_tid; } fn detach(self: Impl) void { switch (self.thread.completion.swap(.detached, .SeqCst)) { .running => {}, .completed => self.join(), .detached => unreachable, } } fn join(self: Impl) void { defer os.munmap(self.thread.mapped); var spin: u8 = 10; while (true) { const tid = self.thread.child_tid.load(.SeqCst); if (tid == 0) { break; } if (spin > 0) { spin -= 1; std.atomic.spinLoopHint(); continue; } switch (linux.getErrno(linux.futex_wait( &self.thread.child_tid.value, linux.FUTEX.WAIT, tid, null, ))) { .SUCCESS => continue, .INTR => continue, .AGAIN => continue, else => unreachable, } } } }; fn testThreadName(thread: *Thread) !void { const testCases = &[_][]const u8{ "mythread", "b" ** max_name_len, }; inline for (testCases) |tc| { try thread.setName(tc); var name_buffer: [max_name_len:0]u8 = undefined; const name = try thread.getName(&name_buffer); if (name) |value| { try std.testing.expectEqual(tc.len, value.len); try std.testing.expectEqualStrings(tc, value); } } } test "setName, getName" { if (builtin.single_threaded) return error.SkipZigTest; const Context = struct { start_wait_event: ResetEvent = undefined, test_done_event: ResetEvent = undefined, done: std.atomic.Atomic(bool) = std.atomic.Atomic(bool).init(false), thread: Thread = undefined, fn init(self: *@This()) !void { try self.start_wait_event.init(); try self.test_done_event.init(); } pub fn run(ctx: *@This()) !void { // Wait for the main thread to have set the thread field in the context. ctx.start_wait_event.wait(); switch (target.os.tag) { .windows => testThreadName(&ctx.thread) catch |err| switch (err) { error.Unsupported => return error.SkipZigTest, else => return err, }, else => try testThreadName(&ctx.thread), } // Signal our test is done ctx.test_done_event.set(); while (!ctx.done.load(.SeqCst)) { std.time.sleep(5 * std.time.ns_per_ms); } } }; var context = Context{}; try context.init(); var thread = try spawn(.{}, Context.run, .{&context}); context.thread = thread; context.start_wait_event.set(); context.test_done_event.wait(); switch (target.os.tag) { .macos, .ios, .watchos, .tvos => { const res = thread.setName("foobar"); try std.testing.expectError(error.Unsupported, res); }, .windows => testThreadName(&thread) catch |err| switch (err) { error.Unsupported => return error.SkipZigTest, else => return err, }, else => |tag| if (tag == .linux and use_pthreads and comptime target.abi.isMusl()) { try thread.setName("foobar"); var name_buffer: [max_name_len:0]u8 = undefined; const res = thread.getName(&name_buffer); try std.testing.expectError(error.Unsupported, res); } else { try testThreadName(&thread); }, } context.done.store(true, .SeqCst); thread.join(); } test "std.Thread" { // Doesn't use testing.refAllDecls() since that would pull in the compileError spinLoopHint. _ = AutoResetEvent; _ = Futex; _ = ResetEvent; _ = StaticResetEvent; _ = Mutex; _ = Semaphore; _ = Condition; } fn testIncrementNotify(value: *usize, event: *ResetEvent) void { value.* += 1; event.set(); } test "Thread.join" { if (builtin.single_threaded) return error.SkipZigTest; var value: usize = 0; var event: ResetEvent = undefined; try event.init(); defer event.deinit(); const thread = try Thread.spawn(.{}, testIncrementNotify, .{ &value, &event }); thread.join(); try std.testing.expectEqual(value, 1); } test "Thread.detach" { if (builtin.single_threaded) return error.SkipZigTest; var value: usize = 0; var event: ResetEvent = undefined; try event.init(); defer event.deinit(); const thread = try Thread.spawn(.{}, testIncrementNotify, .{ &value, &event }); thread.detach(); event.wait(); try std.testing.expectEqual(value, 1); } fn testWaitForSignal(mutex: *Mutex, cond: *Condition) void { mutex.lock(); defer mutex.unlock(); cond.signal(); cond.wait(mutex); } test "Condition.signal" { if (builtin.single_threaded) return error.SkipZigTest; var mutex = Mutex{}; var cond = Condition{}; var thread: Thread = undefined; { mutex.lock(); defer mutex.unlock(); thread = try Thread.spawn(.{}, testWaitForSignal, .{ &mutex, &cond }); cond.wait(&mutex); cond.signal(); } thread.join(); }
lib/std/Thread.zig
const std = @import("std"); const io = std.io; const Args = @import("argparse.zig").Args; const curl = @import("curl.zig"); const search = @import("pacman.zig").search; const Pacman = @import("pacman.zig").Pacman; const build_version = @import("build_options").version; pub const log_level: std.log.Level = .info; const mainerror = error{ ZeroResultsFromAurQuery, CouldntResolveHost, QueryargTooSmall, }; pub fn main() !void { var arena_state = std.heap.ArenaAllocator.init(std.heap.c_allocator); defer arena_state.deinit(); var allocator = arena_state.allocator(); var args = Args.init(allocator); try args.parse(); switch (args.action) { .PrintHelp => try printHelp(), .PrintVersion => try printVersion(), .Search => search(allocator, args.pkgs.items[0]) catch |err| { if (err == mainerror.CouldntResolveHost) { try io.getStdOut().writer().print("Please check your connection\n", .{}); } else { try io.getStdErr().writer().print("Found error {any}\n", .{err}); } }, .InstallOrUpgrade => installOrUpdate(allocator, args.pkgs) catch |err| { if (err == mainerror.ZeroResultsFromAurQuery) { try io.getStdOut().writer().print("No aur packages found\n", .{}); } else if (err == mainerror.CouldntResolveHost) { try io.getStdOut().writer().print("Please check your connection\n", .{}); } else { try io.getStdErr().writer().print("Found error {any}\n", .{err}); } }, .Unset => @panic("Args somehow ended up with 'Unset' state"), } } fn installOrUpdate(allocator: std.mem.Allocator, pkg_list: std.ArrayList([]const u8)) !void { try curl.init(); defer curl.deinit(); var pacman = try Pacman.init(allocator); // default to updating all AUR packages if (pkg_list.items.len == 0) { try pacman.updateFromRepos(); try pacman.fetchLocalPackages(); } else { // This is a slight hack to have the install process share // the same code path as the update process. try pacman.setInstallPackages(pkg_list); } try pacman.fetchRemoteAurVersions(); try pacman.compareVersions(); try pacman.processOutOfDate(); } fn printHelp() !void { const msg = \\usage: zur [action] \\ \\ actions: \\ -S <pkg1> [pkg2]... install packages \\ -Ss <pkg> search for packages by name \\ \\ default action: update out-of-date AUR packages \\ ; var stderr = &io.getStdErr().writer(); _ = try stderr.write(msg); } fn printVersion() !void { var stdout = &io.getStdOut().writer(); _ = try stdout.write("version: " ++ build_version ++ "\n"); }
src/main.zig
const std = @import("std"); const zang = @import("zang"); const common = @import("common.zig"); const c = @import("common/c.zig"); const Recorder = @import("recorder.zig").Recorder; const example = @import(@import("build_options").example); const visual = @import("visual.zig"); const AUDIO_FORMAT = example.AUDIO_FORMAT; const AUDIO_SAMPLE_RATE = example.AUDIO_SAMPLE_RATE; const AUDIO_BUFFER_SIZE = example.AUDIO_BUFFER_SIZE; const screen_w = 512; const screen_h = 512; var g_outputs: [example.MainModule.num_outputs][AUDIO_BUFFER_SIZE]f32 = undefined; var g_temps: [example.MainModule.num_temps][AUDIO_BUFFER_SIZE]f32 = undefined; var g_redraw_event: c.Uint32 = undefined; fn pushRedrawEvent() void { var event: c.SDL_Event = undefined; event.type = g_redraw_event; _ = c.SDL_PushEvent(&event); } const UserData = struct { main_module: example.MainModule, // only valid if ok is true ok: bool, }; fn audioCallback( userdata_: ?*c_void, stream_: ?[*]u8, len_: c_int, ) callconv(.C) void { const userdata = @ptrCast(*UserData, @alignCast(@alignOf(*UserData), userdata_.?)); const stream = stream_.?[0..@intCast(usize, len_)]; var outputs: [example.MainModule.num_outputs][]f32 = undefined; var temps: [example.MainModule.num_temps][]f32 = undefined; var i: usize = undefined; const span = zang.Span.init(0, AUDIO_BUFFER_SIZE); i = 0; while (i < example.MainModule.num_outputs) : (i += 1) { outputs[i] = g_outputs[i][0..]; zang.zero(span, outputs[i]); } i = 0; while (i < example.MainModule.num_temps) : (i += 1) { temps[i] = g_temps[i][0..]; } if (userdata.ok) { userdata.main_module.paint(span, outputs, temps); } const mul = 0.25; switch (example.MainModule.output_audio) { .mono => |both| { zang.mixDown(stream, outputs[both][0..], AUDIO_FORMAT, 1, 0, mul); }, .stereo => |p| { zang.mixDown(stream, outputs[p.left][0..], AUDIO_FORMAT, 2, 0, mul); zang.mixDown(stream, outputs[p.right][0..], AUDIO_FORMAT, 2, 1, mul); }, } if (@hasDecl(example.MainModule, "output_visualize")) { const visualize = outputs[example.MainModule.output_visualize][0..]; const sync = if (@hasDecl(example.MainModule, "output_sync_oscilloscope")) outputs[example.MainModule.output_sync_oscilloscope][0..] else null; if (visuals.newInput(visualize, mul, AUDIO_SAMPLE_RATE, sync)) { pushRedrawEvent(); } } } const ListenerEvent = enum { reload, }; const Listener = struct { socket: std.os.fd_t, fn init(port: u16) !Listener { // open UDP socket on port 8888 const socket = try std.os.socket(std.os.AF_INET, std.os.SOCK_DGRAM, std.os.IPPROTO_UDP); _ = try std.os.fcntl(socket, std.os.F_SETFL, std.os.O_NONBLOCK); var addr: std.os.sockaddr_in = .{ .port = std.mem.nativeToBig(std.os.in_port_t, port), .addr = 0, // INADDR_ANY }; try std.os.bind(socket, @ptrCast(*std.os.sockaddr, &addr), @sizeOf(@TypeOf(addr))); std.debug.warn("listening on port {}\n", .{port}); return Listener{ .socket = socket }; } fn deinit(self: *Listener) void { std.os.close(self.socket); } fn checkForEvent(self: *Listener) !?ListenerEvent { var buf: [100]u8 = undefined; var from_addr: std.os.sockaddr_in = undefined; var from_addr_len: u32 = @sizeOf(@TypeOf(from_addr)); const num_bytes = std.os.recvfrom(self.socket, &buf, buf.len, @ptrCast(*std.os.sockaddr, &from_addr), &from_addr_len) catch |err| blk: { if (err == error.WouldBlock) { return null; } else { return err; } }; if (num_bytes > 0) { const string = buf[0..num_bytes]; if (std.mem.eql(u8, string, "reload")) { return ListenerEvent.reload; } } return null; } }; var visuals: visual.Visuals = undefined; pub fn main() !void { const allocator = std.heap.page_allocator; visuals = try visual.Visuals.init(allocator, screen_w, screen_h); defer visuals.deinit(); var userdata: UserData = .{ .ok = true, .main_module = undefined, }; if (@typeInfo(@typeInfo(@TypeOf(example.MainModule.init)).Fn.return_type.?) == .ErrorUnion) { var script_error: ?[]const u8 = null; userdata.main_module = example.MainModule.init(&script_error) catch blk: { visuals.setScriptError(script_error); visuals.setState(visuals.state); userdata.ok = false; break :blk undefined; }; } else { userdata.main_module = example.MainModule.init(); } defer if (userdata.ok) { if (@hasDecl(example.MainModule, "deinit")) { userdata.main_module.deinit(); } }; if (c.SDL_Init(c.SDL_INIT_VIDEO | c.SDL_INIT_AUDIO) != 0) { c.SDL_Log("Unable to initialize SDL: %s", c.SDL_GetError()); return error.SDLInitializationFailed; } errdefer c.SDL_Quit(); g_redraw_event = c.SDL_RegisterEvents(1); const SDL_WINDOWPOS_UNDEFINED = @bitCast(c_int, c.SDL_WINDOWPOS_UNDEFINED_MASK); const window = c.SDL_CreateWindow( "zang", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen_w, screen_h, 0, ) orelse { c.SDL_Log("Unable to create window: %s", c.SDL_GetError()); return error.SDLInitializationFailed; }; errdefer c.SDL_DestroyWindow(window); const screen = @ptrCast(*c.SDL_Surface, c.SDL_GetWindowSurface(window) orelse { c.SDL_Log("Unable to get window surface: %s", c.SDL_GetError()); return error.SDLInitializationFailed; }); var want: c.SDL_AudioSpec = undefined; want.freq = AUDIO_SAMPLE_RATE; want.format = switch (AUDIO_FORMAT) { .signed8 => c.AUDIO_S8, .signed16_lsb => c.AUDIO_S16LSB, }; want.channels = switch (example.MainModule.output_audio) { .mono => 1, .stereo => 2, }; want.samples = AUDIO_BUFFER_SIZE; want.callback = audioCallback; want.userdata = &userdata; const device: c.SDL_AudioDeviceID = c.SDL_OpenAudioDevice( 0, // device name (NULL) 0, // non-zero to open for recording instead of playback &want, // desired output format 0, // obtained output format (NULL) 0, // allowed changes: 0 means `obtained` will not differ from `want`, // and SDL will do any necessary resampling behind the scenes ); if (device == 0) { c.SDL_Log("Failed to open audio: %s", c.SDL_GetError()); return error.SDLInitializationFailed; } errdefer c.SDL_CloseAudio(); var maybe_listener: ?Listener = null; if (std.process.getEnvVarOwned(allocator, "ZANG_LISTEN_PORT") catch null) |port_str| { const maybe_port = std.fmt.parseInt(u16, port_str, 10) catch blk: { std.debug.warn("invalid value for ZANG_LISTEN_PORT\n", .{}); break :blk null; }; allocator.free(port_str); if (maybe_port) |port| { maybe_listener = Listener.init(port) catch |err| blk: { std.debug.warn("Listener.init failed: {}\n", .{err}); break :blk null; }; } } // this seems to match the value of SDL_GetTicks the first time the audio // callback is called const start_time = @intToFloat(f32, c.SDL_GetTicks()) / 1000.0; c.SDL_PauseAudioDevice(device, 0); // unpause pushRedrawEvent(); var recorder = Recorder.init(); var event: c.SDL_Event = undefined; while (c.SDL_WaitEvent(&event) != 0) { switch (event.type) { c.SDL_QUIT => { break; }, c.SDL_KEYDOWN, c.SDL_KEYUP => { const down = event.type == c.SDL_KEYDOWN; if (event.key.keysym.sym == c.SDLK_ESCAPE and down) { break; } if (event.key.keysym.sym == c.SDLK_F1 and down) { c.SDL_LockAudioDevice(device); visuals.setState(.help); pushRedrawEvent(); c.SDL_UnlockAudioDevice(device); } if (event.key.keysym.sym == c.SDLK_F2 and down) { c.SDL_LockAudioDevice(device); visuals.setState(.main); pushRedrawEvent(); c.SDL_UnlockAudioDevice(device); } if (event.key.keysym.sym == c.SDLK_F3 and down) { c.SDL_LockAudioDevice(device); visuals.setState(.oscil); pushRedrawEvent(); c.SDL_UnlockAudioDevice(device); } if (event.key.keysym.sym == c.SDLK_F4 and down) { c.SDL_LockAudioDevice(device); visuals.setState(.full_fft); pushRedrawEvent(); c.SDL_UnlockAudioDevice(device); } if (event.key.keysym.sym == c.SDLK_F5 and down) { c.SDL_LockAudioDevice(device); visuals.toggleLogarithmicFFT(); pushRedrawEvent(); c.SDL_UnlockAudioDevice(device); } if (event.key.keysym.sym == c.SDLK_BACKQUOTE and down and event.key.repeat == 0) { c.SDL_LockAudioDevice(device); recorder.cycleMode(); pushRedrawEvent(); c.SDL_UnlockAudioDevice(device); } if (event.key.keysym.sym == c.SDLK_RETURN and down) { c.SDL_LockAudioDevice(device); if (userdata.ok) { if (@hasDecl(example.MainModule, "deinit")) { userdata.main_module.deinit(); } } visuals.setScriptError(null); visuals.setState(visuals.state); userdata.ok = true; if (@typeInfo(@typeInfo(@TypeOf(example.MainModule.init)).Fn.return_type.?) == .ErrorUnion) { var script_error: ?[]const u8 = null; userdata.main_module = example.MainModule.init(&script_error) catch blk: { visuals.setScriptError(script_error); visuals.setState(visuals.state); userdata.ok = false; break :blk undefined; }; } else { userdata.main_module = example.MainModule.init(); } c.SDL_UnlockAudioDevice(device); } if (@hasDecl(example.MainModule, "keyEvent")) { if (event.key.repeat == 0) { c.SDL_LockAudioDevice(device); if (userdata.ok) { //const impulse_frame = getImpulseFrame( // AUDIO_BUFFER_SIZE, // AUDIO_SAMPLE_RATE, // start_time, //); const impulse_frame = getImpulseFrame(); if (userdata.main_module.keyEvent(event.key.keysym.sym, down, impulse_frame)) { recorder.recordEvent(event.key.keysym.sym, down); recorder.trackEvent(event.key.keysym.sym, down); } } c.SDL_UnlockAudioDevice(device); } } }, c.SDL_MOUSEMOTION => { if (@hasDecl(example.MainModule, "mouseEvent")) { const x = @intToFloat(f32, event.motion.x) / @intToFloat(f32, screen_w - 1); const y = @intToFloat(f32, event.motion.y) / @intToFloat(f32, screen_h - 1); const impulse_frame = getImpulseFrame(); c.SDL_LockAudioDevice(device); userdata.main_module.mouseEvent(x, y, impulse_frame); c.SDL_UnlockAudioDevice(device); } }, else => {}, } while (recorder.getNote()) |n| { if (@hasDecl(example.MainModule, "keyEvent")) { c.SDL_LockAudioDevice(device); if (userdata.ok) { const impulse_frame = 0; if (userdata.main_module.keyEvent(n.key, n.down, impulse_frame)) { recorder.trackEvent(n.key, n.down); } } c.SDL_UnlockAudioDevice(device); } } if (maybe_listener) |*listener| { const maybe_event = listener.checkForEvent() catch |err| blk: { std.debug.warn("listener.checkForEvent failed: {}\n", .{err}); listener.deinit(); maybe_listener = null; break :blk null; }; if (maybe_event) |listener_event| { switch (listener_event) { .reload => { c.SDL_LockAudioDevice(device); if (userdata.ok) { if (@hasDecl(example.MainModule, "deinit")) { userdata.main_module.deinit(); } } visuals.setScriptError(null); visuals.setState(visuals.state); userdata.ok = true; if (@typeInfo(@typeInfo(@TypeOf(example.MainModule.init)).Fn.return_type.?) == .ErrorUnion) { var script_error: ?[]const u8 = null; userdata.main_module = example.MainModule.init(&script_error) catch blk: { visuals.setScriptError(script_error); visuals.setState(visuals.state); userdata.ok = false; break :blk undefined; }; } else { userdata.main_module = example.MainModule.init(); } c.SDL_UnlockAudioDevice(device); }, } } } if (event.type == g_redraw_event) { c.SDL_LockAudioDevice(device); _ = c.SDL_LockSurface(screen); const pitch = @intCast(usize, screen.pitch) >> 2; const pixels = @ptrCast([*]u32, @alignCast(@alignOf(u32), screen.pixels))[0 .. screen_h * pitch]; const vis_screen: visual.Screen = .{ .width = screen_w, .height = screen_h, .pixels = pixels, .pitch = pitch, }; visuals.blit(vis_screen, .{ .recorder_state = recorder.state }); c.SDL_UnlockSurface(screen); _ = c.SDL_UpdateWindowSurface(window); c.SDL_UnlockAudioDevice(device); } } if (maybe_listener) |*listener| { listener.deinit(); } c.SDL_LockAudioDevice(device); c.SDL_UnlockAudioDevice(device); c.SDL_CloseAudioDevice(device); c.SDL_DestroyWindow(window); c.SDL_Quit(); } // start notes at a random time within the mix buffer. // this is only for testing purposes, because if i start everything at 0 there // are some code paths not being hit. // TODO - actually time the proper impulse frame //var r = std.rand.DefaultPrng.init(0); fn getImpulseFrame() usize { // FIXME - i was using random values as a kind of test, but this is // actually bad. it means if you press two keys at the same time, they get // different values, and the second might have an earlier value than the // first, which will cause it to get discarded by the ImpulseQueue! //return r.random.intRangeLessThan(usize, 0, example.AUDIO_BUFFER_SIZE); return 0; } //// come up with a frame index to start the sound at //fn getImpulseFrame( // buffer_size: usize, // sample_rate: usize, // start_time: f32, // current_frame_index: usize, //) usize { // // `current_frame_index` is the END of the mix frame currently queued to // // be heard next // const one_mix_frame = @intToFloat(f32, buffer_size) / // @intToFloat(f32, sample_rate); // // // time of the start of the mix frame currently underway // const mix_end = @intToFloat(f32, current_frame_index) / // @intToFloat(f32, sample_rate); // const mix_start = mix_end - one_mix_frame; // // const current_time = // @intToFloat(f32, c.SDL_GetTicks()) / 1000.0 - start_time; // // // if everything is working properly, current_time should be // // between mix_start and mix_end. there might be a little bit of an // // offset but i'm not going to deal with that for now. // // // i just need to make sure that if this code queues up an impulse // // that's in the "past" when it actually gets picked up by the // // audio thread, it will still be picked up (somehow)! // // // FIXME - shouldn't be multiplied by 2! this is only to // // compensate for the clocks sometimes starting out of sync // const impulse_time = current_time + one_mix_frame * 2.0; // const impulse_frame = // @floatToInt(usize, impulse_time * @intToFloat(f32, sample_rate)); // // return impulse_frame; //}
examples/example.zig
pub fn isEmoji(cp: u21) bool { if (cp < 0x23 or cp > 0x1faf6) return false; return switch (cp) { 0x23 => true, 0x2a => true, 0x30...0x39 => true, 0xa9 => true, 0xae => true, 0x203c => true, 0x2049 => true, 0x2122 => true, 0x2139 => true, 0x2194...0x2199 => true, 0x21a9...0x21aa => true, 0x231a...0x231b => true, 0x2328 => true, 0x23cf => true, 0x23e9...0x23ec => true, 0x23ed...0x23ee => true, 0x23ef => true, 0x23f0 => true, 0x23f1...0x23f2 => true, 0x23f3 => true, 0x23f8...0x23fa => true, 0x24c2 => true, 0x25aa...0x25ab => true, 0x25b6 => true, 0x25c0 => true, 0x25fb...0x25fe => true, 0x2600...0x2601 => true, 0x2602...0x2603 => true, 0x2604 => true, 0x260e => true, 0x2611 => true, 0x2614...0x2615 => true, 0x2618 => true, 0x261d => true, 0x2620 => true, 0x2622...0x2623 => true, 0x2626 => true, 0x262a => true, 0x262e => true, 0x262f => true, 0x2638...0x2639 => true, 0x263a => true, 0x2640 => true, 0x2642 => true, 0x2648...0x2653 => true, 0x265f => true, 0x2660 => true, 0x2663 => true, 0x2665...0x2666 => true, 0x2668 => true, 0x267b => true, 0x267e => true, 0x267f => true, 0x2692 => true, 0x2693 => true, 0x2694 => true, 0x2695 => true, 0x2696...0x2697 => true, 0x2699 => true, 0x269b...0x269c => true, 0x26a0...0x26a1 => true, 0x26a7 => true, 0x26aa...0x26ab => true, 0x26b0...0x26b1 => true, 0x26bd...0x26be => true, 0x26c4...0x26c5 => true, 0x26c8 => true, 0x26ce => true, 0x26cf => true, 0x26d1 => true, 0x26d3 => true, 0x26d4 => true, 0x26e9 => true, 0x26ea => true, 0x26f0...0x26f1 => true, 0x26f2...0x26f3 => true, 0x26f4 => true, 0x26f5 => true, 0x26f7...0x26f9 => true, 0x26fa => true, 0x26fd => true, 0x2702 => true, 0x2705 => true, 0x2708...0x270c => true, 0x270d => true, 0x270f => true, 0x2712 => true, 0x2714 => true, 0x2716 => true, 0x271d => true, 0x2721 => true, 0x2728 => true, 0x2733...0x2734 => true, 0x2744 => true, 0x2747 => true, 0x274c => true, 0x274e => true, 0x2753...0x2755 => true, 0x2757 => true, 0x2763 => true, 0x2764 => true, 0x2795...0x2797 => true, 0x27a1 => true, 0x27b0 => true, 0x27bf => true, 0x2934...0x2935 => true, 0x2b05...0x2b07 => true, 0x2b1b...0x2b1c => true, 0x2b50 => true, 0x2b55 => true, 0x3030 => true, 0x303d => true, 0x3297 => true, 0x3299 => true, 0x1f004 => true, 0x1f0cf => true, 0x1f170...0x1f171 => true, 0x1f17e...0x1f17f => true, 0x1f18e => true, 0x1f191...0x1f19a => true, 0x1f1e6...0x1f1ff => true, 0x1f201...0x1f202 => true, 0x1f21a => true, 0x1f22f => true, 0x1f232...0x1f23a => true, 0x1f250...0x1f251 => true, 0x1f300...0x1f30c => true, 0x1f30d...0x1f30e => true, 0x1f30f => true, 0x1f310 => true, 0x1f311 => true, 0x1f312 => true, 0x1f313...0x1f315 => true, 0x1f316...0x1f318 => true, 0x1f319 => true, 0x1f31a => true, 0x1f31b => true, 0x1f31c => true, 0x1f31d...0x1f31e => true, 0x1f31f...0x1f320 => true, 0x1f321 => true, 0x1f324...0x1f32c => true, 0x1f32d...0x1f32f => true, 0x1f330...0x1f331 => true, 0x1f332...0x1f333 => true, 0x1f334...0x1f335 => true, 0x1f336 => true, 0x1f337...0x1f34a => true, 0x1f34b => true, 0x1f34c...0x1f34f => true, 0x1f350 => true, 0x1f351...0x1f37b => true, 0x1f37c => true, 0x1f37d => true, 0x1f37e...0x1f37f => true, 0x1f380...0x1f393 => true, 0x1f396...0x1f397 => true, 0x1f399...0x1f39b => true, 0x1f39e...0x1f39f => true, 0x1f3a0...0x1f3c4 => true, 0x1f3c5 => true, 0x1f3c6 => true, 0x1f3c7 => true, 0x1f3c8 => true, 0x1f3c9 => true, 0x1f3ca => true, 0x1f3cb...0x1f3ce => true, 0x1f3cf...0x1f3d3 => true, 0x1f3d4...0x1f3df => true, 0x1f3e0...0x1f3e3 => true, 0x1f3e4 => true, 0x1f3e5...0x1f3f0 => true, 0x1f3f3 => true, 0x1f3f4 => true, 0x1f3f5 => true, 0x1f3f7 => true, 0x1f3f8...0x1f407 => true, 0x1f408 => true, 0x1f409...0x1f40b => true, 0x1f40c...0x1f40e => true, 0x1f40f...0x1f410 => true, 0x1f411...0x1f412 => true, 0x1f413 => true, 0x1f414 => true, 0x1f415 => true, 0x1f416 => true, 0x1f417...0x1f429 => true, 0x1f42a => true, 0x1f42b...0x1f43e => true, 0x1f43f => true, 0x1f440 => true, 0x1f441 => true, 0x1f442...0x1f464 => true, 0x1f465 => true, 0x1f466...0x1f46b => true, 0x1f46c...0x1f46d => true, 0x1f46e...0x1f4ac => true, 0x1f4ad => true, 0x1f4ae...0x1f4b5 => true, 0x1f4b6...0x1f4b7 => true, 0x1f4b8...0x1f4eb => true, 0x1f4ec...0x1f4ed => true, 0x1f4ee => true, 0x1f4ef => true, 0x1f4f0...0x1f4f4 => true, 0x1f4f5 => true, 0x1f4f6...0x1f4f7 => true, 0x1f4f8 => true, 0x1f4f9...0x1f4fc => true, 0x1f4fd => true, 0x1f4ff...0x1f502 => true, 0x1f503 => true, 0x1f504...0x1f507 => true, 0x1f508 => true, 0x1f509 => true, 0x1f50a...0x1f514 => true, 0x1f515 => true, 0x1f516...0x1f52b => true, 0x1f52c...0x1f52d => true, 0x1f52e...0x1f53d => true, 0x1f549...0x1f54a => true, 0x1f54b...0x1f54e => true, 0x1f550...0x1f55b => true, 0x1f55c...0x1f567 => true, 0x1f56f...0x1f570 => true, 0x1f573...0x1f579 => true, 0x1f57a => true, 0x1f587 => true, 0x1f58a...0x1f58d => true, 0x1f590 => true, 0x1f595...0x1f596 => true, 0x1f5a4 => true, 0x1f5a5 => true, 0x1f5a8 => true, 0x1f5b1...0x1f5b2 => true, 0x1f5bc => true, 0x1f5c2...0x1f5c4 => true, 0x1f5d1...0x1f5d3 => true, 0x1f5dc...0x1f5de => true, 0x1f5e1 => true, 0x1f5e3 => true, 0x1f5e8 => true, 0x1f5ef => true, 0x1f5f3 => true, 0x1f5fa => true, 0x1f5fb...0x1f5ff => true, 0x1f600 => true, 0x1f601...0x1f606 => true, 0x1f607...0x1f608 => true, 0x1f609...0x1f60d => true, 0x1f60e => true, 0x1f60f => true, 0x1f610 => true, 0x1f611 => true, 0x1f612...0x1f614 => true, 0x1f615 => true, 0x1f616 => true, 0x1f617 => true, 0x1f618 => true, 0x1f619 => true, 0x1f61a => true, 0x1f61b => true, 0x1f61c...0x1f61e => true, 0x1f61f => true, 0x1f620...0x1f625 => true, 0x1f626...0x1f627 => true, 0x1f628...0x1f62b => true, 0x1f62c => true, 0x1f62d => true, 0x1f62e...0x1f62f => true, 0x1f630...0x1f633 => true, 0x1f634 => true, 0x1f635 => true, 0x1f636 => true, 0x1f637...0x1f640 => true, 0x1f641...0x1f644 => true, 0x1f645...0x1f64f => true, 0x1f680 => true, 0x1f681...0x1f682 => true, 0x1f683...0x1f685 => true, 0x1f686 => true, 0x1f687 => true, 0x1f688 => true, 0x1f689 => true, 0x1f68a...0x1f68b => true, 0x1f68c => true, 0x1f68d => true, 0x1f68e => true, 0x1f68f => true, 0x1f690 => true, 0x1f691...0x1f693 => true, 0x1f694 => true, 0x1f695 => true, 0x1f696 => true, 0x1f697 => true, 0x1f698 => true, 0x1f699...0x1f69a => true, 0x1f69b...0x1f6a1 => true, 0x1f6a2 => true, 0x1f6a3 => true, 0x1f6a4...0x1f6a5 => true, 0x1f6a6 => true, 0x1f6a7...0x1f6ad => true, 0x1f6ae...0x1f6b1 => true, 0x1f6b2 => true, 0x1f6b3...0x1f6b5 => true, 0x1f6b6 => true, 0x1f6b7...0x1f6b8 => true, 0x1f6b9...0x1f6be => true, 0x1f6bf => true, 0x1f6c0 => true, 0x1f6c1...0x1f6c5 => true, 0x1f6cb => true, 0x1f6cc => true, 0x1f6cd...0x1f6cf => true, 0x1f6d0 => true, 0x1f6d1...0x1f6d2 => true, 0x1f6d5 => true, 0x1f6d6...0x1f6d7 => true, 0x1f6dd...0x1f6df => true, 0x1f6e0...0x1f6e5 => true, 0x1f6e9 => true, 0x1f6eb...0x1f6ec => true, 0x1f6f0 => true, 0x1f6f3 => true, 0x1f6f4...0x1f6f6 => true, 0x1f6f7...0x1f6f8 => true, 0x1f6f9 => true, 0x1f6fa => true, 0x1f6fb...0x1f6fc => true, 0x1f7e0...0x1f7eb => true, 0x1f7f0 => true, 0x1f90c => true, 0x1f90d...0x1f90f => true, 0x1f910...0x1f918 => true, 0x1f919...0x1f91e => true, 0x1f91f => true, 0x1f920...0x1f927 => true, 0x1f928...0x1f92f => true, 0x1f930 => true, 0x1f931...0x1f932 => true, 0x1f933...0x1f93a => true, 0x1f93c...0x1f93e => true, 0x1f93f => true, 0x1f940...0x1f945 => true, 0x1f947...0x1f94b => true, 0x1f94c => true, 0x1f94d...0x1f94f => true, 0x1f950...0x1f95e => true, 0x1f95f...0x1f96b => true, 0x1f96c...0x1f970 => true, 0x1f971 => true, 0x1f972 => true, 0x1f973...0x1f976 => true, 0x1f977...0x1f978 => true, 0x1f979 => true, 0x1f97a => true, 0x1f97b => true, 0x1f97c...0x1f97f => true, 0x1f980...0x1f984 => true, 0x1f985...0x1f991 => true, 0x1f992...0x1f997 => true, 0x1f998...0x1f9a2 => true, 0x1f9a3...0x1f9a4 => true, 0x1f9a5...0x1f9aa => true, 0x1f9ab...0x1f9ad => true, 0x1f9ae...0x1f9af => true, 0x1f9b0...0x1f9b9 => true, 0x1f9ba...0x1f9bf => true, 0x1f9c0 => true, 0x1f9c1...0x1f9c2 => true, 0x1f9c3...0x1f9ca => true, 0x1f9cb => true, 0x1f9cc => true, 0x1f9cd...0x1f9cf => true, 0x1f9d0...0x1f9e6 => true, 0x1f9e7...0x1f9ff => true, 0x1fa70...0x1fa73 => true, 0x1fa74 => true, 0x1fa78...0x1fa7a => true, 0x1fa7b...0x1fa7c => true, 0x1fa80...0x1fa82 => true, 0x1fa83...0x1fa86 => true, 0x1fa90...0x1fa95 => true, 0x1fa96...0x1faa8 => true, 0x1faa9...0x1faac => true, 0x1fab0...0x1fab6 => true, 0x1fab7...0x1faba => true, 0x1fac0...0x1fac2 => true, 0x1fac3...0x1fac5 => true, 0x1fad0...0x1fad6 => true, 0x1fad7...0x1fad9 => true, 0x1fae0...0x1fae7 => true, 0x1faf0...0x1faf6 => true, else => false, }; } pub fn isEmojiPresentation(cp: u21) bool { if (cp < 0x231a or cp > 0x1faf6) return false; return switch (cp) { 0x231a...0x231b => true, 0x23e9...0x23ec => true, 0x23f0 => true, 0x23f3 => true, 0x25fd...0x25fe => true, 0x2614...0x2615 => true, 0x2648...0x2653 => true, 0x267f => true, 0x2693 => true, 0x26a1 => true, 0x26aa...0x26ab => true, 0x26bd...0x26be => true, 0x26c4...0x26c5 => true, 0x26ce => true, 0x26d4 => true, 0x26ea => true, 0x26f2...0x26f3 => true, 0x26f5 => true, 0x26fa => true, 0x26fd => true, 0x2705 => true, 0x270a...0x270b => true, 0x2728 => true, 0x274c => true, 0x274e => true, 0x2753...0x2755 => true, 0x2757 => true, 0x2795...0x2797 => true, 0x27b0 => true, 0x27bf => true, 0x2b1b...0x2b1c => true, 0x2b50 => true, 0x2b55 => true, 0x1f004 => true, 0x1f0cf => true, 0x1f18e => true, 0x1f191...0x1f19a => true, 0x1f1e6...0x1f1ff => true, 0x1f201 => true, 0x1f21a => true, 0x1f22f => true, 0x1f232...0x1f236 => true, 0x1f238...0x1f23a => true, 0x1f250...0x1f251 => true, 0x1f300...0x1f30c => true, 0x1f30d...0x1f30e => true, 0x1f30f => true, 0x1f310 => true, 0x1f311 => true, 0x1f312 => true, 0x1f313...0x1f315 => true, 0x1f316...0x1f318 => true, 0x1f319 => true, 0x1f31a => true, 0x1f31b => true, 0x1f31c => true, 0x1f31d...0x1f31e => true, 0x1f31f...0x1f320 => true, 0x1f32d...0x1f32f => true, 0x1f330...0x1f331 => true, 0x1f332...0x1f333 => true, 0x1f334...0x1f335 => true, 0x1f337...0x1f34a => true, 0x1f34b => true, 0x1f34c...0x1f34f => true, 0x1f350 => true, 0x1f351...0x1f37b => true, 0x1f37c => true, 0x1f37e...0x1f37f => true, 0x1f380...0x1f393 => true, 0x1f3a0...0x1f3c4 => true, 0x1f3c5 => true, 0x1f3c6 => true, 0x1f3c7 => true, 0x1f3c8 => true, 0x1f3c9 => true, 0x1f3ca => true, 0x1f3cf...0x1f3d3 => true, 0x1f3e0...0x1f3e3 => true, 0x1f3e4 => true, 0x1f3e5...0x1f3f0 => true, 0x1f3f4 => true, 0x1f3f8...0x1f407 => true, 0x1f408 => true, 0x1f409...0x1f40b => true, 0x1f40c...0x1f40e => true, 0x1f40f...0x1f410 => true, 0x1f411...0x1f412 => true, 0x1f413 => true, 0x1f414 => true, 0x1f415 => true, 0x1f416 => true, 0x1f417...0x1f429 => true, 0x1f42a => true, 0x1f42b...0x1f43e => true, 0x1f440 => true, 0x1f442...0x1f464 => true, 0x1f465 => true, 0x1f466...0x1f46b => true, 0x1f46c...0x1f46d => true, 0x1f46e...0x1f4ac => true, 0x1f4ad => true, 0x1f4ae...0x1f4b5 => true, 0x1f4b6...0x1f4b7 => true, 0x1f4b8...0x1f4eb => true, 0x1f4ec...0x1f4ed => true, 0x1f4ee => true, 0x1f4ef => true, 0x1f4f0...0x1f4f4 => true, 0x1f4f5 => true, 0x1f4f6...0x1f4f7 => true, 0x1f4f8 => true, 0x1f4f9...0x1f4fc => true, 0x1f4ff...0x1f502 => true, 0x1f503 => true, 0x1f504...0x1f507 => true, 0x1f508 => true, 0x1f509 => true, 0x1f50a...0x1f514 => true, 0x1f515 => true, 0x1f516...0x1f52b => true, 0x1f52c...0x1f52d => true, 0x1f52e...0x1f53d => true, 0x1f54b...0x1f54e => true, 0x1f550...0x1f55b => true, 0x1f55c...0x1f567 => true, 0x1f57a => true, 0x1f595...0x1f596 => true, 0x1f5a4 => true, 0x1f5fb...0x1f5ff => true, 0x1f600 => true, 0x1f601...0x1f606 => true, 0x1f607...0x1f608 => true, 0x1f609...0x1f60d => true, 0x1f60e => true, 0x1f60f => true, 0x1f610 => true, 0x1f611 => true, 0x1f612...0x1f614 => true, 0x1f615 => true, 0x1f616 => true, 0x1f617 => true, 0x1f618 => true, 0x1f619 => true, 0x1f61a => true, 0x1f61b => true, 0x1f61c...0x1f61e => true, 0x1f61f => true, 0x1f620...0x1f625 => true, 0x1f626...0x1f627 => true, 0x1f628...0x1f62b => true, 0x1f62c => true, 0x1f62d => true, 0x1f62e...0x1f62f => true, 0x1f630...0x1f633 => true, 0x1f634 => true, 0x1f635 => true, 0x1f636 => true, 0x1f637...0x1f640 => true, 0x1f641...0x1f644 => true, 0x1f645...0x1f64f => true, 0x1f680 => true, 0x1f681...0x1f682 => true, 0x1f683...0x1f685 => true, 0x1f686 => true, 0x1f687 => true, 0x1f688 => true, 0x1f689 => true, 0x1f68a...0x1f68b => true, 0x1f68c => true, 0x1f68d => true, 0x1f68e => true, 0x1f68f => true, 0x1f690 => true, 0x1f691...0x1f693 => true, 0x1f694 => true, 0x1f695 => true, 0x1f696 => true, 0x1f697 => true, 0x1f698 => true, 0x1f699...0x1f69a => true, 0x1f69b...0x1f6a1 => true, 0x1f6a2 => true, 0x1f6a3 => true, 0x1f6a4...0x1f6a5 => true, 0x1f6a6 => true, 0x1f6a7...0x1f6ad => true, 0x1f6ae...0x1f6b1 => true, 0x1f6b2 => true, 0x1f6b3...0x1f6b5 => true, 0x1f6b6 => true, 0x1f6b7...0x1f6b8 => true, 0x1f6b9...0x1f6be => true, 0x1f6bf => true, 0x1f6c0 => true, 0x1f6c1...0x1f6c5 => true, 0x1f6cc => true, 0x1f6d0 => true, 0x1f6d1...0x1f6d2 => true, 0x1f6d5 => true, 0x1f6d6...0x1f6d7 => true, 0x1f6dd...0x1f6df => true, 0x1f6eb...0x1f6ec => true, 0x1f6f4...0x1f6f6 => true, 0x1f6f7...0x1f6f8 => true, 0x1f6f9 => true, 0x1f6fa => true, 0x1f6fb...0x1f6fc => true, 0x1f7e0...0x1f7eb => true, 0x1f7f0 => true, 0x1f90c => true, 0x1f90d...0x1f90f => true, 0x1f910...0x1f918 => true, 0x1f919...0x1f91e => true, 0x1f91f => true, 0x1f920...0x1f927 => true, 0x1f928...0x1f92f => true, 0x1f930 => true, 0x1f931...0x1f932 => true, 0x1f933...0x1f93a => true, 0x1f93c...0x1f93e => true, 0x1f93f => true, 0x1f940...0x1f945 => true, 0x1f947...0x1f94b => true, 0x1f94c => true, 0x1f94d...0x1f94f => true, 0x1f950...0x1f95e => true, 0x1f95f...0x1f96b => true, 0x1f96c...0x1f970 => true, 0x1f971 => true, 0x1f972 => true, 0x1f973...0x1f976 => true, 0x1f977...0x1f978 => true, 0x1f979 => true, 0x1f97a => true, 0x1f97b => true, 0x1f97c...0x1f97f => true, 0x1f980...0x1f984 => true, 0x1f985...0x1f991 => true, 0x1f992...0x1f997 => true, 0x1f998...0x1f9a2 => true, 0x1f9a3...0x1f9a4 => true, 0x1f9a5...0x1f9aa => true, 0x1f9ab...0x1f9ad => true, 0x1f9ae...0x1f9af => true, 0x1f9b0...0x1f9b9 => true, 0x1f9ba...0x1f9bf => true, 0x1f9c0 => true, 0x1f9c1...0x1f9c2 => true, 0x1f9c3...0x1f9ca => true, 0x1f9cb => true, 0x1f9cc => true, 0x1f9cd...0x1f9cf => true, 0x1f9d0...0x1f9e6 => true, 0x1f9e7...0x1f9ff => true, 0x1fa70...0x1fa73 => true, 0x1fa74 => true, 0x1fa78...0x1fa7a => true, 0x1fa7b...0x1fa7c => true, 0x1fa80...0x1fa82 => true, 0x1fa83...0x1fa86 => true, 0x1fa90...0x1fa95 => true, 0x1fa96...0x1faa8 => true, 0x1faa9...0x1faac => true, 0x1fab0...0x1fab6 => true, 0x1fab7...0x1faba => true, 0x1fac0...0x1fac2 => true, 0x1fac3...0x1fac5 => true, 0x1fad0...0x1fad6 => true, 0x1fad7...0x1fad9 => true, 0x1fae0...0x1fae7 => true, 0x1faf0...0x1faf6 => true, else => false, }; } pub fn isEmojiModifier(cp: u21) bool { if (cp < 0x1f3fb or cp > 0x1f3ff) return false; return switch (cp) { 0x1f3fb...0x1f3ff => true, else => false, }; } pub fn isEmojiModifierBase(cp: u21) bool { if (cp < 0x261d or cp > 0x1faf6) return false; return switch (cp) { 0x261d => true, 0x26f9 => true, 0x270a...0x270c => true, 0x270d => true, 0x1f385 => true, 0x1f3c2...0x1f3c4 => true, 0x1f3c7 => true, 0x1f3ca => true, 0x1f3cb...0x1f3cc => true, 0x1f442...0x1f443 => true, 0x1f446...0x1f450 => true, 0x1f466...0x1f46b => true, 0x1f46c...0x1f46d => true, 0x1f46e...0x1f478 => true, 0x1f47c => true, 0x1f481...0x1f483 => true, 0x1f485...0x1f487 => true, 0x1f48f => true, 0x1f491 => true, 0x1f4aa => true, 0x1f574...0x1f575 => true, 0x1f57a => true, 0x1f590 => true, 0x1f595...0x1f596 => true, 0x1f645...0x1f647 => true, 0x1f64b...0x1f64f => true, 0x1f6a3 => true, 0x1f6b4...0x1f6b5 => true, 0x1f6b6 => true, 0x1f6c0 => true, 0x1f6cc => true, 0x1f90c => true, 0x1f90f => true, 0x1f918 => true, 0x1f919...0x1f91e => true, 0x1f91f => true, 0x1f926 => true, 0x1f930 => true, 0x1f931...0x1f932 => true, 0x1f933...0x1f939 => true, 0x1f93c...0x1f93e => true, 0x1f977 => true, 0x1f9b5...0x1f9b6 => true, 0x1f9b8...0x1f9b9 => true, 0x1f9bb => true, 0x1f9cd...0x1f9cf => true, 0x1f9d1...0x1f9dd => true, 0x1fac3...0x1fac5 => true, 0x1faf0...0x1faf6 => true, else => false, }; } pub fn isEmojiComponent(cp: u21) bool { if (cp < 0x23 or cp > 0xe007f) return false; return switch (cp) { 0x23 => true, 0x2a => true, 0x30...0x39 => true, 0x200d => true, 0x20e3 => true, 0xfe0f => true, 0x1f1e6...0x1f1ff => true, 0x1f3fb...0x1f3ff => true, 0x1f9b0...0x1f9b3 => true, 0xe0020...0xe007f => true, else => false, }; } pub fn isExtendedPictographic(cp: u21) bool { if (cp < 0xa9 or cp > 0x1fffd) return false; return switch (cp) { 0xa9 => true, 0xae => true, 0x203c => true, 0x2049 => true, 0x2122 => true, 0x2139 => true, 0x2194...0x2199 => true, 0x21a9...0x21aa => true, 0x231a...0x231b => true, 0x2328 => true, 0x2388 => true, 0x23cf => true, 0x23e9...0x23ec => true, 0x23ed...0x23ee => true, 0x23ef => true, 0x23f0 => true, 0x23f1...0x23f2 => true, 0x23f3 => true, 0x23f8...0x23fa => true, 0x24c2 => true, 0x25aa...0x25ab => true, 0x25b6 => true, 0x25c0 => true, 0x25fb...0x25fe => true, 0x2600...0x2601 => true, 0x2602...0x2603 => true, 0x2604 => true, 0x2605 => true, 0x2607...0x260d => true, 0x260e => true, 0x260f...0x2610 => true, 0x2611 => true, 0x2612 => true, 0x2614...0x2615 => true, 0x2616...0x2617 => true, 0x2618 => true, 0x2619...0x261c => true, 0x261d => true, 0x261e...0x261f => true, 0x2620 => true, 0x2621 => true, 0x2622...0x2623 => true, 0x2624...0x2625 => true, 0x2626 => true, 0x2627...0x2629 => true, 0x262a => true, 0x262b...0x262d => true, 0x262e => true, 0x262f => true, 0x2630...0x2637 => true, 0x2638...0x2639 => true, 0x263a => true, 0x263b...0x263f => true, 0x2640 => true, 0x2641 => true, 0x2642 => true, 0x2643...0x2647 => true, 0x2648...0x2653 => true, 0x2654...0x265e => true, 0x265f => true, 0x2660 => true, 0x2661...0x2662 => true, 0x2663 => true, 0x2664 => true, 0x2665...0x2666 => true, 0x2667 => true, 0x2668 => true, 0x2669...0x267a => true, 0x267b => true, 0x267c...0x267d => true, 0x267e => true, 0x267f => true, 0x2680...0x2685 => true, 0x2690...0x2691 => true, 0x2692 => true, 0x2693 => true, 0x2694 => true, 0x2695 => true, 0x2696...0x2697 => true, 0x2698 => true, 0x2699 => true, 0x269a => true, 0x269b...0x269c => true, 0x269d...0x269f => true, 0x26a0...0x26a1 => true, 0x26a2...0x26a6 => true, 0x26a7 => true, 0x26a8...0x26a9 => true, 0x26aa...0x26ab => true, 0x26ac...0x26af => true, 0x26b0...0x26b1 => true, 0x26b2...0x26bc => true, 0x26bd...0x26be => true, 0x26bf...0x26c3 => true, 0x26c4...0x26c5 => true, 0x26c6...0x26c7 => true, 0x26c8 => true, 0x26c9...0x26cd => true, 0x26ce => true, 0x26cf => true, 0x26d0 => true, 0x26d1 => true, 0x26d2 => true, 0x26d3 => true, 0x26d4 => true, 0x26d5...0x26e8 => true, 0x26e9 => true, 0x26ea => true, 0x26eb...0x26ef => true, 0x26f0...0x26f1 => true, 0x26f2...0x26f3 => true, 0x26f4 => true, 0x26f5 => true, 0x26f6 => true, 0x26f7...0x26f9 => true, 0x26fa => true, 0x26fb...0x26fc => true, 0x26fd => true, 0x26fe...0x2701 => true, 0x2702 => true, 0x2703...0x2704 => true, 0x2705 => true, 0x2708...0x270c => true, 0x270d => true, 0x270e => true, 0x270f => true, 0x2710...0x2711 => true, 0x2712 => true, 0x2714 => true, 0x2716 => true, 0x271d => true, 0x2721 => true, 0x2728 => true, 0x2733...0x2734 => true, 0x2744 => true, 0x2747 => true, 0x274c => true, 0x274e => true, 0x2753...0x2755 => true, 0x2757 => true, 0x2763 => true, 0x2764 => true, 0x2765...0x2767 => true, 0x2795...0x2797 => true, 0x27a1 => true, 0x27b0 => true, 0x27bf => true, 0x2934...0x2935 => true, 0x2b05...0x2b07 => true, 0x2b1b...0x2b1c => true, 0x2b50 => true, 0x2b55 => true, 0x3030 => true, 0x303d => true, 0x3297 => true, 0x3299 => true, 0x1f000...0x1f003 => true, 0x1f004 => true, 0x1f005...0x1f0ce => true, 0x1f0cf => true, 0x1f0d0...0x1f0ff => true, 0x1f10d...0x1f10f => true, 0x1f12f => true, 0x1f16c...0x1f16f => true, 0x1f170...0x1f171 => true, 0x1f17e...0x1f17f => true, 0x1f18e => true, 0x1f191...0x1f19a => true, 0x1f1ad...0x1f1e5 => true, 0x1f201...0x1f202 => true, 0x1f203...0x1f20f => true, 0x1f21a => true, 0x1f22f => true, 0x1f232...0x1f23a => true, 0x1f23c...0x1f23f => true, 0x1f249...0x1f24f => true, 0x1f250...0x1f251 => true, 0x1f252...0x1f2ff => true, 0x1f300...0x1f30c => true, 0x1f30d...0x1f30e => true, 0x1f30f => true, 0x1f310 => true, 0x1f311 => true, 0x1f312 => true, 0x1f313...0x1f315 => true, 0x1f316...0x1f318 => true, 0x1f319 => true, 0x1f31a => true, 0x1f31b => true, 0x1f31c => true, 0x1f31d...0x1f31e => true, 0x1f31f...0x1f320 => true, 0x1f321 => true, 0x1f322...0x1f323 => true, 0x1f324...0x1f32c => true, 0x1f32d...0x1f32f => true, 0x1f330...0x1f331 => true, 0x1f332...0x1f333 => true, 0x1f334...0x1f335 => true, 0x1f336 => true, 0x1f337...0x1f34a => true, 0x1f34b => true, 0x1f34c...0x1f34f => true, 0x1f350 => true, 0x1f351...0x1f37b => true, 0x1f37c => true, 0x1f37d => true, 0x1f37e...0x1f37f => true, 0x1f380...0x1f393 => true, 0x1f394...0x1f395 => true, 0x1f396...0x1f397 => true, 0x1f398 => true, 0x1f399...0x1f39b => true, 0x1f39c...0x1f39d => true, 0x1f39e...0x1f39f => true, 0x1f3a0...0x1f3c4 => true, 0x1f3c5 => true, 0x1f3c6 => true, 0x1f3c7 => true, 0x1f3c8 => true, 0x1f3c9 => true, 0x1f3ca => true, 0x1f3cb...0x1f3ce => true, 0x1f3cf...0x1f3d3 => true, 0x1f3d4...0x1f3df => true, 0x1f3e0...0x1f3e3 => true, 0x1f3e4 => true, 0x1f3e5...0x1f3f0 => true, 0x1f3f1...0x1f3f2 => true, 0x1f3f3 => true, 0x1f3f4 => true, 0x1f3f5 => true, 0x1f3f6 => true, 0x1f3f7 => true, 0x1f3f8...0x1f3fa => true, 0x1f400...0x1f407 => true, 0x1f408 => true, 0x1f409...0x1f40b => true, 0x1f40c...0x1f40e => true, 0x1f40f...0x1f410 => true, 0x1f411...0x1f412 => true, 0x1f413 => true, 0x1f414 => true, 0x1f415 => true, 0x1f416 => true, 0x1f417...0x1f429 => true, 0x1f42a => true, 0x1f42b...0x1f43e => true, 0x1f43f => true, 0x1f440 => true, 0x1f441 => true, 0x1f442...0x1f464 => true, 0x1f465 => true, 0x1f466...0x1f46b => true, 0x1f46c...0x1f46d => true, 0x1f46e...0x1f4ac => true, 0x1f4ad => true, 0x1f4ae...0x1f4b5 => true, 0x1f4b6...0x1f4b7 => true, 0x1f4b8...0x1f4eb => true, 0x1f4ec...0x1f4ed => true, 0x1f4ee => true, 0x1f4ef => true, 0x1f4f0...0x1f4f4 => true, 0x1f4f5 => true, 0x1f4f6...0x1f4f7 => true, 0x1f4f8 => true, 0x1f4f9...0x1f4fc => true, 0x1f4fd => true, 0x1f4fe => true, 0x1f4ff...0x1f502 => true, 0x1f503 => true, 0x1f504...0x1f507 => true, 0x1f508 => true, 0x1f509 => true, 0x1f50a...0x1f514 => true, 0x1f515 => true, 0x1f516...0x1f52b => true, 0x1f52c...0x1f52d => true, 0x1f52e...0x1f53d => true, 0x1f546...0x1f548 => true, 0x1f549...0x1f54a => true, 0x1f54b...0x1f54e => true, 0x1f54f => true, 0x1f550...0x1f55b => true, 0x1f55c...0x1f567 => true, 0x1f568...0x1f56e => true, 0x1f56f...0x1f570 => true, 0x1f571...0x1f572 => true, 0x1f573...0x1f579 => true, 0x1f57a => true, 0x1f57b...0x1f586 => true, 0x1f587 => true, 0x1f588...0x1f589 => true, 0x1f58a...0x1f58d => true, 0x1f58e...0x1f58f => true, 0x1f590 => true, 0x1f591...0x1f594 => true, 0x1f595...0x1f596 => true, 0x1f597...0x1f5a3 => true, 0x1f5a4 => true, 0x1f5a5 => true, 0x1f5a6...0x1f5a7 => true, 0x1f5a8 => true, 0x1f5a9...0x1f5b0 => true, 0x1f5b1...0x1f5b2 => true, 0x1f5b3...0x1f5bb => true, 0x1f5bc => true, 0x1f5bd...0x1f5c1 => true, 0x1f5c2...0x1f5c4 => true, 0x1f5c5...0x1f5d0 => true, 0x1f5d1...0x1f5d3 => true, 0x1f5d4...0x1f5db => true, 0x1f5dc...0x1f5de => true, 0x1f5df...0x1f5e0 => true, 0x1f5e1 => true, 0x1f5e2 => true, 0x1f5e3 => true, 0x1f5e4...0x1f5e7 => true, 0x1f5e8 => true, 0x1f5e9...0x1f5ee => true, 0x1f5ef => true, 0x1f5f0...0x1f5f2 => true, 0x1f5f3 => true, 0x1f5f4...0x1f5f9 => true, 0x1f5fa => true, 0x1f5fb...0x1f5ff => true, 0x1f600 => true, 0x1f601...0x1f606 => true, 0x1f607...0x1f608 => true, 0x1f609...0x1f60d => true, 0x1f60e => true, 0x1f60f => true, 0x1f610 => true, 0x1f611 => true, 0x1f612...0x1f614 => true, 0x1f615 => true, 0x1f616 => true, 0x1f617 => true, 0x1f618 => true, 0x1f619 => true, 0x1f61a => true, 0x1f61b => true, 0x1f61c...0x1f61e => true, 0x1f61f => true, 0x1f620...0x1f625 => true, 0x1f626...0x1f627 => true, 0x1f628...0x1f62b => true, 0x1f62c => true, 0x1f62d => true, 0x1f62e...0x1f62f => true, 0x1f630...0x1f633 => true, 0x1f634 => true, 0x1f635 => true, 0x1f636 => true, 0x1f637...0x1f640 => true, 0x1f641...0x1f644 => true, 0x1f645...0x1f64f => true, 0x1f680 => true, 0x1f681...0x1f682 => true, 0x1f683...0x1f685 => true, 0x1f686 => true, 0x1f687 => true, 0x1f688 => true, 0x1f689 => true, 0x1f68a...0x1f68b => true, 0x1f68c => true, 0x1f68d => true, 0x1f68e => true, 0x1f68f => true, 0x1f690 => true, 0x1f691...0x1f693 => true, 0x1f694 => true, 0x1f695 => true, 0x1f696 => true, 0x1f697 => true, 0x1f698 => true, 0x1f699...0x1f69a => true, 0x1f69b...0x1f6a1 => true, 0x1f6a2 => true, 0x1f6a3 => true, 0x1f6a4...0x1f6a5 => true, 0x1f6a6 => true, 0x1f6a7...0x1f6ad => true, 0x1f6ae...0x1f6b1 => true, 0x1f6b2 => true, 0x1f6b3...0x1f6b5 => true, 0x1f6b6 => true, 0x1f6b7...0x1f6b8 => true, 0x1f6b9...0x1f6be => true, 0x1f6bf => true, 0x1f6c0 => true, 0x1f6c1...0x1f6c5 => true, 0x1f6c6...0x1f6ca => true, 0x1f6cb => true, 0x1f6cc => true, 0x1f6cd...0x1f6cf => true, 0x1f6d0 => true, 0x1f6d1...0x1f6d2 => true, 0x1f6d3...0x1f6d4 => true, 0x1f6d5 => true, 0x1f6d6...0x1f6d7 => true, 0x1f6d8...0x1f6dc => true, 0x1f6dd...0x1f6df => true, 0x1f6e0...0x1f6e5 => true, 0x1f6e6...0x1f6e8 => true, 0x1f6e9 => true, 0x1f6ea => true, 0x1f6eb...0x1f6ec => true, 0x1f6ed...0x1f6ef => true, 0x1f6f0 => true, 0x1f6f1...0x1f6f2 => true, 0x1f6f3 => true, 0x1f6f4...0x1f6f6 => true, 0x1f6f7...0x1f6f8 => true, 0x1f6f9 => true, 0x1f6fa => true, 0x1f6fb...0x1f6fc => true, 0x1f6fd...0x1f6ff => true, 0x1f774...0x1f77f => true, 0x1f7d5...0x1f7df => true, 0x1f7e0...0x1f7eb => true, 0x1f7ec...0x1f7ef => true, 0x1f7f0 => true, 0x1f7f1...0x1f7ff => true, 0x1f80c...0x1f80f => true, 0x1f848...0x1f84f => true, 0x1f85a...0x1f85f => true, 0x1f888...0x1f88f => true, 0x1f8ae...0x1f8ff => true, 0x1f90c => true, 0x1f90d...0x1f90f => true, 0x1f910...0x1f918 => true, 0x1f919...0x1f91e => true, 0x1f91f => true, 0x1f920...0x1f927 => true, 0x1f928...0x1f92f => true, 0x1f930 => true, 0x1f931...0x1f932 => true, 0x1f933...0x1f93a => true, 0x1f93c...0x1f93e => true, 0x1f93f => true, 0x1f940...0x1f945 => true, 0x1f947...0x1f94b => true, 0x1f94c => true, 0x1f94d...0x1f94f => true, 0x1f950...0x1f95e => true, 0x1f95f...0x1f96b => true, 0x1f96c...0x1f970 => true, 0x1f971 => true, 0x1f972 => true, 0x1f973...0x1f976 => true, 0x1f977...0x1f978 => true, 0x1f979 => true, 0x1f97a => true, 0x1f97b => true, 0x1f97c...0x1f97f => true, 0x1f980...0x1f984 => true, 0x1f985...0x1f991 => true, 0x1f992...0x1f997 => true, 0x1f998...0x1f9a2 => true, 0x1f9a3...0x1f9a4 => true, 0x1f9a5...0x1f9aa => true, 0x1f9ab...0x1f9ad => true, 0x1f9ae...0x1f9af => true, 0x1f9b0...0x1f9b9 => true, 0x1f9ba...0x1f9bf => true, 0x1f9c0 => true, 0x1f9c1...0x1f9c2 => true, 0x1f9c3...0x1f9ca => true, 0x1f9cb => true, 0x1f9cc => true, 0x1f9cd...0x1f9cf => true, 0x1f9d0...0x1f9e6 => true, 0x1f9e7...0x1f9ff => true, 0x1fa00...0x1fa6f => true, 0x1fa70...0x1fa73 => true, 0x1fa74 => true, 0x1fa75...0x1fa77 => true, 0x1fa78...0x1fa7a => true, 0x1fa7b...0x1fa7c => true, 0x1fa7d...0x1fa7f => true, 0x1fa80...0x1fa82 => true, 0x1fa83...0x1fa86 => true, 0x1fa87...0x1fa8f => true, 0x1fa90...0x1fa95 => true, 0x1fa96...0x1faa8 => true, 0x1faa9...0x1faac => true, 0x1faad...0x1faaf => true, 0x1fab0...0x1fab6 => true, 0x1fab7...0x1faba => true, 0x1fabb...0x1fabf => true, 0x1fac0...0x1fac2 => true, 0x1fac3...0x1fac5 => true, 0x1fac6...0x1facf => true, 0x1fad0...0x1fad6 => true, 0x1fad7...0x1fad9 => true, 0x1fada...0x1fadf => true, 0x1fae0...0x1fae7 => true, 0x1fae8...0x1faef => true, 0x1faf0...0x1faf6 => true, 0x1faf7...0x1faff => true, 0x1fc00...0x1fffd => true, else => false, }; }
src/components/autogen/EmojiData.zig
const std = @import("std"); const w4 = @import("wasm4.zig"); pub const Point = struct { x: i32, y: i32, pub fn init(x: i32, y: i32) @This() { return @This(){ .x = x, .y = y, }; } pub fn equals(this: @This(), other: @This()) bool { return (this.x == other.x) and (this.y == other.y); } }; pub const Snake = struct { body: std.BoundedArray(Point, 400), direction: Point, pub fn init() @This() { return @This(){ .body = std.BoundedArray(Point, 400).fromSlice(&.{ Point.init(2, 0), Point.init(1, 0), Point.init(0, 0), }) catch @panic("couldn't init snake body"), .direction = Point.init(1, 0), }; } pub fn draw(this: @This()) void { w4.DRAW_COLORS.* = 0x0043; for (this.body.constSlice()) |part| { w4.rect(.{ part.x * 8, part.y * 8 }, .{ 8, 8 }); } w4.DRAW_COLORS.* = 0x0004; w4.rect(.{ this.body.get(0).x * 8, this.body.get(0).y * 8 }, .{ 8, 8 }); } pub fn update(this: *@This()) void { const part = this.body.slice(); var i: u32 = part.len - 1; while (i > 0) : (i -= 1) { part[i].x = part[i - 1].x; part[i].y = part[i - 1].y; } part[0].x = @mod((part[0].x + this.direction.x), 20); part[0].y = @mod((part[0].y + this.direction.y), 20); if (part[0].x < 0) part[0].x = 19; if (part[0].y < 0) part[0].y = 19; } pub fn up(this: *@This()) void { if (this.direction.y == 0) { this.direction.x = 0; this.direction.y = -1; } } pub fn down(this: *@This()) void { if (this.direction.y == 0) { this.direction.x = 0; this.direction.y = 1; } } pub fn left(this: *@This()) void { if (this.direction.x == 0) { this.direction.x = -1; this.direction.y = 0; } } pub fn right(this: *@This()) void { if (this.direction.x == 0) { this.direction.x = 1; this.direction.y = 0; } } };
src/snake.zig
const std = @import("std"); const ssl = @import("ssl"); const SSLConnection = ssl.SSLConnection; const Address = std.net.Address; const Allocator = std.mem.Allocator; pub const HeaderMap = std.StringHashMap(Header); pub const Header = struct { value: []const u8 }; pub const HttpResponse = struct { headers: HeaderMap, content: []const u8, alloc: *Allocator, pub fn deinit(self: *HttpResponse) void { self.alloc.free(self.content); self.headers.deinit(); } }; pub const HttpRequest = struct { headers: HeaderMap, host: []const u8, path: []const u8, /// Whether it uses TLS or SSL. secure: bool = false }; fn parseResponse(allocator: *Allocator, text: []u8) !HttpResponse { var map = HeaderMap.init(allocator); var pos: usize = 0; // 0 = HTTP status // 1 = header key // 2 = header value var parsing: u2 = 0; var keyStart: usize = 0; var keyEnd: usize = 0; var valueStart: usize = 0; var valueEnd: usize = 0; while (true) { var char = text[pos]; if (std.mem.eql(u8, text[pos..(pos+2)], "\r\n")) { if (parsing == 1 and keyStart == 0) { pos = pos + 2; break; } else { if (parsing == 0) { parsing = 1; } if (parsing == 2) { const lower = try std.ascii.allocLowerString(allocator, text[keyStart..keyEnd]); try map.put(lower, .{ .value = text[valueStart..valueEnd] }); keyStart = 0; valueStart = 0; parsing = 1; } pos = pos + 1; } } else if (parsing == 0) { // TODO } else if (parsing == 1) { if (keyStart == 0) { keyStart = pos; } if (char == ':') { pos = pos + 1; // skip : and whitespace parsing = 2; } else { keyEnd = pos+1; } } else if (parsing == 2) { if (valueStart == 0) { valueStart = pos; } valueEnd = pos+1; } pos = pos + 1; } var resp: HttpResponse = .{ .headers = map, .alloc = allocator, .content = text[pos..] }; return resp; } pub fn request(allocator: *Allocator, address: Address, rst: HttpRequest) !HttpResponse { var file = try std.net.tcpConnectToAddress(address); const conn = try SSLConnection.init(allocator, file, rst.host, rst.secure); defer conn.deinit(); const reader = conn.reader(); const writer = conn.writer(); try writer.writeAll("GET "); try writer.writeAll(rst.path); try writer.writeAll(" HTTP/1.1\r\n"); try writer.writeAll("Host: "); try writer.writeAll(rst.host); try writer.writeAll("\r\n"); var it = rst.headers.iterator(); while (it.next()) |entry| { try writer.writeAll(entry.key); try writer.writeAll(": "); try writer.writeAll(entry.value.value); try writer.writeAll("\r\n"); std.debug.warn("{s}: {s}\n", .{entry.key, entry.value.value}); } try writer.writeAll("\r\n"); var result: []u8 = try allocator.alloc(u8, 0); var bytes: []u8 = try allocator.alloc(u8, 4096); defer allocator.free(bytes); var read: usize = 0; var len: usize = 0; while (true) { read = try reader.read(bytes); var slice = bytes[0..read]; var start = len; len += read; result = try allocator.realloc(result, len); @memcpy(result[start..].ptr, slice.ptr, read); if (read == 0) { break; } } return parseResponse(allocator, result); }
zervo/protocols/http.zig
pub const DEVPKEY_MTPBTH_IsConnected = PROPERTYKEY { .fmtid = Guid.initString("ea1237fa-589d-4472-84e4-0abe36fd62ef"), .pid = 2 }; pub const GUID_DEVINTERFACE_WPD = Guid.initString("6ac27878-a6fa-4155-ba85-f98f491d4f33"); pub const GUID_DEVINTERFACE_WPD_PRIVATE = Guid.initString("ba0c718f-4ded-49b7-bdd3-fabe28661211"); pub const GUID_DEVINTERFACE_WPD_SERVICE = Guid.initString("9ef44f80-3d64-4246-a6aa-206f328d1edc"); pub const WPD_CONTROL_FUNCTION_GENERIC_MESSAGE = @as(u32, 66); pub const IOCTL_WPD_MESSAGE_READWRITE_ACCESS = @as(u32, 4243720); pub const IOCTL_WPD_MESSAGE_READ_ACCESS = @as(u32, 4210952); pub const FACILITY_WPD = @as(u32, 42); pub const E_WPD_DEVICE_ALREADY_OPENED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144731135)); pub const E_WPD_DEVICE_NOT_OPEN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144731134)); pub const E_WPD_OBJECT_ALREADY_ATTACHED_TO_DEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144731133)); pub const E_WPD_OBJECT_NOT_ATTACHED_TO_DEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144731132)); pub const E_WPD_OBJECT_NOT_COMMITED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144731131)); pub const E_WPD_DEVICE_IS_HUNG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144731130)); pub const E_WPD_SMS_INVALID_RECIPIENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144731036)); pub const E_WPD_SMS_INVALID_MESSAGE_BODY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144731035)); pub const E_WPD_SMS_SERVICE_UNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144731034)); pub const E_WPD_SERVICE_ALREADY_OPENED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144730936)); pub const E_WPD_SERVICE_NOT_OPEN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144730935)); pub const E_WPD_OBJECT_ALREADY_ATTACHED_TO_SERVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144730934)); pub const E_WPD_OBJECT_NOT_ATTACHED_TO_SERVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144730933)); pub const E_WPD_SERVICE_BAD_PARAMETER_ORDER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2144730932)); pub const WPD_EVENT_NOTIFICATION = Guid.initString("2ba2e40a-6b4c-4295-bb43-26322b99aeb2"); pub const WPD_EVENT_OBJECT_ADDED = Guid.initString("a726da95-e207-4b02-8d44-bef2e86cbffc"); pub const WPD_EVENT_OBJECT_REMOVED = Guid.initString("be82ab88-a52c-4823-96e5-d0272671fc38"); pub const WPD_EVENT_OBJECT_UPDATED = Guid.initString("1445a759-2e01-485d-9f27-ff07dae697ab"); pub const WPD_EVENT_DEVICE_RESET = Guid.initString("7755cf53-c1ed-44f3-b5a2-451e2c376b27"); pub const WPD_EVENT_DEVICE_CAPABILITIES_UPDATED = Guid.initString("36885aa1-cd54-4daa-b3d0-afb3e03f5999"); pub const WPD_EVENT_STORAGE_FORMAT = Guid.initString("3782616b-22bc-4474-a251-3070f8d38857"); pub const WPD_EVENT_OBJECT_TRANSFER_REQUESTED = Guid.initString("8d16a0a1-f2c6-41da-8f19-5e53721adbf2"); pub const WPD_EVENT_DEVICE_REMOVED = Guid.initString("e4cbca1b-6918-48b9-85ee-02be7c850af9"); pub const WPD_EVENT_SERVICE_METHOD_COMPLETE = Guid.initString("8a33f5f8-0acc-4d9b-9cc4-112d353b86ca"); pub const WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT = Guid.initString("99ed0160-17ff-4c44-9d98-1d7a6f941921"); pub const WPD_CONTENT_TYPE_FOLDER = Guid.initString("27e2e392-a111-48e0-ab0c-e17705a05f85"); pub const WPD_CONTENT_TYPE_IMAGE = Guid.initString("ef2107d5-a52a-4243-a26b-62d4176d7603"); pub const WPD_CONTENT_TYPE_DOCUMENT = Guid.initString("680adf52-950a-4041-9b41-65e393648155"); pub const WPD_CONTENT_TYPE_CONTACT = Guid.initString("eaba8313-4525-4707-9f0e-87c6808e9435"); pub const WPD_CONTENT_TYPE_CONTACT_GROUP = Guid.initString("346b8932-4c36-40d8-9415-1828291f9de9"); pub const WPD_CONTENT_TYPE_AUDIO = Guid.initString("4ad2c85e-5e2d-45e5-8864-4f229e3c6cf0"); pub const WPD_CONTENT_TYPE_VIDEO = Guid.initString("9261b03c-3d78-4519-85e3-02c5e1f50bb9"); pub const WPD_CONTENT_TYPE_TELEVISION = Guid.initString("60a169cf-f2ae-4e21-9375-9677f11c1c6e"); pub const WPD_CONTENT_TYPE_PLAYLIST = Guid.initString("1a33f7e4-af13-48f5-994e-77369dfe04a3"); pub const WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM = Guid.initString("00f0c3ac-a593-49ac-9219-24abca5a2563"); pub const WPD_CONTENT_TYPE_AUDIO_ALBUM = Guid.initString("aa18737e-5009-48fa-ae21-85f24383b4e6"); pub const WPD_CONTENT_TYPE_IMAGE_ALBUM = Guid.initString("75793148-15f5-4a30-a813-54ed8a37e226"); pub const WPD_CONTENT_TYPE_VIDEO_ALBUM = Guid.initString("012b0db7-d4c1-45d6-b081-94b87779614f"); pub const WPD_CONTENT_TYPE_MEMO = Guid.initString("9cd20ecf-3b50-414f-a641-e473ffe45751"); pub const WPD_CONTENT_TYPE_EMAIL = Guid.initString("8038044a-7e51-4f8f-883d-1d0623d14533"); pub const WPD_CONTENT_TYPE_APPOINTMENT = Guid.initString("0fed060e-8793-4b1e-90c9-48ac389ac631"); pub const WPD_CONTENT_TYPE_TASK = Guid.initString("63252f2c-887f-4cb6-b1ac-d29855dcef6c"); pub const WPD_CONTENT_TYPE_PROGRAM = Guid.initString("d269f96a-247c-4bff-98fb-97f3c49220e6"); pub const WPD_CONTENT_TYPE_GENERIC_FILE = Guid.initString("0085e0a6-8d34-45d7-bc5c-447e59c73d48"); pub const WPD_CONTENT_TYPE_CALENDAR = Guid.initString("a1fd5967-6023-49a0-9df1-f8060be751b0"); pub const WPD_CONTENT_TYPE_GENERIC_MESSAGE = Guid.initString("e80eaaf8-b2db-4133-b67e-1bef4b4a6e5f"); pub const WPD_CONTENT_TYPE_NETWORK_ASSOCIATION = Guid.initString("031da7ee-18c8-4205-847e-89a11261d0f3"); pub const WPD_CONTENT_TYPE_CERTIFICATE = Guid.initString("dc3876e8-a948-4060-9050-cbd77e8a3d87"); pub const WPD_CONTENT_TYPE_WIRELESS_PROFILE = Guid.initString("0bac070a-9f5f-4da4-a8f6-3de44d68fd6c"); pub const WPD_CONTENT_TYPE_MEDIA_CAST = Guid.initString("5e88b3cc-3e65-4e62-bfff-229495253ab0"); pub const WPD_CONTENT_TYPE_SECTION = Guid.initString("821089f5-1d91-4dc9-be3c-bbb1b35b18ce"); pub const WPD_CONTENT_TYPE_UNSPECIFIED = Guid.initString("28d8d31e-249c-454e-aabc-34883168e634"); pub const WPD_CONTENT_TYPE_ALL = Guid.initString("80e170d2-1055-4a3e-b952-82cc4f8a8689"); pub const WPD_FUNCTIONAL_CATEGORY_DEVICE = Guid.initString("08ea466b-e3a4-4336-a1f3-a44d2b5c438c"); pub const WPD_FUNCTIONAL_CATEGORY_STORAGE = Guid.initString("23f05bbc-15de-4c2a-a55b-a9af5ce412ef"); pub const WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE = Guid.initString("613ca327-ab93-4900-b4fa-895bb5874b79"); pub const WPD_FUNCTIONAL_CATEGORY_AUDIO_CAPTURE = Guid.initString("3f2a1919-c7c2-4a00-855d-f57cf06debbb"); pub const WPD_FUNCTIONAL_CATEGORY_VIDEO_CAPTURE = Guid.initString("e23e5f6b-7243-43aa-8df1-0eb3d968a918"); pub const WPD_FUNCTIONAL_CATEGORY_SMS = Guid.initString("0044a0b1-c1e9-4afd-b358-a62c6117c9cf"); pub const WPD_FUNCTIONAL_CATEGORY_RENDERING_INFORMATION = Guid.initString("08600ba4-a7ba-4a01-ab0e-0065d0a356d3"); pub const WPD_FUNCTIONAL_CATEGORY_NETWORK_CONFIGURATION = Guid.initString("48f4db72-7c6a-4ab0-9e1a-470e3cdbf26a"); pub const WPD_FUNCTIONAL_CATEGORY_ALL = Guid.initString("2d8a6512-a74c-448e-ba8a-f4ac07c49399"); pub const WPD_OBJECT_FORMAT_ICON = Guid.initString("077232ed-102c-4638-9c22-83f142bfc822"); pub const WPD_OBJECT_FORMAT_M4A = Guid.initString("30aba7ac-6ffd-4c23-a359-3e9b52f3f1c8"); pub const WPD_OBJECT_FORMAT_NETWORK_ASSOCIATION = Guid.initString("b1020000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_X509V3CERTIFICATE = Guid.initString("b1030000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MICROSOFT_WFC = Guid.initString("b1040000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_3GPA = Guid.initString("e5172730-f971-41ef-a10b-2271a0019d7a"); pub const WPD_OBJECT_FORMAT_3G2A = Guid.initString("1a11202d-8759-4e34-ba5e-b1211087eee4"); pub const WPD_OBJECT_FORMAT_ALL = Guid.initString("c1f62eb2-4bb3-479c-9cfa-05b5f3a57b22"); pub const WPD_CATEGORY_NULL = Guid.initString("00000000-0000-0000-0000-000000000000"); pub const WPD_OBJECT_PROPERTIES_V1 = Guid.initString("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"); pub const WPD_OBJECT_PROPERTIES_V2 = Guid.initString("0373cd3d-4a46-40d7-b4d8-73e8da74e775"); pub const WPD_FUNCTIONAL_OBJECT_PROPERTIES_V1 = Guid.initString("8f052d93-abca-4fc5-a5ac-b01df4dbe598"); pub const WPD_STORAGE_OBJECT_PROPERTIES_V1 = Guid.initString("01a3057a-74d6-4e80-bea7-dc4c212ce50a"); pub const WPD_NETWORK_ASSOCIATION_PROPERTIES_V1 = Guid.initString("e4c93c1f-b203-43f1-a100-5a07d11b0274"); pub const WPD_STILL_IMAGE_CAPTURE_OBJECT_PROPERTIES_V1 = Guid.initString("58c571ec-1bcb-42a7-8ac5-bb291573a260"); pub const WPD_RENDERING_INFORMATION_OBJECT_PROPERTIES_V1 = Guid.initString("c53d039f-ee23-4a31-8590-7639879870b4"); pub const WPD_CLIENT_INFORMATION_PROPERTIES_V1 = Guid.initString("204d9f0c-2292-4080-9f42-40664e70f859"); pub const WPD_PROPERTY_ATTRIBUTES_V1 = Guid.initString("ab7943d8-6332-445f-a00d-8d5ef1e96f37"); pub const WPD_PROPERTY_ATTRIBUTES_V2 = Guid.initString("5d9da160-74ae-43cc-85a9-fe555a80798e"); pub const WPD_CLASS_EXTENSION_OPTIONS_V1 = Guid.initString("6309ffef-a87c-4ca7-8434-797576e40a96"); pub const WPD_CLASS_EXTENSION_OPTIONS_V2 = Guid.initString("3e3595da-4d71-49fe-a0b4-d4406c3ae93f"); pub const WPD_CLASS_EXTENSION_OPTIONS_V3 = Guid.initString("65c160f8-1367-4ce2-939d-8310839f0d30"); pub const WPD_RESOURCE_ATTRIBUTES_V1 = Guid.initString("1eb6f604-9278-429f-93cc-5bb8c06656b6"); pub const WPD_DEVICE_PROPERTIES_V1 = Guid.initString("26d4979a-e643-4626-9e2b-736dc0c92fdc"); pub const WPD_DEVICE_PROPERTIES_V2 = Guid.initString("463dd662-7fc4-4291-911c-7f4c9cca9799"); pub const WPD_DEVICE_PROPERTIES_V3 = Guid.initString("6c2b878c-c2ec-490d-b425-d7a75e23e5ed"); pub const WPD_SERVICE_PROPERTIES_V1 = Guid.initString("7510698a-cb54-481c-b8db-0d75c93f1c06"); pub const WPD_EVENT_PROPERTIES_V1 = Guid.initString("15ab1953-f817-4fef-a921-5676e838f6e0"); pub const WPD_EVENT_PROPERTIES_V2 = Guid.initString("52807b8a-4914-4323-9b9a-74f654b2b846"); pub const WPD_EVENT_OPTIONS_V1 = Guid.initString("b3d8dad7-a361-4b83-8a48-5b02ce10713b"); pub const WPD_EVENT_ATTRIBUTES_V1 = Guid.initString("10c96578-2e81-4111-adde-e08ca6138f6d"); pub const WPD_API_OPTIONS_V1 = Guid.initString("10e54a3e-052d-4777-a13c-de7614be2bc4"); pub const WPD_FORMAT_ATTRIBUTES_V1 = Guid.initString("a0a02000-bcaf-4be8-b3f5-233f231cf58f"); pub const WPD_METHOD_ATTRIBUTES_V1 = Guid.initString("f17a5071-f039-44af-8efe-432cf32e432a"); pub const WPD_PARAMETER_ATTRIBUTES_V1 = Guid.initString("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"); pub const WPD_CATEGORY_COMMON = Guid.initString("f0422a9c-5dc8-4440-b5bd-5df28835658a"); pub const WPD_CATEGORY_OBJECT_ENUMERATION = Guid.initString("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec"); pub const WPD_CATEGORY_OBJECT_PROPERTIES = Guid.initString("9e5582e4-0814-44e6-981a-b2998d583804"); pub const WPD_CATEGORY_OBJECT_PROPERTIES_BULK = Guid.initString("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"); pub const WPD_CATEGORY_OBJECT_RESOURCES = Guid.initString("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"); pub const WPD_CATEGORY_OBJECT_MANAGEMENT = Guid.initString("ef1e43dd-a9ed-4341-8bcc-186192aea089"); pub const WPD_CATEGORY_CAPABILITIES = Guid.initString("0cabec78-6b74-41c6-9216-2639d1fce356"); pub const WPD_CATEGORY_STORAGE = Guid.initString("d8f907a6-34cc-45fa-97fb-d007fa47ec94"); pub const WPD_CATEGORY_SMS = Guid.initString("afc25d66-fe0d-4114-9097-970c93e920d1"); pub const WPD_CATEGORY_STILL_IMAGE_CAPTURE = Guid.initString("4fcd6982-22a2-4b05-a48b-62d38bf27b32"); pub const WPD_CATEGORY_MEDIA_CAPTURE = Guid.initString("59b433ba-fe44-4d8d-808c-6bcb9b0f15e8"); pub const WPD_CATEGORY_DEVICE_HINTS = Guid.initString("0d5fb92b-cb46-4c4f-8343-0bc3d3f17c84"); pub const WPD_CLASS_EXTENSION_V1 = Guid.initString("33fb0d11-64a3-4fac-b4c7-3dfeaa99b051"); pub const WPD_CLASS_EXTENSION_V2 = Guid.initString("7f0779b5-fa2b-4766-9cb2-f73ba30b6758"); pub const WPD_CATEGORY_NETWORK_CONFIGURATION = Guid.initString("78f9c6fc-79b8-473c-9060-6bd23dd072c4"); pub const WPD_CATEGORY_SERVICE_COMMON = Guid.initString("322f071d-36ef-477f-b4b5-6f52d734baee"); pub const WPD_CATEGORY_SERVICE_CAPABILITIES = Guid.initString("24457e74-2e9f-44f9-8c57-1d1bcb170b89"); pub const WPD_CATEGORY_SERVICE_METHODS = Guid.initString("2d521ca8-c1b0-4268-a342-cf19321569bc"); pub const WPD_OBJECT_FORMAT_PROPERTIES_ONLY = Guid.initString("30010000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_UNSPECIFIED = Guid.initString("30000000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_SCRIPT = Guid.initString("30020000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_EXECUTABLE = Guid.initString("30030000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_TEXT = Guid.initString("30040000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_HTML = Guid.initString("30050000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_DPOF = Guid.initString("30060000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_AIFF = Guid.initString("30070000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_WAVE = Guid.initString("30080000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MP3 = Guid.initString("30090000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_AVI = Guid.initString("300a0000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MPEG = Guid.initString("300b0000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_ASF = Guid.initString("300c0000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_EXIF = Guid.initString("38010000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_TIFFEP = Guid.initString("38020000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_FLASHPIX = Guid.initString("38030000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_BMP = Guid.initString("38040000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_CIFF = Guid.initString("38050000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_GIF = Guid.initString("38070000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_JFIF = Guid.initString("38080000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_PCD = Guid.initString("38090000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_PICT = Guid.initString("380a0000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_PNG = Guid.initString("380b0000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_TIFF = Guid.initString("380d0000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_TIFFIT = Guid.initString("380e0000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_JP2 = Guid.initString("380f0000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_JPX = Guid.initString("38100000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_WBMP = Guid.initString("b8030000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_JPEGXR = Guid.initString("b8040000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_WINDOWSIMAGEFORMAT = Guid.initString("b8810000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_WMA = Guid.initString("b9010000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_WMV = Guid.initString("b9810000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_WPLPLAYLIST = Guid.initString("ba100000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_M3UPLAYLIST = Guid.initString("ba110000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MPLPLAYLIST = Guid.initString("ba120000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_ASXPLAYLIST = Guid.initString("ba130000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_PLSPLAYLIST = Guid.initString("ba140000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_ABSTRACT_CONTACT_GROUP = Guid.initString("ba060000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_ABSTRACT_MEDIA_CAST = Guid.initString("ba0b0000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_VCALENDAR1 = Guid.initString("be020000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_ICALENDAR = Guid.initString("be030000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_ABSTRACT_CONTACT = Guid.initString("bb810000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_VCARD2 = Guid.initString("bb820000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_VCARD3 = Guid.initString("bb830000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_XML = Guid.initString("ba820000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_AAC = Guid.initString("b9030000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_AUDIBLE = Guid.initString("b9040000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_FLAC = Guid.initString("b9060000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_QCELP = Guid.initString("b9070000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_AMR = Guid.initString("b9080000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_OGG = Guid.initString("b9020000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MP4 = Guid.initString("b9820000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MP2 = Guid.initString("b9830000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MICROSOFT_WORD = Guid.initString("ba830000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MHT_COMPILED_HTML = Guid.initString("ba840000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MICROSOFT_EXCEL = Guid.initString("ba850000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MICROSOFT_POWERPOINT = Guid.initString("ba860000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_3GP = Guid.initString("b9840000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_3G2 = Guid.initString("b9850000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_AVCHD = Guid.initString("b9860000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_ATSCTS = Guid.initString("b9870000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_DVBTS = Guid.initString("b9880000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_OBJECT_FORMAT_MKV = Guid.initString("b9900000-ae6c-4804-98ba-c57b46965fe7"); pub const WPD_FOLDER_OBJECT_PROPERTIES_V1 = Guid.initString("7e9a7abf-e568-4b34-aa2f-13bb12ab177d"); pub const WPD_IMAGE_OBJECT_PROPERTIES_V1 = Guid.initString("63d64908-9fa1-479f-85ba-9952216447db"); pub const WPD_DOCUMENT_OBJECT_PROPERTIES_V1 = Guid.initString("0b110203-eb95-4f02-93e0-97c631493ad5"); pub const WPD_MEDIA_PROPERTIES_V1 = Guid.initString("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"); pub const WPD_CONTACT_OBJECT_PROPERTIES_V1 = Guid.initString("fbd4fdab-987d-4777-b3f9-726185a9312b"); pub const WPD_MUSIC_OBJECT_PROPERTIES_V1 = Guid.initString("b324f56a-dc5d-46e5-b6df-d2ea414888c6"); pub const WPD_VIDEO_OBJECT_PROPERTIES_V1 = Guid.initString("346f2163-f998-4146-8b01-d19b4c00de9a"); pub const WPD_COMMON_INFORMATION_OBJECT_PROPERTIES_V1 = Guid.initString("b28ae94b-05a4-4e8e-be01-72cc7e099d8f"); pub const WPD_MEMO_OBJECT_PROPERTIES_V1 = Guid.initString("5ffbfc7b-7483-41ad-afb9-da3f4e592b8d"); pub const WPD_EMAIL_OBJECT_PROPERTIES_V1 = Guid.initString("41f8f65a-5484-4782-b13d-4740dd7c37c5"); pub const WPD_APPOINTMENT_OBJECT_PROPERTIES_V1 = Guid.initString("f99efd03-431d-40d8-a1c9-4e220d9c88d3"); pub const WPD_TASK_OBJECT_PROPERTIES_V1 = Guid.initString("e354e95e-d8a0-4637-a03a-0cb26838dbc7"); pub const WPD_SMS_OBJECT_PROPERTIES_V1 = Guid.initString("7e1074cc-50ff-4dd1-a742-53be6f093a0d"); pub const WPD_SECTION_OBJECT_PROPERTIES_V1 = Guid.initString("516afd2b-c64e-44f0-98dc-bee1c88f7d66"); pub const DEVSVC_SERVICEINFO_VERSION = @as(u32, 100); pub const DEVSVCTYPE_DEFAULT = @as(u32, 0); pub const DEVSVCTYPE_ABSTRACT = @as(u32, 1); pub const TYPE_CalendarSvc = @as(u32, 0); pub const ENUM_CalendarObj_BusyStatusFree = @as(u32, 0); pub const ENUM_CalendarObj_BusyStatusBusy = @as(u32, 1); pub const ENUM_CalendarObj_BusyStatusOutOfOffice = @as(u32, 2); pub const ENUM_CalendarObj_BusyStatusTentative = @as(u32, 3); pub const TYPE_HintsSvc = @as(u32, 0); pub const TYPE_MessageSvc = @as(u32, 0); pub const ENUM_MessageObj_PriorityHighest = @as(u32, 2); pub const ENUM_MessageObj_PriorityNormal = @as(u32, 1); pub const ENUM_MessageObj_PriorityLowest = @as(u32, 0); pub const ENUM_MessageObj_ReadFalse = @as(u32, 0); pub const ENUM_MessageObj_ReadTrue = @as(u32, 255); pub const ENUM_MessageObj_PatternTypeDaily = @as(u32, 1); pub const ENUM_MessageObj_PatternTypeWeekly = @as(u32, 2); pub const ENUM_MessageObj_PatternTypeMonthly = @as(u32, 3); pub const ENUM_MessageObj_PatternTypeYearly = @as(u32, 4); pub const FLAG_MessageObj_DayOfWeekNone = @as(u32, 0); pub const FLAG_MessageObj_DayOfWeekSunday = @as(u32, 1); pub const FLAG_MessageObj_DayOfWeekMonday = @as(u32, 2); pub const FLAG_MessageObj_DayOfWeekTuesday = @as(u32, 4); pub const FLAG_MessageObj_DayOfWeekWednesday = @as(u32, 8); pub const FLAG_MessageObj_DayOfWeekThursday = @as(u32, 16); pub const FLAG_MessageObj_DayOfWeekFriday = @as(u32, 32); pub const FLAG_MessageObj_DayOfWeekSaturday = @as(u32, 64); pub const RANGEMIN_MessageObj_PatternDayOfMonth = @as(u32, 1); pub const RANGEMAX_MessageObj_PatternDayOfMonth = @as(u32, 31); pub const RANGESTEP_MessageObj_PatternDayOfMonth = @as(u32, 1); pub const RANGEMIN_MessageObj_PatternMonthOfYear = @as(u32, 1); pub const RANGEMAX_MessageObj_PatternMonthOfYear = @as(u32, 12); pub const RANGESTEP_MessageObj_PatternMonthOfYear = @as(u32, 1); pub const ENUM_MessageObj_PatternInstanceNone = @as(u32, 0); pub const ENUM_MessageObj_PatternInstanceFirst = @as(u32, 1); pub const ENUM_MessageObj_PatternInstanceSecond = @as(u32, 2); pub const ENUM_MessageObj_PatternInstanceThird = @as(u32, 3); pub const ENUM_MessageObj_PatternInstanceFourth = @as(u32, 4); pub const ENUM_MessageObj_PatternInstanceLast = @as(u32, 5); pub const TYPE_DeviceMetadataSvc = @as(u32, 0); pub const ENUM_DeviceMetadataObj_DefaultCABFalse = @as(u32, 0); pub const ENUM_DeviceMetadataObj_DefaultCABTrue = @as(u32, 1); pub const TYPE_NotesSvc = @as(u32, 0); pub const TYPE_StatusSvc = @as(u32, 0); pub const RANGEMIN_StatusSvc_SignalStrength = @as(u32, 0); pub const RANGEMAX_StatusSvc_SignalStrength = @as(u32, 4); pub const RANGESTEP_StatusSvc_SignalStrength = @as(u32, 1); pub const RANGEMAX_StatusSvc_TextMessages = @as(u32, 255); pub const RANGEMAX_StatusSvc_NewPictures = @as(u32, 65535); pub const RANGEMAX_StatusSvc_MissedCalls = @as(u32, 255); pub const RANGEMAX_StatusSvc_VoiceMail = @as(u32, 255); pub const ENUM_StatusSvc_RoamingInactive = @as(u32, 0); pub const ENUM_StatusSvc_RoamingActive = @as(u32, 1); pub const ENUM_StatusSvc_RoamingUnknown = @as(u32, 2); pub const RANGEMIN_StatusSvc_BatteryLife = @as(u32, 0); pub const RANGEMAX_StatusSvc_BatteryLife = @as(u32, 100); pub const RANGESTEP_StatusSvc_BatteryLife = @as(u32, 1); pub const ENUM_StatusSvc_ChargingInactive = @as(u32, 0); pub const ENUM_StatusSvc_ChargingActive = @as(u32, 1); pub const ENUM_StatusSvc_ChargingUnknown = @as(u32, 2); pub const SYNCSVC_FILTER_NONE = @as(u32, 0); pub const SYNCSVC_FILTER_CONTACTS_WITH_PHONE = @as(u32, 1); pub const SYNCSVC_FILTER_TASK_ACTIVE = @as(u32, 2); pub const SYNCSVC_FILTER_CALENDAR_WINDOW_WITH_RECURRENCE = @as(u32, 3); pub const ENUM_SyncSvc_SyncObjectReferencesDisabled = @as(u32, 0); pub const ENUM_SyncSvc_SyncObjectReferencesEnabled = @as(u32, 255); pub const TYPE_TasksSvc = @as(u32, 0); pub const ENUM_TaskObj_CompleteFalse = @as(u32, 0); pub const ENUM_TaskObj_CompleteTrue = @as(u32, 255); pub const WPD_CATEGORY_MTP_EXT_VENDOR_OPERATIONS = Guid.initString("4d545058-1a2e-4106-a357-771e0819fc56"); pub const WPD_PROPERTIES_MTP_VENDOR_EXTENDED_OBJECT_PROPS = Guid.initString("4d545058-4fce-4578-95c8-8698a9bc0f49"); pub const WPD_PROPERTIES_MTP_VENDOR_EXTENDED_DEVICE_PROPS = Guid.initString("4d545058-8900-40b3-8f1d-dc246e1e8370"); pub const WPD_EVENT_MTP_VENDOR_EXTENDED_EVENTS = Guid.initString("00000000-5738-4ff2-8445-be3126691059"); pub const CLSID_WPD_NAMESPACE_EXTENSION = Guid.initString("35786d3c-b075-49b9-88dd-029876e11c01"); pub const WPDNSE_OBJECT_PROPERTIES_V1 = Guid.initString("34d71409-4b47-4d80-aaac-3a28a4a3b3e6"); pub const WPDNSE_PROPSHEET_DEVICE_GENERAL = @as(u32, 1); pub const WPDNSE_PROPSHEET_STORAGE_GENERAL = @as(u32, 2); pub const WPDNSE_PROPSHEET_CONTENT_GENERAL = @as(u32, 4); pub const WPDNSE_PROPSHEET_CONTENT_REFERENCES = @as(u32, 8); pub const WPDNSE_PROPSHEET_CONTENT_RESOURCES = @as(u32, 16); pub const WPDNSE_PROPSHEET_CONTENT_DETAILS = @as(u32, 32); pub const TYPE_ContactsSvc = @as(u32, 0); pub const TYPE_RingtonesSvc = @as(u32, 0); pub const TYPE_AnchorSyncSvc = @as(u32, 1); pub const ENUM_AnchorResults_AnchorStateNormal = @as(u32, 0); pub const ENUM_AnchorResults_AnchorStateInvalid = @as(u32, 1); pub const ENUM_AnchorResults_AnchorStateOld = @as(u32, 2); pub const ENUM_AnchorResults_ItemStateInvalid = @as(u32, 0); pub const ENUM_AnchorResults_ItemStateDeleted = @as(u32, 1); pub const ENUM_AnchorResults_ItemStateCreated = @as(u32, 2); pub const ENUM_AnchorResults_ItemStateUpdated = @as(u32, 3); pub const ENUM_AnchorResults_ItemStateChanged = @as(u32, 4); pub const TYPE_FullEnumSyncSvc = @as(u32, 1); //-------------------------------------------------------------------------------- // Section: Types (80) //-------------------------------------------------------------------------------- pub const DELETE_OBJECT_OPTIONS = enum(i32) { NO_RECURSION = 0, WITH_RECURSION = 1, }; pub const PORTABLE_DEVICE_DELETE_NO_RECURSION = DELETE_OBJECT_OPTIONS.NO_RECURSION; pub const PORTABLE_DEVICE_DELETE_WITH_RECURSION = DELETE_OBJECT_OPTIONS.WITH_RECURSION; pub const WPD_DEVICE_TYPES = enum(i32) { GENERIC = 0, CAMERA = 1, MEDIA_PLAYER = 2, PHONE = 3, VIDEO = 4, PERSONAL_INFORMATION_MANAGER = 5, AUDIO_RECORDER = 6, }; pub const WPD_DEVICE_TYPE_GENERIC = WPD_DEVICE_TYPES.GENERIC; pub const WPD_DEVICE_TYPE_CAMERA = WPD_DEVICE_TYPES.CAMERA; pub const WPD_DEVICE_TYPE_MEDIA_PLAYER = WPD_DEVICE_TYPES.MEDIA_PLAYER; pub const WPD_DEVICE_TYPE_PHONE = WPD_DEVICE_TYPES.PHONE; pub const WPD_DEVICE_TYPE_VIDEO = WPD_DEVICE_TYPES.VIDEO; pub const WPD_DEVICE_TYPE_PERSONAL_INFORMATION_MANAGER = WPD_DEVICE_TYPES.PERSONAL_INFORMATION_MANAGER; pub const WPD_DEVICE_TYPE_AUDIO_RECORDER = WPD_DEVICE_TYPES.AUDIO_RECORDER; pub const WpdAttributeForm = enum(i32) { UNSPECIFIED = 0, RANGE = 1, ENUMERATION = 2, REGULAR_EXPRESSION = 3, OBJECT_IDENTIFIER = 4, }; pub const WPD_PROPERTY_ATTRIBUTE_FORM_UNSPECIFIED = WpdAttributeForm.UNSPECIFIED; pub const WPD_PROPERTY_ATTRIBUTE_FORM_RANGE = WpdAttributeForm.RANGE; pub const WPD_PROPERTY_ATTRIBUTE_FORM_ENUMERATION = WpdAttributeForm.ENUMERATION; pub const WPD_PROPERTY_ATTRIBUTE_FORM_REGULAR_EXPRESSION = WpdAttributeForm.REGULAR_EXPRESSION; pub const WPD_PROPERTY_ATTRIBUTE_FORM_OBJECT_IDENTIFIER = WpdAttributeForm.OBJECT_IDENTIFIER; pub const WpdParameterAttributeForm = enum(i32) { UNSPECIFIED = 0, RANGE = 1, ENUMERATION = 2, REGULAR_EXPRESSION = 3, OBJECT_IDENTIFIER = 4, }; pub const WPD_PARAMETER_ATTRIBUTE_FORM_UNSPECIFIED = WpdParameterAttributeForm.UNSPECIFIED; pub const WPD_PARAMETER_ATTRIBUTE_FORM_RANGE = WpdParameterAttributeForm.RANGE; pub const WPD_PARAMETER_ATTRIBUTE_FORM_ENUMERATION = WpdParameterAttributeForm.ENUMERATION; pub const WPD_PARAMETER_ATTRIBUTE_FORM_REGULAR_EXPRESSION = WpdParameterAttributeForm.REGULAR_EXPRESSION; pub const WPD_PARAMETER_ATTRIBUTE_FORM_OBJECT_IDENTIFIER = WpdParameterAttributeForm.OBJECT_IDENTIFIER; pub const WPD_DEVICE_TRANSPORTS = enum(i32) { UNSPECIFIED = 0, USB = 1, IP = 2, BLUETOOTH = 3, }; pub const WPD_DEVICE_TRANSPORT_UNSPECIFIED = WPD_DEVICE_TRANSPORTS.UNSPECIFIED; pub const WPD_DEVICE_TRANSPORT_USB = WPD_DEVICE_TRANSPORTS.USB; pub const WPD_DEVICE_TRANSPORT_IP = WPD_DEVICE_TRANSPORTS.IP; pub const WPD_DEVICE_TRANSPORT_BLUETOOTH = WPD_DEVICE_TRANSPORTS.BLUETOOTH; pub const WPD_STORAGE_TYPE_VALUES = enum(i32) { UNDEFINED = 0, FIXED_ROM = 1, REMOVABLE_ROM = 2, FIXED_RAM = 3, REMOVABLE_RAM = 4, }; pub const WPD_STORAGE_TYPE_UNDEFINED = WPD_STORAGE_TYPE_VALUES.UNDEFINED; pub const WPD_STORAGE_TYPE_FIXED_ROM = WPD_STORAGE_TYPE_VALUES.FIXED_ROM; pub const WPD_STORAGE_TYPE_REMOVABLE_ROM = WPD_STORAGE_TYPE_VALUES.REMOVABLE_ROM; pub const WPD_STORAGE_TYPE_FIXED_RAM = WPD_STORAGE_TYPE_VALUES.FIXED_RAM; pub const WPD_STORAGE_TYPE_REMOVABLE_RAM = WPD_STORAGE_TYPE_VALUES.REMOVABLE_RAM; pub const WPD_STORAGE_ACCESS_CAPABILITY_VALUES = enum(i32) { WRITE = 0, _ONLY_WITHOUT_OBJECT_DELETION = 1, _ONLY_WITH_OBJECT_DELETION = 2, }; pub const WPD_STORAGE_ACCESS_CAPABILITY_READWRITE = WPD_STORAGE_ACCESS_CAPABILITY_VALUES.WRITE; pub const WPD_STORAGE_ACCESS_CAPABILITY_READ_ONLY_WITHOUT_OBJECT_DELETION = WPD_STORAGE_ACCESS_CAPABILITY_VALUES._ONLY_WITHOUT_OBJECT_DELETION; pub const WPD_STORAGE_ACCESS_CAPABILITY_READ_ONLY_WITH_OBJECT_DELETION = WPD_STORAGE_ACCESS_CAPABILITY_VALUES._ONLY_WITH_OBJECT_DELETION; pub const WPD_SMS_ENCODING_TYPES = enum(i32) { @"7_BIT" = 0, @"8_BIT" = 1, UTF_16 = 2, }; pub const SMS_ENCODING_7_BIT = WPD_SMS_ENCODING_TYPES.@"7_BIT"; pub const SMS_ENCODING_8_BIT = WPD_SMS_ENCODING_TYPES.@"8_BIT"; pub const SMS_ENCODING_UTF_16 = WPD_SMS_ENCODING_TYPES.UTF_16; pub const SMS_MESSAGE_TYPES = enum(i32) { TEXT_MESSAGE = 0, BINARY_MESSAGE = 1, }; pub const SMS_TEXT_MESSAGE = SMS_MESSAGE_TYPES.TEXT_MESSAGE; pub const SMS_BINARY_MESSAGE = SMS_MESSAGE_TYPES.BINARY_MESSAGE; pub const WPD_POWER_SOURCES = enum(i32) { BATTERY = 0, EXTERNAL = 1, }; pub const WPD_POWER_SOURCE_BATTERY = WPD_POWER_SOURCES.BATTERY; pub const WPD_POWER_SOURCE_EXTERNAL = WPD_POWER_SOURCES.EXTERNAL; pub const WPD_WHITE_BALANCE_SETTINGS = enum(i32) { UNDEFINED = 0, MANUAL = 1, AUTOMATIC = 2, ONE_PUSH_AUTOMATIC = 3, DAYLIGHT = 4, FLORESCENT = 5, TUNGSTEN = 6, FLASH = 7, }; pub const WPD_WHITE_BALANCE_UNDEFINED = WPD_WHITE_BALANCE_SETTINGS.UNDEFINED; pub const WPD_WHITE_BALANCE_MANUAL = WPD_WHITE_BALANCE_SETTINGS.MANUAL; pub const WPD_WHITE_BALANCE_AUTOMATIC = WPD_WHITE_BALANCE_SETTINGS.AUTOMATIC; pub const WPD_WHITE_BALANCE_ONE_PUSH_AUTOMATIC = WPD_WHITE_BALANCE_SETTINGS.ONE_PUSH_AUTOMATIC; pub const WPD_WHITE_BALANCE_DAYLIGHT = WPD_WHITE_BALANCE_SETTINGS.DAYLIGHT; pub const WPD_WHITE_BALANCE_FLORESCENT = WPD_WHITE_BALANCE_SETTINGS.FLORESCENT; pub const WPD_WHITE_BALANCE_TUNGSTEN = WPD_WHITE_BALANCE_SETTINGS.TUNGSTEN; pub const WPD_WHITE_BALANCE_FLASH = WPD_WHITE_BALANCE_SETTINGS.FLASH; pub const WPD_FOCUS_MODES = enum(i32) { UNDEFINED = 0, MANUAL = 1, AUTOMATIC = 2, AUTOMATIC_MACRO = 3, }; pub const WPD_FOCUS_UNDEFINED = WPD_FOCUS_MODES.UNDEFINED; pub const WPD_FOCUS_MANUAL = WPD_FOCUS_MODES.MANUAL; pub const WPD_FOCUS_AUTOMATIC = WPD_FOCUS_MODES.AUTOMATIC; pub const WPD_FOCUS_AUTOMATIC_MACRO = WPD_FOCUS_MODES.AUTOMATIC_MACRO; pub const WPD_EXPOSURE_METERING_MODES = enum(i32) { UNDEFINED = 0, AVERAGE = 1, CENTER_WEIGHTED_AVERAGE = 2, MULTI_SPOT = 3, CENTER_SPOT = 4, }; pub const WPD_EXPOSURE_METERING_MODE_UNDEFINED = WPD_EXPOSURE_METERING_MODES.UNDEFINED; pub const WPD_EXPOSURE_METERING_MODE_AVERAGE = WPD_EXPOSURE_METERING_MODES.AVERAGE; pub const WPD_EXPOSURE_METERING_MODE_CENTER_WEIGHTED_AVERAGE = WPD_EXPOSURE_METERING_MODES.CENTER_WEIGHTED_AVERAGE; pub const WPD_EXPOSURE_METERING_MODE_MULTI_SPOT = WPD_EXPOSURE_METERING_MODES.MULTI_SPOT; pub const WPD_EXPOSURE_METERING_MODE_CENTER_SPOT = WPD_EXPOSURE_METERING_MODES.CENTER_SPOT; pub const WPD_FLASH_MODES = enum(i32) { UNDEFINED = 0, AUTO = 1, OFF = 2, FILL = 3, RED_EYE_AUTO = 4, RED_EYE_FILL = 5, EXTERNAL_SYNC = 6, }; pub const WPD_FLASH_MODE_UNDEFINED = WPD_FLASH_MODES.UNDEFINED; pub const WPD_FLASH_MODE_AUTO = WPD_FLASH_MODES.AUTO; pub const WPD_FLASH_MODE_OFF = WPD_FLASH_MODES.OFF; pub const WPD_FLASH_MODE_FILL = WPD_FLASH_MODES.FILL; pub const WPD_FLASH_MODE_RED_EYE_AUTO = WPD_FLASH_MODES.RED_EYE_AUTO; pub const WPD_FLASH_MODE_RED_EYE_FILL = WPD_FLASH_MODES.RED_EYE_FILL; pub const WPD_FLASH_MODE_EXTERNAL_SYNC = WPD_FLASH_MODES.EXTERNAL_SYNC; pub const WPD_EXPOSURE_PROGRAM_MODES = enum(i32) { UNDEFINED = 0, MANUAL = 1, AUTO = 2, APERTURE_PRIORITY = 3, SHUTTER_PRIORITY = 4, CREATIVE = 5, ACTION = 6, PORTRAIT = 7, }; pub const WPD_EXPOSURE_PROGRAM_MODE_UNDEFINED = WPD_EXPOSURE_PROGRAM_MODES.UNDEFINED; pub const WPD_EXPOSURE_PROGRAM_MODE_MANUAL = WPD_EXPOSURE_PROGRAM_MODES.MANUAL; pub const WPD_EXPOSURE_PROGRAM_MODE_AUTO = WPD_EXPOSURE_PROGRAM_MODES.AUTO; pub const WPD_EXPOSURE_PROGRAM_MODE_APERTURE_PRIORITY = WPD_EXPOSURE_PROGRAM_MODES.APERTURE_PRIORITY; pub const WPD_EXPOSURE_PROGRAM_MODE_SHUTTER_PRIORITY = WPD_EXPOSURE_PROGRAM_MODES.SHUTTER_PRIORITY; pub const WPD_EXPOSURE_PROGRAM_MODE_CREATIVE = WPD_EXPOSURE_PROGRAM_MODES.CREATIVE; pub const WPD_EXPOSURE_PROGRAM_MODE_ACTION = WPD_EXPOSURE_PROGRAM_MODES.ACTION; pub const WPD_EXPOSURE_PROGRAM_MODE_PORTRAIT = WPD_EXPOSURE_PROGRAM_MODES.PORTRAIT; pub const WPD_CAPTURE_MODES = enum(i32) { UNDEFINED = 0, NORMAL = 1, BURST = 2, TIMELAPSE = 3, }; pub const WPD_CAPTURE_MODE_UNDEFINED = WPD_CAPTURE_MODES.UNDEFINED; pub const WPD_CAPTURE_MODE_NORMAL = WPD_CAPTURE_MODES.NORMAL; pub const WPD_CAPTURE_MODE_BURST = WPD_CAPTURE_MODES.BURST; pub const WPD_CAPTURE_MODE_TIMELAPSE = WPD_CAPTURE_MODES.TIMELAPSE; pub const WPD_EFFECT_MODES = enum(i32) { UNDEFINED = 0, COLOR = 1, BLACK_AND_WHITE = 2, SEPIA = 3, }; pub const WPD_EFFECT_MODE_UNDEFINED = WPD_EFFECT_MODES.UNDEFINED; pub const WPD_EFFECT_MODE_COLOR = WPD_EFFECT_MODES.COLOR; pub const WPD_EFFECT_MODE_BLACK_AND_WHITE = WPD_EFFECT_MODES.BLACK_AND_WHITE; pub const WPD_EFFECT_MODE_SEPIA = WPD_EFFECT_MODES.SEPIA; pub const WPD_FOCUS_METERING_MODES = enum(i32) { UNDEFINED = 0, CENTER_SPOT = 1, MULTI_SPOT = 2, }; pub const WPD_FOCUS_METERING_MODE_UNDEFINED = WPD_FOCUS_METERING_MODES.UNDEFINED; pub const WPD_FOCUS_METERING_MODE_CENTER_SPOT = WPD_FOCUS_METERING_MODES.CENTER_SPOT; pub const WPD_FOCUS_METERING_MODE_MULTI_SPOT = WPD_FOCUS_METERING_MODES.MULTI_SPOT; pub const WPD_BITRATE_TYPES = enum(i32) { UNUSED = 0, DISCRETE = 1, VARIABLE = 2, FREE = 3, }; pub const WPD_BITRATE_TYPE_UNUSED = WPD_BITRATE_TYPES.UNUSED; pub const WPD_BITRATE_TYPE_DISCRETE = WPD_BITRATE_TYPES.DISCRETE; pub const WPD_BITRATE_TYPE_VARIABLE = WPD_BITRATE_TYPES.VARIABLE; pub const WPD_BITRATE_TYPE_FREE = WPD_BITRATE_TYPES.FREE; pub const WPD_META_GENRES = enum(i32) { UNUSED = 0, GENERIC_MUSIC_AUDIO_FILE = 1, GENERIC_NON_MUSIC_AUDIO_FILE = 17, SPOKEN_WORD_AUDIO_BOOK_FILES = 18, SPOKEN_WORD_FILES_NON_AUDIO_BOOK = 19, SPOKEN_WORD_NEWS = 20, SPOKEN_WORD_TALK_SHOWS = 21, GENERIC_VIDEO_FILE = 33, NEWS_VIDEO_FILE = 34, MUSIC_VIDEO_FILE = 35, HOME_VIDEO_FILE = 36, FEATURE_FILM_VIDEO_FILE = 37, TELEVISION_VIDEO_FILE = 38, TRAINING_EDUCATIONAL_VIDEO_FILE = 39, PHOTO_MONTAGE_VIDEO_FILE = 40, GENERIC_NON_AUDIO_NON_VIDEO = 48, AUDIO_PODCAST = 64, VIDEO_PODCAST = 65, MIXED_PODCAST = 66, }; pub const WPD_META_GENRE_UNUSED = WPD_META_GENRES.UNUSED; pub const WPD_META_GENRE_GENERIC_MUSIC_AUDIO_FILE = WPD_META_GENRES.GENERIC_MUSIC_AUDIO_FILE; pub const WPD_META_GENRE_GENERIC_NON_MUSIC_AUDIO_FILE = WPD_META_GENRES.GENERIC_NON_MUSIC_AUDIO_FILE; pub const WPD_META_GENRE_SPOKEN_WORD_AUDIO_BOOK_FILES = WPD_META_GENRES.SPOKEN_WORD_AUDIO_BOOK_FILES; pub const WPD_META_GENRE_SPOKEN_WORD_FILES_NON_AUDIO_BOOK = WPD_META_GENRES.SPOKEN_WORD_FILES_NON_AUDIO_BOOK; pub const WPD_META_GENRE_SPOKEN_WORD_NEWS = WPD_META_GENRES.SPOKEN_WORD_NEWS; pub const WPD_META_GENRE_SPOKEN_WORD_TALK_SHOWS = WPD_META_GENRES.SPOKEN_WORD_TALK_SHOWS; pub const WPD_META_GENRE_GENERIC_VIDEO_FILE = WPD_META_GENRES.GENERIC_VIDEO_FILE; pub const WPD_META_GENRE_NEWS_VIDEO_FILE = WPD_META_GENRES.NEWS_VIDEO_FILE; pub const WPD_META_GENRE_MUSIC_VIDEO_FILE = WPD_META_GENRES.MUSIC_VIDEO_FILE; pub const WPD_META_GENRE_HOME_VIDEO_FILE = WPD_META_GENRES.HOME_VIDEO_FILE; pub const WPD_META_GENRE_FEATURE_FILM_VIDEO_FILE = WPD_META_GENRES.FEATURE_FILM_VIDEO_FILE; pub const WPD_META_GENRE_TELEVISION_VIDEO_FILE = WPD_META_GENRES.TELEVISION_VIDEO_FILE; pub const WPD_META_GENRE_TRAINING_EDUCATIONAL_VIDEO_FILE = WPD_META_GENRES.TRAINING_EDUCATIONAL_VIDEO_FILE; pub const WPD_META_GENRE_PHOTO_MONTAGE_VIDEO_FILE = WPD_META_GENRES.PHOTO_MONTAGE_VIDEO_FILE; pub const WPD_META_GENRE_GENERIC_NON_AUDIO_NON_VIDEO = WPD_META_GENRES.GENERIC_NON_AUDIO_NON_VIDEO; pub const WPD_META_GENRE_AUDIO_PODCAST = WPD_META_GENRES.AUDIO_PODCAST; pub const WPD_META_GENRE_VIDEO_PODCAST = WPD_META_GENRES.VIDEO_PODCAST; pub const WPD_META_GENRE_MIXED_PODCAST = WPD_META_GENRES.MIXED_PODCAST; pub const WPD_CROPPED_STATUS_VALUES = enum(i32) { NOT_CROPPED = 0, CROPPED = 1, SHOULD_NOT_BE_CROPPED = 2, }; pub const WPD_CROPPED_STATUS_NOT_CROPPED = WPD_CROPPED_STATUS_VALUES.NOT_CROPPED; pub const WPD_CROPPED_STATUS_CROPPED = WPD_CROPPED_STATUS_VALUES.CROPPED; pub const WPD_CROPPED_STATUS_SHOULD_NOT_BE_CROPPED = WPD_CROPPED_STATUS_VALUES.SHOULD_NOT_BE_CROPPED; pub const WPD_COLOR_CORRECTED_STATUS_VALUES = enum(i32) { NOT_CORRECTED = 0, CORRECTED = 1, SHOULD_NOT_BE_CORRECTED = 2, }; pub const WPD_COLOR_CORRECTED_STATUS_NOT_CORRECTED = WPD_COLOR_CORRECTED_STATUS_VALUES.NOT_CORRECTED; pub const WPD_COLOR_CORRECTED_STATUS_CORRECTED = WPD_COLOR_CORRECTED_STATUS_VALUES.CORRECTED; pub const WPD_COLOR_CORRECTED_STATUS_SHOULD_NOT_BE_CORRECTED = WPD_COLOR_CORRECTED_STATUS_VALUES.SHOULD_NOT_BE_CORRECTED; pub const WPD_VIDEO_SCAN_TYPES = enum(i32) { UNUSED = 0, PROGRESSIVE = 1, FIELD_INTERLEAVED_UPPER_FIRST = 2, FIELD_INTERLEAVED_LOWER_FIRST = 3, FIELD_SINGLE_UPPER_FIRST = 4, FIELD_SINGLE_LOWER_FIRST = 5, MIXED_INTERLACE = 6, MIXED_INTERLACE_AND_PROGRESSIVE = 7, }; pub const WPD_VIDEO_SCAN_TYPE_UNUSED = WPD_VIDEO_SCAN_TYPES.UNUSED; pub const WPD_VIDEO_SCAN_TYPE_PROGRESSIVE = WPD_VIDEO_SCAN_TYPES.PROGRESSIVE; pub const WPD_VIDEO_SCAN_TYPE_FIELD_INTERLEAVED_UPPER_FIRST = WPD_VIDEO_SCAN_TYPES.FIELD_INTERLEAVED_UPPER_FIRST; pub const WPD_VIDEO_SCAN_TYPE_FIELD_INTERLEAVED_LOWER_FIRST = WPD_VIDEO_SCAN_TYPES.FIELD_INTERLEAVED_LOWER_FIRST; pub const WPD_VIDEO_SCAN_TYPE_FIELD_SINGLE_UPPER_FIRST = WPD_VIDEO_SCAN_TYPES.FIELD_SINGLE_UPPER_FIRST; pub const WPD_VIDEO_SCAN_TYPE_FIELD_SINGLE_LOWER_FIRST = WPD_VIDEO_SCAN_TYPES.FIELD_SINGLE_LOWER_FIRST; pub const WPD_VIDEO_SCAN_TYPE_MIXED_INTERLACE = WPD_VIDEO_SCAN_TYPES.MIXED_INTERLACE; pub const WPD_VIDEO_SCAN_TYPE_MIXED_INTERLACE_AND_PROGRESSIVE = WPD_VIDEO_SCAN_TYPES.MIXED_INTERLACE_AND_PROGRESSIVE; pub const WPD_OPERATION_STATES = enum(i32) { UNSPECIFIED = 0, STARTED = 1, RUNNING = 2, PAUSED = 3, CANCELLED = 4, FINISHED = 5, ABORTED = 6, }; pub const WPD_OPERATION_STATE_UNSPECIFIED = WPD_OPERATION_STATES.UNSPECIFIED; pub const WPD_OPERATION_STATE_STARTED = WPD_OPERATION_STATES.STARTED; pub const WPD_OPERATION_STATE_RUNNING = WPD_OPERATION_STATES.RUNNING; pub const WPD_OPERATION_STATE_PAUSED = WPD_OPERATION_STATES.PAUSED; pub const WPD_OPERATION_STATE_CANCELLED = WPD_OPERATION_STATES.CANCELLED; pub const WPD_OPERATION_STATE_FINISHED = WPD_OPERATION_STATES.FINISHED; pub const WPD_OPERATION_STATE_ABORTED = WPD_OPERATION_STATES.ABORTED; pub const WPD_SECTION_DATA_UNITS_VALUES = enum(i32) { BYTES = 0, MILLISECONDS = 1, }; pub const WPD_SECTION_DATA_UNITS_BYTES = WPD_SECTION_DATA_UNITS_VALUES.BYTES; pub const WPD_SECTION_DATA_UNITS_MILLISECONDS = WPD_SECTION_DATA_UNITS_VALUES.MILLISECONDS; pub const WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPES = enum(i32) { OBJECT = 0, RESOURCE = 1, }; pub const WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPE_OBJECT = WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPES.OBJECT; pub const WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPE_RESOURCE = WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPES.RESOURCE; pub const WPD_COMMAND_ACCESS_TYPES = enum(i32) { READ = 1, READWRITE = 3, FROM_PROPERTY_WITH_STGM_ACCESS = 4, FROM_PROPERTY_WITH_FILE_ACCESS = 8, FROM_ATTRIBUTE_WITH_METHOD_ACCESS = 16, }; pub const WPD_COMMAND_ACCESS_READ = WPD_COMMAND_ACCESS_TYPES.READ; pub const WPD_COMMAND_ACCESS_READWRITE = WPD_COMMAND_ACCESS_TYPES.READWRITE; pub const WPD_COMMAND_ACCESS_FROM_PROPERTY_WITH_STGM_ACCESS = WPD_COMMAND_ACCESS_TYPES.FROM_PROPERTY_WITH_STGM_ACCESS; pub const WPD_COMMAND_ACCESS_FROM_PROPERTY_WITH_FILE_ACCESS = WPD_COMMAND_ACCESS_TYPES.FROM_PROPERTY_WITH_FILE_ACCESS; pub const WPD_COMMAND_ACCESS_FROM_ATTRIBUTE_WITH_METHOD_ACCESS = WPD_COMMAND_ACCESS_TYPES.FROM_ATTRIBUTE_WITH_METHOD_ACCESS; pub const WPD_SERVICE_INHERITANCE_TYPES = enum(i32) { N = 0, }; pub const WPD_SERVICE_INHERITANCE_IMPLEMENTATION = WPD_SERVICE_INHERITANCE_TYPES.N; pub const WPD_PARAMETER_USAGE_TYPES = enum(i32) { RETURN = 0, IN = 1, OUT = 2, INOUT = 3, }; pub const WPD_PARAMETER_USAGE_RETURN = WPD_PARAMETER_USAGE_TYPES.RETURN; pub const WPD_PARAMETER_USAGE_IN = WPD_PARAMETER_USAGE_TYPES.IN; pub const WPD_PARAMETER_USAGE_OUT = WPD_PARAMETER_USAGE_TYPES.OUT; pub const WPD_PARAMETER_USAGE_INOUT = WPD_PARAMETER_USAGE_TYPES.INOUT; pub const WPD_COMMAND_ACCESS_LOOKUP_ENTRY = extern struct { Command: PROPERTYKEY, AccessType: u32, AccessProperty: PROPERTYKEY, }; const CLSID_WpdSerializer_Value = Guid.initString("0b91a74b-ad7c-4a9d-b563-29eef9167172"); pub const CLSID_WpdSerializer = &CLSID_WpdSerializer_Value; const CLSID_PortableDeviceValues_Value = Guid.initString("0c15d503-d017-47ce-9016-7b3f978721cc"); pub const CLSID_PortableDeviceValues = &CLSID_PortableDeviceValues_Value; const CLSID_PortableDeviceKeyCollection_Value = Guid.initString("de2d022d-2480-43be-97f0-d1fa2cf98f4f"); pub const CLSID_PortableDeviceKeyCollection = &CLSID_PortableDeviceKeyCollection_Value; const CLSID_PortableDevicePropVariantCollection_Value = Guid.initString("08a99e2f-6d6d-4b80-af5a-baf2bcbe4cb9"); pub const CLSID_PortableDevicePropVariantCollection = &CLSID_PortableDevicePropVariantCollection_Value; const CLSID_PortableDeviceValuesCollection_Value = Guid.initString("3882134d-14cf-4220-9cb4-435f86d83f60"); pub const CLSID_PortableDeviceValuesCollection = &CLSID_PortableDeviceValuesCollection_Value; pub const WPD_STREAM_UNITS = enum(i32) { BYTES = 0, FRAMES = 1, ROWS = 2, MILLISECONDS = 4, MICROSECONDS = 8, }; pub const WPD_STREAM_UNITS_BYTES = WPD_STREAM_UNITS.BYTES; pub const WPD_STREAM_UNITS_FRAMES = WPD_STREAM_UNITS.FRAMES; pub const WPD_STREAM_UNITS_ROWS = WPD_STREAM_UNITS.ROWS; pub const WPD_STREAM_UNITS_MILLISECONDS = WPD_STREAM_UNITS.MILLISECONDS; pub const WPD_STREAM_UNITS_MICROSECONDS = WPD_STREAM_UNITS.MICROSECONDS; const IID_IWpdSerializer_Value = Guid.initString("b32f4002-bb27-45ff-af4f-06631c1e8dad"); pub const IID_IWpdSerializer = &IID_IWpdSerializer_Value; pub const IWpdSerializer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetIPortableDeviceValuesFromBuffer: fn( self: *const IWpdSerializer, pBuffer: [*:0]u8, dwInputBufferLength: u32, ppParams: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteIPortableDeviceValuesToBuffer: fn( self: *const IWpdSerializer, dwOutputBufferLength: u32, pResults: ?*IPortableDeviceValues, pBuffer: [*:0]u8, pdwBytesWritten: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBufferFromIPortableDeviceValues: fn( self: *const IWpdSerializer, pSource: ?*IPortableDeviceValues, ppBuffer: [*]?*u8, pdwBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSerializedSize: fn( self: *const IWpdSerializer, pSource: ?*IPortableDeviceValues, 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 IWpdSerializer_GetIPortableDeviceValuesFromBuffer(self: *const T, pBuffer: [*:0]u8, dwInputBufferLength: u32, ppParams: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IWpdSerializer.VTable, self.vtable).GetIPortableDeviceValuesFromBuffer(@ptrCast(*const IWpdSerializer, self), pBuffer, dwInputBufferLength, ppParams); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWpdSerializer_WriteIPortableDeviceValuesToBuffer(self: *const T, dwOutputBufferLength: u32, pResults: ?*IPortableDeviceValues, pBuffer: [*:0]u8, pdwBytesWritten: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IWpdSerializer.VTable, self.vtable).WriteIPortableDeviceValuesToBuffer(@ptrCast(*const IWpdSerializer, self), dwOutputBufferLength, pResults, pBuffer, pdwBytesWritten); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWpdSerializer_GetBufferFromIPortableDeviceValues(self: *const T, pSource: ?*IPortableDeviceValues, ppBuffer: [*]?*u8, pdwBufferSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IWpdSerializer.VTable, self.vtable).GetBufferFromIPortableDeviceValues(@ptrCast(*const IWpdSerializer, self), pSource, ppBuffer, pdwBufferSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWpdSerializer_GetSerializedSize(self: *const T, pSource: ?*IPortableDeviceValues, pdwSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IWpdSerializer.VTable, self.vtable).GetSerializedSize(@ptrCast(*const IWpdSerializer, self), pSource, pdwSize); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceValues_Value = Guid.initString("6848f6f2-3155-4f86-b6f5-263eeeab3143"); pub const IID_IPortableDeviceValues = &IID_IPortableDeviceValues_Value; pub const IPortableDeviceValues = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IPortableDeviceValues, pcelt: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAt: fn( self: *const IPortableDeviceValues, index: u32, pKey: ?*PROPERTYKEY, pValue: ?*PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*const PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetStringValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStringValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetUnsignedIntegerValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUnsignedIntegerValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSignedIntegerValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignedIntegerValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetUnsignedLargeIntegerValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUnsignedLargeIntegerValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSignedLargeIntegerValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignedLargeIntegerValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFloatValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFloatValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetErrorValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetErrorValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetKeyValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: ?*const PROPERTYKEY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetKeyValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*PROPERTYKEY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBoolValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBoolValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIUnknownValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIUnknownValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, ppValue: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGuidValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, Value: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGuidValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBufferValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: [*:0]u8, cbValue: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBufferValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, ppValue: [*]?*u8, pcbValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIPortableDeviceValuesValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIPortableDeviceValuesValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, ppValue: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIPortableDevicePropVariantCollectionValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIPortableDevicePropVariantCollectionValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, ppValue: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIPortableDeviceKeyCollectionValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIPortableDeviceKeyCollectionValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, ppValue: ?*?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIPortableDeviceValuesCollectionValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, pValue: ?*IPortableDeviceValuesCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIPortableDeviceValuesCollectionValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, ppValue: ?*?*IPortableDeviceValuesCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveValue: fn( self: *const IPortableDeviceValues, key: ?*const PROPERTYKEY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CopyValuesFromPropertyStore: fn( self: *const IPortableDeviceValues, pStore: ?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CopyValuesToPropertyStore: fn( self: *const IPortableDeviceValues, pStore: ?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetCount(self: *const T, pcelt: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetCount(@ptrCast(*const IPortableDeviceValues, self), pcelt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetAt(self: *const T, index: u32, pKey: ?*PROPERTYKEY, pValue: ?*PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetAt(@ptrCast(*const IPortableDeviceValues, self), index, pKey, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*const PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetStringValue(self: *const T, key: ?*const PROPERTYKEY, Value: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetStringValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetStringValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetStringValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetUnsignedIntegerValue(self: *const T, key: ?*const PROPERTYKEY, Value: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetUnsignedIntegerValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetUnsignedIntegerValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetUnsignedIntegerValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetSignedIntegerValue(self: *const T, key: ?*const PROPERTYKEY, Value: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetSignedIntegerValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetSignedIntegerValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetSignedIntegerValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetUnsignedLargeIntegerValue(self: *const T, key: ?*const PROPERTYKEY, Value: u64) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetUnsignedLargeIntegerValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetUnsignedLargeIntegerValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*u64) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetUnsignedLargeIntegerValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetSignedLargeIntegerValue(self: *const T, key: ?*const PROPERTYKEY, Value: i64) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetSignedLargeIntegerValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetSignedLargeIntegerValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*i64) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetSignedLargeIntegerValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetFloatValue(self: *const T, key: ?*const PROPERTYKEY, Value: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetFloatValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetFloatValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetFloatValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetErrorValue(self: *const T, key: ?*const PROPERTYKEY, Value: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetErrorValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetErrorValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetErrorValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetKeyValue(self: *const T, key: ?*const PROPERTYKEY, Value: ?*const PROPERTYKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetKeyValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetKeyValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*PROPERTYKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetKeyValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetBoolValue(self: *const T, key: ?*const PROPERTYKEY, Value: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetBoolValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetBoolValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetBoolValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetIUnknownValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetIUnknownValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetIUnknownValue(self: *const T, key: ?*const PROPERTYKEY, ppValue: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetIUnknownValue(@ptrCast(*const IPortableDeviceValues, self), key, ppValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetGuidValue(self: *const T, key: ?*const PROPERTYKEY, Value: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetGuidValue(@ptrCast(*const IPortableDeviceValues, self), key, Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetGuidValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetGuidValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetBufferValue(self: *const T, key: ?*const PROPERTYKEY, pValue: [*:0]u8, cbValue: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetBufferValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue, cbValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetBufferValue(self: *const T, key: ?*const PROPERTYKEY, ppValue: [*]?*u8, pcbValue: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetBufferValue(@ptrCast(*const IPortableDeviceValues, self), key, ppValue, pcbValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetIPortableDeviceValuesValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetIPortableDeviceValuesValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetIPortableDeviceValuesValue(self: *const T, key: ?*const PROPERTYKEY, ppValue: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetIPortableDeviceValuesValue(@ptrCast(*const IPortableDeviceValues, self), key, ppValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetIPortableDevicePropVariantCollectionValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetIPortableDevicePropVariantCollectionValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetIPortableDevicePropVariantCollectionValue(self: *const T, key: ?*const PROPERTYKEY, ppValue: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetIPortableDevicePropVariantCollectionValue(@ptrCast(*const IPortableDeviceValues, self), key, ppValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetIPortableDeviceKeyCollectionValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetIPortableDeviceKeyCollectionValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetIPortableDeviceKeyCollectionValue(self: *const T, key: ?*const PROPERTYKEY, ppValue: ?*?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetIPortableDeviceKeyCollectionValue(@ptrCast(*const IPortableDeviceValues, self), key, ppValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_SetIPortableDeviceValuesCollectionValue(self: *const T, key: ?*const PROPERTYKEY, pValue: ?*IPortableDeviceValuesCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).SetIPortableDeviceValuesCollectionValue(@ptrCast(*const IPortableDeviceValues, self), key, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_GetIPortableDeviceValuesCollectionValue(self: *const T, key: ?*const PROPERTYKEY, ppValue: ?*?*IPortableDeviceValuesCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).GetIPortableDeviceValuesCollectionValue(@ptrCast(*const IPortableDeviceValues, self), key, ppValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_RemoveValue(self: *const T, key: ?*const PROPERTYKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).RemoveValue(@ptrCast(*const IPortableDeviceValues, self), key); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_CopyValuesFromPropertyStore(self: *const T, pStore: ?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).CopyValuesFromPropertyStore(@ptrCast(*const IPortableDeviceValues, self), pStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_CopyValuesToPropertyStore(self: *const T, pStore: ?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).CopyValuesToPropertyStore(@ptrCast(*const IPortableDeviceValues, self), pStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValues_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValues.VTable, self.vtable).Clear(@ptrCast(*const IPortableDeviceValues, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceKeyCollection_Value = Guid.initString("dada2357-e0ad-492e-98db-dd61c53ba353"); pub const IID_IPortableDeviceKeyCollection = &IID_IPortableDeviceKeyCollection_Value; pub const IPortableDeviceKeyCollection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IPortableDeviceKeyCollection, pcElems: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAt: fn( self: *const IPortableDeviceKeyCollection, dwIndex: u32, pKey: ?*PROPERTYKEY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IPortableDeviceKeyCollection, Key: ?*const PROPERTYKEY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveAt: fn( self: *const IPortableDeviceKeyCollection, dwIndex: 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 IPortableDeviceKeyCollection_GetCount(self: *const T, pcElems: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceKeyCollection.VTable, self.vtable).GetCount(@ptrCast(*const IPortableDeviceKeyCollection, self), pcElems); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceKeyCollection_GetAt(self: *const T, dwIndex: u32, pKey: ?*PROPERTYKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceKeyCollection.VTable, self.vtable).GetAt(@ptrCast(*const IPortableDeviceKeyCollection, self), dwIndex, pKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceKeyCollection_Add(self: *const T, Key: ?*const PROPERTYKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceKeyCollection.VTable, self.vtable).Add(@ptrCast(*const IPortableDeviceKeyCollection, self), Key); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceKeyCollection_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceKeyCollection.VTable, self.vtable).Clear(@ptrCast(*const IPortableDeviceKeyCollection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceKeyCollection_RemoveAt(self: *const T, dwIndex: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceKeyCollection.VTable, self.vtable).RemoveAt(@ptrCast(*const IPortableDeviceKeyCollection, self), dwIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDevicePropVariantCollection_Value = Guid.initString("89b2e422-4f1b-4316-bcef-a44afea83eb3"); pub const IID_IPortableDevicePropVariantCollection = &IID_IPortableDevicePropVariantCollection_Value; pub const IPortableDevicePropVariantCollection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IPortableDevicePropVariantCollection, pcElems: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAt: fn( self: *const IPortableDevicePropVariantCollection, dwIndex: u32, pValue: ?*PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IPortableDevicePropVariantCollection, pValue: ?*const PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetType: fn( self: *const IPortableDevicePropVariantCollection, pvt: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ChangeType: fn( self: *const IPortableDevicePropVariantCollection, vt: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveAt: fn( self: *const IPortableDevicePropVariantCollection, dwIndex: 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 IPortableDevicePropVariantCollection_GetCount(self: *const T, pcElems: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropVariantCollection.VTable, self.vtable).GetCount(@ptrCast(*const IPortableDevicePropVariantCollection, self), pcElems); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropVariantCollection_GetAt(self: *const T, dwIndex: u32, pValue: ?*PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropVariantCollection.VTable, self.vtable).GetAt(@ptrCast(*const IPortableDevicePropVariantCollection, self), dwIndex, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropVariantCollection_Add(self: *const T, pValue: ?*const PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropVariantCollection.VTable, self.vtable).Add(@ptrCast(*const IPortableDevicePropVariantCollection, self), pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropVariantCollection_GetType(self: *const T, pvt: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropVariantCollection.VTable, self.vtable).GetType(@ptrCast(*const IPortableDevicePropVariantCollection, self), pvt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropVariantCollection_ChangeType(self: *const T, vt: u16) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropVariantCollection.VTable, self.vtable).ChangeType(@ptrCast(*const IPortableDevicePropVariantCollection, self), vt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropVariantCollection_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropVariantCollection.VTable, self.vtable).Clear(@ptrCast(*const IPortableDevicePropVariantCollection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropVariantCollection_RemoveAt(self: *const T, dwIndex: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropVariantCollection.VTable, self.vtable).RemoveAt(@ptrCast(*const IPortableDevicePropVariantCollection, self), dwIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceValuesCollection_Value = Guid.initString("6e3f2d79-4e07-48c4-8208-d8c2e5af4a99"); pub const IID_IPortableDeviceValuesCollection = &IID_IPortableDeviceValuesCollection_Value; pub const IPortableDeviceValuesCollection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IPortableDeviceValuesCollection, pcElems: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAt: fn( self: *const IPortableDeviceValuesCollection, dwIndex: u32, ppValues: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IPortableDeviceValuesCollection, pValues: ?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const IPortableDeviceValuesCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveAt: fn( self: *const IPortableDeviceValuesCollection, dwIndex: 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 IPortableDeviceValuesCollection_GetCount(self: *const T, pcElems: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValuesCollection.VTable, self.vtable).GetCount(@ptrCast(*const IPortableDeviceValuesCollection, self), pcElems); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValuesCollection_GetAt(self: *const T, dwIndex: u32, ppValues: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValuesCollection.VTable, self.vtable).GetAt(@ptrCast(*const IPortableDeviceValuesCollection, self), dwIndex, ppValues); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValuesCollection_Add(self: *const T, pValues: ?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValuesCollection.VTable, self.vtable).Add(@ptrCast(*const IPortableDeviceValuesCollection, self), pValues); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValuesCollection_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValuesCollection.VTable, self.vtable).Clear(@ptrCast(*const IPortableDeviceValuesCollection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceValuesCollection_RemoveAt(self: *const T, dwIndex: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceValuesCollection.VTable, self.vtable).RemoveAt(@ptrCast(*const IPortableDeviceValuesCollection, self), dwIndex); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_PortableDevice_Value = Guid.initString("728a21c5-3d9e-48d7-9810-864848f0f404"); pub const CLSID_PortableDevice = &CLSID_PortableDevice_Value; const CLSID_PortableDeviceManager_Value = Guid.initString("0af10cec-2ecd-4b92-9581-34f6ae0637f3"); pub const CLSID_PortableDeviceManager = &CLSID_PortableDeviceManager_Value; const CLSID_PortableDeviceService_Value = Guid.initString("ef5db4c2-9312-422c-9152-411cd9c4dd84"); pub const CLSID_PortableDeviceService = &CLSID_PortableDeviceService_Value; const CLSID_PortableDeviceDispatchFactory_Value = Guid.initString("43232233-8338-4658-ae01-0b4ae830b6b0"); pub const CLSID_PortableDeviceDispatchFactory = &CLSID_PortableDeviceDispatchFactory_Value; const CLSID_PortableDeviceFTM_Value = Guid.initString("f7c0039a-4762-488a-b4b3-760ef9a1ba9b"); pub const CLSID_PortableDeviceFTM = &CLSID_PortableDeviceFTM_Value; const CLSID_PortableDeviceServiceFTM_Value = Guid.initString("1649b154-c794-497a-9b03-f3f0121302f3"); pub const CLSID_PortableDeviceServiceFTM = &CLSID_PortableDeviceServiceFTM_Value; const CLSID_PortableDeviceWebControl_Value = Guid.initString("186dd02c-2dec-41b5-a7d4-b59056fade51"); pub const CLSID_PortableDeviceWebControl = &CLSID_PortableDeviceWebControl_Value; const IID_IPortableDeviceManager_Value = Guid.initString("a1567595-4c2f-4574-a6fa-ecef917b9a40"); pub const IID_IPortableDeviceManager = &IID_IPortableDeviceManager_Value; pub const IPortableDeviceManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDevices: fn( self: *const IPortableDeviceManager, pPnPDeviceIDs: ?*?PWSTR, pcPnPDeviceIDs: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RefreshDeviceList: fn( self: *const IPortableDeviceManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceFriendlyName: fn( self: *const IPortableDeviceManager, pszPnPDeviceID: ?[*:0]const u16, pDeviceFriendlyName: ?PWSTR, pcchDeviceFriendlyName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceDescription: fn( self: *const IPortableDeviceManager, pszPnPDeviceID: ?[*:0]const u16, pDeviceDescription: ?PWSTR, pcchDeviceDescription: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceManufacturer: fn( self: *const IPortableDeviceManager, pszPnPDeviceID: ?[*:0]const u16, pDeviceManufacturer: ?PWSTR, pcchDeviceManufacturer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceProperty: fn( self: *const IPortableDeviceManager, pszPnPDeviceID: ?[*:0]const u16, pszDevicePropertyName: ?[*:0]const u16, pData: ?*u8, pcbData: ?*u32, pdwType: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPrivateDevices: fn( self: *const IPortableDeviceManager, pPnPDeviceIDs: ?*?PWSTR, pcPnPDeviceIDs: ?*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 IPortableDeviceManager_GetDevices(self: *const T, pPnPDeviceIDs: ?*?PWSTR, pcPnPDeviceIDs: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceManager.VTable, self.vtable).GetDevices(@ptrCast(*const IPortableDeviceManager, self), pPnPDeviceIDs, pcPnPDeviceIDs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceManager_RefreshDeviceList(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceManager.VTable, self.vtable).RefreshDeviceList(@ptrCast(*const IPortableDeviceManager, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceManager_GetDeviceFriendlyName(self: *const T, pszPnPDeviceID: ?[*:0]const u16, pDeviceFriendlyName: ?PWSTR, pcchDeviceFriendlyName: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceManager.VTable, self.vtable).GetDeviceFriendlyName(@ptrCast(*const IPortableDeviceManager, self), pszPnPDeviceID, pDeviceFriendlyName, pcchDeviceFriendlyName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceManager_GetDeviceDescription(self: *const T, pszPnPDeviceID: ?[*:0]const u16, pDeviceDescription: ?PWSTR, pcchDeviceDescription: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceManager.VTable, self.vtable).GetDeviceDescription(@ptrCast(*const IPortableDeviceManager, self), pszPnPDeviceID, pDeviceDescription, pcchDeviceDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceManager_GetDeviceManufacturer(self: *const T, pszPnPDeviceID: ?[*:0]const u16, pDeviceManufacturer: ?PWSTR, pcchDeviceManufacturer: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceManager.VTable, self.vtable).GetDeviceManufacturer(@ptrCast(*const IPortableDeviceManager, self), pszPnPDeviceID, pDeviceManufacturer, pcchDeviceManufacturer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceManager_GetDeviceProperty(self: *const T, pszPnPDeviceID: ?[*:0]const u16, pszDevicePropertyName: ?[*:0]const u16, pData: ?*u8, pcbData: ?*u32, pdwType: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceManager.VTable, self.vtable).GetDeviceProperty(@ptrCast(*const IPortableDeviceManager, self), pszPnPDeviceID, pszDevicePropertyName, pData, pcbData, pdwType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceManager_GetPrivateDevices(self: *const T, pPnPDeviceIDs: ?*?PWSTR, pcPnPDeviceIDs: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceManager.VTable, self.vtable).GetPrivateDevices(@ptrCast(*const IPortableDeviceManager, self), pPnPDeviceIDs, pcPnPDeviceIDs); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDevice_Value = Guid.initString("625e2df8-6392-4cf0-9ad1-3cfa5f17775c"); pub const IID_IPortableDevice = &IID_IPortableDevice_Value; pub const IPortableDevice = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Open: fn( self: *const IPortableDevice, pszPnPDeviceID: ?[*:0]const u16, pClientInfo: ?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendCommand: fn( self: *const IPortableDevice, dwFlags: u32, pParameters: ?*IPortableDeviceValues, ppResults: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Content: fn( self: *const IPortableDevice, ppContent: ?*?*IPortableDeviceContent, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Capabilities: fn( self: *const IPortableDevice, ppCapabilities: ?*?*IPortableDeviceCapabilities, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDevice, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IPortableDevice, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Advise: fn( self: *const IPortableDevice, dwFlags: u32, pCallback: ?*IPortableDeviceEventCallback, pParameters: ?*IPortableDeviceValues, ppszCookie: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unadvise: fn( self: *const IPortableDevice, pszCookie: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPnPDeviceID: fn( self: *const IPortableDevice, ppszPnPDeviceID: ?*?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 IPortableDevice_Open(self: *const T, pszPnPDeviceID: ?[*:0]const u16, pClientInfo: ?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevice.VTable, self.vtable).Open(@ptrCast(*const IPortableDevice, self), pszPnPDeviceID, pClientInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevice_SendCommand(self: *const T, dwFlags: u32, pParameters: ?*IPortableDeviceValues, ppResults: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevice.VTable, self.vtable).SendCommand(@ptrCast(*const IPortableDevice, self), dwFlags, pParameters, ppResults); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevice_Content(self: *const T, ppContent: ?*?*IPortableDeviceContent) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevice.VTable, self.vtable).Content(@ptrCast(*const IPortableDevice, self), ppContent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevice_Capabilities(self: *const T, ppCapabilities: ?*?*IPortableDeviceCapabilities) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevice.VTable, self.vtable).Capabilities(@ptrCast(*const IPortableDevice, self), ppCapabilities); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevice_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevice.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDevice, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevice_Close(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevice.VTable, self.vtable).Close(@ptrCast(*const IPortableDevice, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevice_Advise(self: *const T, dwFlags: u32, pCallback: ?*IPortableDeviceEventCallback, pParameters: ?*IPortableDeviceValues, ppszCookie: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevice.VTable, self.vtable).Advise(@ptrCast(*const IPortableDevice, self), dwFlags, pCallback, pParameters, ppszCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevice_Unadvise(self: *const T, pszCookie: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevice.VTable, self.vtable).Unadvise(@ptrCast(*const IPortableDevice, self), pszCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevice_GetPnPDeviceID(self: *const T, ppszPnPDeviceID: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevice.VTable, self.vtable).GetPnPDeviceID(@ptrCast(*const IPortableDevice, self), ppszPnPDeviceID); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceContent_Value = Guid.initString("6a96ed84-7c73-4480-9938-bf5af477d426"); pub const IID_IPortableDeviceContent = &IID_IPortableDeviceContent_Value; pub const IPortableDeviceContent = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumObjects: fn( self: *const IPortableDeviceContent, dwFlags: u32, pszParentObjectID: ?[*:0]const u16, pFilter: ?*IPortableDeviceValues, ppEnum: ?*?*IEnumPortableDeviceObjectIDs, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Properties: fn( self: *const IPortableDeviceContent, ppProperties: ?*?*IPortableDeviceProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Transfer: fn( self: *const IPortableDeviceContent, ppResources: ?*?*IPortableDeviceResources, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateObjectWithPropertiesOnly: fn( self: *const IPortableDeviceContent, pValues: ?*IPortableDeviceValues, ppszObjectID: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateObjectWithPropertiesAndData: fn( self: *const IPortableDeviceContent, pValues: ?*IPortableDeviceValues, ppData: ?*?*IStream, pdwOptimalWriteBufferSize: ?*u32, ppszCookie: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IPortableDeviceContent, dwOptions: u32, pObjectIDs: ?*IPortableDevicePropVariantCollection, ppResults: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectIDsFromPersistentUniqueIDs: fn( self: *const IPortableDeviceContent, pPersistentUniqueIDs: ?*IPortableDevicePropVariantCollection, ppObjectIDs: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceContent, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Move: fn( self: *const IPortableDeviceContent, pObjectIDs: ?*IPortableDevicePropVariantCollection, pszDestinationFolderObjectID: ?[*:0]const u16, ppResults: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Copy: fn( self: *const IPortableDeviceContent, pObjectIDs: ?*IPortableDevicePropVariantCollection, pszDestinationFolderObjectID: ?[*:0]const u16, ppResults: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_EnumObjects(self: *const T, dwFlags: u32, pszParentObjectID: ?[*:0]const u16, pFilter: ?*IPortableDeviceValues, ppEnum: ?*?*IEnumPortableDeviceObjectIDs) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).EnumObjects(@ptrCast(*const IPortableDeviceContent, self), dwFlags, pszParentObjectID, pFilter, ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_Properties(self: *const T, ppProperties: ?*?*IPortableDeviceProperties) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).Properties(@ptrCast(*const IPortableDeviceContent, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_Transfer(self: *const T, ppResources: ?*?*IPortableDeviceResources) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).Transfer(@ptrCast(*const IPortableDeviceContent, self), ppResources); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_CreateObjectWithPropertiesOnly(self: *const T, pValues: ?*IPortableDeviceValues, ppszObjectID: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).CreateObjectWithPropertiesOnly(@ptrCast(*const IPortableDeviceContent, self), pValues, ppszObjectID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_CreateObjectWithPropertiesAndData(self: *const T, pValues: ?*IPortableDeviceValues, ppData: ?*?*IStream, pdwOptimalWriteBufferSize: ?*u32, ppszCookie: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).CreateObjectWithPropertiesAndData(@ptrCast(*const IPortableDeviceContent, self), pValues, ppData, pdwOptimalWriteBufferSize, ppszCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_Delete(self: *const T, dwOptions: u32, pObjectIDs: ?*IPortableDevicePropVariantCollection, ppResults: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).Delete(@ptrCast(*const IPortableDeviceContent, self), dwOptions, pObjectIDs, ppResults); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_GetObjectIDsFromPersistentUniqueIDs(self: *const T, pPersistentUniqueIDs: ?*IPortableDevicePropVariantCollection, ppObjectIDs: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).GetObjectIDsFromPersistentUniqueIDs(@ptrCast(*const IPortableDeviceContent, self), pPersistentUniqueIDs, ppObjectIDs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceContent, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_Move(self: *const T, pObjectIDs: ?*IPortableDevicePropVariantCollection, pszDestinationFolderObjectID: ?[*:0]const u16, ppResults: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).Move(@ptrCast(*const IPortableDeviceContent, self), pObjectIDs, pszDestinationFolderObjectID, ppResults); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent_Copy(self: *const T, pObjectIDs: ?*IPortableDevicePropVariantCollection, pszDestinationFolderObjectID: ?[*:0]const u16, ppResults: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent.VTable, self.vtable).Copy(@ptrCast(*const IPortableDeviceContent, self), pObjectIDs, pszDestinationFolderObjectID, ppResults); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IPortableDeviceContent2_Value = Guid.initString("9b4add96-f6bf-4034-8708-eca72bf10554"); pub const IID_IPortableDeviceContent2 = &IID_IPortableDeviceContent2_Value; pub const IPortableDeviceContent2 = extern struct { pub const VTable = extern struct { base: IPortableDeviceContent.VTable, UpdateObjectWithPropertiesAndData: fn( self: *const IPortableDeviceContent2, pszObjectID: ?[*:0]const u16, pProperties: ?*IPortableDeviceValues, ppData: ?*?*IStream, pdwOptimalWriteBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPortableDeviceContent.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceContent2_UpdateObjectWithPropertiesAndData(self: *const T, pszObjectID: ?[*:0]const u16, pProperties: ?*IPortableDeviceValues, ppData: ?*?*IStream, pdwOptimalWriteBufferSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceContent2.VTable, self.vtable).UpdateObjectWithPropertiesAndData(@ptrCast(*const IPortableDeviceContent2, self), pszObjectID, pProperties, ppData, pdwOptimalWriteBufferSize); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IEnumPortableDeviceObjectIDs_Value = Guid.initString("10ece955-cf41-4728-bfa0-41eedf1bbf19"); pub const IID_IEnumPortableDeviceObjectIDs = &IID_IEnumPortableDeviceObjectIDs_Value; pub const IEnumPortableDeviceObjectIDs = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumPortableDeviceObjectIDs, cObjects: u32, pObjIDs: [*]?PWSTR, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumPortableDeviceObjectIDs, cObjects: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumPortableDeviceObjectIDs, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumPortableDeviceObjectIDs, ppEnum: ?*?*IEnumPortableDeviceObjectIDs, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IEnumPortableDeviceObjectIDs, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumPortableDeviceObjectIDs_Next(self: *const T, cObjects: u32, pObjIDs: [*]?PWSTR, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumPortableDeviceObjectIDs.VTable, self.vtable).Next(@ptrCast(*const IEnumPortableDeviceObjectIDs, self), cObjects, pObjIDs, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumPortableDeviceObjectIDs_Skip(self: *const T, cObjects: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumPortableDeviceObjectIDs.VTable, self.vtable).Skip(@ptrCast(*const IEnumPortableDeviceObjectIDs, self), cObjects); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumPortableDeviceObjectIDs_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumPortableDeviceObjectIDs.VTable, self.vtable).Reset(@ptrCast(*const IEnumPortableDeviceObjectIDs, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumPortableDeviceObjectIDs_Clone(self: *const T, ppEnum: ?*?*IEnumPortableDeviceObjectIDs) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumPortableDeviceObjectIDs.VTable, self.vtable).Clone(@ptrCast(*const IEnumPortableDeviceObjectIDs, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumPortableDeviceObjectIDs_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumPortableDeviceObjectIDs.VTable, self.vtable).Cancel(@ptrCast(*const IEnumPortableDeviceObjectIDs, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceProperties_Value = Guid.initString("7f6d695c-03df-4439-a809-59266beee3a6"); pub const IID_IPortableDeviceProperties = &IID_IPortableDeviceProperties_Value; pub const IPortableDeviceProperties = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSupportedProperties: fn( self: *const IPortableDeviceProperties, pszObjectID: ?[*:0]const u16, ppKeys: ?*?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPropertyAttributes: fn( self: *const IPortableDeviceProperties, pszObjectID: ?[*:0]const u16, Key: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetValues: fn( self: *const IPortableDeviceProperties, pszObjectID: ?[*:0]const u16, pKeys: ?*IPortableDeviceKeyCollection, ppValues: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetValues: fn( self: *const IPortableDeviceProperties, pszObjectID: ?[*:0]const u16, pValues: ?*IPortableDeviceValues, ppResults: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IPortableDeviceProperties, pszObjectID: ?[*:0]const u16, pKeys: ?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceProperties_GetSupportedProperties(self: *const T, pszObjectID: ?[*:0]const u16, ppKeys: ?*?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceProperties.VTable, self.vtable).GetSupportedProperties(@ptrCast(*const IPortableDeviceProperties, self), pszObjectID, ppKeys); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceProperties_GetPropertyAttributes(self: *const T, pszObjectID: ?[*:0]const u16, Key: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceProperties.VTable, self.vtable).GetPropertyAttributes(@ptrCast(*const IPortableDeviceProperties, self), pszObjectID, Key, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceProperties_GetValues(self: *const T, pszObjectID: ?[*:0]const u16, pKeys: ?*IPortableDeviceKeyCollection, ppValues: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceProperties.VTable, self.vtable).GetValues(@ptrCast(*const IPortableDeviceProperties, self), pszObjectID, pKeys, ppValues); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceProperties_SetValues(self: *const T, pszObjectID: ?[*:0]const u16, pValues: ?*IPortableDeviceValues, ppResults: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceProperties.VTable, self.vtable).SetValues(@ptrCast(*const IPortableDeviceProperties, self), pszObjectID, pValues, ppResults); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceProperties_Delete(self: *const T, pszObjectID: ?[*:0]const u16, pKeys: ?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceProperties.VTable, self.vtable).Delete(@ptrCast(*const IPortableDeviceProperties, self), pszObjectID, pKeys); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceProperties_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceProperties.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceProperties, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceResources_Value = Guid.initString("fd8878ac-d841-4d17-891c-e6829cdb6934"); pub const IID_IPortableDeviceResources = &IID_IPortableDeviceResources_Value; pub const IPortableDeviceResources = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSupportedResources: fn( self: *const IPortableDeviceResources, pszObjectID: ?[*:0]const u16, ppKeys: ?*?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetResourceAttributes: fn( self: *const IPortableDeviceResources, pszObjectID: ?[*:0]const u16, Key: ?*const PROPERTYKEY, ppResourceAttributes: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStream: fn( self: *const IPortableDeviceResources, pszObjectID: ?[*:0]const u16, Key: ?*const PROPERTYKEY, dwMode: u32, pdwOptimalBufferSize: ?*u32, ppStream: ?*?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IPortableDeviceResources, pszObjectID: ?[*:0]const u16, pKeys: ?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceResources, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateResource: fn( self: *const IPortableDeviceResources, pResourceAttributes: ?*IPortableDeviceValues, ppData: ?*?*IStream, pdwOptimalWriteBufferSize: ?*u32, ppszCookie: ?*?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 IPortableDeviceResources_GetSupportedResources(self: *const T, pszObjectID: ?[*:0]const u16, ppKeys: ?*?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceResources.VTable, self.vtable).GetSupportedResources(@ptrCast(*const IPortableDeviceResources, self), pszObjectID, ppKeys); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceResources_GetResourceAttributes(self: *const T, pszObjectID: ?[*:0]const u16, Key: ?*const PROPERTYKEY, ppResourceAttributes: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceResources.VTable, self.vtable).GetResourceAttributes(@ptrCast(*const IPortableDeviceResources, self), pszObjectID, Key, ppResourceAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceResources_GetStream(self: *const T, pszObjectID: ?[*:0]const u16, Key: ?*const PROPERTYKEY, dwMode: u32, pdwOptimalBufferSize: ?*u32, ppStream: ?*?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceResources.VTable, self.vtable).GetStream(@ptrCast(*const IPortableDeviceResources, self), pszObjectID, Key, dwMode, pdwOptimalBufferSize, ppStream); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceResources_Delete(self: *const T, pszObjectID: ?[*:0]const u16, pKeys: ?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceResources.VTable, self.vtable).Delete(@ptrCast(*const IPortableDeviceResources, self), pszObjectID, pKeys); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceResources_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceResources.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceResources, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceResources_CreateResource(self: *const T, pResourceAttributes: ?*IPortableDeviceValues, ppData: ?*?*IStream, pdwOptimalWriteBufferSize: ?*u32, ppszCookie: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceResources.VTable, self.vtable).CreateResource(@ptrCast(*const IPortableDeviceResources, self), pResourceAttributes, ppData, pdwOptimalWriteBufferSize, ppszCookie); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceCapabilities_Value = Guid.initString("2c8c6dbf-e3dc-4061-becc-8542e810d126"); pub const IID_IPortableDeviceCapabilities = &IID_IPortableDeviceCapabilities_Value; pub const IPortableDeviceCapabilities = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSupportedCommands: fn( self: *const IPortableDeviceCapabilities, ppCommands: ?*?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCommandOptions: fn( self: *const IPortableDeviceCapabilities, Command: ?*const PROPERTYKEY, ppOptions: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFunctionalCategories: fn( self: *const IPortableDeviceCapabilities, ppCategories: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFunctionalObjects: fn( self: *const IPortableDeviceCapabilities, Category: ?*const Guid, ppObjectIDs: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedContentTypes: fn( self: *const IPortableDeviceCapabilities, Category: ?*const Guid, ppContentTypes: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedFormats: fn( self: *const IPortableDeviceCapabilities, ContentType: ?*const Guid, ppFormats: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedFormatProperties: fn( self: *const IPortableDeviceCapabilities, Format: ?*const Guid, ppKeys: ?*?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFixedPropertyAttributes: fn( self: *const IPortableDeviceCapabilities, Format: ?*const Guid, Key: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceCapabilities, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedEvents: fn( self: *const IPortableDeviceCapabilities, ppEvents: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEventOptions: fn( self: *const IPortableDeviceCapabilities, Event: ?*const Guid, ppOptions: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetSupportedCommands(self: *const T, ppCommands: ?*?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetSupportedCommands(@ptrCast(*const IPortableDeviceCapabilities, self), ppCommands); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetCommandOptions(self: *const T, Command: ?*const PROPERTYKEY, ppOptions: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetCommandOptions(@ptrCast(*const IPortableDeviceCapabilities, self), Command, ppOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetFunctionalCategories(self: *const T, ppCategories: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetFunctionalCategories(@ptrCast(*const IPortableDeviceCapabilities, self), ppCategories); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetFunctionalObjects(self: *const T, Category: ?*const Guid, ppObjectIDs: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetFunctionalObjects(@ptrCast(*const IPortableDeviceCapabilities, self), Category, ppObjectIDs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetSupportedContentTypes(self: *const T, Category: ?*const Guid, ppContentTypes: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetSupportedContentTypes(@ptrCast(*const IPortableDeviceCapabilities, self), Category, ppContentTypes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetSupportedFormats(self: *const T, ContentType: ?*const Guid, ppFormats: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetSupportedFormats(@ptrCast(*const IPortableDeviceCapabilities, self), ContentType, ppFormats); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetSupportedFormatProperties(self: *const T, Format: ?*const Guid, ppKeys: ?*?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetSupportedFormatProperties(@ptrCast(*const IPortableDeviceCapabilities, self), Format, ppKeys); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetFixedPropertyAttributes(self: *const T, Format: ?*const Guid, Key: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetFixedPropertyAttributes(@ptrCast(*const IPortableDeviceCapabilities, self), Format, Key, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceCapabilities, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetSupportedEvents(self: *const T, ppEvents: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetSupportedEvents(@ptrCast(*const IPortableDeviceCapabilities, self), ppEvents); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceCapabilities_GetEventOptions(self: *const T, Event: ?*const Guid, ppOptions: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceCapabilities.VTable, self.vtable).GetEventOptions(@ptrCast(*const IPortableDeviceCapabilities, self), Event, ppOptions); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceEventCallback_Value = Guid.initString("a8792a31-f385-493c-a893-40f64eb45f6e"); pub const IID_IPortableDeviceEventCallback = &IID_IPortableDeviceEventCallback_Value; pub const IPortableDeviceEventCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnEvent: fn( self: *const IPortableDeviceEventCallback, pEventParameters: ?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceEventCallback_OnEvent(self: *const T, pEventParameters: ?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceEventCallback.VTable, self.vtable).OnEvent(@ptrCast(*const IPortableDeviceEventCallback, self), pEventParameters); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceDataStream_Value = Guid.initString("88e04db3-1012-4d64-9996-f703a950d3f4"); pub const IID_IPortableDeviceDataStream = &IID_IPortableDeviceDataStream_Value; pub const IPortableDeviceDataStream = extern struct { pub const VTable = extern struct { base: IStream.VTable, GetObjectID: fn( self: *const IPortableDeviceDataStream, ppszObjectID: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceDataStream, ) 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 IPortableDeviceDataStream_GetObjectID(self: *const T, ppszObjectID: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceDataStream.VTable, self.vtable).GetObjectID(@ptrCast(*const IPortableDeviceDataStream, self), ppszObjectID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceDataStream_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceDataStream.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceDataStream, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IPortableDeviceUnitsStream_Value = Guid.initString("5e98025f-bfc4-47a2-9a5f-bc900a507c67"); pub const IID_IPortableDeviceUnitsStream = &IID_IPortableDeviceUnitsStream_Value; pub const IPortableDeviceUnitsStream = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SeekInUnits: fn( self: *const IPortableDeviceUnitsStream, dlibMove: LARGE_INTEGER, units: WPD_STREAM_UNITS, dwOrigin: u32, plibNewPosition: ?*ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceUnitsStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceUnitsStream_SeekInUnits(self: *const T, dlibMove: LARGE_INTEGER, units: WPD_STREAM_UNITS, dwOrigin: u32, plibNewPosition: ?*ULARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceUnitsStream.VTable, self.vtable).SeekInUnits(@ptrCast(*const IPortableDeviceUnitsStream, self), dlibMove, units, dwOrigin, plibNewPosition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceUnitsStream_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceUnitsStream.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceUnitsStream, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDevicePropertiesBulk_Value = Guid.initString("482b05c0-4056-44ed-9e0f-5e23b009da93"); pub const IID_IPortableDevicePropertiesBulk = &IID_IPortableDevicePropertiesBulk_Value; pub const IPortableDevicePropertiesBulk = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueueGetValuesByObjectList: fn( self: *const IPortableDevicePropertiesBulk, pObjectIDs: ?*IPortableDevicePropVariantCollection, pKeys: ?*IPortableDeviceKeyCollection, pCallback: ?*IPortableDevicePropertiesBulkCallback, pContext: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueueGetValuesByObjectFormat: fn( self: *const IPortableDevicePropertiesBulk, pguidObjectFormat: ?*const Guid, pszParentObjectID: ?[*:0]const u16, dwDepth: u32, pKeys: ?*IPortableDeviceKeyCollection, pCallback: ?*IPortableDevicePropertiesBulkCallback, pContext: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueueSetValuesByObjectList: fn( self: *const IPortableDevicePropertiesBulk, pObjectValues: ?*IPortableDeviceValuesCollection, pCallback: ?*IPortableDevicePropertiesBulkCallback, pContext: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Start: fn( self: *const IPortableDevicePropertiesBulk, pContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDevicePropertiesBulk, pContext: ?*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 IPortableDevicePropertiesBulk_QueueGetValuesByObjectList(self: *const T, pObjectIDs: ?*IPortableDevicePropVariantCollection, pKeys: ?*IPortableDeviceKeyCollection, pCallback: ?*IPortableDevicePropertiesBulkCallback, pContext: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropertiesBulk.VTable, self.vtable).QueueGetValuesByObjectList(@ptrCast(*const IPortableDevicePropertiesBulk, self), pObjectIDs, pKeys, pCallback, pContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropertiesBulk_QueueGetValuesByObjectFormat(self: *const T, pguidObjectFormat: ?*const Guid, pszParentObjectID: ?[*:0]const u16, dwDepth: u32, pKeys: ?*IPortableDeviceKeyCollection, pCallback: ?*IPortableDevicePropertiesBulkCallback, pContext: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropertiesBulk.VTable, self.vtable).QueueGetValuesByObjectFormat(@ptrCast(*const IPortableDevicePropertiesBulk, self), pguidObjectFormat, pszParentObjectID, dwDepth, pKeys, pCallback, pContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropertiesBulk_QueueSetValuesByObjectList(self: *const T, pObjectValues: ?*IPortableDeviceValuesCollection, pCallback: ?*IPortableDevicePropertiesBulkCallback, pContext: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropertiesBulk.VTable, self.vtable).QueueSetValuesByObjectList(@ptrCast(*const IPortableDevicePropertiesBulk, self), pObjectValues, pCallback, pContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropertiesBulk_Start(self: *const T, pContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropertiesBulk.VTable, self.vtable).Start(@ptrCast(*const IPortableDevicePropertiesBulk, self), pContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropertiesBulk_Cancel(self: *const T, pContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropertiesBulk.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDevicePropertiesBulk, self), pContext); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDevicePropertiesBulkCallback_Value = Guid.initString("9deacb80-11e8-40e3-a9f3-f557986a7845"); pub const IID_IPortableDevicePropertiesBulkCallback = &IID_IPortableDevicePropertiesBulkCallback_Value; pub const IPortableDevicePropertiesBulkCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnStart: fn( self: *const IPortableDevicePropertiesBulkCallback, pContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnProgress: fn( self: *const IPortableDevicePropertiesBulkCallback, pContext: ?*const Guid, pResults: ?*IPortableDeviceValuesCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnEnd: fn( self: *const IPortableDevicePropertiesBulkCallback, pContext: ?*const Guid, hrStatus: 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 IPortableDevicePropertiesBulkCallback_OnStart(self: *const T, pContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropertiesBulkCallback.VTable, self.vtable).OnStart(@ptrCast(*const IPortableDevicePropertiesBulkCallback, self), pContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropertiesBulkCallback_OnProgress(self: *const T, pContext: ?*const Guid, pResults: ?*IPortableDeviceValuesCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropertiesBulkCallback.VTable, self.vtable).OnProgress(@ptrCast(*const IPortableDevicePropertiesBulkCallback, self), pContext, pResults); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDevicePropertiesBulkCallback_OnEnd(self: *const T, pContext: ?*const Guid, hrStatus: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDevicePropertiesBulkCallback.VTable, self.vtable).OnEnd(@ptrCast(*const IPortableDevicePropertiesBulkCallback, self), pContext, hrStatus); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IPortableDeviceServiceManager_Value = Guid.initString("a8abc4e9-a84a-47a9-80b3-c5d9b172a961"); pub const IID_IPortableDeviceServiceManager = &IID_IPortableDeviceServiceManager_Value; pub const IPortableDeviceServiceManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDeviceServices: fn( self: *const IPortableDeviceServiceManager, pszPnPDeviceID: ?[*:0]const u16, guidServiceCategory: ?*const Guid, pServices: ?*?PWSTR, pcServices: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceForService: fn( self: *const IPortableDeviceServiceManager, pszPnPServiceID: ?[*:0]const u16, ppszPnPDeviceID: ?*?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 IPortableDeviceServiceManager_GetDeviceServices(self: *const T, pszPnPDeviceID: ?[*:0]const u16, guidServiceCategory: ?*const Guid, pServices: ?*?PWSTR, pcServices: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceManager.VTable, self.vtable).GetDeviceServices(@ptrCast(*const IPortableDeviceServiceManager, self), pszPnPDeviceID, guidServiceCategory, pServices, pcServices); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceManager_GetDeviceForService(self: *const T, pszPnPServiceID: ?[*:0]const u16, ppszPnPDeviceID: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceManager.VTable, self.vtable).GetDeviceForService(@ptrCast(*const IPortableDeviceServiceManager, self), pszPnPServiceID, ppszPnPDeviceID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IPortableDeviceService_Value = Guid.initString("d3bd3a44-d7b5-40a9-98b7-2fa4d01dec08"); pub const IID_IPortableDeviceService = &IID_IPortableDeviceService_Value; pub const IPortableDeviceService = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Open: fn( self: *const IPortableDeviceService, pszPnPServiceID: ?[*:0]const u16, pClientInfo: ?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Capabilities: fn( self: *const IPortableDeviceService, ppCapabilities: ?*?*IPortableDeviceServiceCapabilities, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Content: fn( self: *const IPortableDeviceService, ppContent: ?*?*IPortableDeviceContent2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Methods: fn( self: *const IPortableDeviceService, ppMethods: ?*?*IPortableDeviceServiceMethods, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceService, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IPortableDeviceService, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetServiceObjectID: fn( self: *const IPortableDeviceService, ppszServiceObjectID: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPnPServiceID: fn( self: *const IPortableDeviceService, ppszPnPServiceID: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Advise: fn( self: *const IPortableDeviceService, dwFlags: u32, pCallback: ?*IPortableDeviceEventCallback, pParameters: ?*IPortableDeviceValues, ppszCookie: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unadvise: fn( self: *const IPortableDeviceService, pszCookie: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendCommand: fn( self: *const IPortableDeviceService, dwFlags: u32, pParameters: ?*IPortableDeviceValues, ppResults: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_Open(self: *const T, pszPnPServiceID: ?[*:0]const u16, pClientInfo: ?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).Open(@ptrCast(*const IPortableDeviceService, self), pszPnPServiceID, pClientInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_Capabilities(self: *const T, ppCapabilities: ?*?*IPortableDeviceServiceCapabilities) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).Capabilities(@ptrCast(*const IPortableDeviceService, self), ppCapabilities); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_Content(self: *const T, ppContent: ?*?*IPortableDeviceContent2) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).Content(@ptrCast(*const IPortableDeviceService, self), ppContent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_Methods(self: *const T, ppMethods: ?*?*IPortableDeviceServiceMethods) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).Methods(@ptrCast(*const IPortableDeviceService, self), ppMethods); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceService, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_Close(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).Close(@ptrCast(*const IPortableDeviceService, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_GetServiceObjectID(self: *const T, ppszServiceObjectID: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).GetServiceObjectID(@ptrCast(*const IPortableDeviceService, self), ppszServiceObjectID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_GetPnPServiceID(self: *const T, ppszPnPServiceID: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).GetPnPServiceID(@ptrCast(*const IPortableDeviceService, self), ppszPnPServiceID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_Advise(self: *const T, dwFlags: u32, pCallback: ?*IPortableDeviceEventCallback, pParameters: ?*IPortableDeviceValues, ppszCookie: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).Advise(@ptrCast(*const IPortableDeviceService, self), dwFlags, pCallback, pParameters, ppszCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_Unadvise(self: *const T, pszCookie: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).Unadvise(@ptrCast(*const IPortableDeviceService, self), pszCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceService_SendCommand(self: *const T, dwFlags: u32, pParameters: ?*IPortableDeviceValues, ppResults: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceService.VTable, self.vtable).SendCommand(@ptrCast(*const IPortableDeviceService, self), dwFlags, pParameters, ppResults); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IPortableDeviceServiceCapabilities_Value = Guid.initString("24dbd89d-413e-43e0-bd5b-197f3c56c886"); pub const IID_IPortableDeviceServiceCapabilities = &IID_IPortableDeviceServiceCapabilities_Value; pub const IPortableDeviceServiceCapabilities = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSupportedMethods: fn( self: *const IPortableDeviceServiceCapabilities, ppMethods: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedMethodsByFormat: fn( self: *const IPortableDeviceServiceCapabilities, Format: ?*const Guid, ppMethods: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMethodAttributes: fn( self: *const IPortableDeviceServiceCapabilities, Method: ?*const Guid, ppAttributes: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMethodParameterAttributes: fn( self: *const IPortableDeviceServiceCapabilities, Method: ?*const Guid, Parameter: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedFormats: fn( self: *const IPortableDeviceServiceCapabilities, ppFormats: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFormatAttributes: fn( self: *const IPortableDeviceServiceCapabilities, Format: ?*const Guid, ppAttributes: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedFormatProperties: fn( self: *const IPortableDeviceServiceCapabilities, Format: ?*const Guid, ppKeys: ?*?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFormatPropertyAttributes: fn( self: *const IPortableDeviceServiceCapabilities, Format: ?*const Guid, Property: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedEvents: fn( self: *const IPortableDeviceServiceCapabilities, ppEvents: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEventAttributes: fn( self: *const IPortableDeviceServiceCapabilities, Event: ?*const Guid, ppAttributes: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEventParameterAttributes: fn( self: *const IPortableDeviceServiceCapabilities, Event: ?*const Guid, Parameter: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInheritedServices: fn( self: *const IPortableDeviceServiceCapabilities, dwInheritanceType: u32, ppServices: ?*?*IPortableDevicePropVariantCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFormatRenderingProfiles: fn( self: *const IPortableDeviceServiceCapabilities, Format: ?*const Guid, ppRenderingProfiles: ?*?*IPortableDeviceValuesCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedCommands: fn( self: *const IPortableDeviceServiceCapabilities, ppCommands: ?*?*IPortableDeviceKeyCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCommandOptions: fn( self: *const IPortableDeviceServiceCapabilities, Command: ?*const PROPERTYKEY, ppOptions: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceServiceCapabilities, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetSupportedMethods(self: *const T, ppMethods: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetSupportedMethods(@ptrCast(*const IPortableDeviceServiceCapabilities, self), ppMethods); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetSupportedMethodsByFormat(self: *const T, Format: ?*const Guid, ppMethods: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetSupportedMethodsByFormat(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Format, ppMethods); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetMethodAttributes(self: *const T, Method: ?*const Guid, ppAttributes: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetMethodAttributes(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Method, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetMethodParameterAttributes(self: *const T, Method: ?*const Guid, Parameter: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetMethodParameterAttributes(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Method, Parameter, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetSupportedFormats(self: *const T, ppFormats: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetSupportedFormats(@ptrCast(*const IPortableDeviceServiceCapabilities, self), ppFormats); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetFormatAttributes(self: *const T, Format: ?*const Guid, ppAttributes: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetFormatAttributes(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Format, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetSupportedFormatProperties(self: *const T, Format: ?*const Guid, ppKeys: ?*?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetSupportedFormatProperties(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Format, ppKeys); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetFormatPropertyAttributes(self: *const T, Format: ?*const Guid, Property: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetFormatPropertyAttributes(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Format, Property, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetSupportedEvents(self: *const T, ppEvents: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetSupportedEvents(@ptrCast(*const IPortableDeviceServiceCapabilities, self), ppEvents); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetEventAttributes(self: *const T, Event: ?*const Guid, ppAttributes: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetEventAttributes(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Event, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetEventParameterAttributes(self: *const T, Event: ?*const Guid, Parameter: ?*const PROPERTYKEY, ppAttributes: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetEventParameterAttributes(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Event, Parameter, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetInheritedServices(self: *const T, dwInheritanceType: u32, ppServices: ?*?*IPortableDevicePropVariantCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetInheritedServices(@ptrCast(*const IPortableDeviceServiceCapabilities, self), dwInheritanceType, ppServices); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetFormatRenderingProfiles(self: *const T, Format: ?*const Guid, ppRenderingProfiles: ?*?*IPortableDeviceValuesCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetFormatRenderingProfiles(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Format, ppRenderingProfiles); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetSupportedCommands(self: *const T, ppCommands: ?*?*IPortableDeviceKeyCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetSupportedCommands(@ptrCast(*const IPortableDeviceServiceCapabilities, self), ppCommands); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_GetCommandOptions(self: *const T, Command: ?*const PROPERTYKEY, ppOptions: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).GetCommandOptions(@ptrCast(*const IPortableDeviceServiceCapabilities, self), Command, ppOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceCapabilities_Cancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceCapabilities.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceServiceCapabilities, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IPortableDeviceServiceMethods_Value = Guid.initString("e20333c9-fd34-412d-a381-cc6f2d820df7"); pub const IID_IPortableDeviceServiceMethods = &IID_IPortableDeviceServiceMethods_Value; pub const IPortableDeviceServiceMethods = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Invoke: fn( self: *const IPortableDeviceServiceMethods, Method: ?*const Guid, pParameters: ?*IPortableDeviceValues, ppResults: ?*?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InvokeAsync: fn( self: *const IPortableDeviceServiceMethods, Method: ?*const Guid, pParameters: ?*IPortableDeviceValues, pCallback: ?*IPortableDeviceServiceMethodCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceServiceMethods, pCallback: ?*IPortableDeviceServiceMethodCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceMethods_Invoke(self: *const T, Method: ?*const Guid, pParameters: ?*IPortableDeviceValues, ppResults: ?*?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceMethods.VTable, self.vtable).Invoke(@ptrCast(*const IPortableDeviceServiceMethods, self), Method, pParameters, ppResults); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceMethods_InvokeAsync(self: *const T, Method: ?*const Guid, pParameters: ?*IPortableDeviceValues, pCallback: ?*IPortableDeviceServiceMethodCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceMethods.VTable, self.vtable).InvokeAsync(@ptrCast(*const IPortableDeviceServiceMethods, self), Method, pParameters, pCallback); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceMethods_Cancel(self: *const T, pCallback: ?*IPortableDeviceServiceMethodCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceMethods.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceServiceMethods, self), pCallback); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IPortableDeviceServiceMethodCallback_Value = Guid.initString("c424233c-afce-4828-a756-7ed7a2350083"); pub const IID_IPortableDeviceServiceMethodCallback = &IID_IPortableDeviceServiceMethodCallback_Value; pub const IPortableDeviceServiceMethodCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnComplete: fn( self: *const IPortableDeviceServiceMethodCallback, hrStatus: HRESULT, pResults: ?*IPortableDeviceValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceMethodCallback_OnComplete(self: *const T, hrStatus: HRESULT, pResults: ?*IPortableDeviceValues) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceMethodCallback.VTable, self.vtable).OnComplete(@ptrCast(*const IPortableDeviceServiceMethodCallback, self), hrStatus, pResults); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceServiceActivation_Value = Guid.initString("e56b0534-d9b9-425c-9b99-75f97cb3d7c8"); pub const IID_IPortableDeviceServiceActivation = &IID_IPortableDeviceServiceActivation_Value; pub const IPortableDeviceServiceActivation = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OpenAsync: fn( self: *const IPortableDeviceServiceActivation, pszPnPServiceID: ?[*:0]const u16, pClientInfo: ?*IPortableDeviceValues, pCallback: ?*IPortableDeviceServiceOpenCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CancelOpenAsync: fn( self: *const IPortableDeviceServiceActivation, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceActivation_OpenAsync(self: *const T, pszPnPServiceID: ?[*:0]const u16, pClientInfo: ?*IPortableDeviceValues, pCallback: ?*IPortableDeviceServiceOpenCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceActivation.VTable, self.vtable).OpenAsync(@ptrCast(*const IPortableDeviceServiceActivation, self), pszPnPServiceID, pClientInfo, pCallback); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceServiceActivation_CancelOpenAsync(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceActivation.VTable, self.vtable).CancelOpenAsync(@ptrCast(*const IPortableDeviceServiceActivation, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPortableDeviceServiceOpenCallback_Value = Guid.initString("bced49c8-8efe-41ed-960b-61313abd47a9"); pub const IID_IPortableDeviceServiceOpenCallback = &IID_IPortableDeviceServiceOpenCallback_Value; pub const IPortableDeviceServiceOpenCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnComplete: fn( self: *const IPortableDeviceServiceOpenCallback, hrStatus: 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 IPortableDeviceServiceOpenCallback_OnComplete(self: *const T, hrStatus: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceServiceOpenCallback.VTable, self.vtable).OnComplete(@ptrCast(*const IPortableDeviceServiceOpenCallback, self), hrStatus); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IPortableDeviceDispatchFactory_Value = Guid.initString("5e1eafc3-e3d7-4132-96fa-759c0f9d1e0f"); pub const IID_IPortableDeviceDispatchFactory = &IID_IPortableDeviceDispatchFactory_Value; pub const IPortableDeviceDispatchFactory = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDeviceDispatch: fn( self: *const IPortableDeviceDispatchFactory, pszPnPDeviceID: ?[*:0]const u16, ppDeviceDispatch: ?*?*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 IPortableDeviceDispatchFactory_GetDeviceDispatch(self: *const T, pszPnPDeviceID: ?[*:0]const u16, ppDeviceDispatch: ?*?*IDispatch) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceDispatchFactory.VTable, self.vtable).GetDeviceDispatch(@ptrCast(*const IPortableDeviceDispatchFactory, self), pszPnPDeviceID, ppDeviceDispatch); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IPortableDeviceWebControl_Value = Guid.initString("94fc7953-5ca1-483a-8aee-df52e7747d00"); pub const IID_IPortableDeviceWebControl = &IID_IPortableDeviceWebControl_Value; pub const IPortableDeviceWebControl = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, GetDeviceFromId: fn( self: *const IPortableDeviceWebControl, deviceId: ?BSTR, ppDevice: ?*?*IDispatch, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceFromIdAsync: fn( self: *const IPortableDeviceWebControl, deviceId: ?BSTR, pCompletionHandler: ?*IDispatch, pErrorHandler: ?*IDispatch, ) 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 IPortableDeviceWebControl_GetDeviceFromId(self: *const T, deviceId: ?BSTR, ppDevice: ?*?*IDispatch) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceWebControl.VTable, self.vtable).GetDeviceFromId(@ptrCast(*const IPortableDeviceWebControl, self), deviceId, ppDevice); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceWebControl_GetDeviceFromIdAsync(self: *const T, deviceId: ?BSTR, pCompletionHandler: ?*IDispatch, pErrorHandler: ?*IDispatch) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceWebControl.VTable, self.vtable).GetDeviceFromIdAsync(@ptrCast(*const IPortableDeviceWebControl, self), deviceId, pCompletionHandler, pErrorHandler); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_EnumBthMtpConnectors_Value = Guid.initString("a1570149-e645-4f43-8b0d-409b061db2fc"); pub const CLSID_EnumBthMtpConnectors = &CLSID_EnumBthMtpConnectors_Value; const IID_IEnumPortableDeviceConnectors_Value = Guid.initString("bfdef549-9247-454f-bd82-06fe80853faa"); pub const IID_IEnumPortableDeviceConnectors = &IID_IEnumPortableDeviceConnectors_Value; pub const IEnumPortableDeviceConnectors = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumPortableDeviceConnectors, cRequested: u32, pConnectors: [*]?*IPortableDeviceConnector, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumPortableDeviceConnectors, cConnectors: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumPortableDeviceConnectors, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumPortableDeviceConnectors, ppEnum: ?*?*IEnumPortableDeviceConnectors, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumPortableDeviceConnectors_Next(self: *const T, cRequested: u32, pConnectors: [*]?*IPortableDeviceConnector, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumPortableDeviceConnectors.VTable, self.vtable).Next(@ptrCast(*const IEnumPortableDeviceConnectors, self), cRequested, pConnectors, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumPortableDeviceConnectors_Skip(self: *const T, cConnectors: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumPortableDeviceConnectors.VTable, self.vtable).Skip(@ptrCast(*const IEnumPortableDeviceConnectors, self), cConnectors); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumPortableDeviceConnectors_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumPortableDeviceConnectors.VTable, self.vtable).Reset(@ptrCast(*const IEnumPortableDeviceConnectors, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumPortableDeviceConnectors_Clone(self: *const T, ppEnum: ?*?*IEnumPortableDeviceConnectors) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumPortableDeviceConnectors.VTable, self.vtable).Clone(@ptrCast(*const IEnumPortableDeviceConnectors, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IPortableDeviceConnector_Value = Guid.initString("625e2df8-6392-4cf0-9ad1-3cfa5f17775c"); pub const IID_IPortableDeviceConnector = &IID_IPortableDeviceConnector_Value; pub const IPortableDeviceConnector = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Connect: fn( self: *const IPortableDeviceConnector, pCallback: ?*IConnectionRequestCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disconnect: fn( self: *const IPortableDeviceConnector, pCallback: ?*IConnectionRequestCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IPortableDeviceConnector, pCallback: ?*IConnectionRequestCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperty: fn( self: *const IPortableDeviceConnector, pPropertyKey: ?*const DEVPROPKEY, pPropertyType: ?*u32, ppData: [*]?*u8, pcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetProperty: fn( self: *const IPortableDeviceConnector, pPropertyKey: ?*const DEVPROPKEY, PropertyType: u32, pData: [*:0]const u8, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPnPID: fn( self: *const IPortableDeviceConnector, ppwszPnPID: ?*?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 IPortableDeviceConnector_Connect(self: *const T, pCallback: ?*IConnectionRequestCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceConnector.VTable, self.vtable).Connect(@ptrCast(*const IPortableDeviceConnector, self), pCallback); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceConnector_Disconnect(self: *const T, pCallback: ?*IConnectionRequestCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceConnector.VTable, self.vtable).Disconnect(@ptrCast(*const IPortableDeviceConnector, self), pCallback); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceConnector_Cancel(self: *const T, pCallback: ?*IConnectionRequestCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceConnector.VTable, self.vtable).Cancel(@ptrCast(*const IPortableDeviceConnector, self), pCallback); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceConnector_GetProperty(self: *const T, pPropertyKey: ?*const DEVPROPKEY, pPropertyType: ?*u32, ppData: [*]?*u8, pcbData: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceConnector.VTable, self.vtable).GetProperty(@ptrCast(*const IPortableDeviceConnector, self), pPropertyKey, pPropertyType, ppData, pcbData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceConnector_SetProperty(self: *const T, pPropertyKey: ?*const DEVPROPKEY, PropertyType: u32, pData: [*:0]const u8, cbData: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceConnector.VTable, self.vtable).SetProperty(@ptrCast(*const IPortableDeviceConnector, self), pPropertyKey, PropertyType, pData, cbData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPortableDeviceConnector_GetPnPID(self: *const T, ppwszPnPID: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPortableDeviceConnector.VTable, self.vtable).GetPnPID(@ptrCast(*const IPortableDeviceConnector, self), ppwszPnPID); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IConnectionRequestCallback_Value = Guid.initString("272c9ae0-7161-4ae0-91bd-9f448ee9c427"); pub const IID_IConnectionRequestCallback = &IID_IConnectionRequestCallback_Value; pub const IConnectionRequestCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnComplete: fn( self: *const IConnectionRequestCallback, hrStatus: 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 IConnectionRequestCallback_OnComplete(self: *const T, hrStatus: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectionRequestCallback.VTable, self.vtable).OnComplete(@ptrCast(*const IConnectionRequestCallback, self), hrStatus); } };} pub usingnamespace MethodMixin(@This()); }; pub const DEVICE_RADIO_STATE = enum(i32) { RADIO_ON = 0, SW_RADIO_OFF = 1, HW_RADIO_OFF = 2, SW_HW_RADIO_OFF = 3, HW_RADIO_ON_UNCONTROLLABLE = 4, RADIO_INVALID = 5, HW_RADIO_OFF_UNCONTROLLABLE = 6, // RADIO_MAX = 6, this enum value conflicts with HW_RADIO_OFF_UNCONTROLLABLE }; pub const DRS_RADIO_ON = DEVICE_RADIO_STATE.RADIO_ON; pub const DRS_SW_RADIO_OFF = DEVICE_RADIO_STATE.SW_RADIO_OFF; pub const DRS_HW_RADIO_OFF = DEVICE_RADIO_STATE.HW_RADIO_OFF; pub const DRS_SW_HW_RADIO_OFF = DEVICE_RADIO_STATE.SW_HW_RADIO_OFF; pub const DRS_HW_RADIO_ON_UNCONTROLLABLE = DEVICE_RADIO_STATE.HW_RADIO_ON_UNCONTROLLABLE; pub const DRS_RADIO_INVALID = DEVICE_RADIO_STATE.RADIO_INVALID; pub const DRS_HW_RADIO_OFF_UNCONTROLLABLE = DEVICE_RADIO_STATE.HW_RADIO_OFF_UNCONTROLLABLE; pub const DRS_RADIO_MAX = DEVICE_RADIO_STATE.HW_RADIO_OFF_UNCONTROLLABLE; pub const SYSTEM_RADIO_STATE = enum(i32) { ENABLED = 0, DISABLED = 1, }; pub const SRS_RADIO_ENABLED = SYSTEM_RADIO_STATE.ENABLED; pub const SRS_RADIO_DISABLED = SYSTEM_RADIO_STATE.DISABLED; const IID_IMediaRadioManager_Value = Guid.initString("6cfdcab5-fc47-42a5-9241-074b58830e73"); pub const IID_IMediaRadioManager = &IID_IMediaRadioManager_Value; pub const IMediaRadioManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetRadioInstances: fn( self: *const IMediaRadioManager, ppCollection: ?*?*IRadioInstanceCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSystemRadioStateChange: fn( self: *const IMediaRadioManager, sysRadioState: SYSTEM_RADIO_STATE, uTimeoutSec: 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 IMediaRadioManager_GetRadioInstances(self: *const T, ppCollection: ?*?*IRadioInstanceCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IMediaRadioManager.VTable, self.vtable).GetRadioInstances(@ptrCast(*const IMediaRadioManager, self), ppCollection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMediaRadioManager_OnSystemRadioStateChange(self: *const T, sysRadioState: SYSTEM_RADIO_STATE, uTimeoutSec: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMediaRadioManager.VTable, self.vtable).OnSystemRadioStateChange(@ptrCast(*const IMediaRadioManager, self), sysRadioState, uTimeoutSec); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IRadioInstanceCollection_Value = Guid.initString("e5791fae-5665-4e0c-95be-5fde31644185"); pub const IID_IRadioInstanceCollection = &IID_IRadioInstanceCollection_Value; pub const IRadioInstanceCollection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IRadioInstanceCollection, pcInstance: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAt: fn( self: *const IRadioInstanceCollection, uIndex: u32, ppRadioInstance: ?*?*IRadioInstance, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRadioInstanceCollection_GetCount(self: *const T, pcInstance: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRadioInstanceCollection.VTable, self.vtable).GetCount(@ptrCast(*const IRadioInstanceCollection, self), pcInstance); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRadioInstanceCollection_GetAt(self: *const T, uIndex: u32, ppRadioInstance: ?*?*IRadioInstance) callconv(.Inline) HRESULT { return @ptrCast(*const IRadioInstanceCollection.VTable, self.vtable).GetAt(@ptrCast(*const IRadioInstanceCollection, self), uIndex, ppRadioInstance); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IRadioInstance_Value = Guid.initString("70aa1c9e-f2b4-4c61-86d3-6b9fb75fd1a2"); pub const IID_IRadioInstance = &IID_IRadioInstance_Value; pub const IRadioInstance = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetRadioManagerSignature: fn( self: *const IRadioInstance, pguidSignature: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInstanceSignature: fn( self: *const IRadioInstance, pbstrId: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFriendlyName: fn( self: *const IRadioInstance, lcid: u32, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRadioState: fn( self: *const IRadioInstance, pRadioState: ?*DEVICE_RADIO_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRadioState: fn( self: *const IRadioInstance, radioState: DEVICE_RADIO_STATE, uTimeoutSec: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsMultiComm: fn( self: *const IRadioInstance, ) callconv(@import("std").os.windows.WINAPI) BOOL, IsAssociatingDevice: fn( self: *const IRadioInstance, ) callconv(@import("std").os.windows.WINAPI) BOOL, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRadioInstance_GetRadioManagerSignature(self: *const T, pguidSignature: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IRadioInstance.VTable, self.vtable).GetRadioManagerSignature(@ptrCast(*const IRadioInstance, self), pguidSignature); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRadioInstance_GetInstanceSignature(self: *const T, pbstrId: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRadioInstance.VTable, self.vtable).GetInstanceSignature(@ptrCast(*const IRadioInstance, self), pbstrId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRadioInstance_GetFriendlyName(self: *const T, lcid: u32, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRadioInstance.VTable, self.vtable).GetFriendlyName(@ptrCast(*const IRadioInstance, self), lcid, pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRadioInstance_GetRadioState(self: *const T, pRadioState: ?*DEVICE_RADIO_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IRadioInstance.VTable, self.vtable).GetRadioState(@ptrCast(*const IRadioInstance, self), pRadioState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRadioInstance_SetRadioState(self: *const T, radioState: DEVICE_RADIO_STATE, uTimeoutSec: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRadioInstance.VTable, self.vtable).SetRadioState(@ptrCast(*const IRadioInstance, self), radioState, uTimeoutSec); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRadioInstance_IsMultiComm(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const IRadioInstance.VTable, self.vtable).IsMultiComm(@ptrCast(*const IRadioInstance, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRadioInstance_IsAssociatingDevice(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const IRadioInstance.VTable, self.vtable).IsAssociatingDevice(@ptrCast(*const IRadioInstance, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMediaRadioManagerNotifySink_Value = Guid.initString("89d81f5f-c147-49ed-a11c-77b20c31e7c9"); pub const IID_IMediaRadioManagerNotifySink = &IID_IMediaRadioManagerNotifySink_Value; pub const IMediaRadioManagerNotifySink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnInstanceAdd: fn( self: *const IMediaRadioManagerNotifySink, pRadioInstance: ?*IRadioInstance, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInstanceRemove: fn( self: *const IMediaRadioManagerNotifySink, bstrRadioInstanceId: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInstanceRadioChange: fn( self: *const IMediaRadioManagerNotifySink, bstrRadioInstanceId: ?BSTR, radioState: DEVICE_RADIO_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMediaRadioManagerNotifySink_OnInstanceAdd(self: *const T, pRadioInstance: ?*IRadioInstance) callconv(.Inline) HRESULT { return @ptrCast(*const IMediaRadioManagerNotifySink.VTable, self.vtable).OnInstanceAdd(@ptrCast(*const IMediaRadioManagerNotifySink, self), pRadioInstance); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMediaRadioManagerNotifySink_OnInstanceRemove(self: *const T, bstrRadioInstanceId: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMediaRadioManagerNotifySink.VTable, self.vtable).OnInstanceRemove(@ptrCast(*const IMediaRadioManagerNotifySink, self), bstrRadioInstanceId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMediaRadioManagerNotifySink_OnInstanceRadioChange(self: *const T, bstrRadioInstanceId: ?BSTR, radioState: DEVICE_RADIO_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IMediaRadioManagerNotifySink.VTable, self.vtable).OnInstanceRadioChange(@ptrCast(*const IMediaRadioManagerNotifySink, self), bstrRadioInstanceId, radioState); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (1) //-------------------------------------------------------------------------------- pub extern "DMProcessXMLFiltered" fn DMProcessConfigXMLFiltered( pszXmlIn: ?[*:0]const u16, rgszAllowedCspNodes: [*]?PWSTR, dwNumAllowedCspNodes: u32, pbstrXmlOut: ?*?BSTR, ) 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 (14) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BSTR = @import("../foundation.zig").BSTR; const DEVPROPKEY = @import("../devices/properties.zig").DEVPROPKEY; const HRESULT = @import("../foundation.zig").HRESULT; const IDispatch = @import("../system/com.zig").IDispatch; const IPropertyStore = @import("../ui/shell/properties_system.zig").IPropertyStore; const IStream = @import("../system/com.zig").IStream; const IUnknown = @import("../system/com.zig").IUnknown; const LARGE_INTEGER = @import("../foundation.zig").LARGE_INTEGER; const PROPERTYKEY = @import("../ui/shell/properties_system.zig").PROPERTYKEY; const PROPVARIANT = @import("../system/com/structured_storage.zig").PROPVARIANT; const PWSTR = @import("../foundation.zig").PWSTR; const ULARGE_INTEGER = @import("../foundation.zig").ULARGE_INTEGER; 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/devices/portable_devices.zig
//-------------------------------------------------------------------------------- // Section: Types (34) //-------------------------------------------------------------------------------- pub const JOB_OBJECT_LIMIT = enum(u32) { LIMIT_WORKINGSET = 1, LIMIT_PROCESS_TIME = 2, LIMIT_JOB_TIME = 4, LIMIT_ACTIVE_PROCESS = 8, LIMIT_AFFINITY = 16, LIMIT_PRIORITY_CLASS = 32, LIMIT_PRESERVE_JOB_TIME = 64, LIMIT_SCHEDULING_CLASS = 128, LIMIT_PROCESS_MEMORY = 256, LIMIT_JOB_MEMORY = 512, // LIMIT_JOB_MEMORY_HIGH = 512, this enum value conflicts with LIMIT_JOB_MEMORY LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 1024, LIMIT_BREAKAWAY_OK = 2048, LIMIT_SILENT_BREAKAWAY_OK = 4096, LIMIT_KILL_ON_JOB_CLOSE = 8192, LIMIT_SUBSET_AFFINITY = 16384, LIMIT_JOB_MEMORY_LOW = 32768, LIMIT_JOB_READ_BYTES = 65536, LIMIT_JOB_WRITE_BYTES = 131072, LIMIT_RATE_CONTROL = 262144, // LIMIT_CPU_RATE_CONTROL = 262144, this enum value conflicts with LIMIT_RATE_CONTROL LIMIT_IO_RATE_CONTROL = 524288, LIMIT_NET_RATE_CONTROL = 1048576, LIMIT_VALID_FLAGS = 524287, BASIC_LIMIT_VALID_FLAGS = 255, EXTENDED_LIMIT_VALID_FLAGS = 32767, NOTIFICATION_LIMIT_VALID_FLAGS = 2064900, _, pub fn initFlags(o: struct { LIMIT_WORKINGSET: u1 = 0, LIMIT_PROCESS_TIME: u1 = 0, LIMIT_JOB_TIME: u1 = 0, LIMIT_ACTIVE_PROCESS: u1 = 0, LIMIT_AFFINITY: u1 = 0, LIMIT_PRIORITY_CLASS: u1 = 0, LIMIT_PRESERVE_JOB_TIME: u1 = 0, LIMIT_SCHEDULING_CLASS: u1 = 0, LIMIT_PROCESS_MEMORY: u1 = 0, LIMIT_JOB_MEMORY: u1 = 0, LIMIT_DIE_ON_UNHANDLED_EXCEPTION: u1 = 0, LIMIT_BREAKAWAY_OK: u1 = 0, LIMIT_SILENT_BREAKAWAY_OK: u1 = 0, LIMIT_KILL_ON_JOB_CLOSE: u1 = 0, LIMIT_SUBSET_AFFINITY: u1 = 0, LIMIT_JOB_MEMORY_LOW: u1 = 0, LIMIT_JOB_READ_BYTES: u1 = 0, LIMIT_JOB_WRITE_BYTES: u1 = 0, LIMIT_RATE_CONTROL: u1 = 0, LIMIT_IO_RATE_CONTROL: u1 = 0, LIMIT_NET_RATE_CONTROL: u1 = 0, LIMIT_VALID_FLAGS: u1 = 0, BASIC_LIMIT_VALID_FLAGS: u1 = 0, EXTENDED_LIMIT_VALID_FLAGS: u1 = 0, NOTIFICATION_LIMIT_VALID_FLAGS: u1 = 0, }) JOB_OBJECT_LIMIT { return @intToEnum(JOB_OBJECT_LIMIT, (if (o.LIMIT_WORKINGSET == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_WORKINGSET) else 0) | (if (o.LIMIT_PROCESS_TIME == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_PROCESS_TIME) else 0) | (if (o.LIMIT_JOB_TIME == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_JOB_TIME) else 0) | (if (o.LIMIT_ACTIVE_PROCESS == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_ACTIVE_PROCESS) else 0) | (if (o.LIMIT_AFFINITY == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_AFFINITY) else 0) | (if (o.LIMIT_PRIORITY_CLASS == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_PRIORITY_CLASS) else 0) | (if (o.LIMIT_PRESERVE_JOB_TIME == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_PRESERVE_JOB_TIME) else 0) | (if (o.LIMIT_SCHEDULING_CLASS == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_SCHEDULING_CLASS) else 0) | (if (o.LIMIT_PROCESS_MEMORY == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_PROCESS_MEMORY) else 0) | (if (o.LIMIT_JOB_MEMORY == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_JOB_MEMORY) else 0) | (if (o.LIMIT_DIE_ON_UNHANDLED_EXCEPTION == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_DIE_ON_UNHANDLED_EXCEPTION) else 0) | (if (o.LIMIT_BREAKAWAY_OK == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_BREAKAWAY_OK) else 0) | (if (o.LIMIT_SILENT_BREAKAWAY_OK == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_SILENT_BREAKAWAY_OK) else 0) | (if (o.LIMIT_KILL_ON_JOB_CLOSE == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_KILL_ON_JOB_CLOSE) else 0) | (if (o.LIMIT_SUBSET_AFFINITY == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_SUBSET_AFFINITY) else 0) | (if (o.LIMIT_JOB_MEMORY_LOW == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_JOB_MEMORY_LOW) else 0) | (if (o.LIMIT_JOB_READ_BYTES == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_JOB_READ_BYTES) else 0) | (if (o.LIMIT_JOB_WRITE_BYTES == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_JOB_WRITE_BYTES) else 0) | (if (o.LIMIT_RATE_CONTROL == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_RATE_CONTROL) else 0) | (if (o.LIMIT_IO_RATE_CONTROL == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_IO_RATE_CONTROL) else 0) | (if (o.LIMIT_NET_RATE_CONTROL == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_NET_RATE_CONTROL) else 0) | (if (o.LIMIT_VALID_FLAGS == 1) @enumToInt(JOB_OBJECT_LIMIT.LIMIT_VALID_FLAGS) else 0) | (if (o.BASIC_LIMIT_VALID_FLAGS == 1) @enumToInt(JOB_OBJECT_LIMIT.BASIC_LIMIT_VALID_FLAGS) else 0) | (if (o.EXTENDED_LIMIT_VALID_FLAGS == 1) @enumToInt(JOB_OBJECT_LIMIT.EXTENDED_LIMIT_VALID_FLAGS) else 0) | (if (o.NOTIFICATION_LIMIT_VALID_FLAGS == 1) @enumToInt(JOB_OBJECT_LIMIT.NOTIFICATION_LIMIT_VALID_FLAGS) else 0) ); } }; pub const JOB_OBJECT_LIMIT_WORKINGSET = JOB_OBJECT_LIMIT.LIMIT_WORKINGSET; pub const JOB_OBJECT_LIMIT_PROCESS_TIME = JOB_OBJECT_LIMIT.LIMIT_PROCESS_TIME; pub const JOB_OBJECT_LIMIT_JOB_TIME = JOB_OBJECT_LIMIT.LIMIT_JOB_TIME; pub const JOB_OBJECT_LIMIT_ACTIVE_PROCESS = JOB_OBJECT_LIMIT.LIMIT_ACTIVE_PROCESS; pub const JOB_OBJECT_LIMIT_AFFINITY = JOB_OBJECT_LIMIT.LIMIT_AFFINITY; pub const JOB_OBJECT_LIMIT_PRIORITY_CLASS = JOB_OBJECT_LIMIT.LIMIT_PRIORITY_CLASS; pub const JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = JOB_OBJECT_LIMIT.LIMIT_PRESERVE_JOB_TIME; pub const JOB_OBJECT_LIMIT_SCHEDULING_CLASS = JOB_OBJECT_LIMIT.LIMIT_SCHEDULING_CLASS; pub const JOB_OBJECT_LIMIT_PROCESS_MEMORY = JOB_OBJECT_LIMIT.LIMIT_PROCESS_MEMORY; pub const JOB_OBJECT_LIMIT_JOB_MEMORY = JOB_OBJECT_LIMIT.LIMIT_JOB_MEMORY; pub const JOB_OBJECT_LIMIT_JOB_MEMORY_HIGH = JOB_OBJECT_LIMIT.LIMIT_JOB_MEMORY; pub const JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = JOB_OBJECT_LIMIT.LIMIT_DIE_ON_UNHANDLED_EXCEPTION; pub const JOB_OBJECT_LIMIT_BREAKAWAY_OK = JOB_OBJECT_LIMIT.LIMIT_BREAKAWAY_OK; pub const JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = JOB_OBJECT_LIMIT.LIMIT_SILENT_BREAKAWAY_OK; pub const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = JOB_OBJECT_LIMIT.LIMIT_KILL_ON_JOB_CLOSE; pub const JOB_OBJECT_LIMIT_SUBSET_AFFINITY = JOB_OBJECT_LIMIT.LIMIT_SUBSET_AFFINITY; pub const JOB_OBJECT_LIMIT_JOB_MEMORY_LOW = JOB_OBJECT_LIMIT.LIMIT_JOB_MEMORY_LOW; pub const JOB_OBJECT_LIMIT_JOB_READ_BYTES = JOB_OBJECT_LIMIT.LIMIT_JOB_READ_BYTES; pub const JOB_OBJECT_LIMIT_JOB_WRITE_BYTES = JOB_OBJECT_LIMIT.LIMIT_JOB_WRITE_BYTES; pub const JOB_OBJECT_LIMIT_RATE_CONTROL = JOB_OBJECT_LIMIT.LIMIT_RATE_CONTROL; pub const JOB_OBJECT_LIMIT_CPU_RATE_CONTROL = JOB_OBJECT_LIMIT.LIMIT_RATE_CONTROL; pub const JOB_OBJECT_LIMIT_IO_RATE_CONTROL = JOB_OBJECT_LIMIT.LIMIT_IO_RATE_CONTROL; pub const JOB_OBJECT_LIMIT_NET_RATE_CONTROL = JOB_OBJECT_LIMIT.LIMIT_NET_RATE_CONTROL; pub const JOB_OBJECT_LIMIT_VALID_FLAGS = JOB_OBJECT_LIMIT.LIMIT_VALID_FLAGS; pub const JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS = JOB_OBJECT_LIMIT.BASIC_LIMIT_VALID_FLAGS; pub const JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS = JOB_OBJECT_LIMIT.EXTENDED_LIMIT_VALID_FLAGS; pub const JOB_OBJECT_NOTIFICATION_LIMIT_VALID_FLAGS = JOB_OBJECT_LIMIT.NOTIFICATION_LIMIT_VALID_FLAGS; pub const JOB_OBJECT_UILIMIT = enum(u32) { NONE = 0, HANDLES = 1, READCLIPBOARD = 2, WRITECLIPBOARD = 4, SYSTEMPARAMETERS = 8, DISPLAYSETTINGS = 16, GLOBALATOMS = 32, DESKTOP = 64, EXITWINDOWS = 128, _, pub fn initFlags(o: struct { NONE: u1 = 0, HANDLES: u1 = 0, READCLIPBOARD: u1 = 0, WRITECLIPBOARD: u1 = 0, SYSTEMPARAMETERS: u1 = 0, DISPLAYSETTINGS: u1 = 0, GLOBALATOMS: u1 = 0, DESKTOP: u1 = 0, EXITWINDOWS: u1 = 0, }) JOB_OBJECT_UILIMIT { return @intToEnum(JOB_OBJECT_UILIMIT, (if (o.NONE == 1) @enumToInt(JOB_OBJECT_UILIMIT.NONE) else 0) | (if (o.HANDLES == 1) @enumToInt(JOB_OBJECT_UILIMIT.HANDLES) else 0) | (if (o.READCLIPBOARD == 1) @enumToInt(JOB_OBJECT_UILIMIT.READCLIPBOARD) else 0) | (if (o.WRITECLIPBOARD == 1) @enumToInt(JOB_OBJECT_UILIMIT.WRITECLIPBOARD) else 0) | (if (o.SYSTEMPARAMETERS == 1) @enumToInt(JOB_OBJECT_UILIMIT.SYSTEMPARAMETERS) else 0) | (if (o.DISPLAYSETTINGS == 1) @enumToInt(JOB_OBJECT_UILIMIT.DISPLAYSETTINGS) else 0) | (if (o.GLOBALATOMS == 1) @enumToInt(JOB_OBJECT_UILIMIT.GLOBALATOMS) else 0) | (if (o.DESKTOP == 1) @enumToInt(JOB_OBJECT_UILIMIT.DESKTOP) else 0) | (if (o.EXITWINDOWS == 1) @enumToInt(JOB_OBJECT_UILIMIT.EXITWINDOWS) else 0) ); } }; pub const JOB_OBJECT_UILIMIT_NONE = JOB_OBJECT_UILIMIT.NONE; pub const JOB_OBJECT_UILIMIT_HANDLES = JOB_OBJECT_UILIMIT.HANDLES; pub const JOB_OBJECT_UILIMIT_READCLIPBOARD = JOB_OBJECT_UILIMIT.READCLIPBOARD; pub const JOB_OBJECT_UILIMIT_WRITECLIPBOARD = JOB_OBJECT_UILIMIT.WRITECLIPBOARD; pub const JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = JOB_OBJECT_UILIMIT.SYSTEMPARAMETERS; pub const JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = JOB_OBJECT_UILIMIT.DISPLAYSETTINGS; pub const JOB_OBJECT_UILIMIT_GLOBALATOMS = JOB_OBJECT_UILIMIT.GLOBALATOMS; pub const JOB_OBJECT_UILIMIT_DESKTOP = JOB_OBJECT_UILIMIT.DESKTOP; pub const JOB_OBJECT_UILIMIT_EXITWINDOWS = JOB_OBJECT_UILIMIT.EXITWINDOWS; pub const JOB_OBJECT_SECURITY = enum(u32) { NO_ADMIN = 1, RESTRICTED_TOKEN = 2, ONLY_TOKEN = 4, FILTER_TOKENS = 8, VALID_FLAGS = 15, _, pub fn initFlags(o: struct { NO_ADMIN: u1 = 0, RESTRICTED_TOKEN: u1 = 0, ONLY_TOKEN: u1 = 0, FILTER_TOKENS: u1 = 0, VALID_FLAGS: u1 = 0, }) JOB_OBJECT_SECURITY { return @intToEnum(JOB_OBJECT_SECURITY, (if (o.NO_ADMIN == 1) @enumToInt(JOB_OBJECT_SECURITY.NO_ADMIN) else 0) | (if (o.RESTRICTED_TOKEN == 1) @enumToInt(JOB_OBJECT_SECURITY.RESTRICTED_TOKEN) else 0) | (if (o.ONLY_TOKEN == 1) @enumToInt(JOB_OBJECT_SECURITY.ONLY_TOKEN) else 0) | (if (o.FILTER_TOKENS == 1) @enumToInt(JOB_OBJECT_SECURITY.FILTER_TOKENS) else 0) | (if (o.VALID_FLAGS == 1) @enumToInt(JOB_OBJECT_SECURITY.VALID_FLAGS) else 0) ); } }; pub const JOB_OBJECT_SECURITY_NO_ADMIN = JOB_OBJECT_SECURITY.NO_ADMIN; pub const JOB_OBJECT_SECURITY_RESTRICTED_TOKEN = JOB_OBJECT_SECURITY.RESTRICTED_TOKEN; pub const JOB_OBJECT_SECURITY_ONLY_TOKEN = JOB_OBJECT_SECURITY.ONLY_TOKEN; pub const JOB_OBJECT_SECURITY_FILTER_TOKENS = JOB_OBJECT_SECURITY.FILTER_TOKENS; pub const JOB_OBJECT_SECURITY_VALID_FLAGS = JOB_OBJECT_SECURITY.VALID_FLAGS; pub const JOB_OBJECT_CPU_RATE_CONTROL = enum(u32) { CPU_RATE_CONTROL_ENABLE = 1, CPU_RATE_CONTROL_WEIGHT_BASED = 2, CPU_RATE_CONTROL_HARD_CAP = 4, CPU_RATE_CONTROL_NOTIFY = 8, _CPU_RATE_CONTROL_MIN_MAX_RATE = 16, }; pub const JOB_OBJECT_CPU_RATE_CONTROL_ENABLE = JOB_OBJECT_CPU_RATE_CONTROL.CPU_RATE_CONTROL_ENABLE; pub const JOB_OBJECT_CPU_RATE_CONTROL_WEIGHT_BASED = JOB_OBJECT_CPU_RATE_CONTROL.CPU_RATE_CONTROL_WEIGHT_BASED; pub const JOB_OBJECT_CPU_RATE_CONTROL_HARD_CAP = JOB_OBJECT_CPU_RATE_CONTROL.CPU_RATE_CONTROL_HARD_CAP; pub const JOB_OBJECT_CPU_RATE_CONTROL_NOTIFY = JOB_OBJECT_CPU_RATE_CONTROL.CPU_RATE_CONTROL_NOTIFY; pub const JOB_OBJECT__CPU_RATE_CONTROL_MIN_MAX_RATE = JOB_OBJECT_CPU_RATE_CONTROL._CPU_RATE_CONTROL_MIN_MAX_RATE; pub const JOB_OBJECT_TERMINATE_AT_END_ACTION = enum(u32) { TERMINATE_AT_END_OF_JOB = 0, POST_AT_END_OF_JOB = 1, }; pub const JOB_OBJECT_TERMINATE_AT_END_OF_JOB = JOB_OBJECT_TERMINATE_AT_END_ACTION.TERMINATE_AT_END_OF_JOB; pub const JOB_OBJECT_POST_AT_END_OF_JOB = JOB_OBJECT_TERMINATE_AT_END_ACTION.POST_AT_END_OF_JOB; pub const JOBOBJECT_IO_RATE_CONTROL_INFORMATION = extern struct { MaxIops: i64, MaxBandwidth: i64, ReservationIops: i64, VolumeName: ?[*:0]const u16, BaseIoSize: u32, ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS, }; pub const JOB_SET_ARRAY = extern struct { JobHandle: ?HANDLE, MemberLevel: u32, Flags: u32, }; pub const JOBOBJECT_BASIC_ACCOUNTING_INFORMATION = extern struct { TotalUserTime: LARGE_INTEGER, TotalKernelTime: LARGE_INTEGER, ThisPeriodTotalUserTime: LARGE_INTEGER, ThisPeriodTotalKernelTime: LARGE_INTEGER, TotalPageFaultCount: u32, TotalProcesses: u32, ActiveProcesses: u32, TotalTerminatedProcesses: u32, }; pub const JOBOBJECT_BASIC_LIMIT_INFORMATION = extern struct { PerProcessUserTimeLimit: LARGE_INTEGER, PerJobUserTimeLimit: LARGE_INTEGER, LimitFlags: JOB_OBJECT_LIMIT, MinimumWorkingSetSize: usize, MaximumWorkingSetSize: usize, ActiveProcessLimit: u32, Affinity: usize, PriorityClass: u32, SchedulingClass: u32, }; pub const JOBOBJECT_EXTENDED_LIMIT_INFORMATION = extern struct { BasicLimitInformation: JOBOBJECT_BASIC_LIMIT_INFORMATION, IoInfo: IO_COUNTERS, ProcessMemoryLimit: usize, JobMemoryLimit: usize, PeakProcessMemoryUsed: usize, PeakJobMemoryUsed: usize, }; pub const JOBOBJECT_BASIC_PROCESS_ID_LIST = extern struct { NumberOfAssignedProcesses: u32, NumberOfProcessIdsInList: u32, ProcessIdList: [1]usize, }; pub const JOBOBJECT_BASIC_UI_RESTRICTIONS = extern struct { UIRestrictionsClass: JOB_OBJECT_UILIMIT, }; pub const JOBOBJECT_SECURITY_LIMIT_INFORMATION = extern struct { SecurityLimitFlags: JOB_OBJECT_SECURITY, JobToken: ?HANDLE, SidsToDisable: ?*TOKEN_GROUPS, PrivilegesToDelete: ?*TOKEN_PRIVILEGES, RestrictedSids: ?*TOKEN_GROUPS, }; pub const JOBOBJECT_END_OF_JOB_TIME_INFORMATION = extern struct { EndOfJobTimeAction: JOB_OBJECT_TERMINATE_AT_END_ACTION, }; pub const JOBOBJECT_ASSOCIATE_COMPLETION_PORT = extern struct { CompletionKey: ?*anyopaque, CompletionPort: ?HANDLE, }; pub const JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION = extern struct { BasicInfo: JOBOBJECT_BASIC_ACCOUNTING_INFORMATION, IoInfo: IO_COUNTERS, }; pub const JOBOBJECT_JOBSET_INFORMATION = extern struct { MemberLevel: u32, }; pub const JOBOBJECT_RATE_CONTROL_TOLERANCE = enum(i32) { Low = 1, Medium = 2, High = 3, }; pub const ToleranceLow = JOBOBJECT_RATE_CONTROL_TOLERANCE.Low; pub const ToleranceMedium = JOBOBJECT_RATE_CONTROL_TOLERANCE.Medium; pub const ToleranceHigh = JOBOBJECT_RATE_CONTROL_TOLERANCE.High; pub const JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL = enum(i32) { Short = 1, Medium = 2, Long = 3, }; // TODO: enum 'JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL' has known issues with its value aliases pub const JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION = extern struct { IoReadBytesLimit: u64, IoWriteBytesLimit: u64, PerJobUserTimeLimit: LARGE_INTEGER, JobMemoryLimit: u64, RateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, RateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, LimitFlags: JOB_OBJECT_LIMIT, }; pub const JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2 = extern struct { IoReadBytesLimit: u64, IoWriteBytesLimit: u64, PerJobUserTimeLimit: LARGE_INTEGER, Anonymous1: extern union { JobHighMemoryLimit: u64, JobMemoryLimit: u64, }, Anonymous2: extern union { RateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, CpuRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, }, Anonymous3: extern union { RateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, CpuRateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, }, LimitFlags: JOB_OBJECT_LIMIT, IoRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, JobLowMemoryLimit: u64, IoRateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, NetRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, NetRateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, }; pub const JOBOBJECT_LIMIT_VIOLATION_INFORMATION = extern struct { LimitFlags: JOB_OBJECT_LIMIT, ViolationLimitFlags: JOB_OBJECT_LIMIT, IoReadBytes: u64, IoReadBytesLimit: u64, IoWriteBytes: u64, IoWriteBytesLimit: u64, PerJobUserTime: LARGE_INTEGER, PerJobUserTimeLimit: LARGE_INTEGER, JobMemory: u64, JobMemoryLimit: u64, RateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, RateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE, }; pub const JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2 = extern struct { LimitFlags: JOB_OBJECT_LIMIT, ViolationLimitFlags: JOB_OBJECT_LIMIT, IoReadBytes: u64, IoReadBytesLimit: u64, IoWriteBytes: u64, IoWriteBytesLimit: u64, PerJobUserTime: LARGE_INTEGER, PerJobUserTimeLimit: LARGE_INTEGER, JobMemory: u64, Anonymous1: extern union { JobHighMemoryLimit: u64, JobMemoryLimit: u64, }, Anonymous2: extern union { RateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, CpuRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, }, Anonymous3: extern union { RateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE, CpuRateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE, }, JobLowMemoryLimit: u64, IoRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, IoRateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE, NetRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, NetRateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE, }; pub const JOBOBJECT_CPU_RATE_CONTROL_INFORMATION = extern struct { ControlFlags: JOB_OBJECT_CPU_RATE_CONTROL, Anonymous: extern union { CpuRate: u32, Weight: u32, Anonymous: extern struct { MinRate: u16, MaxRate: u16, }, }, }; pub const JOB_OBJECT_NET_RATE_CONTROL_FLAGS = enum(i32) { ENABLE = 1, MAX_BANDWIDTH = 2, DSCP_TAG = 4, VALID_FLAGS = 7, }; pub const JOB_OBJECT_NET_RATE_CONTROL_ENABLE = JOB_OBJECT_NET_RATE_CONTROL_FLAGS.ENABLE; pub const JOB_OBJECT_NET_RATE_CONTROL_MAX_BANDWIDTH = JOB_OBJECT_NET_RATE_CONTROL_FLAGS.MAX_BANDWIDTH; pub const JOB_OBJECT_NET_RATE_CONTROL_DSCP_TAG = JOB_OBJECT_NET_RATE_CONTROL_FLAGS.DSCP_TAG; pub const JOB_OBJECT_NET_RATE_CONTROL_VALID_FLAGS = JOB_OBJECT_NET_RATE_CONTROL_FLAGS.VALID_FLAGS; pub const JOBOBJECT_NET_RATE_CONTROL_INFORMATION = extern struct { MaxBandwidth: u64, ControlFlags: JOB_OBJECT_NET_RATE_CONTROL_FLAGS, DscpTag: u8, }; pub const JOB_OBJECT_IO_RATE_CONTROL_FLAGS = enum(i32) { ENABLE = 1, STANDALONE_VOLUME = 2, FORCE_UNIT_ACCESS_ALL = 4, FORCE_UNIT_ACCESS_ON_SOFT_CAP = 8, VALID_FLAGS = 15, }; pub const JOB_OBJECT_IO_RATE_CONTROL_ENABLE = JOB_OBJECT_IO_RATE_CONTROL_FLAGS.ENABLE; pub const JOB_OBJECT_IO_RATE_CONTROL_STANDALONE_VOLUME = JOB_OBJECT_IO_RATE_CONTROL_FLAGS.STANDALONE_VOLUME; pub const JOB_OBJECT_IO_RATE_CONTROL_FORCE_UNIT_ACCESS_ALL = JOB_OBJECT_IO_RATE_CONTROL_FLAGS.FORCE_UNIT_ACCESS_ALL; pub const JOB_OBJECT_IO_RATE_CONTROL_FORCE_UNIT_ACCESS_ON_SOFT_CAP = JOB_OBJECT_IO_RATE_CONTROL_FLAGS.FORCE_UNIT_ACCESS_ON_SOFT_CAP; pub const JOB_OBJECT_IO_RATE_CONTROL_VALID_FLAGS = JOB_OBJECT_IO_RATE_CONTROL_FLAGS.VALID_FLAGS; pub const JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE = extern struct { MaxIops: i64, MaxBandwidth: i64, ReservationIops: i64, VolumeName: ?PWSTR, BaseIoSize: u32, ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS, VolumeNameLength: u16, }; pub const JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V2 = extern struct { MaxIops: i64, MaxBandwidth: i64, ReservationIops: i64, VolumeName: ?PWSTR, BaseIoSize: u32, ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS, VolumeNameLength: u16, CriticalReservationIops: i64, ReservationBandwidth: i64, CriticalReservationBandwidth: i64, MaxTimePercent: i64, ReservationTimePercent: i64, CriticalReservationTimePercent: i64, }; pub const JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V3 = extern struct { MaxIops: i64, MaxBandwidth: i64, ReservationIops: i64, VolumeName: ?PWSTR, BaseIoSize: u32, ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS, VolumeNameLength: u16, CriticalReservationIops: i64, ReservationBandwidth: i64, CriticalReservationBandwidth: i64, MaxTimePercent: i64, ReservationTimePercent: i64, CriticalReservationTimePercent: i64, SoftMaxIops: i64, SoftMaxBandwidth: i64, SoftMaxTimePercent: i64, LimitExcessNotifyIops: i64, LimitExcessNotifyBandwidth: i64, LimitExcessNotifyTimePercent: i64, }; pub const JOBOBJECT_IO_ATTRIBUTION_CONTROL_FLAGS = enum(i32) { ENABLE = 1, DISABLE = 2, VALID_FLAGS = 3, }; pub const JOBOBJECT_IO_ATTRIBUTION_CONTROL_ENABLE = JOBOBJECT_IO_ATTRIBUTION_CONTROL_FLAGS.ENABLE; pub const JOBOBJECT_IO_ATTRIBUTION_CONTROL_DISABLE = JOBOBJECT_IO_ATTRIBUTION_CONTROL_FLAGS.DISABLE; pub const JOBOBJECT_IO_ATTRIBUTION_CONTROL_VALID_FLAGS = JOBOBJECT_IO_ATTRIBUTION_CONTROL_FLAGS.VALID_FLAGS; pub const JOBOBJECT_IO_ATTRIBUTION_STATS = extern struct { IoCount: usize, TotalNonOverlappedQueueTime: u64, TotalNonOverlappedServiceTime: u64, TotalSize: u64, }; pub const JOBOBJECT_IO_ATTRIBUTION_INFORMATION = extern struct { ControlFlags: u32, ReadStats: JOBOBJECT_IO_ATTRIBUTION_STATS, WriteStats: JOBOBJECT_IO_ATTRIBUTION_STATS, }; pub const JOBOBJECTINFOCLASS = enum(i32) { JobObjectBasicAccountingInformation = 1, JobObjectBasicLimitInformation = 2, JobObjectBasicProcessIdList = 3, JobObjectBasicUIRestrictions = 4, JobObjectSecurityLimitInformation = 5, JobObjectEndOfJobTimeInformation = 6, JobObjectAssociateCompletionPortInformation = 7, JobObjectBasicAndIoAccountingInformation = 8, JobObjectExtendedLimitInformation = 9, JobObjectJobSetInformation = 10, JobObjectGroupInformation = 11, JobObjectNotificationLimitInformation = 12, JobObjectLimitViolationInformation = 13, JobObjectGroupInformationEx = 14, JobObjectCpuRateControlInformation = 15, JobObjectCompletionFilter = 16, JobObjectCompletionCounter = 17, JobObjectReserved1Information = 18, JobObjectReserved2Information = 19, JobObjectReserved3Information = 20, JobObjectReserved4Information = 21, JobObjectReserved5Information = 22, JobObjectReserved6Information = 23, JobObjectReserved7Information = 24, JobObjectReserved8Information = 25, JobObjectReserved9Information = 26, JobObjectReserved10Information = 27, JobObjectReserved11Information = 28, JobObjectReserved12Information = 29, JobObjectReserved13Information = 30, JobObjectReserved14Information = 31, JobObjectNetRateControlInformation = 32, JobObjectNotificationLimitInformation2 = 33, JobObjectLimitViolationInformation2 = 34, JobObjectCreateSilo = 35, JobObjectSiloBasicInformation = 36, JobObjectReserved15Information = 37, JobObjectReserved16Information = 38, JobObjectReserved17Information = 39, JobObjectReserved18Information = 40, JobObjectReserved19Information = 41, JobObjectReserved20Information = 42, JobObjectReserved21Information = 43, JobObjectReserved22Information = 44, JobObjectReserved23Information = 45, JobObjectReserved24Information = 46, JobObjectReserved25Information = 47, MaxJobObjectInfoClass = 48, }; pub const JobObjectBasicAccountingInformation = JOBOBJECTINFOCLASS.JobObjectBasicAccountingInformation; pub const JobObjectBasicLimitInformation = JOBOBJECTINFOCLASS.JobObjectBasicLimitInformation; pub const JobObjectBasicProcessIdList = JOBOBJECTINFOCLASS.JobObjectBasicProcessIdList; pub const JobObjectBasicUIRestrictions = JOBOBJECTINFOCLASS.JobObjectBasicUIRestrictions; pub const JobObjectSecurityLimitInformation = JOBOBJECTINFOCLASS.JobObjectSecurityLimitInformation; pub const JobObjectEndOfJobTimeInformation = JOBOBJECTINFOCLASS.JobObjectEndOfJobTimeInformation; pub const JobObjectAssociateCompletionPortInformation = JOBOBJECTINFOCLASS.JobObjectAssociateCompletionPortInformation; pub const JobObjectBasicAndIoAccountingInformation = JOBOBJECTINFOCLASS.JobObjectBasicAndIoAccountingInformation; pub const JobObjectExtendedLimitInformation = JOBOBJECTINFOCLASS.JobObjectExtendedLimitInformation; pub const JobObjectJobSetInformation = JOBOBJECTINFOCLASS.JobObjectJobSetInformation; pub const JobObjectGroupInformation = JOBOBJECTINFOCLASS.JobObjectGroupInformation; pub const JobObjectNotificationLimitInformation = JOBOBJECTINFOCLASS.JobObjectNotificationLimitInformation; pub const JobObjectLimitViolationInformation = JOBOBJECTINFOCLASS.JobObjectLimitViolationInformation; pub const JobObjectGroupInformationEx = JOBOBJECTINFOCLASS.JobObjectGroupInformationEx; pub const JobObjectCpuRateControlInformation = JOBOBJECTINFOCLASS.JobObjectCpuRateControlInformation; pub const JobObjectCompletionFilter = JOBOBJECTINFOCLASS.JobObjectCompletionFilter; pub const JobObjectCompletionCounter = JOBOBJECTINFOCLASS.JobObjectCompletionCounter; pub const JobObjectReserved1Information = JOBOBJECTINFOCLASS.JobObjectReserved1Information; pub const JobObjectReserved2Information = JOBOBJECTINFOCLASS.JobObjectReserved2Information; pub const JobObjectReserved3Information = JOBOBJECTINFOCLASS.JobObjectReserved3Information; pub const JobObjectReserved4Information = JOBOBJECTINFOCLASS.JobObjectReserved4Information; pub const JobObjectReserved5Information = JOBOBJECTINFOCLASS.JobObjectReserved5Information; pub const JobObjectReserved6Information = JOBOBJECTINFOCLASS.JobObjectReserved6Information; pub const JobObjectReserved7Information = JOBOBJECTINFOCLASS.JobObjectReserved7Information; pub const JobObjectReserved8Information = JOBOBJECTINFOCLASS.JobObjectReserved8Information; pub const JobObjectReserved9Information = JOBOBJECTINFOCLASS.JobObjectReserved9Information; pub const JobObjectReserved10Information = JOBOBJECTINFOCLASS.JobObjectReserved10Information; pub const JobObjectReserved11Information = JOBOBJECTINFOCLASS.JobObjectReserved11Information; pub const JobObjectReserved12Information = JOBOBJECTINFOCLASS.JobObjectReserved12Information; pub const JobObjectReserved13Information = JOBOBJECTINFOCLASS.JobObjectReserved13Information; pub const JobObjectReserved14Information = JOBOBJECTINFOCLASS.JobObjectReserved14Information; pub const JobObjectNetRateControlInformation = JOBOBJECTINFOCLASS.JobObjectNetRateControlInformation; pub const JobObjectNotificationLimitInformation2 = JOBOBJECTINFOCLASS.JobObjectNotificationLimitInformation2; pub const JobObjectLimitViolationInformation2 = JOBOBJECTINFOCLASS.JobObjectLimitViolationInformation2; pub const JobObjectCreateSilo = JOBOBJECTINFOCLASS.JobObjectCreateSilo; pub const JobObjectSiloBasicInformation = JOBOBJECTINFOCLASS.JobObjectSiloBasicInformation; pub const JobObjectReserved15Information = JOBOBJECTINFOCLASS.JobObjectReserved15Information; pub const JobObjectReserved16Information = JOBOBJECTINFOCLASS.JobObjectReserved16Information; pub const JobObjectReserved17Information = JOBOBJECTINFOCLASS.JobObjectReserved17Information; pub const JobObjectReserved18Information = JOBOBJECTINFOCLASS.JobObjectReserved18Information; pub const JobObjectReserved19Information = JOBOBJECTINFOCLASS.JobObjectReserved19Information; pub const JobObjectReserved20Information = JOBOBJECTINFOCLASS.JobObjectReserved20Information; pub const JobObjectReserved21Information = JOBOBJECTINFOCLASS.JobObjectReserved21Information; pub const JobObjectReserved22Information = JOBOBJECTINFOCLASS.JobObjectReserved22Information; pub const JobObjectReserved23Information = JOBOBJECTINFOCLASS.JobObjectReserved23Information; pub const JobObjectReserved24Information = JOBOBJECTINFOCLASS.JobObjectReserved24Information; pub const JobObjectReserved25Information = JOBOBJECTINFOCLASS.JobObjectReserved25Information; pub const MaxJobObjectInfoClass = JOBOBJECTINFOCLASS.MaxJobObjectInfoClass; //-------------------------------------------------------------------------------- // Section: Functions (14) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn IsProcessInJob( ProcessHandle: ?HANDLE, JobHandle: ?HANDLE, Result: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn CreateJobObjectW( lpJobAttributes: ?*SECURITY_ATTRIBUTES, lpName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "KERNEL32" fn FreeMemoryJobObject( Buffer: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn OpenJobObjectW( dwDesiredAccess: u32, bInheritHandle: BOOL, lpName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn AssignProcessToJobObject( hJob: ?HANDLE, hProcess: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn TerminateJobObject( hJob: ?HANDLE, uExitCode: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn SetInformationJobObject( hJob: ?HANDLE, JobObjectInformationClass: JOBOBJECTINFOCLASS, // TODO: what to do with BytesParamIndex 3? lpJobObjectInformation: ?*anyopaque, cbJobObjectInformationLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "KERNEL32" fn SetIoRateControlInformationJobObject( hJob: ?HANDLE, IoRateControlInfo: ?*JOBOBJECT_IO_RATE_CONTROL_INFORMATION, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn QueryInformationJobObject( hJob: ?HANDLE, JobObjectInformationClass: JOBOBJECTINFOCLASS, // TODO: what to do with BytesParamIndex 3? lpJobObjectInformation: ?*anyopaque, cbJobObjectInformationLength: u32, lpReturnLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "KERNEL32" fn QueryIoRateControlInformationJobObject( hJob: ?HANDLE, VolumeName: ?[*:0]const u16, InfoBlocks: ?*?*JOBOBJECT_IO_RATE_CONTROL_INFORMATION, InfoBlockCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "USER32" fn UserHandleGrantAccess( hUserHandle: ?HANDLE, hJob: ?HANDLE, bGrant: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn CreateJobObjectA( lpJobAttributes: ?*SECURITY_ATTRIBUTES, lpName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn OpenJobObjectA( dwDesiredAccess: u32, bInheritHandle: BOOL, lpName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; pub extern "KERNEL32" fn CreateJobSet( NumJob: u32, UserJobSet: [*]JOB_SET_ARRAY, Flags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (2) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const CreateJobObject = thismodule.CreateJobObjectA; pub const OpenJobObject = thismodule.OpenJobObjectA; }, .wide => struct { pub const CreateJobObject = thismodule.CreateJobObjectW; pub const OpenJobObject = thismodule.OpenJobObjectW; }, .unspecified => if (@import("builtin").is_test) struct { pub const CreateJobObject = *opaque{}; pub const OpenJobObject = *opaque{}; } else struct { pub const CreateJobObject = @compileError("'CreateJobObject' requires that UNICODE be set to true or false in the root module"); pub const OpenJobObject = @compileError("'OpenJobObject' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (9) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const HANDLE = @import("../foundation.zig").HANDLE; const IO_COUNTERS = @import("../system/threading.zig").IO_COUNTERS; const LARGE_INTEGER = @import("../foundation.zig").LARGE_INTEGER; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const SECURITY_ATTRIBUTES = @import("../security.zig").SECURITY_ATTRIBUTES; const TOKEN_GROUPS = @import("../security.zig").TOKEN_GROUPS; const TOKEN_PRIVILEGES = @import("../security.zig").TOKEN_PRIVILEGES; 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/job_objects.zig
// TODO: implement Op as a Redis.Arguments? pub const BITOP = struct { //! ``` //! const cmd = BITOP.init(.AND, "result", &[_][]const u8{ "key1", "key2" }); //! ``` operation: Op, destKey: []const u8, sourceKeys: []const []const u8, pub fn init(operation: Op, destKey: []const u8, sourceKeys: []const []const u8) BITOP { return .{ .operation = operation, .destKey = destKey, .sourceKeys = sourceKeys }; } pub fn validate(self: BITOP) !void { if (self.key.len == 0) return error.EmptyKeyName; if (self.value.len == 0) return error.EmptyValue; } pub const RedisCommand = struct { pub fn serialize(self: BITOP, comptime rootSerializer: type, msg: anytype) !void { const op = switch (self.operation) { .AND => "AND", .OR => "OR", .XOR => "XOR", .NOT => "NOT", }; return rootSerializer.serializeCommand(msg, .{ "BITOP", op, self.destKey, self.sourceKeys }); } }; pub const Op = enum { AND, OR, XOR, NOT, }; }; test "basic usage" { const cmd = BITOP.init(.AND, "result", &[_][]const u8{ "key1", "key2" }); } test "serializer" { const std = @import("std"); const serializer = @import("../../serializer.zig").CommandSerializer; var correctBuf: [1000]u8 = undefined; var correctMsg = std.io.fixedBufferStream(correctBuf[0..]); var testBuf: [1000]u8 = undefined; var testMsg = std.io.fixedBufferStream(testBuf[0..]); { correctMsg.reset(); testMsg.reset(); try serializer.serializeCommand( testMsg.outStream(), BITOP.init(.AND, "mykey", &[_][]const u8{ "key1", "key2" }), ); try serializer.serializeCommand( correctMsg.outStream(), .{ "BITOP", "AND", "mykey", "key1", "key2" }, ); std.testing.expectEqualSlices(u8, correctMsg.getWritten(), testMsg.getWritten()); } }
src/commands/strings/bitop.zig
const builtin = @import("builtin"); const std = @import("std"); const expect = std.testing.expect; const expectEqualStrings = std.testing.expectEqualStrings; const expectStringStartsWith = std.testing.expectStringStartsWith; // 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. test "anon fn param" { if (builtin.zig_backend == .stage1) { // stage1 uses line/column for the names but we're moving away from that for // incremental compilation purposes. return error.SkipZigTest; } if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO // https://github.com/ziglang/zig/issues/9339 try expectEqualStringsIgnoreDigits( "behavior.typename.TypeFromFn(behavior.typename.test.anon fn param__struct_0)", @typeName(TypeFromFn(struct {})), ); try expectEqualStringsIgnoreDigits( "behavior.typename.TypeFromFn(behavior.typename.test.anon fn param__union_0)", @typeName(TypeFromFn(union { unused: u8 })), ); try expectEqualStringsIgnoreDigits( "behavior.typename.TypeFromFn(behavior.typename.test.anon fn param__enum_0)", @typeName(TypeFromFn(enum { unused })), ); try expectEqualStringsIgnoreDigits( "behavior.typename.TypeFromFnB(behavior.typename.test.anon fn param__struct_0,behavior.typename.test.anon fn param__union_0,behavior.typename.test.anon fn param__enum_0)", @typeName(TypeFromFnB(struct {}, union { unused: u8 }, enum { unused })), ); } test "anon field init" { if (builtin.zig_backend == .stage1) { // stage1 uses line/column for the names but we're moving away from that for // incremental compilation purposes. return error.SkipZigTest; } if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO const Foo = .{ .T1 = struct {}, .T2 = union { unused: u8 }, .T3 = enum { unused }, }; try expectEqualStringsIgnoreDigits( "behavior.typename.test.anon field init__struct_0", @typeName(Foo.T1), ); try expectEqualStringsIgnoreDigits( "behavior.typename.test.anon field init__union_0", @typeName(Foo.T2), ); try expectEqualStringsIgnoreDigits( "behavior.typename.test.anon field init__enum_0", @typeName(Foo.T3), ); } test "basic" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO try expectEqualStrings(@typeName(i64), "i64"); try expectEqualStrings(@typeName(*usize), "*usize"); try expectEqualStrings(@typeName([]u8), "[]u8"); } test "top level decl" { if (builtin.zig_backend == .stage1) { // stage1 fails to return fully qualified namespaces. return error.SkipZigTest; } if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO try expectEqualStrings( "behavior.typename.A_Struct", @typeName(A_Struct), ); try expectEqualStrings( "behavior.typename.A_Union", @typeName(A_Union), ); try expectEqualStrings( "behavior.typename.A_Enum", @typeName(A_Enum), ); // regular fn, without error try expectEqualStrings( "fn() void", @typeName(@TypeOf(regular)), ); // regular fn inside struct, with error try expectEqualStrings( "fn() @typeInfo(@typeInfo(@TypeOf(behavior.typename.B.doTest)).Fn.return_type.?).ErrorUnion.error_set!void", @typeName(@TypeOf(B.doTest)), ); // generic fn try expectEqualStrings( "fn(type) type", @typeName(@TypeOf(TypeFromFn)), ); } const A_Struct = struct {}; const A_Union = union { unused: u8, }; const A_Enum = enum { unused, }; fn regular() void {} test "fn body decl" { if (builtin.zig_backend == .stage1) { // stage1 fails to return fully qualified namespaces. return error.SkipZigTest; } if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO 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 expectEqualStringsIgnoreDigits( "behavior.typename.B.doTest__struct_0", @typeName(B_Struct), ); try expectEqualStringsIgnoreDigits( "behavior.typename.B.doTest__union_0", @typeName(B_Union), ); try expectEqualStringsIgnoreDigits( "behavior.typename.B.doTest__enum_0", @typeName(B_Enum), ); } }; test "fn param" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO // https://github.com/ziglang/zig/issues/675 try expectEqualStrings( "behavior.typename.TypeFromFn(u8)", @typeName(TypeFromFn(u8)), ); try expectEqualStrings( "behavior.typename.TypeFromFn(behavior.typename.A_Struct)", @typeName(TypeFromFn(A_Struct)), ); try expectEqualStrings( "behavior.typename.TypeFromFn(behavior.typename.A_Union)", @typeName(TypeFromFn(A_Union)), ); try expectEqualStrings( "behavior.typename.TypeFromFn(behavior.typename.A_Enum)", @typeName(TypeFromFn(A_Enum)), ); try expectEqualStrings( "behavior.typename.TypeFromFn2(u8,bool)", @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 TypeFromFnB(comptime T1: type, comptime T2: type, comptime T3: type) type { _ = T1; _ = T2; _ = T3; return struct {}; } /// Replaces integers in `actual` with '0' before doing the test. pub fn expectEqualStringsIgnoreDigits(expected: []const u8, actual: []const u8) !void { var actual_buf: [1024]u8 = undefined; var actual_i: usize = 0; var last_digit = false; for (actual) |byte| { switch (byte) { '0'...'9' => { if (last_digit) continue; last_digit = true; actual_buf[actual_i] = '0'; actual_i += 1; }, else => { last_digit = false; actual_buf[actual_i] = byte; actual_i += 1; }, } } return expectEqualStrings(expected, actual_buf[0..actual_i]); }
test/behavior/typename.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) == 0x1000); expect(x.len == 0x500); expect(@ptrToInt(y) == 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); } test "C pointer slice access" { var buf: [10]u32 = [1]u32{42} ** 10; const c_ptr = @ptrCast([*c]const u32, &buf); var runtime_zero: usize = 0; comptime expectEqual([]const u32, @TypeOf(c_ptr[runtime_zero..1])); comptime expectEqual(*const [1]u32, @TypeOf(c_ptr[0..1])); for (c_ptr[0..5]) |*cl| { expectEqual(@as(u32, 42), cl.*); } } 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]) == *[2]u8); var runtime_zero: usize = 0; comptime expect(@TypeOf(ptr2[runtime_zero..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 "@ptrCast slice to pointer" { const S = struct { fn doTheTest() void { var array align(@alignOf(u16)) = [5]u8{ 0xff, 0xff, 0xff, 0xff, 0xff }; var slice: []u8 = &array; var ptr = @ptrCast(*u16, slice); expect(ptr.* == 65535); } }; S.doTheTest(); comptime S.doTheTest(); } test "slice syntax resulting in pointer-to-array" { const S = struct { fn doTheTest() void { testArray(); testArrayZ(); testArray0(); testArrayAlign(); testPointer(); testPointerZ(); testPointer0(); testPointerAlign(); testSlice(); testSliceZ(); testSlice0(); testSliceOpt(); testSliceAlign(); } fn testArray() void { var array = [5]u8{ 1, 2, 3, 4, 5 }; var slice = array[1..3]; comptime expect(@TypeOf(slice) == *[2]u8); expect(slice[0] == 2); expect(slice[1] == 3); } fn testArrayZ() void { var array = [5:0]u8{ 1, 2, 3, 4, 5 }; comptime expect(@TypeOf(array[1..3]) == *[2]u8); comptime expect(@TypeOf(array[1..5]) == *[4:0]u8); comptime expect(@TypeOf(array[1..]) == *[4:0]u8); comptime expect(@TypeOf(array[1..3 :4]) == *[2:4]u8); } fn testArray0() void { { var array = [0]u8{}; var slice = array[0..0]; comptime expect(@TypeOf(slice) == *[0]u8); } { var array = [0:0]u8{}; var slice = array[0..0]; comptime expect(@TypeOf(slice) == *[0:0]u8); expect(slice[0] == 0); } } fn testArrayAlign() void { var array align(4) = [5]u8{ 1, 2, 3, 4, 5 }; var slice = array[4..5]; comptime expect(@TypeOf(slice) == *align(4) [1]u8); expect(slice[0] == 5); comptime expect(@TypeOf(array[0..2]) == *align(4) [2]u8); } fn testPointer() void { var array = [5]u8{ 1, 2, 3, 4, 5 }; var pointer: [*]u8 = &array; var slice = pointer[1..3]; comptime expect(@TypeOf(slice) == *[2]u8); expect(slice[0] == 2); expect(slice[1] == 3); } fn testPointerZ() void { var array = [5:0]u8{ 1, 2, 3, 4, 5 }; var pointer: [*:0]u8 = &array; comptime expect(@TypeOf(pointer[1..3]) == *[2]u8); comptime expect(@TypeOf(pointer[1..3 :4]) == *[2:4]u8); } fn testPointer0() void { var pointer: [*]const u0 = &[1]u0{0}; var slice = pointer[0..1]; comptime expect(@TypeOf(slice) == *const [1]u0); expect(slice[0] == 0); } fn testPointerAlign() void { var array align(4) = [5]u8{ 1, 2, 3, 4, 5 }; var pointer: [*]align(4) u8 = &array; var slice = pointer[4..5]; comptime expect(@TypeOf(slice) == *align(4) [1]u8); expect(slice[0] == 5); comptime expect(@TypeOf(pointer[0..2]) == *align(4) [2]u8); } fn testSlice() void { var array = [5]u8{ 1, 2, 3, 4, 5 }; var src_slice: []u8 = &array; var slice = src_slice[1..3]; comptime expect(@TypeOf(slice) == *[2]u8); expect(slice[0] == 2); expect(slice[1] == 3); } fn testSliceZ() void { var array = [5:0]u8{ 1, 2, 3, 4, 5 }; var slice: [:0]u8 = &array; comptime expect(@TypeOf(slice[1..3]) == *[2]u8); comptime expect(@TypeOf(slice[1..]) == [:0]u8); comptime expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8); } fn testSliceOpt() void { var array: [2]u8 = [2]u8{ 1, 2 }; var slice: ?[]u8 = &array; comptime expect(@TypeOf(&array, slice) == ?[]u8); comptime expect(@TypeOf(slice.?[0..2]) == *[2]u8); } fn testSlice0() void { { var array = [0]u8{}; var src_slice: []u8 = &array; var slice = src_slice[0..0]; comptime expect(@TypeOf(slice) == *[0]u8); } { var array = [0:0]u8{}; var src_slice: [:0]u8 = &array; var slice = src_slice[0..0]; comptime expect(@TypeOf(slice) == *[0]u8); } } fn testSliceAlign() void { var array align(4) = [5]u8{ 1, 2, 3, 4, 5 }; var src_slice: []align(4) u8 = &array; var slice = src_slice[4..5]; comptime expect(@TypeOf(slice) == *align(4) [1]u8); expect(slice[0] == 5); comptime expect(@TypeOf(src_slice[0..2]) == *align(4) [2]u8); } fn testConcatStrLiterals() void { expectEqualSlices("a"[0..] ++ "b"[0..], "ab"); expectEqualSlices("a"[0..:0] ++ "b"[0..:0], "ab"); } }; S.doTheTest(); comptime S.doTheTest(); } test "slice of hardcoded address to pointer" { const S = struct { fn doTheTest() void { const pointer = @intToPtr([*]u8, 0x04)[0..2]; comptime expect(@TypeOf(pointer) == *[2]u8); const slice: []const u8 = pointer; expect(@ptrToInt(slice.ptr) == 4); expect(slice.len == 2); } }; S.doTheTest(); } test "type coercion of pointer to anon struct literal to pointer to slice" { const S = struct { const U = union{ a: u32, b: bool, c: []const u8, }; fn doTheTest() void { var x1: u8 = 42; const t1 = &.{ x1, 56, 54 }; var slice1: []const u8 = t1; expect(slice1.len == 3); expect(slice1[0] == 42); expect(slice1[1] == 56); expect(slice1[2] == 54); var x2: []const u8 = "hello"; const t2 = &.{ x2, ", ", "world!" }; // @compileLog(@TypeOf(t2)); var slice2: []const []const u8 = t2; expect(slice2.len == 3); expect(mem.eql(u8, slice2[0], "hello")); expect(mem.eql(u8, slice2[1], ", ")); expect(mem.eql(u8, slice2[2], "world!")); } }; // S.doTheTest(); comptime S.doTheTest(); }
test/stage1/behavior/slice.zig
const std = @import("std"); pub const NodeValue = union(enum) { integer: i32, string: []const u8, fn fromToken(token: Token) ?NodeValue { if (token.value) |value| { switch (value) { .integer => |int| return NodeValue{ .integer = int }, .string => |str| return NodeValue{ .string = str }, } } else { return null; } } }; pub const Tree = struct { left: ?*Tree, right: ?*Tree, typ: NodeType, value: ?NodeValue = null, }; pub const ParserError = error{ OutOfMemory, ExpectedNotFound, } || std.fmt.ParseIntError; pub const Parser = struct { token_it: LexerOutputTokenizer, curr: Token, allocator: std.mem.Allocator, const Self = @This(); pub fn init(allocator: std.mem.Allocator, str: []const u8) Self { return Self{ .token_it = LexerOutputTokenizer.init(str), .curr = Token{ .line = 0, .col = 0, .typ = .unknown }, .allocator = allocator, }; } fn makeNode(self: *Self, typ: NodeType, left: ?*Tree, right: ?*Tree) !*Tree { const result = try self.allocator.create(Tree); result.* = Tree{ .left = left, .right = right, .typ = typ }; return result; } fn makeLeaf(self: *Self, typ: NodeType, value: ?NodeValue) !*Tree { const result = try self.allocator.create(Tree); result.* = Tree{ .left = null, .right = null, .typ = typ, .value = value }; return result; } pub fn parse(self: *Self) ParserError!?*Tree { try self.next(); var result: ?*Tree = null; while (true) { const stmt = try self.parseStmt(); result = try self.makeNode(.sequence, result, stmt); if (self.curr.typ == .eof) break; } return result; } /// Classic "Recursive descent" statement parser. fn parseStmt(self: *Self) ParserError!?*Tree { var result: ?*Tree = null; switch (self.curr.typ) { .kw_print => { try self.next(); try self.expect(.left_paren); // Parse each print's argument as an expression delimited by commas until we reach // a closing parens. while (true) { var expr: ?*Tree = null; if (self.curr.typ == .string) { expr = try self.makeNode( .prts, try self.makeLeaf(.string, NodeValue.fromToken(self.curr)), null, ); try self.next(); } else { expr = try self.makeNode(.prti, try self.parseExpr(0), null); } result = try self.makeNode(.sequence, result, expr); if (self.curr.typ != .comma) break; try self.next(); } try self.expect(.right_paren); try self.expect(.semicolon); }, .kw_putc => { try self.next(); result = try self.makeNode(.prtc, try self.parseParenExpr(), null); try self.expect(.semicolon); }, .kw_while => { try self.next(); const expr = try self.parseParenExpr(); result = try self.makeNode(.kw_while, expr, try self.parseStmt()); }, .kw_if => { try self.next(); const expr = try self.parseParenExpr(); const if_stmt = try self.parseStmt(); const else_stmt = blk: { if (self.curr.typ == .kw_else) { try self.next(); break :blk try self.parseStmt(); } else { break :blk null; } }; const stmt_node = try self.makeNode(.kw_if, if_stmt, else_stmt); // If-statement uses `.kw_if` node for both first node with `expr` on the left // and statements on the right and also `.kw_if` node which goes to the right // and contains both if-branch and else-branch. result = try self.makeNode(.kw_if, expr, stmt_node); }, .left_brace => { try self.next(); while (self.curr.typ != .right_brace and self.curr.typ != .eof) { result = try self.makeNode(.sequence, result, try self.parseStmt()); } try self.expect(.right_brace); }, .identifier => { const identifer = try self.makeLeaf(.identifier, NodeValue.fromToken(self.curr)); try self.next(); try self.expect(.assign); const expr = try self.parseExpr(0); result = try self.makeNode(.assign, identifer, expr); try self.expect(.semicolon); }, .semicolon => try self.next(), else => { std.debug.print("\nSTMT: UNKNOWN {}\n", .{self.curr}); std.os.exit(1); }, } return result; } /// "Precedence climbing" expression parser. fn parseExpr(self: *Self, precedence: i8) ParserError!?*Tree { var result: ?*Tree = null; switch (self.curr.typ) { .left_paren => { result = try self.parseParenExpr(); }, .subtract => { try self.next(); const metadata = NodeMetadata.find(.negate); const expr = try self.parseExpr(metadata.precedence); result = try self.makeNode(.negate, expr, null); }, .not => { try self.next(); const metadata = NodeMetadata.find(.not); const expr = try self.parseExpr(metadata.precedence); result = try self.makeNode(.not, expr, null); }, .add => { try self.next(); result = try self.parseExpr(precedence); }, .integer, .identifier => { const node_type = NodeMetadata.find(self.curr.typ).node_type; result = try self.makeLeaf(node_type, NodeValue.fromToken(self.curr)); try self.next(); }, else => { std.debug.print("\nEXPR: UNKNOWN {}\n", .{self.curr}); std.os.exit(1); }, } var curr_metadata = NodeMetadata.find(self.curr.typ); while (curr_metadata.binary and curr_metadata.precedence >= precedence) { const new_precedence = if (curr_metadata.right_associative) curr_metadata.precedence else curr_metadata.precedence + 1; try self.next(); const sub_expr = try self.parseExpr(new_precedence); result = try self.makeNode(curr_metadata.node_type, result, sub_expr); curr_metadata = NodeMetadata.find(self.curr.typ); } return result; } fn parseParenExpr(self: *Self) ParserError!?*Tree { try self.expect(.left_paren); const result = try self.parseExpr(0); try self.expect(.right_paren); return result; } fn next(self: *Self) ParserError!void { const token = try self.token_it.next(); if (token) |tok| { self.curr = tok; } else { self.curr = Token{ .line = 0, .col = 0, .typ = .unknown }; } } fn expect(self: *Self, token_type: TokenType) ParserError!void { if (self.curr.typ != token_type) { const expected_str = NodeMetadata.find(token_type).token_str; const found_str = NodeMetadata.find(self.curr.typ).token_str; std.debug.print( "({d}, {d}) error: Expecting '{s}', found '{s}'\n", .{ self.curr.line, self.curr.col, expected_str, found_str }, ); return ParserError.ExpectedNotFound; } try self.next(); } }; pub fn parse(allocator: std.mem.Allocator, str: []const u8) !?*Tree { var parser = Parser.init(allocator, str); return try parser.parse(); } pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); var arg_it = std.process.args(); _ = try arg_it.next(allocator) orelse unreachable; // program name const file_name = arg_it.next(allocator); // We accept both files and standard input. var file_handle = blk: { if (file_name) |file_name_delimited| { const fname: []const u8 = try file_name_delimited; break :blk try std.fs.cwd().openFile(fname, .{}); } else { break :blk std.io.getStdIn(); } }; defer file_handle.close(); const input_content = try file_handle.readToEndAlloc(allocator, std.math.maxInt(usize)); const result: ?*Tree = try parse(allocator, input_content); const result_str = try astToFlattenedString(allocator, result); _ = try std.io.getStdOut().write(result_str); } const NodeMetadata = struct { token_type: TokenType, right_associative: bool, binary: bool, unary: bool, precedence: i8, node_type: NodeType, token_str: []const u8, const self = [_]NodeMetadata{ .{ .token_type = .multiply, .right_associative = false, .binary = true, .unary = false, .precedence = 13, .node_type = .multiply, .token_str = "*" }, .{ .token_type = .divide, .right_associative = false, .binary = true, .unary = false, .precedence = 13, .node_type = .divide, .token_str = "/" }, .{ .token_type = .mod, .right_associative = false, .binary = true, .unary = false, .precedence = 13, .node_type = .mod, .token_str = "%" }, .{ .token_type = .add, .right_associative = false, .binary = true, .unary = false, .precedence = 12, .node_type = .add, .token_str = "+" }, .{ .token_type = .subtract, .right_associative = false, .binary = true, .unary = false, .precedence = 12, .node_type = .subtract, .token_str = "-" }, .{ .token_type = .negate, .right_associative = false, .binary = false, .unary = true, .precedence = 14, .node_type = .negate, .token_str = "-" }, .{ .token_type = .less, .right_associative = false, .binary = true, .unary = false, .precedence = 10, .node_type = .less, .token_str = "<" }, .{ .token_type = .less_equal, .right_associative = false, .binary = true, .unary = false, .precedence = 10, .node_type = .less_equal, .token_str = "<=" }, .{ .token_type = .greater, .right_associative = false, .binary = true, .unary = false, .precedence = 10, .node_type = .greater, .token_str = ">" }, .{ .token_type = .greater_equal, .right_associative = false, .binary = true, .unary = false, .precedence = 10, .node_type = .greater_equal, .token_str = ">=" }, .{ .token_type = .equal, .right_associative = false, .binary = true, .unary = false, .precedence = 9, .node_type = .equal, .token_str = "=" }, .{ .token_type = .not_equal, .right_associative = false, .binary = true, .unary = false, .precedence = 9, .node_type = .not_equal, .token_str = "!=" }, .{ .token_type = .not, .right_associative = false, .binary = false, .unary = true, .precedence = 14, .node_type = .not, .token_str = "!" }, .{ .token_type = .assign, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .assign, .token_str = "=" }, .{ .token_type = .bool_and, .right_associative = false, .binary = true, .unary = false, .precedence = 5, .node_type = .bool_and, .token_str = "&&" }, .{ .token_type = .bool_or, .right_associative = false, .binary = true, .unary = false, .precedence = 4, .node_type = .bool_or, .token_str = "||" }, .{ .token_type = .left_paren, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = "(" }, .{ .token_type = .right_paren, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = ")" }, .{ .token_type = .left_brace, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = "{" }, .{ .token_type = .right_brace, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = "}" }, .{ .token_type = .semicolon, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = ";" }, .{ .token_type = .comma, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = "," }, .{ .token_type = .kw_if, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .kw_if, .token_str = "if" }, .{ .token_type = .kw_else, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = "else" }, .{ .token_type = .kw_while, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .kw_while, .token_str = "while" }, .{ .token_type = .kw_print, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = "print" }, .{ .token_type = .kw_putc, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = "putc" }, .{ .token_type = .identifier, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .identifier, .token_str = "Identifier" }, .{ .token_type = .integer, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .integer, .token_str = "Integer literal" }, .{ .token_type = .string, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .string, .token_str = "String literal" }, .{ .token_type = .eof, .right_associative = false, .binary = false, .unary = false, .precedence = -1, .node_type = .unknown, .token_str = "End of line" }, }; pub fn find(token_type: TokenType) NodeMetadata { for (self) |metadata| { if (metadata.token_type == token_type) return metadata; } else { unreachable; } } }; pub const NodeType = enum { unknown, identifier, string, integer, sequence, kw_if, prtc, prts, prti, kw_while, assign, negate, not, multiply, divide, mod, add, subtract, less, less_equal, greater, greater_equal, equal, not_equal, bool_and, bool_or, pub fn toString(self: NodeType) []const u8 { return switch (self) { .unknown => "UNKNOWN", .identifier => "Identifier", .string => "String", .integer => "Integer", .sequence => "Sequence", .kw_if => "If", .prtc => "Prtc", .prts => "Prts", .prti => "Prti", .kw_while => "While", .assign => "Assign", .negate => "Negate", .not => "Not", .multiply => "Multiply", .divide => "Divide", .mod => "Mod", .add => "Add", .subtract => "Subtract", .less => "Less", .less_equal => "LessEqual", .greater => "Greater", .greater_equal => "GreaterEqual", .equal => "Equal", .not_equal => "NotEqual", .bool_and => "And", .bool_or => "Or", }; } }; fn astToFlattenedString(allocator: std.mem.Allocator, tree: ?*Tree) ![]const u8 { var result = std.ArrayList(u8).init(allocator); var writer = result.writer(); try treeToString(allocator, writer, tree); return result.items; } pub const TokenType = enum { unknown, multiply, divide, mod, add, subtract, negate, less, less_equal, greater, greater_equal, equal, not_equal, not, assign, bool_and, bool_or, left_paren, right_paren, left_brace, right_brace, semicolon, comma, kw_if, kw_else, kw_while, kw_print, kw_putc, identifier, integer, string, eof, const from_string_map = std.ComptimeStringMap(TokenType, .{ .{ "Op_multiply", .multiply }, .{ "Op_divide", .divide }, .{ "Op_mod", .mod }, .{ "Op_add", .add }, .{ "Op_subtract", .subtract }, .{ "Op_negate", .negate }, .{ "Op_less", .less }, .{ "Op_lessequal", .less_equal }, .{ "Op_greater", .greater }, .{ "Op_greaterequal", .greater_equal }, .{ "Op_equal", .equal }, .{ "Op_notequal", .not_equal }, .{ "Op_not", .not }, .{ "Op_assign", .assign }, .{ "Op_and", .bool_and }, .{ "Op_or", .bool_or }, .{ "LeftParen", .left_paren }, .{ "RightParen", .right_paren }, .{ "LeftBrace", .left_brace }, .{ "RightBrace", .right_brace }, .{ "Semicolon", .semicolon }, .{ "Comma", .comma }, .{ "Keyword_if", .kw_if }, .{ "Keyword_else", .kw_else }, .{ "Keyword_while", .kw_while }, .{ "Keyword_print", .kw_print }, .{ "Keyword_putc", .kw_putc }, .{ "Identifier", .identifier }, .{ "Integer", .integer }, .{ "String", .string }, .{ "End_of_input", .eof }, }); pub fn fromString(str: []const u8) TokenType { return from_string_map.get(str).?; } }; pub const TokenValue = union(enum) { integer: i32, string: []const u8, }; pub const Token = struct { line: usize, col: usize, typ: TokenType = .unknown, value: ?TokenValue = null, }; const TreeToStringError = error{OutOfMemory}; fn treeToString( allocator: std.mem.Allocator, writer: std.ArrayList(u8).Writer, tree: ?*Tree, ) TreeToStringError!void { if (tree) |t| { _ = try writer.write(try std.fmt.allocPrint( allocator, "{s}", .{t.typ.toString()}, )); switch (t.typ) { .string, .identifier => _ = try writer.write(try std.fmt.allocPrint( allocator, " {s}\n", .{t.value.?.string}, )), .integer => _ = try writer.write(try std.fmt.allocPrint( allocator, " {d}\n", .{t.value.?.integer}, )), else => { _ = try writer.write(try std.fmt.allocPrint( allocator, "\n", .{}, )); try treeToString(allocator, writer, t.left); try treeToString(allocator, writer, t.right); }, } } else { _ = try writer.write(try std.fmt.allocPrint( allocator, ";\n", .{}, )); } } pub const LexerOutputTokenizer = struct { it: std.mem.SplitIterator(u8), const Self = @This(); pub fn init(str: []const u8) Self { return Self{ .it = std.mem.split(u8, str, "\n") }; } pub fn next(self: *Self) std.fmt.ParseIntError!?Token { if (self.it.next()) |line| { if (line.len == 0) return null; var tokens_it = std.mem.tokenize(u8, line, " "); const lineNumber = try std.fmt.parseInt(usize, tokens_it.next().?, 10); const colNumber = try std.fmt.parseInt(usize, tokens_it.next().?, 10); const typ_text = tokens_it.next().?; const typ = TokenType.fromString(typ_text); const pre_value_index = tokens_it.index; const value = tokens_it.next(); var token = Token{ .line = lineNumber, .col = colNumber, .typ = typ }; if (value) |val| { const token_value = blk: { switch (typ) { .string, .identifier => { tokens_it.index = pre_value_index; break :blk TokenValue{ .string = tokens_it.rest() }; }, .integer => break :blk TokenValue{ .integer = try std.fmt.parseInt(i32, val, 10) }, else => unreachable, } }; token.value = token_value; } return token; } else { return null; } } }; fn stringToTokenList(allocator: std.mem.Allocator, str: []const u8) !std.ArrayList(Token) { var result = std.ArrayList(Token).init(allocator); var lexer_output_it = LexerOutputTokenizer.init(str); while (try lexer_output_it.next()) |token| { try result.append(token); } return result; } const testing = std.testing; test "stringToTokenList" { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); const str: []const u8 = "\"Hello, World!\\n\""; const tok_array = [6]Token{ Token{ .line = 4, .col = 1, .typ = .kw_print }, Token{ .line = 4, .col = 6, .typ = .left_paren }, Token{ .line = 4, .col = 7, .typ = .string, .value = TokenValue{ .string = str } }, Token{ .line = 4, .col = 24, .typ = .right_paren }, Token{ .line = 4, .col = 25, .typ = .semicolon }, Token{ .line = 5, .col = 1, .typ = .eof }, }; var token_list = std.ArrayList(Token).init(allocator); (try token_list.addManyAsArray(6)).* = tok_array; const string = \\ 4 1 Keyword_print \\ 4 6 LeftParen \\ 4 7 String "Hello, World!\n" \\ 4 24 RightParen \\ 4 25 Semicolon \\ 5 1 End_of_input \\ ; const result = try stringToTokenList(allocator, string); try testing.expectEqual(token_list.items.len, result.items.len); try testing.expectEqual(token_list.items[0], result.items[0]); try testing.expectEqual(token_list.items[1], result.items[1]); try testing.expectEqual(token_list.items[2].line, result.items[2].line); try testing.expectEqual(token_list.items[2].col, result.items[2].col); try testing.expectEqual(token_list.items[2].typ, result.items[2].typ); try testing.expectEqualSlices(u8, token_list.items[2].value.?.string, result.items[2].value.?.string); try testing.expectEqual(token_list.items[3], result.items[3]); try testing.expectEqual(token_list.items[4], result.items[4]); try testing.expectEqual(token_list.items[5], result.items[5]); } fn squishSpaces(allocator: std.mem.Allocator, str: []const u8) ![]u8 { var result = std.ArrayList(u8).init(allocator); var was_space = false; for (str) |ch| { switch (ch) { ' ' => { if (!was_space) { was_space = true; try result.append(ch); } }, else => { was_space = false; try result.append(ch); }, } } return result.items; } test "examples" { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); { const example_input_path = "examples/lexed0.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed0.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed1.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed1.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed2.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const ast = parse(allocator, content_input); try testing.expectError(ParserError.ExpectedNotFound, ast); } { const example_input_path = "examples/lexed3.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed3.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed4.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed4.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed5.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed5.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed6.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed6.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed7.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed7.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed8.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed8.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed9.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed9.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed10.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed10.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed11.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed11.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed12.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed12.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed13.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed13.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } { const example_input_path = "examples/lexed14.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/parsed14.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); const ast = try parse(allocator, content_input); const pretty_output = try astToFlattenedString(allocator, ast); const stripped_expected = try squishSpaces(allocator, content_output); const stripped_result = try squishSpaces(allocator, pretty_output); try testing.expectFmt(stripped_expected, "{s}", .{stripped_result}); } }
parser.zig
const std = @import("std"); const BoolMap = enum(u8) { auto_left_margin = 0, auto_right_margin = 1, no_esc_ctlc = 2, ceol_standout_glitch = 3, eat_newline_glitch = 4, erase_overstrike = 5, generic_type = 6, hard_copy = 7, has_meta_key = 8, has_status_line = 9, insert_null_glitch = 10, memory_above = 11, memory_below = 12, move_insert_mode = 13, move_standout_mode = 14, over_strike = 15, status_line_esc_ok = 16, dest_tabs_magic_smso = 17, tilde_glitch = 18, transparent_underline = 19, xon_xoff = 20, needs_xon_xoff = 21, prtr_silent = 22, hard_cursor = 23, non_rev_rmcup = 24, no_pad_char = 25, non_dest_scroll_region = 26, can_change = 27, back_color_erase = 28, hue_lightness_saturation = 29, col_addr_glitch = 30, cr_cancels_micro_mode = 31, has_print_wheel = 32, row_addr_glitch = 33, semi_auto_right_margin = 34, cpi_changes_res = 35, lpi_changes_res = 36, }; const NumberMap = enum(u8) { columns = 0, init_tabs = 1, lines = 2, lines_of_memory = 3, magic_cookie_glitch = 4, padding_baud_rate = 5, virtual_terminal = 6, width_status_line = 7, num_labels = 8, label_height = 9, label_width = 10, max_attributes = 11, maximum_windows = 12, max_colors = 13, max_pairs = 14, no_color_video = 15, buffer_capacity = 16, dot_vert_spacing = 17, dot_horz_spacing = 18, max_micro_address = 19, max_micro_jump = 20, micro_col_size = 21, micro_line_size = 22, number_of_pins = 23, output_res_char = 24, output_res_line = 25, output_res_horz_inch = 26, output_res_vert_inch = 27, print_rate = 28, wide_char_size = 29, buttons = 30, bit_image_entwining = 31, bit_image_type = 32, }; const StringMap = enum(u16) { back_tab = 0, bell = 1, carriage_return = 2, change_scroll_region = 3, clear_all_tabs = 4, clear_screen = 5, clr_eol = 6, clr_eos = 7, column_address = 8, command_character = 9, cursor_address = 10, cursor_down = 11, cursor_home = 12, cursor_invisible = 13, cursor_left = 14, cursor_mem_address = 15, cursor_normal = 16, cursor_right = 17, cursor_to_ll = 18, cursor_up = 19, cursor_visible = 20, delete_character = 21, delete_line = 22, dis_status_line = 23, down_half_line = 24, enter_alt_charset_mode = 25, enter_blink_mode = 26, enter_bold_mode = 27, enter_ca_mode = 28, enter_delete_mode = 29, enter_dim_mode = 30, enter_insert_mode = 31, enter_secure_mode = 32, enter_protected_mode = 33, enter_reverse_mode = 34, enter_standout_mode = 35, enter_underline_mode = 36, erase_chars = 37, exit_alt_charset_mode = 38, exit_attribute_mode = 39, exit_ca_mode = 40, exit_delete_mode = 41, exit_insert_mode = 42, exit_standout_mode = 43, exit_underline_mode = 44, flash_screen = 45, form_feed = 46, from_status_line = 47, init_1string = 48, init_2string = 49, init_3string = 50, init_file = 51, insert_character = 52, insert_line = 53, insert_padding = 54, key_backspace = 55, key_catab = 56, key_clear = 57, key_ctab = 58, key_dc = 59, key_dl = 60, key_down = 61, key_eic = 62, key_eol = 63, key_eos = 64, key_f0 = 65, key_f1 = 66, key_f10 = 67, key_f2 = 68, key_f3 = 69, key_f4 = 70, key_f5 = 71, key_f6 = 72, key_f7 = 73, key_f8 = 74, key_f9 = 75, key_home = 76, key_ic = 77, key_il = 78, key_left = 79, key_ll = 80, key_npage = 81, key_ppage = 82, key_right = 83, key_sf = 84, key_sr = 85, key_stab = 86, key_up = 87, keypad_local = 88, keypad_xmit = 89, lab_f0 = 90, lab_f1 = 91, lab_f10 = 92, lab_f2 = 93, lab_f3 = 94, lab_f4 = 95, lab_f5 = 96, lab_f6 = 97, lab_f7 = 98, lab_f8 = 99, lab_f9 = 100, meta_off = 101, meta_on = 102, newline = 103, pad_char = 104, parm_dch = 105, parm_delete_line = 106, parm_down_cursor = 107, parm_ich = 108, parm_index = 109, parm_insert_line = 110, parm_left_cursor = 111, parm_right_cursor = 112, parm_rindex = 113, parm_up_cursor = 114, pkey_key = 115, pkey_local = 116, pkey_xmit = 117, print_screen = 118, prtr_off = 119, prtr_on = 120, repeat_char = 121, reset_1string = 122, reset_2string = 123, reset_3string = 124, reset_file = 125, restore_cursor = 126, row_address = 127, save_cursor = 128, scroll_forward = 129, scroll_reverse = 130, set_attributes = 131, set_tab = 132, set_window = 133, tab = 134, to_status_line = 135, underline_char = 136, up_half_line = 137, init_prog = 138, key_a1 = 139, key_a3 = 140, key_b2 = 141, key_c1 = 142, key_c3 = 143, prtr_non = 144, char_padding = 145, acs_chars = 146, plab_norm = 147, key_btab = 148, enter_xon_mode = 149, exit_xon_mode = 150, enter_am_mode = 151, exit_am_mode = 152, xon_character = 153, xoff_character = 154, ena_acs = 155, label_on = 156, label_off = 157, key_beg = 158, key_cancel = 159, key_close = 160, key_command = 161, key_copy = 162, key_create = 163, key_end = 164, key_enter = 165, key_exit = 166, key_find = 167, key_help = 168, key_mark = 169, key_message = 170, key_move = 171, key_next = 172, key_open = 173, key_options = 174, key_previous = 175, key_print = 176, key_redo = 177, key_reference = 178, key_refresh = 179, key_replace = 180, key_restart = 181, key_resume = 182, key_save = 183, key_suspend = 184, key_undo = 185, key_sbeg = 186, key_scancel = 187, key_scommand = 188, key_scopy = 189, key_screate = 190, key_sdc = 191, key_sdl = 192, key_select = 193, key_send = 194, key_seol = 195, key_sexit = 196, key_sfind = 197, key_shelp = 198, key_shome = 199, key_sic = 200, key_sleft = 201, key_smessage = 202, key_smove = 203, key_snext = 204, key_soptions = 205, key_sprevious = 206, key_sprint = 207, key_sredo = 208, key_sreplace = 209, key_sright = 210, key_srsume = 211, key_ssave = 212, key_ssuspend = 213, key_sundo = 214, req_for_input = 215, key_f11 = 216, key_f12 = 217, key_f13 = 218, key_f14 = 219, key_f15 = 220, key_f16 = 221, key_f17 = 222, key_f18 = 223, key_f19 = 224, key_f20 = 225, key_f21 = 226, key_f22 = 227, key_f23 = 228, key_f24 = 229, key_f25 = 230, key_f26 = 231, key_f27 = 232, key_f28 = 233, key_f29 = 234, key_f30 = 235, key_f31 = 236, key_f32 = 237, key_f33 = 238, key_f34 = 239, key_f35 = 240, key_f36 = 241, key_f37 = 242, key_f38 = 243, key_f39 = 244, key_f40 = 245, key_f41 = 246, key_f42 = 247, key_f43 = 248, key_f44 = 249, key_f45 = 250, key_f46 = 251, key_f47 = 252, key_f48 = 253, key_f49 = 254, key_f50 = 255, key_f51 = 256, key_f52 = 257, key_f53 = 258, key_f54 = 259, key_f55 = 260, key_f56 = 261, key_f57 = 262, key_f58 = 263, key_f59 = 264, key_f60 = 265, key_f61 = 266, key_f62 = 267, key_f63 = 268, clr_bol = 269, clear_margins = 270, set_left_margin = 271, set_right_margin = 272, label_format = 273, set_clock = 274, display_clock = 275, remove_clock = 276, create_window = 277, goto_window = 278, hangup = 279, dial_phone = 280, quick_dial = 281, tone = 282, pulse = 283, flash_hook = 284, fixed_pause = 285, wait_tone = 286, user0 = 287, user1 = 288, user2 = 289, user3 = 290, user4 = 291, user5 = 292, user6 = 293, user7 = 294, user8 = 295, user9 = 296, orig_pair = 297, orig_colors = 298, initialize_color = 299, initialize_pair = 300, set_color_pair = 301, set_foreground = 302, set_background = 303, change_char_pitch = 304, change_line_pitch = 305, change_res_horz = 306, change_res_vert = 307, define_char = 308, enter_doublewide_mode = 309, enter_draft_quality = 310, enter_italics_mode = 311, enter_leftward_mode = 312, enter_micro_mode = 313, enter_near_letter_quality = 314, enter_normal_quality = 315, enter_shadow_mode = 316, enter_subscript_mode = 317, enter_superscript_mode = 318, enter_upward_mode = 319, exit_doublewide_mode = 320, exit_italics_mode = 321, exit_leftward_mode = 322, exit_micro_mode = 323, exit_shadow_mode = 324, exit_subscript_mode = 325, exit_superscript_mode = 326, exit_upward_mode = 327, micro_column_address = 328, micro_down = 329, micro_left = 330, micro_right = 331, micro_row_address = 332, micro_up = 333, order_of_pins = 334, parm_down_micro = 335, parm_left_micro = 336, parm_right_micro = 337, parm_up_micro = 338, select_char_set = 339, set_bottom_margin = 340, set_bottom_margin_parm = 341, set_left_margin_parm = 342, set_right_margin_parm = 343, set_top_margin = 344, set_top_margin_parm = 345, start_bit_image = 346, start_char_set_def = 347, stop_bit_image = 348, stop_char_set_def = 349, subscript_characters = 350, superscript_characters = 351, these_cause_cr = 352, zero_motion = 353, char_set_names = 354, key_mouse = 355, mouse_info = 356, req_mouse_pos = 357, get_mouse = 358, set_a_foreground = 359, set_a_background = 360, pkey_plab = 361, device_type = 362, code_set_init = 363, set0_des_seq = 364, set1_des_seq = 365, set2_des_seq = 366, set3_des_seq = 367, set_lr_margin = 368, set_tb_margin = 369, bit_image_repeat = 370, bit_image_newline = 371, bit_image_carriage_return = 372, color_names = 373, define_bit_image_region = 374, end_bit_image_region = 375, set_color_band = 376, set_page_length = 377, display_pc_char = 378, enter_pc_charset_mode = 379, exit_pc_charset_mode = 380, enter_scancode_mode = 381, exit_scancode_mode = 382, pc_term_options = 383, scancode_escape = 384, alt_scancode_esc = 385, enter_horizontal_hl_mode = 386, enter_left_hl_mode = 387, enter_low_hl_mode = 388, enter_right_hl_mode = 389, enter_top_hl_mode = 390, enter_vertical_hl_mode = 391, set_a_attributes = 392, set_pglen_inch = 393, }; const TerminfoHeader = packed struct { // LE storage const LEGACY_MAGIC: u16 = 0o432; const EXTENDED_MAGIC: u16 = 0o1036; magic: u16, terminal_names_size: u16, boolean_flags_size: u16, numbers_length: u16, offsets_length: u16, string_size: u16, }; comptime { std.debug.assert(@sizeOf(TerminfoHeader) == 12); } pub const TermInfo = struct { alloc: *std.mem.Allocator, name: []const u8, strings: [394]?[]const u8, numbers: [32]u32, bool_caps: std.StaticBitSet(256), string_buffer: []const u8, pub fn getString(self: @This(), string: StringMap) ?[]const u8 { return self.strings[@enumToInt(string)]; } pub fn getNumber(self: @This(), number: NumberMap) u32 { return self.numbers[@enumToInt(number)]; } pub fn getName(self: @This()) []const u8 { return self.name; } pub fn getBoolCap(self: @This(), cap: BoolMap) bool { return self.bool_caps.isSet(@enumToInt(cap)); } pub fn deinit(self: *@This()) void { self.alloc.free(self.name); self.alloc.free(self.string_buffer); } }; pub fn loadDefinition(alloc: *std.mem.Allocator, source: anytype) !TermInfo { const header = try source.reader().readStruct(TerminfoHeader); const is_legacy = switch (header.magic) { TerminfoHeader.LEGACY_MAGIC => true, TerminfoHeader.EXTENDED_MAGIC => false, else => { std.debug.print("Invalid magic\n", .{}); return error.InvalidMagic; }, }; const names = try source.reader().readUntilDelimiterAlloc(alloc, '\x00', 256); var bool_map = std.StaticBitSet(256).initEmpty(); // Load boolean flags { var i: usize = 0; while (i < header.boolean_flags_size) : (i += 1) { const value = try source.reader().readInt(u8, .Little); bool_map.setValue(i, value != 0); } } // Align to 2 { var stream = source.seekableStream(); const offset = try stream.getPos(); try stream.seekTo(std.mem.alignForward(offset, 2)); } // Load numbers var numbers = [_]u32{0} ** 32; { var i: usize = 0; while (i < header.numbers_length) : (i += 1) { if (is_legacy) { const value = try source.reader().readInt(u16, .Little); numbers[i] = @as(u32, value); } else { const value = try source.reader().readInt(u32, .Little); numbers[i] = value; } } } // Load offsets var offsets = std.ArrayList(u16).init(alloc); defer offsets.deinit(); { var i: usize = 0; while (i < header.offsets_length) : (i += 1) { const value = try source.reader().readInt(u16, .Little); try offsets.append(value); } } // Load strings var string_buffer = try alloc.alloc(u8, header.string_size); try source.reader().readNoEof(string_buffer); var string_map: [394]?[]const u8 = undefined; { for (string_map) |*entry| { entry.* = null; } for (offsets.items) |offset, i| { if (offset == 0xffff or i >= string_map.len) { continue; } string_map[i] = std.mem.sliceTo(string_buffer[offset..], '\x00'); } } return TermInfo{ .alloc = alloc, .name = names, .strings = string_map, .string_buffer = string_buffer, .bool_caps = bool_map, .numbers = numbers, }; } pub fn loadTerm(alloc: *std.mem.Allocator) !TermInfo { // TODO implement search algorithm const terminal = std.os.getenv("TERM") orelse "ansi"; const path = try std.fmt.allocPrint(alloc, "/usr/share/terminfo/{c}/{s}", .{ terminal[0], terminal }); defer alloc.free(path); const file = try std.fs.cwd().openFile(path, .{}); defer file.close(); return loadDefinition(alloc, file); } // Search algorithm // man 5 terminfo // // if TERMINFO is set // use it as the only search directory // return // // try $HOME/.terminfo for a description // // if TERMINFO_DIRS is set // use it as colon-separated list of search directories // empty directory is interpreted as compiled-in default // otherwise use compiled-in locations + /usr/share/terminfo //
src/terminfo.zig
const std = @import("std"); const builtin = std.builtin; const time = std.time; const unicode = std.unicode; const Timer = time.Timer; const N = 1_000_000; const KiB = 1024; const MiB = 1024 * KiB; const GiB = 1024 * MiB; const ResultCount = struct { count: usize, throughput: u64, }; fn benchmarkCodepointCount(buf: []const u8) !ResultCount { var timer = try Timer.start(); const bytes = N * buf.len; const start = timer.lap(); var i: usize = 0; var r: usize = undefined; while (i < N) : (i += 1) { r = try @call( .{ .modifier = .never_inline }, std.unicode.utf8CountCodepoints, .{buf}, ); } const end = timer.read(); const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; const throughput = @floatToInt(u64, @intToFloat(f64, bytes) / elapsed_s); return ResultCount{ .count = r, .throughput = throughput }; } pub fn main() !void { const stdout = std.io.getStdOut().writer(); try stdout.print("short ASCII strings\n", .{}); { const result = try benchmarkCodepointCount("abc"); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } try stdout.print("short Unicode strings\n", .{}); { const result = try benchmarkCodepointCount("ŌŌŌ"); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } try stdout.print("pure ASCII strings\n", .{}); { const result = try benchmarkCodepointCount("hello" ** 16); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } try stdout.print("pure Unicode strings\n", .{}); { const result = try benchmarkCodepointCount("こんにちは" ** 16); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } try stdout.print("mixed ASCII/Unicode strings\n", .{}); { const result = try benchmarkCodepointCount("Hyvää huomenta" ** 16); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } }
lib/std/unicode/throughput_test.zig
const std = @import("std"); const assert = std.debug.assert; const panic = std.debug.panic; const zp = @import("../../zplay.zig"); const gl = zp.deps.gl; const Self = @This(); pub const Error = error{ TextureUnitUsed, }; pub const TextureType = enum(c_uint) { texture_1d = gl.GL_TEXTURE_1D, texture_2d = gl.GL_TEXTURE_2D, texture_3d = gl.GL_TEXTURE_3D, texture_1d_array = gl.GL_TEXTURE_1D_ARRAY, texture_2d_array = gl.GL_TEXTURE_2D_ARRAY, texture_rectangle = gl.GL_TEXTURE_RECTANGLE, texture_cube_map = gl.GL_TEXTURE_CUBE_MAP, texture_buffer = gl.GL_TEXTURE_BUFFER, texture_2d_multisample = gl.GL_TEXTURE_2D_MULTISAMPLE, texture_2d_multisample_array = gl.GL_TEXTURE_2D_MULTISAMPLE_ARRAY, }; pub const UpdateTarget = enum(c_uint) { /// 1d texture_1d = gl.GL_TEXTURE_1D, proxy_texture_1d = gl.GL_PROXY_TEXTURE_1D, /// 2d texture_2d = gl.GL_TEXTURE_2D, proxy_texture_2d = gl.GL_PROXY_TEXTURE_2D, texture_1d_array = gl.GL_TEXTURE_1D_ARRAY, proxy_texture_1d_array = gl.GL_PROXY_TEXTURE_1D_ARRAY, texture_rectangle = gl.GL_TEXTURE_RECTANGLE, proxy_texture_rectangle = gl.GL_PROXY_TEXTURE_RECTANGLE, texture_cube_map_positive_x = gl.GL_TEXTURE_CUBE_MAP_POSITIVE_X, texture_cube_map_negative_x = gl.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, texture_cube_map_positive_y = gl.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, texture_cube_map_negative_y = gl.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, texture_cube_map_positive_z = gl.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, texture_cube_map_negative_z = gl.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, proxy_texture_cube_map = gl.GL_PROXY_TEXTURE_CUBE_MAP, /// 3d texture_3d = gl.GL_TEXTURE_3D, proxy_texture_3d = gl.GL_PROXY_TEXTURE_3D, texture_2d_array = gl.GL_TEXTURE_2D_ARRAY, proxy_texture_2d_array = gl.GL_PROXY_TEXTURE_2D_ARRAY, }; pub const TextureMultisampleTarget = enum(c_uint) { /// 2d multisample texture_2d_multisample = gl.GL_TEXTURE_2D_MULTISAMPLE, proxy_texture_2d_multisample = gl.GL_PROXY_TEXTURE_2D_MULTISAMPLE, /// 3d multisample texture_2d_multisample_array = gl.GL_TEXTURE_2D_MULTISAMPLE_ARRAY, proxy_texture_2d_multisample_array = gl.GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY, }; pub const TextureFormat = enum(c_int) { red = gl.GL_RED, rg = gl.GL_RG, rgb = gl.GL_RGB, rgba = gl.GL_RGBA, depth_component = gl.GL_DEPTH_COMPONENT, depth_stencil = gl.GL_DEPTH_STENCIL, compressed_red = gl.GL_COMPRESSED_RED, compressed_rg = gl.GL_COMPRESSED_RG, compressed_rgb = gl.GL_COMPRESSED_RGB, compressed_rgba = gl.GL_COMPRESSED_RGBA, compressed_srgb = gl.GL_COMPRESSED_SRGB, compressed_srgb_alpha = gl.GL_COMPRESSED_SRGB_ALPHA, }; pub const ImageFormat = enum(c_uint) { red = gl.GL_RED, rg = gl.GL_RG, rgb = gl.GL_RGB, bgr = gl.GL_BGR, rgba = gl.GL_RGBA, bgra = gl.GL_BGRA, depth_component = gl.GL_DEPTH_COMPONENT, depth_stencil = gl.GL_DEPTH_STENCIL, pub fn getChannels(self: @This()) u32 { return switch (self) { .red => 1, .rg => 2, .rgb => 3, .bgr => 3, .rgba => 4, .bgra => 4, else => { panic("not image format!", .{}); }, }; } }; pub const TextureUnit = enum(c_uint) { texture_unit_0 = gl.GL_TEXTURE0, texture_unit_1 = gl.GL_TEXTURE1, texture_unit_2 = gl.GL_TEXTURE2, texture_unit_3 = gl.GL_TEXTURE3, texture_unit_4 = gl.GL_TEXTURE4, texture_unit_5 = gl.GL_TEXTURE5, texture_unit_6 = gl.GL_TEXTURE6, texture_unit_7 = gl.GL_TEXTURE7, texture_unit_8 = gl.GL_TEXTURE8, texture_unit_9 = gl.GL_TEXTURE9, texture_unit_10 = gl.GL_TEXTURE10, texture_unit_11 = gl.GL_TEXTURE11, texture_unit_12 = gl.GL_TEXTURE12, texture_unit_13 = gl.GL_TEXTURE13, texture_unit_14 = gl.GL_TEXTURE14, texture_unit_15 = gl.GL_TEXTURE15, texture_unit_16 = gl.GL_TEXTURE16, texture_unit_17 = gl.GL_TEXTURE17, texture_unit_18 = gl.GL_TEXTURE18, texture_unit_19 = gl.GL_TEXTURE19, texture_unit_20 = gl.GL_TEXTURE20, texture_unit_21 = gl.GL_TEXTURE21, texture_unit_22 = gl.GL_TEXTURE22, texture_unit_23 = gl.GL_TEXTURE23, texture_unit_24 = gl.GL_TEXTURE24, texture_unit_25 = gl.GL_TEXTURE25, texture_unit_26 = gl.GL_TEXTURE26, texture_unit_27 = gl.GL_TEXTURE27, texture_unit_28 = gl.GL_TEXTURE28, texture_unit_29 = gl.GL_TEXTURE29, texture_unit_30 = gl.GL_TEXTURE30, texture_unit_31 = gl.GL_TEXTURE31, const Unit = @This(); pub fn fromInt(int: i32) Unit { return @intToEnum(Unit, int + gl.GL_TEXTURE0); } pub fn toInt(self: Unit) i32 { return @intCast(i32, @enumToInt(self) - gl.GL_TEXTURE0); } // mark where texture unit is allocated to var alloc_map = std.EnumArray(Unit, ?*Self).initFill(null); fn alloc(unit: Unit, tex: *Self) void { if (alloc_map.get(unit)) |t| { if (tex == t) return; t.tu = null; // detach unit from old texture } tex.tu = unit; alloc_map.set(unit, tex); } fn free(unit: Unit) void { if (alloc_map.get(unit)) |t| { t.tu = null; // detach unit from old texture alloc_map.set(unit, null); } } }; pub const WrappingCoord = enum(c_uint) { s = gl.GL_TEXTURE_WRAP_S, t = gl.GL_TEXTURE_WRAP_T, r = gl.GL_TEXTURE_WRAP_R, }; pub const WrappingMode = enum(c_int) { repeat = gl.GL_REPEAT, mirrored_repeat = gl.GL_MIRRORED_REPEAT, clamp_to_edge = gl.GL_CLAMP_TO_EDGE, clamp_to_border = gl.GL_CLAMP_TO_BORDER, }; pub const FilteringSituation = enum(c_uint) { minifying = gl.GL_TEXTURE_MIN_FILTER, magnifying = gl.GL_TEXTURE_MAG_FILTER, }; pub const FilteringMode = enum(c_int) { nearest = gl.GL_NEAREST, linear = gl.GL_LINEAR, nearest_mipmap_nearest = gl.GL_NEAREST_MIPMAP_NEAREST, nearest_mipmap_linear = gl.GL_NEAREST_MIPMAP_LINEAR, linear_mipmap_nearest = gl.GL_LINEAR_MIPMAP_NEAREST, linear_mipmap_linear = gl.GL_LINEAR_MIPMAP_LINEAR, }; /// allocator allocator: std.mem.Allocator, /// texture id id: gl.GLuint = undefined, /// texture type tt: TextureType, /// texture unit tu: ?TextureUnit = null, /// internal format format: TextureFormat = undefined, /// size of texture width: u32 = undefined, height: ?u32 = null, depth: ?u32 = null, pub fn init(allocator: std.mem.Allocator, tt: TextureType) !*Self { const self = try allocator.create(Self); self.tt = tt; gl.genTextures(1, &self.id); gl.util.checkError(); return self; } pub fn deinit(self: *Self) void { if (self.tu) |u| { TextureUnit.free(u); } gl.deleteTextures(1, &self.id); gl.util.checkError(); } /// activate and bind to given texture unit /// NOTE: because a texture unit can be stolen anytime /// by other textures, we just blindly bind them everytime. /// Maybe we need to look out for performance issue. pub fn bindToTextureUnit(self: *Self, unit: TextureUnit) void { TextureUnit.alloc(unit, self); gl.activeTexture(@enumToInt(self.tu.?)); defer gl.activeTexture(gl.GL_TEXTURE0); gl.bindTexture(@enumToInt(self.tt), self.id); gl.util.checkError(); } /// get binded texture unit pub fn getTextureUnit(self: Self) i32 { return @intCast(i32, @enumToInt(self.tu.?) - gl.GL_TEXTURE0); } /// set texture wrapping mode pub fn setWrappingMode(self: Self, coord: WrappingCoord, mode: WrappingMode) void { assert(self.tt == .texture_2d or self.tt == .texture_cube_map); gl.bindTexture(@enumToInt(self.tt), self.id); defer gl.bindTexture(@enumToInt(self.tt), 0); gl.texParameteri(@enumToInt(self.tt), @enumToInt(coord), @enumToInt(mode)); gl.util.checkError(); } /// set border color, useful when using `WrappingMode.clamp_to_border` pub fn setBorderColor(self: Self, color: [4]f32) void { assert(self.tt == .texture_2d); gl.bindTexture(@enumToInt(self.tt), self.id); defer gl.bindTexture(@enumToInt(self.tt), 0); gl.texParameterfv(@enumToInt(self.tt), gl.GL_TEXTURE_BORDER_COLOR, &color); gl.util.checkError(); } /// set filtering mode pub fn setFilteringMode(self: Self, situation: FilteringSituation, mode: FilteringMode) void { assert(self.tt == .texture_2d or self.tt == .texture_cube_map); if (situation == .magnifying and (mode == .linear_mipmap_nearest or mode == .linear_mipmap_linear or mode == .nearest_mipmap_nearest or mode == .nearest_mipmap_linear)) { panic("meaningless filtering parameters!", .{}); } gl.bindTexture(@enumToInt(self.tt), self.id); defer gl.bindTexture(@enumToInt(self.tt), 0); gl.texParameteri(@enumToInt(self.tt), @enumToInt(situation), @enumToInt(mode)); gl.util.checkError(); } /// update image data pub fn updateImageData( self: *Self, target: UpdateTarget, mipmap_level: i32, texture_format: TextureFormat, width: u32, height: ?u32, depth: ?u32, image_format: ImageFormat, comptime T: type, data: ?[*]const T, gen_mipmap: bool, ) void { gl.bindTexture(@enumToInt(self.tt), self.id); defer gl.bindTexture(@enumToInt(self.tt), 0); switch (self.tt) { .texture_1d => { assert(target == .texture_1d or target == .proxy_texture_1d); gl.texImage1D( @enumToInt(target), mipmap_level, @enumToInt(texture_format), @intCast(c_int, width), 0, @enumToInt(image_format), gl.util.dataType(T), data, ); }, .texture_2d => { assert(target == .texture_2d or target == .proxy_texture_2d); gl.texImage2D( @enumToInt(target), mipmap_level, @enumToInt(texture_format), @intCast(c_int, width), @intCast(c_int, height.?), 0, @enumToInt(image_format), gl.util.dataType(T), data, ); }, .texture_1d_array => { assert(target == .texture_1d or target == .proxy_texture_1d); gl.texImage2D( @enumToInt(target), mipmap_level, @enumToInt(texture_format), @intCast(c_int, width), @intCast(c_int, height.?), 0, @enumToInt(image_format), gl.util.dataType(T), data, ); }, .texture_rectangle => { assert(target == .texture_rectangle or target == .proxy_texture_rectangle); gl.texImage2D( @enumToInt(target), mipmap_level, @enumToInt(texture_format), @intCast(c_int, width), @intCast(c_int, height.?), 0, @enumToInt(image_format), gl.util.dataType(T), data, ); }, .texture_cube_map => { assert(target == .texture_cube_map_positive_x or target == .texture_cube_map_negative_x or target == .texture_cube_map_positive_y or target == .texture_cube_map_negative_y or target == .texture_cube_map_positive_z or target == .texture_cube_map_negative_z or target == .proxy_texture_cube_map); gl.texImage2D( @enumToInt(target), mipmap_level, @enumToInt(texture_format), @intCast(c_int, width), @intCast(c_int, height.?), 0, @enumToInt(image_format), gl.util.dataType(T), data, ); }, .texture_3d => { assert(target == .texture_3d or target == .proxy_texture_3d); gl.texImage3D( @enumToInt(target), mipmap_level, @enumToInt(texture_format), @intCast(c_int, width), @intCast(c_int, height.?), @intCast(c_int, depth.?), 0, @enumToInt(image_format), gl.util.dataType(T), data, ); }, .texture_2d_array => { assert(target == .texture_2d_array or target == .proxy_texture_2d_array); gl.texImage3D( @enumToInt(target), mipmap_level, @enumToInt(texture_format), @intCast(c_int, width), @intCast(c_int, height.?), @intCast(c_int, depth.?), 0, @enumToInt(image_format), gl.util.dataType(T), data, ); }, else => { panic("invalid operation!", .{}); }, } gl.util.checkError(); if (self.tt != .texture_rectangle and gen_mipmap) { gl.generateMipmap(@enumToInt(self.tt)); gl.util.checkError(); } self.format = texture_format; self.width = width; self.height = height; self.depth = depth; } /// update multisample data pub fn updateMultisampleData( self: Self, target: UpdateTarget, samples: u32, texture_format: TextureFormat, width: u32, height: u32, depth: ?u32, fixed_sample_location: bool, ) void { switch (self.tt) { .texture_2d_multisample => { assert(target == .texture_2d_multisample or target == .proxy_texture_2d_multisample); gl.texImage2DMultisample( @enumToInt(target), samples, @enumToInt(texture_format), width, height, gl.util.boolType(fixed_sample_location), ); }, .texture_2d_multisample_array => { assert(target == .texture_2d_multisample_array or target == .proxy_texture_2d_multisample_array); gl.texImage3DMultisample( @enumToInt(target), samples, @enumToInt(texture_format), width, height, depth.?, gl.util.boolType(fixed_sample_location), ); }, else => { panic("invalid operation!", .{}); }, } gl.util.checkError(); } /// update buffer texture data pub fn updateBufferTexture( self: Self, texture_format: TextureFormat, vbo: gl.Uint, ) void { assert(self.tt == .texture_buffer); gl.texBuffer(@enumToInt(self.tt), @enumToInt(texture_format), vbo); gl.util.checkError(); }
src/graphics/common/Texture.zig
const std = @import("std"); const warn = std.debug.print; const Allocator = std.mem.Allocator; const util = @import("../util.zig"); const config = @import("../config.zig"); const simple_buffer = @import("../simple_buffer.zig"); const toot_lib = @import("../toot.zig"); const thread = @import("../thread.zig"); const filter_lib = @import("../filter.zig"); const c = @cImport({ @cInclude("gtk/gtk.h"); }); const GUIError = error{ GtkInit, GladeLoad, }; var allocator: *Allocator = undefined; var settings: *config.Settings = undefined; pub const queue = std.ArrayList(u8).init(allocator); var myActor: *thread.Actor = undefined; var myAllocation = c.GtkAllocation{ .x = -1, .y = -1, .width = 0, .height = 0 }; pub const Column = struct { builder: [*c]c.GtkBuilder, columnbox: [*c]c.GtkWidget, config_window: [*c]c.GtkWidget, main: *config.ColumnInfo, guitoots: std.StringHashMap(*c.GtkBuilder), }; var columns: std.ArrayList(*Column) = undefined; var myBuilder: *c.GtkBuilder = undefined; var myCssProvider: [*c]c.GtkCssProvider = undefined; pub fn libname() []const u8 { return "GTK"; } pub fn init(alloca: *Allocator, set: *config.Settings) !void { warn("{} started\n", .{libname()}); settings = set; allocator = alloca; columns = std.ArrayList(*Column).init(allocator); var argc: c_int = undefined; var argv: ?[*]?[*]?[*]u8 = null; var tf = c.gtk_init_check(@ptrCast([*]c_int, &argc), argv); if (tf != 1) return GUIError.GtkInit; } pub fn gui_setup(actor: *thread.Actor) !void { myActor = actor; // GtkCssProvider *cssProvider = gtk_css_provider_new(); myCssProvider = c.gtk_css_provider_new(); _ = c.gtk_css_provider_load_from_path(myCssProvider, "theme.css", null); c.gtk_style_context_add_provider_for_screen(c.gdk_screen_get_default(), @ptrCast(*c.GtkStyleProvider, myCssProvider), c.GTK_STYLE_PROVIDER_PRIORITY_USER); myBuilder = c.gtk_builder_new(); var ret = c.gtk_builder_add_from_file(myBuilder, "glade/zootdeck.glade", @intToPtr([*c][*c]c._GError, 0)); if (ret == 0) { warn("builder file fail", .{}); return GUIError.GladeLoad; } // Callbacks _ = c.gtk_builder_add_callback_symbol(myBuilder, "actionbar.add", actionbar_add); _ = c.gtk_builder_add_callback_symbol(myBuilder, "zoot_drag", zoot_drag); // captures all keys oh no // _ = c.gtk_builder_add_callback_symbol(myBuilder, "zoot.keypress", // @ptrCast(?extern fn() void, zoot_keypress)); _ = c.gtk_builder_add_callback_symbol(myBuilder, "main_check_resize", @ptrCast(?fn () callconv(.C) void, main_check_resize)); _ = c.gtk_builder_connect_signals(myBuilder, null); // set main size before resize callback happens var main_window = builder_get_widget(myBuilder, "main"); var w = @intCast(c.gint, settings.win_x); var h = @intCast(c.gint, settings.win_y); // c.gtk_widget_set_size_request(main_window, w, h); c.gtk_window_resize(@ptrCast([*c]c.GtkWindow, main_window), w, h); _ = g_signal_connect(main_window, "destroy", gtk_quit, null); warn("{} gui_setup done\n", .{libname()}); } fn builder_get_widget(builder: *c.GtkBuilder, name: [*]const u8) [*]c.GtkWidget { var gobject = @ptrCast([*c]c.GTypeInstance, c.gtk_builder_get_object(builder, name)); var gwidget = @ptrCast([*c]c.GtkWidget, c.g_type_check_instance_cast(gobject, c.gtk_widget_get_type())); return gwidget; } pub fn schedule(func: ?fn (?*anyopaque) callconv(.C) c_int, param: ?*anyopaque) void { _ = c.gdk_threads_add_idle(func, param); } fn hide_column_config(column: *Column) void { c.gtk_widget_hide(column.config_window); } pub fn show_login_schedule(in: *anyopaque) callconv(.C) c_int { _ = in; var login_window = builder_get_widget(myBuilder, "login"); c.gtk_widget_show(login_window); return 0; } pub fn show_main_schedule(in: ?*anyopaque) callconv(.C) c_int { _ = in; var main_window = builder_get_widget(myBuilder, "main"); c.gtk_widget_show(main_window); return 0; } pub fn column_config_oauth_url_schedule(in: ?*anyopaque) callconv(.C) c_int { const column = @ptrCast(*config.ColumnInfo, @alignCast(8, in)); column_config_oauth_url(column); return 0; } pub fn update_author_photo_schedule(in: ?*anyopaque) callconv(.C) c_int { const cAcct = @ptrCast([*c]const u8, @alignCast(8, in)); const acct = util.cstrToSliceCopy(allocator, cAcct); update_author_photo(acct); return 0; } pub fn update_column_ui_schedule(in: ?*anyopaque) callconv(.C) c_int { const columnInfo = @ptrCast(*config.ColumnInfo, @alignCast(8, in)); const column = findColumnByInfo(columnInfo); update_column_ui(column); return 0; } pub const TootPic = struct { toot: *toot_lib.Type, pic: []const u8, }; pub fn toot_media_schedule(in: ?*anyopaque) callconv(.C) c_int { const tootpic = @ptrCast(*TootPic, @alignCast(8, in)); const toot = tootpic.toot; if (findColumnByTootId(toot.id())) |column| { const builder = column.guitoots.get(toot.id()).?; toot_media(column, builder, toot, tootpic.pic); } return 0; } pub fn add_column_schedule(in: ?*anyopaque) callconv(.C) c_int { const column = @ptrCast(*config.ColumnInfo, @alignCast(8, in)); add_column(column); return 0; } pub fn add_column(colInfo: *config.ColumnInfo) void { const container = builder_get_widget(myBuilder, "ZootColumns"); const column = allocator.create(Column) catch unreachable; column.builder = c.gtk_builder_new_from_file("glade/column.glade"); column.columnbox = builder_get_widget(column.builder, "column"); column.main = colInfo; //var line_buf: []u8 = allocator.alloc(u8, 255) catch unreachable; column.config_window = builder_get_widget(column.builder, "column_config"); c.gtk_window_resize(@ptrCast([*c]c.GtkWindow, column.config_window), 600, 200); column.guitoots = std.StringHashMap(*c.GtkBuilder).init(allocator); columns.append(column) catch unreachable; columns_resize(); warn("column added {}\n", .{column.main.makeTitle()}); const filter = builder_get_widget(column.builder, "column_filter"); const cFilter = util.sliceToCstr(allocator, column.main.config.filter); c.gtk_entry_set_text(@ptrCast([*c]c.GtkEntry, filter), cFilter); //const footer = builder_get_widget(column.builder, "column_footer"); const config_icon = builder_get_widget(column.builder, "column_config_icon"); c.gtk_misc_set_alignment(@ptrCast([*c]c.GtkMisc, config_icon), 1, 0); update_column_ui(column); c.gtk_grid_attach_next_to(@ptrCast([*c]c.GtkGrid, container), column.columnbox, null, c.GtkPositionType.GTK_POS_RIGHT, 1, 1); _ = c.gtk_builder_add_callback_symbol(column.builder, "column.title", @ptrCast(?fn () callconv(.C) void, column_top_label_title)); _ = c.gtk_builder_add_callback_symbol(column.builder, "column.config", @ptrCast(?fn () callconv(.C) void, column_config_btn)); _ = c.gtk_builder_add_callback_symbol(column.builder, "column.reload", @ptrCast(?fn () callconv(.C) void, column_reload)); _ = c.gtk_builder_add_callback_symbol(column.builder, "column.imgonly", @ptrCast(?fn () callconv(.C) void, column_imgonly)); _ = c.gtk_builder_add_callback_symbol(column.builder, "column.filter_done", @ptrCast(?fn () callconv(.C) void, column_filter_done)); _ = c.gtk_builder_add_callback_symbol(column.builder, "column_config.done", @ptrCast(?fn () callconv(.C) void, column_config_done)); _ = c.gtk_builder_add_callback_symbol(column.builder, "column_config.remove", @ptrCast(?fn () callconv(.C) void, column_remove_btn)); _ = c.gtk_builder_add_callback_symbol(column.builder, "column_config.oauth_btn", @ptrCast(?fn () callconv(.C) void, column_config_oauth_btn)); _ = c.gtk_builder_add_callback_symbol(column.builder, "column_config.oauth_auth_enter", @ptrCast(?fn () callconv(.C) void, column_config_oauth_activate)); _ = c.gtk_builder_add_callback_symbol(column.builder, "zoot_drag", zoot_drag); _ = c.gtk_builder_connect_signals(column.builder, null); c.gtk_widget_show_all(container); } pub fn update_author_photo(acct: []const u8) void { warn("Update_author_photo {}\n", .{acct}); // all toots in all columns :O for (columns.items) |column| { const toots = column.main.toots.author(acct, allocator); for (toots) |toot| { warn("update_author_photo {} {} {}\n", .{ column.main.filter.host(), acct, toot.id() }); var tootbuilderMaybe = column.guitoots.get(toot.id()); if (tootbuilderMaybe) |kv| { photo_refresh(acct, kv); } } } } pub fn columns_resize() void { if (columns.items.len > 0) { const container = builder_get_widget(myBuilder, "ZootColumns"); var app_width = c.gtk_widget_get_allocated_width(container); var avg_col_width = @divTrunc(app_width, @intCast(c_int, columns.items.len)); warn("columns_resize app_width {} col_width {} columns {}\n", .{ app_width, avg_col_width, columns.items.len }); for (columns.items) |col| { c.gtk_widget_get_allocation(col.columnbox, &myAllocation); } } } pub fn update_column_ui(column: *Column) void { const label = builder_get_widget(column.builder, "column_top_label"); //var topline_null: []u8 = undefined; const title_null = util.sliceAddNull(allocator, column.main.makeTitle()); c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, label), title_null.ptr); } pub fn column_remove_schedule(in: ?*anyopaque) callconv(.C) c_int { column_remove(@ptrCast(*config.ColumnInfo, @alignCast(8, in))); return 0; } pub fn column_remove(colInfo: *config.ColumnInfo) void { warn("gui.column_remove {}\n", .{colInfo.config.title}); const container = builder_get_widget(myBuilder, "ZootColumns"); const column = findColumnByInfo(colInfo); hide_column_config(column); c.gtk_container_remove(@ptrCast([*c]c.GtkContainer, container), column.columnbox); } //pub const GCallback = ?extern fn() void; fn column_top_label_title(p: *anyopaque) callconv(.C) void { warn("column_top_label_title {}\n", .{p}); } pub fn update_column_toots_schedule(in: ?*anyopaque) callconv(.C) c_int { const c_column = @ptrCast(*config.ColumnInfo, @alignCast(8, in)); var columnMaybe = find_gui_column(c_column); if (columnMaybe) |column| { update_column_toots(column); } return 0; } pub fn update_column_config_oauth_finalize_schedule(in: ?*anyopaque) callconv(.C) c_int { const c_column = @ptrCast(*config.ColumnInfo, @alignCast(8, in)); var columnMaybe = find_gui_column(c_column); if (columnMaybe) |column| { column_config_oauth_finalize(column); } return 0; } pub fn update_column_netstatus_schedule(in: ?*anyopaque) callconv(.C) c_int { const http = @ptrCast(*config.HttpInfo, @alignCast(8, in)); var columnMaybe = find_gui_column(http.column); if (columnMaybe) |column| { update_netstatus_column(http, column); } return 0; } fn find_gui_column(c_column: *config.ColumnInfo) ?*Column { //var column: *Column = undefined; for (columns.items) |col| { if (col.main == c_column) return col; } return null; } pub fn update_column_toots(column: *Column) void { warn("update_column {} {} toots {}\n", .{ column.main.config.title, column.main.toots.count(), if (column.main.inError) @as([]const u8, "ERROR") else @as([]const u8, ""), }); const column_toot_zone = builder_get_widget(column.builder, "toot_zone"); var current = column.main.toots.first(); var idx: c_int = 0; if (current != null) { while (current) |node| { const toot = node.data; var tootbuilderMaybe = column.guitoots.get(toot.id()); if (column.main.filter.match(toot)) { if (tootbuilderMaybe) |kv| { const builder = kv; destroyTootBox(builder); warn("update_column_toots destroyTootBox toot #{} {*} {*}\n", .{ toot.id(), toot, builder }); } const tootbuilder = makeTootBox(toot, column); var tootbox = builder_get_widget(tootbuilder, "tootbox"); _ = column.guitoots.put(toot.id(), tootbuilder) catch unreachable; c.gtk_box_pack_start(@ptrCast([*c]c.GtkBox, column_toot_zone), tootbox, c.gtk_true(), c.gtk_true(), 0); c.gtk_box_reorder_child(@ptrCast([*c]c.GtkBox, column_toot_zone), tootbox, idx); } else { if (tootbuilderMaybe) |kv| { const builder = kv; var tootbox = builder_get_widget(builder, "tootbox"); c.gtk_widget_hide(tootbox); warn("update_column_toots hide toot #{} {*} {*}\n", .{ toot.id(), toot, builder }); } } current = node.next; idx += 1; } } else { // help? logo? } const column_footer_count_label = builder_get_widget(column.builder, "column_footer_count"); const tootword = if (column.main.config.img_only) "images" else "toots"; const countStr = std.fmt.allocPrint(allocator, "{} {}", .{ column.main.toots.count(), tootword }) catch unreachable; const cCountStr = util.sliceToCstr(allocator, countStr); c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_count_label), cCountStr); } pub fn update_netstatus_column(http: *config.HttpInfo, column: *Column) void { warn("update_netstatus_column {} {}\n", .{ http.url, http.response_code }); const column_footer_netstatus = builder_get_widget(column.builder, "column_footer_netstatus"); var gtk_context_netstatus = c.gtk_widget_get_style_context(column_footer_netstatus); //var netmsg: [*c]const u8 = undefined; if (http.response_code == 0) { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "GET"); c.gtk_style_context_add_class(gtk_context_netstatus, "net_active"); } else if (http.response_code >= 200 and http.response_code < 300) { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "OK"); c.gtk_style_context_remove_class(gtk_context_netstatus, "net_active"); } else if (http.response_code >= 300 and http.response_code < 400) { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "redirect"); } else if (http.response_code >= 400 and http.response_code < 500) { if (http.response_code == 401) { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "token bad"); } else if (http.response_code == 404) { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "404 err"); } else { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "4xx err"); } } else if (http.response_code >= 500 and http.response_code < 600) { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "5xx err"); } else if (http.response_code >= 1000 and http.response_code < 1100) { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "json err"); } else if (http.response_code == 2100) { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "DNS err"); } else if (http.response_code == 2200) { c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, column_footer_netstatus), "timeout err"); } if (column.main.inError) { c.gtk_style_context_add_class(gtk_context_netstatus, "net_error"); } else { c.gtk_style_context_remove_class(gtk_context_netstatus, "net_error"); } } fn widget_destroy(widget: [*c]c.GtkWidget, userdata: ?*anyopaque) callconv(.C) void { //warn("destroying {*}\n", widget); _ = userdata; c.gtk_widget_destroy(widget); } pub fn destroyTootBox(builder: *c.GtkBuilder) void { const tootbox = builder_get_widget(builder, "tootbox"); c.gtk_widget_destroy(tootbox); c.g_object_unref(builder); } pub fn makeTootBox(toot: *toot_lib.Type, column: *Column) [*c]c.GtkBuilder { warn("maketootbox toot #{} {*} gui building {} images\n", .{ toot.id(), toot, toot.imgList.items.len }); const builder = c.gtk_builder_new_from_file("glade/toot.glade"); //const tootbox = builder_get_widget(builder, "tootbox"); //const id = toot.get("id").?.String; const account = toot.get("account").?.Object; const author_acct = account.get("acct").?.String; const author_name = account.get("display_name").?.String; const author_url = account.get("url").?.String; const created_at = toot.get("created_at").?.String; const name_label = builder_get_widget(builder, "toot_author_name"); labelBufPrint(name_label, "{}", .{author_name}); const url_label = builder_get_widget(builder, "toot_author_url"); labelBufPrint(url_label, "{}", .{author_url}); const author_url_minimode_label = builder_get_widget(builder, "toot_author_url_minimode"); labelBufPrint(author_url_minimode_label, "{}", .{author_url}); const date_label = builder_get_widget(builder, "toot_date"); labelBufPrint(date_label, "{}", .{created_at}); photo_refresh(author_acct, builder); var hDecode = util.htmlEntityDecode(toot.content(), allocator) catch unreachable; const html_trim = util.htmlTagStrip(hDecode, allocator) catch unreachable; //var line_limit = 50 / columns.items.len; //const html_wrapped = hardWrap(html_trim, line_limit) catch unreachable; var cText = util.sliceToCstr(allocator, html_trim); const toottext_label = builder_get_widget(builder, "toot_text"); c.gtk_label_set_line_wrap_mode(@ptrCast([*c]c.GtkLabel, toottext_label), c.PangoWrapMode.PANGO_WRAP_WORD_CHAR); c.gtk_label_set_line_wrap(@ptrCast([*c]c.GtkLabel, toottext_label), 1); c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, toottext_label), cText); const tagBox = builder_get_widget(builder, "tag_flowbox"); //var tagidx: usize = 0; for (toot.tagList.items) |tag| { const cTag = util.sliceToCstr(allocator, tag); const tagLabel = c.gtk_label_new(cTag); const labelContext = c.gtk_widget_get_style_context(tagLabel); c.gtk_style_context_add_class(labelContext, "toot_tag"); c.gtk_container_add(@ptrCast([*c]c.GtkContainer, tagBox), tagLabel); c.gtk_widget_show(tagLabel); } // show/hide parts to put widget into full or imgonly display const id_row = builder_get_widget(builder, "toot_id_row"); const toot_separator = builder_get_widget(builder, "toot_separator"); if (column.main.config.img_only) { c.gtk_widget_hide(toottext_label); c.gtk_widget_hide(id_row); if (toot.imgCount() == 0) { c.gtk_widget_hide(date_label); c.gtk_widget_hide(toot_separator); } else { c.gtk_widget_show(author_url_minimode_label); c.gtk_widget_show(date_label); } } for (toot.imgList.items) |imgdata| { warn("toot #{} rebuilding with img\n", .{toot.id()}); toot_media(column, builder, toot, imgdata); } return builder; } fn photo_refresh(acct: []const u8, builder: *c.GtkBuilder) void { const avatar = builder_get_widget(builder, "toot_author_avatar"); const avatar_path = std.fmt.allocPrint(allocator, "./cache/{}/photo", .{acct}) catch unreachable; var pixbuf = c.gdk_pixbuf_new_from_file_at_scale(util.sliceToCstr(allocator, avatar_path), 50, -1, 1, null); c.gtk_image_set_from_pixbuf(@ptrCast([*c]c.GtkImage, avatar), pixbuf); } fn toot_media(column: *Column, builder: [*c]c.GtkBuilder, toot: *toot_lib.Type, pic: []const u8) void { const tootBox = builder_get_widget(builder, "tootbox"); const imageBox = builder_get_widget(builder, "image_box"); c.gtk_widget_get_allocation(column.columnbox, &myAllocation); var loader = c.gdk_pixbuf_loader_new(); // todo: size-prepared signal var colWidth = @floatToInt(c_int, @intToFloat(f32, myAllocation.width) / @intToFloat(f32, columns.items.len) * 0.9); var colHeight: c_int = -1; // seems to work const colWidth_ptr = allocator.create(c_int) catch unreachable; colWidth_ptr.* = colWidth; _ = g_signal_connect(loader, "size-prepared", pixloaderSizePrepared, colWidth_ptr); const loadYN = c.gdk_pixbuf_loader_write(loader, pic.ptr, pic.len, null); if (loadYN == c.gtk_true()) { var pixbuf = c.gdk_pixbuf_loader_get_pixbuf(loader); //const account = toot.get("account").?.Object; //const acct = account.get("acct").?.String; var pixbufWidth = c.gdk_pixbuf_get_width(pixbuf); warn("toot_media #{} {*} {*} {} images. win {}x{} col {}x{}px pixbuf {}px\n", .{ toot.id(), toot, tootBox, toot.imgCount(), myAllocation.width, myAllocation.height, colWidth, colHeight, pixbufWidth, }); _ = c.gdk_pixbuf_loader_close(loader, null); if (pixbuf != null) { var new_img = c.gtk_image_new_from_pixbuf(pixbuf); c.gtk_box_pack_start(@ptrCast([*c]c.GtkBox, imageBox), new_img, c.gtk_false(), c.gtk_false(), 0); c.gtk_widget_show(new_img); } else { warn("toot_media img from pixbuf FAILED\n", .{}); } } else { warn("pixbuf load FAILED of {} bytes\n", .{pic.len}); } } fn pixloaderSizePrepared(loader: *c.GdkPixbufLoader, img_width: c.gint, img_height: c.gint, data_ptr: *anyopaque) void { const colWidth = @ptrCast(*c_int, @alignCast(4, data_ptr)).*; var scaleWidth = img_width; var scaleHeight = img_height; if (img_width > colWidth) { scaleWidth = colWidth; //const scale_factor = @divFloor(img_width, colWidth); const scale_factor = @intToFloat(f32, colWidth) / @intToFloat(f32, img_width); scaleHeight = @floatToInt(c_int, @intToFloat(f32, img_height) * scale_factor); } warn("toot_media pixloaderSizePrepared col {}px img {}x{} scale {}x{}\n", .{ colWidth, img_width, img_height, scaleWidth, scaleHeight }); c.gdk_pixbuf_loader_set_size(loader, scaleWidth, scaleHeight); } fn hardWrap(str: []const u8, limit: usize) ![]const u8 { var wrapped = try simple_buffer.SimpleU8.initSize(allocator, 0); var short_lines = str.len / limit; var extra_bytes = str.len % limit; var idx: usize = 0; while (idx < short_lines) : (idx += 1) { try wrapped.append(str[limit * idx .. limit * (idx + 1)]); try wrapped.append("\n"); } try wrapped.append(str[limit * idx .. (limit * idx) + extra_bytes]); return wrapped.toSliceConst(); } fn escapeGtkString(str: []const u8) []const u8 { const str_esc_null = c.g_markup_escape_text(str.ptr, @intCast(c_long, str.len)); const str_esc = util.cstrToSlice(allocator, str_esc_null); return str_esc; } pub fn labelBufPrint(label: [*c]c.GtkWidget, comptime fmt: []const u8, args: anytype) void { const buf = allocator.alloc(u8, 256) catch unreachable; const str = std.fmt.bufPrint(buf, fmt, args) catch unreachable; const cStr = util.sliceToCstr(allocator, str); c.gtk_label_set_text(@ptrCast([*c]c.GtkLabel, label), cStr); } fn column_config_btn(columnptr: ?*anyopaque) callconv(.C) void { var columnbox = @ptrCast([*c]c.GtkWidget, @alignCast(8, columnptr)); var column: *Column = findColumnByBox(columnbox); columnConfigWriteGui(column); c.gtk_widget_show(column.config_window); } fn findColumnByTootId(toot_id: []const u8) ?*Column { for (columns.items) |column| { var kvMaybe = column.guitoots.get(toot_id); if (kvMaybe) { return column; } } return null; } fn findColumnByInfo(info: *config.ColumnInfo) *Column { for (columns.items) |col| { if (col.main == info) { return col; } } unreachable; } fn findColumnByBox(box: [*c]c.GtkWidget) *Column { for (columns.items) |col| { if (col.columnbox == box) { return col; } } unreachable; } fn findColumnByConfigWindow(widget: [*c]c.GtkWidget) *Column { const parent = c.gtk_widget_get_toplevel(widget); for (columns.items) |col| { if (col.config_window == parent) { return col; } } warn("Config window not found for widget {} parent {}\n", .{ widget, parent }); unreachable; } fn main_check_resize(selfptr: *anyopaque) callconv(.C) void { var self = @ptrCast([*c]c.GtkWidget, @alignCast(8, selfptr)); var h: c.gint = undefined; var w: c.gint = undefined; c.gtk_window_get_size(@ptrCast([*c]c.GtkWindow, self), &w, &h); //warn("main_check_resize, gtk_window_get_size {} x {}\n", w, h); if (w != settings.win_x) { warn("main_check_resize, win_x {} != w {}\n", .{ settings.win_x, w }); settings.win_x = w; thread.signal(myActor, &thread.Command{ .actor = myActor, .id = 10, .verb = &thread.CommandVerb{ .idle = undefined } }); } if (h != settings.win_y) { warn("main_check_resize, win_x {} != w {}\n", .{ settings.win_x, w }); settings.win_y = h; thread.signal(myActor, &thread.Command{ .actor = myActor, .id = 10, .verb = &thread.CommandVerb{ .idle = undefined } }); } } fn actionbar_add() callconv(.C) void { warn("actionbar_add\n", .{}); thread.signal(myActor, &thread.Command{ .actor = myActor, .id = 3, .verb = &thread.CommandVerb{ .idle = undefined } }); } fn zoot_drag() callconv(.C) void { warn("zoot_drag\n", .{}); } // rebulid half of GdkEventKey, avoiding bitfield const EventKey = packed struct { _type: i32, window: [*c]c.GtkWindow, send_event: i8, time: u32, state: u32, keyval: u32, }; fn zoot_keypress(widgetptr: *anyopaque, evtptr: *EventKey) callconv(.C) void { _ = widgetptr; warn("zoot_keypress {}\n", .{evtptr}); } fn column_reload(columnptr: *anyopaque) callconv(.C) void { var column_widget = @ptrCast([*c]c.GtkWidget, @alignCast(8, columnptr)); var column: *Column = findColumnByBox(column_widget); warn("column reload found {}\n", .{column.main.config.title}); // signal crazy var command = allocator.create(thread.Command) catch unreachable; var verb = allocator.create(thread.CommandVerb) catch unreachable; verb.column = column.main; command.id = 2; command.verb = verb; thread.signal(myActor, command); } fn column_imgonly(columnptr: *anyopaque) callconv(.C) void { var column_widget = @ptrCast([*c]c.GtkWidget, @alignCast(8, columnptr)); var column: *Column = findColumnByBox(column_widget); // signal crazy var command = allocator.create(thread.Command) catch unreachable; var verb = allocator.create(thread.CommandVerb) catch unreachable; verb.column = column.main; command.id = 9; //imgonly button press command.verb = verb; thread.signal(myActor, command); } fn column_remove_btn(selfptr: *anyopaque) callconv(.C) void { var self = @ptrCast([*c]c.GtkWidget, @alignCast(8, selfptr)); var column: *Column = findColumnByConfigWindow(self); // signal crazy var command = allocator.create(thread.Command) catch unreachable; var verb = allocator.create(thread.CommandVerb) catch unreachable; verb.column = column.main; command.id = 5; // col remove button press command.verb = verb; thread.signal(myActor, command); } fn column_config_oauth_btn(selfptr: *anyopaque) callconv(.C) void { var self = @ptrCast([*c]c.GtkWidget, @alignCast(8, selfptr)); var column: *Column = findColumnByConfigWindow(self); var oauth_box = builder_get_widget(column.builder, "column_config_oauth_box"); var host_box = builder_get_widget(column.builder, "column_config_host_box"); c.gtk_box_pack_end(@ptrCast([*c]c.GtkBox, host_box), oauth_box, 1, 0, 0); var oauth_label = builder_get_widget(column.builder, "column_config_oauth_label"); c.gtk_label_set_markup(@ptrCast([*c]c.GtkLabel, oauth_label), "contacting server..."); columnConfigReadGui(column); column.main.filter = filter_lib.parse(allocator, column.main.config.filter); // signal crazy var command = allocator.create(thread.Command) catch unreachable; var verb = allocator.create(thread.CommandVerb) catch unreachable; verb.column = column.main; command.id = 6; command.verb = verb; warn("column_config_oauth_btn cmd vrb {*}\n", .{command.verb.column}); thread.signal(myActor, command); } pub fn column_config_oauth_url(colInfo: *config.ColumnInfo) void { warn("gui.column_config_oauth_url {}\n", .{colInfo.config.title}); //const container = builder_get_widget(myBuilder, "ZootColumns"); const column = findColumnByInfo(colInfo); //var oauth_box = builder_get_widget(column.builder, "column_config_oauth_box"); var oauth_label = builder_get_widget(column.builder, "column_config_oauth_label"); var oauth_url_buf = simple_buffer.SimpleU8.initSize(allocator, 0) catch unreachable; oauth_url_buf.append("https://") catch unreachable; oauth_url_buf.append(column.main.filter.host()) catch unreachable; oauth_url_buf.append("/oauth/authorize") catch unreachable; oauth_url_buf.append("?client_id=") catch unreachable; oauth_url_buf.append(column.main.oauthClientId.?) catch unreachable; oauth_url_buf.append("&amp;scope=read+write") catch unreachable; oauth_url_buf.append("&amp;response_type=code") catch unreachable; oauth_url_buf.append("&amp;redirect_uri=urn:ietf:wg:oauth:2.0:oob") catch unreachable; var markupBuf = allocator.alloc(u8, 512) catch unreachable; var markup = std.fmt.bufPrint(markupBuf, "<a href=\"{}\">{} oauth</a>", .{ oauth_url_buf.toSliceConst(), column.main.filter.host() }) catch unreachable; var cLabel = util.sliceToCstr(allocator, markup); c.gtk_label_set_markup(@ptrCast([*c]c.GtkLabel, oauth_label), cLabel); } fn column_config_oauth_activate(selfptr: *anyopaque) callconv(.C) void { var self = @ptrCast([*c]c.GtkWidget, @alignCast(8, selfptr)); var column: *Column = findColumnByConfigWindow(self); var token_entry = builder_get_widget(column.builder, "column_config_authorization_entry"); const cAuthorization = c.gtk_entry_get_text(@ptrCast([*c]c.GtkEntry, token_entry)); const authorization = util.cstrToSliceCopy(allocator, cAuthorization); // signal crazy var command = allocator.create(thread.Command) catch unreachable; var verb = allocator.create(thread.CommandVerb) catch unreachable; var auth = allocator.create(config.ColumnAuth) catch unreachable; auth.code = authorization; auth.column = column.main; verb.auth = auth; command.id = 7; command.verb = verb; thread.signal(myActor, command); } pub fn column_config_oauth_finalize(column: *Column) void { var oauth_box = builder_get_widget(column.builder, "column_config_oauth_box"); var host_box = builder_get_widget(column.builder, "column_config_host_box"); c.gtk_container_remove(@ptrCast([*c]c.GtkContainer, host_box), oauth_box); columnConfigWriteGui(column); update_column_ui(column); } pub fn columnConfigWriteGui(column: *Column) void { var url_entry = builder_get_widget(column.builder, "column_config_url_entry"); var cUrl = util.sliceToCstr(allocator, column.main.filter.host()); c.gtk_entry_set_text(@ptrCast([*c]c.GtkEntry, url_entry), cUrl); var token_image = builder_get_widget(column.builder, "column_config_token_image"); var icon_name: [*c]const u8 = undefined; if (column.main.config.token) { icon_name = "gtk-apply"; } else { icon_name = "gtk-close"; } c.gtk_image_set_from_icon_name(@ptrCast([*c]c.GtkImage, token_image), icon_name, c.GtkIconSize.GTK_ICON_SIZE_BUTTON); } pub fn columnReadFilter(column: *Column) []const u8 { var filter_entry = builder_get_widget(column.builder, "column_filter"); var cFilter = c.gtk_entry_get_text(@ptrCast([*c]c.GtkEntry, filter_entry)); const filter = util.cstrToSliceCopy(allocator, cFilter); // edit in guithread-- warn("columnReadFilter: {} {}\n", .{ filter, filter.len }); return filter; } pub fn columnConfigReadGui(column: *Column) void { var url_entry = builder_get_widget(column.builder, "column_config_url_entry"); var cUrl = c.gtk_entry_get_text(@ptrCast([*c]c.GtkEntry, url_entry)); const newFilter = util.cstrToSliceCopy(allocator, cUrl); // edit in guithread-- column.main.filter = filter_lib.parse(allocator, newFilter); } fn column_filter_done(selfptr: *anyopaque) callconv(.C) void { var self = @ptrCast([*c]c.GtkWidget, @alignCast(8, selfptr)); var column: *Column = findColumnByBox(self); column.main.config.filter = columnReadFilter(column); column.main.filter = filter_lib.parse(allocator, column.main.config.filter); update_column_ui(column); // signal crazy var command = allocator.create(thread.Command) catch unreachable; var verb = allocator.create(thread.CommandVerb) catch unreachable; verb.column = column.main; command.id = 4; // save config command.verb = verb; thread.signal(myActor, command); // signal crazy command = allocator.create(thread.Command) catch unreachable; verb = allocator.create(thread.CommandVerb) catch unreachable; verb.column = column.main; command.id = 8; // update column UI command.verb = verb; thread.signal(myActor, command); } fn column_config_done(selfptr: *anyopaque) callconv(.C) void { var self = @ptrCast([*c]c.GtkWidget, @alignCast(8, selfptr)); var column: *Column = findColumnByConfigWindow(self); columnConfigReadGui(column); column.main.filter = filter_lib.parse(allocator, column.main.config.filter); hide_column_config(column); // signal crazy var command = allocator.create(thread.Command) catch unreachable; var verb = allocator.create(thread.CommandVerb) catch unreachable; verb.column = column.main; command.id = 4; // save config command.verb = verb; thread.signal(myActor, command); // signal crazy command = allocator.create(thread.Command) catch unreachable; verb = allocator.create(thread.CommandVerb) catch unreachable; verb.column = column.main; command.id = 8; // update column UI command.verb = verb; thread.signal(myActor, command); } fn g_signal_connect(instance: anytype, signal_name: []const u8, callback: anytype, data: anytype) c.gulong { // pub extern fn g_signal_connect_data(instance: gpointer, // detailed_signal: [*c]const gchar, // c_handler: GCallback, // data: gpointer, // destroy_data: GClosureNotify, // connect_flags: GConnectFlags) gulong; // connect_flags: GConnectFlags) gulong; // typedef void* gpointer; var signal_name_null: []u8 = std.cstr.addNullByte(allocator, signal_name) catch unreachable; var data_ptr: ?*anyopaque = undefined; if (@sizeOf(@TypeOf(data)) != 0) { data_ptr = @ptrCast(?*anyopaque, data); } else { data_ptr = null; } var thing = @ptrCast(c.gpointer, instance); return c.g_signal_connect_data(thing, signal_name_null.ptr, @ptrCast(c.GCallback, callback), data_ptr, null, c.GConnectFlags.G_CONNECT_AFTER); } pub fn mainloop() bool { var stop = false; warn("gtk pending {}\n", .{c.gtk_events_pending()}); warn("gtk main level {}\n", .{c.gtk_main_level()}); var exitcode = c.gtk_main_iteration(); warn("gtk main interaction return {}\n", .{exitcode}); //if(c.gtk_events_pending() != 0) { if (exitcode == 0) { stop = true; } return stop; } pub fn gtk_quit() callconv(.C) void { warn("gtk signal destroy - gtk_main_quit\n", .{}); c.g_object_unref(myBuilder); c.gtk_main_quit(); } pub fn gui_end() void { warn("gui ended\n", .{}); }
src/gui/gtk.zig
//-------------------------------------------------------------------------------- // Section: Types (0) //-------------------------------------------------------------------------------- //-------------------------------------------------------------------------------- // Section: Functions (4) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn CreateMailslotA( lpName: ?[*:0]const u8, nMaxMessageSize: u32, lReadTimeout: u32, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn CreateMailslotW( lpName: ?[*:0]const u16, nMaxMessageSize: u32, lReadTimeout: u32, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetMailslotInfo( hMailslot: ?HANDLE, lpMaxMessageSize: ?*u32, lpNextSize: ?*u32, lpMessageCount: ?*u32, lpReadTimeout: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn SetMailslotInfo( hMailslot: ?HANDLE, lReadTimeout: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (1) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const CreateMailslot = thismodule.CreateMailslotA; }, .wide => struct { pub const CreateMailslot = thismodule.CreateMailslotW; }, .unspecified => if (@import("builtin").is_test) struct { pub const CreateMailslot = *opaque{}; } else struct { pub const CreateMailslot = @compileError("'CreateMailslot' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (5) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const HANDLE = @import("../foundation.zig").HANDLE; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const SECURITY_ATTRIBUTES = @import("../security.zig").SECURITY_ATTRIBUTES; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/system/mailslots.zig
const std = @import("std"); const datetime = @import("datetime"); const Channel = @import("utils/channel.zig").Channel; const GlobalEventUnion = @import("main.zig").Event; const Chat = @import("Chat.zig"); const parser = @import("network/parser.zig"); const EmoteCache = @import("network/EmoteCache.zig"); const build_opts = @import("build_options"); pub const checkTokenValidity = @import("network/auth.zig").checkTokenValidity; pub const Event = union(enum) { message: Chat.Message, connected, disconnected, reconnected, clear: ?[]const u8, // optional nickname, if empty delete all }; pub const UserCommand = union(enum) { message: []const u8, // ban: []const u8, }; const Command = union(enum) { user: UserCommand, pong, }; name: []const u8, oauth: []const u8, tz: datetime.Timezone, allocator: std.mem.Allocator, ch: *Channel(GlobalEventUnion), emote_cache: EmoteCache, socket: std.net.Stream, reader: std.net.Stream.Reader, writer: std.net.Stream.Writer, writer_lock: std.event.Lock = .{}, _atomic_reconnecting: bool = false, const Self = @This(); var reconnect_frame: @Frame(_reconnect) = undefined; // var messages_frame: @Frame(receiveMessages) = undefined; var messages_frame_bytes: []align(16) u8 = undefined; var messages_result: void = undefined; pub fn init( self: *Self, alloc: std.mem.Allocator, ch: *Channel(GlobalEventUnion), name: []const u8, oauth: []const u8, tz: datetime.Timezone, ) !void { var socket = try connect(alloc, name, oauth); self.* = Self{ .name = name, .oauth = oauth, .tz = tz, .allocator = alloc, .ch = ch, .emote_cache = EmoteCache.init(alloc), .socket = socket, .reader = socket.reader(), .writer = socket.writer(), }; // Allocate messages_frame_bytes = try alloc.alignedAlloc(u8, 16, @sizeOf(@Frame(receiveMessages))); // Start the reader { // messages_frame_bytes = async self.receiveMessages(); _ = @asyncCall(messages_frame_bytes, &messages_result, receiveMessages, .{self}); } } pub fn deinit(self: *Self) void { // Try to grab the reconnecting flag while (@atomicRmw(bool, &self._atomic_reconnecting, .Xchg, true, .SeqCst)) { std.time.sleep(10 * std.time.ns_per_ms); } // Now we can kill the connection and nobody will try to reconnect std.os.shutdown(self.socket.handle, .both) catch |err| { std.log.debug("shutdown failed, err: {}", .{err}); }; await @ptrCast(anyframe->void, messages_frame_bytes); self.socket.close(); } fn receiveMessages(self: *Self) void { defer std.log.debug("receiveMessages done", .{}); std.log.debug("reader started", .{}); // yield immediately so callers can go on // with their lives instead of risking being // trapped reading a spammy socket forever std.event.Loop.instance.?.yield(); while (true) { const data = data: { const d = self.reader.readUntilDelimiterAlloc(self.allocator, '\n', 4096) catch |err| { std.log.debug("receiveMessages errored out: {e}", .{err}); self.reconnect(null); return; }; if (d.len >= 1 and d[d.len - 1] == '\r') { break :data d[0 .. d.len - 1]; } break :data d; }; std.log.debug("receiveMessages succeded", .{}); const p = parser.parseMessage(data, self.allocator, self.tz) catch |err| { std.log.debug("parsing error: [{e}]", .{err}); continue; }; switch (p) { .ping => { self.send(.pong); }, .clear => |c| { self.ch.put(GlobalEventUnion{ .network = .{ .clear = c } }); }, .message => |msg| { switch (msg.kind) { else => {}, .chat => |c| { self.emote_cache.fetch(c.emotes) catch |err| { std.log.debug("fetching error: [{e}]", .{err}); continue; }; }, .resub => |c| { self.emote_cache.fetch(c.resub_message_emotes) catch |err| { std.log.debug("fetching error: [{e}]", .{err}); continue; }; }, } self.ch.put(GlobalEventUnion{ .network = .{ .message = msg } }); // Hack: when receiving resub events, we generate a fake chat message // to display the resub message. In the future this should be // dropped in favor of actually representing properly the resub. // Also this message is pointing to data that "belongs" to another // message. Kind of a bad idea. switch (msg.kind) { .resub => |r| { if (r.resub_message.len > 0) { self.ch.put(GlobalEventUnion{ .network = .{ .message = Chat.Message{ .login_name = msg.login_name, .time = msg.time, .kind = .{ .chat = .{ .display_name = r.display_name, .text = r.resub_message, .sub_months = r.count, .is_founder = false, // std.mem.eql(u8, sub_badge.name, "founder"), .emotes = r.resub_message_emotes, .is_mod = false, // is_mod, .is_highlighted = true, }, }, }, }, }); } }, else => {}, } }, } } } // Public interface for sending commands (messages, bans, ...) pub fn sendCommand(self: *Self, cmd: UserCommand) void { // if (self.isReconnecting()) { // return error.Reconnecting; // } return self.send(Command{ .user = cmd }); } // // NOTE: it could still be possible for a command // // to remain stuck here while we are reconnecting, // // but in most cases we'll be able to correctly // // report that we can't carry out any command. // // if the twitch chat system had unique command ids, // // we could have opted to retry instead of failing // // immediately, but without unique ids you risk // // sending the same command twice. // } fn send(self: *Self, cmd: Command) void { var held = self.writer_lock.acquire(); var comm = switch (cmd) { .pong => blk: { std.log.debug("PONG!", .{}); break :blk self.writer.print("PONG :tmi.twitch.tv\n", .{}); }, .user => |uc| blk: { switch (uc) { .message => |msg| { std.log.debug("SEND MESSAGE!", .{}); break :blk self.writer.print("PRIVMSG #{s} :{s}\n", .{ self.name, msg }); }, } }, }; if (comm) |_| {} else |_| { // Try to start the reconnect procedure self.reconnect(held); } held.release(); } fn isReconnecting(self: *Self) bool { return @atomicLoad(bool, &self._atomic_reconnecting, .SeqCst); } // Public interface, used by the main control loop. pub fn askToReconnect(self: *Self) void { self.reconnect(null); } // Tries to reconnect forever. // As an optimization, writers can pass ownership of the lock directly. fn reconnect(self: *Self, writer_held: ?std.event.Lock.Held) void { if (@atomicRmw(bool, &self._atomic_reconnecting, .Xchg, true, .SeqCst)) { if (writer_held) |h| h.release(); return; } // Start the reconnect procedure reconnect_frame = async self._reconnect(writer_held); } // This function is a perfect example of what runDetached does, // with the exception that we don't want to allocate dynamic // memory for it. fn _reconnect(self: *Self, writer_held: ?std.event.Lock.Held) void { var retries: usize = 0; var backoff = [_]usize{ 100, 400, 800, 2000, 5000, 10000, //ms }; // Notify the system the connection is borked self.ch.put(GlobalEventUnion{ .network = .disconnected }); // Ensure we have the writer lock var held = writer_held orelse self.writer_lock.acquire(); // Sync with the reader. It will at one point notice // that the connection is borked and return. { std.os.shutdown(self.socket.handle, .both) catch unreachable; // await messages_frame; await @ptrCast(anyframe->void, messages_frame_bytes); self.socket.close(); } // Reconnect the socket { // Compiler doesn't like the straight break from while, // nor the labeled block version :( // self.socket = while (true) { // break connect(self.allocator, self.name, self.oauth) catch |err| { // // TODO: panic on non-transient errors. // std.time.sleep(backoff[retries] * std.time.ns_per_ms); // if (retries < backoff.len - 1) { // retries += 1; // } // continue; // }; // }; // self.socket = blk: { // while (true) { // break :blk connect(self.allocator, self.name, self.oauth) catch |err| { // // TODO: panic on non-transient errors. // std.time.sleep(backoff[retries] * std.time.ns_per_ms); // if (retries < backoff.len - 1) { // retries += 1; // } // continue; // }; // } // }; while (true) { var s = connect(self.allocator, self.name, self.oauth) catch { // TODO: panic on non-transient errors. std.time.sleep(backoff[retries] * std.time.ns_per_ms); if (retries < backoff.len - 1) { retries += 1; } continue; }; self.socket = s; break; } } self.reader = self.socket.reader(); self.writer = self.socket.writer(); // Suspend at the end to avoid a race condition // where the check to resume a potential awaiter // (nobody should be awaiting us) might end up // reading the frame while a second reconnect // attempt is running on the same frame, causing UB. suspend { // Reset the reconnecting flag std.debug.assert(@atomicRmw( bool, &self._atomic_reconnecting, .Xchg, false, .SeqCst, )); // Unblock commands held.release(); // Notify the system all is good again self.ch.put(GlobalEventUnion{ .network = .reconnected }); // Restart the reader { // messages_frame = async self.receiveMessages(); _ = @asyncCall(messages_frame_bytes, &messages_result, receiveMessages, .{self}); } } } pub fn connect(alloc: std.mem.Allocator, name: []const u8, oauth: []const u8) !std.net.Stream { var socket = if (build_opts.local) try std.net.tcpConnectToHost(alloc, "localhost", 6667) else try std.net.tcpConnectToHost(alloc, "irc.chat.twitch.tv", 6667); errdefer socket.close(); const oua = if (build_opts.local) "foo" else oauth; try socket.writer().print( \\PASS {0s} \\NICK {1s} \\CAP REQ :twitch.tv/tags \\CAP REQ :twitch.tv/commands \\JOIN #{1s} \\ , .{ oua, name }); // TODO: read what we got back, instead of assuming that // all went well just because the bytes were shipped. return socket; }
src/Network.zig
const std = @import("std"); const VM = @import("./vm.zig").VM; const Compiler = @import("./compiler.zig").Compiler; const debug = @import("./debug.zig"); const Allocator = std.mem.Allocator; const Value = @import("./value.zig").Value; const Obj = @import("./object.zig").Obj; const Table = @import("./table.zig").Table; pub const GCAllocator = struct { vm: *VM, backing_allocator: *Allocator, allocator: Allocator, bytesAllocated: usize, nextGC: usize, const HEAP_GROW_FACTOR = 2; pub fn init(vm: *VM, backing_allocator: *Allocator) GCAllocator { return GCAllocator{ .vm = vm, .allocator = Allocator{ .allocFn = alloc, .resizeFn = resize, }, .backing_allocator = backing_allocator, .bytesAllocated = 0, .nextGC = 1024 * 1024, }; } fn alloc(allocator: *Allocator, len: usize, ptr_align: u29, len_align: u29, ret_addr: usize) std.mem.Allocator.Error![]u8 { const self = @fieldParentPtr(GCAllocator, "allocator", allocator); if ((self.bytesAllocated + len > self.nextGC) or debug.STRESS_GC) { try self.collectGarbage(); } var out = try self.backing_allocator.allocFn(self.backing_allocator, len, ptr_align, len_align, ret_addr); self.bytesAllocated += out.len; return out; } fn resize(allocator: *Allocator, buf: []u8, buf_align: u29, new_len: usize, len_align: u29, ret_addr: usize) std.mem.Allocator.Error!usize { const self = @fieldParentPtr(GCAllocator, "allocator", allocator); if (new_len > buf.len) { if ((self.bytesAllocated + (new_len - buf.len) > self.nextGC) or debug.STRESS_GC) { try self.collectGarbage(); } } const out = try self.backing_allocator.resizeFn(self.backing_allocator, buf, buf_align, new_len, len_align, ret_addr); if (out > buf.len) { self.bytesAllocated += out - buf.len; } else { self.bytesAllocated -= buf.len - out; } return out; } fn collectGarbage(self: *GCAllocator) !void { if (debug.LOG_GC) { std.debug.warn("-- gc begin\n", .{}); } try self.markRoots(); try self.traceReferences(); self.removeUnreferencedStrings(); self.sweep(); self.nextGC = self.bytesAllocated * HEAP_GROW_FACTOR; if (debug.LOG_GC) { std.debug.warn("-- gc end\n", .{}); } } fn markRoots(self: *GCAllocator) !void { for (self.vm.stack.items) |value| { try self.markValue(value); } for (self.vm.frames.items) |frame| { try self.markObject(&frame.closure.obj); } var maybeUpvalue = self.vm.openUpvalues; while (maybeUpvalue) |upvalue| { try self.markObject(&upvalue.obj); maybeUpvalue = upvalue.next; } try self.markTable(&self.vm.globals); try self.markCompilerRoots(); if (self.vm.initString) |initString| try self.markObject(&initString.obj); } fn traceReferences(self: *GCAllocator) !void { while (self.vm.grayStack.items.len > 0) { const obj = self.vm.grayStack.pop(); try self.blackenObject(obj); } } fn removeUnreferencedStrings(self: *GCAllocator) void { for (self.vm.strings.entries) |*entry| { if (entry.key) |key| { if (!key.obj.isMarked) { _ = self.vm.strings.delete(key); } } } } fn sweep(self: *GCAllocator) void { var previous: ?*Obj = null; var maybeObject = self.vm.objects; while (maybeObject) |object| { if (object.isMarked) { object.isMarked = false; previous = object; maybeObject = object.next; } else { const unreached = object; maybeObject = object.next; if (previous) |p| { p.next = maybeObject; } else { self.vm.objects = maybeObject; } unreached.destroy(self.vm); } } } fn blackenObject(self: *GCAllocator, obj: *Obj) !void { if (debug.LOG_GC) { std.debug.warn("{} blacken {}\n", .{ @ptrToInt(obj), obj.value() }); } switch (obj.objType) { .Upvalue => try self.markValue(obj.asUpvalue().closed), .Function => { const function = obj.asFunction(); if (function.name) |name| try self.markObject(&name.obj); try self.markArray(function.chunk.constants.items); }, .Closure => { const closure = obj.asClosure(); try self.markObject(&closure.function.obj); for (closure.upvalues) |maybeUpvalue| { if (maybeUpvalue) |upvalue| { try self.markObject(&upvalue.obj); } } }, .Class => { const class = obj.asClass(); try self.markObject(&class.name.obj); try self.markTable(&class.methods); }, .Instance => { const instance = obj.asInstance(); try self.markObject(&instance.class.obj); try self.markTable(&instance.fields); }, .BoundMethod => { const bound = obj.asBoundMethod(); try self.markValue(bound.receiver); try self.markObject(&bound.method.obj); }, .NativeFunction, .String => {}, } } fn markArray(self: *GCAllocator, values: []Value) !void { for (values) |value| try self.markValue(value); } fn markValue(self: *GCAllocator, value: Value) !void { if (value.isObj()) try self.markObject(value.asObj()); } fn markObject(self: *GCAllocator, obj: *Obj) !void { if (obj.isMarked) return; if (debug.LOG_GC) { std.debug.warn("{} mark {}\n", .{ @ptrToInt(obj), obj.value() }); } obj.isMarked = true; try self.vm.grayStack.append(obj); } fn markTable(self: *GCAllocator, table: *Table) !void { for (table.entries) |entry| { if (entry.key) |key| try self.markObject(&key.obj); try self.markValue(entry.value); } } fn markCompilerRoots(self: *GCAllocator) !void { if (self.vm.parser) |parser| { var maybeCompiler: ?*Compiler = parser.compiler; while (maybeCompiler) |compiler| { try self.markObject(&compiler.function.obj); maybeCompiler = compiler.enclosing; } } } };
src/memory.zig
pub const FACILITY_EAP_MESSAGE = @as(u32, 2114); pub const EAP_GROUP_MASK = @as(i32, 65280); pub const EAP_E_EAPHOST_FIRST = @as(i32, -2143158272); pub const EAP_E_EAPHOST_LAST = @as(i32, -2143158017); pub const EAP_I_EAPHOST_FIRST = @as(i32, -2143158272); pub const EAP_I_EAPHOST_LAST = @as(i32, -2143158017); pub const EAP_E_CERT_STORE_INACCESSIBLE = @as(u32, 2151809040); pub const EAP_E_EAPHOST_METHOD_NOT_INSTALLED = @as(u32, 2151809041); pub const EAP_E_EAPHOST_THIRDPARTY_METHOD_HOST_RESET = @as(u32, 2151809042); pub const EAP_E_EAPHOST_EAPQEC_INACCESSIBLE = @as(u32, 2151809043); pub const EAP_E_EAPHOST_IDENTITY_UNKNOWN = @as(u32, 2151809044); pub const EAP_E_AUTHENTICATION_FAILED = @as(u32, 2151809045); pub const EAP_I_EAPHOST_EAP_NEGOTIATION_FAILED = @as(u32, 1078067222); pub const EAP_E_EAPHOST_METHOD_INVALID_PACKET = @as(u32, 2151809047); pub const EAP_E_EAPHOST_REMOTE_INVALID_PACKET = @as(u32, 2151809048); pub const EAP_E_EAPHOST_XML_MALFORMED = @as(u32, 2151809049); pub const EAP_E_METHOD_CONFIG_DOES_NOT_SUPPORT_SSO = @as(u32, 2151809050); pub const EAP_E_EAPHOST_METHOD_OPERATION_NOT_SUPPORTED = @as(u32, 2151809056); pub const EAP_E_USER_FIRST = @as(i32, -2143158016); pub const EAP_E_USER_LAST = @as(i32, -2143157761); pub const EAP_I_USER_FIRST = @as(i32, 1078067456); pub const EAP_I_USER_LAST = @as(i32, 1078067711); pub const EAP_E_USER_CERT_NOT_FOUND = @as(u32, 2151809280); pub const EAP_E_USER_CERT_INVALID = @as(u32, 2151809281); pub const EAP_E_USER_CERT_EXPIRED = @as(u32, 2151809282); pub const EAP_E_USER_CERT_REVOKED = @as(u32, 2151809283); pub const EAP_E_USER_CERT_OTHER_ERROR = @as(u32, 2151809284); pub const EAP_E_USER_CERT_REJECTED = @as(u32, 2151809285); pub const EAP_I_USER_ACCOUNT_OTHER_ERROR = @as(u32, 1078067472); pub const EAP_E_USER_CREDENTIALS_REJECTED = @as(u32, 2151809297); pub const EAP_E_USER_NAME_PASSWORD_REJECTED = @as(u32, 2151809298); pub const EAP_E_NO_SMART_CARD_READER = @as(u32, 2151809299); pub const EAP_E_SERVER_FIRST = @as(i32, -2143157760); pub const EAP_E_SERVER_LAST = @as(i32, -2143157505); pub const EAP_E_SERVER_CERT_NOT_FOUND = @as(u32, 2151809536); pub const EAP_E_SERVER_CERT_INVALID = @as(u32, 2151809537); pub const EAP_E_SERVER_CERT_EXPIRED = @as(u32, 2151809538); pub const EAP_E_SERVER_CERT_REVOKED = @as(u32, 2151809539); pub const EAP_E_SERVER_CERT_OTHER_ERROR = @as(u32, 2151809540); pub const EAP_E_USER_ROOT_CERT_FIRST = @as(i32, -2143157504); pub const EAP_E_USER_ROOT_CERT_LAST = @as(i32, -2143157249); pub const EAP_E_USER_ROOT_CERT_NOT_FOUND = @as(u32, 2151809792); pub const EAP_E_USER_ROOT_CERT_INVALID = @as(u32, 2151809793); pub const EAP_E_USER_ROOT_CERT_EXPIRED = @as(u32, 2151809794); pub const EAP_E_SERVER_ROOT_CERT_FIRST = @as(i32, -2143157248); pub const EAP_E_SERVER_ROOT_CERT_LAST = @as(i32, -2143156993); pub const EAP_E_SERVER_ROOT_CERT_NOT_FOUND = @as(u32, 2151810048); pub const EAP_E_SERVER_ROOT_CERT_INVALID = @as(u32, 2151810049); pub const EAP_E_SERVER_ROOT_CERT_NAME_REQUIRED = @as(u32, 2151810054); pub const EAP_E_SIM_NOT_VALID = @as(u32, 2151810304); pub const EAP_METHOD_INVALID_PACKET = @as(u32, 2151809047); pub const EAP_INVALID_PACKET = @as(u32, 2151809048); pub const EAP_PEER_FLAG_GUEST_ACCESS = @as(u32, 64); pub const EAP_FLAG_Reserved1 = @as(u32, 1); pub const EAP_FLAG_NON_INTERACTIVE = @as(u32, 2); pub const EAP_FLAG_LOGON = @as(u32, 4); pub const EAP_FLAG_PREVIEW = @as(u32, 8); pub const EAP_FLAG_Reserved2 = @as(u32, 16); pub const EAP_FLAG_MACHINE_AUTH = @as(u32, 32); pub const EAP_FLAG_GUEST_ACCESS = @as(u32, 64); pub const EAP_FLAG_Reserved3 = @as(u32, 128); pub const EAP_FLAG_Reserved4 = @as(u32, 256); pub const EAP_FLAG_RESUME_FROM_HIBERNATE = @as(u32, 512); pub const EAP_FLAG_Reserved5 = @as(u32, 1024); pub const EAP_FLAG_Reserved6 = @as(u32, 2048); pub const EAP_FLAG_FULL_AUTH = @as(u32, 4096); pub const EAP_FLAG_PREFER_ALT_CREDENTIALS = @as(u32, 8192); pub const EAP_FLAG_Reserved7 = @as(u32, 16384); pub const EAP_PEER_FLAG_HEALTH_STATE_CHANGE = @as(u32, 32768); pub const EAP_FLAG_SUPRESS_UI = @as(u32, 65536); pub const EAP_FLAG_PRE_LOGON = @as(u32, 131072); pub const EAP_FLAG_USER_AUTH = @as(u32, 262144); pub const EAP_FLAG_CONFG_READONLY = @as(u32, 524288); pub const EAP_FLAG_Reserved8 = @as(u32, 1048576); pub const EAP_FLAG_Reserved9 = @as(u32, 4194304); pub const EAP_FLAG_VPN = @as(u32, 8388608); pub const EAP_FLAG_ONLY_EAP_TLS = @as(u32, 16777216); pub const EAP_FLAG_SERVER_VALIDATION_REQUIRED = @as(u32, 33554432); pub const EAP_CONFIG_INPUT_FIELD_PROPS_DEFAULT = @as(u32, 0); pub const EAP_CONFIG_INPUT_FIELD_PROPS_NON_DISPLAYABLE = @as(u32, 1); pub const EAP_CONFIG_INPUT_FIELD_PROPS_NON_PERSIST = @as(u32, 2); pub const EAP_UI_INPUT_FIELD_PROPS_DEFAULT = @as(u32, 0); pub const EAP_UI_INPUT_FIELD_PROPS_NON_DISPLAYABLE = @as(u32, 1); pub const EAP_UI_INPUT_FIELD_PROPS_NON_PERSIST = @as(u32, 2); pub const EAP_UI_INPUT_FIELD_PROPS_READ_ONLY = @as(u32, 4); pub const EAP_CREDENTIAL_VERSION = @as(u32, 1); pub const EAP_INTERACTIVE_UI_DATA_VERSION = @as(u32, 1); pub const EAPHOST_PEER_API_VERSION = @as(u32, 1); pub const EAPHOST_METHOD_API_VERSION = @as(u32, 1); pub const MAX_EAP_CONFIG_INPUT_FIELD_LENGTH = @as(u32, 256); pub const MAX_EAP_CONFIG_INPUT_FIELD_VALUE_LENGTH = @as(u32, 1024); pub const CERTIFICATE_HASH_LENGTH = @as(u32, 20); pub const NCRYPT_PIN_CACHE_PIN_BYTE_LENGTH = @as(u32, 90); pub const EAP_METHOD_AUTHENTICATOR_CONFIG_IS_IDENTITY_PRIVACY = @as(u32, 1); pub const RAS_EAP_ROLE_AUTHENTICATOR = @as(u32, 1); pub const RAS_EAP_ROLE_AUTHENTICATEE = @as(u32, 2); pub const RAS_EAP_ROLE_EXCLUDE_IN_EAP = @as(u32, 4); pub const RAS_EAP_ROLE_EXCLUDE_IN_PEAP = @as(u32, 8); pub const RAS_EAP_ROLE_EXCLUDE_IN_VPN = @as(u32, 16); pub const EAPCODE_Request = @as(u32, 1); pub const EAPCODE_Response = @as(u32, 2); pub const EAPCODE_Success = @as(u32, 3); pub const EAPCODE_Failure = @as(u32, 4); pub const MAXEAPCODE = @as(u32, 4); pub const RAS_EAP_FLAG_ROUTER = @as(u32, 1); pub const RAS_EAP_FLAG_NON_INTERACTIVE = @as(u32, 2); pub const RAS_EAP_FLAG_LOGON = @as(u32, 4); pub const RAS_EAP_FLAG_PREVIEW = @as(u32, 8); pub const RAS_EAP_FLAG_FIRST_LINK = @as(u32, 16); pub const RAS_EAP_FLAG_MACHINE_AUTH = @as(u32, 32); pub const RAS_EAP_FLAG_GUEST_ACCESS = @as(u32, 64); pub const RAS_EAP_FLAG_8021X_AUTH = @as(u32, 128); pub const RAS_EAP_FLAG_HOSTED_IN_PEAP = @as(u32, 256); pub const RAS_EAP_FLAG_RESUME_FROM_HIBERNATE = @as(u32, 512); pub const RAS_EAP_FLAG_PEAP_UPFRONT = @as(u32, 1024); pub const RAS_EAP_FLAG_ALTERNATIVE_USER_DB = @as(u32, 2048); pub const RAS_EAP_FLAG_PEAP_FORCE_FULL_AUTH = @as(u32, 4096); pub const RAS_EAP_FLAG_PRE_LOGON = @as(u32, 131072); pub const RAS_EAP_FLAG_CONFG_READONLY = @as(u32, 524288); pub const RAS_EAP_FLAG_RESERVED = @as(u32, 1048576); pub const RAS_EAP_FLAG_SAVE_CREDMAN = @as(u32, 2097152); pub const RAS_EAP_FLAG_SERVER_VALIDATION_REQUIRED = @as(u32, 33554432); pub const GUID_EapHost_Default = Guid.initString("00000000-0000-0000-0000-000000000000"); pub const GUID_EapHost_Cause_MethodDLLNotFound = Guid.initString("9612fc67-6150-4209-a85e-a8d800000001"); pub const GUID_EapHost_Repair_ContactSysadmin = Guid.initString("9612fc67-6150-4209-a85e-a8d800000002"); pub const GUID_EapHost_Cause_CertStoreInaccessible = Guid.initString("9612fc67-6150-4209-a85e-a8d800000004"); pub const GUID_EapHost_Cause_Generic_AuthFailure = Guid.initString("9612fc67-6150-4209-a85e-a8d800000104"); pub const GUID_EapHost_Cause_IdentityUnknown = Guid.initString("9612fc67-6150-4209-a85e-a8d800000204"); pub const GUID_EapHost_Cause_SimNotValid = Guid.initString("9612fc67-6150-4209-a85e-a8d800000304"); pub const GUID_EapHost_Cause_Server_CertExpired = Guid.initString("9612fc67-6150-4209-a85e-a8d800000005"); pub const GUID_EapHost_Cause_Server_CertInvalid = Guid.initString("9612fc67-6150-4209-a85e-a8d800000006"); pub const GUID_EapHost_Cause_Server_CertNotFound = Guid.initString("9612fc67-6150-4209-a85e-a8d800000007"); pub const GUID_EapHost_Cause_Server_CertRevoked = Guid.initString("9612fc67-6150-4209-a85e-a8d800000008"); pub const GUID_EapHost_Cause_Server_CertOtherError = Guid.initString("9612fc67-6150-4209-a85e-a8d800000108"); pub const GUID_EapHost_Cause_User_CertExpired = Guid.initString("9612fc67-6150-4209-a85e-a8d800000009"); pub const GUID_EapHost_Cause_User_CertInvalid = Guid.initString("9612fc67-6150-4209-a85e-a8d80000000a"); pub const GUID_EapHost_Cause_User_CertNotFound = Guid.initString("9612fc67-6150-4209-a85e-a8d80000000b"); pub const GUID_EapHost_Cause_User_CertOtherError = Guid.initString("9612fc67-6150-4209-a85e-a8d80000000c"); pub const GUID_EapHost_Cause_User_CertRejected = Guid.initString("9612fc67-6150-4209-a85e-a8d80000000d"); pub const GUID_EapHost_Cause_User_CertRevoked = Guid.initString("9612fc67-6150-4209-a85e-a8d80000000e"); pub const GUID_EapHost_Cause_User_Account_OtherProblem = Guid.initString("9612fc67-6150-4209-a85e-a8d80000010e"); pub const GUID_EapHost_Cause_User_CredsRejected = Guid.initString("9612fc67-6150-4209-a85e-a8d80000020e"); pub const GUID_EapHost_Cause_User_Root_CertExpired = Guid.initString("9612fc67-6150-4209-a85e-a8d80000000f"); pub const GUID_EapHost_Cause_User_Root_CertInvalid = Guid.initString("9612fc67-6150-4209-a85e-a8d800000010"); pub const GUID_EapHost_Cause_User_Root_CertNotFound = Guid.initString("9612fc67-6150-4209-a85e-a8d800000011"); pub const GUID_EapHost_Cause_Server_Root_CertNameRequired = Guid.initString("9612fc67-6150-4209-a85e-a8d800000012"); pub const GUID_EapHost_Cause_Server_Root_CertNotFound = Guid.initString("9612fc67-6150-4209-a85e-a8d800000112"); pub const GUID_EapHost_Cause_ThirdPartyMethod_Host_Reset = Guid.initString("9612fc67-6150-4209-a85e-a8d800000212"); pub const GUID_EapHost_Cause_EapQecInaccessible = Guid.initString("9612fc67-6150-4209-a85e-a8d800000312"); pub const GUID_EapHost_Repair_Server_ClientSelectServerCert = Guid.initString("9612fc67-6150-4209-a85e-a8d800000018"); pub const GUID_EapHost_Repair_User_AuthFailure = Guid.initString("9612fc67-6150-4209-a85e-a8d800000019"); pub const GUID_EapHost_Repair_User_GetNewCert = Guid.initString("9612fc67-6150-4209-a85e-a8d80000001a"); pub const GUID_EapHost_Repair_User_SelectValidCert = Guid.initString("9612fc67-6150-4209-a85e-a8d80000001b"); pub const GUID_EapHost_Repair_Retry_Authentication = Guid.initString("9612fc67-6150-4209-a85e-a8d80000011b"); pub const GUID_EapHost_Cause_EapNegotiationFailed = Guid.initString("9612fc67-6150-4209-a85e-a8d80000001c"); pub const GUID_EapHost_Cause_XmlMalformed = Guid.initString("9612fc67-6150-4209-a85e-a8d80000001d"); pub const GUID_EapHost_Cause_MethodDoesNotSupportOperation = Guid.initString("9612fc67-6150-4209-a85e-a8d80000001e"); pub const GUID_EapHost_Repair_ContactAdmin_AuthFailure = Guid.initString("9612fc67-6150-4209-a85e-a8d80000001f"); pub const GUID_EapHost_Repair_ContactAdmin_IdentityUnknown = Guid.initString("9612fc67-6150-4209-a85e-a8d800000020"); pub const GUID_EapHost_Repair_ContactAdmin_NegotiationFailed = Guid.initString("9612fc67-6150-4209-a85e-a8d800000021"); pub const GUID_EapHost_Repair_ContactAdmin_MethodNotFound = Guid.initString("9612fc67-6150-4209-a85e-a8d800000022"); pub const GUID_EapHost_Repair_RestartNap = Guid.initString("9612fc67-6150-4209-a85e-a8d800000023"); pub const GUID_EapHost_Repair_ContactAdmin_CertStoreInaccessible = Guid.initString("9612fc67-6150-4209-a85e-a8d800000024"); pub const GUID_EapHost_Repair_ContactAdmin_InvalidUserAccount = Guid.initString("9612fc67-6150-4209-a85e-a8d800000025"); pub const GUID_EapHost_Repair_ContactAdmin_RootCertInvalid = Guid.initString("9612fc67-6150-4209-a85e-a8d800000026"); pub const GUID_EapHost_Repair_ContactAdmin_RootCertNotFound = Guid.initString("9612fc67-6150-4209-a85e-a8d800000027"); pub const GUID_EapHost_Repair_ContactAdmin_RootExpired = Guid.initString("9612fc67-6150-4209-a85e-a8d800000028"); pub const GUID_EapHost_Repair_ContactAdmin_CertNameAbsent = Guid.initString("9612fc67-6150-4209-a85e-a8d800000029"); pub const GUID_EapHost_Repair_ContactAdmin_NoSmartCardReader = Guid.initString("9612fc67-6150-4209-a85e-a8d80000002a"); pub const GUID_EapHost_Cause_No_SmartCardReader_Found = Guid.initString("9612fc67-6150-4209-a85e-a8d80000002b"); pub const GUID_EapHost_Repair_ContactAdmin_InvalidUserCert = Guid.initString("9612fc67-6150-4209-a85e-a8d80000002c"); pub const GUID_EapHost_Repair_Method_Not_Support_Sso = Guid.initString("9612fc67-6150-4209-a85e-a8d80000002d"); pub const GUID_EapHost_Repair_No_ValidSim_Found = Guid.initString("9612fc67-6150-4209-a85e-a8d80000002e"); pub const GUID_EapHost_Help_ObtainingCerts = Guid.initString("f535eea3-1bdd-46ca-a2fc-a6655939b7e8"); pub const GUID_EapHost_Help_Troubleshooting = Guid.initString("33307acf-0698-41ba-b014-ea0a2eb8d0a8"); pub const GUID_EapHost_Cause_Method_Config_Does_Not_Support_Sso = Guid.initString("da18bd32-004f-41fa-ae08-0bc85e5845ac"); //-------------------------------------------------------------------------------- // Section: Types (68) //-------------------------------------------------------------------------------- pub const RAS_AUTH_ATTRIBUTE_TYPE = enum(i32) { Minimum = 0, UserName = 1, UserPassword = 2, MD5CHAPPassword = 3, NASIPAddress = 4, NASPort = 5, ServiceType = 6, FramedProtocol = 7, FramedIPAddress = 8, FramedIPNetmask = 9, FramedRouting = 10, FilterId = 11, FramedMTU = 12, FramedCompression = 13, LoginIPHost = 14, LoginService = 15, LoginTCPPort = 16, Unassigned17 = 17, ReplyMessage = 18, CallbackNumber = 19, CallbackId = 20, Unassigned21 = 21, FramedRoute = 22, FramedIPXNetwork = 23, State = 24, Class = 25, VendorSpecific = 26, SessionTimeout = 27, IdleTimeout = 28, TerminationAction = 29, CalledStationId = 30, CallingStationId = 31, NASIdentifier = 32, ProxyState = 33, LoginLATService = 34, LoginLATNode = 35, LoginLATGroup = 36, FramedAppleTalkLink = 37, FramedAppleTalkNetwork = 38, FramedAppleTalkZone = 39, AcctStatusType = 40, AcctDelayTime = 41, AcctInputOctets = 42, AcctOutputOctets = 43, AcctSessionId = 44, AcctAuthentic = 45, AcctSessionTime = 46, AcctInputPackets = 47, AcctOutputPackets = 48, AcctTerminateCause = 49, AcctMultiSessionId = 50, AcctLinkCount = 51, AcctEventTimeStamp = 55, MD5CHAPChallenge = 60, NASPortType = 61, PortLimit = 62, LoginLATPort = 63, TunnelType = 64, TunnelMediumType = 65, TunnelClientEndpoint = 66, TunnelServerEndpoint = 67, ARAPPassword = 70, ARAPFeatures = 71, ARAPZoneAccess = 72, ARAPSecurity = 73, ARAPSecurityData = 74, PasswordRetry = 75, Prompt = 76, ConnectInfo = 77, ConfigurationToken = 78, EAPMessage = 79, Signature = 80, ARAPChallengeResponse = 84, AcctInterimInterval = 85, NASIPv6Address = 95, FramedInterfaceId = 96, FramedIPv6Prefix = 97, LoginIPv6Host = 98, FramedIPv6Route = 99, FramedIPv6Pool = 100, ARAPGuestLogon = 8096, CertificateOID = 8097, EAPConfiguration = 8098, PEAPEmbeddedEAPTypeId = 8099, // InnerEAPTypeId = 8099, this enum value conflicts with PEAPEmbeddedEAPTypeId PEAPFastRoamedSession = 8100, // FastRoamedSession = 8100, this enum value conflicts with PEAPFastRoamedSession EAPTLV = 8102, CredentialsChanged = 8103, CertificateThumbprint = 8250, PeerId = 9000, ServerId = 9001, MethodId = 9002, EMSK = 9003, SessionId = 9004, Reserved = -1, }; pub const raatMinimum = RAS_AUTH_ATTRIBUTE_TYPE.Minimum; pub const raatUserName = RAS_AUTH_ATTRIBUTE_TYPE.UserName; pub const raatUserPassword = RAS_AUTH_ATTRIBUTE_TYPE.UserPassword; pub const raatMD5CHAPPassword = RAS_AUTH_ATTRIBUTE_TYPE.MD5CHAPPassword; pub const raatNASIPAddress = RAS_AUTH_ATTRIBUTE_TYPE.NASIPAddress; pub const raatNASPort = RAS_AUTH_ATTRIBUTE_TYPE.NASPort; pub const raatServiceType = RAS_AUTH_ATTRIBUTE_TYPE.ServiceType; pub const raatFramedProtocol = RAS_AUTH_ATTRIBUTE_TYPE.FramedProtocol; pub const raatFramedIPAddress = RAS_AUTH_ATTRIBUTE_TYPE.FramedIPAddress; pub const raatFramedIPNetmask = RAS_AUTH_ATTRIBUTE_TYPE.FramedIPNetmask; pub const raatFramedRouting = RAS_AUTH_ATTRIBUTE_TYPE.FramedRouting; pub const raatFilterId = RAS_AUTH_ATTRIBUTE_TYPE.FilterId; pub const raatFramedMTU = RAS_AUTH_ATTRIBUTE_TYPE.FramedMTU; pub const raatFramedCompression = RAS_AUTH_ATTRIBUTE_TYPE.FramedCompression; pub const raatLoginIPHost = RAS_AUTH_ATTRIBUTE_TYPE.LoginIPHost; pub const raatLoginService = RAS_AUTH_ATTRIBUTE_TYPE.LoginService; pub const raatLoginTCPPort = RAS_AUTH_ATTRIBUTE_TYPE.LoginTCPPort; pub const raatUnassigned17 = RAS_AUTH_ATTRIBUTE_TYPE.Unassigned17; pub const raatReplyMessage = RAS_AUTH_ATTRIBUTE_TYPE.ReplyMessage; pub const raatCallbackNumber = RAS_AUTH_ATTRIBUTE_TYPE.CallbackNumber; pub const raatCallbackId = RAS_AUTH_ATTRIBUTE_TYPE.CallbackId; pub const raatUnassigned21 = RAS_AUTH_ATTRIBUTE_TYPE.Unassigned21; pub const raatFramedRoute = RAS_AUTH_ATTRIBUTE_TYPE.FramedRoute; pub const raatFramedIPXNetwork = RAS_AUTH_ATTRIBUTE_TYPE.FramedIPXNetwork; pub const raatState = RAS_AUTH_ATTRIBUTE_TYPE.State; pub const raatClass = RAS_AUTH_ATTRIBUTE_TYPE.Class; pub const raatVendorSpecific = RAS_AUTH_ATTRIBUTE_TYPE.VendorSpecific; pub const raatSessionTimeout = RAS_AUTH_ATTRIBUTE_TYPE.SessionTimeout; pub const raatIdleTimeout = RAS_AUTH_ATTRIBUTE_TYPE.IdleTimeout; pub const raatTerminationAction = RAS_AUTH_ATTRIBUTE_TYPE.TerminationAction; pub const raatCalledStationId = RAS_AUTH_ATTRIBUTE_TYPE.CalledStationId; pub const raatCallingStationId = RAS_AUTH_ATTRIBUTE_TYPE.CallingStationId; pub const raatNASIdentifier = RAS_AUTH_ATTRIBUTE_TYPE.NASIdentifier; pub const raatProxyState = RAS_AUTH_ATTRIBUTE_TYPE.ProxyState; pub const raatLoginLATService = RAS_AUTH_ATTRIBUTE_TYPE.LoginLATService; pub const raatLoginLATNode = RAS_AUTH_ATTRIBUTE_TYPE.LoginLATNode; pub const raatLoginLATGroup = RAS_AUTH_ATTRIBUTE_TYPE.LoginLATGroup; pub const raatFramedAppleTalkLink = RAS_AUTH_ATTRIBUTE_TYPE.FramedAppleTalkLink; pub const raatFramedAppleTalkNetwork = RAS_AUTH_ATTRIBUTE_TYPE.FramedAppleTalkNetwork; pub const raatFramedAppleTalkZone = RAS_AUTH_ATTRIBUTE_TYPE.FramedAppleTalkZone; pub const raatAcctStatusType = RAS_AUTH_ATTRIBUTE_TYPE.AcctStatusType; pub const raatAcctDelayTime = RAS_AUTH_ATTRIBUTE_TYPE.AcctDelayTime; pub const raatAcctInputOctets = RAS_AUTH_ATTRIBUTE_TYPE.AcctInputOctets; pub const raatAcctOutputOctets = RAS_AUTH_ATTRIBUTE_TYPE.AcctOutputOctets; pub const raatAcctSessionId = RAS_AUTH_ATTRIBUTE_TYPE.AcctSessionId; pub const raatAcctAuthentic = RAS_AUTH_ATTRIBUTE_TYPE.AcctAuthentic; pub const raatAcctSessionTime = RAS_AUTH_ATTRIBUTE_TYPE.AcctSessionTime; pub const raatAcctInputPackets = RAS_AUTH_ATTRIBUTE_TYPE.AcctInputPackets; pub const raatAcctOutputPackets = RAS_AUTH_ATTRIBUTE_TYPE.AcctOutputPackets; pub const raatAcctTerminateCause = RAS_AUTH_ATTRIBUTE_TYPE.AcctTerminateCause; pub const raatAcctMultiSessionId = RAS_AUTH_ATTRIBUTE_TYPE.AcctMultiSessionId; pub const raatAcctLinkCount = RAS_AUTH_ATTRIBUTE_TYPE.AcctLinkCount; pub const raatAcctEventTimeStamp = RAS_AUTH_ATTRIBUTE_TYPE.AcctEventTimeStamp; pub const raatMD5CHAPChallenge = RAS_AUTH_ATTRIBUTE_TYPE.MD5CHAPChallenge; pub const raatNASPortType = RAS_AUTH_ATTRIBUTE_TYPE.NASPortType; pub const raatPortLimit = RAS_AUTH_ATTRIBUTE_TYPE.PortLimit; pub const raatLoginLATPort = RAS_AUTH_ATTRIBUTE_TYPE.LoginLATPort; pub const raatTunnelType = RAS_AUTH_ATTRIBUTE_TYPE.TunnelType; pub const raatTunnelMediumType = RAS_AUTH_ATTRIBUTE_TYPE.TunnelMediumType; pub const raatTunnelClientEndpoint = RAS_AUTH_ATTRIBUTE_TYPE.TunnelClientEndpoint; pub const raatTunnelServerEndpoint = RAS_AUTH_ATTRIBUTE_TYPE.TunnelServerEndpoint; pub const raatARAPPassword = RAS_AUTH_ATTRIBUTE_TYPE.ARAPPassword; pub const raatARAPFeatures = RAS_AUTH_ATTRIBUTE_TYPE.ARAPFeatures; pub const raatARAPZoneAccess = RAS_AUTH_ATTRIBUTE_TYPE.ARAPZoneAccess; pub const raatARAPSecurity = RAS_AUTH_ATTRIBUTE_TYPE.ARAPSecurity; pub const raatARAPSecurityData = RAS_AUTH_ATTRIBUTE_TYPE.ARAPSecurityData; pub const raatPasswordRetry = RAS_AUTH_ATTRIBUTE_TYPE.PasswordRetry; pub const raatPrompt = RAS_AUTH_ATTRIBUTE_TYPE.Prompt; pub const raatConnectInfo = RAS_AUTH_ATTRIBUTE_TYPE.ConnectInfo; pub const raatConfigurationToken = RAS_AUTH_ATTRIBUTE_TYPE.ConfigurationToken; pub const raatEAPMessage = RAS_AUTH_ATTRIBUTE_TYPE.EAPMessage; pub const raatSignature = RAS_AUTH_ATTRIBUTE_TYPE.Signature; pub const raatARAPChallengeResponse = RAS_AUTH_ATTRIBUTE_TYPE.ARAPChallengeResponse; pub const raatAcctInterimInterval = RAS_AUTH_ATTRIBUTE_TYPE.AcctInterimInterval; pub const raatNASIPv6Address = RAS_AUTH_ATTRIBUTE_TYPE.NASIPv6Address; pub const raatFramedInterfaceId = RAS_AUTH_ATTRIBUTE_TYPE.FramedInterfaceId; pub const raatFramedIPv6Prefix = RAS_AUTH_ATTRIBUTE_TYPE.FramedIPv6Prefix; pub const raatLoginIPv6Host = RAS_AUTH_ATTRIBUTE_TYPE.LoginIPv6Host; pub const raatFramedIPv6Route = RAS_AUTH_ATTRIBUTE_TYPE.FramedIPv6Route; pub const raatFramedIPv6Pool = RAS_AUTH_ATTRIBUTE_TYPE.FramedIPv6Pool; pub const raatARAPGuestLogon = RAS_AUTH_ATTRIBUTE_TYPE.ARAPGuestLogon; pub const raatCertificateOID = RAS_AUTH_ATTRIBUTE_TYPE.CertificateOID; pub const raatEAPConfiguration = RAS_AUTH_ATTRIBUTE_TYPE.EAPConfiguration; pub const raatPEAPEmbeddedEAPTypeId = RAS_AUTH_ATTRIBUTE_TYPE.PEAPEmbeddedEAPTypeId; pub const raatInnerEAPTypeId = RAS_AUTH_ATTRIBUTE_TYPE.PEAPEmbeddedEAPTypeId; pub const raatPEAPFastRoamedSession = RAS_AUTH_ATTRIBUTE_TYPE.PEAPFastRoamedSession; pub const raatFastRoamedSession = RAS_AUTH_ATTRIBUTE_TYPE.PEAPFastRoamedSession; pub const raatEAPTLV = RAS_AUTH_ATTRIBUTE_TYPE.EAPTLV; pub const raatCredentialsChanged = RAS_AUTH_ATTRIBUTE_TYPE.CredentialsChanged; pub const raatCertificateThumbprint = RAS_AUTH_ATTRIBUTE_TYPE.CertificateThumbprint; pub const raatPeerId = RAS_AUTH_ATTRIBUTE_TYPE.PeerId; pub const raatServerId = RAS_AUTH_ATTRIBUTE_TYPE.ServerId; pub const raatMethodId = RAS_AUTH_ATTRIBUTE_TYPE.MethodId; pub const raatEMSK = RAS_AUTH_ATTRIBUTE_TYPE.EMSK; pub const raatSessionId = RAS_AUTH_ATTRIBUTE_TYPE.SessionId; pub const raatReserved = RAS_AUTH_ATTRIBUTE_TYPE.Reserved; pub const NgcTicketContext = extern struct { wszTicket: [45]u16, hKey: usize, hImpersonateToken: ?HANDLE, }; pub const RAS_AUTH_ATTRIBUTE = extern struct { raaType: RAS_AUTH_ATTRIBUTE_TYPE, dwLength: u32, Value: ?*anyopaque, }; pub const PPP_EAP_PACKET = extern struct { Code: u8, Id: u8, Length: [2]u8, Data: [1]u8, }; pub const PPP_EAP_INPUT = extern struct { dwSizeInBytes: u32, fFlags: u32, fAuthenticator: BOOL, pwszIdentity: ?PWSTR, pwszPassword: ?PWSTR, bInitialId: u8, pUserAttributes: ?*RAS_AUTH_ATTRIBUTE, fAuthenticationComplete: BOOL, dwAuthResultCode: u32, hTokenImpersonateUser: ?HANDLE, fSuccessPacketReceived: BOOL, fDataReceivedFromInteractiveUI: BOOL, pDataFromInteractiveUI: ?*u8, dwSizeOfDataFromInteractiveUI: u32, pConnectionData: ?*u8, dwSizeOfConnectionData: u32, pUserData: ?*u8, dwSizeOfUserData: u32, hReserved: ?HANDLE, guidConnectionId: Guid, isVpn: BOOL, }; pub const PPP_EAP_ACTION = enum(i32) { NoAction = 0, Authenticate = 1, Done = 2, SendAndDone = 3, Send = 4, SendWithTimeout = 5, SendWithTimeoutInteractive = 6, IndicateTLV = 7, IndicateIdentity = 8, }; pub const EAPACTION_NoAction = PPP_EAP_ACTION.NoAction; pub const EAPACTION_Authenticate = PPP_EAP_ACTION.Authenticate; pub const EAPACTION_Done = PPP_EAP_ACTION.Done; pub const EAPACTION_SendAndDone = PPP_EAP_ACTION.SendAndDone; pub const EAPACTION_Send = PPP_EAP_ACTION.Send; pub const EAPACTION_SendWithTimeout = PPP_EAP_ACTION.SendWithTimeout; pub const EAPACTION_SendWithTimeoutInteractive = PPP_EAP_ACTION.SendWithTimeoutInteractive; pub const EAPACTION_IndicateTLV = PPP_EAP_ACTION.IndicateTLV; pub const EAPACTION_IndicateIdentity = PPP_EAP_ACTION.IndicateIdentity; pub const PPP_EAP_OUTPUT = extern struct { dwSizeInBytes: u32, Action: PPP_EAP_ACTION, dwAuthResultCode: u32, pUserAttributes: ?*RAS_AUTH_ATTRIBUTE, fInvokeInteractiveUI: BOOL, pUIContextData: ?*u8, dwSizeOfUIContextData: u32, fSaveConnectionData: BOOL, pConnectionData: ?*u8, dwSizeOfConnectionData: u32, fSaveUserData: BOOL, pUserData: ?*u8, dwSizeOfUserData: u32, pNgcKerbTicket: ?*NgcTicketContext, fSaveToCredMan: BOOL, }; pub const PPP_EAP_INFO = extern struct { dwSizeInBytes: u32, dwEapTypeId: u32, RasEapInitialize: isize, RasEapBegin: isize, RasEapEnd: isize, RasEapMakeMessage: isize, }; pub const LEGACY_IDENTITY_UI_PARAMS = extern struct { eapType: u32, dwFlags: u32, dwSizeofConnectionData: u32, pConnectionData: ?*u8, dwSizeofUserData: u32, pUserData: ?*u8, dwSizeofUserDataOut: u32, pUserDataOut: ?*u8, pwszIdentity: ?PWSTR, dwError: u32, }; pub const LEGACY_INTERACTIVE_UI_PARAMS = extern struct { eapType: u32, dwSizeofContextData: u32, pContextData: ?*u8, dwSizeofInteractiveUIData: u32, pInteractiveUIData: ?*u8, dwError: u32, }; const IID_IRouterProtocolConfig_Value = Guid.initString("66a2db16-d706-11d0-a37b-00c04fc9da04"); pub const IID_IRouterProtocolConfig = &IID_IRouterProtocolConfig_Value; pub const IRouterProtocolConfig = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddProtocol: fn( self: *const IRouterProtocolConfig, pszMachineName: ?[*:0]const u16, dwTransportId: u32, dwProtocolId: u32, hWnd: ?HWND, dwFlags: u32, pRouter: ?*IUnknown, uReserved1: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveProtocol: fn( self: *const IRouterProtocolConfig, pszMachineName: ?[*:0]const u16, dwTransportId: u32, dwProtocolId: u32, hWnd: ?HWND, dwFlags: u32, pRouter: ?*IUnknown, uReserved1: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRouterProtocolConfig_AddProtocol(self: *const T, pszMachineName: ?[*:0]const u16, dwTransportId: u32, dwProtocolId: u32, hWnd: ?HWND, dwFlags: u32, pRouter: ?*IUnknown, uReserved1: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IRouterProtocolConfig.VTable, self.vtable).AddProtocol(@ptrCast(*const IRouterProtocolConfig, self), pszMachineName, dwTransportId, dwProtocolId, hWnd, dwFlags, pRouter, uReserved1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRouterProtocolConfig_RemoveProtocol(self: *const T, pszMachineName: ?[*:0]const u16, dwTransportId: u32, dwProtocolId: u32, hWnd: ?HWND, dwFlags: u32, pRouter: ?*IUnknown, uReserved1: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IRouterProtocolConfig.VTable, self.vtable).RemoveProtocol(@ptrCast(*const IRouterProtocolConfig, self), pszMachineName, dwTransportId, dwProtocolId, hWnd, dwFlags, pRouter, uReserved1); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAuthenticationProviderConfig_Value = Guid.initString("66a2db17-d706-11d0-a37b-00c04fc9da04"); pub const IID_IAuthenticationProviderConfig = &IID_IAuthenticationProviderConfig_Value; pub const IAuthenticationProviderConfig = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Initialize: fn( self: *const IAuthenticationProviderConfig, pszMachineName: ?[*:0]const u16, puConnectionParam: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Uninitialize: fn( self: *const IAuthenticationProviderConfig, uConnectionParam: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Configure: fn( self: *const IAuthenticationProviderConfig, uConnectionParam: usize, hWnd: ?HWND, dwFlags: u32, uReserved1: usize, uReserved2: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Activate: fn( self: *const IAuthenticationProviderConfig, uConnectionParam: usize, uReserved1: usize, uReserved2: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Deactivate: fn( self: *const IAuthenticationProviderConfig, uConnectionParam: usize, uReserved1: usize, uReserved2: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAuthenticationProviderConfig_Initialize(self: *const T, pszMachineName: ?[*:0]const u16, puConnectionParam: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAuthenticationProviderConfig.VTable, self.vtable).Initialize(@ptrCast(*const IAuthenticationProviderConfig, self), pszMachineName, puConnectionParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAuthenticationProviderConfig_Uninitialize(self: *const T, uConnectionParam: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAuthenticationProviderConfig.VTable, self.vtable).Uninitialize(@ptrCast(*const IAuthenticationProviderConfig, self), uConnectionParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAuthenticationProviderConfig_Configure(self: *const T, uConnectionParam: usize, hWnd: ?HWND, dwFlags: u32, uReserved1: usize, uReserved2: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAuthenticationProviderConfig.VTable, self.vtable).Configure(@ptrCast(*const IAuthenticationProviderConfig, self), uConnectionParam, hWnd, dwFlags, uReserved1, uReserved2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAuthenticationProviderConfig_Activate(self: *const T, uConnectionParam: usize, uReserved1: usize, uReserved2: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAuthenticationProviderConfig.VTable, self.vtable).Activate(@ptrCast(*const IAuthenticationProviderConfig, self), uConnectionParam, uReserved1, uReserved2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAuthenticationProviderConfig_Deactivate(self: *const T, uConnectionParam: usize, uReserved1: usize, uReserved2: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAuthenticationProviderConfig.VTable, self.vtable).Deactivate(@ptrCast(*const IAuthenticationProviderConfig, self), uConnectionParam, uReserved1, uReserved2); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAccountingProviderConfig_Value = Guid.initString("66a2db18-d706-11d0-a37b-00c04fc9da04"); pub const IID_IAccountingProviderConfig = &IID_IAccountingProviderConfig_Value; pub const IAccountingProviderConfig = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Initialize: fn( self: *const IAccountingProviderConfig, pszMachineName: ?[*:0]const u16, puConnectionParam: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Uninitialize: fn( self: *const IAccountingProviderConfig, uConnectionParam: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Configure: fn( self: *const IAccountingProviderConfig, uConnectionParam: usize, hWnd: ?HWND, dwFlags: u32, uReserved1: usize, uReserved2: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Activate: fn( self: *const IAccountingProviderConfig, uConnectionParam: usize, uReserved1: usize, uReserved2: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Deactivate: fn( self: *const IAccountingProviderConfig, uConnectionParam: usize, uReserved1: usize, uReserved2: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAccountingProviderConfig_Initialize(self: *const T, pszMachineName: ?[*:0]const u16, puConnectionParam: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAccountingProviderConfig.VTable, self.vtable).Initialize(@ptrCast(*const IAccountingProviderConfig, self), pszMachineName, puConnectionParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAccountingProviderConfig_Uninitialize(self: *const T, uConnectionParam: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAccountingProviderConfig.VTable, self.vtable).Uninitialize(@ptrCast(*const IAccountingProviderConfig, self), uConnectionParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAccountingProviderConfig_Configure(self: *const T, uConnectionParam: usize, hWnd: ?HWND, dwFlags: u32, uReserved1: usize, uReserved2: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAccountingProviderConfig.VTable, self.vtable).Configure(@ptrCast(*const IAccountingProviderConfig, self), uConnectionParam, hWnd, dwFlags, uReserved1, uReserved2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAccountingProviderConfig_Activate(self: *const T, uConnectionParam: usize, uReserved1: usize, uReserved2: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAccountingProviderConfig.VTable, self.vtable).Activate(@ptrCast(*const IAccountingProviderConfig, self), uConnectionParam, uReserved1, uReserved2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAccountingProviderConfig_Deactivate(self: *const T, uConnectionParam: usize, uReserved1: usize, uReserved2: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IAccountingProviderConfig.VTable, self.vtable).Deactivate(@ptrCast(*const IAccountingProviderConfig, self), uConnectionParam, uReserved1, uReserved2); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEAPProviderConfig_Value = Guid.initString("66a2db19-d706-11d0-a37b-00c04fc9da04"); pub const IID_IEAPProviderConfig = &IID_IEAPProviderConfig_Value; pub const IEAPProviderConfig = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Initialize: fn( self: *const IEAPProviderConfig, pszMachineName: ?[*:0]const u16, dwEapTypeId: u32, puConnectionParam: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Uninitialize: fn( self: *const IEAPProviderConfig, dwEapTypeId: u32, uConnectionParam: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ServerInvokeConfigUI: fn( self: *const IEAPProviderConfig, dwEapTypeId: u32, uConnectionParam: usize, hWnd: ?HWND, uReserved1: usize, uReserved2: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RouterInvokeConfigUI: fn( self: *const IEAPProviderConfig, dwEapTypeId: u32, uConnectionParam: usize, hwndParent: ?HWND, dwFlags: u32, pConnectionDataIn: [*:0]u8, dwSizeOfConnectionDataIn: u32, ppConnectionDataOut: [*]?*u8, pdwSizeOfConnectionDataOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RouterInvokeCredentialsUI: fn( self: *const IEAPProviderConfig, dwEapTypeId: u32, uConnectionParam: usize, hwndParent: ?HWND, dwFlags: u32, pConnectionDataIn: [*:0]u8, dwSizeOfConnectionDataIn: u32, pUserDataIn: [*:0]u8, dwSizeOfUserDataIn: u32, ppUserDataOut: [*]?*u8, pdwSizeOfUserDataOut: ?*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 IEAPProviderConfig_Initialize(self: *const T, pszMachineName: ?[*:0]const u16, dwEapTypeId: u32, puConnectionParam: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IEAPProviderConfig.VTable, self.vtable).Initialize(@ptrCast(*const IEAPProviderConfig, self), pszMachineName, dwEapTypeId, puConnectionParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEAPProviderConfig_Uninitialize(self: *const T, dwEapTypeId: u32, uConnectionParam: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IEAPProviderConfig.VTable, self.vtable).Uninitialize(@ptrCast(*const IEAPProviderConfig, self), dwEapTypeId, uConnectionParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEAPProviderConfig_ServerInvokeConfigUI(self: *const T, dwEapTypeId: u32, uConnectionParam: usize, hWnd: ?HWND, uReserved1: usize, uReserved2: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IEAPProviderConfig.VTable, self.vtable).ServerInvokeConfigUI(@ptrCast(*const IEAPProviderConfig, self), dwEapTypeId, uConnectionParam, hWnd, uReserved1, uReserved2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEAPProviderConfig_RouterInvokeConfigUI(self: *const T, dwEapTypeId: u32, uConnectionParam: usize, hwndParent: ?HWND, dwFlags: u32, pConnectionDataIn: [*:0]u8, dwSizeOfConnectionDataIn: u32, ppConnectionDataOut: [*]?*u8, pdwSizeOfConnectionDataOut: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEAPProviderConfig.VTable, self.vtable).RouterInvokeConfigUI(@ptrCast(*const IEAPProviderConfig, self), dwEapTypeId, uConnectionParam, hwndParent, dwFlags, pConnectionDataIn, dwSizeOfConnectionDataIn, ppConnectionDataOut, pdwSizeOfConnectionDataOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEAPProviderConfig_RouterInvokeCredentialsUI(self: *const T, dwEapTypeId: u32, uConnectionParam: usize, hwndParent: ?HWND, dwFlags: u32, pConnectionDataIn: [*:0]u8, dwSizeOfConnectionDataIn: u32, pUserDataIn: [*:0]u8, dwSizeOfUserDataIn: u32, ppUserDataOut: [*]?*u8, pdwSizeOfUserDataOut: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEAPProviderConfig.VTable, self.vtable).RouterInvokeCredentialsUI(@ptrCast(*const IEAPProviderConfig, self), dwEapTypeId, uConnectionParam, hwndParent, dwFlags, pConnectionDataIn, dwSizeOfConnectionDataIn, pUserDataIn, dwSizeOfUserDataIn, ppUserDataOut, pdwSizeOfUserDataOut); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IEAPProviderConfig2_Value = Guid.initString("d565917a-85c4-4466-856e-671c3742ea9a"); pub const IID_IEAPProviderConfig2 = &IID_IEAPProviderConfig2_Value; pub const IEAPProviderConfig2 = extern struct { pub const VTable = extern struct { base: IEAPProviderConfig.VTable, ServerInvokeConfigUI2: fn( self: *const IEAPProviderConfig2, dwEapTypeId: u32, uConnectionParam: usize, hWnd: ?HWND, pConfigDataIn: ?*const u8, dwSizeOfConfigDataIn: u32, ppConfigDataOut: ?*?*u8, pdwSizeOfConfigDataOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGlobalConfig: fn( self: *const IEAPProviderConfig2, dwEapTypeId: u32, ppConfigDataOut: ?*?*u8, pdwSizeOfConfigDataOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IEAPProviderConfig.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEAPProviderConfig2_ServerInvokeConfigUI2(self: *const T, dwEapTypeId: u32, uConnectionParam: usize, hWnd: ?HWND, pConfigDataIn: ?*const u8, dwSizeOfConfigDataIn: u32, ppConfigDataOut: ?*?*u8, pdwSizeOfConfigDataOut: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEAPProviderConfig2.VTable, self.vtable).ServerInvokeConfigUI2(@ptrCast(*const IEAPProviderConfig2, self), dwEapTypeId, uConnectionParam, hWnd, pConfigDataIn, dwSizeOfConfigDataIn, ppConfigDataOut, pdwSizeOfConfigDataOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEAPProviderConfig2_GetGlobalConfig(self: *const T, dwEapTypeId: u32, ppConfigDataOut: ?*?*u8, pdwSizeOfConfigDataOut: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEAPProviderConfig2.VTable, self.vtable).GetGlobalConfig(@ptrCast(*const IEAPProviderConfig2, self), dwEapTypeId, ppConfigDataOut, pdwSizeOfConfigDataOut); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IEAPProviderConfig3_Value = Guid.initString("b78ecd12-68bb-4f86-9bf0-8438dd3be982"); pub const IID_IEAPProviderConfig3 = &IID_IEAPProviderConfig3_Value; pub const IEAPProviderConfig3 = extern struct { pub const VTable = extern struct { base: IEAPProviderConfig2.VTable, ServerInvokeCertificateConfigUI: fn( self: *const IEAPProviderConfig3, dwEapTypeId: u32, uConnectionParam: usize, hWnd: ?HWND, pConfigDataIn: ?*const u8, dwSizeOfConfigDataIn: u32, ppConfigDataOut: ?*?*u8, pdwSizeOfConfigDataOut: ?*u32, uReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IEAPProviderConfig2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEAPProviderConfig3_ServerInvokeCertificateConfigUI(self: *const T, dwEapTypeId: u32, uConnectionParam: usize, hWnd: ?HWND, pConfigDataIn: ?*const u8, dwSizeOfConfigDataIn: u32, ppConfigDataOut: ?*?*u8, pdwSizeOfConfigDataOut: ?*u32, uReserved: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IEAPProviderConfig3.VTable, self.vtable).ServerInvokeCertificateConfigUI(@ptrCast(*const IEAPProviderConfig3, self), dwEapTypeId, uConnectionParam, hWnd, pConfigDataIn, dwSizeOfConfigDataIn, ppConfigDataOut, pdwSizeOfConfigDataOut, uReserved); } };} pub usingnamespace MethodMixin(@This()); }; pub const EAP_TYPE = extern struct { type: u8, dwVendorId: u32, dwVendorType: u32, }; pub const EAP_METHOD_TYPE = extern struct { eapType: EAP_TYPE, dwAuthorId: u32, }; pub const EAP_METHOD_INFO = extern struct { eaptype: EAP_METHOD_TYPE, pwszAuthorName: ?PWSTR, pwszFriendlyName: ?PWSTR, eapProperties: u32, pInnerMethodInfo: ?*EAP_METHOD_INFO, }; pub const EAP_METHOD_INFO_EX = extern struct { eaptype: EAP_METHOD_TYPE, pwszAuthorName: ?PWSTR, pwszFriendlyName: ?PWSTR, eapProperties: u32, pInnerMethodInfoArray: ?*EAP_METHOD_INFO_ARRAY_EX, }; pub const EAP_METHOD_INFO_ARRAY = extern struct { dwNumberOfMethods: u32, pEapMethods: ?*EAP_METHOD_INFO, }; pub const EAP_METHOD_INFO_ARRAY_EX = extern struct { dwNumberOfMethods: u32, pEapMethods: ?*EAP_METHOD_INFO_EX, }; pub const EAP_ERROR = extern struct { dwWinError: u32, type: EAP_METHOD_TYPE, dwReasonCode: u32, rootCauseGuid: Guid, repairGuid: Guid, helpLinkGuid: Guid, pRootCauseString: ?PWSTR, pRepairString: ?PWSTR, }; pub const EAP_ATTRIBUTE_TYPE = enum(i32) { Minimum = 0, UserName = 1, UserPassword = 2, MD5CHAPPassword = 3, NASIPAddress = 4, NASPort = 5, ServiceType = 6, FramedProtocol = 7, FramedIPAddress = 8, FramedIPNetmask = 9, FramedRouting = 10, FilterId = 11, FramedMTU = 12, FramedCompression = 13, LoginIPHost = 14, LoginService = 15, LoginTCPPort = 16, Unassigned17 = 17, ReplyMessage = 18, CallbackNumber = 19, CallbackId = 20, Unassigned21 = 21, FramedRoute = 22, FramedIPXNetwork = 23, State = 24, Class = 25, VendorSpecific = 26, SessionTimeout = 27, IdleTimeout = 28, TerminationAction = 29, CalledStationId = 30, CallingStationId = 31, NASIdentifier = 32, ProxyState = 33, LoginLATService = 34, LoginLATNode = 35, LoginLATGroup = 36, FramedAppleTalkLink = 37, FramedAppleTalkNetwork = 38, FramedAppleTalkZone = 39, AcctStatusType = 40, AcctDelayTime = 41, AcctInputOctets = 42, AcctOutputOctets = 43, AcctSessionId = 44, AcctAuthentic = 45, AcctSessionTime = 46, AcctInputPackets = 47, AcctOutputPackets = 48, AcctTerminateCause = 49, AcctMultiSessionId = 50, AcctLinkCount = 51, AcctEventTimeStamp = 55, MD5CHAPChallenge = 60, NASPortType = 61, PortLimit = 62, LoginLATPort = 63, TunnelType = 64, TunnelMediumType = 65, TunnelClientEndpoint = 66, TunnelServerEndpoint = 67, ARAPPassword = 70, ARAPFeatures = 71, ARAPZoneAccess = 72, ARAPSecurity = 73, ARAPSecurityData = 74, PasswordRetry = 75, Prompt = 76, ConnectInfo = 77, ConfigurationToken = 78, EAPMessage = 79, Signature = 80, ARAPChallengeResponse = 84, AcctInterimInterval = 85, NASIPv6Address = 95, FramedInterfaceId = 96, FramedIPv6Prefix = 97, LoginIPv6Host = 98, FramedIPv6Route = 99, FramedIPv6Pool = 100, ARAPGuestLogon = 8096, CertificateOID = 8097, EAPConfiguration = 8098, PEAPEmbeddedEAPTypeId = 8099, PEAPFastRoamedSession = 8100, // FastRoamedSession = 8100, this enum value conflicts with PEAPFastRoamedSession EAPTLV = 8102, CredentialsChanged = 8103, InnerEapMethodType = 8104, ClearTextPassword = 8107, QuarantineSoH = 8150, CertificateThumbprint = 8250, PeerId = 9000, ServerId = 9001, MethodId = 9002, EMSK = 9003, SessionId = 9004, Reserved = -1, }; pub const eatMinimum = EAP_ATTRIBUTE_TYPE.Minimum; pub const eatUserName = EAP_ATTRIBUTE_TYPE.UserName; pub const eatUserPassword = EAP_ATTRIBUTE_TYPE.UserPassword; pub const eatMD5CHAPPassword = EAP_ATTRIBUTE_TYPE.MD5CHAPPassword; pub const eatNASIPAddress = EAP_ATTRIBUTE_TYPE.NASIPAddress; pub const eatNASPort = EAP_ATTRIBUTE_TYPE.NASPort; pub const eatServiceType = EAP_ATTRIBUTE_TYPE.ServiceType; pub const eatFramedProtocol = EAP_ATTRIBUTE_TYPE.FramedProtocol; pub const eatFramedIPAddress = EAP_ATTRIBUTE_TYPE.FramedIPAddress; pub const eatFramedIPNetmask = EAP_ATTRIBUTE_TYPE.FramedIPNetmask; pub const eatFramedRouting = EAP_ATTRIBUTE_TYPE.FramedRouting; pub const eatFilterId = EAP_ATTRIBUTE_TYPE.FilterId; pub const eatFramedMTU = EAP_ATTRIBUTE_TYPE.FramedMTU; pub const eatFramedCompression = EAP_ATTRIBUTE_TYPE.FramedCompression; pub const eatLoginIPHost = EAP_ATTRIBUTE_TYPE.LoginIPHost; pub const eatLoginService = EAP_ATTRIBUTE_TYPE.LoginService; pub const eatLoginTCPPort = EAP_ATTRIBUTE_TYPE.LoginTCPPort; pub const eatUnassigned17 = EAP_ATTRIBUTE_TYPE.Unassigned17; pub const eatReplyMessage = EAP_ATTRIBUTE_TYPE.ReplyMessage; pub const eatCallbackNumber = EAP_ATTRIBUTE_TYPE.CallbackNumber; pub const eatCallbackId = EAP_ATTRIBUTE_TYPE.CallbackId; pub const eatUnassigned21 = EAP_ATTRIBUTE_TYPE.Unassigned21; pub const eatFramedRoute = EAP_ATTRIBUTE_TYPE.FramedRoute; pub const eatFramedIPXNetwork = EAP_ATTRIBUTE_TYPE.FramedIPXNetwork; pub const eatState = EAP_ATTRIBUTE_TYPE.State; pub const eatClass = EAP_ATTRIBUTE_TYPE.Class; pub const eatVendorSpecific = EAP_ATTRIBUTE_TYPE.VendorSpecific; pub const eatSessionTimeout = EAP_ATTRIBUTE_TYPE.SessionTimeout; pub const eatIdleTimeout = EAP_ATTRIBUTE_TYPE.IdleTimeout; pub const eatTerminationAction = EAP_ATTRIBUTE_TYPE.TerminationAction; pub const eatCalledStationId = EAP_ATTRIBUTE_TYPE.CalledStationId; pub const eatCallingStationId = EAP_ATTRIBUTE_TYPE.CallingStationId; pub const eatNASIdentifier = EAP_ATTRIBUTE_TYPE.NASIdentifier; pub const eatProxyState = EAP_ATTRIBUTE_TYPE.ProxyState; pub const eatLoginLATService = EAP_ATTRIBUTE_TYPE.LoginLATService; pub const eatLoginLATNode = EAP_ATTRIBUTE_TYPE.LoginLATNode; pub const eatLoginLATGroup = EAP_ATTRIBUTE_TYPE.LoginLATGroup; pub const eatFramedAppleTalkLink = EAP_ATTRIBUTE_TYPE.FramedAppleTalkLink; pub const eatFramedAppleTalkNetwork = EAP_ATTRIBUTE_TYPE.FramedAppleTalkNetwork; pub const eatFramedAppleTalkZone = EAP_ATTRIBUTE_TYPE.FramedAppleTalkZone; pub const eatAcctStatusType = EAP_ATTRIBUTE_TYPE.AcctStatusType; pub const eatAcctDelayTime = EAP_ATTRIBUTE_TYPE.AcctDelayTime; pub const eatAcctInputOctets = EAP_ATTRIBUTE_TYPE.AcctInputOctets; pub const eatAcctOutputOctets = EAP_ATTRIBUTE_TYPE.AcctOutputOctets; pub const eatAcctSessionId = EAP_ATTRIBUTE_TYPE.AcctSessionId; pub const eatAcctAuthentic = EAP_ATTRIBUTE_TYPE.AcctAuthentic; pub const eatAcctSessionTime = EAP_ATTRIBUTE_TYPE.AcctSessionTime; pub const eatAcctInputPackets = EAP_ATTRIBUTE_TYPE.AcctInputPackets; pub const eatAcctOutputPackets = EAP_ATTRIBUTE_TYPE.AcctOutputPackets; pub const eatAcctTerminateCause = EAP_ATTRIBUTE_TYPE.AcctTerminateCause; pub const eatAcctMultiSessionId = EAP_ATTRIBUTE_TYPE.AcctMultiSessionId; pub const eatAcctLinkCount = EAP_ATTRIBUTE_TYPE.AcctLinkCount; pub const eatAcctEventTimeStamp = EAP_ATTRIBUTE_TYPE.AcctEventTimeStamp; pub const eatMD5CHAPChallenge = EAP_ATTRIBUTE_TYPE.MD5CHAPChallenge; pub const eatNASPortType = EAP_ATTRIBUTE_TYPE.NASPortType; pub const eatPortLimit = EAP_ATTRIBUTE_TYPE.PortLimit; pub const eatLoginLATPort = EAP_ATTRIBUTE_TYPE.LoginLATPort; pub const eatTunnelType = EAP_ATTRIBUTE_TYPE.TunnelType; pub const eatTunnelMediumType = EAP_ATTRIBUTE_TYPE.TunnelMediumType; pub const eatTunnelClientEndpoint = EAP_ATTRIBUTE_TYPE.TunnelClientEndpoint; pub const eatTunnelServerEndpoint = EAP_ATTRIBUTE_TYPE.TunnelServerEndpoint; pub const eatARAPPassword = EAP_ATTRIBUTE_TYPE.ARAPPassword; pub const eatARAPFeatures = EAP_ATTRIBUTE_TYPE.ARAPFeatures; pub const eatARAPZoneAccess = EAP_ATTRIBUTE_TYPE.ARAPZoneAccess; pub const eatARAPSecurity = EAP_ATTRIBUTE_TYPE.ARAPSecurity; pub const eatARAPSecurityData = EAP_ATTRIBUTE_TYPE.ARAPSecurityData; pub const eatPasswordRetry = EAP_ATTRIBUTE_TYPE.PasswordRetry; pub const eatPrompt = EAP_ATTRIBUTE_TYPE.Prompt; pub const eatConnectInfo = EAP_ATTRIBUTE_TYPE.ConnectInfo; pub const eatConfigurationToken = EAP_ATTRIBUTE_TYPE.ConfigurationToken; pub const eatEAPMessage = EAP_ATTRIBUTE_TYPE.EAPMessage; pub const eatSignature = EAP_ATTRIBUTE_TYPE.Signature; pub const eatARAPChallengeResponse = EAP_ATTRIBUTE_TYPE.ARAPChallengeResponse; pub const eatAcctInterimInterval = EAP_ATTRIBUTE_TYPE.AcctInterimInterval; pub const eatNASIPv6Address = EAP_ATTRIBUTE_TYPE.NASIPv6Address; pub const eatFramedInterfaceId = EAP_ATTRIBUTE_TYPE.FramedInterfaceId; pub const eatFramedIPv6Prefix = EAP_ATTRIBUTE_TYPE.FramedIPv6Prefix; pub const eatLoginIPv6Host = EAP_ATTRIBUTE_TYPE.LoginIPv6Host; pub const eatFramedIPv6Route = EAP_ATTRIBUTE_TYPE.FramedIPv6Route; pub const eatFramedIPv6Pool = EAP_ATTRIBUTE_TYPE.FramedIPv6Pool; pub const eatARAPGuestLogon = EAP_ATTRIBUTE_TYPE.ARAPGuestLogon; pub const eatCertificateOID = EAP_ATTRIBUTE_TYPE.CertificateOID; pub const eatEAPConfiguration = EAP_ATTRIBUTE_TYPE.EAPConfiguration; pub const eatPEAPEmbeddedEAPTypeId = EAP_ATTRIBUTE_TYPE.PEAPEmbeddedEAPTypeId; pub const eatPEAPFastRoamedSession = EAP_ATTRIBUTE_TYPE.PEAPFastRoamedSession; pub const eatFastRoamedSession = EAP_ATTRIBUTE_TYPE.PEAPFastRoamedSession; pub const eatEAPTLV = EAP_ATTRIBUTE_TYPE.EAPTLV; pub const eatCredentialsChanged = EAP_ATTRIBUTE_TYPE.CredentialsChanged; pub const eatInnerEapMethodType = EAP_ATTRIBUTE_TYPE.InnerEapMethodType; pub const eatClearTextPassword = EAP_ATTRIBUTE_TYPE.ClearTextPassword; pub const eatQuarantineSoH = EAP_ATTRIBUTE_TYPE.QuarantineSoH; pub const eatCertificateThumbprint = EAP_ATTRIBUTE_TYPE.CertificateThumbprint; pub const eatPeerId = EAP_ATTRIBUTE_TYPE.PeerId; pub const eatServerId = EAP_ATTRIBUTE_TYPE.ServerId; pub const eatMethodId = EAP_ATTRIBUTE_TYPE.MethodId; pub const eatEMSK = EAP_ATTRIBUTE_TYPE.EMSK; pub const eatSessionId = EAP_ATTRIBUTE_TYPE.SessionId; pub const eatReserved = EAP_ATTRIBUTE_TYPE.Reserved; pub const EAP_ATTRIBUTE = extern struct { eaType: EAP_ATTRIBUTE_TYPE, dwLength: u32, pValue: ?*u8, }; pub const EAP_ATTRIBUTES = extern struct { dwNumberOfAttributes: u32, pAttribs: ?*EAP_ATTRIBUTE, }; pub const EAP_CONFIG_INPUT_FIELD_TYPE = enum(i32) { InputUsername = 0, InputPassword = 1, InputNetworkUsername = 2, InputNetworkPassword = 3, InputPin = 4, InputPSK = 5, InputEdit = 6, SmartCardUsername = 7, SmartCardError = 8, }; pub const EapConfigInputUsername = EAP_CONFIG_INPUT_FIELD_TYPE.InputUsername; pub const EapConfigInputPassword = EAP_CONFIG_INPUT_FIELD_TYPE.InputPassword; pub const EapConfigInputNetworkUsername = EAP_CONFIG_INPUT_FIELD_TYPE.InputNetworkUsername; pub const EapConfigInputNetworkPassword = EAP_CONFIG_INPUT_FIELD_TYPE.InputNetworkPassword; pub const EapConfigInputPin = EAP_CONFIG_INPUT_FIELD_TYPE.InputPin; pub const EapConfigInputPSK = EAP_CONFIG_INPUT_FIELD_TYPE.InputPSK; pub const EapConfigInputEdit = EAP_CONFIG_INPUT_FIELD_TYPE.InputEdit; pub const EapConfigSmartCardUsername = EAP_CONFIG_INPUT_FIELD_TYPE.SmartCardUsername; pub const EapConfigSmartCardError = EAP_CONFIG_INPUT_FIELD_TYPE.SmartCardError; pub const EAP_CONFIG_INPUT_FIELD_DATA = extern struct { dwSize: u32, Type: EAP_CONFIG_INPUT_FIELD_TYPE, dwFlagProps: u32, pwszLabel: ?PWSTR, pwszData: ?PWSTR, dwMinDataLength: u32, dwMaxDataLength: u32, }; pub const EAP_CONFIG_INPUT_FIELD_ARRAY = extern struct { dwVersion: u32, dwNumberOfFields: u32, pFields: ?*EAP_CONFIG_INPUT_FIELD_DATA, }; pub const EAP_INTERACTIVE_UI_DATA_TYPE = enum(i32) { Req = 0, Resp = 1, ExpiryReq = 2, ExpiryResp = 3, LogonReq = 4, LogonResp = 5, }; pub const EapCredReq = EAP_INTERACTIVE_UI_DATA_TYPE.Req; pub const EapCredResp = EAP_INTERACTIVE_UI_DATA_TYPE.Resp; pub const EapCredExpiryReq = EAP_INTERACTIVE_UI_DATA_TYPE.ExpiryReq; pub const EapCredExpiryResp = EAP_INTERACTIVE_UI_DATA_TYPE.ExpiryResp; pub const EapCredLogonReq = EAP_INTERACTIVE_UI_DATA_TYPE.LogonReq; pub const EapCredLogonResp = EAP_INTERACTIVE_UI_DATA_TYPE.LogonResp; pub const EAP_CRED_EXPIRY_REQ = extern struct { curCreds: EAP_CONFIG_INPUT_FIELD_ARRAY, newCreds: EAP_CONFIG_INPUT_FIELD_ARRAY, }; pub const EAP_UI_DATA_FORMAT = extern union { credData: ?*EAP_CONFIG_INPUT_FIELD_ARRAY, credExpiryData: ?*EAP_CRED_EXPIRY_REQ, credLogonData: ?*EAP_CONFIG_INPUT_FIELD_ARRAY, }; pub const EAP_INTERACTIVE_UI_DATA = extern struct { dwVersion: u32, dwSize: u32, dwDataType: EAP_INTERACTIVE_UI_DATA_TYPE, cbUiData: u32, pbUiData: EAP_UI_DATA_FORMAT, }; pub const EAP_METHOD_PROPERTY_TYPE = enum(i32) { PropCipherSuiteNegotiation = 0, PropMutualAuth = 1, PropIntegrity = 2, PropReplayProtection = 3, PropConfidentiality = 4, PropKeyDerivation = 5, PropKeyStrength64 = 6, PropKeyStrength128 = 7, PropKeyStrength256 = 8, PropKeyStrength512 = 9, PropKeyStrength1024 = 10, PropDictionaryAttackResistance = 11, PropFastReconnect = 12, PropCryptoBinding = 13, PropSessionIndependence = 14, PropFragmentation = 15, PropChannelBinding = 16, PropNap = 17, PropStandalone = 18, PropMppeEncryption = 19, PropTunnelMethod = 20, PropSupportsConfig = 21, PropCertifiedMethod = 22, PropHiddenMethod = 23, PropMachineAuth = 24, PropUserAuth = 25, PropIdentityPrivacy = 26, PropMethodChaining = 27, PropSharedStateEquivalence = 28, LegacyMethodPropertyFlag = 31, PropVendorSpecific = 255, }; pub const emptPropCipherSuiteNegotiation = EAP_METHOD_PROPERTY_TYPE.PropCipherSuiteNegotiation; pub const emptPropMutualAuth = EAP_METHOD_PROPERTY_TYPE.PropMutualAuth; pub const emptPropIntegrity = EAP_METHOD_PROPERTY_TYPE.PropIntegrity; pub const emptPropReplayProtection = EAP_METHOD_PROPERTY_TYPE.PropReplayProtection; pub const emptPropConfidentiality = EAP_METHOD_PROPERTY_TYPE.PropConfidentiality; pub const emptPropKeyDerivation = EAP_METHOD_PROPERTY_TYPE.PropKeyDerivation; pub const emptPropKeyStrength64 = EAP_METHOD_PROPERTY_TYPE.PropKeyStrength64; pub const emptPropKeyStrength128 = EAP_METHOD_PROPERTY_TYPE.PropKeyStrength128; pub const emptPropKeyStrength256 = EAP_METHOD_PROPERTY_TYPE.PropKeyStrength256; pub const emptPropKeyStrength512 = EAP_METHOD_PROPERTY_TYPE.PropKeyStrength512; pub const emptPropKeyStrength1024 = EAP_METHOD_PROPERTY_TYPE.PropKeyStrength1024; pub const emptPropDictionaryAttackResistance = EAP_METHOD_PROPERTY_TYPE.PropDictionaryAttackResistance; pub const emptPropFastReconnect = EAP_METHOD_PROPERTY_TYPE.PropFastReconnect; pub const emptPropCryptoBinding = EAP_METHOD_PROPERTY_TYPE.PropCryptoBinding; pub const emptPropSessionIndependence = EAP_METHOD_PROPERTY_TYPE.PropSessionIndependence; pub const emptPropFragmentation = EAP_METHOD_PROPERTY_TYPE.PropFragmentation; pub const emptPropChannelBinding = EAP_METHOD_PROPERTY_TYPE.PropChannelBinding; pub const emptPropNap = EAP_METHOD_PROPERTY_TYPE.PropNap; pub const emptPropStandalone = EAP_METHOD_PROPERTY_TYPE.PropStandalone; pub const emptPropMppeEncryption = EAP_METHOD_PROPERTY_TYPE.PropMppeEncryption; pub const emptPropTunnelMethod = EAP_METHOD_PROPERTY_TYPE.PropTunnelMethod; pub const emptPropSupportsConfig = EAP_METHOD_PROPERTY_TYPE.PropSupportsConfig; pub const emptPropCertifiedMethod = EAP_METHOD_PROPERTY_TYPE.PropCertifiedMethod; pub const emptPropHiddenMethod = EAP_METHOD_PROPERTY_TYPE.PropHiddenMethod; pub const emptPropMachineAuth = EAP_METHOD_PROPERTY_TYPE.PropMachineAuth; pub const emptPropUserAuth = EAP_METHOD_PROPERTY_TYPE.PropUserAuth; pub const emptPropIdentityPrivacy = EAP_METHOD_PROPERTY_TYPE.PropIdentityPrivacy; pub const emptPropMethodChaining = EAP_METHOD_PROPERTY_TYPE.PropMethodChaining; pub const emptPropSharedStateEquivalence = EAP_METHOD_PROPERTY_TYPE.PropSharedStateEquivalence; pub const emptLegacyMethodPropertyFlag = EAP_METHOD_PROPERTY_TYPE.LegacyMethodPropertyFlag; pub const emptPropVendorSpecific = EAP_METHOD_PROPERTY_TYPE.PropVendorSpecific; pub const EAP_METHOD_PROPERTY_VALUE_TYPE = enum(i32) { Bool = 0, Dword = 1, String = 2, }; pub const empvtBool = EAP_METHOD_PROPERTY_VALUE_TYPE.Bool; pub const empvtDword = EAP_METHOD_PROPERTY_VALUE_TYPE.Dword; pub const empvtString = EAP_METHOD_PROPERTY_VALUE_TYPE.String; pub const EAP_METHOD_PROPERTY_VALUE_BOOL = extern struct { length: u32, value: BOOL, }; pub const EAP_METHOD_PROPERTY_VALUE_DWORD = extern struct { length: u32, value: u32, }; pub const EAP_METHOD_PROPERTY_VALUE_STRING = extern struct { length: u32, value: ?*u8, }; pub const EAP_METHOD_PROPERTY_VALUE = extern union { empvBool: EAP_METHOD_PROPERTY_VALUE_BOOL, empvDword: EAP_METHOD_PROPERTY_VALUE_DWORD, empvString: EAP_METHOD_PROPERTY_VALUE_STRING, }; pub const EAP_METHOD_PROPERTY = extern struct { eapMethodPropertyType: EAP_METHOD_PROPERTY_TYPE, eapMethodPropertyValueType: EAP_METHOD_PROPERTY_VALUE_TYPE, eapMethodPropertyValue: EAP_METHOD_PROPERTY_VALUE, }; pub const EAP_METHOD_PROPERTY_ARRAY = extern struct { dwNumberOfProperties: u32, pMethodProperty: ?*EAP_METHOD_PROPERTY, }; pub const EAPHOST_IDENTITY_UI_PARAMS = extern struct { eapMethodType: EAP_METHOD_TYPE, dwFlags: u32, dwSizeofConnectionData: u32, pConnectionData: ?*u8, dwSizeofUserData: u32, pUserData: ?*u8, dwSizeofUserDataOut: u32, pUserDataOut: ?*u8, pwszIdentity: ?PWSTR, dwError: u32, pEapError: ?*EAP_ERROR, }; pub const EAPHOST_INTERACTIVE_UI_PARAMS = extern struct { dwSizeofContextData: u32, pContextData: ?*u8, dwSizeofInteractiveUIData: u32, pInteractiveUIData: ?*u8, dwError: u32, pEapError: ?*EAP_ERROR, }; pub const EapCredentialType = enum(i32) { EMPTY_CREDENTIAL = 0, USERNAME_PASSWORD_CREDENTIAL = 1, WINLOGON_CREDENTIAL = 2, CERTIFICATE_CREDENTIAL = 3, SIM_CREDENTIAL = 4, }; pub const EAP_EMPTY_CREDENTIAL = EapCredentialType.EMPTY_CREDENTIAL; pub const EAP_USERNAME_PASSWORD_CREDENTIAL = EapCredentialType.USERNAME_PASSWORD_CREDENTIAL; pub const EAP_WINLOGON_CREDENTIAL = EapCredentialType.WINLOGON_CREDENTIAL; pub const EAP_CERTIFICATE_CREDENTIAL = EapCredentialType.CERTIFICATE_CREDENTIAL; pub const EAP_SIM_CREDENTIAL = EapCredentialType.SIM_CREDENTIAL; pub const EapUsernamePasswordCredential = extern struct { username: ?PWSTR, password: ?<PASSWORD>, }; pub const EapCertificateCredential = extern struct { certHash: [20]u8, password: ?<PASSWORD>, }; pub const EapSimCredential = extern struct { iccID: ?PWSTR, }; pub const EapCredentialTypeData = extern union { username_password: EapUsernamePasswordCredential, certificate: EapCertificateCredential, sim: EapSimCredential, }; pub const EapCredential = extern struct { credType: EapCredentialType, credData: EapCredentialTypeData, }; pub const EapHostPeerMethodResultReason = enum(i32) { AltSuccessReceived = 1, Timeout = 2, FromMethod = 3, }; pub const EapHostPeerMethodResultAltSuccessReceived = EapHostPeerMethodResultReason.AltSuccessReceived; pub const EapHostPeerMethodResultTimeout = EapHostPeerMethodResultReason.Timeout; pub const EapHostPeerMethodResultFromMethod = EapHostPeerMethodResultReason.FromMethod; pub const EapHostPeerResponseAction = enum(i32) { Discard = 0, Send = 1, Result = 2, InvokeUi = 3, Respond = 4, StartAuthentication = 5, None = 6, }; pub const EapHostPeerResponseDiscard = EapHostPeerResponseAction.Discard; pub const EapHostPeerResponseSend = EapHostPeerResponseAction.Send; pub const EapHostPeerResponseResult = EapHostPeerResponseAction.Result; pub const EapHostPeerResponseInvokeUi = EapHostPeerResponseAction.InvokeUi; pub const EapHostPeerResponseRespond = EapHostPeerResponseAction.Respond; pub const EapHostPeerResponseStartAuthentication = EapHostPeerResponseAction.StartAuthentication; pub const EapHostPeerResponseNone = EapHostPeerResponseAction.None; pub const EapHostPeerAuthParams = enum(i32) { PeerAuthStatus = 1, PeerIdentity = 2, PeerIdentityExtendedInfo = 3, NapInfo = 4, }; pub const EapHostPeerAuthStatus = EapHostPeerAuthParams.PeerAuthStatus; pub const EapHostPeerIdentity = EapHostPeerAuthParams.PeerIdentity; pub const EapHostPeerIdentityExtendedInfo = EapHostPeerAuthParams.PeerIdentityExtendedInfo; pub const EapHostNapInfo = EapHostPeerAuthParams.NapInfo; pub const EAPHOST_AUTH_STATUS = enum(i32) { InvalidSession = 0, AuthNotStarted = 1, AuthIdentityExchange = 2, AuthNegotiatingType = 3, AuthInProgress = 4, AuthSucceeded = 5, AuthFailed = 6, }; pub const EapHostInvalidSession = EAPHOST_AUTH_STATUS.InvalidSession; pub const EapHostAuthNotStarted = EAPHOST_AUTH_STATUS.AuthNotStarted; pub const EapHostAuthIdentityExchange = EAPHOST_AUTH_STATUS.AuthIdentityExchange; pub const EapHostAuthNegotiatingType = EAPHOST_AUTH_STATUS.AuthNegotiatingType; pub const EapHostAuthInProgress = EAPHOST_AUTH_STATUS.AuthInProgress; pub const EapHostAuthSucceeded = EAPHOST_AUTH_STATUS.AuthSucceeded; pub const EapHostAuthFailed = EAPHOST_AUTH_STATUS.AuthFailed; pub const EAPHOST_AUTH_INFO = extern struct { status: EAPHOST_AUTH_STATUS, dwErrorCode: u32, dwReasonCode: u32, }; pub const ISOLATION_STATE = enum(i32) { UNKNOWN = 0, NOT_RESTRICTED = 1, IN_PROBATION = 2, RESTRICTED_ACCESS = 3, }; pub const ISOLATION_STATE_UNKNOWN = ISOLATION_STATE.UNKNOWN; pub const ISOLATION_STATE_NOT_RESTRICTED = ISOLATION_STATE.NOT_RESTRICTED; pub const ISOLATION_STATE_IN_PROBATION = ISOLATION_STATE.IN_PROBATION; pub const ISOLATION_STATE_RESTRICTED_ACCESS = ISOLATION_STATE.RESTRICTED_ACCESS; pub const EapHostPeerMethodResult = extern struct { fIsSuccess: BOOL, dwFailureReasonCode: u32, fSaveConnectionData: BOOL, dwSizeofConnectionData: u32, pConnectionData: ?*u8, fSaveUserData: BOOL, dwSizeofUserData: u32, pUserData: ?*u8, pAttribArray: ?*EAP_ATTRIBUTES, isolationState: ISOLATION_STATE, pEapMethodInfo: ?*EAP_METHOD_INFO, pEapError: ?*EAP_ERROR, }; pub const EapPacket = extern struct { Code: u8, Id: u8, Length: [2]u8, Data: [1]u8, }; pub const EapCode = enum(i32) { Minimum = 1, // Request = 1, this enum value conflicts with Minimum Response = 2, Success = 3, Failure = 4, // Maximum = 4, this enum value conflicts with Failure }; pub const EapCodeMinimum = EapCode.Minimum; pub const EapCodeRequest = EapCode.Minimum; pub const EapCodeResponse = EapCode.Response; pub const EapCodeSuccess = EapCode.Success; pub const EapCodeFailure = EapCode.Failure; pub const EapCodeMaximum = EapCode.Failure; pub const NotificationHandler = fn( connectionId: Guid, pContextData: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const EAP_METHOD_AUTHENTICATOR_RESPONSE_ACTION = enum(i32) { DISCARD = 0, SEND = 1, RESULT = 2, RESPOND = 3, AUTHENTICATE = 4, HANDLE_IDENTITY = 5, }; pub const EAP_METHOD_AUTHENTICATOR_RESPONSE_DISCARD = EAP_METHOD_AUTHENTICATOR_RESPONSE_ACTION.DISCARD; pub const EAP_METHOD_AUTHENTICATOR_RESPONSE_SEND = EAP_METHOD_AUTHENTICATOR_RESPONSE_ACTION.SEND; pub const EAP_METHOD_AUTHENTICATOR_RESPONSE_RESULT = EAP_METHOD_AUTHENTICATOR_RESPONSE_ACTION.RESULT; pub const EAP_METHOD_AUTHENTICATOR_RESPONSE_RESPOND = EAP_METHOD_AUTHENTICATOR_RESPONSE_ACTION.RESPOND; pub const EAP_METHOD_AUTHENTICATOR_RESPONSE_AUTHENTICATE = EAP_METHOD_AUTHENTICATOR_RESPONSE_ACTION.AUTHENTICATE; pub const EAP_METHOD_AUTHENTICATOR_RESPONSE_HANDLE_IDENTITY = EAP_METHOD_AUTHENTICATOR_RESPONSE_ACTION.HANDLE_IDENTITY; pub const EAP_METHOD_AUTHENTICATOR_RESULT = extern struct { fIsSuccess: BOOL, dwFailureReason: u32, pAuthAttribs: ?*EAP_ATTRIBUTES, }; pub const EapPeerMethodResponseAction = enum(i32) { Discard = 0, Send = 1, Result = 2, InvokeUI = 3, Respond = 4, None = 5, }; pub const EapPeerMethodResponseActionDiscard = EapPeerMethodResponseAction.Discard; pub const EapPeerMethodResponseActionSend = EapPeerMethodResponseAction.Send; pub const EapPeerMethodResponseActionResult = EapPeerMethodResponseAction.Result; pub const EapPeerMethodResponseActionInvokeUI = EapPeerMethodResponseAction.InvokeUI; pub const EapPeerMethodResponseActionRespond = EapPeerMethodResponseAction.Respond; pub const EapPeerMethodResponseActionNone = EapPeerMethodResponseAction.None; pub const EapPeerMethodOutput = extern struct { action: EapPeerMethodResponseAction, fAllowNotifications: BOOL, }; pub const EapPeerMethodResultReason = enum(i32) { Unknown = 1, Success = 2, Failure = 3, }; pub const EapPeerMethodResultUnknown = EapPeerMethodResultReason.Unknown; pub const EapPeerMethodResultSuccess = EapPeerMethodResultReason.Success; pub const EapPeerMethodResultFailure = EapPeerMethodResultReason.Failure; pub const EapPeerMethodResult = extern struct { fIsSuccess: BOOL, dwFailureReasonCode: u32, fSaveConnectionData: BOOL, dwSizeofConnectionData: u32, pConnectionData: ?*u8, fSaveUserData: BOOL, dwSizeofUserData: u32, pUserData: ?*u8, pAttribArray: ?*EAP_ATTRIBUTES, pEapError: ?*EAP_ERROR, pNgcKerbTicket: ?*NgcTicketContext, fSaveToCredMan: BOOL, }; pub const EAP_PEER_METHOD_ROUTINES = extern struct { dwVersion: u32, pEapType: ?*EAP_TYPE, EapPeerInitialize: isize, EapPeerGetIdentity: isize, EapPeerBeginSession: isize, EapPeerSetCredentials: isize, EapPeerProcessRequestPacket: isize, EapPeerGetResponsePacket: isize, EapPeerGetResult: isize, EapPeerGetUIContext: isize, EapPeerSetUIContext: isize, EapPeerGetResponseAttributes: isize, EapPeerSetResponseAttributes: isize, EapPeerEndSession: isize, EapPeerShutdown: isize, }; pub const EAP_AUTHENTICATOR_SEND_TIMEOUT = enum(i32) { NONE = 0, BASIC = 1, INTERACTIVE = 2, }; pub const EAP_AUTHENTICATOR_SEND_TIMEOUT_NONE = EAP_AUTHENTICATOR_SEND_TIMEOUT.NONE; pub const EAP_AUTHENTICATOR_SEND_TIMEOUT_BASIC = EAP_AUTHENTICATOR_SEND_TIMEOUT.BASIC; pub const EAP_AUTHENTICATOR_SEND_TIMEOUT_INTERACTIVE = EAP_AUTHENTICATOR_SEND_TIMEOUT.INTERACTIVE; pub const EAP_AUTHENTICATOR_METHOD_ROUTINES = extern struct { dwSizeInBytes: u32, pEapType: ?*EAP_METHOD_TYPE, EapMethodAuthenticatorInitialize: isize, EapMethodAuthenticatorBeginSession: isize, EapMethodAuthenticatorUpdateInnerMethodParams: isize, EapMethodAuthenticatorReceivePacket: isize, EapMethodAuthenticatorSendPacket: isize, EapMethodAuthenticatorGetAttributes: isize, EapMethodAuthenticatorSetAttributes: isize, EapMethodAuthenticatorGetResult: isize, EapMethodAuthenticatorEndSession: isize, EapMethodAuthenticatorShutdown: isize, }; //-------------------------------------------------------------------------------- // Section: Functions (32) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerGetMethods( pEapMethodInfoArray: ?*EAP_METHOD_INFO_ARRAY, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.1' pub extern "eappcfg" fn EapHostPeerGetMethodProperties( dwVersion: u32, dwFlags: u32, eapMethodType: EAP_METHOD_TYPE, hUserImpersonationToken: ?HANDLE, dwEapConnDataSize: u32, pbEapConnData: [*:0]const u8, dwUserDataSize: u32, pbUserData: [*:0]const u8, pMethodPropertyArray: ?*EAP_METHOD_PROPERTY_ARRAY, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerInvokeConfigUI( hwndParent: ?HWND, dwFlags: u32, eapMethodType: EAP_METHOD_TYPE, dwSizeOfConfigIn: u32, pConfigIn: ?[*:0]const u8, pdwSizeOfConfigOut: ?*u32, ppConfigOut: ?*?*u8, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerQueryCredentialInputFields( hUserImpersonationToken: ?HANDLE, eapMethodType: EAP_METHOD_TYPE, dwFlags: u32, dwEapConnDataSize: u32, pbEapConnData: [*:0]const u8, pEapConfigInputFieldArray: ?*EAP_CONFIG_INPUT_FIELD_ARRAY, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerQueryUserBlobFromCredentialInputFields( hUserImpersonationToken: ?HANDLE, eapMethodType: EAP_METHOD_TYPE, dwFlags: u32, dwEapConnDataSize: u32, pbEapConnData: [*:0]const u8, pEapConfigInputFieldArray: ?*const EAP_CONFIG_INPUT_FIELD_ARRAY, pdwUserBlobSize: ?*u32, ppbUserBlob: [*]?*u8, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerInvokeIdentityUI( dwVersion: u32, eapMethodType: EAP_METHOD_TYPE, dwFlags: u32, hwndParent: ?HWND, dwSizeofConnectionData: u32, pConnectionData: [*:0]const u8, dwSizeofUserData: u32, pUserData: ?[*:0]const u8, pdwSizeOfUserDataOut: ?*u32, ppUserDataOut: ?*?*u8, ppwszIdentity: ?*?PWSTR, ppEapError: ?*?*EAP_ERROR, ppvReserved: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerInvokeInteractiveUI( hwndParent: ?HWND, dwSizeofUIContextData: u32, pUIContextData: ?[*:0]const u8, pdwSizeOfDataFromInteractiveUI: ?*u32, ppDataFromInteractiveUI: ?*?*u8, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerQueryInteractiveUIInputFields( dwVersion: u32, dwFlags: u32, dwSizeofUIContextData: u32, pUIContextData: [*:0]const u8, pEapInteractiveUIData: ?*EAP_INTERACTIVE_UI_DATA, ppEapError: ?*?*EAP_ERROR, ppvReserved: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerQueryUIBlobFromInteractiveUIInputFields( dwVersion: u32, dwFlags: u32, dwSizeofUIContextData: u32, pUIContextData: [*:0]const u8, pEapInteractiveUIData: ?*const EAP_INTERACTIVE_UI_DATA, pdwSizeOfDataFromInteractiveUI: ?*u32, ppDataFromInteractiveUI: ?*?*u8, ppEapError: ?*?*EAP_ERROR, ppvReserved: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerConfigXml2Blob( dwFlags: u32, pConfigDoc: ?*IXMLDOMNode, pdwSizeOfConfigOut: ?*u32, ppConfigOut: ?*?*u8, pEapMethodType: ?*EAP_METHOD_TYPE, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerCredentialsXml2Blob( dwFlags: u32, pCredentialsDoc: ?*IXMLDOMNode, dwSizeOfConfigIn: u32, pConfigIn: [*:0]u8, pdwSizeOfCredentialsOut: ?*u32, ppCredentialsOut: ?*?*u8, pEapMethodType: ?*EAP_METHOD_TYPE, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerConfigBlob2Xml( dwFlags: u32, eapMethodType: EAP_METHOD_TYPE, dwSizeOfConfigIn: u32, pConfigIn: [*:0]u8, ppConfigDoc: ?*?*IXMLDOMDocument2, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerFreeMemory( pData: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappcfg" fn EapHostPeerFreeErrorMemory( pEapError: ?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerInitialize( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerUninitialize( ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerBeginSession( dwFlags: u32, eapType: EAP_METHOD_TYPE, pAttributeArray: ?*const EAP_ATTRIBUTES, hTokenImpersonateUser: ?HANDLE, dwSizeofConnectionData: u32, pConnectionData: ?*const u8, dwSizeofUserData: u32, pUserData: ?*const u8, dwMaxSendPacketSize: u32, pConnectionId: ?*const Guid, func: ?NotificationHandler, pContextData: ?*anyopaque, pSessionId: ?*u32, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerProcessReceivedPacket( sessionHandle: u32, cbReceivePacket: u32, pReceivePacket: ?*const u8, pEapOutput: ?*EapHostPeerResponseAction, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerGetSendPacket( sessionHandle: u32, pcbSendPacket: ?*u32, ppSendPacket: ?*?*u8, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerGetResult( sessionHandle: u32, reason: EapHostPeerMethodResultReason, ppResult: ?*EapHostPeerMethodResult, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerGetUIContext( sessionHandle: u32, pdwSizeOfUIContextData: ?*u32, ppUIContextData: ?*?*u8, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerSetUIContext( sessionHandle: u32, dwSizeOfUIContextData: u32, pUIContextData: ?*const u8, pEapOutput: ?*EapHostPeerResponseAction, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerGetResponseAttributes( sessionHandle: u32, pAttribs: ?*EAP_ATTRIBUTES, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerSetResponseAttributes( sessionHandle: u32, pAttribs: ?*const EAP_ATTRIBUTES, pEapOutput: ?*EapHostPeerResponseAction, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerGetAuthStatus( sessionHandle: u32, authParam: EapHostPeerAuthParams, pcbAuthData: ?*u32, ppAuthData: ?*?*u8, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerEndSession( sessionHandle: u32, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "eappprxy" fn EapHostPeerGetDataToUnplumbCredentials( pConnectionIdThatLastSavedCreds: ?*Guid, phCredentialImpersonationToken: ?*isize, sessionHandle: u32, ppEapError: ?*?*EAP_ERROR, fSaveToCredMan: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerClearConnection( pConnectionId: ?*Guid, ppEapError: ?*?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerFreeEapError( pEapError: ?*EAP_ERROR, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerGetIdentity( dwVersion: u32, dwFlags: u32, eapMethodType: EAP_METHOD_TYPE, dwSizeofConnectionData: u32, pConnectionData: [*:0]const u8, dwSizeofUserData: u32, pUserData: ?[*:0]const u8, hTokenImpersonateUser: ?HANDLE, pfInvokeUI: ?*BOOL, pdwSizeOfUserDataOut: ?*u32, ppUserDataOut: ?*?*u8, ppwszIdentity: ?*?PWSTR, ppEapError: ?*?*EAP_ERROR, ppvReserved: ?*?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "eappprxy" fn EapHostPeerGetEncryptedPassword( dwSizeofPassword: u32, // TODO: what to do with BytesParamIndex 0? szPassword: ?PWSTR, ppszEncPassword: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "eappprxy" fn EapHostPeerFreeRuntimeMemory( pData: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (9) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const HANDLE = @import("../foundation.zig").HANDLE; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const IUnknown = @import("../system/com.zig").IUnknown; const IXMLDOMDocument2 = @import("../data/xml/ms_xml.zig").IXMLDOMDocument2; const IXMLDOMNode = @import("../data/xml/ms_xml.zig").IXMLDOMNode; const PWSTR = @import("../foundation.zig").PWSTR; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "NotificationHandler")) { _ = NotificationHandler; } @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/extensible_authentication_protocol.zig
const std = @import("std"); const testing = std.testing; const allocator = std.testing.allocator; // TIMES // // Dijkstra optimized: // part 1: 0.037 seconds (answer: 707) // part 2: 0.719 seconds (answer: 2942) // // A*: // part 1: 0.052 seconds (answer: 707) // part 2: 1.034 seconds (answer: 2942) pub const Map = struct { pub const Mode = enum { Small, Large }; pub const Algo = enum { Dijkstra, AStar }; const Pos = struct { x: usize, y: usize, pub fn init(x: usize, y: usize) Pos { var self = Pos{ .x = x, .y = y }; return self; } pub fn deinit(_: *Pos) void {} pub fn equal(self: Pos, other: Pos) bool { return self.x == other.x and self.y == other.y; } }; const Node = struct { pos: Pos, cost: usize, pub fn init(pos: Pos, cost: usize) Node { var self = Node{ .pos = pos, .cost = cost }; return self; } fn lessThan(l: Node, r: Node) std.math.Order { return std.math.order(l.cost, r.cost); } }; const Dir = enum { N, S, E, W }; const Path = std.AutoHashMap(Pos, Node); mode: Mode, algo: Algo, enlarged: bool, width: usize, height: usize, grid: std.AutoHashMap(Pos, usize), pub fn init(mode: Mode, algo: Algo) Map { var self = Map{ .mode = mode, .algo = algo, .enlarged = false, .width = 0, .height = 0, .grid = std.AutoHashMap(Pos, usize).init(allocator), }; return self; } pub fn deinit(self: *Map) void { self.grid.deinit(); } pub fn process_line(self: *Map, data: []const u8) !void { if (self.width == 0) self.width = data.len; if (self.width != data.len) unreachable; const y = self.height; for (data) |num, x| { const n = num - '0'; const p = Pos.init(x, y); try self.grid.put(p, n); } self.height += 1; } pub fn get_total_risk(self: *Map) !usize { if (self.mode == Mode.Large and !self.enlarged) { try self.enlarge(); self.enlarged = true; } const start = Pos.init(0, 0); const goal = Pos.init(self.width - 1, self.height - 1); var cameFrom = Path.init(allocator); defer cameFrom.deinit(); switch (self.algo) { Algo.Dijkstra => try self.walk_dijkstra(start, goal, &cameFrom), Algo.AStar => try self.walk_astar(start, goal, &cameFrom), } var risk: usize = 0; var pos = goal; while (true) { // std.debug.warn("PATH {}\n", .{pos}); if (pos.equal(start)) break; risk += self.grid.get(pos).?; const node = cameFrom.get(pos).?; pos = node.pos; } // std.debug.warn("SHORTEST {}\n", .{risk}); return risk; } fn walk_dijkstra(self: *Map, start: Pos, goal: Pos, cameFrom: *Path) !void { var pending = std.PriorityQueue(Node, Node.lessThan).init(allocator); defer pending.deinit(); var score = std.AutoHashMap(Pos, usize).init(allocator); defer score.deinit(); // We begin the route at the start node try pending.add(Node.init(start, 0)); while (pending.count() != 0) { const min_node = pending.remove(); const u: Pos = min_node.pos; if (u.equal(goal)) { // found target -- yay! break; } const su = min_node.cost; // update score for all neighbours of u // add closest neighbour of u to the path for (std.enums.values(Dir)) |dir| { if (self.get_neighbor(u, dir)) |v| { const duv = self.grid.get(v).?; const tentative = su + duv; var sv: usize = std.math.maxInt(usize); if (score.getEntry(v)) |e| { sv = e.value_ptr.*; } if (tentative >= sv) continue; try pending.add(Node.init(v, tentative)); try score.put(v, tentative); try cameFrom.put(v, Node.init(u, duv)); } } } } // Implemented this because I thought it would make a major difference with // Dijkstra (back when the code was NOT using a priority queue), but there // is actually not much difference. and this is much more complicated. fn walk_astar(self: *Map, start: Pos, goal: Pos, cameFrom: *Path) !void { var pending = std.PriorityQueue(Node, Node.lessThan).init(allocator); defer pending.deinit(); var gScore = std.AutoHashMap(Pos, usize).init(allocator); defer gScore.deinit(); var hScore = std.AutoHashMap(Pos, usize).init(allocator); defer hScore.deinit(); // Fill hScore for all nodes // fScore and gScore are infinite by default var y: usize = 0; while (y < self.height) : (y += 1) { var x: usize = 0; while (x < self.width) : (x += 1) { const p = Pos.init(x, y); try hScore.put(p, self.height - y + self.width - x); } } try gScore.put(start, 0); try pending.add(Node.init(start, 0)); while (pending.count() != 0) { const min_node = pending.remove(); const u: Pos = min_node.pos; if (u.equal(goal)) { // found target -- yay! break; } // update score for all neighbours of u // add closest neighbour of u to the path var gu: usize = std.math.maxInt(usize); if (gScore.getEntry(u)) |e| { gu = e.value_ptr.*; } for (std.enums.values(Dir)) |dir| { if (self.get_neighbor(u, dir)) |v| { const duv = self.grid.get(v).?; const tentative = gu + duv; var gv: usize = std.math.maxInt(usize); if (gScore.getEntry(v)) |e| { gv = e.value_ptr.*; } if (tentative >= gv) continue; try pending.add(Node.init(v, tentative)); try gScore.put(v, tentative); try cameFrom.put(v, Node.init(u, duv)); } } } } fn enlarge(self: *Map) !void { var y: usize = 0; while (y < self.height) : (y += 1) { var x: usize = 0; while (x < self.width) : (x += 1) { const p = Pos.init(x, y); var m = self.grid.get(p).?; var dy: usize = 0; while (dy < 5) : (dy += 1) { var n = m; var dx: usize = 0; while (dx < 5) : (dx += 1) { const q = Pos.init(x + self.width * dx, y + self.height * dy); // std.debug.warn("ENLARGE {} = {}\n", .{ q, n }); try self.grid.put(q, n); n += 1; if (n > 9) n = 1; } m += 1; if (m > 9) m = 1; } } } self.width *= 5; self.height *= 5; } fn get_neighbor(self: *Map, u: Pos, dir: Dir) ?Pos { var dx: isize = 0; var dy: isize = 0; switch (dir) { Dir.N => dy = -1, Dir.S => dy = 1, Dir.E => dx = 1, Dir.W => dx = -1, } const sx = @intCast(isize, u.x) + dx; if (sx < 0 or sx >= self.width) return null; const sy = @intCast(isize, u.y) + dy; if (sy < 0 or sy >= self.height) return null; var v = Pos.init(@intCast(usize, sx), @intCast(usize, sy)); if (!self.grid.contains(v)) return null; return v; } }; test "sample gonzo Dijkstra" { const data: []const u8 = \\1199 \\9199 \\1199 \\1999 \\1111 ; var map = Map.init(Map.Mode.Small, Map.Algo.Dijkstra); defer map.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { try map.process_line(line); } const risk = try map.get_total_risk(); try testing.expect(risk == 9); } test "sample gonzo A*" { const data: []const u8 = \\1199 \\9199 \\1199 \\1999 \\1111 ; var map = Map.init(Map.Mode.Small, Map.Algo.AStar); defer map.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { try map.process_line(line); } const risk = try map.get_total_risk(); try testing.expect(risk == 9); } test "sample part a Dijkstra" { const data: []const u8 = \\1163751742 \\1381373672 \\2136511328 \\3694931569 \\7463417111 \\1319128137 \\1359912421 \\3125421639 \\1293138521 \\2311944581 ; var map = Map.init(Map.Mode.Small, Map.Algo.Dijkstra); defer map.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { try map.process_line(line); } const risk = try map.get_total_risk(); try testing.expect(risk == 40); } test "sample part a A*" { const data: []const u8 = \\1163751742 \\1381373672 \\2136511328 \\3694931569 \\7463417111 \\1319128137 \\1359912421 \\3125421639 \\1293138521 \\2311944581 ; var map = Map.init(Map.Mode.Small, Map.Algo.AStar); defer map.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { try map.process_line(line); } const risk = try map.get_total_risk(); try testing.expect(risk == 40); } test "sample part b Dijkstra" { const data: []const u8 = \\1163751742 \\1381373672 \\2136511328 \\3694931569 \\7463417111 \\1319128137 \\1359912421 \\3125421639 \\1293138521 \\2311944581 ; var map = Map.init(Map.Mode.Large, Map.Algo.Dijkstra); defer map.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { try map.process_line(line); } const risk = try map.get_total_risk(); try testing.expect(risk == 315); } test "sample part b A*" { const data: []const u8 = \\1163751742 \\1381373672 \\2136511328 \\3694931569 \\7463417111 \\1319128137 \\1359912421 \\3125421639 \\1293138521 \\2311944581 ; var map = Map.init(Map.Mode.Large, Map.Algo.AStar); defer map.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { try map.process_line(line); } const risk = try map.get_total_risk(); try testing.expect(risk == 315); }
2021/p15/map.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const L = std.unicode.utf8ToUtf16LeStringLiteral; const zwin32 = @import("zwin32"); const w = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hrPanicOnFail; const zd3d12 = @import("zd3d12"); const common = @import("common"); const GuiRenderer = common.GuiRenderer; // We need to export below symbols for DirectX 12 Agility SDK. pub export const D3D12SDKVersion: u32 = 4; pub export const D3D12SDKPath: [*:0]const u8 = ".\\d3d12\\"; const content_dir = @import("build_options").content_dir; const window_name = "zig-gamedev: intro 1"; const window_width = 1920; const window_height = 1080; const Vertex = struct { position: [3]f32, color: u32, }; const DemoState = struct { gctx: zd3d12.GraphicsContext, guictx: GuiRenderer, frame_stats: common.FrameStats, intro1_pso: zd3d12.PipelineHandle, vertex_buffer: zd3d12.ResourceHandle, index_buffer: zd3d12.ResourceHandle, }; fn init(gpa_allocator: std.mem.Allocator) DemoState { // Create application window and initialize dear imgui library. const window = common.initWindow(gpa_allocator, window_name, window_width, window_height) catch unreachable; // Create temporary memory allocator for use during initialization. We pass this allocator to all // subsystems that need memory and then free everyting with a single deallocation. var arena_allocator_state = std.heap.ArenaAllocator.init(gpa_allocator); defer arena_allocator_state.deinit(); const arena_allocator = arena_allocator_state.allocator(); // Create DirectX 12 context. var gctx = zd3d12.GraphicsContext.init(gpa_allocator, window); // Enable vsync. // gctx.present_flags = 0; // gctx.present_interval = 1; // Create pipeline state object (pso) which is needed to draw geometry - it contains vertex shader, // pixel shader and draw state data all linked together. const intro1_pso = blk: { const input_layout_desc = [_]d3d12.INPUT_ELEMENT_DESC{ d3d12.INPUT_ELEMENT_DESC.init("POSITION", 0, .R32G32B32_FLOAT, 0, 0, .PER_VERTEX_DATA, 0), d3d12.INPUT_ELEMENT_DESC.init("_Color", 0, .R32_UINT, 0, 12, .PER_VERTEX_DATA, 0), }; var pso_desc = d3d12.GRAPHICS_PIPELINE_STATE_DESC.initDefault(); pso_desc.InputLayout = .{ .pInputElementDescs = &input_layout_desc, .NumElements = input_layout_desc.len, }; pso_desc.RTVFormats[0] = .R8G8B8A8_UNORM; pso_desc.NumRenderTargets = 1; pso_desc.DepthStencilState.DepthEnable = w.FALSE; pso_desc.BlendState.RenderTarget[0].RenderTargetWriteMask = 0xf; pso_desc.PrimitiveTopologyType = .TRIANGLE; break :blk gctx.createGraphicsShaderPipeline( arena_allocator, &pso_desc, content_dir ++ "shaders/intro1.vs.cso", content_dir ++ "shaders/intro1.ps.cso", ); }; // Create vertex buffer and return a *handle* to the underlying Direct3D12 resource. const vertex_buffer = gctx.createCommittedResource( .DEFAULT, d3d12.HEAP_FLAG_NONE, &d3d12.RESOURCE_DESC.initBuffer(3 * @sizeOf(Vertex)), d3d12.RESOURCE_STATE_COPY_DEST, null, ) catch |err| hrPanic(err); // Create index buffer and return a *handle* to the underlying Direct3D12 resource. const index_buffer = gctx.createCommittedResource( .DEFAULT, d3d12.HEAP_FLAG_NONE, &d3d12.RESOURCE_DESC.initBuffer(3 * @sizeOf(u16)), d3d12.RESOURCE_STATE_COPY_DEST, null, ) catch |err| hrPanic(err); // Open D3D12 command list, setup descriptor heap, etc. After this call we can upload resources to the GPU, // draw 3D graphics etc. gctx.beginFrame(); // Create and upload graphics resources for dear imgui renderer. var guictx = GuiRenderer.init(arena_allocator, &gctx, 1, content_dir); // Fill vertex buffer with vertex data. { // Allocate memory from upload heap and fill it with vertex data. const verts = gctx.allocateUploadBufferRegion(Vertex, 3); verts.cpu_slice[0].position = [3]f32{ -0.7, -0.7, 0.0 }; verts.cpu_slice[1].position = [3]f32{ 0.0, 0.7, 0.0 }; verts.cpu_slice[2].position = [3]f32{ 0.7, -0.7, 0.0 }; verts.cpu_slice[0].color = 0x00_00_00_ff; verts.cpu_slice[1].color = 0x00_00_ff_00; verts.cpu_slice[2].color = 0x00_ff_00_00; // Copy vertex data from upload heap to vertex buffer resource that resides in high-performance memory // on the GPU. gctx.cmdlist.CopyBufferRegion( gctx.lookupResource(vertex_buffer).?, 0, verts.buffer, verts.buffer_offset, verts.cpu_slice.len * @sizeOf(@TypeOf(verts.cpu_slice[0])), ); } // Fill index buffer with index data. { // Allocate memory from upload heap and fill it with index data. const indices = gctx.allocateUploadBufferRegion(u16, 3); indices.cpu_slice[0] = 0; indices.cpu_slice[1] = 1; indices.cpu_slice[2] = 2; // Copy index data from upload heap to index buffer resource that resides in high-performance memory // on the GPU. gctx.cmdlist.CopyBufferRegion( gctx.lookupResource(index_buffer).?, 0, indices.buffer, indices.buffer_offset, indices.cpu_slice.len * @sizeOf(@TypeOf(indices.cpu_slice[0])), ); } // Transition vertex and index buffers from 'copy dest' state to the state appropriate for rendering. gctx.addTransitionBarrier(vertex_buffer, d3d12.RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER); gctx.addTransitionBarrier(index_buffer, d3d12.RESOURCE_STATE_INDEX_BUFFER); gctx.flushResourceBarriers(); // This will send command list to the GPU, call 'Present' and do some other bookkeeping. gctx.endFrame(); // Wait for the GPU to finish all commands. gctx.finishGpuCommands(); return .{ .gctx = gctx, .guictx = guictx, .frame_stats = common.FrameStats.init(), .intro1_pso = intro1_pso, .vertex_buffer = vertex_buffer, .index_buffer = index_buffer, }; } fn deinit(demo: *DemoState, gpa_allocator: std.mem.Allocator) void { demo.gctx.finishGpuCommands(); demo.guictx.deinit(&demo.gctx); demo.gctx.deinit(gpa_allocator); common.deinitWindow(gpa_allocator); demo.* = undefined; } fn update(demo: *DemoState) void { // Update frame counter and fps stats. demo.frame_stats.update(demo.gctx.window, window_name); const dt = demo.frame_stats.delta_time; // Update dear imgui common. After this call we can define our widgets. common.newImGuiFrame(dt); } fn draw(demo: *DemoState) void { var gctx = &demo.gctx; // Begin DirectX 12 rendering. gctx.beginFrame(); // Get current back buffer resource and transition it to 'render target' state. const back_buffer = gctx.getBackBuffer(); gctx.addTransitionBarrier(back_buffer.resource_handle, d3d12.RESOURCE_STATE_RENDER_TARGET); gctx.flushResourceBarriers(); gctx.cmdlist.OMSetRenderTargets( 1, &[_]d3d12.CPU_DESCRIPTOR_HANDLE{back_buffer.descriptor_handle}, w.TRUE, null, ); gctx.cmdlist.ClearRenderTargetView( back_buffer.descriptor_handle, &[4]f32{ 0.0, 0.0, 0.0, 1.0 }, 0, null, ); // Set graphics state and draw. gctx.setCurrentPipeline(demo.intro1_pso); gctx.cmdlist.IASetPrimitiveTopology(.TRIANGLELIST); gctx.cmdlist.IASetVertexBuffers(0, 1, &[_]d3d12.VERTEX_BUFFER_VIEW{.{ .BufferLocation = gctx.lookupResource(demo.vertex_buffer).?.GetGPUVirtualAddress(), .SizeInBytes = 3 * @sizeOf(Vertex), .StrideInBytes = @sizeOf(Vertex), }}); gctx.cmdlist.IASetIndexBuffer(&.{ .BufferLocation = gctx.lookupResource(demo.index_buffer).?.GetGPUVirtualAddress(), .SizeInBytes = 3 * @sizeOf(u16), .Format = .R16_UINT, }); gctx.cmdlist.DrawIndexedInstanced(3, 1, 0, 0, 0); // Draw dear imgui (not used in this demo). demo.guictx.draw(gctx); gctx.addTransitionBarrier(back_buffer.resource_handle, d3d12.RESOURCE_STATE_PRESENT); gctx.flushResourceBarriers(); // Call 'Present' and prepare for the next frame. gctx.endFrame(); } pub fn main() !void { // Initialize some low-level Windows stuff (DPI awarness, COM), check Windows version and also check // if DirectX 12 Agility SDK is supported. common.init(); defer common.deinit(); // Create main memory allocator for our application. 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 = init(gpa_allocator); defer deinit(&demo, 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 false; if (has_message) { _ = w.user32.translateMessage(&message); _ = w.user32.dispatchMessageA(&message); if (message.message == w.user32.WM_QUIT) { break; } } else { update(&demo); draw(&demo); } } }
samples/intro/src/intro1.zig
const std = @import("std"); const input = @embedFile("../input.txt"); const Vector = struct { x: i64 = 0, y: i64 = 0, z: i64 = 0, w: i64 = 0, }; const CubeList = std.ArrayList(Vector); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); var allocator = &gpa.allocator; var activated_cubes = std.AutoHashMap(Vector, void).init(allocator); defer activated_cubes.deinit(); { var row: i64 = 0; var column: i64 = 0; for (input) |char| { switch (char) { '#' => { try activated_cubes.put(.{ .y = row, .x = column, .w = 0 }, {}); column += 1; }, '.' => column += 1, '\n' => { row += 1; column = 0; }, else => unreachable, } } } var min_vector = Vector{ .x = std.math.maxInt(i64), .y = std.math.maxInt(i64), .z = std.math.maxInt(i64), .w = std.math.maxInt(i64), }; var max_vector = Vector{ .x = std.math.minInt(i64), .y = std.math.minInt(i64), .z = std.math.minInt(i64), .w = std.math.minInt(i64), }; { var iterator = activated_cubes.iterator(); while (iterator.next()) |entry| { const current = entry.key; min_vector = .{ .x = std.math.min(current.x, min_vector.x), .y = std.math.min(current.y, min_vector.y), .z = std.math.min(current.z, min_vector.z), .w = std.math.min(current.w, min_vector.w), }; max_vector = .{ .x = std.math.max(current.x, max_vector.x), .y = std.math.max(current.y, max_vector.y), .z = std.math.max(current.z, max_vector.z), .w = std.math.max(current.w, max_vector.w), }; } } var turns: usize = 0; while (turns < 6) : (turns += 1) { var cubes_to_activate = CubeList.init(allocator); defer cubes_to_activate.deinit(); var cubes_to_deactivate = CubeList.init(allocator); defer cubes_to_deactivate.deinit(); var z_index = min_vector.z - 1; while (z_index <= max_vector.z + 1) : (z_index += 1) { var y_index = min_vector.y - 1; while (y_index <= max_vector.y + 1) : (y_index += 1) { var x_index = min_vector.x - 1; while (x_index <= max_vector.x + 1) : (x_index += 1) { var w_index = min_vector.w - 1; while (w_index <= max_vector.w + 1) : (w_index += 1) { const coord = Vector{ .z = z_index, .y = y_index, .x = x_index, .w = w_index }; var count = getSurroundingCubes(activated_cubes, coord); if (activated_cubes.contains(coord)) { // adding one to the count, as it includes itself if (count != 3 and count != 4) try cubes_to_deactivate.append(coord); } else { if (count == 3) try cubes_to_activate.append(coord); } } } } } for (cubes_to_deactivate.items) |coord| { _ = activated_cubes.remove(coord); } for (cubes_to_activate.items) |coord| { try activated_cubes.put(coord, {}); min_vector = .{ .x = std.math.min(coord.x, min_vector.x), .y = std.math.min(coord.y, min_vector.y), .z = std.math.min(coord.z, min_vector.z), .w = std.math.min(coord.w, min_vector.w), }; max_vector = .{ .x = std.math.max(coord.x, max_vector.x), .y = std.math.max(coord.y, max_vector.y), .z = std.math.max(coord.z, max_vector.z), .w = std.math.max(coord.w, max_vector.w), }; } } std.debug.print("count: {}\n", .{activated_cubes.count()}); } const offsets = [_]i64{ -1, 0, 1 }; fn getSurroundingCubes(cube_list: std.AutoHashMap(Vector, void), coord: Vector) usize { var activated_count: usize = 0; for (offsets) |offset_z| { for (offsets) |offset_y| { for (offsets) |offset_x| { for (offsets) |offset_w| { var check_coord = Vector{ .x = coord.x + offset_x, .y = coord.y + offset_y, .z = coord.z + offset_z, .w = coord.w + offset_w, }; if (cube_list.contains(check_coord)) activated_count += 1; } } } } return activated_count; }
2020/day17/zig/day17.zig
const pokemon = @import("pokemon"); const fun = @import("../../lib/fun-with-zig/index.zig"); const std = @import("std"); const math = std.math; const gen3 = pokemon.gen3; const common = pokemon.common; const lu16 = fun.platform.lu16; const lu32 = fun.platform.lu32; const lu64 = fun.platform.lu64; pub const em_first_trainers = []gen3.Trainer{ gen3.Trainer{ .party_type = 0x00, .class = 0, .encounter_music = 0, .trainer_picture = 0, .name = undefined, .items = []lu16{ lu16.init(0), lu16.init(0), lu16.init(0), lu16.init(0) }, .is_double = lu32.init(0), .ai = lu32.init(0), .party = undefined, }, gen3.Trainer{ .party_type = 0x00, .class = 0x02, .encounter_music = 0x0b, .trainer_picture = 0, .name = undefined, .items = []lu16{ lu16.init(0), lu16.init(0), lu16.init(0), lu16.init(0) }, .is_double = lu32.init(0), .ai = lu32.init(7), .party = undefined, }, }; pub const em_last_trainers = []gen3.Trainer{gen3.Trainer{ .party_type = 0x00, .class = 0x41, .encounter_music = 0x80, .trainer_picture = 0x5c, .name = undefined, .items = []lu16{ lu16.init(0), lu16.init(0), lu16.init(0), lu16.init(0) }, .is_double = lu32.init(0), .ai = lu32.init(0), .party = undefined, }}; pub const rs_first_trainers = []gen3.Trainer{ gen3.Trainer{ .party_type = 0x00, .class = 0, .encounter_music = 0, .trainer_picture = 0, .name = undefined, .items = []lu16{ lu16.init(0), lu16.init(0), lu16.init(0), lu16.init(0) }, .is_double = lu32.init(0), .ai = lu32.init(0), .party = undefined, }, gen3.Trainer{ .party_type = 0x00, .class = 0x02, .encounter_music = 0x06, .trainer_picture = 0x46, .name = undefined, .items = []lu16{ lu16.init(0x16), lu16.init(0x16), lu16.init(0), lu16.init(0) }, .is_double = lu32.init(0), .ai = lu32.init(7), .party = undefined, }, }; pub const rs_last_trainers = []gen3.Trainer{gen3.Trainer{ .party_type = 0x00, .class = 0x21, .encounter_music = 0x0B, .trainer_picture = 0x06, .name = undefined, .items = []lu16{ lu16.init(0), lu16.init(0), lu16.init(0), lu16.init(0) }, .is_double = lu32.init(0), .ai = lu32.init(1), .party = undefined, }}; pub const frls_first_trainers = []gen3.Trainer{ gen3.Trainer{ .party_type = 0x00, .class = 0, .encounter_music = 0, .trainer_picture = 0, .name = undefined, .items = []lu16{ lu16.init(0), lu16.init(0), lu16.init(0), lu16.init(0), }, .is_double = lu32.init(0), .ai = lu32.init(0), .party = undefined, }, gen3.Trainer{ .party_type = 0x00, .class = 2, .encounter_music = 6, .trainer_picture = 0, .name = undefined, .items = []lu16{ lu16.init(0), lu16.init(0), lu16.init(0), lu16.init(0), }, .is_double = lu32.init(0), .ai = lu32.init(1), .party = undefined, }, }; pub const frls_last_trainers = []gen3.Trainer{ gen3.Trainer{ .party_type = 0x03, .class = 90, .encounter_music = 0, .trainer_picture = 125, .name = undefined, .items = []lu16{ lu16.init(19), lu16.init(19), lu16.init(19), lu16.init(19), }, .is_double = lu32.init(0), .ai = lu32.init(7), .party = undefined, }, gen3.Trainer{ .party_type = 0x00, .class = 0x47, .encounter_music = 0, .trainer_picture = 0x60, .name = undefined, .items = []lu16{ lu16.init(0), lu16.init(0), lu16.init(0), lu16.init(0), }, .is_double = lu32.init(0), .ai = lu32.init(1), .party = undefined, }, }; pub const first_moves = []gen3.Move{ // Dummy gen3.Move{ .effect = 0, .power = 0, .@"type" = gen3.Type.Normal, .accuracy = 0, .pp = 0, .side_effect_chance = 0, .target = 0, .priority = 0, .flags = lu32.init(0), }, // Pound gen3.Move{ .effect = 0, .power = 40, .@"type" = gen3.Type.Normal, .accuracy = 100, .pp = 35, .side_effect_chance = 0, .target = 0, .priority = 0, .flags = lu32.init(0x33), }, }; pub const last_moves = []gen3.Move{ // Psycho Boost gen3.Move{ .effect = 204, .power = 140, .@"type" = gen3.Type.Psychic, .accuracy = 90, .pp = 5, .side_effect_chance = 100, .target = 0, .priority = 0, .flags = lu32.init(0x32), }}; // TODO: Fix format pub const first_machine_learnsets = []lu64{ lu64{ .bytes = []u8{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } }, // Dummy Pokémon lu64{ .bytes = []u8{ 0x20, 0x07, 0x35, 0x84, 0x08, 0x1e, 0xe4, 0x00, } }, // Bulbasaur lu64{ .bytes = []u8{ 0x20, 0x07, 0x35, 0x84, 0x08, 0x1e, 0xe4, 0x00, } }, // Ivysaur lu64{ .bytes = []u8{ 0x30, 0x47, 0x35, 0x86, 0x08, 0x1e, 0xe4, 0x00, } }, // Venusaur }; pub const last_machine_learnsets = []lu64{ lu64{ .bytes = []u8{ 0x3e, 0xd6, 0xbb, 0xb7, 0x93, 0x5e, 0x5c, 0x03, } }, // Latios lu64{ .bytes = []u8{ 0x2c, 0xc6, 0x9b, 0xb5, 0x93, 0x8e, 0x40, 0x00, } }, // Jirachi lu64{ .bytes = []u8{ 0x2d, 0xde, 0xbb, 0xf5, 0xc3, 0x8f, 0xe5, 0x00, } }, // Deoxys lu64{ .bytes = []u8{ 0x28, 0x8e, 0x1b, 0xb4, 0x03, 0x9f, 0x41, 0x00, } }, // Chimecho }; pub const first_base_stats = []gen3.BasePokemon{ // Dummy gen3.BasePokemon{ .stats = common.Stats{ .hp = 0, .attack = 0, .defense = 0, .speed = 0, .sp_attack = 0, .sp_defense = 0, }, .types = []gen3.Type{ gen3.Type.Normal, gen3.Type.Normal }, .catch_rate = 0, .base_exp_yield = 0, .ev_yield = common.EvYield{ .hp = 0, .attack = 0, .defense = 0, .speed = 0, .sp_attack = 0, .sp_defense = 0, .padding = 0, }, .items = []lu16{ lu16.init(0), lu16.init(0) }, .gender_ratio = 0, .egg_cycles = 0, .base_friendship = 0, .growth_rate = common.GrowthRate.MediumFast, .egg_group1 = common.EggGroup.Invalid, .egg_group1_pad = undefined, .egg_group2 = common.EggGroup.Invalid, .egg_group2_pad = undefined, .abilities = []u8{ 0, 0 }, .safari_zone_rate = 0, .color = common.Color.Red, .flip = false, .padding = undefined, }, // Bulbasaur gen3.BasePokemon{ .stats = common.Stats{ .hp = 45, .attack = 49, .defense = 49, .speed = 45, .sp_attack = 65, .sp_defense = 65, }, .types = []gen3.Type{ gen3.Type.Grass, gen3.Type.Poison }, .catch_rate = 45, .base_exp_yield = 64, .ev_yield = common.EvYield{ .hp = 0, .attack = 0, .defense = 0, .speed = 0, .sp_attack = 1, .sp_defense = 0, .padding = 0, }, .items = []lu16{ lu16.init(0), lu16.init(0) }, .gender_ratio = comptime percentFemale(12.5), .egg_cycles = 20, .base_friendship = 70, .growth_rate = common.GrowthRate.MediumSlow, .egg_group1 = common.EggGroup.Monster, .egg_group1_pad = undefined, .egg_group2 = common.EggGroup.Grass, .egg_group2_pad = undefined, .abilities = []u8{ 65, 0 }, .safari_zone_rate = 0, .color = common.Color.Green, .flip = false, .padding = undefined, }, }; pub const last_base_stats = []gen3.BasePokemon{ // Chimecho gen3.BasePokemon{ .stats = common.Stats{ .hp = 65, .attack = 50, .defense = 70, .speed = 65, .sp_attack = 95, .sp_defense = 80, }, .types = []gen3.Type{ gen3.Type.Psychic, gen3.Type.Psychic }, .catch_rate = 45, .base_exp_yield = 147, .ev_yield = common.EvYield{ .hp = 0, .attack = 0, .defense = 0, .speed = 0, .sp_attack = 1, .sp_defense = 1, .padding = 0, }, .items = []lu16{ lu16.init(0), lu16.init(0) }, .gender_ratio = comptime percentFemale(50), .egg_cycles = 25, .base_friendship = 70, .growth_rate = common.GrowthRate.Fast, .egg_group1 = common.EggGroup.Amorphous, .egg_group1_pad = undefined, .egg_group2 = common.EggGroup.Amorphous, .egg_group2_pad = undefined, .abilities = []u8{ 26, 0 }, .safari_zone_rate = 0, .color = common.Color.Blue, .flip = false, .padding = undefined, }}; fn percentFemale(percent: f64) u8 { return @floatToInt(u8, math.min(f64(254), (percent * 255) / 100)); } const unused_evo = common.Evolution{ .method = common.Evolution.Method.Unused, .param = lu16.init(0), .target = lu16.init(0), .padding = undefined, }; const unused_evo5 = []common.Evolution{unused_evo} ** 5; pub const first_evolutions = [][5]common.Evolution{ // Dummy unused_evo5, // Bulbasaur []common.Evolution{ common.Evolution{ .method = common.Evolution.Method.LevelUp, .param = lu16.init(16), .target = lu16.init(2), .padding = undefined, }, unused_evo, unused_evo, unused_evo, unused_evo, }, // Ivysaur []common.Evolution{ common.Evolution{ .method = common.Evolution.Method.LevelUp, .param = lu16.init(32), .target = lu16.init(3), .padding = undefined, }, unused_evo, unused_evo, unused_evo, unused_evo, }, }; pub const last_evolutions = [][5]common.Evolution{ // Beldum []common.Evolution{ common.Evolution{ .method = common.Evolution.Method.LevelUp, .param = lu16.init(20), .target = lu16.init(399), .padding = undefined, }, unused_evo, unused_evo, unused_evo, unused_evo, }, // Metang []common.Evolution{ common.Evolution{ .method = common.Evolution.Method.LevelUp, .param = lu16.init(45), .target = lu16.init(400), .padding = undefined, }, unused_evo, unused_evo, unused_evo, unused_evo, }, // Metagross, Regirock, Regice, Registeel, Kyogre, Groudon, Rayquaza // Latias, Latios, Jirachi, Deoxys, Chimecho unused_evo5, unused_evo5, unused_evo5, unused_evo5, unused_evo5, unused_evo5, unused_evo5, unused_evo5, unused_evo5, unused_evo5, unused_evo5, unused_evo5, }; pub const first_levelup_learnsets = []?[]const u8{ // Dummy mon have same moves as Bulbasaur []u8{ 0x21, 0x02, 0x2D, 0x08, 0x49, 0x0E, 0x16, 0x14, 0x4D, 0x1E, 0x4F, 0x1E, 0x4B, 0x28, 0xE6, 0x32, 0x4A, 0x40, 0xEB, 0x4E, 0x4C, 0x5C, 0xFF, 0xFF, }, // Bulbasaur []u8{ 0x21, 0x02, 0x2D, 0x08, 0x49, 0x0E, 0x16, 0x14, 0x4D, 0x1E, 0x4F, 0x1E, 0x4B, 0x28, 0xE6, 0x32, 0x4A, 0x40, 0xEB, 0x4E, 0x4C, 0x5C, 0xFF, 0xFF, }, // Ivysaur []u8{ 0x21, 0x02, 0x2D, 0x02, 0x49, 0x02, 0x2D, 0x08, 0x49, 0x0E, 0x16, 0x14, 0x4D, 0x1E, 0x4F, 0x1E, 0x4B, 0x2C, 0xE6, 0x3A, 0x4A, 0x4C, 0xEB, 0x5E, 0x4C, 0x70, 0xFF, 0xFF, }, // Venusaur []u8{ 0x21, 0x02, 0x2D, 0x02, 0x49, 0x02, 0x16, 0x02, 0x2D, 0x08, 0x49, 0x0E, 0x16, 0x14, 0x4D, 0x1E, 0x4F, 0x1E, 0x4B, 0x2C, 0xE6, 0x3A, 0x4A, 0x52, 0xEB, 0x6A, 0x4C, 0x82, 0xFF, 0xFF, }, }; pub const last_levelup_learnsets = []?[]const u8{ // Latios []u8{ 0x95, 0x02, 0x06, 0x0B, 0x0E, 0x15, 0xDB, 0x1E, 0xE1, 0x28, 0xB6, 0x32, 0x1F, 0x3D, 0x27, 0x47, 0x5E, 0x50, 0x69, 0x5A, 0x5D, 0x65, 0xFF, 0xFF, }, // Jirachi []u8{ 0x11, 0x03, 0x5D, 0x02, 0x9C, 0x0A, 0x81, 0x14, 0x0E, 0x1F, 0x5E, 0x28, 0x1F, 0x33, 0x9C, 0x3C, 0x26, 0x46, 0xF8, 0x50, 0x42, 0x5B, 0x61, 0x65, 0xFF, 0xFF, }, // Deoxys have different moves between FRLG, RUSA and EM null, // Chimecho []u8{ 0x23, 0x02, 0x2D, 0x0C, 0x36, 0x13, 0x5D, 0x1C, 0x24, 0x22, 0xFD, 0x2C, 0x19, 0x33, 0x95, 0x3C, 0x26, 0x42, 0xD7, 0x4C, 0xDB, 0x52, 0x5E, 0x5C, 0xFF, 0xFF, }, }; pub const hms = []u8{ 0x0f, 0x00, 0x13, 0x00, 0x39, 0x00, 0x46, 0x00, 0x94, 0x00, 0xf9, 0x00, 0x7f, 0x00, 0x23, 0x01, }; pub const tms = []u8{ 0x08, 0x01, 0x51, 0x01, 0x60, 0x01, 0x5b, 0x01, 0x2e, 0x00, 0x5c, 0x00, 0x02, 0x01, 0x53, 0x01, 0x4b, 0x01, 0xed, 0x00, 0xf1, 0x00, 0x0d, 0x01, 0x3a, 0x00, 0x3b, 0x00, 0x3f, 0x00, 0x71, 0x00, 0xb6, 0x00, 0xf0, 0x00, 0xca, 0x00, 0xdb, 0x00, 0xda, 0x00, 0x4c, 0x00, 0xe7, 0x00, 0x55, 0x00, 0x57, 0x00, 0x59, 0x00, 0xd8, 0x00, 0x5b, 0x00, 0x5e, 0x00, 0xf7, 0x00, 0x18, 0x01, 0x68, 0x00, 0x73, 0x00, 0x5f, 0x01, 0x35, 0x00, 0xbc, 0x00, 0xc9, 0x00, 0x7e, 0x00, 0x3d, 0x01, 0x4c, 0x01, 0x03, 0x01, 0x07, 0x01, 0x22, 0x01, 0x9c, 0x00, 0xd5, 0x00, 0xa8, 0x00, 0xd3, 0x00, 0x1d, 0x01, 0x21, 0x01, 0x3b, 0x01, }; pub const em_first_items = []gen3.Item{ // ???????? gen3.Item{ .name = undefined, .id = lu16.init(0), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 0, .unknown = 0, .pocked = 1, .@"type" = 4, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, // MASTER BALL gen3.Item{ .name = undefined, .id = lu16.init(1), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 0, .unknown = 0, .pocked = 2, .@"type" = 0, .field_use_func = undefined, .battle_usage = lu32.init(2), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, }; pub const em_last_items = []gen3.Item{ // MAGMA EMBLEM gen3.Item{ .name = undefined, .id = lu16.init(0x177), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 1, .unknown = 1, .pocked = 5, .@"type" = 4, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, // OLD SEA MAP gen3.Item{ .name = undefined, .id = lu16.init(0x178), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 1, .unknown = 1, .pocked = 5, .@"type" = 4, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, }; pub const rs_first_items = []gen3.Item{ // ???????? gen3.Item{ .name = undefined, .id = lu16.init(0), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 0, .unknown = 0, .pocked = 1, .@"type" = 4, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, // MASTER BALL gen3.Item{ .name = undefined, .id = lu16.init(1), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 0, .unknown = 0, .pocked = 2, .@"type" = 0, .field_use_func = undefined, .battle_usage = lu32.init(2), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, }; pub const rs_last_items = []gen3.Item{ // HM08 gen3.Item{ .name = undefined, .id = lu16.init(0x15A), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 1, .unknown = 0, .pocked = 3, .@"type" = 1, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, // ???????? gen3.Item{ .name = undefined, .id = lu16.init(0), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 0, .unknown = 0, .pocked = 1, .@"type" = 4, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, // ???????? gen3.Item{ .name = undefined, .id = lu16.init(0), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 0, .unknown = 0, .pocked = 1, .@"type" = 4, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, }; pub const frlg_first_items = []gen3.Item{ gen3.Item{ .name = undefined, .id = lu16.init(0), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 0, .unknown = 0, .pocked = 1, .@"type" = 4, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, gen3.Item{ .name = undefined, .id = lu16.init(1), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 0, .unknown = 0, .pocked = 3, .@"type" = 0, .field_use_func = undefined, .battle_usage = lu32.init(2), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, }; pub const frlg_last_items = []gen3.Item{ gen3.Item{ .name = undefined, .id = lu16.init(372), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 1, .unknown = 1, .pocked = 2, .@"type" = 4, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, gen3.Item{ .name = undefined, .id = lu16.init(373), .price = lu16.init(0), .hold_effect = 0, .hold_effect_param = 0, .description = undefined, .importance = 1, .unknown = 1, .pocked = 2, .@"type" = 4, .field_use_func = undefined, .battle_usage = lu32.init(0), .battle_use_func = undefined, .secondary_id = lu32.init(0), }, }; fn wildHeader(map_group: u8, map_num: u8) gen3.WildPokemonHeader { return gen3.WildPokemonHeader{ .map_group = map_group, .map_num = map_num, .pad = undefined, .land_pokemons = undefined, .surf_pokemons = undefined, .rock_smash_pokemons = undefined, .fishing_pokemons = undefined, }; } pub const em_first_wild_mon_headers = []gen3.WildPokemonHeader{ wildHeader(0, 16), wildHeader(0, 17), wildHeader(0, 18), }; pub const em_last_wild_mon_headers = []gen3.WildPokemonHeader{ wildHeader(24, 106), wildHeader(24, 106), wildHeader(24, 107), }; pub const rs_first_wild_mon_headers = []gen3.WildPokemonHeader{ wildHeader(0, 0), wildHeader(0, 1), wildHeader(0, 5), wildHeader(0, 6), }; pub const rs_last_wild_mon_headers = []gen3.WildPokemonHeader{ wildHeader(0, 15), wildHeader(0, 50), wildHeader(0, 51), }; pub const frlg_first_wild_mon_headers = []gen3.WildPokemonHeader{ wildHeader(2, 27), wildHeader(2, 28), wildHeader(2, 29), }; pub const frlg_last_wild_mon_headers = []gen3.WildPokemonHeader{ wildHeader(1, 122), wildHeader(1, 122), wildHeader(1, 122), wildHeader(1, 122), wildHeader(1, 122), wildHeader(1, 122), wildHeader(1, 122), wildHeader(1, 122), wildHeader(1, 122), };
tools/offset-finder/gen3-constants.zig
pub usingnamespace @import("std").zig.c_builtins; pub const WGPUNonZeroU64 = c_ulonglong; pub const WGPUOption_NonZeroU32 = c_ulong; pub const WGPUOption_NonZeroU64 = c_ulong; pub const WGPUOption_AdapterId = c_ulonglong; pub const WGPUOption_BufferId = c_ulonglong; pub const WGPUOption_SamplerId = c_ulonglong; pub const WGPUOption_SurfaceId = c_ulonglong; pub const WGPUOption_TextureViewId = c_ulonglong; pub const WGPUChainedStruct = struct_WGPUChainedStruct; pub const WGPUSType = u32; pub const struct_WGPUChainedStruct = extern struct { next: [*c]const WGPUChainedStruct, s_type: WGPUSType, }; pub const struct___va_list_tag = extern struct { gp_offset: c_uint, fp_offset: c_uint, overflow_arg_area: ?*c_void, reg_save_area: ?*c_void, }; pub const __builtin_va_list = [1]struct___va_list_tag; pub const va_list = __builtin_va_list; pub const __gnuc_va_list = __builtin_va_list; pub const int_least8_t = i8; pub const int_least16_t = i16; pub const int_least32_t = i32; pub const int_least64_t = i64; pub const uint_least8_t = u8; pub const uint_least16_t = u16; pub const uint_least32_t = u32; pub const uint_least64_t = u64; pub const int_fast8_t = i8; pub const int_fast16_t = i16; pub const int_fast32_t = i32; pub const int_fast64_t = i64; pub const uint_fast8_t = u8; pub const uint_fast16_t = u16; pub const uint_fast32_t = u32; pub const uint_fast64_t = u64; pub const __int8_t = i8; pub const __uint8_t = u8; pub const __int16_t = c_short; pub const __uint16_t = c_ushort; pub const __int32_t = c_int; pub const __uint32_t = c_uint; pub const __int64_t = c_longlong; pub const __uint64_t = c_ulonglong; pub const __darwin_intptr_t = c_long; pub const __darwin_natural_t = c_uint; pub const __darwin_ct_rune_t = c_int; pub const __mbstate_t = extern union { __mbstate8: [128]u8, _mbstateL: c_longlong, }; pub const __darwin_mbstate_t = __mbstate_t; pub const __darwin_ptrdiff_t = c_long; pub const __darwin_size_t = c_ulong; pub const __darwin_va_list = __builtin_va_list; pub const __darwin_wchar_t = c_int; pub const __darwin_rune_t = __darwin_wchar_t; pub const __darwin_wint_t = c_int; pub const __darwin_clock_t = c_ulong; pub const __darwin_socklen_t = __uint32_t; pub const __darwin_ssize_t = c_long; pub const __darwin_time_t = c_long; pub const __darwin_blkcnt_t = __int64_t; pub const __darwin_blksize_t = __int32_t; pub const __darwin_dev_t = __int32_t; pub const __darwin_fsblkcnt_t = c_uint; pub const __darwin_fsfilcnt_t = c_uint; pub const __darwin_gid_t = __uint32_t; pub const __darwin_id_t = __uint32_t; pub const __darwin_ino64_t = __uint64_t; pub const __darwin_ino_t = __darwin_ino64_t; pub const __darwin_mach_port_name_t = __darwin_natural_t; pub const __darwin_mach_port_t = __darwin_mach_port_name_t; pub const __darwin_mode_t = __uint16_t; pub const __darwin_off_t = __int64_t; pub const __darwin_pid_t = __int32_t; pub const __darwin_sigset_t = __uint32_t; pub const __darwin_suseconds_t = __int32_t; pub const __darwin_uid_t = __uint32_t; pub const __darwin_useconds_t = __uint32_t; pub const __darwin_uuid_t = [16]u8; pub const __darwin_uuid_string_t = [37]u8; pub const struct___darwin_pthread_handler_rec = extern struct { __routine: ?fn (?*c_void) callconv(.C) void, __arg: ?*c_void, __next: [*c]struct___darwin_pthread_handler_rec, }; pub const struct__opaque_pthread_attr_t = extern struct { __sig: c_long, __opaque: [56]u8, }; pub const struct__opaque_pthread_cond_t = extern struct { __sig: c_long, __opaque: [40]u8, }; pub const struct__opaque_pthread_condattr_t = extern struct { __sig: c_long, __opaque: [8]u8, }; pub const struct__opaque_pthread_mutex_t = extern struct { __sig: c_long, __opaque: [56]u8, }; pub const struct__opaque_pthread_mutexattr_t = extern struct { __sig: c_long, __opaque: [8]u8, }; pub const struct__opaque_pthread_once_t = extern struct { __sig: c_long, __opaque: [8]u8, }; pub const struct__opaque_pthread_rwlock_t = extern struct { __sig: c_long, __opaque: [192]u8, }; pub const struct__opaque_pthread_rwlockattr_t = extern struct { __sig: c_long, __opaque: [16]u8, }; pub const struct__opaque_pthread_t = extern struct { __sig: c_long, __cleanup_stack: [*c]struct___darwin_pthread_handler_rec, __opaque: [8176]u8, }; pub const __darwin_pthread_attr_t = struct__opaque_pthread_attr_t; pub const __darwin_pthread_cond_t = struct__opaque_pthread_cond_t; pub const __darwin_pthread_condattr_t = struct__opaque_pthread_condattr_t; pub const __darwin_pthread_key_t = c_ulong; pub const __darwin_pthread_mutex_t = struct__opaque_pthread_mutex_t; pub const __darwin_pthread_mutexattr_t = struct__opaque_pthread_mutexattr_t; pub const __darwin_pthread_once_t = struct__opaque_pthread_once_t; pub const __darwin_pthread_rwlock_t = struct__opaque_pthread_rwlock_t; pub const __darwin_pthread_rwlockattr_t = struct__opaque_pthread_rwlockattr_t; pub const __darwin_pthread_t = [*c]struct__opaque_pthread_t; pub const u_int8_t = u8; pub const u_int16_t = c_ushort; pub const u_int32_t = c_uint; pub const u_int64_t = c_ulonglong; pub const register_t = i64; pub const user_addr_t = u_int64_t; pub const user_size_t = u_int64_t; pub const user_ssize_t = i64; pub const user_long_t = i64; pub const user_ulong_t = u_int64_t; pub const user_time_t = i64; pub const user_off_t = i64; pub const syscall_arg_t = u_int64_t; pub const intmax_t = c_long; pub const uintmax_t = c_ulong; pub const __darwin_nl_item = c_int; pub const __darwin_wctrans_t = c_int; pub const __darwin_wctype_t = __uint32_t; pub const P_ALL: c_int = 0; pub const P_PID: c_int = 1; pub const P_PGID: c_int = 2; pub const idtype_t = c_uint; pub const pid_t = __darwin_pid_t; pub const id_t = __darwin_id_t; pub const sig_atomic_t = c_int; pub const struct___darwin_i386_thread_state = extern struct { __eax: c_uint, __ebx: c_uint, __ecx: c_uint, __edx: c_uint, __edi: c_uint, __esi: c_uint, __ebp: c_uint, __esp: c_uint, __ss: c_uint, __eflags: c_uint, __eip: c_uint, __cs: c_uint, __ds: c_uint, __es: c_uint, __fs: c_uint, __gs: c_uint, }; // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/mach/i386/_structs.h:94:21: warning: struct demoted to opaque type - has bitfield pub const struct___darwin_fp_control = opaque {}; pub const __darwin_fp_control_t = struct___darwin_fp_control; // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/mach/i386/_structs.h:152:21: warning: struct demoted to opaque type - has bitfield pub const struct___darwin_fp_status = opaque {}; pub const __darwin_fp_status_t = struct___darwin_fp_status; pub const struct___darwin_mmst_reg = extern struct { __mmst_reg: [10]u8, __mmst_rsrv: [6]u8, }; pub const struct___darwin_xmm_reg = extern struct { __xmm_reg: [16]u8, }; pub const struct___darwin_ymm_reg = extern struct { __ymm_reg: [32]u8, }; pub const struct___darwin_zmm_reg = extern struct { __zmm_reg: [64]u8, }; pub const struct___darwin_opmask_reg = extern struct { __opmask_reg: [8]u8, }; pub const struct___darwin_i386_float_state = extern struct { __fpu_reserved: [2]c_int, __fpu_fcw: struct___darwin_fp_control, __fpu_fsw: struct___darwin_fp_status, __fpu_ftw: __uint8_t, __fpu_rsrv1: __uint8_t, __fpu_fop: __uint16_t, __fpu_ip: __uint32_t, __fpu_cs: __uint16_t, __fpu_rsrv2: __uint16_t, __fpu_dp: __uint32_t, __fpu_ds: __uint16_t, __fpu_rsrv3: __uint16_t, __fpu_mxcsr: __uint32_t, __fpu_mxcsrmask: __uint32_t, __fpu_stmm0: struct___darwin_mmst_reg, __fpu_stmm1: struct___darwin_mmst_reg, __fpu_stmm2: struct___darwin_mmst_reg, __fpu_stmm3: struct___darwin_mmst_reg, __fpu_stmm4: struct___darwin_mmst_reg, __fpu_stmm5: struct___darwin_mmst_reg, __fpu_stmm6: struct___darwin_mmst_reg, __fpu_stmm7: struct___darwin_mmst_reg, __fpu_xmm0: struct___darwin_xmm_reg, __fpu_xmm1: struct___darwin_xmm_reg, __fpu_xmm2: struct___darwin_xmm_reg, __fpu_xmm3: struct___darwin_xmm_reg, __fpu_xmm4: struct___darwin_xmm_reg, __fpu_xmm5: struct___darwin_xmm_reg, __fpu_xmm6: struct___darwin_xmm_reg, __fpu_xmm7: struct___darwin_xmm_reg, __fpu_rsrv4: [224]u8, __fpu_reserved1: c_int, }; pub const struct___darwin_i386_avx_state = extern struct { __fpu_reserved: [2]c_int, __fpu_fcw: struct___darwin_fp_control, __fpu_fsw: struct___darwin_fp_status, __fpu_ftw: __uint8_t, __fpu_rsrv1: __uint8_t, __fpu_fop: __uint16_t, __fpu_ip: __uint32_t, __fpu_cs: __uint16_t, __fpu_rsrv2: __uint16_t, __fpu_dp: __uint32_t, __fpu_ds: __uint16_t, __fpu_rsrv3: __uint16_t, __fpu_mxcsr: __uint32_t, __fpu_mxcsrmask: __uint32_t, __fpu_stmm0: struct___darwin_mmst_reg, __fpu_stmm1: struct___darwin_mmst_reg, __fpu_stmm2: struct___darwin_mmst_reg, __fpu_stmm3: struct___darwin_mmst_reg, __fpu_stmm4: struct___darwin_mmst_reg, __fpu_stmm5: struct___darwin_mmst_reg, __fpu_stmm6: struct___darwin_mmst_reg, __fpu_stmm7: struct___darwin_mmst_reg, __fpu_xmm0: struct___darwin_xmm_reg, __fpu_xmm1: struct___darwin_xmm_reg, __fpu_xmm2: struct___darwin_xmm_reg, __fpu_xmm3: struct___darwin_xmm_reg, __fpu_xmm4: struct___darwin_xmm_reg, __fpu_xmm5: struct___darwin_xmm_reg, __fpu_xmm6: struct___darwin_xmm_reg, __fpu_xmm7: struct___darwin_xmm_reg, __fpu_rsrv4: [224]u8, __fpu_reserved1: c_int, __avx_reserved1: [64]u8, __fpu_ymmh0: struct___darwin_xmm_reg, __fpu_ymmh1: struct___darwin_xmm_reg, __fpu_ymmh2: struct___darwin_xmm_reg, __fpu_ymmh3: struct___darwin_xmm_reg, __fpu_ymmh4: struct___darwin_xmm_reg, __fpu_ymmh5: struct___darwin_xmm_reg, __fpu_ymmh6: struct___darwin_xmm_reg, __fpu_ymmh7: struct___darwin_xmm_reg, }; pub const struct___darwin_i386_avx512_state = extern struct { __fpu_reserved: [2]c_int, __fpu_fcw: struct___darwin_fp_control, __fpu_fsw: struct___darwin_fp_status, __fpu_ftw: __uint8_t, __fpu_rsrv1: __uint8_t, __fpu_fop: __uint16_t, __fpu_ip: __uint32_t, __fpu_cs: __uint16_t, __fpu_rsrv2: __uint16_t, __fpu_dp: __uint32_t, __fpu_ds: __uint16_t, __fpu_rsrv3: __uint16_t, __fpu_mxcsr: __uint32_t, __fpu_mxcsrmask: __uint32_t, __fpu_stmm0: struct___darwin_mmst_reg, __fpu_stmm1: struct___darwin_mmst_reg, __fpu_stmm2: struct___darwin_mmst_reg, __fpu_stmm3: struct___darwin_mmst_reg, __fpu_stmm4: struct___darwin_mmst_reg, __fpu_stmm5: struct___darwin_mmst_reg, __fpu_stmm6: struct___darwin_mmst_reg, __fpu_stmm7: struct___darwin_mmst_reg, __fpu_xmm0: struct___darwin_xmm_reg, __fpu_xmm1: struct___darwin_xmm_reg, __fpu_xmm2: struct___darwin_xmm_reg, __fpu_xmm3: struct___darwin_xmm_reg, __fpu_xmm4: struct___darwin_xmm_reg, __fpu_xmm5: struct___darwin_xmm_reg, __fpu_xmm6: struct___darwin_xmm_reg, __fpu_xmm7: struct___darwin_xmm_reg, __fpu_rsrv4: [224]u8, __fpu_reserved1: c_int, __avx_reserved1: [64]u8, __fpu_ymmh0: struct___darwin_xmm_reg, __fpu_ymmh1: struct___darwin_xmm_reg, __fpu_ymmh2: struct___darwin_xmm_reg, __fpu_ymmh3: struct___darwin_xmm_reg, __fpu_ymmh4: struct___darwin_xmm_reg, __fpu_ymmh5: struct___darwin_xmm_reg, __fpu_ymmh6: struct___darwin_xmm_reg, __fpu_ymmh7: struct___darwin_xmm_reg, __fpu_k0: struct___darwin_opmask_reg, __fpu_k1: struct___darwin_opmask_reg, __fpu_k2: struct___darwin_opmask_reg, __fpu_k3: struct___darwin_opmask_reg, __fpu_k4: struct___darwin_opmask_reg, __fpu_k5: struct___darwin_opmask_reg, __fpu_k6: struct___darwin_opmask_reg, __fpu_k7: struct___darwin_opmask_reg, __fpu_zmmh0: struct___darwin_ymm_reg, __fpu_zmmh1: struct___darwin_ymm_reg, __fpu_zmmh2: struct___darwin_ymm_reg, __fpu_zmmh3: struct___darwin_ymm_reg, __fpu_zmmh4: struct___darwin_ymm_reg, __fpu_zmmh5: struct___darwin_ymm_reg, __fpu_zmmh6: struct___darwin_ymm_reg, __fpu_zmmh7: struct___darwin_ymm_reg, }; pub const struct___darwin_i386_exception_state = extern struct { __trapno: __uint16_t, __cpu: __uint16_t, __err: __uint32_t, __faultvaddr: __uint32_t, }; pub const struct___darwin_x86_debug_state32 = extern struct { __dr0: c_uint, __dr1: c_uint, __dr2: c_uint, __dr3: c_uint, __dr4: c_uint, __dr5: c_uint, __dr6: c_uint, __dr7: c_uint, }; pub const struct___x86_pagein_state = extern struct { __pagein_error: c_int, }; pub const struct___darwin_x86_thread_state64 = extern struct { __rax: __uint64_t, __rbx: __uint64_t, __rcx: __uint64_t, __rdx: __uint64_t, __rdi: __uint64_t, __rsi: __uint64_t, __rbp: __uint64_t, __rsp: __uint64_t, __r8: __uint64_t, __r9: __uint64_t, __r10: __uint64_t, __r11: __uint64_t, __r12: __uint64_t, __r13: __uint64_t, __r14: __uint64_t, __r15: __uint64_t, __rip: __uint64_t, __rflags: __uint64_t, __cs: __uint64_t, __fs: __uint64_t, __gs: __uint64_t, }; pub const struct___darwin_x86_thread_full_state64 = extern struct { __ss64: struct___darwin_x86_thread_state64, __ds: __uint64_t, __es: __uint64_t, __ss: __uint64_t, __gsbase: __uint64_t, }; pub const struct___darwin_x86_float_state64 = extern struct { __fpu_reserved: [2]c_int, __fpu_fcw: struct___darwin_fp_control, __fpu_fsw: struct___darwin_fp_status, __fpu_ftw: __uint8_t, __fpu_rsrv1: __uint8_t, __fpu_fop: __uint16_t, __fpu_ip: __uint32_t, __fpu_cs: __uint16_t, __fpu_rsrv2: __uint16_t, __fpu_dp: __uint32_t, __fpu_ds: __uint16_t, __fpu_rsrv3: __uint16_t, __fpu_mxcsr: __uint32_t, __fpu_mxcsrmask: __uint32_t, __fpu_stmm0: struct___darwin_mmst_reg, __fpu_stmm1: struct___darwin_mmst_reg, __fpu_stmm2: struct___darwin_mmst_reg, __fpu_stmm3: struct___darwin_mmst_reg, __fpu_stmm4: struct___darwin_mmst_reg, __fpu_stmm5: struct___darwin_mmst_reg, __fpu_stmm6: struct___darwin_mmst_reg, __fpu_stmm7: struct___darwin_mmst_reg, __fpu_xmm0: struct___darwin_xmm_reg, __fpu_xmm1: struct___darwin_xmm_reg, __fpu_xmm2: struct___darwin_xmm_reg, __fpu_xmm3: struct___darwin_xmm_reg, __fpu_xmm4: struct___darwin_xmm_reg, __fpu_xmm5: struct___darwin_xmm_reg, __fpu_xmm6: struct___darwin_xmm_reg, __fpu_xmm7: struct___darwin_xmm_reg, __fpu_xmm8: struct___darwin_xmm_reg, __fpu_xmm9: struct___darwin_xmm_reg, __fpu_xmm10: struct___darwin_xmm_reg, __fpu_xmm11: struct___darwin_xmm_reg, __fpu_xmm12: struct___darwin_xmm_reg, __fpu_xmm13: struct___darwin_xmm_reg, __fpu_xmm14: struct___darwin_xmm_reg, __fpu_xmm15: struct___darwin_xmm_reg, __fpu_rsrv4: [96]u8, __fpu_reserved1: c_int, }; pub const struct___darwin_x86_avx_state64 = extern struct { __fpu_reserved: [2]c_int, __fpu_fcw: struct___darwin_fp_control, __fpu_fsw: struct___darwin_fp_status, __fpu_ftw: __uint8_t, __fpu_rsrv1: __uint8_t, __fpu_fop: __uint16_t, __fpu_ip: __uint32_t, __fpu_cs: __uint16_t, __fpu_rsrv2: __uint16_t, __fpu_dp: __uint32_t, __fpu_ds: __uint16_t, __fpu_rsrv3: __uint16_t, __fpu_mxcsr: __uint32_t, __fpu_mxcsrmask: __uint32_t, __fpu_stmm0: struct___darwin_mmst_reg, __fpu_stmm1: struct___darwin_mmst_reg, __fpu_stmm2: struct___darwin_mmst_reg, __fpu_stmm3: struct___darwin_mmst_reg, __fpu_stmm4: struct___darwin_mmst_reg, __fpu_stmm5: struct___darwin_mmst_reg, __fpu_stmm6: struct___darwin_mmst_reg, __fpu_stmm7: struct___darwin_mmst_reg, __fpu_xmm0: struct___darwin_xmm_reg, __fpu_xmm1: struct___darwin_xmm_reg, __fpu_xmm2: struct___darwin_xmm_reg, __fpu_xmm3: struct___darwin_xmm_reg, __fpu_xmm4: struct___darwin_xmm_reg, __fpu_xmm5: struct___darwin_xmm_reg, __fpu_xmm6: struct___darwin_xmm_reg, __fpu_xmm7: struct___darwin_xmm_reg, __fpu_xmm8: struct___darwin_xmm_reg, __fpu_xmm9: struct___darwin_xmm_reg, __fpu_xmm10: struct___darwin_xmm_reg, __fpu_xmm11: struct___darwin_xmm_reg, __fpu_xmm12: struct___darwin_xmm_reg, __fpu_xmm13: struct___darwin_xmm_reg, __fpu_xmm14: struct___darwin_xmm_reg, __fpu_xmm15: struct___darwin_xmm_reg, __fpu_rsrv4: [96]u8, __fpu_reserved1: c_int, __avx_reserved1: [64]u8, __fpu_ymmh0: struct___darwin_xmm_reg, __fpu_ymmh1: struct___darwin_xmm_reg, __fpu_ymmh2: struct___darwin_xmm_reg, __fpu_ymmh3: struct___darwin_xmm_reg, __fpu_ymmh4: struct___darwin_xmm_reg, __fpu_ymmh5: struct___darwin_xmm_reg, __fpu_ymmh6: struct___darwin_xmm_reg, __fpu_ymmh7: struct___darwin_xmm_reg, __fpu_ymmh8: struct___darwin_xmm_reg, __fpu_ymmh9: struct___darwin_xmm_reg, __fpu_ymmh10: struct___darwin_xmm_reg, __fpu_ymmh11: struct___darwin_xmm_reg, __fpu_ymmh12: struct___darwin_xmm_reg, __fpu_ymmh13: struct___darwin_xmm_reg, __fpu_ymmh14: struct___darwin_xmm_reg, __fpu_ymmh15: struct___darwin_xmm_reg, }; pub const struct___darwin_x86_avx512_state64 = extern struct { __fpu_reserved: [2]c_int, __fpu_fcw: struct___darwin_fp_control, __fpu_fsw: struct___darwin_fp_status, __fpu_ftw: __uint8_t, __fpu_rsrv1: __uint8_t, __fpu_fop: __uint16_t, __fpu_ip: __uint32_t, __fpu_cs: __uint16_t, __fpu_rsrv2: __uint16_t, __fpu_dp: __uint32_t, __fpu_ds: __uint16_t, __fpu_rsrv3: __uint16_t, __fpu_mxcsr: __uint32_t, __fpu_mxcsrmask: __uint32_t, __fpu_stmm0: struct___darwin_mmst_reg, __fpu_stmm1: struct___darwin_mmst_reg, __fpu_stmm2: struct___darwin_mmst_reg, __fpu_stmm3: struct___darwin_mmst_reg, __fpu_stmm4: struct___darwin_mmst_reg, __fpu_stmm5: struct___darwin_mmst_reg, __fpu_stmm6: struct___darwin_mmst_reg, __fpu_stmm7: struct___darwin_mmst_reg, __fpu_xmm0: struct___darwin_xmm_reg, __fpu_xmm1: struct___darwin_xmm_reg, __fpu_xmm2: struct___darwin_xmm_reg, __fpu_xmm3: struct___darwin_xmm_reg, __fpu_xmm4: struct___darwin_xmm_reg, __fpu_xmm5: struct___darwin_xmm_reg, __fpu_xmm6: struct___darwin_xmm_reg, __fpu_xmm7: struct___darwin_xmm_reg, __fpu_xmm8: struct___darwin_xmm_reg, __fpu_xmm9: struct___darwin_xmm_reg, __fpu_xmm10: struct___darwin_xmm_reg, __fpu_xmm11: struct___darwin_xmm_reg, __fpu_xmm12: struct___darwin_xmm_reg, __fpu_xmm13: struct___darwin_xmm_reg, __fpu_xmm14: struct___darwin_xmm_reg, __fpu_xmm15: struct___darwin_xmm_reg, __fpu_rsrv4: [96]u8, __fpu_reserved1: c_int, __avx_reserved1: [64]u8, __fpu_ymmh0: struct___darwin_xmm_reg, __fpu_ymmh1: struct___darwin_xmm_reg, __fpu_ymmh2: struct___darwin_xmm_reg, __fpu_ymmh3: struct___darwin_xmm_reg, __fpu_ymmh4: struct___darwin_xmm_reg, __fpu_ymmh5: struct___darwin_xmm_reg, __fpu_ymmh6: struct___darwin_xmm_reg, __fpu_ymmh7: struct___darwin_xmm_reg, __fpu_ymmh8: struct___darwin_xmm_reg, __fpu_ymmh9: struct___darwin_xmm_reg, __fpu_ymmh10: struct___darwin_xmm_reg, __fpu_ymmh11: struct___darwin_xmm_reg, __fpu_ymmh12: struct___darwin_xmm_reg, __fpu_ymmh13: struct___darwin_xmm_reg, __fpu_ymmh14: struct___darwin_xmm_reg, __fpu_ymmh15: struct___darwin_xmm_reg, __fpu_k0: struct___darwin_opmask_reg, __fpu_k1: struct___darwin_opmask_reg, __fpu_k2: struct___darwin_opmask_reg, __fpu_k3: struct___darwin_opmask_reg, __fpu_k4: struct___darwin_opmask_reg, __fpu_k5: struct___darwin_opmask_reg, __fpu_k6: struct___darwin_opmask_reg, __fpu_k7: struct___darwin_opmask_reg, __fpu_zmmh0: struct___darwin_ymm_reg, __fpu_zmmh1: struct___darwin_ymm_reg, __fpu_zmmh2: struct___darwin_ymm_reg, __fpu_zmmh3: struct___darwin_ymm_reg, __fpu_zmmh4: struct___darwin_ymm_reg, __fpu_zmmh5: struct___darwin_ymm_reg, __fpu_zmmh6: struct___darwin_ymm_reg, __fpu_zmmh7: struct___darwin_ymm_reg, __fpu_zmmh8: struct___darwin_ymm_reg, __fpu_zmmh9: struct___darwin_ymm_reg, __fpu_zmmh10: struct___darwin_ymm_reg, __fpu_zmmh11: struct___darwin_ymm_reg, __fpu_zmmh12: struct___darwin_ymm_reg, __fpu_zmmh13: struct___darwin_ymm_reg, __fpu_zmmh14: struct___darwin_ymm_reg, __fpu_zmmh15: struct___darwin_ymm_reg, __fpu_zmm16: struct___darwin_zmm_reg, __fpu_zmm17: struct___darwin_zmm_reg, __fpu_zmm18: struct___darwin_zmm_reg, __fpu_zmm19: struct___darwin_zmm_reg, __fpu_zmm20: struct___darwin_zmm_reg, __fpu_zmm21: struct___darwin_zmm_reg, __fpu_zmm22: struct___darwin_zmm_reg, __fpu_zmm23: struct___darwin_zmm_reg, __fpu_zmm24: struct___darwin_zmm_reg, __fpu_zmm25: struct___darwin_zmm_reg, __fpu_zmm26: struct___darwin_zmm_reg, __fpu_zmm27: struct___darwin_zmm_reg, __fpu_zmm28: struct___darwin_zmm_reg, __fpu_zmm29: struct___darwin_zmm_reg, __fpu_zmm30: struct___darwin_zmm_reg, __fpu_zmm31: struct___darwin_zmm_reg, }; pub const struct___darwin_x86_exception_state64 = extern struct { __trapno: __uint16_t, __cpu: __uint16_t, __err: __uint32_t, __faultvaddr: __uint64_t, }; pub const struct___darwin_x86_debug_state64 = extern struct { __dr0: __uint64_t, __dr1: __uint64_t, __dr2: __uint64_t, __dr3: __uint64_t, __dr4: __uint64_t, __dr5: __uint64_t, __dr6: __uint64_t, __dr7: __uint64_t, }; pub const struct___darwin_x86_cpmu_state64 = extern struct { __ctrs: [16]__uint64_t, }; pub const struct___darwin_mcontext32 = extern struct { __es: struct___darwin_i386_exception_state, __ss: struct___darwin_i386_thread_state, __fs: struct___darwin_i386_float_state, }; pub const struct___darwin_mcontext_avx32 = extern struct { __es: struct___darwin_i386_exception_state, __ss: struct___darwin_i386_thread_state, __fs: struct___darwin_i386_avx_state, }; pub const struct___darwin_mcontext_avx512_32 = extern struct { __es: struct___darwin_i386_exception_state, __ss: struct___darwin_i386_thread_state, __fs: struct___darwin_i386_avx512_state, }; pub const struct___darwin_mcontext64 = extern struct { __es: struct___darwin_x86_exception_state64, __ss: struct___darwin_x86_thread_state64, __fs: struct___darwin_x86_float_state64, }; pub const struct___darwin_mcontext64_full = extern struct { __es: struct___darwin_x86_exception_state64, __ss: struct___darwin_x86_thread_full_state64, __fs: struct___darwin_x86_float_state64, }; pub const struct___darwin_mcontext_avx64 = extern struct { __es: struct___darwin_x86_exception_state64, __ss: struct___darwin_x86_thread_state64, __fs: struct___darwin_x86_avx_state64, }; pub const struct___darwin_mcontext_avx64_full = extern struct { __es: struct___darwin_x86_exception_state64, __ss: struct___darwin_x86_thread_full_state64, __fs: struct___darwin_x86_avx_state64, }; pub const struct___darwin_mcontext_avx512_64 = extern struct { __es: struct___darwin_x86_exception_state64, __ss: struct___darwin_x86_thread_state64, __fs: struct___darwin_x86_avx512_state64, }; pub const struct___darwin_mcontext_avx512_64_full = extern struct { __es: struct___darwin_x86_exception_state64, __ss: struct___darwin_x86_thread_full_state64, __fs: struct___darwin_x86_avx512_state64, }; pub const mcontext_t = [*c]struct___darwin_mcontext64; pub const pthread_attr_t = __darwin_pthread_attr_t; pub const struct___darwin_sigaltstack = extern struct { ss_sp: ?*c_void, ss_size: __darwin_size_t, ss_flags: c_int, }; pub const stack_t = struct___darwin_sigaltstack; pub const struct___darwin_ucontext = extern struct { uc_onstack: c_int, uc_sigmask: __darwin_sigset_t, uc_stack: struct___darwin_sigaltstack, uc_link: [*c]struct___darwin_ucontext, uc_mcsize: __darwin_size_t, uc_mcontext: [*c]struct___darwin_mcontext64, }; pub const ucontext_t = struct___darwin_ucontext; pub const sigset_t = __darwin_sigset_t; pub const uid_t = __darwin_uid_t; pub const union_sigval = extern union { sival_int: c_int, sival_ptr: ?*c_void, }; pub const struct_sigevent = extern struct { sigev_notify: c_int, sigev_signo: c_int, sigev_value: union_sigval, sigev_notify_function: ?fn (union_sigval) callconv(.C) void, sigev_notify_attributes: [*c]pthread_attr_t, }; pub const struct___siginfo = extern struct { si_signo: c_int, si_errno: c_int, si_code: c_int, si_pid: pid_t, si_uid: uid_t, si_status: c_int, si_addr: ?*c_void, si_value: union_sigval, si_band: c_long, __pad: [7]c_ulong, }; pub const siginfo_t = struct___siginfo; pub const union___sigaction_u = extern union { __sa_handler: ?fn (c_int) callconv(.C) void, __sa_sigaction: ?fn (c_int, [*c]struct___siginfo, ?*c_void) callconv(.C) void, }; pub const struct___sigaction = extern struct { __sigaction_u: union___sigaction_u, sa_tramp: ?fn (?*c_void, c_int, c_int, [*c]siginfo_t, ?*c_void) callconv(.C) void, sa_mask: sigset_t, sa_flags: c_int, }; pub const struct_sigaction = extern struct { __sigaction_u: union___sigaction_u, sa_mask: sigset_t, sa_flags: c_int, }; pub const sig_t = ?fn (c_int) callconv(.C) void; pub const struct_sigvec = extern struct { sv_handler: ?fn (c_int) callconv(.C) void, sv_mask: c_int, sv_flags: c_int, }; pub const struct_sigstack = extern struct { ss_sp: [*c]u8, ss_onstack: c_int, }; pub extern fn signal(c_int, ?fn (c_int) callconv(.C) void) ?fn (c_int) callconv(.C) void; pub const struct_timeval = extern struct { tv_sec: __darwin_time_t, tv_usec: __darwin_suseconds_t, }; pub const rlim_t = __uint64_t; pub const struct_rusage = extern struct { ru_utime: struct_timeval, ru_stime: struct_timeval, ru_maxrss: c_long, ru_ixrss: c_long, ru_idrss: c_long, ru_isrss: c_long, ru_minflt: c_long, ru_majflt: c_long, ru_nswap: c_long, ru_inblock: c_long, ru_oublock: c_long, ru_msgsnd: c_long, ru_msgrcv: c_long, ru_nsignals: c_long, ru_nvcsw: c_long, ru_nivcsw: c_long, }; pub const rusage_info_t = ?*c_void; pub const struct_rusage_info_v0 = extern struct { ri_uuid: [16]u8, ri_user_time: u64, ri_system_time: u64, ri_pkg_idle_wkups: u64, ri_interrupt_wkups: u64, ri_pageins: u64, ri_wired_size: u64, ri_resident_size: u64, ri_phys_footprint: u64, ri_proc_start_abstime: u64, ri_proc_exit_abstime: u64, }; pub const struct_rusage_info_v1 = extern struct { ri_uuid: [16]u8, ri_user_time: u64, ri_system_time: u64, ri_pkg_idle_wkups: u64, ri_interrupt_wkups: u64, ri_pageins: u64, ri_wired_size: u64, ri_resident_size: u64, ri_phys_footprint: u64, ri_proc_start_abstime: u64, ri_proc_exit_abstime: u64, ri_child_user_time: u64, ri_child_system_time: u64, ri_child_pkg_idle_wkups: u64, ri_child_interrupt_wkups: u64, ri_child_pageins: u64, ri_child_elapsed_abstime: u64, }; pub const struct_rusage_info_v2 = extern struct { ri_uuid: [16]u8, ri_user_time: u64, ri_system_time: u64, ri_pkg_idle_wkups: u64, ri_interrupt_wkups: u64, ri_pageins: u64, ri_wired_size: u64, ri_resident_size: u64, ri_phys_footprint: u64, ri_proc_start_abstime: u64, ri_proc_exit_abstime: u64, ri_child_user_time: u64, ri_child_system_time: u64, ri_child_pkg_idle_wkups: u64, ri_child_interrupt_wkups: u64, ri_child_pageins: u64, ri_child_elapsed_abstime: u64, ri_diskio_bytesread: u64, ri_diskio_byteswritten: u64, }; pub const struct_rusage_info_v3 = extern struct { ri_uuid: [16]u8, ri_user_time: u64, ri_system_time: u64, ri_pkg_idle_wkups: u64, ri_interrupt_wkups: u64, ri_pageins: u64, ri_wired_size: u64, ri_resident_size: u64, ri_phys_footprint: u64, ri_proc_start_abstime: u64, ri_proc_exit_abstime: u64, ri_child_user_time: u64, ri_child_system_time: u64, ri_child_pkg_idle_wkups: u64, ri_child_interrupt_wkups: u64, ri_child_pageins: u64, ri_child_elapsed_abstime: u64, ri_diskio_bytesread: u64, ri_diskio_byteswritten: u64, ri_cpu_time_qos_default: u64, ri_cpu_time_qos_maintenance: u64, ri_cpu_time_qos_background: u64, ri_cpu_time_qos_utility: u64, ri_cpu_time_qos_legacy: u64, ri_cpu_time_qos_user_initiated: u64, ri_cpu_time_qos_user_interactive: u64, ri_billed_system_time: u64, ri_serviced_system_time: u64, }; pub const struct_rusage_info_v4 = extern struct { ri_uuid: [16]u8, ri_user_time: u64, ri_system_time: u64, ri_pkg_idle_wkups: u64, ri_interrupt_wkups: u64, ri_pageins: u64, ri_wired_size: u64, ri_resident_size: u64, ri_phys_footprint: u64, ri_proc_start_abstime: u64, ri_proc_exit_abstime: u64, ri_child_user_time: u64, ri_child_system_time: u64, ri_child_pkg_idle_wkups: u64, ri_child_interrupt_wkups: u64, ri_child_pageins: u64, ri_child_elapsed_abstime: u64, ri_diskio_bytesread: u64, ri_diskio_byteswritten: u64, ri_cpu_time_qos_default: u64, ri_cpu_time_qos_maintenance: u64, ri_cpu_time_qos_background: u64, ri_cpu_time_qos_utility: u64, ri_cpu_time_qos_legacy: u64, ri_cpu_time_qos_user_initiated: u64, ri_cpu_time_qos_user_interactive: u64, ri_billed_system_time: u64, ri_serviced_system_time: u64, ri_logical_writes: u64, ri_lifetime_max_phys_footprint: u64, ri_instructions: u64, ri_cycles: u64, ri_billed_energy: u64, ri_serviced_energy: u64, ri_interval_max_phys_footprint: u64, ri_runnable_time: u64, }; pub const rusage_info_current = struct_rusage_info_v4; pub const struct_rlimit = extern struct { rlim_cur: rlim_t, rlim_max: rlim_t, }; pub const struct_proc_rlimit_control_wakeupmon = extern struct { wm_flags: u32, wm_rate: i32, }; pub extern fn getpriority(c_int, id_t) c_int; pub extern fn getiopolicy_np(c_int, c_int) c_int; pub extern fn getrlimit(c_int, [*c]struct_rlimit) c_int; pub extern fn getrusage(c_int, [*c]struct_rusage) c_int; pub extern fn setpriority(c_int, id_t, c_int) c_int; pub extern fn setiopolicy_np(c_int, c_int, c_int) c_int; pub extern fn setrlimit(c_int, [*c]const struct_rlimit) c_int; pub fn _OSSwapInt16(arg__data: __uint16_t) callconv(.C) __uint16_t { var _data = arg__data; return @bitCast(__uint16_t, @truncate(c_short, (@bitCast(c_int, @as(c_uint, _data)) << @intCast(@import("std").math.Log2Int(c_int), 8)) | (@bitCast(c_int, @as(c_uint, _data)) >> @intCast(@import("std").math.Log2Int(c_int), 8)))); } pub fn _OSSwapInt32(arg__data: __uint32_t) callconv(.C) __uint32_t { var _data = arg__data; return __builtin_bswap32(_data); } pub fn _OSSwapInt64(arg__data: __uint64_t) callconv(.C) __uint64_t { var _data = arg__data; return __builtin_bswap64(_data); } // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/wait.h:201:19: warning: struct demoted to opaque type - has bitfield const struct_unnamed_1 = opaque {}; // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/wait.h:220:19: warning: struct demoted to opaque type - has bitfield const struct_unnamed_2 = opaque {}; pub const union_wait = extern union { w_status: c_int, w_T: struct_unnamed_1, w_S: struct_unnamed_2, }; pub extern fn wait([*c]c_int) pid_t; pub extern fn waitpid(pid_t, [*c]c_int, c_int) pid_t; pub extern fn waitid(idtype_t, id_t, [*c]siginfo_t, c_int) c_int; pub extern fn wait3([*c]c_int, c_int, [*c]struct_rusage) pid_t; pub extern fn wait4(pid_t, [*c]c_int, c_int, [*c]struct_rusage) pid_t; pub extern fn alloca(c_ulong) ?*c_void; pub const ct_rune_t = __darwin_ct_rune_t; pub const rune_t = __darwin_rune_t; pub const wchar_t = __darwin_wchar_t; pub const div_t = extern struct { quot: c_int, rem: c_int, }; pub const ldiv_t = extern struct { quot: c_long, rem: c_long, }; pub const lldiv_t = extern struct { quot: c_longlong, rem: c_longlong, }; pub extern var __mb_cur_max: c_int; pub extern fn malloc(__size: c_ulong) ?*c_void; pub extern fn calloc(__count: c_ulong, __size: c_ulong) ?*c_void; pub extern fn free(?*c_void) void; pub extern fn realloc(__ptr: ?*c_void, __size: c_ulong) ?*c_void; pub extern fn valloc(usize) ?*c_void; pub extern fn aligned_alloc(__alignment: usize, __size: usize) ?*c_void; pub extern fn posix_memalign(__memptr: [*c]?*c_void, __alignment: usize, __size: usize) c_int; pub extern fn abort() noreturn; pub extern fn abs(c_int) c_int; pub extern fn atexit(?fn () callconv(.C) void) c_int; pub extern fn atof([*c]const u8) f64; pub extern fn atoi([*c]const u8) c_int; pub extern fn atol([*c]const u8) c_long; pub extern fn atoll([*c]const u8) c_longlong; pub extern fn bsearch(__key: ?*const c_void, __base: ?*const c_void, __nel: usize, __width: usize, __compar: ?fn (?*const c_void, ?*const c_void) callconv(.C) c_int) ?*c_void; pub extern fn div(c_int, c_int) div_t; pub extern fn exit(c_int) noreturn; pub extern fn getenv([*c]const u8) [*c]u8; pub extern fn labs(c_long) c_long; pub extern fn ldiv(c_long, c_long) ldiv_t; pub extern fn llabs(c_longlong) c_longlong; pub extern fn lldiv(c_longlong, c_longlong) lldiv_t; pub extern fn mblen(__s: [*c]const u8, __n: usize) c_int; pub extern fn mbstowcs(noalias [*c]wchar_t, noalias [*c]const u8, usize) usize; pub extern fn mbtowc(noalias [*c]wchar_t, noalias [*c]const u8, usize) c_int; pub extern fn qsort(__base: ?*c_void, __nel: usize, __width: usize, __compar: ?fn (?*const c_void, ?*const c_void) callconv(.C) c_int) void; pub extern fn rand() c_int; pub extern fn srand(c_uint) void; pub extern fn strtod([*c]const u8, [*c][*c]u8) f64; pub extern fn strtof([*c]const u8, [*c][*c]u8) f32; pub extern fn strtol(__str: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_long; pub extern fn strtold([*c]const u8, [*c][*c]u8) c_longdouble; pub extern fn strtoll(__str: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_longlong; pub extern fn strtoul(__str: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_ulong; pub extern fn strtoull(__str: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_ulonglong; pub extern fn system([*c]const u8) c_int; pub extern fn wcstombs(noalias [*c]u8, noalias [*c]const wchar_t, usize) usize; pub extern fn wctomb([*c]u8, wchar_t) c_int; pub extern fn _Exit(c_int) noreturn; pub extern fn a64l([*c]const u8) c_long; pub extern fn drand48() f64; pub extern fn ecvt(f64, c_int, noalias [*c]c_int, noalias [*c]c_int) [*c]u8; pub extern fn erand48([*c]c_ushort) f64; pub extern fn fcvt(f64, c_int, noalias [*c]c_int, noalias [*c]c_int) [*c]u8; pub extern fn gcvt(f64, c_int, [*c]u8) [*c]u8; pub extern fn getsubopt([*c][*c]u8, [*c]const [*c]u8, [*c][*c]u8) c_int; pub extern fn grantpt(c_int) c_int; pub extern fn initstate(c_uint, [*c]u8, usize) [*c]u8; pub extern fn jrand48([*c]c_ushort) c_long; pub extern fn l64a(c_long) [*c]u8; pub extern fn lcong48([*c]c_ushort) void; pub extern fn lrand48() c_long; pub extern fn mktemp([*c]u8) [*c]u8; pub extern fn mkstemp([*c]u8) c_int; pub extern fn mrand48() c_long; pub extern fn nrand48([*c]c_ushort) c_long; pub extern fn posix_openpt(c_int) c_int; pub extern fn ptsname(c_int) [*c]u8; pub extern fn ptsname_r(fildes: c_int, buffer: [*c]u8, buflen: usize) c_int; pub extern fn putenv([*c]u8) c_int; pub extern fn random() c_long; pub extern fn rand_r([*c]c_uint) c_int; pub extern fn realpath(noalias [*c]const u8, noalias [*c]u8) [*c]u8; pub extern fn seed48([*c]c_ushort) [*c]c_ushort; pub extern fn setenv(__name: [*c]const u8, __value: [*c]const u8, __overwrite: c_int) c_int; pub extern fn setkey([*c]const u8) void; pub extern fn setstate([*c]const u8) [*c]u8; pub extern fn srand48(c_long) void; pub extern fn srandom(c_uint) void; pub extern fn unlockpt(c_int) c_int; pub extern fn unsetenv([*c]const u8) c_int; pub const dev_t = __darwin_dev_t; pub const mode_t = __darwin_mode_t; pub extern fn arc4random() u32; pub extern fn arc4random_addrandom([*c]u8, c_int) void; pub extern fn arc4random_buf(__buf: ?*c_void, __nbytes: usize) void; pub extern fn arc4random_stir() void; pub extern fn arc4random_uniform(__upper_bound: u32) u32; // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:275:6: warning: unsupported type: 'BlockPointer' pub const atexit_b = @compileError("unable to resolve prototype of function"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:275:6 // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:276:7: warning: unsupported type: 'BlockPointer' pub const bsearch_b = @compileError("unable to resolve prototype of function"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:276:7 pub extern fn cgetcap([*c]u8, [*c]const u8, c_int) [*c]u8; pub extern fn cgetclose() c_int; pub extern fn cgetent([*c][*c]u8, [*c][*c]u8, [*c]const u8) c_int; pub extern fn cgetfirst([*c][*c]u8, [*c][*c]u8) c_int; pub extern fn cgetmatch([*c]const u8, [*c]const u8) c_int; pub extern fn cgetnext([*c][*c]u8, [*c][*c]u8) c_int; pub extern fn cgetnum([*c]u8, [*c]const u8, [*c]c_long) c_int; pub extern fn cgetset([*c]const u8) c_int; pub extern fn cgetstr([*c]u8, [*c]const u8, [*c][*c]u8) c_int; pub extern fn cgetustr([*c]u8, [*c]const u8, [*c][*c]u8) c_int; pub extern fn daemon(c_int, c_int) c_int; pub extern fn devname(dev_t, mode_t) [*c]u8; pub extern fn devname_r(dev_t, mode_t, buf: [*c]u8, len: c_int) [*c]u8; pub extern fn getbsize([*c]c_int, [*c]c_long) [*c]u8; pub extern fn getloadavg([*c]f64, c_int) c_int; pub extern fn getprogname() [*c]const u8; pub extern fn setprogname([*c]const u8) void; pub extern fn heapsort(__base: ?*c_void, __nel: usize, __width: usize, __compar: ?fn (?*const c_void, ?*const c_void) callconv(.C) c_int) c_int; // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:312:6: warning: unsupported type: 'BlockPointer' pub const heapsort_b = @compileError("unable to resolve prototype of function"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:312:6 pub extern fn mergesort(__base: ?*c_void, __nel: usize, __width: usize, __compar: ?fn (?*const c_void, ?*const c_void) callconv(.C) c_int) c_int; // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:319:6: warning: unsupported type: 'BlockPointer' pub const mergesort_b = @compileError("unable to resolve prototype of function"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:319:6 pub extern fn psort(__base: ?*c_void, __nel: usize, __width: usize, __compar: ?fn (?*const c_void, ?*const c_void) callconv(.C) c_int) void; // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:327:7: warning: unsupported type: 'BlockPointer' pub const psort_b = @compileError("unable to resolve prototype of function"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:327:7 pub extern fn psort_r(__base: ?*c_void, __nel: usize, __width: usize, ?*c_void, __compar: ?fn (?*c_void, ?*const c_void, ?*const c_void) callconv(.C) c_int) void; // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:335:7: warning: unsupported type: 'BlockPointer' pub const qsort_b = @compileError("unable to resolve prototype of function"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/stdlib.h:335:7 pub extern fn qsort_r(__base: ?*c_void, __nel: usize, __width: usize, ?*c_void, __compar: ?fn (?*c_void, ?*const c_void, ?*const c_void) callconv(.C) c_int) void; pub extern fn radixsort(__base: [*c][*c]const u8, __nel: c_int, __table: [*c]const u8, __endbyte: c_uint) c_int; pub extern fn rpmatch([*c]const u8) c_int; pub extern fn sradixsort(__base: [*c][*c]const u8, __nel: c_int, __table: [*c]const u8, __endbyte: c_uint) c_int; pub extern fn sranddev() void; pub extern fn srandomdev() void; pub extern fn reallocf(__ptr: ?*c_void, __size: usize) ?*c_void; pub extern fn strtoq(__str: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_longlong; pub extern fn strtouq(__str: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_ulonglong; pub extern var suboptarg: [*c]u8; pub const WGPUAddressMode_ClampToEdge: c_int = 0; pub const WGPUAddressMode_Repeat: c_int = 1; pub const WGPUAddressMode_MirrorRepeat: c_int = 2; pub const enum_WGPUAddressMode = c_uint; pub const WGPUAddressMode = enum_WGPUAddressMode; pub const WGPUBackend_Empty: c_int = 0; pub const WGPUBackend_Vulkan: c_int = 1; pub const WGPUBackend_Metal: c_int = 2; pub const WGPUBackend_Dx12: c_int = 3; pub const WGPUBackend_Dx11: c_int = 4; pub const WGPUBackend_Gl: c_int = 5; pub const WGPUBackend_BrowserWebGpu: c_int = 6; pub const enum_WGPUBackend = c_uint; pub const WGPUBackend = u8; pub const WGPUBindingType_UniformBuffer: c_int = 0; pub const WGPUBindingType_StorageBuffer: c_int = 1; pub const WGPUBindingType_ReadonlyStorageBuffer: c_int = 2; pub const WGPUBindingType_Sampler: c_int = 3; pub const WGPUBindingType_ComparisonSampler: c_int = 4; pub const WGPUBindingType_SampledTexture: c_int = 5; pub const WGPUBindingType_ReadonlyStorageTexture: c_int = 6; pub const WGPUBindingType_WriteonlyStorageTexture: c_int = 7; pub const enum_WGPUBindingType = c_uint; pub const WGPUBindingType = u32; pub const WGPUBlendFactor_Zero: c_int = 0; pub const WGPUBlendFactor_One: c_int = 1; pub const WGPUBlendFactor_SrcColor: c_int = 2; pub const WGPUBlendFactor_OneMinusSrcColor: c_int = 3; pub const WGPUBlendFactor_SrcAlpha: c_int = 4; pub const WGPUBlendFactor_OneMinusSrcAlpha: c_int = 5; pub const WGPUBlendFactor_DstColor: c_int = 6; pub const WGPUBlendFactor_OneMinusDstColor: c_int = 7; pub const WGPUBlendFactor_DstAlpha: c_int = 8; pub const WGPUBlendFactor_OneMinusDstAlpha: c_int = 9; pub const WGPUBlendFactor_SrcAlphaSaturated: c_int = 10; pub const WGPUBlendFactor_BlendColor: c_int = 11; pub const WGPUBlendFactor_OneMinusBlendColor: c_int = 12; pub const enum_WGPUBlendFactor = c_uint; pub const WGPUBlendFactor = enum_WGPUBlendFactor; pub const WGPUBlendOperation_Add: c_int = 0; pub const WGPUBlendOperation_Subtract: c_int = 1; pub const WGPUBlendOperation_ReverseSubtract: c_int = 2; pub const WGPUBlendOperation_Min: c_int = 3; pub const WGPUBlendOperation_Max: c_int = 4; pub const enum_WGPUBlendOperation = c_uint; pub const WGPUBlendOperation = enum_WGPUBlendOperation; pub const WGPUBufferMapAsyncStatus_Success: c_int = 0; pub const WGPUBufferMapAsyncStatus_Error: c_int = 1; pub const WGPUBufferMapAsyncStatus_Unknown: c_int = 2; pub const WGPUBufferMapAsyncStatus_ContextLost: c_int = 3; pub const enum_WGPUBufferMapAsyncStatus = c_uint; pub const WGPUBufferMapAsyncStatus = enum_WGPUBufferMapAsyncStatus; pub const WGPUCDeviceType_Other: c_int = 0; pub const WGPUCDeviceType_IntegratedGpu: c_int = 1; pub const WGPUCDeviceType_DiscreteGpu: c_int = 2; pub const WGPUCDeviceType_VirtualGpu: c_int = 3; pub const WGPUCDeviceType_Cpu: c_int = 4; pub const enum_WGPUCDeviceType = c_uint; pub const WGPUCDeviceType = u8; pub const WGPUCompareFunction_Undefined: c_int = 0; pub const WGPUCompareFunction_Never: c_int = 1; pub const WGPUCompareFunction_Less: c_int = 2; pub const WGPUCompareFunction_Equal: c_int = 3; pub const WGPUCompareFunction_LessEqual: c_int = 4; pub const WGPUCompareFunction_Greater: c_int = 5; pub const WGPUCompareFunction_NotEqual: c_int = 6; pub const WGPUCompareFunction_GreaterEqual: c_int = 7; pub const WGPUCompareFunction_Always: c_int = 8; pub const enum_WGPUCompareFunction = c_uint; pub const WGPUCompareFunction = enum_WGPUCompareFunction; pub const WGPUCullMode_None: c_int = 0; pub const WGPUCullMode_Front: c_int = 1; pub const WGPUCullMode_Back: c_int = 2; pub const enum_WGPUCullMode = c_uint; pub const WGPUCullMode = enum_WGPUCullMode; pub const WGPUFilterMode_Nearest: c_int = 0; pub const WGPUFilterMode_Linear: c_int = 1; pub const enum_WGPUFilterMode = c_uint; pub const WGPUFilterMode = enum_WGPUFilterMode; pub const WGPUFrontFace_Ccw: c_int = 0; pub const WGPUFrontFace_Cw: c_int = 1; pub const enum_WGPUFrontFace = c_uint; pub const WGPUFrontFace = enum_WGPUFrontFace; pub const WGPUIndexFormat_Uint16: c_int = 0; pub const WGPUIndexFormat_Uint32: c_int = 1; pub const enum_WGPUIndexFormat = c_uint; pub const WGPUIndexFormat = enum_WGPUIndexFormat; pub const WGPUInputStepMode_Vertex: c_int = 0; pub const WGPUInputStepMode_Instance: c_int = 1; pub const enum_WGPUInputStepMode = c_uint; pub const WGPUInputStepMode = enum_WGPUInputStepMode; pub const WGPULoadOp_Clear: c_int = 0; pub const WGPULoadOp_Load: c_int = 1; pub const enum_WGPULoadOp = c_uint; pub const WGPULoadOp = enum_WGPULoadOp; pub const WGPULogLevel_Off: c_int = 0; pub const WGPULogLevel_Error: c_int = 1; pub const WGPULogLevel_Warn: c_int = 2; pub const WGPULogLevel_Info: c_int = 3; pub const WGPULogLevel_Debug: c_int = 4; pub const WGPULogLevel_Trace: c_int = 5; pub const enum_WGPULogLevel = c_uint; pub const WGPULogLevel = enum_WGPULogLevel; pub const WGPUPowerPreference_Default: c_int = 0; pub const WGPUPowerPreference_LowPower: c_int = 1; pub const WGPUPowerPreference_HighPerformance: c_int = 2; pub const enum_WGPUPowerPreference = c_uint; pub const WGPUPowerPreference = enum_WGPUPowerPreference; pub const WGPUPresentMode_Immediate: c_int = 0; pub const WGPUPresentMode_Mailbox: c_int = 1; pub const WGPUPresentMode_Fifo: c_int = 2; pub const enum_WGPUPresentMode = c_uint; pub const WGPUPresentMode = enum_WGPUPresentMode; pub const WGPUPrimitiveTopology_PointList: c_int = 0; pub const WGPUPrimitiveTopology_LineList: c_int = 1; pub const WGPUPrimitiveTopology_LineStrip: c_int = 2; pub const WGPUPrimitiveTopology_TriangleList: c_int = 3; pub const WGPUPrimitiveTopology_TriangleStrip: c_int = 4; pub const enum_WGPUPrimitiveTopology = c_uint; pub const WGPUPrimitiveTopology = enum_WGPUPrimitiveTopology; pub const WGPUSType_Invalid: c_int = 0; pub const WGPUSType_SurfaceDescriptorFromMetalLayer: c_int = 1; pub const WGPUSType_SurfaceDescriptorFromWindowsHWND: c_int = 2; pub const WGPUSType_SurfaceDescriptorFromXlib: c_int = 3; pub const WGPUSType_SurfaceDescriptorFromHTMLCanvasId: c_int = 4; pub const WGPUSType_ShaderModuleSPIRVDescriptor: c_int = 5; pub const WGPUSType_ShaderModuleWGSLDescriptor: c_int = 6; pub const WGPUSType_AnisotropicFiltering: c_int = 268435456; pub const WGPUSType_Force32: c_int = 2147483647; pub const enum_WGPUSType = c_uint; pub const WGPUStencilOperation_Keep: c_int = 0; pub const WGPUStencilOperation_Zero: c_int = 1; pub const WGPUStencilOperation_Replace: c_int = 2; pub const WGPUStencilOperation_Invert: c_int = 3; pub const WGPUStencilOperation_IncrementClamp: c_int = 4; pub const WGPUStencilOperation_DecrementClamp: c_int = 5; pub const WGPUStencilOperation_IncrementWrap: c_int = 6; pub const WGPUStencilOperation_DecrementWrap: c_int = 7; pub const enum_WGPUStencilOperation = c_uint; pub const WGPUStencilOperation = enum_WGPUStencilOperation; pub const WGPUStoreOp_Clear: c_int = 0; pub const WGPUStoreOp_Store: c_int = 1; pub const enum_WGPUStoreOp = c_uint; pub const WGPUStoreOp = enum_WGPUStoreOp; pub const WGPUSwapChainStatus_Good: c_int = 0; pub const WGPUSwapChainStatus_Suboptimal: c_int = 1; pub const WGPUSwapChainStatus_Timeout: c_int = 2; pub const WGPUSwapChainStatus_Outdated: c_int = 3; pub const WGPUSwapChainStatus_Lost: c_int = 4; pub const WGPUSwapChainStatus_OutOfMemory: c_int = 5; pub const enum_WGPUSwapChainStatus = c_uint; pub const WGPUSwapChainStatus = enum_WGPUSwapChainStatus; pub const WGPUTextureAspect_All: c_int = 0; pub const WGPUTextureAspect_StencilOnly: c_int = 1; pub const WGPUTextureAspect_DepthOnly: c_int = 2; pub const enum_WGPUTextureAspect = c_uint; pub const WGPUTextureAspect = enum_WGPUTextureAspect; pub const WGPUTextureComponentType_Float: c_int = 0; pub const WGPUTextureComponentType_Sint: c_int = 1; pub const WGPUTextureComponentType_Uint: c_int = 2; pub const enum_WGPUTextureComponentType = c_uint; pub const WGPUTextureComponentType = enum_WGPUTextureComponentType; pub const WGPUTextureDimension_D1: c_int = 0; pub const WGPUTextureDimension_D2: c_int = 1; pub const WGPUTextureDimension_D3: c_int = 2; pub const enum_WGPUTextureDimension = c_uint; pub const WGPUTextureDimension = enum_WGPUTextureDimension; pub const WGPUTextureFormat_R8Unorm: c_int = 0; pub const WGPUTextureFormat_R8Snorm: c_int = 1; pub const WGPUTextureFormat_R8Uint: c_int = 2; pub const WGPUTextureFormat_R8Sint: c_int = 3; pub const WGPUTextureFormat_R16Uint: c_int = 4; pub const WGPUTextureFormat_R16Sint: c_int = 5; pub const WGPUTextureFormat_R16Float: c_int = 6; pub const WGPUTextureFormat_Rg8Unorm: c_int = 7; pub const WGPUTextureFormat_Rg8Snorm: c_int = 8; pub const WGPUTextureFormat_Rg8Uint: c_int = 9; pub const WGPUTextureFormat_Rg8Sint: c_int = 10; pub const WGPUTextureFormat_R32Uint: c_int = 11; pub const WGPUTextureFormat_R32Sint: c_int = 12; pub const WGPUTextureFormat_R32Float: c_int = 13; pub const WGPUTextureFormat_Rg16Uint: c_int = 14; pub const WGPUTextureFormat_Rg16Sint: c_int = 15; pub const WGPUTextureFormat_Rg16Float: c_int = 16; pub const WGPUTextureFormat_Rgba8Unorm: c_int = 17; pub const WGPUTextureFormat_Rgba8UnormSrgb: c_int = 18; pub const WGPUTextureFormat_Rgba8Snorm: c_int = 19; pub const WGPUTextureFormat_Rgba8Uint: c_int = 20; pub const WGPUTextureFormat_Rgba8Sint: c_int = 21; pub const WGPUTextureFormat_Bgra8Unorm: c_int = 22; pub const WGPUTextureFormat_Bgra8UnormSrgb: c_int = 23; pub const WGPUTextureFormat_Rgb10a2Unorm: c_int = 24; pub const WGPUTextureFormat_Rg11b10Float: c_int = 25; pub const WGPUTextureFormat_Rg32Uint: c_int = 26; pub const WGPUTextureFormat_Rg32Sint: c_int = 27; pub const WGPUTextureFormat_Rg32Float: c_int = 28; pub const WGPUTextureFormat_Rgba16Uint: c_int = 29; pub const WGPUTextureFormat_Rgba16Sint: c_int = 30; pub const WGPUTextureFormat_Rgba16Float: c_int = 31; pub const WGPUTextureFormat_Rgba32Uint: c_int = 32; pub const WGPUTextureFormat_Rgba32Sint: c_int = 33; pub const WGPUTextureFormat_Rgba32Float: c_int = 34; pub const WGPUTextureFormat_Depth32Float: c_int = 35; pub const WGPUTextureFormat_Depth24Plus: c_int = 36; pub const WGPUTextureFormat_Depth24PlusStencil8: c_int = 37; pub const enum_WGPUTextureFormat = c_uint; pub const WGPUTextureFormat = enum_WGPUTextureFormat; pub const WGPUTextureViewDimension_D1: c_int = 0; pub const WGPUTextureViewDimension_D2: c_int = 1; pub const WGPUTextureViewDimension_D2Array: c_int = 2; pub const WGPUTextureViewDimension_Cube: c_int = 3; pub const WGPUTextureViewDimension_CubeArray: c_int = 4; pub const WGPUTextureViewDimension_D3: c_int = 5; pub const enum_WGPUTextureViewDimension = c_uint; pub const WGPUTextureViewDimension = enum_WGPUTextureViewDimension; pub const WGPUVertexFormat_Uchar2: c_int = 0; pub const WGPUVertexFormat_Uchar4: c_int = 1; pub const WGPUVertexFormat_Char2: c_int = 2; pub const WGPUVertexFormat_Char4: c_int = 3; pub const WGPUVertexFormat_Uchar2Norm: c_int = 4; pub const WGPUVertexFormat_Uchar4Norm: c_int = 5; pub const WGPUVertexFormat_Char2Norm: c_int = 6; pub const WGPUVertexFormat_Char4Norm: c_int = 7; pub const WGPUVertexFormat_Ushort2: c_int = 8; pub const WGPUVertexFormat_Ushort4: c_int = 9; pub const WGPUVertexFormat_Short2: c_int = 10; pub const WGPUVertexFormat_Short4: c_int = 11; pub const WGPUVertexFormat_Ushort2Norm: c_int = 12; pub const WGPUVertexFormat_Ushort4Norm: c_int = 13; pub const WGPUVertexFormat_Short2Norm: c_int = 14; pub const WGPUVertexFormat_Short4Norm: c_int = 15; pub const WGPUVertexFormat_Half2: c_int = 16; pub const WGPUVertexFormat_Half4: c_int = 17; pub const WGPUVertexFormat_Float: c_int = 18; pub const WGPUVertexFormat_Float2: c_int = 19; pub const WGPUVertexFormat_Float3: c_int = 20; pub const WGPUVertexFormat_Float4: c_int = 21; pub const WGPUVertexFormat_Uint: c_int = 22; pub const WGPUVertexFormat_Uint2: c_int = 23; pub const WGPUVertexFormat_Uint3: c_int = 24; pub const WGPUVertexFormat_Uint4: c_int = 25; pub const WGPUVertexFormat_Int: c_int = 26; pub const WGPUVertexFormat_Int2: c_int = 27; pub const WGPUVertexFormat_Int3: c_int = 28; pub const WGPUVertexFormat_Int4: c_int = 29; pub const enum_WGPUVertexFormat = c_uint; pub const WGPUVertexFormat = enum_WGPUVertexFormat; pub const struct_WGPUComputePass = opaque {}; pub const WGPUComputePass = struct_WGPUComputePass; pub const struct_WGPUOption_BufferSize = opaque {}; pub const WGPUOption_BufferSize = struct_WGPUOption_BufferSize; pub const struct_WGPURenderBundleEncoder = opaque {}; pub const WGPURenderBundleEncoder = struct_WGPURenderBundleEncoder; pub const struct_WGPURenderPass = opaque {}; pub const WGPURenderPass = struct_WGPURenderPass; pub const WGPUId_Adapter_Dummy = WGPUNonZeroU64; pub const WGPUAdapterId = WGPUId_Adapter_Dummy; pub const WGPUFeatures = u64; pub const struct_WGPUCAdapterInfo = extern struct { name: [*c]u8, name_length: usize, vendor: usize, device: usize, device_type: WGPUCDeviceType, backend: WGPUBackend, }; pub const WGPUCAdapterInfo = struct_WGPUCAdapterInfo; pub const struct_WGPUCLimits = extern struct { max_bind_groups: u32, }; pub const WGPUCLimits = struct_WGPUCLimits; pub const WGPUId_Device_Dummy = WGPUNonZeroU64; pub const WGPUDeviceId = WGPUId_Device_Dummy; pub const WGPUId_BindGroup_Dummy = WGPUNonZeroU64; pub const WGPUBindGroupId = WGPUId_BindGroup_Dummy; pub const WGPUId_BindGroupLayout_Dummy = WGPUNonZeroU64; pub const WGPUBindGroupLayoutId = WGPUId_BindGroupLayout_Dummy; pub const WGPUId_Buffer_Dummy = WGPUNonZeroU64; pub const WGPUBufferId = WGPUId_Buffer_Dummy; pub const WGPUBufferAddress = u64; pub const WGPUBufferSize = WGPUNonZeroU64; pub const WGPUBufferMapCallback = ?fn (WGPUBufferMapAsyncStatus, [*c]u8) callconv(.C) void; pub const WGPUId_CommandBuffer_Dummy = WGPUNonZeroU64; pub const WGPUCommandBufferId = WGPUId_CommandBuffer_Dummy; pub const WGPUCommandEncoderId = WGPUCommandBufferId; pub const struct_WGPUComputePassDescriptor = extern struct { todo: u32, }; pub const WGPUComputePassDescriptor = struct_WGPUComputePassDescriptor; pub const WGPUId_TextureView_Dummy = WGPUNonZeroU64; pub const WGPUTextureViewId = WGPUId_TextureView_Dummy; pub const struct_WGPUColor = extern struct { r: f64, g: f64, b: f64, a: f64, }; pub const WGPUColor = struct_WGPUColor; pub const struct_WGPUPassChannel_Color = extern struct { load_op: WGPULoadOp, store_op: WGPUStoreOp, clear_value: WGPUColor, read_only: bool, }; pub const WGPUPassChannel_Color = struct_WGPUPassChannel_Color; pub const struct_WGPURenderPassColorAttachmentDescriptorBase_TextureViewId = extern struct { attachment: WGPUTextureViewId, resolve_target: WGPUOption_TextureViewId, channel: WGPUPassChannel_Color, }; pub const WGPURenderPassColorAttachmentDescriptorBase_TextureViewId = struct_WGPURenderPassColorAttachmentDescriptorBase_TextureViewId; pub const WGPURenderPassColorAttachmentDescriptor = WGPURenderPassColorAttachmentDescriptorBase_TextureViewId; pub const struct_WGPUPassChannel_f32 = extern struct { load_op: WGPULoadOp, store_op: WGPUStoreOp, clear_value: f32, read_only: bool, }; pub const WGPUPassChannel_f32 = struct_WGPUPassChannel_f32; pub const struct_WGPUPassChannel_u32 = extern struct { load_op: WGPULoadOp, store_op: WGPUStoreOp, clear_value: u32, read_only: bool, }; pub const WGPUPassChannel_u32 = struct_WGPUPassChannel_u32; pub const struct_WGPURenderPassDepthStencilAttachmentDescriptorBase_TextureViewId = extern struct { attachment: WGPUTextureViewId, depth: WGPUPassChannel_f32, stencil: WGPUPassChannel_u32, }; pub const WGPURenderPassDepthStencilAttachmentDescriptorBase_TextureViewId = struct_WGPURenderPassDepthStencilAttachmentDescriptorBase_TextureViewId; pub const WGPURenderPassDepthStencilAttachmentDescriptor = WGPURenderPassDepthStencilAttachmentDescriptorBase_TextureViewId; pub const struct_WGPURenderPassDescriptor = extern struct { color_attachments: [*c]const WGPURenderPassColorAttachmentDescriptor, color_attachments_length: usize, depth_stencil_attachment: [*c]const WGPURenderPassDepthStencilAttachmentDescriptor, }; pub const WGPURenderPassDescriptor = struct_WGPURenderPassDescriptor; pub const struct_WGPUTextureDataLayout = extern struct { offset: WGPUBufferAddress, bytes_per_row: u32, rows_per_image: u32, }; pub const WGPUTextureDataLayout = struct_WGPUTextureDataLayout; pub const struct_WGPUBufferCopyView = extern struct { buffer: WGPUBufferId, layout: WGPUTextureDataLayout, }; pub const WGPUBufferCopyView = struct_WGPUBufferCopyView; pub const WGPUId_Texture_Dummy = WGPUNonZeroU64; pub const WGPUTextureId = WGPUId_Texture_Dummy; pub const struct_WGPUOrigin3d = extern struct { x: u32, y: u32, z: u32, }; pub const WGPUOrigin3d = struct_WGPUOrigin3d; pub const struct_WGPUTextureCopyView = extern struct { texture: WGPUTextureId, mip_level: u32, origin: WGPUOrigin3d, }; pub const WGPUTextureCopyView = struct_WGPUTextureCopyView; pub const struct_WGPUExtent3d = extern struct { width: u32, height: u32, depth: u32, }; pub const WGPUExtent3d = struct_WGPUExtent3d; pub const struct_WGPUCommandBufferDescriptor = extern struct { todo: u32, }; pub const WGPUCommandBufferDescriptor = struct_WGPUCommandBufferDescriptor; pub const WGPURawString = [*c]const u8; pub const WGPUDynamicOffset = u32; pub const WGPUId_ComputePipeline_Dummy = WGPUNonZeroU64; pub const WGPUComputePipelineId = WGPUId_ComputePipeline_Dummy; pub const WGPUId_Surface = WGPUNonZeroU64; pub const WGPUSurfaceId = WGPUId_Surface; pub const WGPULabel = [*c]const u8; pub const struct_WGPUBindGroupEntry = extern struct { binding: u32, buffer: WGPUOption_BufferId, offset: WGPUBufferAddress, size: WGPUBufferSize, sampler: WGPUOption_SamplerId, texture_view: WGPUOption_TextureViewId, }; pub const WGPUBindGroupEntry = struct_WGPUBindGroupEntry; pub const struct_WGPUBindGroupDescriptor = extern struct { label: WGPULabel, layout: WGPUBindGroupLayoutId, entries: [*c]const WGPUBindGroupEntry, entries_length: usize, }; pub const WGPUBindGroupDescriptor = struct_WGPUBindGroupDescriptor; pub const WGPUShaderStage = u32; pub const struct_WGPUBindGroupLayoutEntry = extern struct { binding: u32, visibility: WGPUShaderStage, ty: WGPUBindingType, has_dynamic_offset: bool, min_buffer_binding_size: WGPUOption_NonZeroU64, multisampled: bool, view_dimension: WGPUTextureViewDimension, texture_component_type: WGPUTextureComponentType, storage_texture_format: WGPUTextureFormat, count: WGPUOption_NonZeroU32, }; pub const WGPUBindGroupLayoutEntry = struct_WGPUBindGroupLayoutEntry; pub const struct_WGPUBindGroupLayoutDescriptor = extern struct { label: WGPULabel, entries: [*c]const WGPUBindGroupLayoutEntry, entries_length: usize, }; pub const WGPUBindGroupLayoutDescriptor = struct_WGPUBindGroupLayoutDescriptor; pub const WGPUBufferUsage = u32; pub const struct_WGPUBufferDescriptor = extern struct { label: WGPULabel, size: WGPUBufferAddress, usage: WGPUBufferUsage, mapped_at_creation: bool, }; pub const WGPUBufferDescriptor = struct_WGPUBufferDescriptor; pub const struct_WGPUCommandEncoderDescriptor = extern struct { label: WGPULabel, }; pub const WGPUCommandEncoderDescriptor = struct_WGPUCommandEncoderDescriptor; pub const WGPUId_PipelineLayout_Dummy = WGPUNonZeroU64; pub const WGPUPipelineLayoutId = WGPUId_PipelineLayout_Dummy; pub const WGPUId_ShaderModule_Dummy = WGPUNonZeroU64; pub const WGPUShaderModuleId = WGPUId_ShaderModule_Dummy; pub const struct_WGPUProgrammableStageDescriptor = extern struct { module: WGPUShaderModuleId, entry_point: WGPURawString, }; pub const WGPUProgrammableStageDescriptor = struct_WGPUProgrammableStageDescriptor; pub const struct_WGPUComputePipelineDescriptor = extern struct { layout: WGPUPipelineLayoutId, compute_stage: WGPUProgrammableStageDescriptor, }; pub const WGPUComputePipelineDescriptor = struct_WGPUComputePipelineDescriptor; pub const struct_WGPUPipelineLayoutDescriptor = extern struct { bind_group_layouts: [*c]const WGPUBindGroupLayoutId, bind_group_layouts_length: usize, }; pub const WGPUPipelineLayoutDescriptor = struct_WGPUPipelineLayoutDescriptor; pub const WGPURenderBundleEncoderId = ?*WGPURenderBundleEncoder; pub const struct_WGPURenderBundleEncoderDescriptor = extern struct { label: WGPULabel, color_formats: [*c]const WGPUTextureFormat, color_formats_length: usize, depth_stencil_format: [*c]const WGPUTextureFormat, sample_count: u32, }; pub const WGPURenderBundleEncoderDescriptor = struct_WGPURenderBundleEncoderDescriptor; pub const WGPUId_RenderPipeline_Dummy = WGPUNonZeroU64; pub const WGPURenderPipelineId = WGPUId_RenderPipeline_Dummy; pub const struct_WGPURasterizationStateDescriptor = extern struct { front_face: WGPUFrontFace, cull_mode: WGPUCullMode, depth_bias: i32, depth_bias_slope_scale: f32, depth_bias_clamp: f32, }; pub const WGPURasterizationStateDescriptor = struct_WGPURasterizationStateDescriptor; pub const struct_WGPUBlendDescriptor = extern struct { src_factor: WGPUBlendFactor, dst_factor: WGPUBlendFactor, operation: WGPUBlendOperation, }; pub const WGPUBlendDescriptor = struct_WGPUBlendDescriptor; pub const WGPUColorWrite = u32; pub const struct_WGPUColorStateDescriptor = extern struct { format: WGPUTextureFormat, alpha_blend: WGPUBlendDescriptor, color_blend: WGPUBlendDescriptor, write_mask: WGPUColorWrite, }; pub const WGPUColorStateDescriptor = struct_WGPUColorStateDescriptor; pub const struct_WGPUStencilStateFaceDescriptor = extern struct { compare: WGPUCompareFunction, fail_op: WGPUStencilOperation, depth_fail_op: WGPUStencilOperation, pass_op: WGPUStencilOperation, }; pub const WGPUStencilStateFaceDescriptor = struct_WGPUStencilStateFaceDescriptor; pub const struct_WGPUDepthStencilStateDescriptor = extern struct { format: WGPUTextureFormat, depth_write_enabled: bool, depth_compare: WGPUCompareFunction, stencil_front: WGPUStencilStateFaceDescriptor, stencil_back: WGPUStencilStateFaceDescriptor, stencil_read_mask: u32, stencil_write_mask: u32, }; pub const WGPUDepthStencilStateDescriptor = struct_WGPUDepthStencilStateDescriptor; pub const WGPUShaderLocation = u32; pub const struct_WGPUVertexAttributeDescriptor = extern struct { offset: WGPUBufferAddress, format: WGPUVertexFormat, shader_location: WGPUShaderLocation, }; pub const WGPUVertexAttributeDescriptor = struct_WGPUVertexAttributeDescriptor; pub const struct_WGPUVertexBufferLayoutDescriptor = extern struct { array_stride: WGPUBufferAddress, step_mode: WGPUInputStepMode, attributes: [*c]const WGPUVertexAttributeDescriptor, attributes_length: usize, }; pub const WGPUVertexBufferLayoutDescriptor = struct_WGPUVertexBufferLayoutDescriptor; pub const struct_WGPUVertexStateDescriptor = extern struct { index_format: WGPUIndexFormat, vertex_buffers: [*c]const WGPUVertexBufferLayoutDescriptor, vertex_buffers_length: usize, }; pub const WGPUVertexStateDescriptor = struct_WGPUVertexStateDescriptor; pub const struct_WGPURenderPipelineDescriptor = extern struct { layout: WGPUPipelineLayoutId, vertex_stage: WGPUProgrammableStageDescriptor, fragment_stage: [*c]const WGPUProgrammableStageDescriptor, primitive_topology: WGPUPrimitiveTopology, rasterization_state: [*c]const WGPURasterizationStateDescriptor, color_states: [*c]const WGPUColorStateDescriptor, color_states_length: usize, depth_stencil_state: [*c]const WGPUDepthStencilStateDescriptor, vertex_state: WGPUVertexStateDescriptor, sample_count: u32, sample_mask: u32, alpha_to_coverage_enabled: bool, }; pub const WGPURenderPipelineDescriptor = struct_WGPURenderPipelineDescriptor; pub const WGPUId_Sampler_Dummy = WGPUNonZeroU64; pub const WGPUSamplerId = WGPUId_Sampler_Dummy; pub const struct_WGPUSamplerDescriptor = extern struct { next_in_chain: [*c]const WGPUChainedStruct, label: WGPULabel, address_mode_u: WGPUAddressMode, address_mode_v: WGPUAddressMode, address_mode_w: WGPUAddressMode, mag_filter: WGPUFilterMode, min_filter: WGPUFilterMode, mipmap_filter: WGPUFilterMode, lod_min_clamp: f32, lod_max_clamp: f32, compare: WGPUCompareFunction, }; pub const WGPUSamplerDescriptor = struct_WGPUSamplerDescriptor; pub const struct_WGPUShaderSource = extern struct { bytes: [*c]const u32, length: usize, }; pub const WGPUShaderSource = struct_WGPUShaderSource; pub const WGPUId_SwapChain_Dummy = WGPUNonZeroU64; pub const WGPUSwapChainId = WGPUId_SwapChain_Dummy; pub const WGPUTextureUsage = u32; pub const struct_WGPUSwapChainDescriptor = extern struct { usage: WGPUTextureUsage, format: WGPUTextureFormat, width: u32, height: u32, present_mode: WGPUPresentMode, }; pub const WGPUSwapChainDescriptor = struct_WGPUSwapChainDescriptor; pub const struct_WGPUTextureDescriptor = extern struct { label: WGPULabel, size: WGPUExtent3d, mip_level_count: u32, sample_count: u32, dimension: WGPUTextureDimension, format: WGPUTextureFormat, usage: WGPUTextureUsage, }; pub const WGPUTextureDescriptor = struct_WGPUTextureDescriptor; pub const WGPUQueueId = WGPUDeviceId; pub const WGPUId_RenderBundle = WGPUNonZeroU64; pub const WGPURenderBundleId = WGPUId_RenderBundle; pub const struct_WGPURenderBundleDescriptor_Label = extern struct { label: WGPULabel, }; pub const WGPURenderBundleDescriptor_Label = struct_WGPURenderBundleDescriptor_Label; pub const struct_WGPURequestAdapterOptions = extern struct { power_preference: WGPUPowerPreference, compatible_surface: WGPUOption_SurfaceId, }; pub const WGPURequestAdapterOptions = struct_WGPURequestAdapterOptions; pub const WGPUBackendBit = u32; pub const WGPURequestAdapterCallback = ?fn (WGPUOption_AdapterId, ?*c_void) callconv(.C) void; pub const WGPULogCallback = ?fn (c_int, [*c]const u8) callconv(.C) void; pub const struct_WGPUSwapChainOutput = extern struct { status: WGPUSwapChainStatus, view_id: WGPUOption_TextureViewId, }; pub const WGPUSwapChainOutput = struct_WGPUSwapChainOutput; pub const struct_WGPUTextureViewDescriptor = extern struct { label: WGPULabel, format: WGPUTextureFormat, dimension: WGPUTextureViewDimension, aspect: WGPUTextureAspect, base_mip_level: u32, level_count: u32, base_array_layer: u32, array_layer_count: u32, }; pub const WGPUTextureViewDescriptor = struct_WGPUTextureViewDescriptor; pub const struct_WGPUAnisotropicSamplerDescriptorExt = extern struct { next_in_chain: [*c]const WGPUChainedStruct, s_type: WGPUSType, anisotropic_clamp: u8, }; pub const WGPUAnisotropicSamplerDescriptorExt = struct_WGPUAnisotropicSamplerDescriptorExt; pub extern fn wgpu_adapter_destroy(adapter_id: WGPUAdapterId) void; pub extern fn wgpu_adapter_features(adapter_id: WGPUAdapterId) WGPUFeatures; pub extern fn wgpu_adapter_get_info(adapter_id: WGPUAdapterId, info: [*c]WGPUCAdapterInfo) void; pub extern fn wgpu_adapter_limits(adapter_id: WGPUAdapterId) WGPUCLimits; pub extern fn wgpu_adapter_request_device(adapter_id: WGPUAdapterId, features: WGPUFeatures, limits: [*c]const WGPUCLimits, shader_validation: bool, trace_path: [*c]const u8) WGPUDeviceId; pub extern fn wgpu_bind_group_destroy(bind_group_id: WGPUBindGroupId) void; pub extern fn wgpu_bind_group_layout_destroy(bind_group_layout_id: WGPUBindGroupLayoutId) void; pub extern fn wgpu_buffer_destroy(buffer_id: WGPUBufferId) void; pub extern fn wgpu_buffer_get_mapped_range(buffer_id: WGPUBufferId, start: WGPUBufferAddress, size: WGPUBufferSize) [*c]u8; pub extern fn wgpu_buffer_map_read_async(buffer_id: WGPUBufferId, start: WGPUBufferAddress, size: WGPUBufferAddress, callback: WGPUBufferMapCallback, user_data: [*c]u8) void; pub extern fn wgpu_buffer_map_write_async(buffer_id: WGPUBufferId, start: WGPUBufferAddress, size: WGPUBufferAddress, callback: WGPUBufferMapCallback, user_data: [*c]u8) void; pub extern fn wgpu_buffer_unmap(buffer_id: WGPUBufferId) void; pub extern fn wgpu_command_buffer_destroy(command_buffer_id: WGPUCommandBufferId) void; pub extern fn wgpu_command_encoder_begin_compute_pass(encoder_id: WGPUCommandEncoderId, _desc: [*c]const WGPUComputePassDescriptor) ?*WGPUComputePass; pub extern fn wgpu_command_encoder_begin_render_pass(encoder_id: WGPUCommandEncoderId, desc: [*c]const WGPURenderPassDescriptor) ?*WGPURenderPass; pub extern fn wgpu_command_encoder_copy_buffer_to_buffer(command_encoder_id: WGPUCommandEncoderId, source: WGPUBufferId, source_offset: WGPUBufferAddress, destination: WGPUBufferId, destination_offset: WGPUBufferAddress, size: WGPUBufferAddress) void; pub extern fn wgpu_command_encoder_copy_buffer_to_texture(command_encoder_id: WGPUCommandEncoderId, source: [*c]const WGPUBufferCopyView, destination: [*c]const WGPUTextureCopyView, copy_size: [*c]const WGPUExtent3d) void; pub extern fn wgpu_command_encoder_copy_texture_to_buffer(command_encoder_id: WGPUCommandEncoderId, source: [*c]const WGPUTextureCopyView, destination: [*c]const WGPUBufferCopyView, copy_size: [*c]const WGPUExtent3d) void; pub extern fn wgpu_command_encoder_copy_texture_to_texture(command_encoder_id: WGPUCommandEncoderId, source: [*c]const WGPUTextureCopyView, destination: [*c]const WGPUTextureCopyView, copy_size: [*c]const WGPUExtent3d) void; pub extern fn wgpu_command_encoder_destroy(command_encoder_id: WGPUCommandEncoderId) void; pub extern fn wgpu_command_encoder_finish(encoder_id: WGPUCommandEncoderId, desc: [*c]const WGPUCommandBufferDescriptor) WGPUCommandBufferId; pub extern fn wgpu_compute_pass_destroy(pass: ?*WGPUComputePass) void; pub extern fn wgpu_compute_pass_dispatch(pass: ?*WGPUComputePass, groups_x: u32, groups_y: u32, groups_z: u32) void; pub extern fn wgpu_compute_pass_dispatch_indirect(pass: ?*WGPUComputePass, buffer_id: WGPUBufferId, offset: WGPUBufferAddress) void; pub extern fn wgpu_compute_pass_end_pass(pass: ?*WGPUComputePass) void; pub extern fn wgpu_compute_pass_insert_debug_marker(pass: ?*WGPUComputePass, label: WGPURawString, color: u32) void; pub extern fn wgpu_compute_pass_pop_debug_group(pass: ?*WGPUComputePass) void; pub extern fn wgpu_compute_pass_push_debug_group(pass: ?*WGPUComputePass, label: WGPURawString, color: u32) void; pub extern fn wgpu_compute_pass_set_bind_group(pass: ?*WGPUComputePass, index: u32, bind_group_id: WGPUBindGroupId, offsets: [*c]const WGPUDynamicOffset, offset_length: usize) void; pub extern fn wgpu_compute_pass_set_pipeline(pass: ?*WGPUComputePass, pipeline_id: WGPUComputePipelineId) void; pub extern fn wgpu_compute_pipeline_destroy(compute_pipeline_id: WGPUComputePipelineId) void; pub extern fn wgpu_create_surface_from_android(a_native_window: ?*c_void) WGPUSurfaceId; pub extern fn wgpu_create_surface_from_metal_layer(layer: ?*c_void) WGPUSurfaceId; pub extern fn wgpu_create_surface_from_wayland(surface: ?*c_void, display: ?*c_void) WGPUSurfaceId; pub extern fn wgpu_create_surface_from_windows_hwnd(_hinstance: ?*c_void, hwnd: ?*c_void) WGPUSurfaceId; pub extern fn wgpu_create_surface_from_xlib(display: [*c]?*const c_void, window: c_ulong) WGPUSurfaceId; pub extern fn wgpu_device_create_bind_group(device_id: WGPUDeviceId, desc: [*c]const WGPUBindGroupDescriptor) WGPUBindGroupId; pub extern fn wgpu_device_create_bind_group_layout(device_id: WGPUDeviceId, desc: [*c]const WGPUBindGroupLayoutDescriptor) WGPUBindGroupLayoutId; pub extern fn wgpu_device_create_buffer(device_id: WGPUDeviceId, desc: [*c]const WGPUBufferDescriptor) WGPUBufferId; pub extern fn wgpu_device_create_command_encoder(device_id: WGPUDeviceId, desc: [*c]const WGPUCommandEncoderDescriptor) WGPUCommandEncoderId; pub extern fn wgpu_device_create_compute_pipeline(device_id: WGPUDeviceId, desc: [*c]const WGPUComputePipelineDescriptor) WGPUComputePipelineId; pub extern fn wgpu_device_create_pipeline_layout(device_id: WGPUDeviceId, desc: [*c]const WGPUPipelineLayoutDescriptor) WGPUPipelineLayoutId; pub extern fn wgpu_device_create_render_bundle_encoder(device_id: WGPUDeviceId, desc: [*c]const WGPURenderBundleEncoderDescriptor) WGPURenderBundleEncoderId; pub extern fn wgpu_device_create_render_pipeline(device_id: WGPUDeviceId, desc: [*c]const WGPURenderPipelineDescriptor) WGPURenderPipelineId; pub extern fn wgpu_device_create_sampler(device_id: WGPUDeviceId, desc: [*c]const WGPUSamplerDescriptor) WGPUSamplerId; pub extern fn wgpu_device_create_shader_module(device_id: WGPUDeviceId, source: WGPUShaderSource) WGPUShaderModuleId; pub extern fn wgpu_device_create_swap_chain(device_id: WGPUDeviceId, surface_id: WGPUSurfaceId, desc: [*c]const WGPUSwapChainDescriptor) WGPUSwapChainId; pub extern fn wgpu_device_create_texture(device_id: WGPUDeviceId, desc: [*c]const WGPUTextureDescriptor) WGPUTextureId; pub extern fn wgpu_device_destroy(device_id: WGPUDeviceId) void; pub extern fn wgpu_device_features(device_id: WGPUDeviceId) WGPUFeatures; pub extern fn wgpu_device_get_default_queue(device_id: WGPUDeviceId) WGPUQueueId; pub extern fn wgpu_device_limits(device_id: WGPUDeviceId) WGPUCLimits; pub extern fn wgpu_device_poll(device_id: WGPUDeviceId, force_wait: bool) void; pub extern fn wgpu_get_version() c_uint; pub extern fn wgpu_pipeline_layout_destroy(pipeline_layout_id: WGPUPipelineLayoutId) void; pub extern fn wgpu_queue_submit(queue_id: WGPUQueueId, command_buffers: [*c]const WGPUCommandBufferId, command_buffers_length: usize) void; pub extern fn wgpu_queue_write_buffer(queue_id: WGPUQueueId, buffer_id: WGPUBufferId, buffer_offset: WGPUBufferAddress, data: [*c]const u8, data_length: usize) void; pub extern fn wgpu_queue_write_texture(queue_id: WGPUQueueId, texture: [*c]const WGPUTextureCopyView, data: [*c]const u8, data_length: usize, data_layout: [*c]const WGPUTextureDataLayout, size: [*c]const WGPUExtent3d) void; pub extern fn wgpu_render_bundle_destroy(render_bundle_id: WGPURenderBundleId) void; pub extern fn wgpu_render_bundle_draw(bundle: ?*WGPURenderBundleEncoder, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32) void; pub extern fn wgpu_render_bundle_draw_indexed(bundle: ?*WGPURenderBundleEncoder, index_count: u32, instance_count: u32, first_index: u32, base_vertex: i32, first_instance: u32) void; pub extern fn wgpu_render_bundle_draw_indirect(bundle: ?*WGPURenderBundleEncoder, buffer_id: WGPUBufferId, offset: WGPUBufferAddress) void; pub extern fn wgpu_render_bundle_encoder_finish(bundle_encoder_id: WGPURenderBundleEncoderId, desc: [*c]const WGPURenderBundleDescriptor_Label) WGPURenderBundleId; pub extern fn wgpu_render_bundle_insert_debug_marker(_bundle: ?*WGPURenderBundleEncoder, _label: WGPURawString) void; pub extern fn wgpu_render_bundle_pop_debug_group(_bundle: ?*WGPURenderBundleEncoder) void; pub extern fn wgpu_render_bundle_push_debug_group(_bundle: ?*WGPURenderBundleEncoder, _label: WGPURawString) void; pub extern fn wgpu_render_bundle_set_bind_group(bundle: ?*WGPURenderBundleEncoder, index: u32, bind_group_id: WGPUBindGroupId, offsets: [*c]const WGPUDynamicOffset, offset_length: usize) void; pub extern fn wgpu_render_bundle_set_index_buffer(bundle: ?*WGPURenderBundleEncoder, buffer_id: WGPUBufferId, offset: WGPUBufferAddress, size: WGPUOption_BufferSize) void; pub extern fn wgpu_render_bundle_set_pipeline(bundle: ?*WGPURenderBundleEncoder, pipeline_id: WGPURenderPipelineId) void; pub extern fn wgpu_render_bundle_set_vertex_buffer(bundle: ?*WGPURenderBundleEncoder, slot: u32, buffer_id: WGPUBufferId, offset: WGPUBufferAddress, size: WGPUOption_BufferSize) void; pub extern fn wgpu_render_pass_bundle_indexed_indirect(bundle: ?*WGPURenderBundleEncoder, buffer_id: WGPUBufferId, offset: WGPUBufferAddress) void; pub extern fn wgpu_render_pass_destroy(pass: ?*WGPURenderPass) void; pub extern fn wgpu_render_pass_draw(pass: ?*WGPURenderPass, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32) void; pub extern fn wgpu_render_pass_draw_indexed(pass: ?*WGPURenderPass, index_count: u32, instance_count: u32, first_index: u32, base_vertex: i32, first_instance: u32) void; pub extern fn wgpu_render_pass_draw_indexed_indirect(pass: ?*WGPURenderPass, buffer_id: WGPUBufferId, offset: WGPUBufferAddress) void; pub extern fn wgpu_render_pass_draw_indirect(pass: ?*WGPURenderPass, buffer_id: WGPUBufferId, offset: WGPUBufferAddress) void; pub extern fn wgpu_render_pass_end_pass(pass: ?*WGPURenderPass) void; pub extern fn wgpu_render_pass_insert_debug_marker(pass: ?*WGPURenderPass, label: WGPURawString, color: u32) void; pub extern fn wgpu_render_pass_multi_draw_indexed_indirect(pass: ?*WGPURenderPass, buffer_id: WGPUBufferId, offset: WGPUBufferAddress, count: u32) void; pub extern fn wgpu_render_pass_multi_draw_indexed_indirect_count(pass: ?*WGPURenderPass, buffer_id: WGPUBufferId, offset: WGPUBufferAddress, count_buffer_id: WGPUBufferId, count_buffer_offset: WGPUBufferAddress, max_count: u32) void; pub extern fn wgpu_render_pass_multi_draw_indirect(pass: ?*WGPURenderPass, buffer_id: WGPUBufferId, offset: WGPUBufferAddress, count: u32) void; pub extern fn wgpu_render_pass_multi_draw_indirect_count(pass: ?*WGPURenderPass, buffer_id: WGPUBufferId, offset: WGPUBufferAddress, count_buffer_id: WGPUBufferId, count_buffer_offset: WGPUBufferAddress, max_count: u32) void; pub extern fn wgpu_render_pass_pop_debug_group(pass: ?*WGPURenderPass) void; pub extern fn wgpu_render_pass_push_debug_group(pass: ?*WGPURenderPass, label: WGPURawString, color: u32) void; pub extern fn wgpu_render_pass_set_bind_group(pass: ?*WGPURenderPass, index: u32, bind_group_id: WGPUBindGroupId, offsets: [*c]const WGPUDynamicOffset, offset_length: usize) void; pub extern fn wgpu_render_pass_set_blend_color(pass: ?*WGPURenderPass, color: [*c]const WGPUColor) void; pub extern fn wgpu_render_pass_set_index_buffer(pass: ?*WGPURenderPass, buffer_id: WGPUBufferId, offset: WGPUBufferAddress, size: WGPUOption_BufferSize) void; pub extern fn wgpu_render_pass_set_pipeline(pass: ?*WGPURenderPass, pipeline_id: WGPURenderPipelineId) void; pub extern fn wgpu_render_pass_set_scissor_rect(pass: ?*WGPURenderPass, x: u32, y: u32, w: u32, h: u32) void; pub extern fn wgpu_render_pass_set_stencil_reference(pass: ?*WGPURenderPass, value: u32) void; pub extern fn wgpu_render_pass_set_vertex_buffer(pass: ?*WGPURenderPass, slot: u32, buffer_id: WGPUBufferId, offset: WGPUBufferAddress, size: WGPUOption_BufferSize) void; pub extern fn wgpu_render_pass_set_viewport(pass: ?*WGPURenderPass, x: f32, y: f32, w: f32, h: f32, depth_min: f32, depth_max: f32) void; pub extern fn wgpu_render_pipeline_destroy(render_pipeline_id: WGPURenderPipelineId) void; pub extern fn wgpu_request_adapter_async(desc: [*c]const WGPURequestAdapterOptions, mask: WGPUBackendBit, allow_unsafe: bool, callback: WGPURequestAdapterCallback, userdata: ?*c_void) void; pub extern fn wgpu_sampler_destroy(sampler_id: WGPUSamplerId) void; pub extern fn wgpu_set_log_callback(callback: WGPULogCallback) void; pub extern fn wgpu_set_log_level(level: WGPULogLevel) c_int; pub extern fn wgpu_shader_module_destroy(shader_module_id: WGPUShaderModuleId) void; pub extern fn wgpu_swap_chain_get_next_texture(swap_chain_id: WGPUSwapChainId) WGPUSwapChainOutput; pub extern fn wgpu_swap_chain_present(swap_chain_id: WGPUSwapChainId) void; pub extern fn wgpu_texture_create_view(texture_id: WGPUTextureId, desc: [*c]const WGPUTextureViewDescriptor) WGPUTextureViewId; pub extern fn wgpu_texture_destroy(texture_id: WGPUTextureId) void; pub extern fn wgpu_texture_view_destroy(texture_view_id: WGPUTextureViewId) void; pub const va_start = @compileError("TODO implement function '__builtin_va_start' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/include/stdarg.h:17:9 pub const va_end = @compileError("TODO implement function '__builtin_va_end' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/include/stdarg.h:18:9 pub const va_arg = @compileError("TODO implement function '__builtin_va_arg' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/include/stdarg.h:19:9 pub const __va_copy = @compileError("TODO implement function '__builtin_va_copy' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/include/stdarg.h:24:9 pub const va_copy = @compileError("TODO implement function '__builtin_va_copy' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/include/stdarg.h:27:9 pub const __CONCAT = @compileError("unable to translate C expr: unexpected token .HashHash"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:113:9 pub const __STRING = @compileError("unable to translate C expr: unexpected token .Hash"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:114:9 pub const __const = @compileError("unable to translate C expr: unexpected token .Keyword_const"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:116:9 pub const __volatile = @compileError("unable to translate C expr: unexpected token .Keyword_volatile"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:118:9 pub const __kpi_deprecated = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:202:9 pub const __restrict = @compileError("unable to translate C expr: unexpected token .Keyword_restrict"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:222:9 pub const __swift_unavailable = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:288:9 pub const __header_inline = @compileError("unable to translate C expr: unexpected token .Keyword_inline"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:322:10 pub const __unreachable_ok_push = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:348:10 pub const __IDSTRING = @compileError("unable to translate C expr: unexpected token .Keyword_static"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:379:9 pub const __FBSDID = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:399:9 pub const __DECONST = @compileError("unable to translate C expr: unexpected token .Keyword_const"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:403:9 pub const __DEVOLATILE = @compileError("unable to translate C expr: unexpected token .Keyword_volatile"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:407:9 pub const __DEQUALIFY = @compileError("unable to translate C expr: unexpected token .Keyword_const"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:411:9 pub const __alloc_size = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:429:9 pub const __DARWIN_ALIAS = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:612:9 pub const __DARWIN_ALIAS_C = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:613:9 pub const __DARWIN_ALIAS_I = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:614:9 pub const __DARWIN_NOCANCEL = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:615:9 pub const __DARWIN_INODE64 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:616:9 pub const __DARWIN_1050 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:618:9 pub const __DARWIN_1050ALIAS = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:619:9 pub const __DARWIN_1050ALIAS_C = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:620:9 pub const __DARWIN_1050ALIAS_I = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:621:9 pub const __DARWIN_1050INODE64 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:622:9 pub const __DARWIN_EXTSN = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:624:9 pub const __DARWIN_EXTSN_C = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:625:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_2_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:35:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_2_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:41:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_2_2 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:47:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_3_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:53:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_3_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:59:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_3_2 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:65:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:71:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:77:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_2 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:83:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_3 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:89:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_5_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:95:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_5_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:101:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_6_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:107:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_6_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:113:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_7_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:119:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_7_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:125:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:131:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:137:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_2 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:143:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_3 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:149:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_4 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:155:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:161:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:167:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_2 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:173:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_3 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:179:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:185:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:191:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_2 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:197:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_3 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:203:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:209:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:215:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_2 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:221:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_3 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:227:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_4 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:233:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:239:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:245:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_2 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:251:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_3 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:257:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_4 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:263:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_0 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:269:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:275:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_2 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:281:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_3 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:287:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_4 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:293:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_5 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:299:9 pub const __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_6 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:305:9 pub const __DARWIN_ALIAS_STARTING_MAC___MAC_10_15 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:491:9 pub const __DARWIN_ALIAS_STARTING_MAC___MAC_10_15_1 = @compileError("unable to translate C expr: unexpected token .Eof"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/_symbol_aliasing.h:497:9 pub const __DARWIN_ALIAS_STARTING = @compileError("unable to translate C expr: unexpected token .HashHash"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:635:9 pub const __POSIX_C_DEPRECATED = @compileError("unable to translate C expr: unexpected token .HashHash"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:698:9 pub const __compiler_barrier = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:812:9 pub const __enum_decl = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:836:9 pub const __enum_closed_decl = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:838:9 pub const __options_decl = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:840:9 pub const __options_closed_decl = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/sys/cdefs.h:842:9 pub const __offsetof = @compileError("TODO implement function '__builtin_offsetof' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/_types.h:83:9 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2919:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2920:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2921:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2923:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2927:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2929:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2934:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2938:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2939:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2941:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2945:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2947:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2951:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2953:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2958:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2962:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2963:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2965:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2969:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2971:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2975:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2977:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2982:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2987:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2991:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2993:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2997:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:2999:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3003:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3005:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_5 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3009:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_5_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3011:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_6 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3015:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_6_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3017:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3021:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_7_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3023:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3027:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_8_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3029:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3033:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3035:25 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3039:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3040:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3041:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3042:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3043:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3044:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3046:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3050:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3052:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3057:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3061:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3062:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3064:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3068:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3070:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3074:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3076:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3081:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3085:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3086:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3088:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3092:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3094:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3098:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3100:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3105:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3109:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3110:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3112:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3116:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3118:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3122:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3124:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_5 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3128:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_5_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3130:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_6 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3134:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_6_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3136:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3140:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_7_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3142:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3146:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_8_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3148:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3152:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3154:25 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3158:21 pub const __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3159:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3160:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3161:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3162:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3163:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3165:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3169:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3171:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3176:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3180:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3181:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3183:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3187:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3189:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3193:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3195:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3200:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3204:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3205:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3207:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3211:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3213:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3217:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3219:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3224:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3228:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3229:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3231:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3235:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3237:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_5 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3241:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_5_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3243:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_6 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3247:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_6_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3249:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3253:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_7_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3255:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3259:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_8_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3261:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3265:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3267:25 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3271:21 pub const __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3272:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3273:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3274:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3275:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3276:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3278:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3282:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3284:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3289:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3293:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3294:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3296:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3300:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3302:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3306:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3308:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3313:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3317:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3318:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3320:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3324:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3326:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3330:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3332:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3337:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3341:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3342:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3344:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_5 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3348:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_5_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3350:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_6 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3354:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_6_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3356:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3360:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_7_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3362:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3366:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_8_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3368:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3372:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3374:25 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3378:21 pub const __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3379:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3380:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEPRECATED__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3381:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3382:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3383:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3384:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3386:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3390:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3392:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3397:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3401:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3402:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3404:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3408:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3410:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3414:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3416:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3421:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3425:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3426:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3428:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3432:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3434:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3438:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3440:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3445:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_5 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3449:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_5_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3451:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_6 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3455:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_6_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3457:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3461:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_7_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3463:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3467:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_8_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3469:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3473:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3475:25 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3479:21 pub const __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3480:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3481:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3482:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3483:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3484:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3486:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3490:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3492:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3497:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3501:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3502:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3504:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3508:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3510:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3514:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3516:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3521:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3525:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3526:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3528:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3532:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3534:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3538:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3540:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3545:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3549:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_6 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3550:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_6_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3552:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3556:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_7_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3558:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3562:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_8_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3564:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3568:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3570:25 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3574:21 pub const __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3575:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3576:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3577:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3578:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3579:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3581:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3585:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3587:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3592:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3596:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3597:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3599:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3603:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3605:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3609:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3611:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3616:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3620:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3621:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3623:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3627:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3629:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3633:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3635:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3640:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_13_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3644:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3645:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_7_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3647:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3651:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_8_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3653:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3657:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3659:25 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3663:21 pub const __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3664:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3665:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3666:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3667:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3668:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3670:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3674:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3676:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3681:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3685:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3686:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3688:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3692:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3694:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3698:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3700:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3705:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3709:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3710:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3712:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3716:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3718:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3722:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3724:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3729:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3733:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3734:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_8_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3736:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3740:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3742:25 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3746:21 pub const __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3747:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3748:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3749:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3750:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3751:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3753:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3757:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3759:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3764:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3768:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3769:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3771:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3775:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3777:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3781:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3783:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3788:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3792:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3793:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3795:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3799:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3801:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3805:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3807:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3812:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3816:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_14 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3817:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3818:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3820:25 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3824:21 pub const __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3825:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3826:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_0 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3827:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_0_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3829:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3833:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3834:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3835:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3837:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3841:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3843:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3848:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3852:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3853:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3855:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3859:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3861:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3865:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3867:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3872:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3876:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3877:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3879:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3883:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3885:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3889:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3891:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3896:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3900:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3902:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3906:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3908:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3912:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3914:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3918:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3920:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_5 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3924:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_5_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3926:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_6 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3930:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_6_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3932:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_7 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3936:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_7_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3938:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_8 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3942:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_8_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3944:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_9 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3948:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_9_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3950:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_13_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3955:25 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3959:21 pub const __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3960:21 pub const __AVAILABILITY_INTERNAL__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3961:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3962:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3963:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3964:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3966:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3970:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3972:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3976:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3977:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3979:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3983:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3985:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3989:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3991:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:3996:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4000:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4001:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4003:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4007:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4009:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4013:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4015:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4020:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4024:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4025:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4026:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4027:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4029:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4033:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4034:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4036:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4040:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4042:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4046:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4048:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4053:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4057:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4058:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4060:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4064:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4066:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4070:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4072:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4077:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4081:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4082:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4083:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_10 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4084:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_10_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4085:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_10_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4087:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_10_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4091:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_10_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4093:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_10_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4098:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4102:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4103:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4105:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4109:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4111:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4115:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4117:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4122:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4126:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4127:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4129:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4133:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4135:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4139:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4141:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4146:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4150:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_13_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4152:25 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_13_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4156:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4157:21 pub const __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4158:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4159:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4160:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4161:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4163:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4167:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4169:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4173:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4175:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4179:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4180:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4182:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4186:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4188:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4192:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4194:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4199:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4203:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4204:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4205:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4206:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4208:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4212:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4214:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4218:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4219:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4221:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4225:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4227:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4231:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4233:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4238:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4242:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4243:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4244:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4245:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4247:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4251:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4252:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4254:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4258:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4260:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4264:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4266:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4271:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4275:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4276:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4277:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4278:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4279:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4281:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_3 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4285:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_3_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4287:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4291:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4293:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4298:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4302:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4303:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4305:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4309:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4311:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4315:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4317:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4322:25 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4326:21 pub const __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4327:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4328:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4329:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4330:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4332:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4336:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4338:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4342:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4344:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4348:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4349:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4350:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4351:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4353:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4357:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4359:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4363:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4364:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4365:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4366:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4368:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4372:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4373:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4374:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_1 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4375:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_1_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4377:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_2 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4381:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_2_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4383:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4387:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_4_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4389:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4394:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4398:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_13_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4400:25 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_13_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4404:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_14 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4405:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_NA = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4406:21 pub const __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_NA_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4407:21 pub const __AVAILABILITY_INTERNAL__MAC_10_13 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4408:21 pub const __AVAILABILITY_INTERNAL__MAC_10_13_4 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4409:21 pub const __AVAILABILITY_INTERNAL__MAC_10_14 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4410:21 pub const __AVAILABILITY_INTERNAL__MAC_10_14_DEP__MAC_10_14 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4411:21 pub const __AVAILABILITY_INTERNAL__MAC_10_15 = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4412:21 pub const __API_AVAILABLE_PLATFORM_macos = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4442:13 pub const __API_AVAILABLE_PLATFORM_macosx = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4443:13 pub const __API_AVAILABLE_PLATFORM_ios = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4444:13 pub const __API_AVAILABLE_PLATFORM_watchos = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4445:13 pub const __API_AVAILABLE_PLATFORM_tvos = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4446:13 pub const __API_AVAILABLE_PLATFORM_macCatalyst = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4448:13 pub const __API_AVAILABLE_PLATFORM_uikitformac = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4451:14 pub const __API_AVAILABLE_PLATFORM_driverkit = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4453:13 pub const __API_A = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4457:17 pub const __API_AVAILABLE2 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4466:13 pub const __API_AVAILABLE3 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4467:13 pub const __API_AVAILABLE4 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4468:13 pub const __API_AVAILABLE5 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4469:13 pub const __API_AVAILABLE6 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4470:13 pub const __API_AVAILABLE7 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4471:13 pub const __API_AVAILABLE_GET_MACRO = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4472:13 pub const __API_APPLY_TO = @compileError("unable to translate C expr: expected Identifier instead got: Comma"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4474:13 pub const __API_RANGE_STRINGIFY2 = @compileError("unable to translate C expr: unexpected token .Hash"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4476:13 pub const __API_A_BEGIN = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4478:13 pub const __API_AVAILABLE_BEGIN2 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4481:13 pub const __API_AVAILABLE_BEGIN3 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4482:13 pub const __API_AVAILABLE_BEGIN4 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4483:13 pub const __API_AVAILABLE_BEGIN5 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4484:13 pub const __API_AVAILABLE_BEGIN6 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4485:13 pub const __API_AVAILABLE_BEGIN7 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4486:13 pub const __API_AVAILABLE_BEGIN_GET_MACRO = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4487:13 pub const __API_DEPRECATED_PLATFORM_macos = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4490:13 pub const __API_DEPRECATED_PLATFORM_macosx = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4491:13 pub const __API_DEPRECATED_PLATFORM_ios = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4492:13 pub const __API_DEPRECATED_PLATFORM_watchos = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4493:13 pub const __API_DEPRECATED_PLATFORM_tvos = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4494:13 pub const __API_DEPRECATED_PLATFORM_macCatalyst = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4496:13 pub const __API_DEPRECATED_PLATFORM_uikitformac = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4499:14 pub const __API_DEPRECATED_PLATFORM_driverkit = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4501:13 pub const __API_D = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4505:17 pub const __API_DEPRECATED_MSG3 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4514:13 pub const __API_DEPRECATED_MSG4 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4515:13 pub const __API_DEPRECATED_MSG5 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4516:13 pub const __API_DEPRECATED_MSG6 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4517:13 pub const __API_DEPRECATED_MSG7 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4518:13 pub const __API_DEPRECATED_MSG8 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4519:13 pub const __API_DEPRECATED_MSG_GET_MACRO = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4520:13 pub const __API_D_BEGIN = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4522:13 pub const __API_DEPRECATED_BEGIN_MSG3 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4525:13 pub const __API_DEPRECATED_BEGIN_MSG4 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4526:13 pub const __API_DEPRECATED_BEGIN_MSG5 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4527:13 pub const __API_DEPRECATED_BEGIN_MSG6 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4528:13 pub const __API_DEPRECATED_BEGIN_MSG7 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4529:13 pub const __API_DEPRECATED_BEGIN_MSG8 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4530:13 pub const __API_DEPRECATED_BEGIN_MSG_GET_MACRO = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4531:13 pub const __API_R = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4534:17 pub const __API_DEPRECATED_REP3 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4540:13 pub const __API_DEPRECATED_REP4 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4541:13 pub const __API_DEPRECATED_REP5 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4542:13 pub const __API_DEPRECATED_REP6 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4543:13 pub const __API_DEPRECATED_REP7 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4544:13 pub const __API_DEPRECATED_REP8 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4545:13 pub const __API_DEPRECATED_REP_GET_MACRO = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4546:13 pub const __API_R_BEGIN = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4549:17 pub const __API_DEPRECATED_BEGIN_REP3 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4555:13 pub const __API_DEPRECATED_BEGIN_REP4 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4556:13 pub const __API_DEPRECATED_BEGIN_REP5 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4557:13 pub const __API_DEPRECATED_BEGIN_REP6 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4558:13 pub const __API_DEPRECATED_BEGIN_REP7 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4559:13 pub const __API_DEPRECATED_BEGIN_REP8 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4560:13 pub const __API_DEPRECATED_BEGIN_REP_GET_MACRO = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4561:13 pub const __API_U = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4586:17 pub const __API_UNAVAILABLE2 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4595:13 pub const __API_UNAVAILABLE3 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4596:13 pub const __API_UNAVAILABLE4 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4597:13 pub const __API_UNAVAILABLE5 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4598:13 pub const __API_UNAVAILABLE6 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4599:13 pub const __API_UNAVAILABLE7 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4600:13 pub const __API_UNAVAILABLE_GET_MACRO = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4601:13 pub const __API_U_BEGIN = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4603:13 pub const __API_UNAVAILABLE_BEGIN2 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4606:13 pub const __API_UNAVAILABLE_BEGIN3 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4607:13 pub const __API_UNAVAILABLE_BEGIN4 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4608:13 pub const __API_UNAVAILABLE_BEGIN5 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4609:13 pub const __API_UNAVAILABLE_BEGIN6 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4610:13 pub const __API_UNAVAILABLE_BEGIN7 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4611:13 pub const __API_UNAVAILABLE_BEGIN_GET_MACRO = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4612:13 pub const __swift_compiler_version_at_least = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4661:13 pub const __SPI_AVAILABLE = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/AvailabilityInternal.h:4669:11 pub const __OSX_AVAILABLE_STARTING = @compileError("unable to translate C expr: unexpected token .HashHash"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:295:17 pub const __OSX_AVAILABLE_BUT_DEPRECATED = @compileError("unable to translate C expr: unexpected token .HashHash"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:296:17 pub const __OSX_AVAILABLE_BUT_DEPRECATED_MSG = @compileError("unable to translate C expr: unexpected token .HashHash"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:298:17 pub const __OS_AVAILABILITY_MSG = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:322:13 pub const __OS_EXTENSION_UNAVAILABLE = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:350:9 pub const __OSX_AVAILABLE = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:358:13 pub const __OSX_DEPRECATED = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:359:13 pub const __IOS_AVAILABLE = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:381:13 pub const __IOS_DEPRECATED = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:382:13 pub const __TVOS_AVAILABLE = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:408:13 pub const __TVOS_DEPRECATED = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:409:13 pub const __WATCHOS_AVAILABLE = @compileError("unable to translate C expr: expected ',' or ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:435:13 pub const __WATCHOS_DEPRECATED = @compileError("unable to translate C expr: unexpected token .Identifier"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:436:13 pub const __API_AVAILABLE = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:504:13 pub const __API_AVAILABLE_BEGIN = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:506:13 pub const __API_DEPRECATED = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:525:13 pub const __API_DEPRECATED_WITH_REPLACEMENT = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:526:13 pub const __API_DEPRECATED_BEGIN = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:528:13 pub const __API_DEPRECATED_WITH_REPLACEMENT_BEGIN = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:531:13 pub const __API_UNAVAILABLE = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:542:13 pub const __API_UNAVAILABLE_BEGIN = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:544:13 pub const __SPI_DEPRECATED = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:598:11 pub const __SPI_DEPRECATED_WITH_REPLACEMENT = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/Availability.h:602:11 pub const SIG_DFL = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/signal.h:131:9 pub const SIG_IGN = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/signal.h:132:9 pub const SIG_HOLD = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/signal.h:133:9 pub const SIG_ERR = @compileError("unable to translate C expr: expected ')'"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/signal.h:134:9 pub const __DARWIN_OS_INLINE = @compileError("unable to translate C expr: unexpected token .Keyword_static"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/libkern/i386/_OSByteOrder.h:34:17 pub const __DARWIN_OSSwapInt16 = @compileError("TODO implement function '__builtin_constant_p' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/libkern/_OSByteOrder.h:71:9 pub const __DARWIN_OSSwapInt32 = @compileError("TODO implement function '__builtin_constant_p' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/libkern/_OSByteOrder.h:74:9 pub const __DARWIN_OSSwapInt64 = @compileError("TODO implement function '__builtin_constant_p' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/x86_64-macos-gnu/libkern/_OSByteOrder.h:77:9 pub const NTOHL = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/_endian.h:143:9 pub const NTOHS = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/_endian.h:144:9 pub const NTOHLL = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/_endian.h:145:9 pub const HTONL = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/_endian.h:146:9 pub const HTONS = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/_endian.h:147:9 pub const HTONLL = @compileError("unable to translate C expr: unexpected token .Equal"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/sys/_endian.h:148:9 pub const __alloca = @compileError("TODO implement function '__builtin_alloca' in std.c.builtins"); // /usr/local/Cellar/zig/HEAD-eb010ce_1/lib/zig/libc/include/any-macos-any/alloca.h:40:9 pub const __llvm__ = @as(c_int, 1); pub const __clang__ = @as(c_int, 1); pub const __clang_major__ = @as(c_int, 12); pub const __clang_minor__ = @as(c_int, 0); pub const __clang_patchlevel__ = @as(c_int, 1); pub const __clang_version__ = "12.0.1 "; pub const __GNUC__ = @as(c_int, 4); pub const __GNUC_MINOR__ = @as(c_int, 2); pub const __GNUC_PATCHLEVEL__ = @as(c_int, 1); pub const __GXX_ABI_VERSION = @as(c_int, 1002); pub const __ATOMIC_RELAXED = @as(c_int, 0); pub const __ATOMIC_CONSUME = @as(c_int, 1); pub const __ATOMIC_ACQUIRE = @as(c_int, 2); pub const __ATOMIC_RELEASE = @as(c_int, 3); pub const __ATOMIC_ACQ_REL = @as(c_int, 4); pub const __ATOMIC_SEQ_CST = @as(c_int, 5); pub const __OPENCL_MEMORY_SCOPE_WORK_ITEM = @as(c_int, 0); pub const __OPENCL_MEMORY_SCOPE_WORK_GROUP = @as(c_int, 1); pub const __OPENCL_MEMORY_SCOPE_DEVICE = @as(c_int, 2); pub const __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES = @as(c_int, 3); pub const __OPENCL_MEMORY_SCOPE_SUB_GROUP = @as(c_int, 4); pub const __PRAGMA_REDEFINE_EXTNAME = @as(c_int, 1); pub const __VERSION__ = "Homebrew Clang 12.0.1"; pub const __OBJC_BOOL_IS_BOOL = @as(c_int, 0); pub const __CONSTANT_CFSTRINGS__ = @as(c_int, 1); pub const __block = __attribute__(__blocks__(byref)); pub const __BLOCKS__ = @as(c_int, 1); pub const __OPTIMIZE__ = @as(c_int, 1); pub const __ORDER_LITTLE_ENDIAN__ = @as(c_int, 1234); pub const __ORDER_BIG_ENDIAN__ = @as(c_int, 4321); pub const __ORDER_PDP_ENDIAN__ = @as(c_int, 3412); pub const __BYTE_ORDER__ = __ORDER_LITTLE_ENDIAN__; pub const __LITTLE_ENDIAN__ = @as(c_int, 1); pub const _LP64 = @as(c_int, 1); pub const __LP64__ = @as(c_int, 1); pub const __CHAR_BIT__ = @as(c_int, 8); pub const __SCHAR_MAX__ = @as(c_int, 127); pub const __SHRT_MAX__ = @as(c_int, 32767); pub const __INT_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __LONG_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __LONG_LONG_MAX__ = @as(c_longlong, 9223372036854775807); pub const __WCHAR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __WINT_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __INTMAX_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __SIZE_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __UINTMAX_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __PTRDIFF_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __INTPTR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __UINTPTR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __SIZEOF_DOUBLE__ = @as(c_int, 8); pub const __SIZEOF_FLOAT__ = @as(c_int, 4); pub const __SIZEOF_INT__ = @as(c_int, 4); pub const __SIZEOF_LONG__ = @as(c_int, 8); pub const __SIZEOF_LONG_DOUBLE__ = @as(c_int, 16); pub const __SIZEOF_LONG_LONG__ = @as(c_int, 8); pub const __SIZEOF_POINTER__ = @as(c_int, 8); pub const __SIZEOF_SHORT__ = @as(c_int, 2); pub const __SIZEOF_PTRDIFF_T__ = @as(c_int, 8); pub const __SIZEOF_SIZE_T__ = @as(c_int, 8); pub const __SIZEOF_WCHAR_T__ = @as(c_int, 4); pub const __SIZEOF_WINT_T__ = @as(c_int, 4); pub const __SIZEOF_INT128__ = @as(c_int, 16); pub const __INTMAX_TYPE__ = c_long; pub const __INTMAX_FMTd__ = "ld"; pub const __INTMAX_FMTi__ = "li"; pub const __INTMAX_C_SUFFIX__ = L; pub const __UINTMAX_TYPE__ = c_ulong; pub const __UINTMAX_FMTo__ = "lo"; pub const __UINTMAX_FMTu__ = "lu"; pub const __UINTMAX_FMTx__ = "lx"; pub const __UINTMAX_FMTX__ = "lX"; pub const __UINTMAX_C_SUFFIX__ = UL; pub const __INTMAX_WIDTH__ = @as(c_int, 64); pub const __PTRDIFF_TYPE__ = c_long; pub const __PTRDIFF_FMTd__ = "ld"; pub const __PTRDIFF_FMTi__ = "li"; pub const __PTRDIFF_WIDTH__ = @as(c_int, 64); pub const __INTPTR_TYPE__ = c_long; pub const __INTPTR_FMTd__ = "ld"; pub const __INTPTR_FMTi__ = "li"; pub const __INTPTR_WIDTH__ = @as(c_int, 64); pub const __SIZE_TYPE__ = c_ulong; pub const __SIZE_FMTo__ = "lo"; pub const __SIZE_FMTu__ = "lu"; pub const __SIZE_FMTx__ = "lx"; pub const __SIZE_FMTX__ = "lX"; pub const __SIZE_WIDTH__ = @as(c_int, 64); pub const __WCHAR_TYPE__ = c_int; pub const __WCHAR_WIDTH__ = @as(c_int, 32); pub const __WINT_TYPE__ = c_int; pub const __WINT_WIDTH__ = @as(c_int, 32); pub const __SIG_ATOMIC_WIDTH__ = @as(c_int, 32); pub const __SIG_ATOMIC_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __CHAR16_TYPE__ = c_ushort; pub const __CHAR32_TYPE__ = c_uint; pub const __UINTMAX_WIDTH__ = @as(c_int, 64); pub const __UINTPTR_TYPE__ = c_ulong; pub const __UINTPTR_FMTo__ = "lo"; pub const __UINTPTR_FMTu__ = "lu"; pub const __UINTPTR_FMTx__ = "lx"; pub const __UINTPTR_FMTX__ = "lX"; pub const __UINTPTR_WIDTH__ = @as(c_int, 64); pub const __FLT_DENORM_MIN__ = @as(f32, 1.40129846e-45); pub const __FLT_HAS_DENORM__ = @as(c_int, 1); pub const __FLT_DIG__ = @as(c_int, 6); pub const __FLT_DECIMAL_DIG__ = @as(c_int, 9); pub const __FLT_EPSILON__ = @as(f32, 1.19209290e-7); pub const __FLT_HAS_INFINITY__ = @as(c_int, 1); pub const __FLT_HAS_QUIET_NAN__ = @as(c_int, 1); pub const __FLT_MANT_DIG__ = @as(c_int, 24); pub const __FLT_MAX_10_EXP__ = @as(c_int, 38); pub const __FLT_MAX_EXP__ = @as(c_int, 128); pub const __FLT_MAX__ = @as(f32, 3.40282347e+38); pub const __FLT_MIN_10_EXP__ = -@as(c_int, 37); pub const __FLT_MIN_EXP__ = -@as(c_int, 125); pub const __FLT_MIN__ = @as(f32, 1.17549435e-38); pub const __DBL_DENORM_MIN__ = 4.9406564584124654e-324; pub const __DBL_HAS_DENORM__ = @as(c_int, 1); pub const __DBL_DIG__ = @as(c_int, 15); pub const __DBL_DECIMAL_DIG__ = @as(c_int, 17); pub const __DBL_EPSILON__ = 2.2204460492503131e-16; pub const __DBL_HAS_INFINITY__ = @as(c_int, 1); pub const __DBL_HAS_QUIET_NAN__ = @as(c_int, 1); pub const __DBL_MANT_DIG__ = @as(c_int, 53); pub const __DBL_MAX_10_EXP__ = @as(c_int, 308); pub const __DBL_MAX_EXP__ = @as(c_int, 1024); pub const __DBL_MAX__ = 1.7976931348623157e+308; pub const __DBL_MIN_10_EXP__ = -@as(c_int, 307); pub const __DBL_MIN_EXP__ = -@as(c_int, 1021); pub const __DBL_MIN__ = 2.2250738585072014e-308; pub const __LDBL_DENORM_MIN__ = @as(c_longdouble, 3.64519953188247460253e-4951); pub const __LDBL_HAS_DENORM__ = @as(c_int, 1); pub const __LDBL_DIG__ = @as(c_int, 18); pub const __LDBL_DECIMAL_DIG__ = @as(c_int, 21); pub const __LDBL_EPSILON__ = @as(c_longdouble, 1.08420217248550443401e-19); pub const __LDBL_HAS_INFINITY__ = @as(c_int, 1); pub const __LDBL_HAS_QUIET_NAN__ = @as(c_int, 1); pub const __LDBL_MANT_DIG__ = @as(c_int, 64); pub const __LDBL_MAX_10_EXP__ = @as(c_int, 4932); pub const __LDBL_MAX_EXP__ = @as(c_int, 16384); pub const __LDBL_MAX__ = @as(c_longdouble, 1.18973149535723176502e+4932); pub const __LDBL_MIN_10_EXP__ = -@as(c_int, 4931); pub const __LDBL_MIN_EXP__ = -@as(c_int, 16381); pub const __LDBL_MIN__ = @as(c_longdouble, 3.36210314311209350626e-4932); pub const __POINTER_WIDTH__ = @as(c_int, 64); pub const __BIGGEST_ALIGNMENT__ = @as(c_int, 16); pub const __INT8_TYPE__ = i8; pub const __INT8_FMTd__ = "hhd"; pub const __INT8_FMTi__ = "hhi"; pub const __INT16_TYPE__ = c_short; pub const __INT16_FMTd__ = "hd"; pub const __INT16_FMTi__ = "hi"; pub const __INT32_TYPE__ = c_int; pub const __INT32_FMTd__ = "d"; pub const __INT32_FMTi__ = "i"; pub const __INT64_TYPE__ = c_longlong; pub const __INT64_FMTd__ = "lld"; pub const __INT64_FMTi__ = "lli"; pub const __INT64_C_SUFFIX__ = LL; pub const __UINT8_TYPE__ = u8; pub const __UINT8_FMTo__ = "hho"; pub const __UINT8_FMTu__ = "hhu"; pub const __UINT8_FMTx__ = "hhx"; pub const __UINT8_FMTX__ = "hhX"; pub const __UINT8_MAX__ = @as(c_int, 255); pub const __INT8_MAX__ = @as(c_int, 127); pub const __UINT16_TYPE__ = c_ushort; pub const __UINT16_FMTo__ = "ho"; pub const __UINT16_FMTu__ = "hu"; pub const __UINT16_FMTx__ = "hx"; pub const __UINT16_FMTX__ = "hX"; pub const __UINT16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); pub const __INT16_MAX__ = @as(c_int, 32767); pub const __UINT32_TYPE__ = c_uint; pub const __UINT32_FMTo__ = "o"; pub const __UINT32_FMTu__ = "u"; pub const __UINT32_FMTx__ = "x"; pub const __UINT32_FMTX__ = "X"; pub const __UINT32_C_SUFFIX__ = U; pub const __UINT32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const __INT32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __UINT64_TYPE__ = c_ulonglong; pub const __UINT64_FMTo__ = "llo"; pub const __UINT64_FMTu__ = "llu"; pub const __UINT64_FMTx__ = "llx"; pub const __UINT64_FMTX__ = "llX"; pub const __UINT64_C_SUFFIX__ = ULL; pub const __UINT64_MAX__ = @as(c_ulonglong, 18446744073709551615); pub const __INT64_MAX__ = @as(c_longlong, 9223372036854775807); pub const __INT_LEAST8_TYPE__ = i8; pub const __INT_LEAST8_MAX__ = @as(c_int, 127); pub const __INT_LEAST8_FMTd__ = "hhd"; pub const __INT_LEAST8_FMTi__ = "hhi"; pub const __UINT_LEAST8_TYPE__ = u8; pub const __UINT_LEAST8_MAX__ = @as(c_int, 255); pub const __UINT_LEAST8_FMTo__ = "hho"; pub const __UINT_LEAST8_FMTu__ = "hhu"; pub const __UINT_LEAST8_FMTx__ = "hhx"; pub const __UINT_LEAST8_FMTX__ = "hhX"; pub const __INT_LEAST16_TYPE__ = c_short; pub const __INT_LEAST16_MAX__ = @as(c_int, 32767); pub const __INT_LEAST16_FMTd__ = "hd"; pub const __INT_LEAST16_FMTi__ = "hi"; pub const __UINT_LEAST16_TYPE__ = c_ushort; pub const __UINT_LEAST16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); pub const __UINT_LEAST16_FMTo__ = "ho"; pub const __UINT_LEAST16_FMTu__ = "hu"; pub const __UINT_LEAST16_FMTx__ = "hx"; pub const __UINT_LEAST16_FMTX__ = "hX"; pub const __INT_LEAST32_TYPE__ = c_int; pub const __INT_LEAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __INT_LEAST32_FMTd__ = "d"; pub const __INT_LEAST32_FMTi__ = "i"; pub const __UINT_LEAST32_TYPE__ = c_uint; pub const __UINT_LEAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const __UINT_LEAST32_FMTo__ = "o"; pub const __UINT_LEAST32_FMTu__ = "u"; pub const __UINT_LEAST32_FMTx__ = "x"; pub const __UINT_LEAST32_FMTX__ = "X"; pub const __INT_LEAST64_TYPE__ = c_longlong; pub const __INT_LEAST64_MAX__ = @as(c_longlong, 9223372036854775807); pub const __INT_LEAST64_FMTd__ = "lld"; pub const __INT_LEAST64_FMTi__ = "lli"; pub const __UINT_LEAST64_TYPE__ = c_ulonglong; pub const __UINT_LEAST64_MAX__ = @as(c_ulonglong, 18446744073709551615); pub const __UINT_LEAST64_FMTo__ = "llo"; pub const __UINT_LEAST64_FMTu__ = "llu"; pub const __UINT_LEAST64_FMTx__ = "llx"; pub const __UINT_LEAST64_FMTX__ = "llX"; pub const __INT_FAST8_TYPE__ = i8; pub const __INT_FAST8_MAX__ = @as(c_int, 127); pub const __INT_FAST8_FMTd__ = "hhd"; pub const __INT_FAST8_FMTi__ = "hhi"; pub const __UINT_FAST8_TYPE__ = u8; pub const __UINT_FAST8_MAX__ = @as(c_int, 255); pub const __UINT_FAST8_FMTo__ = "hho"; pub const __UINT_FAST8_FMTu__ = "hhu"; pub const __UINT_FAST8_FMTx__ = "hhx"; pub const __UINT_FAST8_FMTX__ = "hhX"; pub const __INT_FAST16_TYPE__ = c_short; pub const __INT_FAST16_MAX__ = @as(c_int, 32767); pub const __INT_FAST16_FMTd__ = "hd"; pub const __INT_FAST16_FMTi__ = "hi"; pub const __UINT_FAST16_TYPE__ = c_ushort; pub const __UINT_FAST16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); pub const __UINT_FAST16_FMTo__ = "ho"; pub const __UINT_FAST16_FMTu__ = "hu"; pub const __UINT_FAST16_FMTx__ = "hx"; pub const __UINT_FAST16_FMTX__ = "hX"; pub const __INT_FAST32_TYPE__ = c_int; pub const __INT_FAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __INT_FAST32_FMTd__ = "d"; pub const __INT_FAST32_FMTi__ = "i"; pub const __UINT_FAST32_TYPE__ = c_uint; pub const __UINT_FAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const __UINT_FAST32_FMTo__ = "o"; pub const __UINT_FAST32_FMTu__ = "u"; pub const __UINT_FAST32_FMTx__ = "x"; pub const __UINT_FAST32_FMTX__ = "X"; pub const __INT_FAST64_TYPE__ = c_longlong; pub const __INT_FAST64_MAX__ = @as(c_longlong, 9223372036854775807); pub const __INT_FAST64_FMTd__ = "lld"; pub const __INT_FAST64_FMTi__ = "lli"; pub const __UINT_FAST64_TYPE__ = c_ulonglong; pub const __UINT_FAST64_MAX__ = @as(c_ulonglong, 18446744073709551615); pub const __UINT_FAST64_FMTo__ = "llo"; pub const __UINT_FAST64_FMTu__ = "llu"; pub const __UINT_FAST64_FMTx__ = "llx"; pub const __UINT_FAST64_FMTX__ = "llX"; pub const __USER_LABEL_PREFIX__ = @"_"; pub const __FINITE_MATH_ONLY__ = @as(c_int, 0); pub const __GNUC_STDC_INLINE__ = @as(c_int, 1); pub const __GCC_ATOMIC_TEST_AND_SET_TRUEVAL = @as(c_int, 1); pub const __CLANG_ATOMIC_BOOL_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_CHAR_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_CHAR16_T_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_CHAR32_T_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_WCHAR_T_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_SHORT_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_INT_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_LONG_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_LLONG_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_POINTER_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_BOOL_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_CHAR_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_CHAR16_T_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_CHAR32_T_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_WCHAR_T_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_SHORT_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_INT_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_LONG_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_LLONG_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_POINTER_LOCK_FREE = @as(c_int, 2); pub const __PIC__ = @as(c_int, 2); pub const __pic__ = @as(c_int, 2); pub const __FLT_EVAL_METHOD__ = @as(c_int, 0); pub const __FLT_RADIX__ = @as(c_int, 2); pub const __DECIMAL_DIG__ = __LDBL_DECIMAL_DIG__; pub const __SSP_STRONG__ = @as(c_int, 2); pub const __nonnull = _Nonnull; pub const __null_unspecified = _Null_unspecified; pub const __nullable = _Nullable; pub const __GCC_ASM_FLAG_OUTPUTS__ = @as(c_int, 1); pub const __code_model_small__ = @as(c_int, 1); pub const __amd64__ = @as(c_int, 1); pub const __amd64 = @as(c_int, 1); pub const __x86_64 = @as(c_int, 1); pub const __x86_64__ = @as(c_int, 1); pub const __SEG_GS = @as(c_int, 1); pub const __SEG_FS = @as(c_int, 1); pub const __seg_gs = __attribute__(address_space(@as(c_int, 256))); pub const __seg_fs = __attribute__(address_space(@as(c_int, 257))); pub const __corei7 = @as(c_int, 1); pub const __corei7__ = @as(c_int, 1); pub const __tune_corei7__ = @as(c_int, 1); pub const __NO_MATH_INLINES = @as(c_int, 1); pub const __AES__ = @as(c_int, 1); pub const __PCLMUL__ = @as(c_int, 1); pub const __LAHF_SAHF__ = @as(c_int, 1); pub const __LZCNT__ = @as(c_int, 1); pub const __RDRND__ = @as(c_int, 1); pub const __FSGSBASE__ = @as(c_int, 1); pub const __BMI__ = @as(c_int, 1); pub const __BMI2__ = @as(c_int, 1); pub const __POPCNT__ = @as(c_int, 1); pub const __RTM__ = @as(c_int, 1); pub const __PRFCHW__ = @as(c_int, 1); pub const __RDSEED__ = @as(c_int, 1); pub const __ADX__ = @as(c_int, 1); pub const __MOVBE__ = @as(c_int, 1); pub const __FMA__ = @as(c_int, 1); pub const __F16C__ = @as(c_int, 1); pub const __FXSR__ = @as(c_int, 1); pub const __XSAVE__ = @as(c_int, 1); pub const __XSAVEOPT__ = @as(c_int, 1); pub const __XSAVEC__ = @as(c_int, 1); pub const __XSAVES__ = @as(c_int, 1); pub const __CLFLUSHOPT__ = @as(c_int, 1); pub const __SGX__ = @as(c_int, 1); pub const __INVPCID__ = @as(c_int, 1); pub const __AVX2__ = @as(c_int, 1); pub const __AVX__ = @as(c_int, 1); pub const __SSE4_2__ = @as(c_int, 1); pub const __SSE4_1__ = @as(c_int, 1); pub const __SSSE3__ = @as(c_int, 1); pub const __SSE3__ = @as(c_int, 1); pub const __SSE2__ = @as(c_int, 1); pub const __SSE2_MATH__ = @as(c_int, 1); pub const __SSE__ = @as(c_int, 1); pub const __SSE_MATH__ = @as(c_int, 1); pub const __MMX__ = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = @as(c_int, 1); pub const __APPLE_CC__ = @as(c_int, 6000); pub const __APPLE__ = @as(c_int, 1); pub const __STDC_NO_THREADS__ = @as(c_int, 1); pub const __weak = __attribute__(objc_gc(weak)); pub const __DYNAMIC__ = @as(c_int, 1); pub const __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101406, .decimal); pub const __MACH__ = @as(c_int, 1); pub const __STDC__ = @as(c_int, 1); pub const __STDC_HOSTED__ = @as(c_int, 1); pub const __STDC_VERSION__ = @as(c_long, 201710); pub const __STDC_UTF_16__ = @as(c_int, 1); pub const __STDC_UTF_32__ = @as(c_int, 1); pub const _DEBUG = @as(c_int, 1); pub const __GNUC_VA_LIST = @as(c_int, 1); pub const bool_3 = bool; pub const true_4 = @as(c_int, 1); pub const false_5 = @as(c_int, 0); pub const __bool_true_false_are_defined = @as(c_int, 1); pub const __WORDSIZE = @as(c_int, 64); pub inline fn __P(protos: anytype) @TypeOf(protos) { return protos; } pub const __signed = c_int; pub const __dead2 = __attribute__(__noreturn__); pub const __pure2 = __attribute__(__const__); pub const __unused = __attribute__(__unused__); pub const __used = __attribute__(__used__); pub const __cold = __attribute__(__cold__); pub const __deprecated = __attribute__(__deprecated__); pub inline fn __deprecated_msg(_msg: anytype) @TypeOf(__attribute__(__deprecated__(_msg))) { return __attribute__(__deprecated__(_msg)); } pub inline fn __deprecated_enum_msg(_msg: anytype) @TypeOf(__deprecated_msg(_msg)) { return __deprecated_msg(_msg); } pub const __unavailable = __attribute__(__unavailable__); pub const __disable_tail_calls = __attribute__(__disable_tail_calls__); pub const __not_tail_called = __attribute__(__not_tail_called__); pub const __result_use_check = __attribute__(__warn_unused_result__); pub const __abortlike = __dead2 ++ __cold ++ __not_tail_called; pub const __header_always_inline = __header_inline ++ __attribute__(__always_inline__); pub const __unreachable_ok_pop = _Pragma("clang diagnostic pop"); pub inline fn __printflike(fmtarg: anytype, firstvararg: anytype) @TypeOf(__attribute__(__format__(__printf__, fmtarg, firstvararg))) { return __attribute__(__format__(__printf__, fmtarg, firstvararg)); } pub inline fn __printf0like(fmtarg: anytype, firstvararg: anytype) @TypeOf(__attribute__(__format__(__printf0__, fmtarg, firstvararg))) { return __attribute__(__format__(__printf0__, fmtarg, firstvararg)); } pub inline fn __scanflike(fmtarg: anytype, firstvararg: anytype) @TypeOf(__attribute__(__format__(__scanf__, fmtarg, firstvararg))) { return __attribute__(__format__(__scanf__, fmtarg, firstvararg)); } pub inline fn __COPYRIGHT(s: anytype) @TypeOf(__IDSTRING(copyright, s)) { return __IDSTRING(copyright, s); } pub inline fn __RCSID(s: anytype) @TypeOf(__IDSTRING(rcsid, s)) { return __IDSTRING(rcsid, s); } pub inline fn __SCCSID(s: anytype) @TypeOf(__IDSTRING(sccsid, s)) { return __IDSTRING(sccsid, s); } pub inline fn __PROJECT_VERSION(s: anytype) @TypeOf(__IDSTRING(project_version, s)) { return __IDSTRING(project_version, s); } pub const __DARWIN_ONLY_64_BIT_INO_T = @as(c_int, 0); pub const __DARWIN_ONLY_VERS_1050 = @as(c_int, 0); pub const __DARWIN_ONLY_UNIX_CONFORMANCE = @as(c_int, 1); pub const __DARWIN_UNIX03 = @as(c_int, 1); pub const __DARWIN_64_BIT_INO_T = @as(c_int, 1); pub const __DARWIN_VERS_1050 = @as(c_int, 1); pub const __DARWIN_NON_CANCELABLE = @as(c_int, 0); pub const __DARWIN_SUF_64_BIT_INO_T = "$INODE64"; pub const __DARWIN_SUF_1050 = "$1050"; pub const __DARWIN_SUF_EXTSN = "$DARWIN_EXTSN"; pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_0(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_1(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_2(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_3(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_4(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_5(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_6(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_7(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_8(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_9(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_10(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_10_2(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_10_3(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_11(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_11_2(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_11_3(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_11_4(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_12(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_12_1(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_12_2(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_12_4(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_13(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_13_1(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_13_2(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_13_4(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_14(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_1(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_4(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_5(x: anytype) @TypeOf(x) { return x; } pub inline fn __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_6(x: anytype) @TypeOf(x) { return x; } pub const __DARWIN_C_ANSI = @as(c_long, 0o10000); pub const __DARWIN_C_FULL = @as(c_long, 900000); pub const __DARWIN_C_LEVEL = __DARWIN_C_FULL; pub const __STDC_WANT_LIB_EXT1__ = @as(c_int, 1); pub const __DARWIN_NO_LONG_LONG = @as(c_int, 0); pub const _DARWIN_FEATURE_64_BIT_INODE = @as(c_int, 1); pub const _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = @as(c_int, 1); pub const _DARWIN_FEATURE_UNIX_CONFORMANCE = @as(c_int, 3); pub inline fn __CAST_AWAY_QUALIFIER(variable: anytype, qualifier: anytype, type_1: anytype) @TypeOf(type_1(c_long)(variable)) { _ = qualifier; return type_1(c_long)(variable); } pub const __XNU_PRIVATE_EXTERN = __attribute__(visibility("hidden")); pub const __enum_open = __attribute__(__enum_extensibility__(open)); pub const __enum_closed = __attribute__(__enum_extensibility__(closed)); pub const __enum_options = __attribute__(__flag_enum__); pub const __DARWIN_NULL = @import("std").zig.c_translation.cast(?*c_void, @as(c_int, 0)); pub const __PTHREAD_SIZE__ = @as(c_int, 8176); pub const __PTHREAD_ATTR_SIZE__ = @as(c_int, 56); pub const __PTHREAD_MUTEXATTR_SIZE__ = @as(c_int, 8); pub const __PTHREAD_MUTEX_SIZE__ = @as(c_int, 56); pub const __PTHREAD_CONDATTR_SIZE__ = @as(c_int, 8); pub const __PTHREAD_COND_SIZE__ = @as(c_int, 40); pub const __PTHREAD_ONCE_SIZE__ = @as(c_int, 8); pub const __PTHREAD_RWLOCK_SIZE__ = @as(c_int, 192); pub const __PTHREAD_RWLOCKATTR_SIZE__ = @as(c_int, 16); pub const USER_ADDR_NULL = @import("std").zig.c_translation.cast(user_addr_t, @as(c_int, 0)); pub inline fn CAST_USER_ADDR_T(a_ptr: anytype) user_addr_t { return @import("std").zig.c_translation.cast(user_addr_t, @import("std").zig.c_translation.cast(usize, a_ptr)); } pub inline fn INT8_C(v: anytype) @TypeOf(v) { return v; } pub inline fn INT16_C(v: anytype) @TypeOf(v) { return v; } pub inline fn INT32_C(v: anytype) @TypeOf(v) { return v; } pub const INT64_C = @import("std").zig.c_translation.Macros.LL_SUFFIX; pub inline fn UINT8_C(v: anytype) @TypeOf(v) { return v; } pub inline fn UINT16_C(v: anytype) @TypeOf(v) { return v; } pub const UINT32_C = @import("std").zig.c_translation.Macros.U_SUFFIX; pub const UINT64_C = @import("std").zig.c_translation.Macros.ULL_SUFFIX; pub const INTMAX_C = @import("std").zig.c_translation.Macros.L_SUFFIX; pub const UINTMAX_C = @import("std").zig.c_translation.Macros.UL_SUFFIX; pub const INT8_MAX = @as(c_int, 127); pub const INT16_MAX = @as(c_int, 32767); pub const INT32_MAX = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const INT64_MAX = @as(c_longlong, 9223372036854775807); pub const INT8_MIN = -@as(c_int, 128); pub const INT16_MIN = -@import("std").zig.c_translation.promoteIntLiteral(c_int, 32768, .decimal); pub const INT32_MIN = -INT32_MAX - @as(c_int, 1); pub const INT64_MIN = -INT64_MAX - @as(c_int, 1); pub const UINT8_MAX = @as(c_int, 255); pub const UINT16_MAX = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); pub const UINT32_MAX = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const UINT64_MAX = @as(c_ulonglong, 18446744073709551615); pub const INT_LEAST8_MIN = INT8_MIN; pub const INT_LEAST16_MIN = INT16_MIN; pub const INT_LEAST32_MIN = INT32_MIN; pub const INT_LEAST64_MIN = INT64_MIN; pub const INT_LEAST8_MAX = INT8_MAX; pub const INT_LEAST16_MAX = INT16_MAX; pub const INT_LEAST32_MAX = INT32_MAX; pub const INT_LEAST64_MAX = INT64_MAX; pub const UINT_LEAST8_MAX = UINT8_MAX; pub const UINT_LEAST16_MAX = UINT16_MAX; pub const UINT_LEAST32_MAX = UINT32_MAX; pub const UINT_LEAST64_MAX = UINT64_MAX; pub const INT_FAST8_MIN = INT8_MIN; pub const INT_FAST16_MIN = INT16_MIN; pub const INT_FAST32_MIN = INT32_MIN; pub const INT_FAST64_MIN = INT64_MIN; pub const INT_FAST8_MAX = INT8_MAX; pub const INT_FAST16_MAX = INT16_MAX; pub const INT_FAST32_MAX = INT32_MAX; pub const INT_FAST64_MAX = INT64_MAX; pub const UINT_FAST8_MAX = UINT8_MAX; pub const UINT_FAST16_MAX = UINT16_MAX; pub const UINT_FAST32_MAX = UINT32_MAX; pub const UINT_FAST64_MAX = UINT64_MAX; pub const INTPTR_MAX = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const INTPTR_MIN = -INTPTR_MAX - @as(c_int, 1); pub const UINTPTR_MAX = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const INTMAX_MAX = INTMAX_C(@import("std").zig.c_translation.promoteIntLiteral(c_int, 9223372036854775807, .decimal)); pub const UINTMAX_MAX = UINTMAX_C(@import("std").zig.c_translation.promoteIntLiteral(c_int, 18446744073709551615, .decimal)); pub const INTMAX_MIN = -INTMAX_MAX - @as(c_int, 1); pub const PTRDIFF_MIN = INTMAX_MIN; pub const PTRDIFF_MAX = INTMAX_MAX; pub const SIZE_MAX = UINTPTR_MAX; pub const RSIZE_MAX = SIZE_MAX >> @as(c_int, 1); pub const WCHAR_MAX = __WCHAR_MAX__; pub const WCHAR_MIN = -WCHAR_MAX - @as(c_int, 1); pub const WINT_MIN = INT32_MIN; pub const WINT_MAX = INT32_MAX; pub const SIG_ATOMIC_MIN = INT32_MIN; pub const SIG_ATOMIC_MAX = INT32_MAX; pub const __API_TO_BE_DEPRECATED = @import("std").zig.c_translation.promoteIntLiteral(c_int, 100000, .decimal); pub const __MAC_10_0 = @as(c_int, 1000); pub const __MAC_10_1 = @as(c_int, 1010); pub const __MAC_10_2 = @as(c_int, 1020); pub const __MAC_10_3 = @as(c_int, 1030); pub const __MAC_10_4 = @as(c_int, 1040); pub const __MAC_10_5 = @as(c_int, 1050); pub const __MAC_10_6 = @as(c_int, 1060); pub const __MAC_10_7 = @as(c_int, 1070); pub const __MAC_10_8 = @as(c_int, 1080); pub const __MAC_10_9 = @as(c_int, 1090); pub const __MAC_10_10 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101000, .decimal); pub const __MAC_10_10_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101002, .decimal); pub const __MAC_10_10_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101003, .decimal); pub const __MAC_10_11 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101100, .decimal); pub const __MAC_10_11_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101102, .decimal); pub const __MAC_10_11_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101103, .decimal); pub const __MAC_10_11_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101104, .decimal); pub const __MAC_10_12 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101200, .decimal); pub const __MAC_10_12_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101201, .decimal); pub const __MAC_10_12_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101202, .decimal); pub const __MAC_10_12_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101204, .decimal); pub const __MAC_10_13 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101300, .decimal); pub const __MAC_10_13_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101301, .decimal); pub const __MAC_10_13_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101302, .decimal); pub const __MAC_10_13_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101304, .decimal); pub const __MAC_10_14 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101400, .decimal); pub const __MAC_10_14_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101401, .decimal); pub const __MAC_10_14_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101404, .decimal); pub const __MAC_10_15 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101500, .decimal); pub const __MAC_10_15_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101501, .decimal); pub const __MAC_10_15_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 101504, .decimal); pub const __IPHONE_2_0 = @as(c_int, 20000); pub const __IPHONE_2_1 = @as(c_int, 20100); pub const __IPHONE_2_2 = @as(c_int, 20200); pub const __IPHONE_3_0 = @as(c_int, 30000); pub const __IPHONE_3_1 = @as(c_int, 30100); pub const __IPHONE_3_2 = @as(c_int, 30200); pub const __IPHONE_4_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 40000, .decimal); pub const __IPHONE_4_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 40100, .decimal); pub const __IPHONE_4_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 40200, .decimal); pub const __IPHONE_4_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 40300, .decimal); pub const __IPHONE_5_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 50000, .decimal); pub const __IPHONE_5_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 50100, .decimal); pub const __IPHONE_6_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 60000, .decimal); pub const __IPHONE_6_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 60100, .decimal); pub const __IPHONE_7_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 70000, .decimal); pub const __IPHONE_7_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 70100, .decimal); pub const __IPHONE_8_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 80000, .decimal); pub const __IPHONE_8_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 80100, .decimal); pub const __IPHONE_8_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 80200, .decimal); pub const __IPHONE_8_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 80300, .decimal); pub const __IPHONE_8_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 80400, .decimal); pub const __IPHONE_9_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 90000, .decimal); pub const __IPHONE_9_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 90100, .decimal); pub const __IPHONE_9_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 90200, .decimal); pub const __IPHONE_9_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 90300, .decimal); pub const __IPHONE_10_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 100000, .decimal); pub const __IPHONE_10_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 100100, .decimal); pub const __IPHONE_10_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 100200, .decimal); pub const __IPHONE_10_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 100300, .decimal); pub const __IPHONE_11_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110000, .decimal); pub const __IPHONE_11_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110100, .decimal); pub const __IPHONE_11_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110200, .decimal); pub const __IPHONE_11_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110300, .decimal); pub const __IPHONE_11_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110400, .decimal); pub const __IPHONE_12_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120000, .decimal); pub const __IPHONE_12_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120100, .decimal); pub const __IPHONE_12_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120200, .decimal); pub const __IPHONE_12_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120300, .decimal); pub const __IPHONE_13_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130000, .decimal); pub const __IPHONE_13_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130100, .decimal); pub const __IPHONE_13_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130200, .decimal); pub const __IPHONE_13_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130300, .decimal); pub const __IPHONE_13_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130400, .decimal); pub const __IPHONE_13_5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130500, .decimal); pub const __IPHONE_13_6 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130600, .decimal); pub const __TVOS_9_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 90000, .decimal); pub const __TVOS_9_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 90100, .decimal); pub const __TVOS_9_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 90200, .decimal); pub const __TVOS_10_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 100000, .decimal); pub const __TVOS_10_0_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 100001, .decimal); pub const __TVOS_10_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 100100, .decimal); pub const __TVOS_10_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 100200, .decimal); pub const __TVOS_11_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110000, .decimal); pub const __TVOS_11_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110100, .decimal); pub const __TVOS_11_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110200, .decimal); pub const __TVOS_11_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110300, .decimal); pub const __TVOS_11_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 110400, .decimal); pub const __TVOS_12_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120000, .decimal); pub const __TVOS_12_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120100, .decimal); pub const __TVOS_12_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120200, .decimal); pub const __TVOS_12_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120300, .decimal); pub const __TVOS_13_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130000, .decimal); pub const __TVOS_13_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130200, .decimal); pub const __TVOS_13_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130300, .decimal); pub const __TVOS_13_4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 130400, .decimal); pub const __WATCHOS_1_0 = @as(c_int, 10000); pub const __WATCHOS_2_0 = @as(c_int, 20000); pub const __WATCHOS_2_1 = @as(c_int, 20100); pub const __WATCHOS_2_2 = @as(c_int, 20200); pub const __WATCHOS_3_0 = @as(c_int, 30000); pub const __WATCHOS_3_1 = @as(c_int, 30100); pub const __WATCHOS_3_1_1 = @as(c_int, 30101); pub const __WATCHOS_3_2 = @as(c_int, 30200); pub const __WATCHOS_4_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 40000, .decimal); pub const __WATCHOS_4_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 40100, .decimal); pub const __WATCHOS_4_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 40200, .decimal); pub const __WATCHOS_4_3 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 40300, .decimal); pub const __WATCHOS_5_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 50000, .decimal); pub const __WATCHOS_5_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 50100, .decimal); pub const __WATCHOS_5_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 50200, .decimal); pub const __WATCHOS_6_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 60000, .decimal); pub const __WATCHOS_6_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 60100, .decimal); pub const __WATCHOS_6_2 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 60200, .decimal); pub const __DRIVERKIT_19_0 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 190000, .decimal); pub const __MAC_OS_X_VERSION_MIN_REQUIRED = __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__; pub const __MAC_OS_X_VERSION_MAX_ALLOWED = __MAC_10_15; pub const __AVAILABILITY_INTERNAL_DEPRECATED = __attribute__(deprecated); pub inline fn __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg: anytype) @TypeOf(__attribute__(deprecated(_msg))) { return __attribute__(deprecated(_msg)); } pub const __AVAILABILITY_INTERNAL_UNAVAILABLE = __attribute__(unavailable); pub const __AVAILABILITY_INTERNAL_WEAK_IMPORT = __attribute__(weak_import); pub const __ENABLE_LEGACY_MAC_AVAILABILITY = @as(c_int, 1); pub const __AVAILABILITY_INTERNAL__MAC_NA = __attribute__(availability(macosx, unavailable)); pub const __AVAILABILITY_INTERNAL__MAC_NA_DEP__MAC_NA = __attribute__(availability(macosx, unavailable)); pub inline fn __AVAILABILITY_INTERNAL__MAC_NA_DEP__MAC_NA_MSG(_msg: anytype) @TypeOf(__attribute__(availability(macosx, unavailable))) { _ = _msg; return __attribute__(availability(macosx, unavailable)); } pub const __AVAILABILITY_INTERNAL__IPHONE_NA = __attribute__(availability(ios, unavailable)); pub const __AVAILABILITY_INTERNAL__IPHONE_NA__IPHONE_NA = __attribute__(availability(ios, unavailable)); pub const __AVAILABILITY_INTERNAL__IPHONE_NA_DEP__IPHONE_NA = __attribute__(availability(ios, unavailable)); pub inline fn __AVAILABILITY_INTERNAL__IPHONE_NA_DEP__IPHONE_NA_MSG(_msg: anytype) @TypeOf(__attribute__(availability(ios, unavailable))) { _ = _msg; return __attribute__(availability(ios, unavailable)); } pub const __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION = __attribute__(availability(ios, unavailable)); pub const __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION_DEP__IPHONE_COMPAT_VERSION = __attribute__(availability(ios, unavailable)); pub inline fn __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION_DEP__IPHONE_COMPAT_VERSION_MSG(_msg: anytype) @TypeOf(__attribute__(availability(ios, unavailable))) { _ = _msg; return __attribute__(availability(ios, unavailable)); } pub inline fn __API_AVAILABLE1(x: anytype) @TypeOf(__API_A(x)) { return __API_A(x); } pub inline fn __API_RANGE_STRINGIFY(x: anytype) @TypeOf(__API_RANGE_STRINGIFY2(x)) { return __API_RANGE_STRINGIFY2(x); } pub inline fn __API_AVAILABLE_BEGIN1(a: anytype) @TypeOf(__API_A_BEGIN(a)) { return __API_A_BEGIN(a); } pub inline fn __API_DEPRECATED_MSG2(msg: anytype, x: anytype) @TypeOf(__API_D(msg, x)) { return __API_D(msg, x); } pub inline fn __API_DEPRECATED_BEGIN_MSG2(msg: anytype, a: anytype) @TypeOf(__API_D_BEGIN(msg, a)) { return __API_D_BEGIN(msg, a); } pub inline fn __API_DEPRECATED_REP2(rep: anytype, x: anytype) @TypeOf(__API_R(rep, x)) { return __API_R(rep, x); } pub inline fn __API_DEPRECATED_BEGIN_REP2(rep: anytype, a: anytype) @TypeOf(__API_R_BEGIN(rep, a)) { return __API_R_BEGIN(rep, a); } pub const __API_UNAVAILABLE_PLATFORM_macos = blk: { _ = macos; break :blk unavailable; }; pub const __API_UNAVAILABLE_PLATFORM_macosx = blk: { _ = macosx; break :blk unavailable; }; pub const __API_UNAVAILABLE_PLATFORM_ios = blk: { _ = ios; break :blk unavailable; }; pub const __API_UNAVAILABLE_PLATFORM_watchos = blk: { _ = watchos; break :blk unavailable; }; pub const __API_UNAVAILABLE_PLATFORM_tvos = blk: { _ = tvos; break :blk unavailable; }; pub const __API_UNAVAILABLE_PLATFORM_macCatalyst = blk: { _ = macCatalyst; break :blk unavailable; }; pub inline fn __API_UNAVAILABLE_PLATFORM_uikitformac(x: anytype) @TypeOf(unavailable) { _ = x; return blk: { _ = uikitformac; break :blk unavailable; }; } pub const __API_UNAVAILABLE_PLATFORM_driverkit = blk: { _ = driverkit; break :blk unavailable; }; pub inline fn __API_UNAVAILABLE1(x: anytype) @TypeOf(__API_U(x)) { return __API_U(x); } pub inline fn __API_UNAVAILABLE_BEGIN1(a: anytype) @TypeOf(__API_U_BEGIN(a)) { return __API_U_BEGIN(a); } pub inline fn __OS_AVAILABILITY(_target: anytype, _availability: anytype) @TypeOf(__attribute__(availability(_target, _availability))) { return __attribute__(availability(_target, _availability)); } pub inline fn __OSX_EXTENSION_UNAVAILABLE(_msg: anytype) @TypeOf(__OS_AVAILABILITY_MSG(macosx_app_extension, unavailable, _msg)) { return __OS_AVAILABILITY_MSG(macosx_app_extension, unavailable, _msg); } pub inline fn __IOS_EXTENSION_UNAVAILABLE(_msg: anytype) @TypeOf(__OS_AVAILABILITY_MSG(ios_app_extension, unavailable, _msg)) { return __OS_AVAILABILITY_MSG(ios_app_extension, unavailable, _msg); } pub const __OSX_UNAVAILABLE = __OS_AVAILABILITY(macosx, unavailable); pub const __IOS_UNAVAILABLE = __OS_AVAILABILITY(ios, unavailable); pub const __IOS_PROHIBITED = __OS_AVAILABILITY(ios, unavailable); pub const __TVOS_UNAVAILABLE = __OS_AVAILABILITY(tvos, unavailable); pub const __TVOS_PROHIBITED = __OS_AVAILABILITY(tvos, unavailable); pub const __WATCHOS_UNAVAILABLE = __OS_AVAILABILITY(watchos, unavailable); pub const __WATCHOS_PROHIBITED = __OS_AVAILABILITY(watchos, unavailable); pub const __SWIFT_UNAVAILABLE = __OS_AVAILABILITY(swift, unavailable); pub inline fn __SWIFT_UNAVAILABLE_MSG(_msg: anytype) @TypeOf(__OS_AVAILABILITY_MSG(swift, unavailable, _msg)) { return __OS_AVAILABILITY_MSG(swift, unavailable, _msg); } pub const __API_AVAILABLE_END = _Pragma("clang attribute pop"); pub const __API_DEPRECATED_END = _Pragma("clang attribute pop"); pub const __API_DEPRECATED_WITH_REPLACEMENT_END = _Pragma("clang attribute pop"); pub const __API_UNAVAILABLE_END = _Pragma("clang attribute pop"); pub inline fn __strfmonlike(fmtarg: anytype, firstvararg: anytype) @TypeOf(__attribute__(__format__(__strfmon__, fmtarg, firstvararg))) { return __attribute__(__format__(__strfmon__, fmtarg, firstvararg)); } pub inline fn __strftimelike(fmtarg: anytype) @TypeOf(__attribute__(__format__(__strftime__, fmtarg, @as(c_int, 0)))) { return __attribute__(__format__(__strftime__, fmtarg, @as(c_int, 0))); } pub const __DARWIN_WCHAR_MAX = __WCHAR_MAX__; pub const __DARWIN_WCHAR_MIN = -@import("std").zig.c_translation.promoteIntLiteral(c_int, 0x7fffffff, .hexadecimal) - @as(c_int, 1); pub const __DARWIN_WEOF = @import("std").zig.c_translation.cast(__darwin_wint_t, -@as(c_int, 1)); pub const _FORTIFY_SOURCE = @as(c_int, 2); pub const __DARWIN_NSIG = @as(c_int, 32); pub const NSIG = __DARWIN_NSIG; pub const _I386_SIGNAL_H_ = @as(c_int, 1); pub const SIGHUP = @as(c_int, 1); pub const SIGINT = @as(c_int, 2); pub const SIGQUIT = @as(c_int, 3); pub const SIGILL = @as(c_int, 4); pub const SIGTRAP = @as(c_int, 5); pub const SIGABRT = @as(c_int, 6); pub const SIGIOT = SIGABRT; pub const SIGEMT = @as(c_int, 7); pub const SIGFPE = @as(c_int, 8); pub const SIGKILL = @as(c_int, 9); pub const SIGBUS = @as(c_int, 10); pub const SIGSEGV = @as(c_int, 11); pub const SIGSYS = @as(c_int, 12); pub const SIGPIPE = @as(c_int, 13); pub const SIGALRM = @as(c_int, 14); pub const SIGTERM = @as(c_int, 15); pub const SIGURG = @as(c_int, 16); pub const SIGSTOP = @as(c_int, 17); pub const SIGTSTP = @as(c_int, 18); pub const SIGCONT = @as(c_int, 19); pub const SIGCHLD = @as(c_int, 20); pub const SIGTTIN = @as(c_int, 21); pub const SIGTTOU = @as(c_int, 22); pub const SIGIO = @as(c_int, 23); pub const SIGXCPU = @as(c_int, 24); pub const SIGXFSZ = @as(c_int, 25); pub const SIGVTALRM = @as(c_int, 26); pub const SIGPROF = @as(c_int, 27); pub const SIGWINCH = @as(c_int, 28); pub const SIGINFO = @as(c_int, 29); pub const SIGUSR1 = @as(c_int, 30); pub const SIGUSR2 = @as(c_int, 31); pub const _STRUCT_X86_THREAD_STATE32 = struct___darwin_i386_thread_state; pub const _STRUCT_FP_CONTROL = struct___darwin_fp_control; pub const FP_PREC_24B = @as(c_int, 0); pub const FP_PREC_53B = @as(c_int, 2); pub const FP_PREC_64B = @as(c_int, 3); pub const FP_RND_NEAR = @as(c_int, 0); pub const FP_RND_DOWN = @as(c_int, 1); pub const FP_RND_UP = @as(c_int, 2); pub const FP_CHOP = @as(c_int, 3); pub const _STRUCT_FP_STATUS = struct___darwin_fp_status; pub const _STRUCT_MMST_REG = struct___darwin_mmst_reg; pub const _STRUCT_XMM_REG = struct___darwin_xmm_reg; pub const _STRUCT_YMM_REG = struct___darwin_ymm_reg; pub const _STRUCT_ZMM_REG = struct___darwin_zmm_reg; pub const _STRUCT_OPMASK_REG = struct___darwin_opmask_reg; pub const FP_STATE_BYTES = @as(c_int, 512); pub const _STRUCT_X86_FLOAT_STATE32 = struct___darwin_i386_float_state; pub const _STRUCT_X86_AVX_STATE32 = struct___darwin_i386_avx_state; pub const _STRUCT_X86_AVX512_STATE32 = struct___darwin_i386_avx512_state; pub const _STRUCT_X86_EXCEPTION_STATE32 = struct___darwin_i386_exception_state; pub const _STRUCT_X86_DEBUG_STATE32 = struct___darwin_x86_debug_state32; pub const _STRUCT_X86_PAGEIN_STATE = struct___x86_pagein_state; pub const _STRUCT_X86_THREAD_STATE64 = struct___darwin_x86_thread_state64; pub const _STRUCT_X86_THREAD_FULL_STATE64 = struct___darwin_x86_thread_full_state64; pub const _STRUCT_X86_FLOAT_STATE64 = struct___darwin_x86_float_state64; pub const _STRUCT_X86_AVX_STATE64 = struct___darwin_x86_avx_state64; pub const _STRUCT_X86_AVX512_STATE64 = struct___darwin_x86_avx512_state64; pub const _STRUCT_X86_EXCEPTION_STATE64 = struct___darwin_x86_exception_state64; pub const _STRUCT_X86_DEBUG_STATE64 = struct___darwin_x86_debug_state64; pub const _STRUCT_X86_CPMU_STATE64 = struct___darwin_x86_cpmu_state64; pub const _STRUCT_MCONTEXT32 = struct___darwin_mcontext32; pub const _STRUCT_MCONTEXT_AVX32 = struct___darwin_mcontext_avx32; pub const _STRUCT_MCONTEXT_AVX512_32 = struct___darwin_mcontext_avx512_32; pub const _STRUCT_MCONTEXT64 = struct___darwin_mcontext64; pub const _STRUCT_MCONTEXT64_FULL = struct___darwin_mcontext64_full; pub const _STRUCT_MCONTEXT_AVX64 = struct___darwin_mcontext_avx64; pub const _STRUCT_MCONTEXT_AVX64_FULL = struct___darwin_mcontext_avx64_full; pub const _STRUCT_MCONTEXT_AVX512_64 = struct___darwin_mcontext_avx512_64; pub const _STRUCT_MCONTEXT_AVX512_64_FULL = struct___darwin_mcontext_avx512_64_full; pub const _STRUCT_MCONTEXT = _STRUCT_MCONTEXT64; pub const _STRUCT_SIGALTSTACK = struct___darwin_sigaltstack; pub const _STRUCT_UCONTEXT = struct___darwin_ucontext; pub const SIGEV_NONE = @as(c_int, 0); pub const SIGEV_SIGNAL = @as(c_int, 1); pub const SIGEV_THREAD = @as(c_int, 3); pub const ILL_NOOP = @as(c_int, 0); pub const ILL_ILLOPC = @as(c_int, 1); pub const ILL_ILLTRP = @as(c_int, 2); pub const ILL_PRVOPC = @as(c_int, 3); pub const ILL_ILLOPN = @as(c_int, 4); pub const ILL_ILLADR = @as(c_int, 5); pub const ILL_PRVREG = @as(c_int, 6); pub const ILL_COPROC = @as(c_int, 7); pub const ILL_BADSTK = @as(c_int, 8); pub const FPE_NOOP = @as(c_int, 0); pub const FPE_FLTDIV = @as(c_int, 1); pub const FPE_FLTOVF = @as(c_int, 2); pub const FPE_FLTUND = @as(c_int, 3); pub const FPE_FLTRES = @as(c_int, 4); pub const FPE_FLTINV = @as(c_int, 5); pub const FPE_FLTSUB = @as(c_int, 6); pub const FPE_INTDIV = @as(c_int, 7); pub const FPE_INTOVF = @as(c_int, 8); pub const SEGV_NOOP = @as(c_int, 0); pub const SEGV_MAPERR = @as(c_int, 1); pub const SEGV_ACCERR = @as(c_int, 2); pub const BUS_NOOP = @as(c_int, 0); pub const BUS_ADRALN = @as(c_int, 1); pub const BUS_ADRERR = @as(c_int, 2); pub const BUS_OBJERR = @as(c_int, 3); pub const TRAP_BRKPT = @as(c_int, 1); pub const TRAP_TRACE = @as(c_int, 2); pub const CLD_NOOP = @as(c_int, 0); pub const CLD_EXITED = @as(c_int, 1); pub const CLD_KILLED = @as(c_int, 2); pub const CLD_DUMPED = @as(c_int, 3); pub const CLD_TRAPPED = @as(c_int, 4); pub const CLD_STOPPED = @as(c_int, 5); pub const CLD_CONTINUED = @as(c_int, 6); pub const POLL_IN = @as(c_int, 1); pub const POLL_OUT = @as(c_int, 2); pub const POLL_MSG = @as(c_int, 3); pub const POLL_ERR = @as(c_int, 4); pub const POLL_PRI = @as(c_int, 5); pub const POLL_HUP = @as(c_int, 6); pub const sa_handler = __sigaction_u.__sa_handler; pub const sa_sigaction = __sigaction_u.__sa_sigaction; pub const SA_ONSTACK = @as(c_int, 0x0001); pub const SA_RESTART = @as(c_int, 0x0002); pub const SA_RESETHAND = @as(c_int, 0x0004); pub const SA_NOCLDSTOP = @as(c_int, 0x0008); pub const SA_NODEFER = @as(c_int, 0x0010); pub const SA_NOCLDWAIT = @as(c_int, 0x0020); pub const SA_SIGINFO = @as(c_int, 0x0040); pub const SA_USERTRAMP = @as(c_int, 0x0100); pub const SA_64REGSET = @as(c_int, 0x0200); pub const SA_USERSPACE_MASK = (((((SA_ONSTACK | SA_RESTART) | SA_RESETHAND) | SA_NOCLDSTOP) | SA_NODEFER) | SA_NOCLDWAIT) | SA_SIGINFO; pub const SIG_BLOCK = @as(c_int, 1); pub const SIG_UNBLOCK = @as(c_int, 2); pub const SIG_SETMASK = @as(c_int, 3); pub const SI_USER = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10001, .hexadecimal); pub const SI_QUEUE = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10002, .hexadecimal); pub const SI_TIMER = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10003, .hexadecimal); pub const SI_ASYNCIO = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10004, .hexadecimal); pub const SI_MESGQ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10005, .hexadecimal); pub const SS_ONSTACK = @as(c_int, 0x0001); pub const SS_DISABLE = @as(c_int, 0x0004); pub const MINSIGSTKSZ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 32768, .decimal); pub const SIGSTKSZ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 131072, .decimal); pub const SV_ONSTACK = SA_ONSTACK; pub const SV_INTERRUPT = SA_RESTART; pub const SV_RESETHAND = SA_RESETHAND; pub const SV_NODEFER = SA_NODEFER; pub const SV_NOCLDSTOP = SA_NOCLDSTOP; pub const SV_SIGINFO = SA_SIGINFO; pub const sv_onstack = sv_flags; pub inline fn sigmask(m: anytype) @TypeOf(@as(c_int, 1) << (m - @as(c_int, 1))) { return @as(c_int, 1) << (m - @as(c_int, 1)); } pub const BADSIG = SIG_ERR; pub const _STRUCT_TIMEVAL = struct_timeval; pub const PRIO_PROCESS = @as(c_int, 0); pub const PRIO_PGRP = @as(c_int, 1); pub const PRIO_USER = @as(c_int, 2); pub const PRIO_DARWIN_THREAD = @as(c_int, 3); pub const PRIO_DARWIN_PROCESS = @as(c_int, 4); pub const PRIO_MIN = -@as(c_int, 20); pub const PRIO_MAX = @as(c_int, 20); pub const PRIO_DARWIN_BG = @as(c_int, 0x1000); pub const PRIO_DARWIN_NONUI = @as(c_int, 0x1001); pub const RUSAGE_SELF = @as(c_int, 0); pub const RUSAGE_CHILDREN = -@as(c_int, 1); pub const ru_first = ru_ixrss; pub const ru_last = ru_nivcsw; pub const RUSAGE_INFO_V0 = @as(c_int, 0); pub const RUSAGE_INFO_V1 = @as(c_int, 1); pub const RUSAGE_INFO_V2 = @as(c_int, 2); pub const RUSAGE_INFO_V3 = @as(c_int, 3); pub const RUSAGE_INFO_V4 = @as(c_int, 4); pub const RUSAGE_INFO_CURRENT = RUSAGE_INFO_V4; pub const RLIM_INFINITY = (@import("std").zig.c_translation.cast(__uint64_t, @as(c_int, 1)) << @as(c_int, 63)) - @as(c_int, 1); pub const RLIM_SAVED_MAX = RLIM_INFINITY; pub const RLIM_SAVED_CUR = RLIM_INFINITY; pub const RLIMIT_CPU = @as(c_int, 0); pub const RLIMIT_FSIZE = @as(c_int, 1); pub const RLIMIT_DATA = @as(c_int, 2); pub const RLIMIT_STACK = @as(c_int, 3); pub const RLIMIT_CORE = @as(c_int, 4); pub const RLIMIT_AS = @as(c_int, 5); pub const RLIMIT_RSS = RLIMIT_AS; pub const RLIMIT_MEMLOCK = @as(c_int, 6); pub const RLIMIT_NPROC = @as(c_int, 7); pub const RLIMIT_NOFILE = @as(c_int, 8); pub const RLIM_NLIMITS = @as(c_int, 9); pub const _RLIMIT_POSIX_FLAG = @as(c_int, 0x1000); pub const RLIMIT_WAKEUPS_MONITOR = @as(c_int, 0x1); pub const RLIMIT_CPU_USAGE_MONITOR = @as(c_int, 0x2); pub const RLIMIT_THREAD_CPULIMITS = @as(c_int, 0x3); pub const RLIMIT_FOOTPRINT_INTERVAL = @as(c_int, 0x4); pub const WAKEMON_ENABLE = @as(c_int, 0x01); pub const WAKEMON_DISABLE = @as(c_int, 0x02); pub const WAKEMON_GET_PARAMS = @as(c_int, 0x04); pub const WAKEMON_SET_DEFAULTS = @as(c_int, 0x08); pub const WAKEMON_MAKE_FATAL = @as(c_int, 0x10); pub const CPUMON_MAKE_FATAL = @as(c_int, 0x1000); pub const FOOTPRINT_INTERVAL_RESET = @as(c_int, 0x1); pub const IOPOL_TYPE_DISK = @as(c_int, 0); pub const IOPOL_TYPE_VFS_ATIME_UPDATES = @as(c_int, 2); pub const IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = @as(c_int, 3); pub const IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = @as(c_int, 4); pub const IOPOL_SCOPE_PROCESS = @as(c_int, 0); pub const IOPOL_SCOPE_THREAD = @as(c_int, 1); pub const IOPOL_SCOPE_DARWIN_BG = @as(c_int, 2); pub const IOPOL_DEFAULT = @as(c_int, 0); pub const IOPOL_IMPORTANT = @as(c_int, 1); pub const IOPOL_PASSIVE = @as(c_int, 2); pub const IOPOL_THROTTLE = @as(c_int, 3); pub const IOPOL_UTILITY = @as(c_int, 4); pub const IOPOL_STANDARD = @as(c_int, 5); pub const IOPOL_APPLICATION = IOPOL_STANDARD; pub const IOPOL_NORMAL = IOPOL_IMPORTANT; pub const IOPOL_ATIME_UPDATES_DEFAULT = @as(c_int, 0); pub const IOPOL_ATIME_UPDATES_OFF = @as(c_int, 1); pub const IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = @as(c_int, 0); pub const IOPOL_MATERIALIZE_DATALESS_FILES_OFF = @as(c_int, 1); pub const IOPOL_MATERIALIZE_DATALESS_FILES_ON = @as(c_int, 2); pub const IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = @as(c_int, 0); pub const IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = @as(c_int, 1); pub const WNOHANG = @as(c_int, 0x00000001); pub const WUNTRACED = @as(c_int, 0x00000002); pub inline fn _W_INT(w: anytype) @TypeOf(@import("std").zig.c_translation.cast([*c]c_int, &w).*) { return @import("std").zig.c_translation.cast([*c]c_int, &w).*; } pub const WCOREFLAG = @as(c_int, 0o200); pub inline fn _WSTATUS(x: anytype) @TypeOf(_W_INT(x) & @as(c_int, 0o177)) { return _W_INT(x) & @as(c_int, 0o177); } pub const _WSTOPPED = @as(c_int, 0o177); pub inline fn WEXITSTATUS(x: anytype) @TypeOf((_W_INT(x) >> @as(c_int, 8)) & @as(c_int, 0x000000ff)) { return (_W_INT(x) >> @as(c_int, 8)) & @as(c_int, 0x000000ff); } pub inline fn WSTOPSIG(x: anytype) @TypeOf(_W_INT(x) >> @as(c_int, 8)) { return _W_INT(x) >> @as(c_int, 8); } pub inline fn WIFCONTINUED(x: anytype) @TypeOf((_WSTATUS(x) == _WSTOPPED) and (WSTOPSIG(x) == @as(c_int, 0x13))) { return (_WSTATUS(x) == _WSTOPPED) and (WSTOPSIG(x) == @as(c_int, 0x13)); } pub inline fn WIFSTOPPED(x: anytype) @TypeOf((_WSTATUS(x) == _WSTOPPED) and (WSTOPSIG(x) != @as(c_int, 0x13))) { return (_WSTATUS(x) == _WSTOPPED) and (WSTOPSIG(x) != @as(c_int, 0x13)); } pub inline fn WIFEXITED(x: anytype) @TypeOf(_WSTATUS(x) == @as(c_int, 0)) { return _WSTATUS(x) == @as(c_int, 0); } pub inline fn WIFSIGNALED(x: anytype) @TypeOf((_WSTATUS(x) != _WSTOPPED) and (_WSTATUS(x) != @as(c_int, 0))) { return (_WSTATUS(x) != _WSTOPPED) and (_WSTATUS(x) != @as(c_int, 0)); } pub inline fn WTERMSIG(x: anytype) @TypeOf(_WSTATUS(x)) { return _WSTATUS(x); } pub inline fn WCOREDUMP(x: anytype) @TypeOf(_W_INT(x) & WCOREFLAG) { return _W_INT(x) & WCOREFLAG; } pub inline fn W_EXITCODE(ret: anytype, sig: anytype) @TypeOf((ret << @as(c_int, 8)) | sig) { return (ret << @as(c_int, 8)) | sig; } pub inline fn W_STOPCODE(sig: anytype) @TypeOf((sig << @as(c_int, 8)) | _WSTOPPED) { return (sig << @as(c_int, 8)) | _WSTOPPED; } pub const WEXITED = @as(c_int, 0x00000004); pub const WSTOPPED = @as(c_int, 0x00000008); pub const WCONTINUED = @as(c_int, 0x00000010); pub const WNOWAIT = @as(c_int, 0x00000020); pub const WAIT_ANY = -@as(c_int, 1); pub const WAIT_MYPGRP = @as(c_int, 0); pub const _QUAD_HIGHWORD = @as(c_int, 1); pub const _QUAD_LOWWORD = @as(c_int, 0); pub const __DARWIN_LITTLE_ENDIAN = @as(c_int, 1234); pub const __DARWIN_BIG_ENDIAN = @as(c_int, 4321); pub const __DARWIN_PDP_ENDIAN = @as(c_int, 3412); pub const __DARWIN_BYTE_ORDER = __DARWIN_LITTLE_ENDIAN; pub const LITTLE_ENDIAN = __DARWIN_LITTLE_ENDIAN; pub const BIG_ENDIAN = __DARWIN_BIG_ENDIAN; pub const PDP_ENDIAN = __DARWIN_PDP_ENDIAN; pub const BYTE_ORDER = __DARWIN_BYTE_ORDER; pub inline fn __DARWIN_OSSwapConstInt16(x: anytype) __uint16_t { return @import("std").zig.c_translation.cast(__uint16_t, ((@import("std").zig.c_translation.cast(__uint16_t, x) & @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xff00, .hexadecimal)) >> @as(c_int, 8)) | ((@import("std").zig.c_translation.cast(__uint16_t, x) & @as(c_int, 0x00ff)) << @as(c_int, 8))); } pub inline fn __DARWIN_OSSwapConstInt32(x: anytype) __uint32_t { return @import("std").zig.c_translation.cast(__uint32_t, ((((@import("std").zig.c_translation.cast(__uint32_t, x) & @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xff000000, .hexadecimal)) >> @as(c_int, 24)) | ((@import("std").zig.c_translation.cast(__uint32_t, x) & @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x00ff0000, .hexadecimal)) >> @as(c_int, 8))) | ((@import("std").zig.c_translation.cast(__uint32_t, x) & @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0000ff00, .hexadecimal)) << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast(__uint32_t, x) & @as(c_int, 0x000000ff)) << @as(c_int, 24))); } pub inline fn __DARWIN_OSSwapConstInt64(x: anytype) __uint64_t { return @import("std").zig.c_translation.cast(__uint64_t, ((((((((@import("std").zig.c_translation.cast(__uint64_t, x) & @as(c_ulonglong, 0xff00000000000000)) >> @as(c_int, 56)) | ((@import("std").zig.c_translation.cast(__uint64_t, x) & @as(c_ulonglong, 0x00ff000000000000)) >> @as(c_int, 40))) | ((@import("std").zig.c_translation.cast(__uint64_t, x) & @as(c_ulonglong, 0x0000ff0000000000)) >> @as(c_int, 24))) | ((@import("std").zig.c_translation.cast(__uint64_t, x) & @as(c_ulonglong, 0x000000ff00000000)) >> @as(c_int, 8))) | ((@import("std").zig.c_translation.cast(__uint64_t, x) & @as(c_ulonglong, 0x00000000ff000000)) << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast(__uint64_t, x) & @as(c_ulonglong, 0x0000000000ff0000)) << @as(c_int, 24))) | ((@import("std").zig.c_translation.cast(__uint64_t, x) & @as(c_ulonglong, 0x000000000000ff00)) << @as(c_int, 40))) | ((@import("std").zig.c_translation.cast(__uint64_t, x) & @as(c_ulonglong, 0x00000000000000ff)) << @as(c_int, 56))); } pub inline fn ntohs(x: anytype) @TypeOf(__DARWIN_OSSwapInt16(x)) { return __DARWIN_OSSwapInt16(x); } pub inline fn htons(x: anytype) @TypeOf(__DARWIN_OSSwapInt16(x)) { return __DARWIN_OSSwapInt16(x); } pub inline fn ntohl(x: anytype) @TypeOf(__DARWIN_OSSwapInt32(x)) { return __DARWIN_OSSwapInt32(x); } pub inline fn htonl(x: anytype) @TypeOf(__DARWIN_OSSwapInt32(x)) { return __DARWIN_OSSwapInt32(x); } pub inline fn ntohll(x: anytype) @TypeOf(__DARWIN_OSSwapInt64(x)) { return __DARWIN_OSSwapInt64(x); } pub inline fn htonll(x: anytype) @TypeOf(__DARWIN_OSSwapInt64(x)) { return __DARWIN_OSSwapInt64(x); } pub const w_termsig = w_T.w_Termsig; pub const w_coredump = w_T.w_Coredump; pub const w_retcode = w_T.w_Retcode; pub const w_stopval = w_S.w_Stopval; pub const w_stopsig = w_S.w_Stopsig; pub const NULL = __DARWIN_NULL; pub const EXIT_FAILURE = @as(c_int, 1); pub const EXIT_SUCCESS = @as(c_int, 0); pub const RAND_MAX = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x7fffffff, .hexadecimal); pub const MB_CUR_MAX = __mb_cur_max; pub inline fn __swift_unavailable_on(osx_msg: anytype, ios_msg: anytype) @TypeOf(__swift_unavailable(osx_msg)) { _ = ios_msg; return __swift_unavailable(osx_msg); } pub const __sort_noescape = __attribute__(__noescape__); pub const WGPUCOPY_BYTES_PER_ROW_ALIGNMENT = @as(c_int, 256); pub const WGPUDESIRED_NUM_FRAMES = @as(c_int, 3); pub const WGPUMAX_ANISOTROPY = @as(c_int, 16); pub const WGPUMAX_COLOR_TARGETS = @as(c_int, 4); pub const WGPUMAX_MIP_LEVELS = @as(c_int, 16); pub const WGPUMAX_VERTEX_BUFFERS = @as(c_int, 16); pub const WGPUFeatures_MAPPABLE_PRIMARY_BUFFERS = @import("std").zig.c_translation.cast(u64, @import("std").zig.c_translation.promoteIntLiteral(c_int, 65536, .decimal)); pub const WGPUFeatures_SAMPLED_TEXTURE_BINDING_ARRAY = @import("std").zig.c_translation.cast(u64, @import("std").zig.c_translation.promoteIntLiteral(c_int, 131072, .decimal)); pub const WGPUFeatures_SAMPLED_TEXTURE_ARRAY_DYNAMIC_INDEXING = @import("std").zig.c_translation.cast(u64, @import("std").zig.c_translation.promoteIntLiteral(c_int, 262144, .decimal)); pub const WGPUFeatures_SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING = @import("std").zig.c_translation.cast(u64, @import("std").zig.c_translation.promoteIntLiteral(c_int, 524288, .decimal)); pub const WGPUFeatures_UNSIZED_BINDING_ARRAY = @import("std").zig.c_translation.cast(u64, @import("std").zig.c_translation.promoteIntLiteral(c_int, 1048576, .decimal)); pub const WGPUFeatures_MULTI_DRAW_INDIRECT = @import("std").zig.c_translation.cast(u64, @import("std").zig.c_translation.promoteIntLiteral(c_int, 2097152, .decimal)); pub const WGPUFeatures_MULTI_DRAW_INDIRECT_COUNT = @import("std").zig.c_translation.cast(u64, @import("std").zig.c_translation.promoteIntLiteral(c_int, 4194304, .decimal)); pub const WGPUFeatures_ALL_WEBGPU = @import("std").zig.c_translation.cast(u64, @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal)); pub const WGPUFeatures_ALL_UNSAFE = @import("std").zig.c_translation.cast(u64, @as(c_ulonglong, 18446462598732840960)); pub const WGPUFeatures_ALL_NATIVE = @import("std").zig.c_translation.cast(u64, @as(c_ulonglong, 18446744073709486080)); pub const WGPUColor_TRANSPARENT = @import("std").mem.zeroInit(WGPUColor, .{ .r = 0.0, .g = 0.0, .b = 0.0, .a = 0.0, }); pub const WGPUColor_BLACK = @import("std").mem.zeroInit(WGPUColor, .{ .r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0, }); pub const WGPUColor_WHITE = @import("std").mem.zeroInit(WGPUColor, .{ .r = 1.0, .g = 1.0, .b = 1.0, .a = 1.0, }); pub const WGPUColor_RED = @import("std").mem.zeroInit(WGPUColor, .{ .r = 1.0, .g = 0.0, .b = 0.0, .a = 1.0, }); pub const WGPUColor_GREEN = @import("std").mem.zeroInit(WGPUColor, .{ .r = 0.0, .g = 1.0, .b = 0.0, .a = 1.0, }); pub const WGPUColor_BLUE = @import("std").mem.zeroInit(WGPUColor, .{ .r = 0.0, .g = 0.0, .b = 1.0, .a = 1.0, }); pub const WGPUOrigin3d_ZERO = @import("std").mem.zeroInit(WGPUOrigin3d, .{ .x = @as(c_int, 0), .y = @as(c_int, 0), .z = @as(c_int, 0), }); pub const WGPUShaderStage_NONE = @import("std").zig.c_translation.cast(u32, @as(c_int, 0)); pub const WGPUShaderStage_VERTEX = @import("std").zig.c_translation.cast(u32, @as(c_int, 1)); pub const WGPUShaderStage_FRAGMENT = @import("std").zig.c_translation.cast(u32, @as(c_int, 2)); pub const WGPUShaderStage_COMPUTE = @import("std").zig.c_translation.cast(u32, @as(c_int, 4)); pub const WGPUBufferUsage_MAP_READ = @import("std").zig.c_translation.cast(u32, @as(c_int, 1)); pub const WGPUBufferUsage_MAP_WRITE = @import("std").zig.c_translation.cast(u32, @as(c_int, 2)); pub const WGPUBufferUsage_COPY_SRC = @import("std").zig.c_translation.cast(u32, @as(c_int, 4)); pub const WGPUBufferUsage_COPY_DST = @import("std").zig.c_translation.cast(u32, @as(c_int, 8)); pub const WGPUBufferUsage_INDEX = @import("std").zig.c_translation.cast(u32, @as(c_int, 16)); pub const WGPUBufferUsage_VERTEX = @import("std").zig.c_translation.cast(u32, @as(c_int, 32)); pub const WGPUBufferUsage_UNIFORM = @import("std").zig.c_translation.cast(u32, @as(c_int, 64)); pub const WGPUBufferUsage_STORAGE = @import("std").zig.c_translation.cast(u32, @as(c_int, 128)); pub const WGPUBufferUsage_INDIRECT = @import("std").zig.c_translation.cast(u32, @as(c_int, 256)); pub const WGPUColorWrite_RED = @import("std").zig.c_translation.cast(u32, @as(c_int, 1)); pub const WGPUColorWrite_GREEN = @import("std").zig.c_translation.cast(u32, @as(c_int, 2)); pub const WGPUColorWrite_BLUE = @import("std").zig.c_translation.cast(u32, @as(c_int, 4)); pub const WGPUColorWrite_ALPHA = @import("std").zig.c_translation.cast(u32, @as(c_int, 8)); pub const WGPUColorWrite_COLOR = @import("std").zig.c_translation.cast(u32, @as(c_int, 7)); pub const WGPUColorWrite_ALL = @import("std").zig.c_translation.cast(u32, @as(c_int, 15)); pub const WGPUTextureUsage_COPY_SRC = @import("std").zig.c_translation.cast(u32, @as(c_int, 1)); pub const WGPUTextureUsage_COPY_DST = @import("std").zig.c_translation.cast(u32, @as(c_int, 2)); pub const WGPUTextureUsage_SAMPLED = @import("std").zig.c_translation.cast(u32, @as(c_int, 4)); pub const WGPUTextureUsage_STORAGE = @import("std").zig.c_translation.cast(u32, @as(c_int, 8)); pub const WGPUTextureUsage_OUTPUT_ATTACHMENT = @import("std").zig.c_translation.cast(u32, @as(c_int, 16)); pub const __va_list_tag = struct___va_list_tag; pub const __darwin_pthread_handler_rec = struct___darwin_pthread_handler_rec; pub const _opaque_pthread_attr_t = struct__opaque_pthread_attr_t; pub const _opaque_pthread_cond_t = struct__opaque_pthread_cond_t; pub const _opaque_pthread_condattr_t = struct__opaque_pthread_condattr_t; pub const _opaque_pthread_mutex_t = struct__opaque_pthread_mutex_t; pub const _opaque_pthread_mutexattr_t = struct__opaque_pthread_mutexattr_t; pub const _opaque_pthread_once_t = struct__opaque_pthread_once_t; pub const _opaque_pthread_rwlock_t = struct__opaque_pthread_rwlock_t; pub const _opaque_pthread_rwlockattr_t = struct__opaque_pthread_rwlockattr_t; pub const _opaque_pthread_t = struct__opaque_pthread_t; pub const __darwin_i386_thread_state = struct___darwin_i386_thread_state; pub const __darwin_fp_control = struct___darwin_fp_control; pub const __darwin_fp_status = struct___darwin_fp_status; pub const __darwin_mmst_reg = struct___darwin_mmst_reg; pub const __darwin_xmm_reg = struct___darwin_xmm_reg; pub const __darwin_ymm_reg = struct___darwin_ymm_reg; pub const __darwin_zmm_reg = struct___darwin_zmm_reg; pub const __darwin_opmask_reg = struct___darwin_opmask_reg; pub const __darwin_i386_float_state = struct___darwin_i386_float_state; pub const __darwin_i386_avx_state = struct___darwin_i386_avx_state; pub const __darwin_i386_avx512_state = struct___darwin_i386_avx512_state; pub const __darwin_i386_exception_state = struct___darwin_i386_exception_state; pub const __darwin_x86_debug_state32 = struct___darwin_x86_debug_state32; pub const __x86_pagein_state = struct___x86_pagein_state; pub const __darwin_x86_thread_state64 = struct___darwin_x86_thread_state64; pub const __darwin_x86_thread_full_state64 = struct___darwin_x86_thread_full_state64; pub const __darwin_x86_float_state64 = struct___darwin_x86_float_state64; pub const __darwin_x86_avx_state64 = struct___darwin_x86_avx_state64; pub const __darwin_x86_avx512_state64 = struct___darwin_x86_avx512_state64; pub const __darwin_x86_exception_state64 = struct___darwin_x86_exception_state64; pub const __darwin_x86_debug_state64 = struct___darwin_x86_debug_state64; pub const __darwin_x86_cpmu_state64 = struct___darwin_x86_cpmu_state64; pub const __darwin_mcontext32 = struct___darwin_mcontext32; pub const __darwin_mcontext_avx32 = struct___darwin_mcontext_avx32; pub const __darwin_mcontext_avx512_32 = struct___darwin_mcontext_avx512_32; pub const __darwin_mcontext64 = struct___darwin_mcontext64; pub const __darwin_mcontext64_full = struct___darwin_mcontext64_full; pub const __darwin_mcontext_avx64 = struct___darwin_mcontext_avx64; pub const __darwin_mcontext_avx64_full = struct___darwin_mcontext_avx64_full; pub const __darwin_mcontext_avx512_64 = struct___darwin_mcontext_avx512_64; pub const __darwin_mcontext_avx512_64_full = struct___darwin_mcontext_avx512_64_full; pub const __darwin_sigaltstack = struct___darwin_sigaltstack; pub const __darwin_ucontext = struct___darwin_ucontext; pub const sigval = union_sigval; pub const sigevent = struct_sigevent; pub const __siginfo = struct___siginfo; pub const __sigaction_u = union___sigaction_u; pub const __sigaction = struct___sigaction; pub const sigaction = struct_sigaction; pub const sigvec = struct_sigvec; pub const sigstack = struct_sigstack; pub const timeval = struct_timeval; pub const rusage = struct_rusage; pub const rusage_info_v0 = struct_rusage_info_v0; pub const rusage_info_v1 = struct_rusage_info_v1; pub const rusage_info_v2 = struct_rusage_info_v2; pub const rusage_info_v3 = struct_rusage_info_v3; pub const rusage_info_v4 = struct_rusage_info_v4; pub const rlimit = struct_rlimit; pub const proc_rlimit_control_wakeupmon = struct_proc_rlimit_control_wakeupmon;
vendor/wgpu.zig
const std = @import("std"); const assert = std.debug.assert; // I borrowed this name from HLSL fn all(vector: anytype) bool { const type_info = @typeInfo(@TypeOf(vector)); assert(type_info.Vector.child == bool); assert(type_info.Vector.len > 1); return @reduce(.And, vector); } fn any(vector: anytype) bool { const type_info = @typeInfo(@TypeOf(vector)); assert(type_info.Vector.child == bool); assert(type_info.Vector.len > 1); return @reduce(.Or, vector); } pub const @"u32_2" = std.meta.Vector(2, u32); pub const f32_2 = std.meta.Vector(2, f32); pub const f32_3 = std.meta.Vector(3, f32); pub const f32_4 = std.meta.Vector(4, f32); // FIXME Zig doesn't seem to have a suitable matrix construct yet pub const f32_3x3 = [3]f32_3; pub const f32_4x3 = [4]f32_3; pub const f32_4x4 = [4]f32_4; const FrameBufferPixelFormat = f32_4; const FramebufferExtentMin = u32_2{ 16, 16 }; const FramebufferExtentMax = u32_2{ 2048, 2048 }; const RenderTileSize = u32_2{ 16, 16 }; const MaxWorkItemCount: u32 = 2048; const diffuse_sample_count: u32 = 16; const WorkItem = struct { position_start: u32_2, position_end: u32_2, }; const RayQuery = struct { direction_ws: f32_3, accum: FrameBufferPixelFormat = .{}, }; pub const RaytracerState = struct { frame_extent: u32_2, framebuffer: [][]FrameBufferPixelFormat, work_queue: []WorkItem, // Work item should be taken from the end work_queue_size: u32 = 0, ray_queries: []RayQuery, // FIXME Put in worker context ray_query_count: u32 = 0, rng: std.rand.Xoroshiro128, // Hardcode PRNG type for forward compatibility }; pub fn create_raytracer_state(allocator: std.mem.Allocator, extent: u32_2, seed: u64) !RaytracerState { assert(all(extent >= FramebufferExtentMin)); assert(all(extent <= FramebufferExtentMax)); // Allocate framebuffer const framebuffer = try allocator.alloc([]FrameBufferPixelFormat, extent[0]); errdefer allocator.free(framebuffer); for (framebuffer) |*column| { column.* = try allocator.alloc(FrameBufferPixelFormat, extent[1]); errdefer allocator.free(column); for (column.*) |*cell| { cell.* = .{ 0.0, 0.0, 0.0, 0.0 }; } } // Allocate work item queue const work_queue = try allocator.alloc(WorkItem, MaxWorkItemCount); errdefer allocator.free(work_queue); const ray_queries = try allocator.alloc(RayQuery, RenderTileSize[0] * RenderTileSize[1] * 1024); errdefer allocator.free(ray_queries); return RaytracerState{ .frame_extent = extent, .framebuffer = framebuffer, .work_queue = work_queue, .ray_queries = ray_queries, .rng = std.rand.Xoroshiro128.init(seed), }; } pub fn destroy_raytracer_state(allocator: std.mem.Allocator, rt: *RaytracerState) void { allocator.free(rt.ray_queries); allocator.free(rt.work_queue); for (rt.framebuffer) |column| { allocator.free(column); } allocator.free(rt.framebuffer); } // Cut the screen into tiles and create a workload item for each pub fn add_fullscreen_workload(rt: *RaytracerState) void { const tile_count = (rt.frame_extent + RenderTileSize - u32_2{ 1, 1 }) / RenderTileSize; var tile_index: u32_2 = .{ 0, undefined }; while (tile_index[0] < tile_count[0]) : (tile_index[0] += 1) { tile_index[1] = 0; while (tile_index[1] < tile_count[1]) : (tile_index[1] += 1) { const tile_min = tile_index * RenderTileSize; const tile_max = (tile_index + @splat(2, @as(u32, 1))) * RenderTileSize; const tile_max_clamped = u32_2{ std.math.min(tile_max[0], rt.frame_extent[0]), std.math.min(tile_max[1], rt.frame_extent[1]), }; rt.work_queue[rt.work_queue_size] = WorkItem{ .position_start = tile_min, .position_end = tile_max_clamped, }; rt.work_queue_size += 1; } } } // Renders some of the internal workload items and returns if everything is finished pub fn render_workload(rt: *RaytracerState, item_count: u32) bool { const count = std.math.min(item_count, rt.work_queue_size); const end = rt.work_queue_size; const start = end - count; for (rt.work_queue[start..end]) |work_item| { render_work_item(rt, work_item); } rt.work_queue_size = start; return rt.work_queue_size == 0; } const Material = struct { albedo: f32_3, metalness: f32, fake_texture: bool, }; const Pi: f32 = 3.14159265; const DegToRad: f32 = Pi / 180.0; const RayHitThreshold: f32 = 0.001; const Ray = struct { origin: f32_3, direction: f32_3, // Not normalized }; const Sphere = struct { origin: f32_3, radius: f32, material: *const Material, }; const Scene = struct { spheres: [8]*const Sphere, }; // TODO annoying fn u32_2_to_f32_2(v: u32_2) f32_2 { return .{ @intToFloat(f32, v[0]), @intToFloat(f32, v[1]), }; } fn dot(a: f32_3, b: f32_3) f32 { return @reduce(.Add, a * b); } fn cross(v1: f32_3, v2: f32_3) f32_3 { return .{ v1[1] * v2[2] - v1[2] * v2[1], v1[2] * v2[0] - v1[0] * v2[2], v1[0] * v2[1] - v1[1] * v2[0], }; } // normal should be normalized fn reflect(v: f32_3, normal: f32_3) f32_3 { return v - normal * @splat(3, 2.0 * dot(v, normal)); } fn mul(m: f32_3x3, v: f32_3) f32_3 { return f32_3{ dot(.{ m[0][0], m[1][0], m[2][0] }, v), dot(.{ m[0][1], m[1][1], m[2][1] }, v), dot(.{ m[0][2], m[1][2], m[2][2] }, v), }; } fn normalize(v: f32_3) f32_3 { const length = std.math.sqrt(dot(v, v)); const lengthInv = 1.0 / length; return v * @splat(3, lengthInv); } fn sign(value: f32) f32 { return if (value >= 0.0) 1.0 else -1.0; } fn lookAt(viewPosition: f32_3, targetPosition: f32_3, upDirection: f32_3) f32_3x3 { const viewForward = -normalize(targetPosition - viewPosition); const viewRight = normalize(cross(upDirection, viewForward)); const viewUp = cross(viewForward, viewRight); return .{ viewRight, viewUp, viewForward, }; } fn sampleDistribution(normal: f32_3, sample: f32_3) f32_3 { const sampleOriented = sample * @splat(3, sign(dot(normal, sample))); return sampleOriented; } fn render_work_item(rt: *RaytracerState, work_item: WorkItem) void { const fovDegrees: f32 = 100.0; const maxSteps: u32 = 2; const mat1Mirror = Material{ .albedo = .{ 0.2, 0.2, 0.2 }, .metalness = 1.0, .fake_texture = false }; const mat2 = Material{ .albedo = .{ 0.2, 0.2, 0.2 }, .metalness = 0.2, .fake_texture = true }; const mat3Diffuse = Material{ .albedo = .{ 0.2, 0.2, 0.2 }, .metalness = 0.4, .fake_texture = false }; const mat4 = Material{ .albedo = .{ 10.0, 10.0, 4.0 }, .metalness = 0.0, .fake_texture = false }; const mat5 = Material{ .albedo = .{ 10.0, 1.0, 1.0 }, .metalness = 0.0, .fake_texture = false }; const mat6EmissiveGreen = Material{ .albedo = .{ 1.0, 14.0, 1.0 }, .metalness = 0.0, .fake_texture = false }; const s1 = Sphere{ .origin = .{ 0.0, 0.0, 0.0 }, .radius = 1.0, .material = &mat1Mirror }; const s2 = Sphere{ .origin = .{ 0.0, -301.0, 0.0 }, .radius = 300.0, .material = &mat2 }; const s3 = Sphere{ .origin = .{ -2.0, 0.5, -2.0 }, .radius = 1.5, .material = &mat3Diffuse }; const s4 = Sphere{ .origin = .{ 2.0, -0.1, 1.0 }, .radius = 0.9, .material = &mat3Diffuse }; const s5 = Sphere{ .origin = .{ -4.0, 0.0, 0.0 }, .radius = 1.0, .material = &mat4 }; const sphereEmissiveRed = Sphere{ .origin = .{ 4.0, -0.2, 1.0 }, .radius = 0.8, .material = &mat5 }; const sphereEmissiveGreen = Sphere{ .origin = .{ -1.3, -0.5, 1.5 }, .radius = 0.5, .material = &mat6EmissiveGreen }; const sphereMirror2 = Sphere{ .origin = .{ -3.0, 1.0, 4.0 }, .radius = 2.0, .material = &mat1Mirror }; const spheres = [_]*const Sphere{ &s1, &s2, &s3, &s4, &s5, &sphereEmissiveRed, &sphereEmissiveGreen, &sphereMirror2 }; const scene = Scene{ .spheres = spheres }; const cameraPositionWS = f32_3{ 3.0, 3.0, 6.0 }; const cameraTargetWS = f32_3{ 0.0, -1.0, 0.0 }; const cameraUpVector = f32_3{ 0.0, 1.0, 0.0 }; const camera_orientation_ws = lookAt(cameraPositionWS, cameraTargetWS, cameraUpVector); const aspectRatioInv = @intToFloat(f32, rt.frame_extent[1]) / @intToFloat(f32, rt.frame_extent[0]); const tanHFov: f32 = std.math.tan((fovDegrees * 0.5) * DegToRad); const viewportTransform = f32_2{ tanHFov, -tanHFov * aspectRatioInv }; const imageSizeFloat = u32_2_to_f32_2(rt.frame_extent); // FOR TODO var pos_ts: u32_2 = .{ work_item.position_start[0], undefined }; while (pos_ts[0] < work_item.position_end[0]) : (pos_ts[0] += 1) { pos_ts[1] = work_item.position_start[1]; while (pos_ts[1] < work_item.position_end[1]) : (pos_ts[1] += 1) { const rayIndex = u32_2_to_f32_2(pos_ts) + @splat(2, @as(f32, 0.5)); const ray_dir_vs = ((rayIndex - imageSizeFloat * @splat(2, @as(f32, 0.5))) / imageSizeFloat) * viewportTransform; const ray_origin_vs: f32_3 = @splat(3, @as(f32, 0.0)); const ray_vs = Ray{ .origin = ray_origin_vs, .direction = .{ ray_dir_vs[0], ray_dir_vs[1], -1.0 }, }; const ray_ws = Ray{ .origin = ray_vs.origin + cameraPositionWS, .direction = mul(camera_orientation_ws, ray_vs.direction), }; const color = shade(scene, &rt.rng, ray_ws, maxSteps); rt.framebuffer[pos_ts[0]][pos_ts[1]] += f32_4{ color[0], color[1], color[2], 1 }; } } } const RayHit = struct { t: f32, mat: *const Material, position_ws: f32_3, normal_ws: f32_3, }; fn shade(scene: Scene, rng: *std.rand.Xoroshiro128, ray: Ray, steps: u32) f32_3 { var hitResult: RayHit = undefined; if (traverse_scene(scene, ray, &hitResult)) { const mat = hitResult.mat; if (steps > 0) { if (mat.metalness == 1.0) { const reflectedRay = Ray{ .origin = hitResult.position_ws, .direction = reflect(ray.direction, hitResult.normal_ws) }; return shade(scene, rng, reflectedRay, steps - 1); } else { var albedo = mat.albedo; if (mat.fake_texture) { // Checkerboard formula const size: f32 = 1.0; const modx1: f32 = (std.math.mod(f32, std.math.absFloat(hitResult.position_ws[0]) + size * 0.5, size * 2.0) catch 0.0) - size; const mody1: f32 = (std.math.mod(f32, std.math.absFloat(hitResult.position_ws[2]) + size * 0.5, size * 2.0) catch 0.0) - size; if (modx1 * mody1 > 0.0) albedo = f32_3{ 0.1, 0.1, 0.15 }; } var i: u32 = 0; var accum: f32_3 = .{}; while (i < diffuse_sample_count) : (i += 1) { const random_f32_3 = f32_3{ rng.random().float(f32) * 2.0 - 1.0, rng.random().float(f32) * 2.0 - 1.0, rng.random().float(f32) * 2.0 - 1.0, }; var randomSample = normalize(random_f32_3); randomSample = sampleDistribution(hitResult.normal_ws, randomSample); const reflectedRay = Ray{ .origin = hitResult.position_ws, .direction = randomSample }; accum += shade(scene, rng, reflectedRay, steps - 1); } // Shade result return albedo * accum / @splat(3, @intToFloat(f32, diffuse_sample_count)); } } else return mat.albedo; } // No hit -> fake skybox const normalizedDirection = normalize(ray.direction); const t: f32 = 0.5 * (normalizedDirection[1] + 1.0); return f32_3{ 1.0, 1.0, 1.0 } * @splat(3, 1.0 - t) + f32_3{ 0.5, 0.7, 1.0 } * @splat(3, t); } fn traverse_scene(s: Scene, ray: Ray, hit: *RayHit) bool { var bestHit: f32 = 0.0; for (s.spheres) |sphere_ws| { const t = hit_sphere(sphere_ws.*, ray); if (isBetterHit(t, bestHit)) { bestHit = t; const ray_hit_ws = ray.origin + ray.direction * @splat(3, t); hit.normal_ws = (ray_hit_ws - sphere_ws.origin) / @splat(3, sphere_ws.radius); hit.position_ws = ray_hit_ws; hit.mat = sphere_ws.material; } } hit.t = bestHit; return bestHit > RayHitThreshold; } fn hit_sphere(sphere: Sphere, ray: Ray) f32 { const originToCenter = ray.origin - sphere.origin; const a = dot(ray.direction, ray.direction); const b = 2.0 * dot(originToCenter, ray.direction); const c = dot(originToCenter, originToCenter) - sphere.radius * sphere.radius; const discriminant = b * b - 4.0 * a * c; if (discriminant < 0.0) { return -1.0; } else { return ((-b - std.math.sqrt(discriminant)) * 0.5) / a; } } fn isBetterHit(value: f32, base: f32) bool { return value > RayHitThreshold and (!(base > RayHitThreshold) or value < base); }
src/raytracer.zig
const Self = @This(); const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const wlr = @import("wlroots"); const wayland = @import("wayland"); const wl = wayland.server.wl; const server = &@import("main.zig").server; const util = @import("util.zig"); const Layout = @import("Layout.zig"); const Box = @import("Box.zig"); const Server = @import("Server.zig"); const Output = @import("Output.zig"); const View = @import("View.zig"); const ViewStack = @import("view_stack.zig").ViewStack; const log = std.log.scoped(.layout); const Error = error{ViewDimensionMismatch}; const timeout_ms = 100; serial: u32, /// Number of views for which dimensions have not been pushed. /// This will go negative if the client pushes too many dimensions. views: i32, /// Proposed view dimensions view_boxen: []Box, timeout_timer: *wl.EventSource, pub fn init(layout: *Layout, views: u32) !Self { const event_loop = server.wl_server.getEventLoop(); const timeout_timer = try event_loop.addTimer(*Layout, handleTimeout, layout); errdefer timeout_timer.remove(); try timeout_timer.timerUpdate(timeout_ms); return Self{ .serial = server.wl_server.nextSerial(), .views = @intCast(i32, views), .view_boxen = try util.gpa.alloc(Box, views), .timeout_timer = timeout_timer, }; } pub fn deinit(self: *const Self) void { self.timeout_timer.remove(); util.gpa.free(self.view_boxen); } /// Destroy the LayoutDemand on timeout. /// All further responses to the event will simply be ignored. fn handleTimeout(layout: *Layout) callconv(.C) c_int { log.notice( "layout demand for layout '{s}' on output '{s}' timed out", .{ layout.namespace, mem.sliceTo(&layout.output.wlr_output.name, 0) }, ); layout.output.layout_demand.?.deinit(); layout.output.layout_demand = null; server.root.notifyLayoutDemandDone(); return 0; } /// Push a set of proposed view dimensions and position to the list pub fn pushViewDimensions(self: *Self, output: *Output, x: i32, y: i32, width: u32, height: u32) void { // The client pushed too many dimensions if (self.views < 0) return; // Here we apply the offset to align the coords with the origin of the // usable area and shrink the dimensions to accomodate the border size. const border_width = server.config.border_width; self.view_boxen[self.view_boxen.len - @intCast(usize, self.views)] = .{ .x = x + output.usable_box.x + @intCast(i32, border_width), .y = y + output.usable_box.y + @intCast(i32, border_width), .width = if (width > 2 * border_width) width - 2 * border_width else width, .height = if (height > 2 * border_width) height - 2 * border_width else height, }; self.views -= 1; } /// Apply the proposed layout to the output pub fn apply(self: *Self, layout: *Layout) void { const output = layout.output; // Whether the layout demand succeeds or fails, we are done with it and // need to clean up defer { output.layout_demand.?.deinit(); output.layout_demand = null; server.root.notifyLayoutDemandDone(); } // Check that the number of proposed dimensions is correct. if (self.views != 0) { log.err( "proposed dimension count ({}) does not match view count ({}), aborting layout demand", .{ -self.views + @intCast(i32, self.view_boxen.len), self.view_boxen.len }, ); layout.layout.postError( .count_mismatch, "number of proposed view dimensions must match number of views", ); return; } // Apply proposed layout to views var it = ViewStack(View).iter(output.views.first, .forward, output.pending.tags, Output.arrangeFilter); var i: u32 = 0; while (it.next()) |view| : (i += 1) { view.pending.box = self.view_boxen[i]; view.applyConstraints(); } assert(i == self.view_boxen.len); assert(output.pending.layout == layout); }
source/river-0.1.0/river/LayoutDemand.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const expect = std.testing.expect; const Obj = @import("./object.zig").Obj; pub const Value = union(enum) { const Self = @This(); nil, boolean: bool, number: f64, obj: *Obj, pub fn isNil(self: Self) bool { return self == .nil; } pub fn isBool(self: Self) bool { return self == .boolean; } pub fn isNumber(self: Self) bool { return self == .number; } pub fn isObj(self: Self) bool { return self == .obj; } pub fn isString(self: Self) bool { return self.isObj() and self.asObj().is(.string); } pub fn asBool(self: Self) bool { std.debug.assert(self.isBool()); return self.boolean; } pub fn asNumber(self: Self) f64 { std.debug.assert(self.isNumber()); return self.number; } pub fn asObj(self: Self) *Obj { std.debug.assert(self.isObj()); return self.obj; } pub fn fromBool(val: bool) Self { return Value{ .boolean = val }; } pub fn fromNumber(val: f64) Self { return Value{ .number = val }; } pub fn fromObj(val: *Obj) Self { return Value{ .obj = val }; } pub fn equals(valA: Self, valB: Self) bool { return switch (valA) { .nil => switch (valB) { .nil => true, else => false, }, .boolean => |a| switch (valB) { .boolean => |b| a == b, else => false, }, .number => |a| switch (valB) { .number => |b| a == b, else => false, }, .obj => |a| switch (valB) { .obj => |b| { return a == b; }, else => false, }, }; } pub fn isFalsey(self: Self) bool { return switch (self) { .nil => true, .boolean => |b| !b, .number => false, .obj => false, }; } pub fn format(self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = options; _ = fmt; switch (self) { .number => |value| try writer.print("{d}", .{value}), .boolean => |value| try writer.print("{}", .{value}), .nil => try writer.print("nil", .{}), .obj => |obj| try printObj(obj, writer), } } }; fn printObj(obj: *Obj, writer: anytype) !void { switch (obj.obj_type) { .string => try writer.print("{s}", .{obj.asString().bytes}), } } test "size of a Value" { try expect(@sizeOf(Value) == 16); }
src/value.zig
const std = @import("std"); const mem = std.mem; pub const output_len_unknown = 0; pub const Blake2Xb = struct { const Self = @This(); const Blake2 = std.crypto.hash.blake2.Blake2b512; const magic_unknown_output_len = (1 << 32) - 1; const max_output_len = (1 << 32) * 64; const iv = [8]u64{ 0x6a09e667f3bcc908, 0xbb67ae8584caa73b, 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1, 0x510e527fade682d1, 0x9b05688c2b3e6c1f, 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179, }; pub const Options = Blake2.Options; b2: Blake2, len: usize, rem: usize, cfg: [Blake2.digest_length]u8, h0: [Blake2.digest_length]u8, buffer: [Blake2.digest_length]u8, offset: usize, node_offset: u32, read_mode: bool, pub fn init(size: usize, options: Options) Self { std.debug.assert(size != magic_unknown_output_len); std.debug.assert(size < 0xffff_ffff); if (options.key) |v| { std.debug.assert(v.len <= Blake2.key_length_max); } var len = size; if (len == output_len_unknown) { len = magic_unknown_output_len; } var self: Self = undefined; self.b2 = Blake2.init(options); self.b2.h[1] ^= @as(u64, len) << 32; self.len = len; self.rem = len; if (self.rem == magic_unknown_output_len) { self.rem = max_output_len; } mem.set(u8, &self.cfg, 0); self.cfg[0] = Blake2.digest_length; mem.writeIntLittle(u32, self.cfg[4..8], Blake2.digest_length); mem.writeIntLittle(u32, self.cfg[12..16], @intCast(u32, self.len)); self.cfg[17] = Blake2.digest_length; if (options.salt) |v| { mem.copy(u8, self.cfg[32..], &v); } if (options.context) |v| { mem.copy(u8, self.cfg[48..], &v); } self.offset = 0; self.node_offset = 0; self.read_mode = false; return self; } pub fn update(self: *Self, data: []const u8) void { if (self.read_mode) { std.debug.panic("blake2xb: write after read", .{}); } self.b2.update(data); } pub fn read(self: *Self, out: []u8) usize { if (!self.read_mode) { self.b2.final(&self.h0); self.read_mode = true; } if (self.rem == 0) { return 0; } var out_slice = out; var n = out_slice.len; if (n > self.rem) { n = self.rem; out_slice = out_slice[0..n]; } if (self.offset > 0) { const buf_rem = Blake2.digest_length - self.offset; if (n < buf_rem) { mem.copy(u8, out_slice, self.buffer[self.offset..][0..out_slice.len]); self.offset += out_slice.len; self.rem -= n; return n; } mem.copy(u8, out_slice, self.buffer[self.offset..]); out_slice = out_slice[buf_rem..]; self.offset = 0; self.rem -= buf_rem; } while (out_slice.len >= Blake2.digest_length) { mem.writeIntLittle(u32, self.cfg[8..12], self.node_offset); self.node_offset += 1; self.initConfig(); self.b2.update(&self.h0); self.b2.final(&self.buffer); mem.copy(u8, out_slice, &self.buffer); out_slice = out_slice[Blake2.digest_length..]; self.rem -= Blake2.digest_length; } if (out_slice.len > 0) { if (self.rem < Blake2.digest_length) { self.cfg[0] = @intCast(u8, self.rem); } mem.writeIntLittle(u32, self.cfg[8..12], self.node_offset); self.node_offset += 1; self.initConfig(); self.b2.update(&self.h0); self.b2.final(&self.buffer); mem.copy(u8, out_slice, self.buffer[0..out_slice.len]); self.offset = out_slice.len; self.rem -= out_slice.len; } return n; } fn initConfig(self: *Self) void { self.b2.t = 0; self.b2.buf_len = 0; for (self.b2.h) |_, i| { self.b2.h[i] = iv[i] ^ mem.readIntSliceLittle(u64, self.cfg[i * 8 ..]); } } }; pub const Blake2Xs = struct { const Self = @This(); const Blake2 = std.crypto.hash.blake2.Blake2s256; const magic_unknown_output_len = 65535; const max_output_len = (1 << 32) * 32; const iv = [8]u32{ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19, }; pub const Options = Blake2.Options; b2: Blake2, len: usize, rem: usize, cfg: [Blake2.digest_length]u8, h0: [Blake2.digest_length]u8, buffer: [Blake2.digest_length]u8, offset: usize, node_offset: u32, read_mode: bool, pub fn init(size: usize, options: Options) Self { std.debug.assert(size != magic_unknown_output_len); std.debug.assert(size < 0xffff); if (options.key) |v| { std.debug.assert(v.len <= Blake2.key_length_max); } var len = size; if (len == output_len_unknown) { len = magic_unknown_output_len; } var self: Self = undefined; self.b2 = Blake2.init(options); self.b2.h[3] ^= @intCast(u32, len); self.len = len; self.rem = len; if (self.rem == magic_unknown_output_len) { self.rem = max_output_len; } mem.set(u8, &self.cfg, 0); self.cfg[0] = Blake2.digest_length; mem.writeIntLittle(u32, self.cfg[4..8], Blake2.digest_length); mem.writeIntLittle(u16, self.cfg[12..14], @intCast(u16, self.len)); self.cfg[15] = Blake2.digest_length; if (options.salt) |v| { mem.copy(u8, self.cfg[16..], &v); } if (options.context) |v| { mem.copy(u8, self.cfg[24..], &v); } self.offset = 0; self.node_offset = 0; self.read_mode = false; return self; } pub fn update(self: *Self, data: []const u8) void { if (self.read_mode) { std.debug.panic("blake2xs: write after read", .{}); } self.b2.update(data); } pub fn read(self: *Self, out: []u8) usize { if (!self.read_mode) { self.b2.final(&self.h0); self.read_mode = true; } if (self.rem == 0) { return 0; } var out_slice = out; var n = out_slice.len; if (n > self.rem) { n = self.rem; out_slice = out_slice[0..n]; } if (self.offset > 0) { const buf_rem = Blake2.digest_length - self.offset; if (n < buf_rem) { mem.copy(u8, out_slice, self.buffer[self.offset..][0..out_slice.len]); self.offset += out_slice.len; self.rem -= n; return n; } mem.copy(u8, out_slice, self.buffer[self.offset..]); out_slice = out_slice[buf_rem..]; self.offset = 0; self.rem -= buf_rem; } while (out_slice.len >= Blake2.digest_length) { mem.writeIntLittle(u32, self.cfg[8..12], self.node_offset); self.node_offset += 1; self.initConfig(); self.b2.update(&self.h0); self.b2.final(&self.buffer); mem.copy(u8, out_slice, &self.buffer); out_slice = out_slice[Blake2.digest_length..]; self.rem -= Blake2.digest_length; } if (out_slice.len > 0) { if (self.rem < Blake2.digest_length) { self.cfg[0] = @intCast(u8, self.rem); } mem.writeIntLittle(u32, self.cfg[8..12], self.node_offset); self.node_offset += 1; self.initConfig(); self.b2.update(&self.h0); self.b2.final(&self.buffer); mem.copy(u8, out_slice, self.buffer[0..out_slice.len]); self.offset = out_slice.len; self.rem -= out_slice.len; } return n; } fn initConfig(self: *Self) void { self.b2.t = 0; self.b2.buf_len = 0; for (self.b2.h) |_, i| { self.b2.h[i] = iv[i] ^ mem.readIntSliceLittle(u32, self.cfg[i * 4 ..]); } } }; test "blake2xb" { const hashes = @import("test_data.zig").xb; const key_hex = "<KEY>"; var key: [key_hex.len / 2]u8 = undefined; _ = try std.fmt.hexToBytes(&key, key_hex); var input: [256]u8 = undefined; for (input) |_, i| { input[i] = @intCast(u8, i); } inline for (hashes) |hash_hex| { const len = hash_hex.len / 2; var hash: [len]u8 = undefined; var sum: [len]u8 = undefined; _ = try std.fmt.hexToBytes(&hash, hash_hex); var xof = Blake2Xb.init(len, .{ .key = &key }); xof.update(&input); try std.testing.expect(xof.read(&sum) == len); try std.testing.expect(xof.read(&sum) == 0); try std.testing.expectEqualSlices(u8, &hash, &sum); xof = Blake2Xb.init(len, .{ .key = &key }); for (input) |_, j| { xof.update(input[j .. j + 1]); } for (sum) |_, j| { _ = try std.testing.expect(xof.read(sum[j .. j + 1]) == 1); } try std.testing.expectEqualSlices(u8, &hash, &sum); } var xof = Blake2Xb.init(output_len_unknown, .{ .key = &key }); xof.update(&input); var sum: [64]u8 = undefined; try std.testing.expect(xof.read(&sum) == sum.len); const hash_hex = "3dbba8516da76bf7330055c66ea36cf1005e92714262b24d9710f51d9e126406e1bcd6497059f9331f1091c3634b695428d475ed432f987040575520a1c29f5e"; var hash: [hash_hex.len / 2]u8 = undefined; _ = try std.fmt.hexToBytes(&hash, hash_hex); try std.testing.expectEqualSlices(u8, &hash, &sum); } test "blake2xs" { const hashes = @import("test_data.zig").xs; const key_hex = "<KEY>"; var key: [key_hex.len / 2]u8 = undefined; _ = try std.fmt.hexToBytes(&key, key_hex); var input: [256]u8 = undefined; for (input) |_, i| { input[i] = @intCast(u8, i); } inline for (hashes) |hash_hex| { const len = hash_hex.len / 2; var hash: [len]u8 = undefined; var sum: [len]u8 = undefined; _ = try std.fmt.hexToBytes(&hash, hash_hex); var xof = Blake2Xs.init(len, .{ .key = &key }); xof.update(&input); try std.testing.expect(xof.read(&sum) == len); try std.testing.expect(xof.read(&sum) == 0); try std.testing.expectEqualSlices(u8, &hash, &sum); xof = Blake2Xs.init(len, .{ .key = &key }); for (input) |_, j| { xof.update(input[j .. j + 1]); } for (sum) |_, j| { _ = try std.testing.expect(xof.read(sum[j .. j + 1]) == 1); } try std.testing.expectEqualSlices(u8, &hash, &sum); } var xof = Blake2Xs.init(output_len_unknown, .{ .key = &key }); xof.update(&input); var sum: [64]u8 = undefined; try std.testing.expect(xof.read(&sum) == sum.len); const hash_hex = "2a9a6977d915a2c4dd07dbcafe1918bf1682e56d9c8e567ecd19bfd7cd93528833c764d12b34a5e2a219c9fd463dab45e972c5574d73f45de5b2e23af72530d8"; var hash: [hash_hex.len / 2]u8 = undefined; _ = try std.fmt.hexToBytes(&hash, hash_hex); try std.testing.expectEqualSlices(u8, &hash, &sum); }
src/blake2x.zig
const std = @import("std"); const Self = @This(); step: std.build.Step, builder: *std.build.Builder, source: std.build.FileSource, output_file: std.build.GeneratedFile, pub fn create(builder: *std.build.Builder, file: []const u8) *Self { return createSource(builder, .{ .path = file }); } pub fn createSource(builder: *std.build.Builder, source: std.build.FileSource) *Self { const self = builder.allocator.create(Self) catch unreachable; self.* = Self{ .step = std.build.Step.init(.custom, "build-template", builder.allocator, make), .builder = builder, .source = source, .output_file = std.build.GeneratedFile{ .step = &self.step }, }; source.addStepDependencies(&self.step); return self; } pub fn transform(builder: *std.build.Builder, file: []const u8) std.build.FileSource { const step = create(builder, file); return step.getFileSource(); } pub fn transformSource(builder: *std.build.Builder, source: std.build.FileSource) std.build.FileSource { const step = createSource(builder, source); return step.getFileSource(); } /// Returns the file source pub fn getFileSource(self: *const Self) std.build.FileSource { return std.build.FileSource{ .generated = &self.output_file }; } fn make(step: *std.build.Step) !void { const self = @fieldParentPtr(Self, "step", step); const source_file_name = self.source.getPath(self.builder); // std.debug.print("source = '{s}'\n", .{source_file_name}); const basename = std.fs.path.basename(source_file_name); const output_name = blk: { if (std.mem.indexOf(u8, basename, ".")) |index| { break :blk try std.mem.join(self.builder.allocator, ".", &[_][]const u8{ basename[0..index], "zig", }); } else { break :blk try std.mem.join(self.builder.allocator, ".", &[_][]const u8{ basename, "zig", }); } }; // std.debug.print("basename = '{s}'\n", .{basename}); // std.debug.print("output name = '{s}'\n", .{output_name}); var output_buffer = std.ArrayList(u8).init(self.builder.allocator); defer output_buffer.deinit(); { var file = try std.fs.cwd().openFile(source_file_name, .{}); defer file.close(); var buffered_reader = std.io.bufferedReader(file.reader()); var reader = buffered_reader.reader(); var writer = output_buffer.writer(); const UnderlyingWriter = @TypeOf(writer); const Writer = struct { const W = @This(); const State = enum { init, text, code, done }; writer: UnderlyingWriter, state: State = .init, fn start(wr: *W) !void { std.debug.assert(wr.state == .init); try wr.writer.writeAll( \\const std = @import("std"); \\ \\pub fn render(output: anytype, context: anytype) !void { \\ ); wr.state = .code; } fn writeText(wr: *W, slice: []const u8) !void { switch (wr.state) { .text => {}, .code => { try wr.endCode(); try wr.beginText(); }, else => unreachable, } wr.state = .text; for (slice) |c| { switch (c) { 0...31 => try wr.writer.print("\\x{X:0>2}", .{c}), '\\', '\"', '\'' => { try wr.writer.writeByte('\\'); try wr.writer.writeByte(c); }, else => try wr.writer.writeByte(c), } } // try wr.writer.writeAll(slice); } fn writeCode(wr: *W, slice: []const u8) !void { switch (wr.state) { .code => {}, .text => { try wr.endText(); try wr.beginCode(); }, else => unreachable, } wr.state = .code; var iterator = slice; while (iterator.len > 0) { if (std.mem.indexOf(u8, iterator, "\n")) |index| { if (index > 0) { try wr.writer.writeAll(iterator[0 .. index - 1]); } try wr.writer.writeAll("\n "); iterator = iterator[index + 1 ..]; } else { try wr.writer.writeAll(iterator); break; } } } fn finalize(wr: *W) !void { switch (wr.state) { .text => try wr.endText(), .code => try wr.endCode(), else => unreachable, } try wr.writer.writeAll( \\} \\ ); wr.state = .done; } fn beginText(wr: *W) !void { try wr.writer.writeAll(" try output.writeAll(\""); } fn endText(wr: *W) !void { try wr.writer.writeAll("\");\n"); } fn beginCode(wr: *W) !void { try wr.writer.writeAll(" "); } fn endCode(wr: *W) !void { try wr.writer.writeAll("\n"); } }; var generator = Writer{ .writer = writer }; try generator.start(); var previous_char: u8 = 0; var in_code_segment = false; while (true) { const byte = reader.readByte() catch |err| switch (err) { error.EndOfStream => break, else => |e| return e, }; if (in_code_segment) { if ((previous_char == '?') and (byte == '>')) { in_code_segment = false; } else if (byte == '?') { // skip the ? for now } else { if (byte == '?') try generator.writeCode("?"); try generator.writeCode(&[_]u8{byte}); } } else { if ((previous_char == '<') and (byte == '?')) { in_code_segment = true; } else if (byte == '<') { // skip the < for now } else { if (previous_char == '<') try generator.writeText("<"); try generator.writeText(&[_]u8{byte}); } } previous_char = byte; } try generator.finalize(); } // std.debug.print("data = '{s}'\n", .{output_buffer.items}); // The cache is used here not really as a way to speed things up - because writing // the data to a file would probably be very fast - but as a way to find a canonical // location to put build artifacts. // If, for example, a hard-coded path was used as the location to put WriteFileStep // files, then two WriteFileSteps executing in parallel might clobber each other. // TODO port the cache system from stage1 to zig std lib. Until then we use blake2b // directly and construct the path, and no "cache hit" detection happens; the files // are always written. var hash = std.crypto.hash.blake2.Blake2b384.init(.{}); // Random bytes to make TemplateStep unique. Refresh this with // new random bytes when TemplateStep implementation is modified // in a non-backwards-compatible way. hash.update("C9XVU4MxSDFZz2to"); hash.update(basename); hash.update(output_buffer.items); var digest: [48]u8 = undefined; hash.final(&digest); var hash_basename: [64]u8 = undefined; _ = std.fs.base64_encoder.encode(&hash_basename, &digest); const output_dir = try std.fs.path.join(self.builder.allocator, &[_][]const u8{ self.builder.cache_root, "o", &hash_basename, }); // std.debug.print("out dir = {s}\n", .{self.output_dir}); var dir = std.fs.cwd().makeOpenPath(output_dir, .{}) catch |err| { std.debug.print("unable to make path {s}: {s}\n", .{ output_dir, @errorName(err) }); return err; }; self.output_file.path = try std.fs.path.join(self.builder.allocator, &[_][]const u8{ output_dir, output_name, }); // std.debug.print("out file = {s}\n", .{self.file_name}); dir.writeFile(output_name, output_buffer.items) catch |err| { std.debug.print("unable to write {s} into {s}: {s}\n", .{ output_name, output_dir, @errorName(err), }); return err; }; //std.debug.print("----------------------------------\n{s}\n----------------------------------\n", .{output_buffer.items}); }
src/TemplateStep.zig
pub const GUID_DEVINTERFACE_DISPLAY_ADAPTER = Guid.initString("5b45201d-f2f2-4f3b-85bb-30ff1f953599"); pub const GUID_DEVINTERFACE_MONITOR = Guid.initString("e6f07b5f-ee97-4a90-b076-33f57bf4eaa7"); pub const GUID_DISPLAY_DEVICE_ARRIVAL = Guid.initString("1ca05180-a699-450a-9a0c-de4fbe3ddd89"); pub const GUID_DEVINTERFACE_VIDEO_OUTPUT_ARRIVAL = Guid.initString("1ad9e4f0-f88d-4360-bab9-4c2d55e564cd"); pub const DEVPKEY_IndirectDisplay = PROPERTYKEY { .fmtid = @import("../zig.zig").Guid.initString("c50a3f10-aa5c-4247-b830-d6a6f8eaa310"), .pid = 1 }; pub const DEVPKEY_Device_TerminalLuid = PROPERTYKEY { .fmtid = @import("../zig.zig").Guid.initString("c50a3f10-aa5c-4247-b830-d6a6f8eaa310"), .pid = 2 }; pub const DEVPKEY_Device_AdapterLuid = PROPERTYKEY { .fmtid = @import("../zig.zig").Guid.initString("c50a3f10-aa5c-4247-b830-d6a6f8eaa310"), .pid = 3 }; pub const DEVPKEY_Device_ActivityId = PROPERTYKEY { .fmtid = @import("../zig.zig").Guid.initString("c50a3f10-aa5c-4247-b830-d6a6f8eaa310"), .pid = 4 }; pub const INDIRECT_DISPLAY_INFO_FLAGS_CREATED_IDDCX_ADAPTER = @as(u32, 1); pub const IOCTL_VIDEO_DISABLE_VDM = @as(u32, 2293764); pub const IOCTL_VIDEO_REGISTER_VDM = @as(u32, 2293768); pub const IOCTL_VIDEO_SET_OUTPUT_DEVICE_POWER_STATE = @as(u32, 2293772); pub const IOCTL_VIDEO_GET_OUTPUT_DEVICE_POWER_STATE = @as(u32, 2293776); pub const IOCTL_VIDEO_MONITOR_DEVICE = @as(u32, 2293780); pub const IOCTL_VIDEO_ENUM_MONITOR_PDO = @as(u32, 2293784); pub const IOCTL_VIDEO_INIT_WIN32K_CALLBACKS = @as(u32, 2293788); pub const IOCTL_VIDEO_IS_VGA_DEVICE = @as(u32, 2293796); pub const IOCTL_VIDEO_USE_DEVICE_IN_SESSION = @as(u32, 2293800); pub const IOCTL_VIDEO_PREPARE_FOR_EARECOVERY = @as(u32, 2293804); pub const IOCTL_VIDEO_ENABLE_VDM = @as(u32, 2293760); pub const IOCTL_VIDEO_SAVE_HARDWARE_STATE = @as(u32, 2294272); pub const IOCTL_VIDEO_RESTORE_HARDWARE_STATE = @as(u32, 2294276); pub const IOCTL_VIDEO_HANDLE_VIDEOPARAMETERS = @as(u32, 2293792); pub const IOCTL_VIDEO_QUERY_AVAIL_MODES = @as(u32, 2294784); pub const IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES = @as(u32, 2294788); pub const IOCTL_VIDEO_QUERY_CURRENT_MODE = @as(u32, 2294792); pub const IOCTL_VIDEO_SET_CURRENT_MODE = @as(u32, 2294796); pub const IOCTL_VIDEO_RESET_DEVICE = @as(u32, 2294800); pub const IOCTL_VIDEO_LOAD_AND_SET_FONT = @as(u32, 2294804); pub const IOCTL_VIDEO_SET_PALETTE_REGISTERS = @as(u32, 2294808); pub const IOCTL_VIDEO_SET_COLOR_REGISTERS = @as(u32, 2294812); pub const IOCTL_VIDEO_ENABLE_CURSOR = @as(u32, 2294816); pub const IOCTL_VIDEO_DISABLE_CURSOR = @as(u32, 2294820); pub const IOCTL_VIDEO_SET_CURSOR_ATTR = @as(u32, 2294824); pub const IOCTL_VIDEO_QUERY_CURSOR_ATTR = @as(u32, 2294828); pub const IOCTL_VIDEO_SET_CURSOR_POSITION = @as(u32, 2294832); pub const IOCTL_VIDEO_QUERY_CURSOR_POSITION = @as(u32, 2294836); pub const IOCTL_VIDEO_ENABLE_POINTER = @as(u32, 2294840); pub const IOCTL_VIDEO_DISABLE_POINTER = @as(u32, 2294844); pub const IOCTL_VIDEO_SET_POINTER_ATTR = @as(u32, 2294848); pub const IOCTL_VIDEO_QUERY_POINTER_ATTR = @as(u32, 2294852); pub const IOCTL_VIDEO_SET_POINTER_POSITION = @as(u32, 2294856); pub const IOCTL_VIDEO_QUERY_POINTER_POSITION = @as(u32, 2294860); pub const IOCTL_VIDEO_QUERY_POINTER_CAPABILITIES = @as(u32, 2294864); pub const IOCTL_VIDEO_GET_BANK_SELECT_CODE = @as(u32, 2294868); pub const IOCTL_VIDEO_MAP_VIDEO_MEMORY = @as(u32, 2294872); pub const IOCTL_VIDEO_UNMAP_VIDEO_MEMORY = @as(u32, 2294876); pub const IOCTL_VIDEO_QUERY_PUBLIC_ACCESS_RANGES = @as(u32, 2294880); pub const IOCTL_VIDEO_FREE_PUBLIC_ACCESS_RANGES = @as(u32, 2294884); pub const IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES = @as(u32, 2294888); pub const IOCTL_VIDEO_SET_POWER_MANAGEMENT = @as(u32, 2294892); pub const IOCTL_VIDEO_GET_POWER_MANAGEMENT = @as(u32, 2294896); pub const IOCTL_VIDEO_SHARE_VIDEO_MEMORY = @as(u32, 2294900); pub const IOCTL_VIDEO_UNSHARE_VIDEO_MEMORY = @as(u32, 2294904); pub const IOCTL_VIDEO_SET_COLOR_LUT_DATA = @as(u32, 2294908); pub const IOCTL_VIDEO_GET_CHILD_STATE = @as(u32, 2294912); pub const IOCTL_VIDEO_VALIDATE_CHILD_STATE_CONFIGURATION = @as(u32, 2294916); pub const IOCTL_VIDEO_SET_CHILD_STATE_CONFIGURATION = @as(u32, 2294920); pub const IOCTL_VIDEO_SWITCH_DUALVIEW = @as(u32, 2294924); pub const IOCTL_VIDEO_SET_BANK_POSITION = @as(u32, 2294928); pub const IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS = @as(u32, 2294932); pub const IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS = @as(u32, 2294936); pub const IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS = @as(u32, 2294940); pub const IOCTL_FSVIDEO_COPY_FRAME_BUFFER = @as(u32, 3409920); pub const IOCTL_FSVIDEO_WRITE_TO_FRAME_BUFFER = @as(u32, 3409924); pub const IOCTL_FSVIDEO_REVERSE_MOUSE_POINTER = @as(u32, 3409928); pub const IOCTL_FSVIDEO_SET_CURRENT_MODE = @as(u32, 3409932); pub const IOCTL_FSVIDEO_SET_SCREEN_INFORMATION = @as(u32, 3409936); pub const IOCTL_FSVIDEO_SET_CURSOR_POSITION = @as(u32, 3409940); pub const IOCTL_PANEL_QUERY_BRIGHTNESS_CAPS = @as(u32, 2296832); pub const IOCTL_PANEL_QUERY_BRIGHTNESS_RANGES = @as(u32, 2296836); pub const IOCTL_PANEL_GET_BRIGHTNESS = @as(u32, 2296840); pub const IOCTL_PANEL_SET_BRIGHTNESS = @as(u32, 2296844); pub const IOCTL_PANEL_SET_BRIGHTNESS_STATE = @as(u32, 2296848); pub const IOCTL_PANEL_SET_BACKLIGHT_OPTIMIZATION = @as(u32, 2296852); pub const IOCTL_PANEL_GET_BACKLIGHT_REDUCTION = @as(u32, 2296856); pub const IOCTL_COLORSPACE_TRANSFORM_QUERY_TARGET_CAPS = @as(u32, 2297856); pub const IOCTL_COLORSPACE_TRANSFORM_SET = @as(u32, 2297860); pub const IOCTL_SET_ACTIVE_COLOR_PROFILE_NAME = @as(u32, 2297864); pub const IOCTL_MIPI_DSI_QUERY_CAPS = @as(u32, 2298880); pub const IOCTL_MIPI_DSI_TRANSMISSION = @as(u32, 2298884); pub const IOCTL_MIPI_DSI_RESET = @as(u32, 2298888); pub const DXGK_WIN32K_PARAM_FLAG_UPDATEREGISTRY = @as(u32, 1); pub const DXGK_WIN32K_PARAM_FLAG_MODESWITCH = @as(u32, 2); pub const DXGK_WIN32K_PARAM_FLAG_DISABLEVIEW = @as(u32, 4); pub const VIDEO_DUALVIEW_REMOVABLE = @as(u32, 1); pub const VIDEO_DUALVIEW_PRIMARY = @as(u32, 2147483648); pub const VIDEO_DUALVIEW_SECONDARY = @as(u32, 1073741824); pub const VIDEO_DUALVIEW_WDDM_VGA = @as(u32, 536870912); pub const VIDEO_STATE_NON_STANDARD_VGA = @as(u32, 1); pub const VIDEO_STATE_UNEMULATED_VGA_STATE = @as(u32, 2); pub const VIDEO_STATE_PACKED_CHAIN4_MODE = @as(u32, 4); pub const VIDEO_MODE_NO_ZERO_MEMORY = @as(u32, 2147483648); pub const VIDEO_MODE_MAP_MEM_LINEAR = @as(u32, 1073741824); pub const VIDEO_MODE_COLOR = @as(u32, 1); pub const VIDEO_MODE_GRAPHICS = @as(u32, 2); pub const VIDEO_MODE_PALETTE_DRIVEN = @as(u32, 4); pub const VIDEO_MODE_MANAGED_PALETTE = @as(u32, 8); pub const VIDEO_MODE_INTERLACED = @as(u32, 16); pub const VIDEO_MODE_NO_OFF_SCREEN = @as(u32, 32); pub const VIDEO_MODE_NO_64_BIT_ACCESS = @as(u32, 64); pub const VIDEO_MODE_BANKED = @as(u32, 128); pub const VIDEO_MODE_LINEAR = @as(u32, 256); pub const VIDEO_MODE_ASYNC_POINTER = @as(u32, 1); pub const VIDEO_MODE_MONO_POINTER = @as(u32, 2); pub const VIDEO_MODE_COLOR_POINTER = @as(u32, 4); pub const VIDEO_MODE_ANIMATE_START = @as(u32, 8); pub const VIDEO_MODE_ANIMATE_UPDATE = @as(u32, 16); pub const PLANAR_HC = @as(u32, 1); pub const VIDEO_DEVICE_COLOR = @as(u32, 1); pub const VIDEO_OPTIONAL_GAMMET_TABLE = @as(u32, 2); pub const VIDEO_COLOR_LUT_DATA_FORMAT_RGB256WORDS = @as(u32, 1); pub const VIDEO_COLOR_LUT_DATA_FORMAT_PRIVATEFORMAT = @as(u32, 2147483648); pub const DISPLAYPOLICY_AC = @as(u32, 1); pub const DISPLAYPOLICY_DC = @as(u32, 2); pub const CHAR_TYPE_SBCS = @as(u32, 0); pub const CHAR_TYPE_LEADING = @as(u32, 2); pub const CHAR_TYPE_TRAILING = @as(u32, 3); pub const BITMAP_BITS_BYTE_ALIGN = @as(u32, 8); pub const BITMAP_BITS_WORD_ALIGN = @as(u32, 16); pub const BITMAP_ARRAY_BYTE = @as(u32, 3); pub const BITMAP_PLANES = @as(u32, 1); pub const BITMAP_BITS_PIXEL = @as(u32, 1); pub const VIDEO_REASON_NONE = @as(u32, 0); pub const VIDEO_REASON_POLICY1 = @as(u32, 1); pub const VIDEO_REASON_POLICY2 = @as(u32, 2); pub const VIDEO_REASON_POLICY3 = @as(u32, 3); pub const VIDEO_REASON_POLICY4 = @as(u32, 4); pub const VIDEO_REASON_LOCK = @as(u32, 5); pub const VIDEO_REASON_FAILED_ROTATION = @as(u32, 5); pub const VIDEO_REASON_ALLOCATION = @as(u32, 6); pub const VIDEO_REASON_SCRATCH = @as(u32, 8); pub const VIDEO_REASON_CONFIGURATION = @as(u32, 9); pub const BRIGHTNESS_MAX_LEVEL_COUNT = @as(u32, 103); pub const BRIGHTNESS_MAX_NIT_RANGE_COUNT = @as(u32, 16); pub const DSI_PACKET_EMBEDDED_PAYLOAD_SIZE = @as(u32, 8); pub const MAX_PACKET_COUNT = @as(u32, 128); pub const DSI_INVALID_PACKET_INDEX = @as(u32, 255); pub const DSI_SOT_ERROR = @as(u32, 1); pub const DSI_SOT_SYNC_ERROR = @as(u32, 2); pub const DSI_EOT_SYNC_ERROR = @as(u32, 4); pub const DSI_ESCAPE_MODE_ENTRY_COMMAND_ERROR = @as(u32, 8); pub const DSI_LOW_POWER_TRANSMIT_SYNC_ERROR = @as(u32, 16); pub const DSI_PERIPHERAL_TIMEOUT_ERROR = @as(u32, 32); pub const DSI_FALSE_CONTROL_ERROR = @as(u32, 64); pub const DSI_CONTENTION_DETECTED = @as(u32, 128); pub const DSI_CHECKSUM_ERROR_CORRECTED = @as(u32, 256); pub const DSI_CHECKSUM_ERROR_NOT_CORRECTED = @as(u32, 512); pub const DSI_LONG_PACKET_PAYLOAD_CHECKSUM_ERROR = @as(u32, 1024); pub const DSI_DSI_DATA_TYPE_NOT_RECOGNIZED = @as(u32, 2048); pub const DSI_DSI_VC_ID_INVALID = @as(u32, 4096); pub const DSI_INVALID_TRANSMISSION_LENGTH = @as(u32, 8192); pub const DSI_DSI_PROTOCOL_VIOLATION = @as(u32, 32768); pub const HOST_DSI_DEVICE_NOT_READY = @as(u32, 1); pub const HOST_DSI_INTERFACE_RESET = @as(u32, 2); pub const HOST_DSI_DEVICE_RESET = @as(u32, 4); pub const HOST_DSI_TRANSMISSION_CANCELLED = @as(u32, 16); pub const HOST_DSI_TRANSMISSION_DROPPED = @as(u32, 32); pub const HOST_DSI_TRANSMISSION_TIMEOUT = @as(u32, 64); pub const HOST_DSI_INVALID_TRANSMISSION = @as(u32, 256); pub const HOST_DSI_OS_REJECTED_PACKET = @as(u32, 512); pub const HOST_DSI_DRIVER_REJECTED_PACKET = @as(u32, 1024); pub const HOST_DSI_BAD_TRANSMISSION_MODE = @as(u32, 4096); pub const GUID_MONITOR_OVERRIDE_PSEUDO_SPECIALIZED = Guid.initString("f196c02f-f86f-4f9a-aa15-e9cebdfe3b96"); pub const SURFACEALIGN_DISCARDABLE = @as(i32, 1); pub const VMEMHEAP_LINEAR = @as(i32, 1); pub const VMEMHEAP_RECTANGULAR = @as(i32, 2); pub const VMEMHEAP_ALIGNMENT = @as(i32, 4); pub const MC_CAPS_NONE = @as(u32, 0); pub const MC_CAPS_MONITOR_TECHNOLOGY_TYPE = @as(u32, 1); pub const MC_CAPS_BRIGHTNESS = @as(u32, 2); pub const MC_CAPS_CONTRAST = @as(u32, 4); pub const MC_CAPS_COLOR_TEMPERATURE = @as(u32, 8); pub const MC_CAPS_RED_GREEN_BLUE_GAIN = @as(u32, 16); pub const MC_CAPS_RED_GREEN_BLUE_DRIVE = @as(u32, 32); pub const MC_CAPS_DEGAUSS = @as(u32, 64); pub const MC_CAPS_DISPLAY_AREA_POSITION = @as(u32, 128); pub const MC_CAPS_DISPLAY_AREA_SIZE = @as(u32, 256); pub const MC_CAPS_RESTORE_FACTORY_DEFAULTS = @as(u32, 1024); pub const MC_CAPS_RESTORE_FACTORY_COLOR_DEFAULTS = @as(u32, 2048); pub const MC_RESTORE_FACTORY_DEFAULTS_ENABLES_MONITOR_SETTINGS = @as(u32, 4096); pub const MC_SUPPORTED_COLOR_TEMPERATURE_NONE = @as(u32, 0); pub const MC_SUPPORTED_COLOR_TEMPERATURE_4000K = @as(u32, 1); pub const MC_SUPPORTED_COLOR_TEMPERATURE_5000K = @as(u32, 2); pub const MC_SUPPORTED_COLOR_TEMPERATURE_6500K = @as(u32, 4); pub const MC_SUPPORTED_COLOR_TEMPERATURE_7500K = @as(u32, 8); pub const MC_SUPPORTED_COLOR_TEMPERATURE_8200K = @as(u32, 16); pub const MC_SUPPORTED_COLOR_TEMPERATURE_9300K = @as(u32, 32); pub const MC_SUPPORTED_COLOR_TEMPERATURE_10000K = @as(u32, 64); pub const MC_SUPPORTED_COLOR_TEMPERATURE_11500K = @as(u32, 128); pub const PHYSICAL_MONITOR_DESCRIPTION_SIZE = @as(u32, 128); //-------------------------------------------------------------------------------- // Section: Types (109) //-------------------------------------------------------------------------------- pub const INDIRECT_DISPLAY_INFO = extern struct { DisplayAdapterLuid: LUID, Flags: u32, NumMonitors: u32, DisplayAdapterTargetBase: u32, }; pub const VIDEO_VDM = extern struct { ProcessHandle: ?HANDLE, }; pub const VIDEO_REGISTER_VDM = extern struct { MinimumStateSize: u32, }; pub const VIDEO_MONITOR_DESCRIPTOR = extern struct { DescriptorSize: u32, Descriptor: [1]u8, }; pub const VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE = enum(i32) { PowerNotifyCallout = 1, EnumChildPdoNotifyCallout = 3, FindAdapterCallout = 4, PnpNotifyCallout = 7, DxgkDisplaySwitchCallout = 8, DxgkFindAdapterTdrCallout = 10, DxgkHardwareProtectionTeardown = 11, RepaintDesktop = 12, UpdateCursor = 13, DisableMultiPlaneOverlay = 14, DesktopDuplicationChange = 15, BlackScreenDiagnostics = 16, }; pub const VideoPowerNotifyCallout = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.PowerNotifyCallout; pub const VideoEnumChildPdoNotifyCallout = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.EnumChildPdoNotifyCallout; pub const VideoFindAdapterCallout = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.FindAdapterCallout; pub const VideoPnpNotifyCallout = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.PnpNotifyCallout; pub const VideoDxgkDisplaySwitchCallout = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.DxgkDisplaySwitchCallout; pub const VideoDxgkFindAdapterTdrCallout = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.DxgkFindAdapterTdrCallout; pub const VideoDxgkHardwareProtectionTeardown = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.DxgkHardwareProtectionTeardown; pub const VideoRepaintDesktop = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.RepaintDesktop; pub const VideoUpdateCursor = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.UpdateCursor; pub const VideoDisableMultiPlaneOverlay = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.DisableMultiPlaneOverlay; pub const VideoDesktopDuplicationChange = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.DesktopDuplicationChange; pub const VideoBlackScreenDiagnostics = VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE.BlackScreenDiagnostics; pub const BlackScreenDiagnosticsCalloutParam = enum(i32) { agnosticsData = 1, splayRecovery = 2, }; pub const BlackScreenDiagnosticsData = BlackScreenDiagnosticsCalloutParam.agnosticsData; pub const BlackScreenDisplayRecovery = BlackScreenDiagnosticsCalloutParam.splayRecovery; pub const DXGK_WIN32K_PARAM_DATA = extern struct { PathsArray: ?*c_void, ModesArray: ?*c_void, NumPathArrayElements: u32, NumModeArrayElements: u32, SDCFlags: u32, }; pub const VIDEO_WIN32K_CALLBACKS_PARAMS = extern struct { CalloutType: VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE, PhysDisp: ?*c_void, Param: usize, Status: i32, LockUserSession: BOOLEAN, IsPostDevice: BOOLEAN, SurpriseRemoval: BOOLEAN, WaitForQueueReady: BOOLEAN, }; pub const PVIDEO_WIN32K_CALLOUT = fn( Params: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub const VIDEO_WIN32K_CALLBACKS = extern struct { PhysDisp: ?*c_void, Callout: ?PVIDEO_WIN32K_CALLOUT, bACPI: u32, pPhysDeviceObject: ?HANDLE, DualviewFlags: u32, }; pub const VIDEO_DEVICE_SESSION_STATUS = extern struct { bEnable: u32, bSuccess: u32, }; pub const VIDEO_HARDWARE_STATE_HEADER = extern struct { Length: u32, PortValue: [48]u8, AttribIndexDataState: u32, BasicSequencerOffset: u32, BasicCrtContOffset: u32, BasicGraphContOffset: u32, BasicAttribContOffset: u32, BasicDacOffset: u32, BasicLatchesOffset: u32, ExtendedSequencerOffset: u32, ExtendedCrtContOffset: u32, ExtendedGraphContOffset: u32, ExtendedAttribContOffset: u32, ExtendedDacOffset: u32, ExtendedValidatorStateOffset: u32, ExtendedMiscDataOffset: u32, PlaneLength: u32, Plane1Offset: u32, Plane2Offset: u32, Plane3Offset: u32, Plane4Offset: u32, VGAStateFlags: u32, DIBOffset: u32, DIBBitsPerPixel: u32, DIBXResolution: u32, DIBYResolution: u32, DIBXlatOffset: u32, DIBXlatLength: u32, VesaInfoOffset: u32, FrameBufferData: ?*c_void, }; pub const VIDEO_HARDWARE_STATE = extern struct { StateHeader: ?*VIDEO_HARDWARE_STATE_HEADER, StateLength: u32, }; pub const VIDEO_NUM_MODES = extern struct { NumModes: u32, ModeInformationLength: u32, }; pub const VIDEO_MODE = extern struct { RequestedMode: u32, }; pub const VIDEO_MODE_INFORMATION = extern struct { Length: u32, ModeIndex: u32, VisScreenWidth: u32, VisScreenHeight: u32, ScreenStride: u32, NumberOfPlanes: u32, BitsPerPlane: u32, Frequency: u32, XMillimeter: u32, YMillimeter: u32, NumberRedBits: u32, NumberGreenBits: u32, NumberBlueBits: u32, RedMask: u32, GreenMask: u32, BlueMask: u32, AttributeFlags: u32, VideoMemoryBitmapWidth: u32, VideoMemoryBitmapHeight: u32, DriverSpecificAttributeFlags: u32, }; pub const VIDEO_LOAD_FONT_INFORMATION = extern struct { WidthInPixels: u16, HeightInPixels: u16, FontSize: u32, Font: [1]u8, }; pub const VIDEO_PALETTE_DATA = extern struct { NumEntries: u16, FirstEntry: u16, Colors: [1]u16, }; pub const VIDEO_CLUTDATA = extern struct { Red: u8, Green: u8, Blue: u8, Unused: u8, }; pub const VIDEO_CLUT = extern struct { NumEntries: u16, FirstEntry: u16, LookupTable: [1]extern union { RgbArray: VIDEO_CLUTDATA, RgbLong: u32, }, }; pub const VIDEO_CURSOR_POSITION = extern struct { Column: i16, Row: i16, }; pub const VIDEO_CURSOR_ATTRIBUTES = extern struct { Width: u16, Height: u16, Column: i16, Row: i16, Rate: u8, Enable: u8, }; pub const VIDEO_POINTER_POSITION = extern struct { Column: i16, Row: i16, }; pub const VIDEO_POINTER_ATTRIBUTES = extern struct { Flags: u32, Width: u32, Height: u32, WidthInBytes: u32, Enable: u32, Column: i16, Row: i16, Pixels: [1]u8, }; pub const VIDEO_POINTER_CAPABILITIES = extern struct { Flags: u32, MaxWidth: u32, MaxHeight: u32, HWPtrBitmapStart: u32, HWPtrBitmapEnd: u32, }; pub const VIDEO_BANK_SELECT = extern struct { Length: u32, Size: u32, BankingFlags: u32, BankingType: u32, PlanarHCBankingType: u32, BitmapWidthInBytes: u32, BitmapSize: u32, Granularity: u32, PlanarHCGranularity: u32, CodeOffset: u32, PlanarHCBankCodeOffset: u32, PlanarHCEnableCodeOffset: u32, PlanarHCDisableCodeOffset: u32, }; pub const VIDEO_BANK_TYPE = enum(i32) { VideoNotBanked = 0, VideoBanked1RW = 1, VideoBanked1R1W = 2, VideoBanked2RW = 3, NumVideoBankTypes = 4, }; pub const VideoNotBanked = VIDEO_BANK_TYPE.VideoNotBanked; pub const VideoBanked1RW = VIDEO_BANK_TYPE.VideoBanked1RW; pub const VideoBanked1R1W = VIDEO_BANK_TYPE.VideoBanked1R1W; pub const VideoBanked2RW = VIDEO_BANK_TYPE.VideoBanked2RW; pub const NumVideoBankTypes = VIDEO_BANK_TYPE.NumVideoBankTypes; pub const VIDEO_MEMORY = extern struct { RequestedVirtualAddress: ?*c_void, }; pub const VIDEO_SHARE_MEMORY = extern struct { ProcessHandle: ?HANDLE, ViewOffset: u32, ViewSize: u32, RequestedVirtualAddress: ?*c_void, }; pub const VIDEO_SHARE_MEMORY_INFORMATION = extern struct { SharedViewOffset: u32, SharedViewSize: u32, VirtualAddress: ?*c_void, }; pub const VIDEO_MEMORY_INFORMATION = extern struct { VideoRamBase: ?*c_void, VideoRamLength: u32, FrameBufferBase: ?*c_void, FrameBufferLength: u32, }; pub const VIDEO_PUBLIC_ACCESS_RANGES = extern struct { InIoSpace: u32, MappedInIoSpace: u32, VirtualAddress: ?*c_void, }; pub const VIDEO_COLOR_CAPABILITIES = extern struct { Length: u32, AttributeFlags: u32, RedPhosphoreDecay: i32, GreenPhosphoreDecay: i32, BluePhosphoreDecay: i32, WhiteChromaticity_x: i32, WhiteChromaticity_y: i32, WhiteChromaticity_Y: i32, RedChromaticity_x: i32, RedChromaticity_y: i32, GreenChromaticity_x: i32, GreenChromaticity_y: i32, BlueChromaticity_x: i32, BlueChromaticity_y: i32, WhiteGamma: i32, RedGamma: i32, GreenGamma: i32, BlueGamma: i32, }; pub const VIDEO_POWER_STATE = enum(i32) { Unspecified = 0, On = 1, StandBy = 2, Suspend = 3, Off = 4, Hibernate = 5, Shutdown = 6, Maximum = 7, }; pub const VideoPowerUnspecified = VIDEO_POWER_STATE.Unspecified; pub const VideoPowerOn = VIDEO_POWER_STATE.On; pub const VideoPowerStandBy = VIDEO_POWER_STATE.StandBy; pub const VideoPowerSuspend = VIDEO_POWER_STATE.Suspend; pub const VideoPowerOff = VIDEO_POWER_STATE.Off; pub const VideoPowerHibernate = VIDEO_POWER_STATE.Hibernate; pub const VideoPowerShutdown = VIDEO_POWER_STATE.Shutdown; pub const VideoPowerMaximum = VIDEO_POWER_STATE.Maximum; pub const VIDEO_POWER_MANAGEMENT = extern struct { Length: u32, DPMSVersion: u32, PowerState: u32, }; pub const VIDEO_COLOR_LUT_DATA = extern struct { Length: u32, LutDataFormat: u32, LutData: [1]u8, }; pub const VIDEO_LUT_RGB256WORDS = extern struct { Red: [256]u16, Green: [256]u16, Blue: [256]u16, }; pub const BANK_POSITION = extern struct { ReadBankPosition: u32, WriteBankPosition: u32, }; pub const DISPLAY_BRIGHTNESS = extern struct { ucDisplayPolicy: u8, ucACBrightness: u8, ucDCBrightness: u8, }; pub const VIDEO_BRIGHTNESS_POLICY = extern struct { DefaultToBiosPolicy: BOOLEAN, LevelCount: u8, Level: [1]extern struct { BatteryLevel: u8, Brightness: u8, }, }; pub const FSCNTL_SCREEN_INFO = extern struct { Position: COORD, ScreenSize: COORD, nNumberOfChars: u32, }; pub const FONT_IMAGE_INFO = extern struct { FontSize: COORD, ImageBits: ?*u8, }; pub const CHAR_IMAGE_INFO = extern struct { CharInfo: CHAR_INFO, FontImageInfo: FONT_IMAGE_INFO, }; pub const VGA_CHAR = extern struct { Char: CHAR, Attributes: CHAR, }; pub const FSVIDEO_COPY_FRAME_BUFFER = extern struct { SrcScreen: FSCNTL_SCREEN_INFO, DestScreen: FSCNTL_SCREEN_INFO, }; pub const FSVIDEO_WRITE_TO_FRAME_BUFFER = extern struct { SrcBuffer: ?*CHAR_IMAGE_INFO, DestScreen: FSCNTL_SCREEN_INFO, }; pub const FSVIDEO_REVERSE_MOUSE_POINTER = extern struct { Screen: FSCNTL_SCREEN_INFO, dwType: u32, }; pub const FSVIDEO_MODE_INFORMATION = extern struct { VideoMode: VIDEO_MODE_INFORMATION, VideoMemory: VIDEO_MEMORY_INFORMATION, }; pub const FSVIDEO_SCREEN_INFORMATION = extern struct { ScreenSize: COORD, FontSize: COORD, }; pub const FSVIDEO_CURSOR_POSITION = extern struct { Coord: VIDEO_CURSOR_POSITION, dwType: u32, }; pub const ENG_EVENT = extern struct { pKEvent: ?*c_void, fFlags: u32, }; pub const VIDEO_PERFORMANCE_COUNTER = extern struct { NbOfAllocationEvicted: [10]u64, NbOfAllocationMarked: [10]u64, NbOfAllocationRestored: [10]u64, KBytesEvicted: [10]u64, KBytesMarked: [10]u64, KBytesRestored: [10]u64, NbProcessCommited: u64, NbAllocationCommited: u64, NbAllocationMarked: u64, KBytesAllocated: u64, KBytesAvailable: u64, KBytesCurMarked: u64, Reference: u64, Unreference: u64, TrueReference: u64, NbOfPageIn: u64, KBytesPageIn: u64, NbOfPageOut: u64, KBytesPageOut: u64, NbOfRotateOut: u64, KBytesRotateOut: u64, }; pub const VIDEO_QUERY_PERFORMANCE_COUNTER = extern struct { BufferSize: u32, Buffer: ?*VIDEO_PERFORMANCE_COUNTER, }; pub const BRIGHTNESS_INTERFACE_VERSION = enum(i32) { @"1" = 1, @"2" = 2, @"3" = 3, }; pub const BRIGHTNESS_INTERFACE_VERSION_1 = BRIGHTNESS_INTERFACE_VERSION.@"1"; pub const BRIGHTNESS_INTERFACE_VERSION_2 = BRIGHTNESS_INTERFACE_VERSION.@"2"; pub const BRIGHTNESS_INTERFACE_VERSION_3 = BRIGHTNESS_INTERFACE_VERSION.@"3"; pub const PANEL_QUERY_BRIGHTNESS_CAPS = extern struct { Version: BRIGHTNESS_INTERFACE_VERSION, Anonymous: extern union { Anonymous: extern struct { _bitfield: u32, }, Value: u32, }, }; pub const BRIGHTNESS_LEVEL = extern struct { Count: u8, Level: [103]u8, }; pub const BRIGHTNESS_NIT_RANGE = extern struct { MinLevelInMillinit: u32, MaxLevelInMillinit: u32, StepSizeInMillinit: u32, }; pub const BRIGHTNESS_NIT_RANGES = extern struct { NormalRangeCount: u32, RangeCount: u32, PreferredMaximumBrightness: u32, SupportedRanges: [16]BRIGHTNESS_NIT_RANGE, }; pub const PANEL_QUERY_BRIGHTNESS_RANGES = extern struct { Version: BRIGHTNESS_INTERFACE_VERSION, Anonymous: extern union { BrightnessLevel: BRIGHTNESS_LEVEL, NitRanges: BRIGHTNESS_NIT_RANGES, }, }; pub const PANEL_GET_BRIGHTNESS = extern struct { Version: BRIGHTNESS_INTERFACE_VERSION, Anonymous: extern union { Level: u8, Anonymous: extern struct { CurrentInMillinits: u32, TargetInMillinits: u32, }, }, }; pub const CHROMATICITY_COORDINATE = extern struct { x: f32, y: f32, }; pub const PANEL_BRIGHTNESS_SENSOR_DATA = extern struct { Anonymous: extern union { Anonymous: extern struct { _bitfield: u32, }, Value: u32, }, AlsReading: f32, ChromaticityCoordinate: CHROMATICITY_COORDINATE, ColorTemperature: f32, }; pub const PANEL_SET_BRIGHTNESS = extern struct { Version: BRIGHTNESS_INTERFACE_VERSION, Anonymous: extern union { Level: u8, Anonymous: extern struct { Millinits: u32, TransitionTimeInMs: u32, SensorData: PANEL_BRIGHTNESS_SENSOR_DATA, }, }, }; pub const PANEL_SET_BRIGHTNESS_STATE = extern struct { Anonymous: extern union { Anonymous: extern struct { _bitfield: u32, }, Value: u32, }, }; pub const BACKLIGHT_OPTIMIZATION_LEVEL = enum(i32) { Disable = 0, Desktop = 1, Dynamic = 2, Dimmed = 3, EDR = 4, }; pub const BacklightOptimizationDisable = BACKLIGHT_OPTIMIZATION_LEVEL.Disable; pub const BacklightOptimizationDesktop = BACKLIGHT_OPTIMIZATION_LEVEL.Desktop; pub const BacklightOptimizationDynamic = BACKLIGHT_OPTIMIZATION_LEVEL.Dynamic; pub const BacklightOptimizationDimmed = BACKLIGHT_OPTIMIZATION_LEVEL.Dimmed; pub const BacklightOptimizationEDR = BACKLIGHT_OPTIMIZATION_LEVEL.EDR; pub const PANEL_SET_BACKLIGHT_OPTIMIZATION = extern struct { Level: BACKLIGHT_OPTIMIZATION_LEVEL, }; pub const BACKLIGHT_REDUCTION_GAMMA_RAMP = extern struct { R: [256]u16, G: [256]u16, B: [256]u16, }; pub const PANEL_GET_BACKLIGHT_REDUCTION = extern struct { BacklightUsersetting: u16, BacklightEffective: u16, GammaRamp: BACKLIGHT_REDUCTION_GAMMA_RAMP, }; pub const COLORSPACE_TRANSFORM_DATA_TYPE = enum(i32) { IXED_POINT = 0, LOAT = 1, }; pub const COLORSPACE_TRANSFORM_DATA_TYPE_FIXED_POINT = COLORSPACE_TRANSFORM_DATA_TYPE.IXED_POINT; pub const COLORSPACE_TRANSFORM_DATA_TYPE_FLOAT = COLORSPACE_TRANSFORM_DATA_TYPE.LOAT; pub const COLORSPACE_TRANSFORM_DATA_CAP = extern struct { DataType: COLORSPACE_TRANSFORM_DATA_TYPE, Anonymous: extern union { Anonymous1: extern struct { _bitfield: u32, }, Anonymous2: extern struct { _bitfield: u32, }, Value: u32, }, NumericRangeMin: f32, NumericRangeMax: f32, }; pub const COLORSPACE_TRANSFORM_1DLUT_CAP = extern struct { NumberOfLUTEntries: u32, DataCap: COLORSPACE_TRANSFORM_DATA_CAP, }; pub const COLORSPACE_TRANSFORM_MATRIX_CAP = extern struct { Anonymous: extern union { Anonymous: extern struct { _bitfield: u32, }, Value: u32, }, DataCap: COLORSPACE_TRANSFORM_DATA_CAP, }; pub const COLORSPACE_TRANSFORM_TARGET_CAPS_VERSION = enum(i32) { DEFAULT = 0, @"1" = 1, // NOT_SUPPORTED = 0, this enum value conflicts with DEFAULT }; pub const COLORSPACE_TRANSFORM_VERSION_DEFAULT = COLORSPACE_TRANSFORM_TARGET_CAPS_VERSION.DEFAULT; pub const COLORSPACE_TRANSFORM_VERSION_1 = COLORSPACE_TRANSFORM_TARGET_CAPS_VERSION.@"1"; pub const COLORSPACE_TRANSFORM_VERSION_NOT_SUPPORTED = COLORSPACE_TRANSFORM_TARGET_CAPS_VERSION.DEFAULT; pub const COLORSPACE_TRANSFORM_TARGET_CAPS = extern struct { Version: COLORSPACE_TRANSFORM_TARGET_CAPS_VERSION, LookupTable1DDegammaCap: COLORSPACE_TRANSFORM_1DLUT_CAP, ColorMatrix3x3Cap: COLORSPACE_TRANSFORM_MATRIX_CAP, LookupTable1DRegammaCap: COLORSPACE_TRANSFORM_1DLUT_CAP, }; pub const COLORSPACE_TRANSFORM_TYPE = enum(i32) { UNINITIALIZED = 0, DEFAULT = 1, RGB256x3x16 = 2, DXGI_1 = 3, MATRIX_3x4 = 4, MATRIX_V2 = 5, }; pub const COLORSPACE_TRANSFORM_TYPE_UNINITIALIZED = COLORSPACE_TRANSFORM_TYPE.UNINITIALIZED; pub const COLORSPACE_TRANSFORM_TYPE_DEFAULT = COLORSPACE_TRANSFORM_TYPE.DEFAULT; pub const COLORSPACE_TRANSFORM_TYPE_RGB256x3x16 = COLORSPACE_TRANSFORM_TYPE.RGB256x3x16; pub const COLORSPACE_TRANSFORM_TYPE_DXGI_1 = COLORSPACE_TRANSFORM_TYPE.DXGI_1; pub const COLORSPACE_TRANSFORM_TYPE_MATRIX_3x4 = COLORSPACE_TRANSFORM_TYPE.MATRIX_3x4; pub const COLORSPACE_TRANSFORM_TYPE_MATRIX_V2 = COLORSPACE_TRANSFORM_TYPE.MATRIX_V2; pub const GAMMA_RAMP_RGB256x3x16 = extern struct { Red: [256]u16, Green: [256]u16, Blue: [256]u16, }; pub const GAMMA_RAMP_RGB = extern struct { Red: f32, Green: f32, Blue: f32, }; pub const GAMMA_RAMP_DXGI_1 = extern struct { Scale: GAMMA_RAMP_RGB, Offset: GAMMA_RAMP_RGB, GammaCurve: [1025]GAMMA_RAMP_RGB, }; pub const COLORSPACE_TRANSFORM_3x4 = extern struct { ColorMatrix3x4: [12]f32, ScalarMultiplier: f32, LookupTable1D: [4096]GAMMA_RAMP_RGB, }; pub const OUTPUT_WIRE_COLOR_SPACE_TYPE = enum(i32) { G22_P709 = 0, RESERVED = 4, G2084_P2020 = 12, G22_P709_WCG = 30, G22_P2020 = 31, G2084_P2020_HDR10PLUS = 32, G2084_P2020_DVLL = 33, }; pub const OUTPUT_WIRE_COLOR_SPACE_G22_P709 = OUTPUT_WIRE_COLOR_SPACE_TYPE.G22_P709; pub const OUTPUT_WIRE_COLOR_SPACE_RESERVED = OUTPUT_WIRE_COLOR_SPACE_TYPE.RESERVED; pub const OUTPUT_WIRE_COLOR_SPACE_G2084_P2020 = OUTPUT_WIRE_COLOR_SPACE_TYPE.G2084_P2020; pub const OUTPUT_WIRE_COLOR_SPACE_G22_P709_WCG = OUTPUT_WIRE_COLOR_SPACE_TYPE.G22_P709_WCG; pub const OUTPUT_WIRE_COLOR_SPACE_G22_P2020 = OUTPUT_WIRE_COLOR_SPACE_TYPE.G22_P2020; pub const OUTPUT_WIRE_COLOR_SPACE_G2084_P2020_HDR10PLUS = OUTPUT_WIRE_COLOR_SPACE_TYPE.G2084_P2020_HDR10PLUS; pub const OUTPUT_WIRE_COLOR_SPACE_G2084_P2020_DVLL = OUTPUT_WIRE_COLOR_SPACE_TYPE.G2084_P2020_DVLL; pub const OUTPUT_COLOR_ENCODING = enum(i32) { RGB = 0, YCBCR444 = 1, YCBCR422 = 2, YCBCR420 = 3, INTENSITY = 4, FORCE_UINT32 = -1, }; pub const OUTPUT_COLOR_ENCODING_RGB = OUTPUT_COLOR_ENCODING.RGB; pub const OUTPUT_COLOR_ENCODING_YCBCR444 = OUTPUT_COLOR_ENCODING.YCBCR444; pub const OUTPUT_COLOR_ENCODING_YCBCR422 = OUTPUT_COLOR_ENCODING.YCBCR422; pub const OUTPUT_COLOR_ENCODING_YCBCR420 = OUTPUT_COLOR_ENCODING.YCBCR420; pub const OUTPUT_COLOR_ENCODING_INTENSITY = OUTPUT_COLOR_ENCODING.INTENSITY; pub const OUTPUT_COLOR_ENCODING_FORCE_UINT32 = OUTPUT_COLOR_ENCODING.FORCE_UINT32; pub const OUTPUT_WIRE_FORMAT = extern struct { ColorEncoding: OUTPUT_COLOR_ENCODING, BitsPerPixel: u32, }; pub const COLORSPACE_TRANSFORM_STAGE_CONTROL = enum(i32) { No_Change = 0, Enable = 1, Bypass = 2, }; pub const ColorSpaceTransformStageControl_No_Change = COLORSPACE_TRANSFORM_STAGE_CONTROL.No_Change; pub const ColorSpaceTransformStageControl_Enable = COLORSPACE_TRANSFORM_STAGE_CONTROL.Enable; pub const ColorSpaceTransformStageControl_Bypass = COLORSPACE_TRANSFORM_STAGE_CONTROL.Bypass; pub const COLORSPACE_TRANSFORM_MATRIX_V2 = extern struct { StageControlLookupTable1DDegamma: COLORSPACE_TRANSFORM_STAGE_CONTROL, LookupTable1DDegamma: [4096]GAMMA_RAMP_RGB, StageControlColorMatrix3x3: COLORSPACE_TRANSFORM_STAGE_CONTROL, ColorMatrix3x3: [9]f32, StageControlLookupTable1DRegamma: COLORSPACE_TRANSFORM_STAGE_CONTROL, LookupTable1DRegamma: [4096]GAMMA_RAMP_RGB, }; pub const COLORSPACE_TRANSFORM = extern struct { Type: COLORSPACE_TRANSFORM_TYPE, Data: extern union { Rgb256x3x16: GAMMA_RAMP_RGB256x3x16, Dxgi1: GAMMA_RAMP_DXGI_1, T3x4: COLORSPACE_TRANSFORM_3x4, MatrixV2: COLORSPACE_TRANSFORM_MATRIX_V2, }, }; pub const COLORSPACE_TRANSFORM_SET_INPUT = extern struct { OutputWireColorSpaceExpected: OUTPUT_WIRE_COLOR_SPACE_TYPE, OutputWireFormatExpected: OUTPUT_WIRE_FORMAT, ColorSpaceTransform: COLORSPACE_TRANSFORM, }; pub const SET_ACTIVE_COLOR_PROFILE_NAME = extern struct { ColorProfileName: [1]u16, }; pub const MIPI_DSI_CAPS = extern struct { DSITypeMajor: u8, DSITypeMinor: u8, SpecVersionMajor: u8, SpecVersionMinor: u8, SpecVersionPatch: u8, TargetMaximumReturnPacketSize: u16, ResultCodeFlags: u8, ResultCodeStatus: u8, Revision: u8, Level: u8, DeviceClassHi: u8, DeviceClassLo: u8, ManufacturerHi: u8, ManufacturerLo: u8, ProductHi: u8, ProductLo: u8, LengthHi: u8, LengthLo: u8, }; pub const DSI_CONTROL_TRANSMISSION_MODE = enum(i32) { DEFAULT = 0, FORCE_LOW_POWER = 1, FORCE_HIGH_PERFORMANCE = 2, }; pub const DCT_DEFAULT = DSI_CONTROL_TRANSMISSION_MODE.DEFAULT; pub const DCT_FORCE_LOW_POWER = DSI_CONTROL_TRANSMISSION_MODE.FORCE_LOW_POWER; pub const DCT_FORCE_HIGH_PERFORMANCE = DSI_CONTROL_TRANSMISSION_MODE.FORCE_HIGH_PERFORMANCE; pub const MIPI_DSI_PACKET = extern struct { Anonymous1: extern union { DataId: u8, Anonymous: extern struct { _bitfield: u8, }, }, Anonymous2: extern union { Anonymous: extern struct { Data0: u8, Data1: u8, }, LongWriteWordCount: u16, }, EccFiller: u8, Payload: [8]u8, }; pub const MIPI_DSI_TRANSMISSION = extern struct { TotalBufferSize: u32, PacketCount: u8, FailedPacket: u8, Anonymous: extern struct { _bitfield: u16, }, ReadWordCount: u16, FinalCommandExtraPayload: u16, MipiErrors: u16, HostErrors: u16, Packets: [1]MIPI_DSI_PACKET, }; pub const MIPI_DSI_RESET = extern struct { Flags: u32, Anonymous: extern union { Anonymous: extern struct { _bitfield: u32, }, Results: u32, }, }; pub const SURFACEALIGNMENT = extern struct { Anonymous: extern union { Linear: extern struct { dwStartAlignment: u32, dwPitchAlignment: u32, dwFlags: u32, dwReserved2: u32, }, Rectangular: extern struct { dwXAlignment: u32, dwYAlignment: u32, dwFlags: u32, dwReserved2: u32, }, }, }; pub const HEAPALIGNMENT = extern struct { dwSize: u32, ddsCaps: DDSCAPS, dwReserved: u32, ExecuteBuffer: SURFACEALIGNMENT, Overlay: SURFACEALIGNMENT, Texture: SURFACEALIGNMENT, ZBuffer: SURFACEALIGNMENT, AlphaBuffer: SURFACEALIGNMENT, Offscreen: SURFACEALIGNMENT, FlipTarget: SURFACEALIGNMENT, }; pub const DD_GETHEAPALIGNMENTDATA = extern struct { dwInstance: usize, dwHeap: u32, ddRVal: HRESULT, GetHeapAlignment: ?*c_void, Alignment: HEAPALIGNMENT, }; pub const VMEML = extern struct { next: ?*VMEML, ptr: usize, size: u32, bDiscardable: BOOL, }; pub const VMEMR = extern struct { next: ?*VMEMR, prev: ?*VMEMR, pUp: ?*VMEMR, pDown: ?*VMEMR, pLeft: ?*VMEMR, pRight: ?*VMEMR, ptr: usize, size: u32, x: u32, y: u32, cx: u32, cy: u32, flags: u32, pBits: usize, bDiscardable: BOOL, }; pub const VMEMHEAP = extern struct { dwFlags: u32, stride: u32, freeList: ?*c_void, allocList: ?*c_void, dwTotalSize: u32, fpGARTLin: usize, fpGARTDev: usize, dwCommitedSize: u32, dwCoalesceCount: u32, Alignment: HEAPALIGNMENT, ddsCapsEx: DDSCAPSEX, ddsCapsExAlt: DDSCAPSEX, liPhysAGPBase: LARGE_INTEGER, hdevAGP: ?HANDLE, pvPhysRsrv: ?*c_void, pAgpCommitMask: ?*u8, dwAgpCommitMaskSize: u32, }; pub const AR_STATE = enum(i32) { ENABLED = 0, DISABLED = 1, SUPPRESSED = 2, REMOTESESSION = 4, MULTIMON = 8, NOSENSOR = 16, NOT_SUPPORTED = 32, DOCKED = 64, LAPTOP = 128, }; pub const AR_ENABLED = AR_STATE.ENABLED; pub const AR_DISABLED = AR_STATE.DISABLED; pub const AR_SUPPRESSED = AR_STATE.SUPPRESSED; pub const AR_REMOTESESSION = AR_STATE.REMOTESESSION; pub const AR_MULTIMON = AR_STATE.MULTIMON; pub const AR_NOSENSOR = AR_STATE.NOSENSOR; pub const AR_NOT_SUPPORTED = AR_STATE.NOT_SUPPORTED; pub const AR_DOCKED = AR_STATE.DOCKED; pub const AR_LAPTOP = AR_STATE.LAPTOP; pub const ORIENTATION_PREFERENCE = enum(i32) { NONE = 0, LANDSCAPE = 1, PORTRAIT = 2, LANDSCAPE_FLIPPED = 4, PORTRAIT_FLIPPED = 8, }; pub const ORIENTATION_PREFERENCE_NONE = ORIENTATION_PREFERENCE.NONE; pub const ORIENTATION_PREFERENCE_LANDSCAPE = ORIENTATION_PREFERENCE.LANDSCAPE; pub const ORIENTATION_PREFERENCE_PORTRAIT = ORIENTATION_PREFERENCE.PORTRAIT; pub const ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED = ORIENTATION_PREFERENCE.LANDSCAPE_FLIPPED; pub const ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED = ORIENTATION_PREFERENCE.PORTRAIT_FLIPPED; pub const PHYSICAL_MONITOR = packed struct { hPhysicalMonitor: ?HANDLE, szPhysicalMonitorDescription: [128]u16, }; pub const MC_TIMING_REPORT = packed struct { dwHorizontalFrequencyInHZ: u32, dwVerticalFrequencyInHZ: u32, bTimingStatusByte: u8, }; pub const MC_VCP_CODE_TYPE = enum(i32) { MOMENTARY = 0, SET_PARAMETER = 1, }; pub const MC_MOMENTARY = MC_VCP_CODE_TYPE.MOMENTARY; pub const MC_SET_PARAMETER = MC_VCP_CODE_TYPE.SET_PARAMETER; pub const MC_DISPLAY_TECHNOLOGY_TYPE = enum(i32) { SHADOW_MASK_CATHODE_RAY_TUBE = 0, APERTURE_GRILL_CATHODE_RAY_TUBE = 1, THIN_FILM_TRANSISTOR = 2, LIQUID_CRYSTAL_ON_SILICON = 3, PLASMA = 4, ORGANIC_LIGHT_EMITTING_DIODE = 5, ELECTROLUMINESCENT = 6, MICROELECTROMECHANICAL = 7, FIELD_EMISSION_DEVICE = 8, }; pub const MC_SHADOW_MASK_CATHODE_RAY_TUBE = MC_DISPLAY_TECHNOLOGY_TYPE.SHADOW_MASK_CATHODE_RAY_TUBE; pub const MC_APERTURE_GRILL_CATHODE_RAY_TUBE = MC_DISPLAY_TECHNOLOGY_TYPE.APERTURE_GRILL_CATHODE_RAY_TUBE; pub const MC_THIN_FILM_TRANSISTOR = MC_DISPLAY_TECHNOLOGY_TYPE.THIN_FILM_TRANSISTOR; pub const MC_LIQUID_CRYSTAL_ON_SILICON = MC_DISPLAY_TECHNOLOGY_TYPE.LIQUID_CRYSTAL_ON_SILICON; pub const MC_PLASMA = MC_DISPLAY_TECHNOLOGY_TYPE.PLASMA; pub const MC_ORGANIC_LIGHT_EMITTING_DIODE = MC_DISPLAY_TECHNOLOGY_TYPE.ORGANIC_LIGHT_EMITTING_DIODE; pub const MC_ELECTROLUMINESCENT = MC_DISPLAY_TECHNOLOGY_TYPE.ELECTROLUMINESCENT; pub const MC_MICROELECTROMECHANICAL = MC_DISPLAY_TECHNOLOGY_TYPE.MICROELECTROMECHANICAL; pub const MC_FIELD_EMISSION_DEVICE = MC_DISPLAY_TECHNOLOGY_TYPE.FIELD_EMISSION_DEVICE; pub const MC_DRIVE_TYPE = enum(i32) { RED_DRIVE = 0, GREEN_DRIVE = 1, BLUE_DRIVE = 2, }; pub const MC_RED_DRIVE = MC_DRIVE_TYPE.RED_DRIVE; pub const MC_GREEN_DRIVE = MC_DRIVE_TYPE.GREEN_DRIVE; pub const MC_BLUE_DRIVE = MC_DRIVE_TYPE.BLUE_DRIVE; pub const MC_GAIN_TYPE = enum(i32) { RED_GAIN = 0, GREEN_GAIN = 1, BLUE_GAIN = 2, }; pub const MC_RED_GAIN = MC_GAIN_TYPE.RED_GAIN; pub const MC_GREEN_GAIN = MC_GAIN_TYPE.GREEN_GAIN; pub const MC_BLUE_GAIN = MC_GAIN_TYPE.BLUE_GAIN; pub const MC_POSITION_TYPE = enum(i32) { HORIZONTAL_POSITION = 0, VERTICAL_POSITION = 1, }; pub const MC_HORIZONTAL_POSITION = MC_POSITION_TYPE.HORIZONTAL_POSITION; pub const MC_VERTICAL_POSITION = MC_POSITION_TYPE.VERTICAL_POSITION; pub const MC_SIZE_TYPE = enum(i32) { WIDTH = 0, HEIGHT = 1, }; pub const MC_WIDTH = MC_SIZE_TYPE.WIDTH; pub const MC_HEIGHT = MC_SIZE_TYPE.HEIGHT; pub const MC_COLOR_TEMPERATURE = enum(i32) { UNKNOWN = 0, @"4000K" = 1, @"5000K" = 2, @"6500K" = 3, @"7500K" = 4, @"8200K" = 5, @"9300K" = 6, @"10000K" = 7, @"11500K" = 8, }; pub const MC_COLOR_TEMPERATURE_UNKNOWN = MC_COLOR_TEMPERATURE.UNKNOWN; pub const MC_COLOR_TEMPERATURE_4000K = MC_COLOR_TEMPERATURE.@"4000K"; pub const MC_COLOR_TEMPERATURE_5000K = MC_COLOR_TEMPERATURE.@"5000K"; pub const MC_COLOR_TEMPERATURE_6500K = MC_COLOR_TEMPERATURE.@"6500K"; pub const MC_COLOR_TEMPERATURE_7500K = MC_COLOR_TEMPERATURE.@"7500K"; pub const MC_COLOR_TEMPERATURE_8200K = MC_COLOR_TEMPERATURE.@"8200K"; pub const MC_COLOR_TEMPERATURE_9300K = MC_COLOR_TEMPERATURE.@"9300K"; pub const MC_COLOR_TEMPERATURE_10000K = MC_COLOR_TEMPERATURE.@"10000K"; pub const MC_COLOR_TEMPERATURE_11500K = MC_COLOR_TEMPERATURE.@"11500K"; //-------------------------------------------------------------------------------- // Section: Functions (35) //-------------------------------------------------------------------------------- pub extern "USER32" fn GetAutoRotationState( pState: ?*AR_STATE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "USER32" fn GetDisplayAutoRotationPreferences( pOrientation: ?*ORIENTATION_PREFERENCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "USER32" fn SetDisplayAutoRotationPreferences( orientation: ORIENTATION_PREFERENCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetNumberOfPhysicalMonitorsFromHMONITOR( hMonitor: ?HMONITOR, pdwNumberOfPhysicalMonitors: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetNumberOfPhysicalMonitorsFromIDirect3DDevice9( pDirect3DDevice9: ?*IDirect3DDevice9, pdwNumberOfPhysicalMonitors: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetPhysicalMonitorsFromHMONITOR( hMonitor: ?HMONITOR, dwPhysicalMonitorArraySize: u32, pPhysicalMonitorArray: [*]PHYSICAL_MONITOR, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetPhysicalMonitorsFromIDirect3DDevice9( pDirect3DDevice9: ?*IDirect3DDevice9, dwPhysicalMonitorArraySize: u32, pPhysicalMonitorArray: [*]PHYSICAL_MONITOR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn DestroyPhysicalMonitor( hMonitor: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn DestroyPhysicalMonitors( dwPhysicalMonitorArraySize: u32, pPhysicalMonitorArray: [*]PHYSICAL_MONITOR, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetVCPFeatureAndVCPFeatureReply( hMonitor: ?HANDLE, bVCPCode: u8, pvct: ?*MC_VCP_CODE_TYPE, pdwCurrentValue: ?*u32, pdwMaximumValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SetVCPFeature( hMonitor: ?HANDLE, bVCPCode: u8, dwNewValue: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SaveCurrentSettings( hMonitor: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetCapabilitiesStringLength( hMonitor: ?HANDLE, pdwCapabilitiesStringLengthInCharacters: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn CapabilitiesRequestAndCapabilitiesReply( hMonitor: ?HANDLE, pszASCIICapabilitiesString: [*:0]u8, dwCapabilitiesStringLengthInCharacters: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetTimingReport( hMonitor: ?HANDLE, pmtrMonitorTimingReport: ?*MC_TIMING_REPORT, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetMonitorCapabilities( hMonitor: ?HANDLE, pdwMonitorCapabilities: ?*u32, pdwSupportedColorTemperatures: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SaveCurrentMonitorSettings( hMonitor: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetMonitorTechnologyType( hMonitor: ?HANDLE, pdtyDisplayTechnologyType: ?*MC_DISPLAY_TECHNOLOGY_TYPE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetMonitorBrightness( hMonitor: ?HANDLE, pdwMinimumBrightness: ?*u32, pdwCurrentBrightness: ?*u32, pdwMaximumBrightness: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetMonitorContrast( hMonitor: ?HANDLE, pdwMinimumContrast: ?*u32, pdwCurrentContrast: ?*u32, pdwMaximumContrast: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetMonitorColorTemperature( hMonitor: ?HANDLE, pctCurrentColorTemperature: ?*MC_COLOR_TEMPERATURE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetMonitorRedGreenOrBlueDrive( hMonitor: ?HANDLE, dtDriveType: MC_DRIVE_TYPE, pdwMinimumDrive: ?*u32, pdwCurrentDrive: ?*u32, pdwMaximumDrive: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetMonitorRedGreenOrBlueGain( hMonitor: ?HANDLE, gtGainType: MC_GAIN_TYPE, pdwMinimumGain: ?*u32, pdwCurrentGain: ?*u32, pdwMaximumGain: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SetMonitorBrightness( hMonitor: ?HANDLE, dwNewBrightness: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SetMonitorContrast( hMonitor: ?HANDLE, dwNewContrast: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SetMonitorColorTemperature( hMonitor: ?HANDLE, ctCurrentColorTemperature: MC_COLOR_TEMPERATURE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SetMonitorRedGreenOrBlueDrive( hMonitor: ?HANDLE, dtDriveType: MC_DRIVE_TYPE, dwNewDrive: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SetMonitorRedGreenOrBlueGain( hMonitor: ?HANDLE, gtGainType: MC_GAIN_TYPE, dwNewGain: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn DegaussMonitor( hMonitor: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetMonitorDisplayAreaSize( hMonitor: ?HANDLE, stSizeType: MC_SIZE_TYPE, pdwMinimumWidthOrHeight: ?*u32, pdwCurrentWidthOrHeight: ?*u32, pdwMaximumWidthOrHeight: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn GetMonitorDisplayAreaPosition( hMonitor: ?HANDLE, ptPositionType: MC_POSITION_TYPE, pdwMinimumPosition: ?*u32, pdwCurrentPosition: ?*u32, pdwMaximumPosition: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SetMonitorDisplayAreaSize( hMonitor: ?HANDLE, stSizeType: MC_SIZE_TYPE, dwNewDisplayAreaWidthOrHeight: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn SetMonitorDisplayAreaPosition( hMonitor: ?HANDLE, ptPositionType: MC_POSITION_TYPE, dwNewPosition: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn RestoreMonitorFactoryColorDefaults( hMonitor: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "dxva2" fn RestoreMonitorFactoryDefaults( hMonitor: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; //-------------------------------------------------------------------------------- // 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 (15) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BOOLEAN = @import("../foundation.zig").BOOLEAN; const CHAR = @import("../system/system_services.zig").CHAR; const CHAR_INFO = @import("../system/console.zig").CHAR_INFO; const COORD = @import("../system/console.zig").COORD; const DDSCAPS = @import("../graphics/direct_draw.zig").DDSCAPS; const DDSCAPSEX = @import("../graphics/direct_draw.zig").DDSCAPSEX; const HANDLE = @import("../foundation.zig").HANDLE; const HMONITOR = @import("../graphics/gdi.zig").HMONITOR; const HRESULT = @import("../foundation.zig").HRESULT; const IDirect3DDevice9 = @import("../graphics/direct3d9.zig").IDirect3DDevice9; const LARGE_INTEGER = @import("../system/system_services.zig").LARGE_INTEGER; const LUID = @import("../system/system_services.zig").LUID; const PROPERTYKEY = @import("../system/properties_system.zig").PROPERTYKEY; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PVIDEO_WIN32K_CALLOUT")) { _ = PVIDEO_WIN32K_CALLOUT; } @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/devices/display.zig
const std = @import("std"); const allocator = @import("memory.zig").allocator; const state = @import("state.zig"); const enums = @import("enums.zig"); /// hostcallErrors is a wrapper of erred enums.Status. pub const hostcallErrors = error{ NotFound, BadArgument, SerializationFailure, InvalidMemoryAccess, Empty, CasMismatch, }; extern "env" fn proxy_log( enums.LogLevel, [*]const u8, usize, ) enums.Status; /// log emits a message with a given level to the host. pub fn log(level: enums.LogLevel, message: []const u8) hostcallErrors!void { switch (proxy_log(level, message.ptr, message.len)) { .Ok => {}, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } return; } extern "env" fn proxy_set_tick_period_milliseconds( milliseconds: u32, ) enums.Status; /// setTickPeriod sets the interval of onTick function being called for the current context. pub fn setTickPeriod(milliseconds: u32) void { switch (proxy_set_tick_period_milliseconds(milliseconds)) { .Ok => {}, else => unreachable, } } extern "env" fn proxy_set_buffer_bytes( buffer_type: enums.BufferType, start: usize, max_size: usize, data_ptr: [*]const u8, data_size: usize, ) enums.Status; fn setBufferBytes(buffer_type: enums.BufferType, start: usize, max_size: usize, data: []const u8) hostcallErrors!void { switch (proxy_set_buffer_bytes(buffer_type, start, max_size, data.ptr, data.len)) { .Ok => {}, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } /// appendBufferBytes appends the given data to the buffer of a specificed buffer_type. pub fn appendBufferBytes(buffer_type: enums.BufferType, data: []const u8) hostcallErrors!void { try setBufferBytes(buffer_type, std.math.maxInt(usize), 0, data); } /// appendBufferBytes prepends the given data to the buffer of a specificed buffer_type. pub fn prependBufferBytes(buffer_type: enums.BufferType, data: []const u8) hostcallErrors!void { try setBufferBytes(buffer_type, 0, 0, data); } /// appendBufferBytes replaces the buffer of a specificed buffer_type with the given data. pub fn replaceBufferBytes(buffer_type: enums.BufferType, data: []const u8) hostcallErrors!void { try setBufferBytes(buffer_type, 0, std.math.maxInt(usize), data); } /// WasmData holds the byte data allocated by hosts. It is caller's responsibility to deallocate /// it by calling deinit. pub const WasmData = struct { const Self = @This(); raw_data: []const u8, pub fn deinit(self: *Self) void { defer allocator.free(self.raw_data); } }; extern "env" fn proxy_get_buffer_bytes( buffer_type: enums.BufferType, start: usize, max_size: usize, return_buffer_ptr: *[*]const u8, return_buffer_size: *usize, ) enums.Status; /// getBufferBytes returns a WasmData holding the bytes allocated by host for the given buffer_type. pub fn getBufferBytes(buffer_type: enums.BufferType, start: usize, max_size: usize) hostcallErrors!WasmData { var buf_ptr: [*]const u8 = undefined; var buf_len: usize = undefined; switch (proxy_get_buffer_bytes(buffer_type, start, max_size, &buf_ptr, &buf_len)) { .Ok => { return if (buf_ptr == undefined) hostcallErrors.NotFound else WasmData{ .raw_data = buf_ptr[0..buf_len] }; }, .NotFound => return hostcallErrors.NotFound, else => unreachable, } } /// HeaderMap holds the headers map (e.g. request/response HTTP headers/trailers) which is allocated by /// hosts. It is caller's responsibility to deallocate this struct by calling deinit. pub const HeaderMap = struct { const Self = @This(); map: std.StringHashMap([]const u8), raw_data: []const u8, pub fn deinit(self: *Self) void { defer self.map.deinit(); if (self.raw_data.len > 0) { defer allocator.free(self.raw_data); } } }; extern "env" fn proxy_get_header_map_pairs( map_type: enums.MapType, return_buffer_data: *[*]const u8, return_buffer_size: *usize, ) enums.Status; /// getHeaderMap returns a HeaderMap holding the bytes allocated by host for the given map_type. pub fn getHeaderMap(map_type: enums.MapType) !HeaderMap { var buf_ptr: [*]const u8 = undefined; var buf_size: usize = undefined; switch (proxy_get_header_map_pairs(map_type, &buf_ptr, &buf_size)) { .Ok => { var map = std.StringHashMap([]const u8).init(allocator); const num_headers: u32 = std.mem.readIntSliceLittle(u32, buf_ptr[0..4]); var count: usize = 0; var size_index: usize = 4; var data_index: usize = 4 + num_headers * 4 * 2; while (count < num_headers) : (count += 1) { const key_size: u32 = std.mem.readIntSliceLittle(u32, buf_ptr[size_index .. 4 + size_index]); size_index += 4; var key: []const u8 = buf_ptr[data_index .. data_index + key_size]; data_index += key_size + 1; const value_size: u32 = std.mem.readIntSliceLittle(u32, buf_ptr[size_index .. 4 + size_index]); size_index += 4; var value: []const u8 = buf_ptr[data_index .. data_index + value_size]; data_index += value_size + 1; try map.put(key, value); } std.debug.assert(data_index == buf_size); return HeaderMap{ .map = map, .raw_data = buf_ptr[0..buf_size] }; }, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } fn serializeHeaders(map: std.StringHashMap([]const u8)) ![]const u8 { var size: usize = 4; var iter = map.iterator(); while (iter.next()) |header| { size += header.key_ptr.len + header.value_ptr.len + 10; } var buf = try allocator.alloc(u8, size); // Write the number of headers. std.mem.writeIntSliceLittle(usize, buf[0..4], map.count()); // Write the lengths of key/values. var base: usize = 4; iter = map.iterator(); while (iter.next()) |header| { std.mem.writeIntSliceLittle(usize, buf[base .. base + 4], header.key_ptr.len); std.mem.writeIntSliceLittle(usize, buf[base + 4 .. base + 8], header.value_ptr.len); base += 8; } // Write key/valuees. iter = map.iterator(); while (iter.next()) |header| { // Copy key. std.mem.copy(u8, buf[base..], header.key_ptr.*); base += header.key_ptr.len; buf[base] = 0; base += 1; // Copy value. std.mem.copy(u8, buf[base..], header.value_ptr.*); base += header.value_ptr.len; buf[base] = 0; base += 1; } std.debug.assert(base == buf.len); return buf; } extern "env" fn proxy_set_header_map_pairs( map_type: enums.MapType, buf: [*]const u8, size: usize, ) enums.Status; /// replaceHeaderMap *replaces* the underlying map in host with the given map. pub fn replaceHeaderMap(map_type: enums.MapType, map: std.StringHashMap([]const u8)) !void { const buf = try serializeHeaders(map); defer allocator.free(buf); switch (proxy_set_header_map_pairs(map_type, buf.ptr, buf.len)) { .Ok => {}, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_get_header_map_value( map_type: enums.MapType, key_ptr: [*]const u8, key_size: usize, return_value_ptr: *[*]const u8, return_value_size: *usize, ) enums.Status; /// getHeaderMapValue gets the value as WasmData of the given key in the map of map_type. pub fn getHeaderMapValue(map_type: enums.MapType, key: []const u8) hostcallErrors!WasmData { var value_ptr: [*]const u8 = undefined; var value_size: usize = undefined; switch (proxy_get_header_map_value(map_type, key.ptr, key.len, &value_ptr, &value_size)) { .Ok => { return WasmData{ .raw_data = value_ptr[0..value_size] }; }, .NotFound => return hostcallErrors.NotFound, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_replace_header_map_value( map_type: enums.MapType, key_ptr: [*]const u8, key_size: usize, value_ptr: [*]const u8, value_size: usize, ) enums.Status; /// replaceHeaderMapValue replaces the value of the given key in the map of map_type. pub fn replaceHeaderMapValue(map_type: enums.MapType, key: []const u8, value: []const u8) hostcallErrors!void { switch (proxy_replace_header_map_value(map_type, key.ptr, key.len, value.ptr, value.len)) { .Ok => {}, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_remove_header_map_value( map_type: enums.MapType, key_ptr: [*]const u8, key_size: usize, ) enums.Status; /// replaceHeaderMapValue removes the value of the given key in the map of map_type. pub fn removeHeaderMapValue(map_type: enums.MapType, key: []const u8) hostcallErrors!void { switch (proxy_remove_header_map_value(map_type, key.ptr, key.len)) { .Ok => {}, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_add_header_map_value( map_type: enums.MapType, key_ptr: [*]const u8, key_size: usize, value_ptr: [*]const u8, value_size: usize, ) enums.Status; /// replaceHeaderMapValue adds the value of the given key in the map of map_type. pub fn addHeaderMapValue(map_type: enums.MapType, key: []const u8, value: []const u8) hostcallErrors!void { switch (proxy_add_header_map_value(map_type, key.ptr, key.len, value.ptr, value.len)) { .Ok => {}, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_get_property( serialized_path_ptr: [*]const u8, serialized_path_size: usize, return_data_ptr: *[*]const u8, return_size_size: *usize, ) enums.Status; /// getProperty gets the property as WasmData of the given path. pub fn getProperty(path: []const []const u8) !WasmData { if (path.len == 0) { return hostcallErrors.BadArgument; } var size: usize = 0; for (path) |p| { size += p.len + 1; } var serialized_path = try allocator.alloc(u8, size); defer allocator.free(serialized_path); var index: usize = 0; for (path) |p| { std.mem.copy(u8, serialized_path[index .. index + p.len], p); index += p.len; serialized_path[index] = 0; index += 1; } var data_ptr: [*]const u8 = undefined; var data_size: usize = undefined; switch (proxy_get_property(serialized_path.ptr, serialized_path.len, &data_ptr, &data_size)) { .Ok => { return WasmData{ .raw_data = data_ptr[0..data_size] }; }, .NotFound => return hostcallErrors.NotFound, .BadArgument => return hostcallErrors.BadArgument, .SerializationFailure => return hostcallErrors.SerializationFailure, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_get_shared_data( key_ptr: [*]const u8, key_size: usize, return_value_ptr: *[*]const u8, return_value_size: *usize, return_cas: *u32, ) enums.Status; /// getSharedData gets the shared data as WasmData of the given key. /// return_cas can be used for setting a value on the same key via setSharedData call. pub fn getSharedData(key: []const u8, return_cas: *u32) hostcallErrors!WasmData { var value_ptr: [*]const u8 = undefined; var value_size: usize = undefined; switch (proxy_get_shared_data(key.ptr, key.len, &value_ptr, &value_size, return_cas)) { .Ok => { return WasmData{ .raw_data = value_ptr[0..value_size] }; }, .NotFound => return hostcallErrors.NotFound, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_set_shared_data( key_ptr: [*]const u8, key_size: usize, value_ptr: [*]const u8, value_len: usize, cas: u32, ) enums.Status; /// setSharedData sets the shared data as WasmData of the given key and the data. pub fn setSharedData(key: []const u8, data: []const u8, cas: u32) hostcallErrors!void { switch (proxy_set_shared_data(key.ptr, key.len, data.ptr, data.len, cas)) { .Ok => {}, .NotFound => return hostcallErrors.NotFound, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, .CasMismatch => return hostcallErrors.CasMismatch, else => unreachable, } } extern "env" fn proxy_register_shared_queue( name_ptr: [*]const u8, name_size: usize, return_queue_id: *u32, ) enums.Status; /// registerSharedQueue registers the shared queue for the given name, /// and reutrns the quque ID for it. /// onQueueReady is called with the ID when an item is enqueued on this queue. /// Note that the queue ID is allocated per (vm_id, name). pub fn registerSharedQueue(name: []const u8) hostcallErrors!u32 { var queue_id: u32 = undefined; switch (proxy_register_shared_queue(name.ptr, name.len, &queue_id)) { .Ok => return queue_id, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_resolve_shared_queue( vm_id_ptr: [*]const u8, vm_id_size: usize, name_ptr: [*]const u8, name_size: usize, return_queue_id: *u32, ) enums.Status; /// resolveSharedQueue returns the queue ID for the given vm_id and name. /// Note that the queue ID is allocated per (vm_id, name). pub fn resolveSharedQueue(vm_id: []const u8, name: []const u8) hostcallErrors!u32 { var queue_id: u32 = undefined; switch (proxy_resolve_shared_queue(vm_id.ptr, vm_id.len, name.ptr, name.len, &queue_id)) { .Ok => { return queue_id; }, .NotFound => return hostcallErrors.NotFound, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_dequeue_shared_queue( queue_id: u32, return_data_ptr: *[*]const u8, return_data_size: *usize, ) enums.Status; /// dequeueSharedQueue dequeues an item from the queue of queue_id. pub fn dequeueSharedQueue(queue_id: u32) hostcallErrors!WasmData { var data_ptr: [*]const u8 = undefined; var data_size: usize = undefined; switch (proxy_dequeue_shared_queue(queue_id, &data_ptr, &data_size)) { .Ok => { return WasmData{ .raw_data = data_ptr[0..data_size] }; }, .NotFound => return hostcallErrors.NotFound, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, .Empty => return hostcallErrors.Empty, else => unreachable, } } extern "env" fn proxy_enqueue_shared_queue( queue_id: u32, data_ptr: [*]const u8, data_size: usize, ) enums.Status; /// enqueueSharedQueue enqueues an item to the queue of queue_id. pub fn enqueueSharedQueue(queue_id: u32, data: []const u8) hostcallErrors!void { switch (proxy_enqueue_shared_queue(queue_id, data.ptr, data.len)) { .Ok => {}, .NotFound => return hostcallErrors.NotFound, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_continue_stream(stream_type: enums.StreamType) enums.Status; /// continueHttpRequest continues the HTTP request process of the current HTTP context. /// Available after Action.Pause is returend. pub fn continueHttpRequest() void { switch (proxy_continue_stream(enums.StreamType.Request)) { .Ok => {}, else => unreachable, } } /// continueHttpResponse continues the HTTP response process of the current HTTP context. /// Available after Action.Pause is returend. pub fn continueHttpResponse() void { switch (proxy_continue_stream(enums.StreamType.Response)) { .Ok => {}, else => unreachable, } } extern "env" fn proxy_send_local_response( status_code: u32, status_code_details_ptr: [*]const u8, status_code_details_size: usize, body_ptr: [*]const u8, body_size: usize, headers_buf_ptr: [*]const u8, headers_buf_size: usize, grpc_status: i32, ) enums.Status; /// sendLocalResponse sends the HTTP response with the given status, body and headers. /// Caller contexts must return Action.Pause after calling this. pub fn sendLocalResponse( status_code: u32, body: ?[]const u8, headers: ?std.StringHashMap([]const u8), ) !void { var headers_buf: ?[]const u8 = undefined; if (headers) |h| { headers_buf = try serializeHeaders(h); } defer { if (headers_buf) |buf| { allocator.free(buf); } } switch (proxy_send_local_response( status_code, undefined, 0, if (body != null) body.?.ptr else undefined, if (body != null) body.?.len else 0, if (headers_buf != null) headers_buf.?.ptr else undefined, if (headers_buf != null) headers_buf.?.len else 0, -1, )) { .Ok => {}, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_http_call( cluster_ptr: [*]const u8, cluster_size: usize, headers_buf_ptr: [*]const u8, headers_buf_size: usize, body_ptr: [*]const u8, body_size: usize, tailers_buf_ptr: [*]const u8, tailers_buf_size: usize, timeout: u32, return_callout_id: *u32, ) enums.Status; /// dispatchHttpCall dispatches a HTTP call with the given attributes to the cluster. /// Returns a callout ID, and the onHttpCalloutResponse is called with that ID, /// when hosts receives the response to that dipached request. pub fn dispatchHttpCall( cluster: []const u8, headers: ?std.StringHashMap([]const u8), body: ?[]const u8, trailers: ?std.StringHashMap([]const u8), timeout_milliseconds: u32, ) !u32 { var headers_buf: ?[]const u8 = undefined; if (headers) |h| { headers_buf = try serializeHeaders(h); } defer { if (headers_buf) |buf| { allocator.free(buf); } } var trailers_buf: ?[]const u8 = undefined; if (trailers) |h| { trailers_buf = try serializeHeaders(h); } defer { if (trailers_buf) |buf| { allocator.free(buf); } } var callout_id: u32 = undefined; switch (proxy_http_call( cluster.ptr, cluster.len, if (headers_buf != null) headers_buf.?.ptr else undefined, if (headers_buf != null) headers_buf.?.len else 0, if (body != null) body.?.ptr else undefined, if (body != null) body.?.len else 0, if (trailers_buf != null) trailers_buf.?.ptr else undefined, if (trailers_buf != null) trailers_buf.?.len else 0, timeout_milliseconds, &callout_id, )) { .Ok => { state.current_state.registerCalloutId(callout_id); return callout_id; }, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_set_effective_context(context_id: u32) enums.Status; /// setEffectiveContext is used only in the SDK internally. pub fn setEffectiveContext(context_id: u32) void { switch (proxy_set_effective_context(context_id)) { .Ok => {}, else => unreachable, } } extern "env" fn proxy_done() enums.Status; pub fn done() void { switch (proxy_done()) { .Ok => {}, else => unreachable, } } /// defineMetric defines/resolves the metric ID for the given name and metric_type. /// Returns the metric ID which can be used for {get,increment,record}Metric calls. extern "env" fn proxy_define_metric( metric_type: enums.MetricType, name_ptr: [*]const u8, name_size: usize, return_metric_id: *u32, ) enums.Status; pub fn defineMetric(metric_type: enums.MetricType, name: []const u8) hostcallErrors!u32 { var metric_id: u32 = undefined; switch (proxy_define_metric(metric_type, name.ptr, name.len, &metric_id)) { .Ok => return metric_id, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_get_metric( metric_id: u32, return_value: *u64, ) enums.Status; /// getMetric returns the metric value for the given metric ID. pub fn getMetric(metric_id: u32) hostcallErrors!u64 { var value: u64 = undefined; switch (proxy_get_metric(metric_id, &value)) { .Ok => return value, .NotFound => return hostcallErrors.NotFound, .BadArgument => return hostcallErrors.BadArgument, .InvalidMemoryAccess => return hostcallErrors.InvalidMemoryAccess, else => unreachable, } } extern "env" fn proxy_increment_metric( metric_id: u32, offset: i64, ) enums.Status; /// incrementMetric increments the metric for the given metric ID with the offset. pub fn incrementMetric(metric_id: u32, offset: i64) hostcallErrors!void { switch (proxy_increment_metric(metric_id, offset)) { .Ok => {}, .NotFound => return hostcallErrors.NotFound, .BadArgument => return hostcallErrors.BadArgument, else => unreachable, } } extern "env" fn proxy_record_metric( metric_id: u32, value: u64, ) enums.Status; /// recordMetric records the metric for the given metric ID with the value. pub fn recordMetric(metric_id: u32, value: u64) hostcallErrors!void { switch (proxy_record_metric(metric_id, value)) { .Ok => {}, .NotFound => return hostcallErrors.NotFound, .BadArgument => return hostcallErrors.BadArgument, else => unreachable, } }
lib/hostcalls.zig
const std = @import("std"); const concepts = @import("../../../lib.zig").concepts; const DefaultSeed = @import("../../../lib.zig").de.DefaultSeed; pub fn MapAccess( comptime Context: type, comptime Error: type, comptime nextKeySeed: @TypeOf(struct { fn f(c: Context, seed: anytype) Error!?@TypeOf(seed).Value { _ = c; unreachable; } }.f), comptime nextValueSeed: @TypeOf(struct { fn f(c: Context, seed: anytype) Error!@TypeOf(seed).Value { _ = c; unreachable; } }.f), ) type { return struct { pub const @"getty.de.MapAccess" = struct { context: Context, const Self = @This(); pub const Error = Error; pub fn nextKeySeed(self: Self, seed: anytype) KeyReturn(@TypeOf(seed)) { return try nextKeySeed(self.context, seed); } pub fn nextValueSeed(self: Self, seed: anytype) ValueReturn(@TypeOf(seed)) { return try nextValueSeed(self.context, seed); } //pub fn nextEntrySeed(self: Self, kseed: anytype, vseed: anytype) Error!?std.meta.Tuple(.{ @TypeOf(kseed).Value, @TypeOf(vseed).Value }) { //_ = self; //} pub fn nextKey(self: Self, comptime K: type) !?K { var seed = DefaultSeed(K){}; const ds = seed.seed(); return try self.nextKeySeed(ds); } pub fn nextValue(self: Self, comptime V: type) !V { var seed = DefaultSeed(V){}; const ds = seed.seed(); return try self.nextValueSeed(ds); } //pub fn nextEntry(self: Self, comptime K: type, comptime V: type) !?std.meta.Tuple(.{ K, V }) { //_ = self; //} fn KeyReturn(comptime Seed: type) type { comptime concepts.@"getty.de.Seed"(Seed); return Error!?Seed.Value; } fn ValueReturn(comptime Seed: type) type { comptime concepts.@"getty.de.Seed"(Seed); return Error!Seed.Value; } }; pub fn mapAccess(self: Context) @"getty.de.MapAccess" { return .{ .context = self }; } }; }
src/de/interface/access/map.zig
const std = @import("std"); const assert = std.debug.assert; pub const DNA = struct { pub const Unit = "nt"; pub const SupportsStrands = true; pub fn complement(letter: u8) u8 { return switch (letter) { 'A' => 'T', 'G' => 'C', 'C' => 'G', 'T', 'U' => 'A', 'Y' => 'R', 'R' => 'Y', 'W' => 'W', 'S' => 'S', 'K' => 'M', 'M' => 'K', 'D' => 'H', 'V' => 'B', 'H' => 'D', 'B' => 'V', 'N' => 'N', else => letter, }; } pub fn mapToBits(letter: u8) ?u2 { return switch (letter) { 'A' => 0b00, 'C' => 0b01, 'U', 'T' => 0b10, 'G' => 0b11, else => null, }; } const ScoreMatrixSize = 26; const ScoreMatrix = [ScoreMatrixSize][ScoreMatrixSize]i8{ [_]i8{ 2, -4, -4, 2, 0, 0, -4, 2, 0, 0, -4, 0, 2, 2, 0, 0, 0, 2, -4, -4, -4, 2, 2, 0, -4, 0 }, [_]i8{ -4, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 2, 0 }, [_]i8{ -4, 2, 2, -4, 0, 0, -4, 2, 0, 0, -4, 0, 2, 2, 0, 0, 0, -4, 2, -4, -4, 2, -4, 0, 2, 0 }, [_]i8{ 2, 2, -4, 2, 0, 0, 2, 2, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 2, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, [_]i8{ -4, 2, -4, 2, 0, 0, 2, -4, 0, 0, 2, 0, -4, 2, 0, 0, 0, 2, 2, -4, -4, 2, -4, 0, -4, 0 }, [_]i8{ 2, 2, 2, 2, 0, 0, -4, 2, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 2, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, [_]i8{ -4, 2, -4, 2, 0, 0, 2, 2, 0, 0, 2, 0, -4, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 2, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, [_]i8{ 2, 2, 2, 2, 0, 0, -4, 2, 0, 0, -4, 0, 2, 2, 0, 0, 0, 2, 2, -4, -4, 2, 2, 0, 2, 0 }, [_]i8{ 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 2, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, [_]i8{ 2, 2, -4, 2, 0, 0, 2, 2, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, -4, -4, 2, 2, 0, -4, 0 }, [_]i8{ -4, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, -4, -4, 2, -4, 0, 2, 0 }, [_]i8{ -4, 2, -4, 2, 0, 0, -4, 2, 0, 0, 2, 0, -4, 2, 0, 0, 0, -4, -4, 2, 2, -4, 2, 0, 2, 0 }, [_]i8{ -4, 2, -4, 2, 0, 0, -4, 2, 0, 0, 2, 0, -4, 2, 0, 0, 0, -4, -4, 2, 2, -4, 2, 0, 2, 0 }, [_]i8{ 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, -4, -4, 2, 2, 0, 2, 0 }, [_]i8{ 2, 2, -4, 2, 0, 0, -4, 2, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2, -4, 2, 2, 2, 2, 0, 2, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, [_]i8{ -4, 2, 2, 2, 0, 0, -4, 2, 0, 0, 2, 0, 2, 2, 0, 0, 0, -4, 2, 2, 2, 2, 2, 0, 2, 0 }, [_]i8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, }; pub fn score(a: u8, b: u8) i8 { const idx1: usize = a - 'A'; const idx2: usize = b - 'A'; assert(idx1 <= ScoreMatrixSize and idx2 <= ScoreMatrixSize); return ScoreMatrix[idx1][idx2]; } pub fn match(a: u8, b: u8) bool { return score(a, b) > 0; } pub fn matchSymbol(a: u8, b: u8) u8 { if (a == b) return '|'; if (match(a, b)) return '+'; return ' '; } }; test "complement" { try std.testing.expectEqual(DNA.complement('A'), 'T'); try std.testing.expectEqual(DNA.complement('G'), 'C'); try std.testing.expectEqual(DNA.complement('C'), 'G'); try std.testing.expectEqual(DNA.complement('T'), 'A'); try std.testing.expectEqual(DNA.complement('U'), 'A'); } test "bit mapping" { try std.testing.expectEqual(DNA.mapToBits('A'), 0b00); try std.testing.expectEqual(DNA.mapToBits('C'), 0b01); try std.testing.expectEqual(DNA.mapToBits('U'), 0b10); try std.testing.expectEqual(DNA.mapToBits('T'), 0b10); try std.testing.expectEqual(DNA.mapToBits('G'), 0b11); try std.testing.expectEqual(DNA.mapToBits('N'), null); } test "scoring" { try std.testing.expectEqual(DNA.score('A', 'A'), 2); try std.testing.expectEqual(DNA.score('A', 'T'), -4); try std.testing.expectEqual(DNA.score('A', 'M'), 2); // M = amino (A, C) } test "match" { try std.testing.expectEqual(DNA.match('A', 'A'), true); try std.testing.expectEqual(DNA.match('C', 'G'), false); try std.testing.expectEqual(DNA.match('G', 'G'), true); try std.testing.expectEqual(DNA.match('K', 'U'), true); // K = keto (T/U G) try std.testing.expectEqual(DNA.match('K', 'M'), false); }
src/bio/alphabet/dna.zig
const std = @import("std"); const nc = @import("notcurses.zig"); const time = @import("time.zig"); const BOX_NUM: usize = 10; const c_red: u32 = 14101551; const c_yel: u32 = 16764969; const c_blu: u32 = 3950975; const c_whi: u32 = 16711422; const box_colors = [BOX_NUM]u32{ c_red, c_whi, c_yel, c_whi, c_blu, c_whi, c_blu, c_yel, c_red, c_whi }; fn linear_transition(start: anytype, end: anytype, duration: u64, diff: u64) @TypeOf(start) { return (start + @intCast(@TypeOf(start), @divTrunc((end - start) * @intCast(i64, diff), @intCast(i64, duration)))); } fn transition_rgb(start: u32, end: u32, duration: u64, diff: u64) u32 { var rgb: u32 = 0; var r = linear_transition(@intCast(c_int, nc.ncchannel_r(start)), @intCast(c_int, nc.ncchannel_r(end)), duration, diff); var g = linear_transition(@intCast(c_int, nc.ncchannel_g(start)), @intCast(c_int, nc.ncchannel_g(end)), duration, diff); var b = linear_transition(@intCast(c_int, nc.ncchannel_b(start)), @intCast(c_int, nc.ncchannel_b(end)), duration, diff); nc.ncchannel_set_rgb8_clipped(&rgb, r, g, b); return rgb; } fn transition_box(start: [4]c_int, end: [4]c_int, duration: u64, diff: u64) [4]c_int { var coords: [4]c_int = undefined; { var i: usize = 0; while (i < coords.len) : (i += 1) { coords[i] = linear_transition(start[i], end[i], duration, diff); } } return coords; } fn make_boxes_start(dimy: anytype, dimx: anytype) [BOX_NUM][4]c_int { var bs: [BOX_NUM][4]c_int = undefined; { var i: usize = 0; while (i < bs.len) : (i += 1) { var y: c_int = -1; var x: c_int = @divTrunc(dimx, 2); bs[i][0] = y; bs[i][1] = x; bs[i][2] = y + 2; bs[i][3] = x + 4; } } return bs; } fn make_boxes_bottom_out(dimy: anytype, dimx: anytype) [BOX_NUM][4]c_int { var bs: [BOX_NUM][4]c_int = undefined; { var i: usize = 0; while (i < bs.len) : (i += 1) { var y: c_int = (dimy + 4); var x: c_int = @divTrunc(dimx, 2); bs[i][0] = y; bs[i][1] = x; bs[i][2] = y + 2; bs[i][3] = x + 4; } } return bs; } fn make_boxes_arranged(dimy: anytype, dimx: anytype) [BOX_NUM][4]c_int { var x0: c_int = 2; var x1 = @divFloor(dimx * 40, 100); var x2 = @divFloor(dimx * 55, 100); var x3 = @divFloor(dimx * 85, 100); var x4 = dimx; var y0: c_int = 1; var y1 = @divFloor(dimy * 18, 100); var y2 = @divFloor(dimy * 22, 100); var y3 = @divFloor(dimy * 35, 100); var y4 = @divFloor(dimy * 55, 100); var y5 = @divFloor(dimy * 70, 100); var y6 = dimy; var bs = [BOX_NUM][4]c_int{ .{ y0, x0, y5, x1 }, .{ y5, x0, y6, x1 }, .{ y0, x1, y2, x2 }, .{ y2, x1, y5, x2 }, .{ y5, x1, y6, x2 }, .{ y0, x2, y3, x3 }, .{ y3, x2, y4, x3 }, .{ y4, x2, y6, x4 }, .{ y0, x3, y1, x4 }, .{ y1, x3, y4, x4 } }; return bs; } fn make_boxes_grid(dimy: anytype, dimx: anytype) [BOX_NUM][4]c_int { const boxh: c_int = @divTrunc(dimy, 5); const boxw: c_int = (boxh * 2); var y0 = @divFloor(dimy * 20, 100); var x0 = @divFloor(dimx * 20, 100); var bs: [BOX_NUM][4]c_int = undefined; { var i: usize = 0; while (i < bs.len) : (i += 1) { const row: c_int = @divFloor(@intCast(c_int, i), 5); const col: c_int = @mod(@intCast(c_int, i), 5); const shifted = (@mod(col, 2) == 0); const y = (y0 + (row * (boxh + @divTrunc(boxh, 2))) + if (shifted) @divTrunc(boxh, 2) + 1 else 0); const x = (x0 + (col * (boxw + 2))); bs[i][0] = y; bs[i][1] = x; bs[i][2] = y + boxh; bs[i][3] = x + boxw; } } return bs; } fn box_ylen(box: [4]c_int) c_int { return (box[2] - box[0] - 1); } fn box_xlen(box: [4]c_int) c_int { return (box[3] - box[1] - 2); } fn make_box_planes(n: *nc.ncplane, planes: []*nc.ncplane) void { { var i: usize = 0; while (i < planes.len) : (i += 1) { var opts = nc.default_ncplane_options; opts.rows = 1; opts.cols = 1; const plane = nc.ncplane_create(n, &opts); planes[i] = plane.?; } } } fn draw_boxes_colored(planes: [BOX_NUM]*nc.ncplane) !void { { var i: usize = 0; while (i < planes.len) : (i += 1) { var chans: u64 = 0; try nc.err(nc.ncchannels_set_bg_rgb(&chans, box_colors[i])); const plane = planes[i]; try nc.err(nc.ncplane_set_base(plane, " ", 0, chans)); nc.ncplane_erase(plane); } } } fn draw_boxes_gradients(planes: [BOX_NUM]*nc.ncplane) !void { { var i: usize = 0; while (i < planes.len) : (i += 1) { const plane = planes[i]; const ur: u32 = (16777215 | nc.NC_BGDEFAULT_MASK); const ul: u32 = (box_colors[i] | @intCast(u32, nc.NC_BGDEFAULT_MASK)); const lr: u32 = (box_colors[i] | @intCast(u32, nc.NC_BGDEFAULT_MASK)); const ll: u32 = (0 | nc.NC_BGDEFAULT_MASK); try nc.err(nc.ncplane_highgradient(plane, ul, ur, ll, lr, nc.ncplane_dim_y(plane) - 1, nc.ncplane_dim_x(plane) - 1)); } } } fn draw_boxes_bordered(planes: [BOX_NUM]*nc.ncplane) !void { { var i: usize = 0; while (i < planes.len) : (i += 1) { var plane = planes[i]; nc.ncplane_erase(plane); try nc.err(nc.ncplane_cursor_move_yx(plane, 0, 0)); _ = nc.ncplane_rounded_box(plane, 0, 0, nc.ncplane_dim_y(plane) - 1, nc.ncplane_dim_x(plane) - 1, 0); } } } fn reposition_plane(plane: *nc.ncplane, box: [4]c_int) !void { try nc.err(nc.ncplane_move_yx(plane, box[0], box[1])); try nc.err(nc.ncplane_resize_simple(plane, box_ylen(box), box_xlen(box))); } fn reposition_planes(planes: [BOX_NUM]*nc.ncplane, boxes: [BOX_NUM][4]c_int) !void { { var i: usize = 0; while (i < planes.len) : (i += 1) { try reposition_plane(planes[i], boxes[i]); } } } fn make_message_box(parent: *nc.ncplane, windowy: c_int, windowx: c_int) !*nc.ncplane { const l1 = "Notcurses by <NAME> et al"; const l2 = "Zig lang by <NAME> & community"; const l3 = "Liz lang & demo by <NAME>"; const l4 = "Press q to quit"; var opts = nc.default_ncplane_options; opts.rows = 5 + 2; opts.cols = l2.len + 4; opts.x = 4; opts.y = windowy - opts.rows - 2; const plane = nc.ncplane_create(parent, &opts).?; var chans: u64 = 0; try nc.err(nc.ncchannels_set_bg_rgb(&chans, 0)); try nc.err(nc.ncchannels_set_bg_alpha(&chans, nc.NCALPHA_BLEND)); try nc.err(nc.ncplane_set_base(plane, " ", 0, chans)); var border_chans: u64 = 0; try nc.err(nc.ncchannels_set_fg_rgb(&border_chans, c_red)); _ = nc.ncplane_rounded_box(plane, 0, border_chans, nc.ncplane_dim_y(plane) - 1, nc.ncplane_dim_x(plane) - 1, 0); try nc.err(nc.ncplane_putstr_yx(plane, 1, 2, l1)); try nc.err(nc.ncplane_putstr_yx(plane, 2, 2, l2)); try nc.err(nc.ncplane_putstr_yx(plane, 3, 2, l3)); try nc.err(nc.ncplane_putstr_yx(plane, 5, 2, l4)); return plane; } var box_planes: [BOX_NUM]*nc.ncplane = undefined; var boxes_start: [BOX_NUM][4]c_int = undefined; var boxes_bottom_out: [BOX_NUM][4]c_int = undefined; var boxes_grid: [BOX_NUM][4]c_int = undefined; var boxes_arranged: [BOX_NUM][4]c_int = undefined; var message_box: *nc.ncplane = undefined; const step_ns: u64 = (time.NANOSECS_IN_SEC / 60); const PositionContext = struct { from: c_int, to: c_int, }; fn run_transition(ncs: *nc.notcurses, duration: u64, ctx: anytype, render: fn (@TypeOf(ctx), u64, u64) nc.Error!void) !void { var time_start: u64 = time.get_time_ns(); var t: u64 = time_start; while (t < (time_start + duration)) : (t = time.get_time_ns()) { try render(ctx, t - time_start, duration); try nc.err(nc.notcurses_render(ncs)); time.sleep_until_ns(t + step_ns); } try render(ctx, duration, duration); try nc.err(nc.notcurses_render(ncs)); } fn run_serial_transition(ncs: *nc.notcurses, duration: u64, render: fn (usize, u64, u64) nc.Error!void) !void { { var i: usize = 0; while (i < BOX_NUM) : (i += 1) { try run_transition(ncs, duration, i, render); } } } pub fn main() !void { var nc_opts: nc.notcurses_options = nc.default_notcurses_options; var ncs: *nc.notcurses = (nc.notcurses_core_init(&nc_opts, null) orelse @panic("notcurses_core_init() failed")); defer _ = nc.notcurses_stop(ncs); var dimy: c_int = undefined; var dimx: c_int = undefined; var n: *nc.ncplane = (nc.notcurses_stddim_yx(ncs, &dimy, &dimx) orelse unreachable); dimx = std.math.max(dimx, 80); dimy = std.math.max(dimy, 25); var std_chan: u64 = 0; try nc.err(nc.ncchannels_set_bg_rgb(&std_chan, 0)); try nc.err(nc.ncplane_set_base(n, " ", 0, std_chan)); make_box_planes(n, &box_planes); boxes_start = make_boxes_start(dimy, dimx); boxes_bottom_out = make_boxes_bottom_out(dimy, dimx); boxes_grid = make_boxes_grid(dimy, dimx); boxes_arranged = make_boxes_arranged(dimy, dimx); try run_serial_transition(ncs, 3.0E8, struct { fn render(i: usize, diff: u64, duration: u64) nc.Error!void { try reposition_plane(box_planes[i], transition_box(boxes_start[i], boxes_grid[i], duration, diff)); try draw_boxes_bordered(box_planes); } }.render); try run_transition(ncs, 1.0E9, {}, struct { fn render(ctx: void, diff: u64, duration: u64) nc.Error!void { { var i: usize = 0; while (i < box_planes.len) : (i += 1) { try reposition_plane(box_planes[i], transition_box(boxes_grid[i], boxes_arranged[i], duration, diff)); } } try draw_boxes_bordered(box_planes); } }.render); try run_serial_transition(ncs, 1.5E8, struct { fn render(i: usize, diff: u64, duration: u64) nc.Error!void { const plane = box_planes[i]; var chans: u64 = 0; _ = nc.ncchannels_set_bchannel(&chans, transition_rgb(3355443, 0, duration, diff)); _ = nc.ncchannels_set_fchannel(&chans, transition_rgb(15921906, 0, duration, diff)); try nc.err(nc.ncplane_set_base(plane, " ", 0, chans)); try draw_boxes_bordered(box_planes); } }.render); try run_serial_transition(ncs, 1.5E8, struct { fn render(i: usize, diff: u64, duration: u64) nc.Error!void { const plane = box_planes[i]; var chans: u64 = 0; _ = nc.ncchannels_set_bchannel(&chans, transition_rgb(0, box_colors[i], duration, diff)); try nc.err(nc.ncplane_set_base(plane, " ", 0, chans)); nc.ncplane_erase(plane); } }.render); try run_serial_transition(ncs, 1.5E8, struct { fn render(i: usize, diff: u64, duration: u64) nc.Error!void { const plane = box_planes[i]; const ur: u32 = (transition_rgb(box_colors[i], 16777215, duration, diff) | @intCast(u32, nc.NC_BGDEFAULT_MASK)); const ul: u32 = (box_colors[i] | @intCast(u32, nc.NC_BGDEFAULT_MASK)); const lr: u32 = (box_colors[i] | @intCast(u32, nc.NC_BGDEFAULT_MASK)); const ll: u32 = (transition_rgb(box_colors[i], 0, duration, diff) | @intCast(u32, nc.NC_BGDEFAULT_MASK)); try nc.err(nc.ncplane_highgradient(plane, ul, ur, ll, lr, nc.ncplane_dim_y(plane) - 1, nc.ncplane_dim_x(plane) - 1)); } }.render); message_box = (try make_message_box(n, dimy, dimx)); try run_transition(ncs, 3.0E8, PositionContext{ .from = (-nc.ncplane_dim_x(message_box)), .to = nc.ncplane_x(message_box), }, struct { fn render(ctx: PositionContext, diff: u64, duration: u64) nc.Error!void { const x: c_int = linear_transition(ctx.from, ctx.to, duration, diff); try nc.err(nc.ncplane_move_yx(message_box, nc.ncplane_y(message_box), x)); } }.render); outer: { var loop: usize = 0; while (true) : (loop += 1) { var duration: u64 = 1.0E9; var time_start: u64 = time.get_time_ns(); var t: u64 = time_start; while (t < (time_start + duration)) : (t = time.get_time_ns()) { { var i: usize = 0; while (i < box_planes.len) : (i += 1) { var plane = box_planes[i]; var i_next = ((i + 1) % BOX_NUM); const colors = [4]u32{ box_colors[i], 16777215, box_colors[i], 0 }; var corners: [4]u32 = undefined; { var j: usize = 0; while (j < 4) : (j += 1) { corners[j] = @intCast(u32, nc.NC_BGDEFAULT_MASK) | transition_rgb(colors[((loop + j) % 4)], colors[((j + loop + 1) % 4)], duration, t - time_start); } } try nc.err(nc.ncplane_highgradient(plane, corners[0], corners[1], corners[3], corners[2], nc.ncplane_dim_y(plane) - 1, nc.ncplane_dim_x(plane) - 1)); } } try nc.err(nc.notcurses_render(ncs)); time.sleep_until_ns(t + step_ns); var keypress: c_uint = nc.notcurses_getc_nblock(ncs, null); if (keypress == 'q') { break :outer; } } } } }
src/main.zig
const std = @import("std"); const stdx = @import("stdx"); const t = stdx.testing; const log = stdx.log.scoped(.builder); const string = stdx.string; const grammar = @import("grammar.zig"); const CharSetRangeSlice = grammar.CharSetRangeSlice; const CharSlice = grammar.CharSlice; const Grammar = grammar.Grammar; const TokenMatchOpId = grammar.TokenMatchOpId; const TokenMatchOp = grammar.TokenMatchOp; const TokenMatchOpSlice = grammar.TokenMatchOpSlice; const MatchOpId = grammar.MatchOpId; const MatchOp = grammar.MatchOp; const MatchOpSlice = grammar.MatchOpSlice; const _ast = @import("ast.zig"); const Tree = _ast.Tree; const _parser = @import("parser.zig"); const NodeTag = _parser.NodeTag; const NodePtr = _parser.NodePtr; const Parser = _parser.Parser; const ParseConfig = _parser.ParseConfig; const grammars = @import("grammars.zig"); // Builds parser grammars. // Creates a grammar to parse the grammar format. // Since parsers currently only exist at runtime, we need to hardcode the rules. pub fn initMetaGrammar(c: *Grammar, alloc: std.mem.Allocator) void { c.init(alloc, "Grammar"); const op = c.addOp; const top = c.addTokenOp; const ops = c.addOps; const tops = c.addTokenOps; c.addRule("Grammar", matchZeroOrMore( op(c.matchRule("Declaration")), )); c.addInlineRule("Declaration", matchChoice(ops(&.{ c.matchRule("RuleDeclaration"), c.matchRule("TokensDeclaration"), }))); c.addRule("TokensDeclaration", matchSeq(ops(&.{ c.matchTokText("Directive", "@tokens"), c.matchLiteral("{"), matchZeroOrMore( op(c.matchRule("TokenDeclaration")), ), c.matchLiteral("}"), }))); c.addRule("TokenDeclaration", matchSeq(ops(&.{ c.matchTokCap("Identifier"), matchZeroOrMore( op(c.matchRule("RuleDirective")), ), c.matchLiteral("{"), c.matchRule("Seq"), c.matchLiteral("}"), }))); c.addRule("Seq", matchOneOrMore(op( matchChoice(ops(&.{ c.matchRule("Choice"), c.matchRule("Term"), })), ))); c.addRule("Choice", matchSeq(ops(&.{ c.matchRule("Term"), matchOneOrMore(op( matchSeq(ops(&.{ c.matchLiteralCap("|"), c.matchRule("Term"), })), )), }))); c.addRule("RuleMatcher", matchSeq(ops(&.{ c.matchRule("Identifier"), matchOptional( op(matchSeq(ops(&.{ c.matchLiteral("="), c.matchRule("StringLiteral"), }))), ), }))); c.addRule("Term", matchSeq(ops(&.{ matchOptional( op(matchChoice(ops(&.{ c.matchLiteralCap("!"), c.matchLiteralCap("&"), }))), ), matchChoice(ops(&.{ c.matchRule("RuleMatcher"), c.matchRule("StringLiteral"), c.matchRule("Directive"), c.matchRule("CharSetLiteral"), matchSeq(ops(&.{ c.matchLiteral("("), c.matchRule("Seq"), c.matchLiteral(")"), })), })), matchOptional( op(matchChoice(ops(&.{ c.matchLiteralCap("*"), c.matchLiteralCap("+"), c.matchLiteralCap("?"), }))), ), }))); c.addRule("RuleDeclaration", matchSeq(ops(&.{ c.matchTokCap("Identifier"), matchZeroOrMore( op(c.matchRule("RuleDirective")), ), c.matchLiteral("{"), c.matchRule("Seq"), c.matchLiteral("}"), }))); c.addRule("RuleDirective", matchSeq(ops(&.{ c.matchTokCap("Directive"), matchOptional( op(matchSeq(ops(&.{ c.matchLiteral("("), // Support just one param for now. c.matchRule("Identifier"), c.matchLiteral(")"), }))), ), }))); c.addTokenRule("Directive", matchTokenSeq(tops(&.{ matchExactChar('@'), matchTokenOneOrMore(top(matchAsciiLetter())), }))); c.addTokenRule("Identifier", matchTokenOneOrMore(top(matchAsciiLetter()))); c.addTokenRule("CharSetLiteral", matchTokenSeq(tops(&.{ matchExactChar('['), matchUntilChar(']'), }))); c.addTokenRule("StringLiteral", matchTokenSeq(tops(&.{ matchExactChar('\''), matchTokenOneOrMore(top( matchTokenChoice(tops(&.{ c.tokMatchText("\\\\"), c.tokMatchText("\\'"), matchNotChar('\''), })), )), matchExactChar('\''), }))); c.addTokenRuleExt("Punctuator", matchTokenChoice(tops(&.{ matchExactChar('{'), matchExactChar('}'), matchExactChar('('), matchExactChar(')'), matchExactChar('*'), matchExactChar('+'), matchExactChar('?'), matchExactChar('|'), matchExactChar('!'), matchExactChar('&'), matchExactChar('='), })), true, false, null); c.build(alloc); } test "initMetaGrammar" { var c: Grammar = undefined; initMetaGrammar(&c, t.alloc); defer c.deinit(); const grammar_src = \\Program { Statement* } \\Statement @inline { ReturnStatement } \\ReturnStatement { 'return' Identifier } \\@tokens { \\ Identifier { [a-zA-Z] [a-zA-Z0-9_]* } \\ Keyword @literal @replace(Identifier) { 'return' } \\} ; var zig_grammar: Grammar = undefined; try initGrammar(&zig_grammar, t.alloc, grammar_src); defer zig_grammar.deinit(); // Test parsing decls. const NumDeclsGeneratedFromTokenDecls = 2; try t.eq(zig_grammar.decls.items.len, 3 + NumDeclsGeneratedFromTokenDecls); try t.eq(zig_grammar.token_decls.items.len, 2); // Test parsing repetition "*" operator. const program_decl = zig_grammar.findRuleDecl("Program").?; var op = zig_grammar.getMatchOp(program_decl.ops.start); try t.eqUnionEnum(op, .MatchZeroOrMore); const inner_op = zig_grammar.getMatchOp(op.MatchZeroOrMore.op_id); try t.eqStr(zig_grammar.getString(inner_op.MatchRule.name), "Statement"); // Test parsing @inline. const statement_decl = zig_grammar.findRuleDecl("Statement").?; try t.eq(statement_decl.is_inline, true); } fn BuildConfigContext(comptime Config: ParseConfig) type { return struct { const Self = @This(); RuleMatcher: NodeTag, Identifier: NodeTag, StringLiteral: NodeTag, Directive: NodeTag, Seq: NodeTag, Term: NodeTag, Choice: NodeTag, CharSetLiteral: NodeTag, op_list_stack: *std.ArrayList(MatchOp), top_list_stack: *std.ArrayList(TokenMatchOp), ast: Tree(Config), config: *Grammar, // Given a match op expression node, recursively add match ops to the config. // Uses a stack to accumulate a list of child ops. // Adds child ops to config but returns the current op. fn buildMatchOpFromExprNode(self: *Self, node: NodePtr) MatchOp { if (node.tag == self.Seq) { const save_state = self.op_list_stack.items.len; const terms = self.ast.getChildNodeList(node, 0); for (terms) |it| { if (it.tag == self.Term) { const op = self.buildMatchOpFromTerm(it); self.op_list_stack.append(op) catch unreachable; } else if (it.tag == self.Choice) { const op = self.buildMatchOpFromExprNode(it); self.op_list_stack.append(op) catch unreachable; } else { stdx.panicFmt("unsupported {s}", .{self.ast.grammar.getNodeTagName(it.tag)}); } } const ops = self.op_list_stack.items[save_state..]; if (ops.len == 1) { // Reduce to single child op. const op = ops[0]; self.op_list_stack.shrinkRetainingCapacity(save_state); return op; } else { const op = matchSeq(self.config.addOps(ops)); self.op_list_stack.shrinkRetainingCapacity(save_state); return op; } } else if (node.tag == self.Choice) { const save_state = self.op_list_stack.items.len; const first_term = self.ast.getChildNode(node, 0); const first_op = self.buildMatchOpFromTerm(first_term); self.op_list_stack.append(first_op) catch unreachable; const terms = self.ast.getChildNodeList(node, 1); for (terms) |it| { if (it.tag == self.Term) { const op = self.buildMatchOpFromTerm(it); self.op_list_stack.append(op) catch unreachable; } else { stdx.panicFmt("unsupported {s}", .{self.ast.grammar.getNodeTagName(it.tag)}); } } const ops = self.op_list_stack.items[save_state..]; if (ops.len == 1) { // Reduce to single child op. const op = ops[0]; self.op_list_stack.shrinkRetainingCapacity(save_state); return op; } else { const op = matchChoice(self.config.addOps(ops)); self.op_list_stack.shrinkRetainingCapacity(save_state); return op; } } else { stdx.panicFmt("unsupported {}", .{node.tag}); } } // Add the smallest single term op into the config. fn buildMatchOpFromTerm(self: *Self, term: NodePtr) MatchOp { const mb_pred = self.ast.getChildNodeOpt(term, 0); const inner = self.ast.getChildNode(term, 1); const mb_reps = self.ast.getChildNodeOpt(term, 2); var op: MatchOp = undefined; if (inner.tag == self.RuleMatcher) { const rule_ident = self.ast.getChildNode(inner, 0); const mb_eq_str = self.ast.getChildNodeOpt(inner, 1); const rule_name = self.ast.getChildStringValue(rule_ident, 0); if (mb_eq_str) |eq_str| { const str = self.ast.getChildStringValue(eq_str, 0); const without_quotes = str[1 .. str.len - 1]; op = self.config.matchTokText(rule_name, without_quotes); } else { op = self.config.matchRule(rule_name); } } else if (inner.tag == self.StringLiteral) { const text = self.ast.getChildStringValue(inner, 0); const without_quotes = text[1 .. text.len - 1]; op = self.config.matchLiteral(without_quotes); } else if (inner.tag == self.Seq) { op = self.buildMatchOpFromExprNode(inner); } else { stdx.panicFmt("unsupported {s}", .{self.ast.grammar.getNodeTagName(inner.tag)}); } // Wrap with repetition op. if (mb_reps) |reps| { const ch = self.ast.getNodeTokenChar(reps); op = switch (ch) { '*' => matchZeroOrMore(self.config.addOp(op)), '?' => matchOptional(self.config.addOp(op)), '+' => matchOneOrMore(self.config.addOp(op)), else => stdx.panicFmt("unsupported {c}", .{ch}), }; } // Wrap with lookahead op. if (mb_pred) |pred| { const ch = self.ast.getNodeTokenChar(pred); op = switch (ch) { '&' => matchPosLookahead(self.config.addOp(op)), '!' => matchNegLookahead(self.config.addOp(op)), else => stdx.panicFmt("unsupported {c}", .{ch}), }; } return op; } fn buildTokenMatchOpFromTerm(self: *Self, term: NodePtr) TokenMatchOp { const mb_pred = self.ast.getChildNodeOpt(term, 0); const base = self.ast.getChildNode(term, 1); const mb_reps = self.ast.getChildNodeOpt(term, 2); var op = buildTokenMatchOpFromTermBase(self, base); // Wrap with repetition op. if (mb_reps) |reps| { const ch = self.ast.getNodeTokenChar(reps); op = switch (ch) { '*' => matchTokenZeroOrMore(self.config.addTokenOp(op)), '+' => matchTokenOneOrMore(self.config.addTokenOp(op)), '?' => matchTokenOptional(self.config.addTokenOp(op)), else => stdx.panicFmt("unsupported {c}", .{ch}), }; } // Wrap with predicate op. if (mb_pred) |pred| { const ch = self.ast.getNodeTokenChar(pred); op = switch (ch) { '!' => matchTokenNegLookahead(self.config.addTokenOp(op)), '&' => matchTokenPosLookahead(self.config.addTokenOp(op)), else => stdx.panicFmt("unsupported {c}", .{ch}), }; } return op; } fn buildTokenMatchOpFromTermBase(self: *Self, term: NodePtr) TokenMatchOp { if (term.tag == self.StringLiteral) { const text = self.ast.getChildStringValue(term, 0); const without_quotes = text[1 .. text.len - 1]; const final_text = unescapeText(self.config, without_quotes); return .{ .MatchText = .{ .str = final_text } }; } else if (term.tag == self.CharSetLiteral) { const text = self.ast.getChildStringValue(term, 0); // Truncate the surrounding bracket chars. const without_delim = text[1 .. text.len - 1]; var chars: CharSlice = undefined; var char_ranges: CharSetRangeSlice = undefined; var negate: bool = undefined; parseCharSet(self.config, &chars, &char_ranges, &negate, without_delim); // log.warn("CHARSET PARAMS: {s} {}", .{chars, char_ranges}); // var i: u32 = char_ranges.start; // while (i < char_ranges.end) : (i += 1) { // const range = self.config.charset_range_buf.items[i]; // log.warn("{c} - {c}", .{range.start, range.end_incl}); // } if (!negate) { return matchTokenCharSet(chars, char_ranges); } else { return matchTokenNotCharSet(chars, char_ranges); } } else if (term.tag == self.Directive) { const dir = self.ast.getChildStringValue(term, 0); if (stdx.string.eq(dir, "@asciiLetter")) { return matchAsciiLetter(); } else { stdx.panicFmt("unsupported directive {s}", .{dir}); } } else if (term.tag == self.Seq) { return self.buildTokenMatchOpFromNode(term); } else if (term.tag == self.RuleMatcher) { const rule_ident = self.ast.getChildNode(term, 0); const rule_name = self.ast.getChildStringValue(rule_ident, 0); const mb_eq_str = self.ast.getChildNodeOpt(term, 1); if (mb_eq_str) |eq_str| { const str = self.ast.getChildStringValue(eq_str, 0); _ = str; stdx.unsupported(); } else { return matchTokenRule(rule_name); } } else { stdx.panicFmt("unsupported {s}", .{self.ast.grammar.getNodeTagName(term.tag)}); } } fn buildTokenMatchOpFromNode(self: *Self, node: NodePtr) TokenMatchOp { if (node.tag == self.Seq) { const save_state = self.top_list_stack.items.len; const terms = self.ast.getChildNodeList(node, 0); for (terms) |it| { if (it.tag == self.Term) { const op = buildTokenMatchOpFromTerm(self, it); self.top_list_stack.append(op) catch unreachable; } else if (it.tag == self.Choice) { const op = buildTokenMatchOpFromNode(self, it); self.top_list_stack.append(op) catch unreachable; } else { stdx.panicFmt("unsupported {s}", .{self.ast.grammar.getNodeTagName(it.tag)}); } } const ops = self.top_list_stack.items[save_state..]; if (ops.len == 1) { // Reduce to single child op. const op = ops[0]; self.top_list_stack.shrinkRetainingCapacity(save_state); return op; } else { const op = matchTokenSeq(self.config.addTokenOps(ops)); self.top_list_stack.shrinkRetainingCapacity(save_state); return op; } } else if (node.tag == self.Choice) { const save_state = self.top_list_stack.items.len; const first_term = self.ast.getChildNode(node, 0); const first_op = buildTokenMatchOpFromTerm(self, first_term); self.top_list_stack.append(first_op) catch unreachable; const terms = self.ast.getChildNodeList(node, 1); for (terms) |it| { if (it.tag == self.Term) { const op = buildTokenMatchOpFromTerm(self, it); self.top_list_stack.append(op) catch unreachable; } else { stdx.panicFmt("unsupported {s}", .{self.ast.grammar.getNodeTagName(it.tag)}); } } const ops = self.top_list_stack.items[save_state..]; if (ops.len == 1) { const op = ops[0]; self.top_list_stack.shrinkRetainingCapacity(save_state); return op; } else { const op = matchTokenChoice(self.config.addTokenOps(ops)); self.top_list_stack.shrinkRetainingCapacity(save_state); return op; } } else { stdx.panicFmt("unsupported {}", .{node.tag}); } } }; } pub fn initGrammar(c: *Grammar, alloc: std.mem.Allocator, src: []const u8) !void { var gc: Grammar = undefined; initMetaGrammar(&gc, alloc); defer gc.deinit(); const Config = ParseConfig{ .is_incremental = false }; var parser = Parser.init(alloc, &gc); defer parser.deinit(); var debug: _parser.DebugInfo = undefined; debug.init(t.alloc); defer debug.deinit(); var res = parser.parseDebug(Config, src, &debug); defer res.deinit(); var str_buf = std.ArrayList(u8).init(alloc); defer str_buf.deinit(); if (!res.success) { str_buf.clearRetainingCapacity(); res.ast.formatContextAtToken(str_buf.writer(), res.err_token_id); log.warn("{s}", .{str_buf.items}); // str_buf.clearRetainingCapacity(); // res.ast.formatTokens(str_buf.writer()); // log.warn("Tokens: {s}", .{str_buf.items}); str_buf.clearRetainingCapacity(); debug.formatMaxCallStack(Config, &res.ast, str_buf.writer()); log.warn("{s}", .{str_buf.items}); return error.ParseError; } // var str_buf = std.ArrayList(u8).init(alloc); // defer str_buf.deinit(); // grammar_ast.formatTree(str_buf.writer()); // log.warn("Tree: {s}", .{str_buf.items}); initGrammarFromAst(Config, c, alloc, res.ast); } pub fn initGrammarFromAst(comptime Config: ParseConfig, c: *Grammar, alloc: std.mem.Allocator, ast: Tree(Config)) void { const root = ast.mb_root.?; c.init(alloc, "Program"); // Tags. const RuleDeclaration = ast.grammar.findRuleDeclId("RuleDeclaration").?; const TokensDeclaration = ast.grammar.findRuleDeclId("TokensDeclaration").?; const TokenDeclaration = ast.grammar.findRuleDeclId("TokenDeclaration").?; const RuleDirective = ast.grammar.findRuleDeclId("RuleDirective").?; var op_list_stack = std.ArrayList(MatchOp).init(alloc); defer op_list_stack.deinit(); var top_list_stack = std.ArrayList(TokenMatchOp).init(alloc); defer top_list_stack.deinit(); var ctx = BuildConfigContext(Config){ .RuleMatcher = ast.grammar.findRuleDeclId("RuleMatcher").?, .Identifier = ast.grammar.findRuleDeclId("Identifier").?, .StringLiteral = ast.grammar.findRuleDeclId("StringLiteral").?, .Seq = ast.grammar.findRuleDeclId("Seq").?, .Directive = ast.grammar.findRuleDeclId("Directive").?, .CharSetLiteral = ast.grammar.findRuleDeclId("CharSetLiteral").?, .Term = ast.grammar.findRuleDeclId("Term").?, .Choice = ast.grammar.findRuleDeclId("Choice").?, .op_list_stack = &op_list_stack, .top_list_stack = &top_list_stack, .ast = ast, .config = c, }; // Process decls. const decls = ast.getChildNodeList(root, 0); for (decls) |it| { if (it.tag == RuleDeclaration) { const name = ast.getChildStringValue(it, 0); // log.warn("build rule {s}", .{name}); const dirs = ast.getChildNodeList(it, 1); var is_inline = false; for (dirs) |d_it| { if (d_it.tag == RuleDirective) { const dir_name = ast.getChildStringValue(d_it, 0); if (stdx.string.eq(dir_name, "@inline")) { is_inline = true; } } else stdx.panicFmt("unsupported {s}", .{ast.grammar.getNodeTagName(it.tag)}); } const seq = ast.getChildNode(it, 2); const op = ctx.buildMatchOpFromExprNode(seq); c.addRuleExt(name, op, is_inline); } else if (it.tag == TokensDeclaration) { const tdecls = ast.getChildNodeList(it, 0); for (tdecls) |d_it| { if (d_it.tag == TokenDeclaration) { const name = ast.getChildStringValue(d_it, 0); // log.warn("build token rule {s}", .{name}); const dirs = ast.getChildNodeList(d_it, 1); var is_literal = false; var skip = false; var replace: ?[]const u8 = null; for (dirs) |dir| { if (dir.tag == RuleDirective) { const dir_name = ast.getChildStringValue(dir, 0); if (string.eq(dir_name, "@literal")) { is_literal = true; } else if (string.eq(dir_name, "@skip")) { skip = true; } else if (string.eq(dir_name, "@replace")) { const ident = ast.getChildNodeOpt(dir, 1); if (ident == null) { stdx.panic("expected param"); } replace = ast.getChildStringValue(ident.?, 0); } else stdx.panicFmt("unsupported {s}", .{dir_name}); } else { stdx.panicFmt("unsupported {}", .{dir.tag}); } } const seq = ast.getChildNode(d_it, 2); const op = ctx.buildTokenMatchOpFromNode(seq); c.addTokenRuleExt(name, op, is_literal, skip, replace); } else { stdx.panicFmt("unsupported {}", .{d_it.tag}); } } } else { stdx.panicFmt("unsupported {}", .{it.tag}); } } c.build(alloc); } fn unescapeText(c: *Grammar, input: []const u8) CharSlice { const State = enum { Start, Backslash, }; const start_id = c.str_buf.items.len; var state = State.Start; for (input) |ch| { const uch = switch (state) { .Start => switch (ch) { '\\' => { state = .Backslash; continue; }, else => ch, }, .Backslash => b: { var _uch: u8 = switch (ch) { 'n' => '\n', '\'' => '\'', '\\' => '\\', else => stdx.panicFmt("unsupported escaped char \\{c}", .{ch}), }; state = .Start; break :b _uch; }, }; c.str_buf.append(uch) catch unreachable; } return .{ .start = @intCast(u32, start_id), .end = @intCast(u32, c.str_buf.items.len) }; } // Unescape chars and add char ranges. fn parseCharSet(c: *Grammar, res_chars: *CharSlice, res_char_ranges: *CharSetRangeSlice, res_negate: *bool, input: []const u8) void { const State = enum { Start, Backslash, }; const res_start_idx = c.str_buf.items.len; const res_range_start_idx = c.charset_range_buf.items.len; var range_start_ch: ?u8 = null; var last_char: ?u8 = null; var parse_range_end: bool = false; var state = State.Start; res_negate.* = false; for (input) |ch, i| { const uch = switch (state) { .Start => switch (ch) { '\\' => { state = .Backslash; continue; }, '-' => { if (last_char != null) { range_start_ch = last_char.?; parse_range_end = true; continue; } else { stdx.panic("Expected start char for charset range."); } }, '^' => b: { if (i == 0) { // Skip first ^ operator and set charset as negated. res_negate.* = true; continue; } else { break :b ch; } }, else => ch, }, .Backslash => b: { var _uch: u8 = switch (ch) { 'n' => '\n', '-' => '-', else => stdx.panicFmt("unsupported escaped char \\{c}", .{ch}), }; state = .Start; break :b _uch; }, }; if (parse_range_end) { c.charset_range_buf.append(.{ .start = range_start_ch.?, .end_incl = uch }) catch unreachable; parse_range_end = false; } else { if (i + 1 == input.len or input[i + 1] != '-') { c.str_buf.append(uch) catch unreachable; } } last_char = uch; } res_chars.* = .{ .start = @intCast(u32, res_start_idx), .end = @intCast(u32, c.str_buf.items.len) }; res_char_ranges.* = .{ .start = @intCast(u32, res_range_start_idx), .end = @intCast(u32, c.charset_range_buf.items.len) }; } fn matchChoice(ops: MatchOpSlice) MatchOp { return .{ .MatchChoice = .{ .computed_capture = undefined, .ops = ops, } }; } fn matchSeq(ops: MatchOpSlice) MatchOp { return .{ .MatchSeq = .{ .computed_capture = undefined, .ops = ops, }, }; } fn matchOptionalCapBool(id: MatchOpId) MatchOp { return .{ .MatchOptional = .{ .computed_capture = undefined, .capture_bool = true, .op_id = id, }, }; } fn matchNegLookahead(id: MatchOpId) MatchOp { return .{ .MatchNegLookahead = .{ .op_id = id, }, }; } fn matchPosLookahead(id: MatchOpId) MatchOp { return .{ .MatchPosLookahead = .{ .op_id = id, }, }; } fn matchOptional(id: MatchOpId) MatchOp { return .{ .MatchOptional = .{ .computed_capture = undefined, .capture_bool = false, .op_id = id, }, }; } fn matchOneOrMore(id: MatchOpId) MatchOp { return .{ .MatchOneOrMore = .{ .op_id = id, } }; } fn matchZeroOrMore(id: MatchOpId) MatchOp { return .{ .MatchZeroOrMore = .{ .skip = false, .op_id = id, } }; } fn matchTokenOptional(id: TokenMatchOpId) TokenMatchOp { return .{ .MatchOptional = .{ .op_id = id, }, }; } fn matchTokenOneOrMore(id: TokenMatchOpId) TokenMatchOp { return .{ .MatchOneOrMore = .{ .op_id = id, } }; } fn matchTokenZeroOrMore(id: TokenMatchOpId) TokenMatchOp { return .{ .MatchZeroOrMore = .{ .op_id = id, } }; } fn matchTokenNegLookahead(id: TokenMatchOpId) TokenMatchOp { return .{ .MatchNegLookahead = .{ .op_id = id, } }; } fn matchTokenPosLookahead(id: TokenMatchOpId) TokenMatchOp { return .{ .MatchPosLookahead = .{ .op_id = id, } }; } fn matchTokenRule(name: []const u8) TokenMatchOp { return .{ .MatchRule = .{ .name = name, .tag = undefined, }, }; } fn matchUntilChar(ch: u8) TokenMatchOp { return .{ .MatchUntilChar = .{ .ch = ch, }, }; } fn matchNotChar(ch: u8) TokenMatchOp { return .{ .MatchNotChar = .{ .ch = ch, }, }; } fn matchExactChar(ch: u8) TokenMatchOp { return .{ .MatchExactChar = .{ .ch = ch, } }; } fn matchTokenSeq(ops: TokenMatchOpSlice) TokenMatchOp { return .{ .MatchSeq = .{ .ops = ops, }, }; } fn matchTokenNotCharSet(charset: CharSlice, ranges: CharSetRangeSlice) TokenMatchOp { return .{ .MatchNotCharSet = .{ .resolved_charset = undefined, .charset = charset, .ranges = ranges, } }; } fn matchTokenCharSet(charset: CharSlice, ranges: CharSetRangeSlice) TokenMatchOp { return .{ .MatchCharSet = .{ .resolved_charset = undefined, .charset = charset, .ranges = ranges, } }; } fn matchTokenChoice( ops: TokenMatchOpSlice, ) TokenMatchOp { return .{ .MatchChoice = .{ .ops = ops, }, }; } fn matchDigit(one_or_more: bool) TokenMatchOp { return .{ .MatchDigit = if (one_or_more) .OneOrMore else .One, }; } fn matchAsciiLetter() TokenMatchOp { return .{ .MatchAsciiLetter = {}, }; }
parser/builder.zig
const vk = @import("vk"); pub fn createRenderPass(device: vk.VkDevice, format: vk.VkFormat) vk.VkRenderPass { const attachment = vk.VkAttachmentDescription{ .format = format, .samples = vk.VK_SAMPLE_COUNT_1_BIT, .loadOp = vk.VK_ATTACHMENT_LOAD_OP_CLEAR, .storeOp = vk.VK_ATTACHMENT_STORE_OP_STORE, .stencilLoadOp = vk.VK_ATTACHMENT_LOAD_OP_DONT_CARE, .stencilStoreOp = vk.VK_ATTACHMENT_STORE_OP_DONT_CARE, .initialLayout = vk.VK_IMAGE_LAYOUT_UNDEFINED, .finalLayout = vk.VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, .flags = 0, }; const attachment_ref = [1]vk.VkAttachmentReference{vk.VkAttachmentReference{ .attachment = 0, .layout = vk.VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, }}; const depth_attachment = vk.VkAttachmentDescription{ .format = vk.VK_FORMAT_D32_SFLOAT, .samples = vk.VK_SAMPLE_COUNT_1_BIT, .loadOp = vk.VK_ATTACHMENT_LOAD_OP_CLEAR, .storeOp = vk.VK_ATTACHMENT_STORE_OP_DONT_CARE, .stencilLoadOp = vk.VK_ATTACHMENT_LOAD_OP_DONT_CARE, .stencilStoreOp = vk.VK_ATTACHMENT_STORE_OP_DONT_CARE, .initialLayout = vk.VK_IMAGE_LAYOUT_UNDEFINED, .finalLayout = vk.VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, .flags = 0, }; const depth_attachment_ref = vk.VkAttachmentReference{ .attachment = 1, .layout = vk.VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, }; const subpass = [_]vk.VkSubpassDescription{vk.VkSubpassDescription{ .pipelineBindPoint = vk.VK_PIPELINE_BIND_POINT_GRAPHICS, .colorAttachmentCount = 1, .pColorAttachments = @as(*const [1]vk.VkAttachmentReference, &attachment_ref), .flags = 0, .inputAttachmentCount = 0, .pInputAttachments = null, .pResolveAttachments = null, .pDepthStencilAttachment = &depth_attachment_ref, .preserveAttachmentCount = 0, .pPreserveAttachments = null, }}; const dependency = [_]vk.VkSubpassDependency{vk.VkSubpassDependency{ .srcSubpass = vk.VK_SUBPASS_EXTERNAL, .dstSubpass = 0, .srcStageMask = vk.VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | vk.VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT, .srcAccessMask = 0, .dstStageMask = vk.VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | vk.VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT, .dstAccessMask = vk.VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | vk.VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | vk.VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, .dependencyFlags = 0, }}; const attachments = [_]vk.VkAttachmentDescription{ attachment, depth_attachment }; const info = vk.VkRenderPassCreateInfo{ .sType = vk.VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, .attachmentCount = attachments.len, .pAttachments = &attachments, .subpassCount = 1, .pSubpasses = &subpass, .dependencyCount = 1, .pDependencies = &dependency, .pNext = null, .flags = 0, }; var ret: vk.VkRenderPass = undefined; const res = vk.createRenderPass(device, &info, null, &ret); vk.assertSuccess(res); return ret; }
graphics/src/backend/vk/renderpass.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; pub fn main() !void { const input = [_]u32{ 1408, 1335, 1648, 1458, 1627, 1928, 1967, 1827, 1606, 1569, 1893, 1866, 1768, 1795, 1264, 1684, 1552, 1343, 1917, 1675, 1731, 1800, 1413, 1879, 1664, 1350, 1694, 1372, 1851, 1743, 1735, 833, 748, 1265, 1885, 1874, 2007, 1661, 1895, 1537, 1622, 1355, 762, 1533, 1771, 1966, 1978, 1572, 1833, 1969, 1805, 1820, 1536, 1911, 2009, 1817, 1268, 1998, 1759, 2008, 2002, 1187, 1896, 1850, 1734, 1849, 1589, 1302, 444, 1280, 1590, 1959, 902, 1709, 1932, 1277, 1561, 1301, 1831, 1286, 1693, 1927, 1467, 1384, 1662, 1401, 716, 1634, 1785, 1801, 1380, 1971, 1292, 1828, 185, 1560, 1322, 1787, 1545, 1395, 1445, 1807, 1750, 1867, 1433, 1894, 1821, 1983, 1578, 1669, 1610, 1549, 1556, 1346, 1616, 1999, 1925, 1387, 1659, 1457, 1237, 1808, 69, 1906, 1449, 1723, 1974, 1919, 1914, 1338, 1305, 1347, 1903, 1929, 1712, 1607, 1400, 197, 1575, 1282, 1296, 1737, 1396, 2003, 1453, 1660, 1646, 1991, 1565, 1416, 1995, 1784, 1367, 1420, 1593, 1654, 1306, 1916, 1797, 1594, 1471, 1405, 1698, 1541, 1900, 1963, 1696, 1574, 1853, 511, 1603, 1889, 1940, 1843, 1979, 272, 1726, 1294, 1877, 1441, 1697, 1644, 1956, 1689, 1665, 1631, 1717, 1781, 1450, 1618, 1317, 1799, 1950, 1722, 1960, 1628, 1941, 1977, 1775, 1529, }; print("part 1: {}\n", .{part1(input[0..])}); print("part 2: {}\n", .{part2(input[0..])}); } fn part1(input: []const u32) u32 { for (input) |a| { for (input) |b| { if (a + b == 2020) { return a*b; } } } return 0; } fn part2(input: []const u32) u32 { for (input) |a| { for (input) |b| { for (input) |c| { if (a+b+c == 2020) { return a*b*c; } } } } return 0; }
src/day01.zig
pub const KnightMoves = struct { pub const dx = [8]i32{-2, -1, 1, 2, 2, 1, -1, -2}; pub const dy = [8]i32{1, 2, 2, 1, -1, -2, -2, -1}; }; pub const KingMoves = struct { pub const dx = [8]i32{0, 1, 1, 1, 0, -1, -1, -1}; pub const dy = [8]i32{1, 1, 0, -1, -1, -1, 0, 1}; }; pub fn sum_for_all_positions(f: fn(i32, i32) u32) u32 { var sum : u32 = 0; inline for ([_]i32{0,1,2,3,4,5,6,7}) |y| { inline for ([_]i32{0,1,2,3,4,5,6,7}) |x| { sum += f(x, y); } } return sum; } pub fn number_of_moves_for_pawns() u32 { return sum_for_all_positions(number_of_moves_for_pawn_at_position); } fn number_of_moves_for_pawn_at_position(x: i32, y: i32) u32 { var sum : u32 = 0; if (y == 1) { sum += 1; // move 2 } if (y < 7 and y > 0) { // pawns cannot be on y == 0 if (x > 0) {sum += 1;} // capture left if (x < 7) {sum += 1;} // capture right sum += 1; // move 1 } return sum; } pub fn position_is_valid(x: i32, y: i32) bool { return x >= 0 and x <=7 and y >= 0 and y <= 7; } pub fn number_of_moves_for_knights() u32 { return sum_for_all_positions(number_of_moves_for_knights_at_square); } pub fn number_of_moves_for_king_at_square(x: i32, y: i32) u32 { const dx = KingMoves.dx; const dy = KingMoves.dy; var sum : u32 = 0; inline for ([_]usize{0,1,2,3,4,5,6,7}) |i| { if (position_is_valid(x + dx[i], y + dy[i])) { sum += 1; } } return sum; } pub fn number_of_moves_for_kings() u32 { return sum_for_all_positions(number_of_moves_for_king_at_square); } fn number_of_moves_for_knights_at_square(x: i32, y: i32) u32 { const dx = KnightMoves.dx; const dy = KnightMoves.dy; var sum : u32 = 0; inline for ([_]usize{0,1,2,3,4,5,6,7}) |i| { if (position_is_valid(x + dx[i], y + dy[i])) { sum += 1; } } return sum; } pub fn number_of_moves_for_main_pieces() u32 { // for rooks, bishops return 64*(7+7); } // computed with the const functions, but there was too much computation const MOVES_MAIN_PIECES = 896; const MOVES_KINGS = 420; const MOVES_KNIGHTS = 336; const MOVES_PAWNS = 140; pub const MAX_MOVES = MOVES_MAIN_PIECES + // bishops MOVES_MAIN_PIECES + // rooks MOVES_MAIN_PIECES*2 + // queens MOVES_PAWNS*2 + MOVES_KNIGHTS + MOVES_KINGS;
src/utils.zig
pub const Bool32 = i32; pub const CString = [*:0]const u8; pub const MutCString = [*:0]u8; pub const FileType = enum(c_int) { invalid, gltf, glb, }; pub const Result = enum(c_int) { success, data_too_short, unknown_format, invalid_json, invalid_gltf, invalid_options, file_not_found, io_error, out_of_memory, legacy_gltf, }; pub const MemoryOptions = extern struct { alloc: ?fn (user: ?*anyopaque, size: usize) callconv(.C) ?*anyopaque = null, free: ?fn (user: ?*anyopaque, ptr: ?*anyopaque) callconv(.C) void = null, user_data: ?*anyopaque = null, }; pub const FileOptions = extern struct { read: ?fn (*const MemoryOptions, *const FileOptions, CString, *usize, *(?*anyopaque)) callconv(.C) Result = null, release: ?fn (*const MemoryOptions, *const FileOptions, ?*anyopaque) callconv(.C) void = null, user_data: ?*anyopaque = null, }; pub const Options = extern struct { file_type: FileType = .invalid, json_token_count: usize = 0, memory: MemoryOptions = .{}, file: FileOptions = .{}, }; pub const BufferViewType = enum(c_int) { invalid, indices, vertices, }; pub const AttributeType = enum(c_int) { invalid, position, normal, tangent, texcoord, color, joints, weights, }; pub const ComponentType = enum(c_int) { invalid, r_8, r_8u, r_16, r_16u, r_32u, r_32f, }; pub const Type = enum(c_int) { invalid, scalar, vec2, vec3, vec4, mat2, mat3, mat4, }; pub const PrimitiveType = enum(c_int) { points, lines, line_loop, line_strip, triangles, triangle_strip, triangle_fan, }; pub const AlphaMode = enum(c_int) { @"opaque", mask, blend, }; pub const AnimationPathType = enum(c_int) { invalid, translation, rotation, scale, weights, }; pub const InterpolationType = enum(c_int) { linear, step, cubic_spline, }; pub const CameraType = enum(c_int) { invalid, perspective, orthographic, }; pub const LightType = enum(c_int) { invalid, directional, point, spot, }; pub const DataFreeMethod = enum(c_int) { none, file_release, memory_free, }; pub const MeshoptCompressionMode = enum(c_int) { invalid, attributes, triangles, indices, }; pub const MeshoptCompressionFilter = enum(c_int) { none, octahedral, quaternion, exponential, }; pub const Extras = extern struct { start_offset: usize, end_offset: usize, }; pub const Extension = extern struct { name: ?MutCString, data: ?MutCString, }; pub const Buffer = extern struct { name: ?MutCString, size: usize, uri: ?MutCString, data: ?*anyopaque, // loaded by loadBuffers() data_free_method: DataFreeMethod, extras: Extras, extensions_count: usize, extensions: ?[*]Extension, }; pub const MeshoptCompression = extern struct { buffer: *Buffer, offset: usize, size: usize, stride: usize, count: usize, mode: MeshoptCompressionMode, filter: MeshoptCompressionFilter, }; pub const BufferView = extern struct { name: ?MutCString, buffer: *Buffer, offset: usize, size: usize, stride: usize, // 0 == automatically determined by accessor view_type: BufferViewType, data: ?*anyopaque, // overrides buffer.data if present, filled by extensions has_meshopt_compression: Bool32, meshopt_compression: MeshoptCompression, extras: Extras, extensions_count: usize, extensions: ?[*]Extension, }; pub const AccessorSparse = extern struct { count: usize, indices_buffer_view: *BufferView, indices_byte_offset: usize, indices_component_type: ComponentType, values_buffer_view: *BufferView, values_byte_offset: usize, extras: Extras, indices_extras: Extras, values_extras: Extras, extensions_count: usize, extensions: ?[*]Extension, indices_extensions_count: usize, indices_extensions: ?[*]Extension, values_extensions_count: usize, values_extensions: ?[*]Extension, }; pub const Accessor = extern struct { name: ?MutCString, component_type: ComponentType, normalized: Bool32, type: Type, offset: usize, count: usize, stride: usize, buffer_view: ?*BufferView, has_min: Bool32, min: [16]f32, has_max: Bool32, max: [16]f32, is_sparse: Bool32, sparse: AccessorSparse, extras: Extras, extensions_count: usize, extensions: ?[*]Extension, }; pub const Attribute = extern struct { name: ?MutCString, type: AttributeType, index: i32, data: *Accessor, }; pub const Image = extern struct { name: ?MutCString, uri: ?MutCString, buffer_view: ?*BufferView, mime_type: ?MutCString, extras: Extras, extensions_count: usize, extensions: ?[*]Extension, }; pub const Sampler = extern struct { uri: ?MutCString, mag_filter: i32, min_filter: i32, wrap_s: i32, wrap_t: i32, extras: Extras, extensions_count: usize, extensions: ?[*]Extension, }; pub const Texture = extern struct { name: ?MutCString, image: ?*Image, sampler: ?*Sampler, has_basisu: Bool32, basisu_image: ?*Image, extras: Extras, extensions_count: usize, extensions: ?[*]Extension, }; pub const TextureTransform = extern struct { offset: [2]f32, rotation: f32, scale: [2]f32, has_texcoord: Bool32, texcoord: i32, };
libs/zmesh/src/zcgltf.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const assert = std.debug.assert; pub const main = tools.defaultMain("2021/day24.txt", run); const Reg = enum { x, y, z, w }; const OpCode = enum { inp, add, mul, div, mod, eql }; const Inst = struct { op: OpCode, a: Reg, b: union(enum) { reg: Reg, imm: i64 } }; fn parseReg(name: []const u8) Reg { return std.meta.stringToEnum(Reg, name).?; } fn runPrg(prg: []const Inst, in: []const u8) i64 { var in_idx: u32 = 0; var vars = [4]i64{ 0, 0, 0, 0 }; for (prg) |inst| { const a = &vars[@enumToInt(inst.a)]; const b = if (inst.b == .reg) vars[@enumToInt(inst.b.reg)] else inst.b.imm; switch (inst.op) { .inp => { a.* = in[in_idx] - '0'; in_idx += 1; }, .add => a.* += b, .mul => a.* *= b, .div => a.* = @divFloor(a.*, b), .mod => a.* = @mod(a.*, b), .eql => a.* = @boolToInt(a.* == b), } } return vars[@enumToInt(Reg.z)]; } fn decompiledToZig(in: [14]i64) i64 { var x: i64 = 0; var y: i64 = 0; var z: i64 = 0; var w: i64 = 0; // zig fmt: off w = in[0]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 1);x += 15;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 9;y *= x;z += y; w = in[1]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 1);x += 11;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 1;y *= x;z += y; w = in[2]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 1);x += 10;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 11;y *= x;z += y; w = in[3]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 1);x += 12;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 3;y *= x;z += y; w = in[4]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 26);x += -11;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 10;y *= x;z += y; w = in[5]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 1);x += 11;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 5;y *= x;z += y; w = in[6]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 1);x += 14;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 0;y *= x;z += y; w = in[7]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 26);x += -6;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 7;y *= x;z += y; w = in[8]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 1);x += 10;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 9;y *= x;z += y; w = in[9]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 26);x += -6;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 15;y *= x;z += y; w = in[10]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 26);x += -6;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 4;y *= x;z += y; w = in[11]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 26);x += -16;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 10;y *= x;z += y; w = in[12]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 26);x += -4;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 4;y *= x;z += y; w = in[13]; x *= 0;x += z;x = @mod(x, 26);z = @divFloor(z, 26);x += -2;x = @boolToInt(x == w);x = @boolToInt(x == 0);y *= 0;y += 25;y *= x;y += 1;z *= y;y *= 0;y += w;y += 9;y *= x;z += y; // zig fmt: on return z; } fn decompiledToZig1(in: [14]i64) i64 { //var x: i64 = 0; //var y: i64 = 0; var z: i64 = 0; //var w: i64 = 0; z = z * 26 + (in[0] + 9); z = z * 26 + (in[1] + 1); z = z * 26 + (in[2] + 11); z = z * 26 + (in[3] + 3); if (@mod(z, 26) - 11 != in[4]) { z = @divFloor(z, 26) * 26 + (in[4] + 10); } else { z = @divFloor(z, 26); } z = z * 26 + (in[5] + 5); z = z * 26 + (in[6] + 0); if (@mod(z, 26) - 6 != in[7]) { z = @divFloor(z, 26) * 26 + (in[7] + 7); } else { z = @divFloor(z, 26); } z = z * 26 + (in[8] + 9); if (@mod(z, 26) - 6 != in[9]) { z = @divFloor(z, 26) * 26 + (in[9] + 15); } else { z = @divFloor(z, 26); } if (@mod(z, 26) - 6 != in[10]) { z = @divFloor(z, 26) * 26 + (in[10] + 4); } else { z = @divFloor(z, 26); } if (@mod(z, 26) - 16 != in[11]) { z = @divFloor(z, 26) * 26 + (in[11] + 10); } else { z = @divFloor(z, 26); } if (@mod(z, 26) - 4 != in[12]) { z = @divFloor(z, 26) * 26 + (in[12] + 4); } else { z = @divFloor(z, 26); } if (@mod(z, 26) - 2 != in[13]) { z = @divFloor(z, 26) * 26 + (in[13] + 9); } else { z = @divFloor(z, 26); } return z; } fn addDigit(z: i64, d: i64) i64 { assert(d >= 0 and d < 26); return z * 26 + d; } fn replaceLastDigit(z: i64, d: i64) i64 { assert(d >= 0 and d < 26); return @divFloor(z, 26) * 26 + d; } fn dropLastDigit(z: i64) i64 { return @divFloor(z, 26); } fn isLastDigit(z: i64, d: i64) bool { assert(d >= 0 and d < 26); return @mod(z, 26) == d; } fn decompiledToZig2(in: [14]i64) i64 { //var x: i64 = 0; //var y: i64 = 0; var z: i64 = 0; //var w: i64 = 0; z = addDigit(z, (in[0] + 9)); z = addDigit(z, (in[1] + 1)); z = addDigit(z, (in[2] + 11)); z = addDigit(z, (in[3] + 3)); z = if (!isLastDigit(z, in[4] + 11)) replaceLastDigit(z, (in[4] + 10)) else dropLastDigit(z); z = z * 26 + (in[5] + 5); z = z * 26 + (in[6] + 0); z = if (!isLastDigit(z, in[7] + 6)) replaceLastDigit(z, (in[7] + 7)) else dropLastDigit(z); z = z * 26 + (in[8] + 9); z = if (!isLastDigit(z, in[9] + 6)) replaceLastDigit(z, (in[9] + 15)) else dropLastDigit(z); z = if (!isLastDigit(z, in[10] + 6)) replaceLastDigit(z, (in[10] + 4)) else dropLastDigit(z); z = if (!isLastDigit(z, in[11] + 16)) replaceLastDigit(z, (in[11] + 10)) else dropLastDigit(z); z = if (!isLastDigit(z, in[12] + 4)) replaceLastDigit(z, (in[12] + 4)) else dropLastDigit(z); z = if (!isLastDigit(z, in[13] + 2)) replaceLastDigit(z, (in[13] + 9)) else dropLastDigit(z); return z; } fn dumpAsZigCode(prg: []const Inst, allocator: std.mem.Allocator) ![]u8 { var buf = try allocator.alloc(u8, 10000); var num_buf: [16]u8 = undefined; var len: usize = 0; var in_idx: u32 = 0; for (prg) |inst| { const a = std.meta.tagName(inst.a); const b = if (inst.b == .reg) std.meta.tagName(inst.b.reg) else std.fmt.bufPrintIntToSlice(&num_buf, inst.b.imm, 10, .lower, .{}); switch (inst.op) { .inp => { len += (try std.fmt.bufPrint(buf[len..], "{s} = in[{d}];\n", .{ a, in_idx })).len; in_idx += 1; }, .add => len += (try std.fmt.bufPrint(buf[len..], "{s} += {s};", .{ a, b })).len, .mul => len += (try std.fmt.bufPrint(buf[len..], "{s} *= {s};", .{ a, b })).len, .div => len += (try std.fmt.bufPrint(buf[len..], "{s} = @divFloor({s}, {s});", .{ a, a, b })).len, .mod => len += (try std.fmt.bufPrint(buf[len..], "{s} = @mod({s}, {s});", .{ a, a, b })).len, .eql => len += (try std.fmt.bufPrint(buf[len..], "{s} = @boolToInt({s} == {s});", .{ a, a, b })).len, } } return buf[0..len]; } pub fn run(input: []const u8, gpa: std.mem.Allocator) tools.RunError![2][]const u8 { var arena_alloc = std.heap.ArenaAllocator.init(gpa); defer arena_alloc.deinit(); const arena = arena_alloc.allocator(); var prg = std.ArrayList(Inst).init(gpa); defer prg.deinit(); var it = std.mem.tokenize(u8, input, "\n"); while (it.next()) |line| { inline for ([_]OpCode{ .inp, .add, .mul, .div, .mod, .eql }) |op| { if (tools.match_pattern(std.meta.tagName(op) ++ " {} {}", line)) |val| { if (val[1] == .imm) { try prg.append(Inst{ .op = op, .a = parseReg(val[0].lit), .b = .{ .imm = val[1].imm }, }); } else { try prg.append(Inst{ .op = op, .a = parseReg(val[0].lit), .b = .{ .reg = parseReg(val[1].lit) }, }); } } else if (tools.match_pattern(std.meta.tagName(op) ++ " {}", line)) |val| { try prg.append(Inst{ .op = op, .a = parseReg(val[0].lit), .b = .{ .imm = 0 } }); } } } if (false) { trace("\n{s}\n", .{try dumpAsZigCode(prg.items, arena)}); } trace("runbytecode={}\n", .{runPrg(prg.items, "13579246899999")}); trace("rundecompile={}\n", .{decompiledToZig2([_]i64{ 1, 3, 5, 7, 9, 2, 4, 6, 8, 9, 9, 9, 9, 9 })}); { // pour arriver à zéro, il faut zero chiffres. // => que des dropLastDigit(), pas de replaceLastDigit() pour compenser tous les addDigits. // (7 addDigits => 7 dropDigit) // num == abcdDefFgGECBA // avec (a+9 == A+2) // avec (b+1 == B+4) // avec (c+11 == C+16) // avec (d+3 == D+11) // avec (e+5 == E+6) // avec (f+0 == F+6) // avec (g+9 == G+6) // => abcdefg=2999996 // ABCDEFG=9641839 trace("runbytecode(answer)={}\n", .{runPrg(prg.items, "29991993698469")}); } const ans1 = 29991993698469; { // => abcdefg=0358160 // ABCDEFG=7000003 trace("runbytecode(answer)={}\n", .{runPrg(prg.items, "03580160030007")}); // => abcdefg=1358160 // ABCDEFG=8000003 trace("runbytecode(answer)={}\n", .{runPrg(prg.items, "13580160030008")}); // too low?!? // "The digit 0 cannot appear in a model number." aaah. // => abcdefg=1469271 // ABCDEFG=8111114 trace("runbytecode(answer)={}\n", .{runPrg(prg.items, "14691271141118")}); // too low?!? } const ans2 = 14691271141118; return [_][]const u8{ try std.fmt.allocPrint(gpa, "{}", .{ans1}), try std.fmt.allocPrint(gpa, "{}", .{ans2}), }; } test {}
2021/day24.zig
const std = @import("std"); const leb = std.leb; const macho = std.macho; const mem = std.mem; const assert = std.debug.assert; const Allocator = mem.Allocator; pub const ExternSymbol = struct { /// MachO symbol table entry. inner: macho.nlist_64, /// Id of the dynamic library where the specified entries can be found. /// Id of 0 means self. /// TODO this should really be an id into the table of all defined /// dylibs. dylib_ordinal: i64 = 0, /// Id of the segment where this symbol is defined (will have its address /// resolved). segment: u16 = 0, /// Offset relative to the start address of the `segment`. offset: u32 = 0, }; pub fn rebaseInfoSize(symbols: anytype) !u64 { var stream = std.io.countingWriter(std.io.null_writer); var writer = stream.writer(); var size: u64 = 0; for (symbols) |entry| { size += 2; try leb.writeILEB128(writer, entry.value.offset); size += 1; } size += 1 + stream.bytes_written; return size; } pub fn writeRebaseInfo(symbols: anytype, writer: anytype) !void { for (symbols) |entry| { const symbol = entry.value; try writer.writeByte(macho.REBASE_OPCODE_SET_TYPE_IMM | @truncate(u4, macho.REBASE_TYPE_POINTER)); try writer.writeByte(macho.REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB | @truncate(u4, symbol.segment)); try leb.writeILEB128(writer, symbol.offset); try writer.writeByte(macho.REBASE_OPCODE_DO_REBASE_IMM_TIMES | @truncate(u4, 1)); } try writer.writeByte(macho.REBASE_OPCODE_DONE); } pub fn bindInfoSize(symbols: anytype) !u64 { var stream = std.io.countingWriter(std.io.null_writer); var writer = stream.writer(); var size: u64 = 0; for (symbols) |entry| { const symbol = entry.value; size += 1; if (symbol.dylib_ordinal > 15) { try leb.writeULEB128(writer, @bitCast(u64, symbol.dylib_ordinal)); } size += 1; size += 1; size += entry.key.len; size += 1; size += 1; try leb.writeILEB128(writer, symbol.offset); size += 2; } size += stream.bytes_written; return size; } pub fn writeBindInfo(symbols: anytype, writer: anytype) !void { for (symbols) |entry| { const symbol = entry.value; if (symbol.dylib_ordinal > 15) { try writer.writeByte(macho.BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB); try leb.writeULEB128(writer, @bitCast(u64, symbol.dylib_ordinal)); } else if (symbol.dylib_ordinal > 0) { try writer.writeByte(macho.BIND_OPCODE_SET_DYLIB_ORDINAL_IMM | @truncate(u4, @bitCast(u64, symbol.dylib_ordinal))); } else { try writer.writeByte(macho.BIND_OPCODE_SET_DYLIB_SPECIAL_IMM | @truncate(u4, @bitCast(u64, symbol.dylib_ordinal))); } try writer.writeByte(macho.BIND_OPCODE_SET_TYPE_IMM | @truncate(u4, macho.BIND_TYPE_POINTER)); try writer.writeByte(macho.BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM); // TODO Sometimes we might want to add flags. try writer.writeAll(entry.key); try writer.writeByte(0); try writer.writeByte(macho.BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB | @truncate(u4, symbol.segment)); try leb.writeILEB128(writer, symbol.offset); try writer.writeByte(macho.BIND_OPCODE_DO_BIND); try writer.writeByte(macho.BIND_OPCODE_DONE); } } pub fn lazyBindInfoSize(symbols: anytype) !u64 { var stream = std.io.countingWriter(std.io.null_writer); var writer = stream.writer(); var size: u64 = 0; for (symbols) |entry| { const symbol = entry.value; size += 1; try leb.writeILEB128(writer, symbol.offset); size += 1; if (symbol.dylib_ordinal > 15) { try leb.writeULEB128(writer, @bitCast(u64, symbol.dylib_ordinal)); } size += 1; size += entry.key.len; size += 1; size += 2; } size += stream.bytes_written; return size; } pub fn writeLazyBindInfo(symbols: anytype, writer: anytype) !void { for (symbols) |entry| { const symbol = entry.value; try writer.writeByte(macho.BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB | @truncate(u4, symbol.segment)); try leb.writeILEB128(writer, symbol.offset); if (symbol.dylib_ordinal > 15) { try writer.writeByte(macho.BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB); try leb.writeULEB128(writer, @bitCast(u64, symbol.dylib_ordinal)); } else if (symbol.dylib_ordinal > 0) { try writer.writeByte(macho.BIND_OPCODE_SET_DYLIB_ORDINAL_IMM | @truncate(u4, @bitCast(u64, symbol.dylib_ordinal))); } else { try writer.writeByte(macho.BIND_OPCODE_SET_DYLIB_SPECIAL_IMM | @truncate(u4, @bitCast(u64, symbol.dylib_ordinal))); } try writer.writeByte(macho.BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM); // TODO Sometimes we might want to add flags. try writer.writeAll(entry.key); try writer.writeByte(0); try writer.writeByte(macho.BIND_OPCODE_DO_BIND); try writer.writeByte(macho.BIND_OPCODE_DONE); } }
src/link/MachO/imports.zig
const std = @import("std"); const os = std.os; const ComptimeStringMap = std.ComptimeStringMap; const File = std.fs.File; const expectEqual = std.testing.expectEqual; pub const EntryType = enum { /// `no`: Normal (non-filename) text Normal, /// `fi`: Regular file RegularFile, /// `di`: Directory Directory, /// `ln`: Symbolic link SymbolicLink, /// `pi`: Named pipe or FIFO FIFO, /// `so`: Socket Socket, /// `do`: Door (IPC connection to another program) Door, /// `bd`: Block-oriented device BlockDevice, /// `cd`: Character-oriented device CharacterDevice, /// `or`: A broken symbolic link OrphanedSymbolicLink, /// `su`: A file that is setuid (`u+s`) Setuid, /// `sg`: A file that is setgid (`g+s`) Setgid, /// `st`: A directory that is sticky and other-writable (`+t`, `o+w`) Sticky, /// `ow`: A directory that is not sticky and other-writeable (`o+w`) OtherWritable, /// `tw`: A directory that is sticky and other-writable (`+t`, `o+w`) StickyAndOtherWritable, /// `ex`: Executable file ExecutableFile, /// `mi`: Missing file MissingFile, /// `ca`: File with capabilities set Capabilities, /// `mh`: File with multiple hard links MultipleHardLinks, /// `lc`: Code that is printed before the color sequence LeftCode, /// `rc`: Code that is printed after the color sequence RightCode, /// `ec`: End code EndCode, /// `rs`: Code to reset to ordinary colors Reset, /// `cl`: Code to clear to the end of the line ClearLine, const Self = @This(); pub const len = std.meta.fields(Self).len; const str_type_map = ComptimeStringMap(Self, .{ .{ "no", .Normal }, .{ "fi", .RegularFile }, .{ "di", .Directory }, .{ "ln", .SymbolicLink }, .{ "pi", .FIFO }, .{ "so", .Socket }, .{ "do", .Door }, .{ "bd", .BlockDevice }, .{ "cd", .CharacterDevice }, .{ "or", .OrphanedSymbolicLink }, .{ "su", .Setuid }, .{ "sg", .Setgid }, .{ "st", .Sticky }, .{ "ow", .OtherWritable }, .{ "tw", .StickyAndOtherWritable }, .{ "ex", .ExecutableFile }, .{ "mi", .MissingFile }, .{ "ca", .Capabilities }, .{ "mh", .MultipleHardLinks }, .{ "lc", .LeftCode }, .{ "rc", .RightCode }, .{ "ec", .EndCode }, .{ "rs", .Reset }, .{ "cl", .ClearLine }, }); pub fn fromStr(entry_type: []const u8) ?Self { return str_type_map.get(entry_type); } /// Get the entry type for this path /// Does not take ownership of the path pub fn fromPath(path: []const u8) !Self { var file = try std.fs.cwd().openFile(path, .{}); defer file.close(); const mode = @intCast(u32, try file.mode()); if (os.S.ISBLK(mode)) { return EntryType.BlockDevice; } else if (os.S.ISCHR(mode)) { return EntryType.CharacterDevice; } else if (os.S.ISDIR(mode)) { return EntryType.Directory; } else if (os.S.ISFIFO(mode)) { return EntryType.FIFO; } else if (os.S.ISSOCK(mode)) { return EntryType.Socket; } else if (mode & os.S.ISUID != 0) { return EntryType.Setuid; } else if (mode & os.S.ISGID != 0) { return EntryType.Setgid; } else if (mode & os.S.ISVTX != 0) { return EntryType.Sticky; } else if (os.S.ISREG(mode)) { if (mode & os.S.IXUSR != 0) { return EntryType.ExecutableFile; } else if (mode & os.S.IXGRP != 0) { return EntryType.ExecutableFile; } else if (mode & os.S.IXOTH != 0) { return EntryType.ExecutableFile; } return EntryType.RegularFile; } else if (os.S.ISLNK(mode)) { var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; const target = try os.readlink(path, &path_buf); var target_file = std.fs.cwd().openFile(target, .{}) catch return EntryType.OrphanedSymbolicLink; target_file.close(); return EntryType.SymbolicLink; } else { return EntryType.Normal; } } }; test "parse entry types" { try expectEqual(EntryType.fromStr(""), null); } test "entry type of . and .." { try expectEqual(EntryType.fromPath("."), .Directory); try expectEqual(EntryType.fromPath(".."), .Directory); } test "entry type of /dev/null" { try expectEqual(EntryType.fromPath("/dev/null"), .CharacterDevice); } test "entry type of /bin/sh" { try expectEqual(EntryType.fromPath("/bin/sh"), .ExecutableFile); }
src/entry_types.zig
const std = @import("std"); const zriscv = @import("zriscv"); const resource_path: []const u8 = @import("build_options").resource_path; test "rv64ui_p_lui" { try runTest("rv64ui_p_lui.bin"); } test "rv64ui_p_auipc" { try runTest("rv64ui_p_auipc.bin"); } test "rv64ui_p_jal" { try runTest("rv64ui_p_jal.bin"); } test "rv64ui_p_jalr" { try runTest("rv64ui_p_jalr.bin"); } test "rv64ui_p_beq" { try runTest("rv64ui_p_beq.bin"); } test "rv64ui_p_bne" { try runTest("rv64ui_p_bne.bin"); } test "rv64ui_p_blt" { try runTest("rv64ui_p_blt.bin"); } test "rv64ui_p_bge" { try runTest("rv64ui_p_bge.bin"); } test "rv64ui_p_bltu" { try runTest("rv64ui_p_bltu.bin"); } test "rv64ui_p_bgeu" { try runTest("rv64ui_p_bgeu.bin"); } test "rv64ui_p_lb" { try runTest("rv64ui_p_lb.bin"); } test "rv64ui_p_lh" { try runTest("rv64ui_p_lh.bin"); } test "rv64ui_p_lw" { try runTest("rv64ui_p_lw.bin"); } test "rv64ui_p_lbu" { try runTest("rv64ui_p_lbu.bin"); } test "rv64ui_p_lhu" { try runTest("rv64ui_p_lhu.bin"); } test "rv64ui_p_sb" { try runTest("rv64ui_p_sb.bin"); } test "rv64ui_p_sh" { try runTest("rv64ui_p_sh.bin"); } test "rv64ui_p_sw" { try runTest("rv64ui_p_sw.bin"); } test "rv64ui_p_addi" { try runTest("rv64ui_p_addi.bin"); } test "rv64ui_p_slti" { try runTest("rv64ui_p_slti.bin"); } test "rv64ui_p_sltiu" { try runTest("rv64ui_p_sltiu.bin"); } test "rv64ui_p_xori" { try runTest("rv64ui_p_xori.bin"); } test "rv64ui_p_ori" { try runTest("rv64ui_p_ori.bin"); } test "rv64ui_p_andi" { try runTest("rv64ui_p_andi.bin"); } test "rv64ui_p_slli" { try runTest("rv64ui_p_slli.bin"); } test "rv64ui_p_srli" { try runTest("rv64ui_p_srli.bin"); } test "rv64ui_p_srai" { try runTest("rv64ui_p_srai.bin"); } test "rv64ui_p_add" { try runTest("rv64ui_p_add.bin"); } test "rv64ui_p_sub" { try runTest("rv64ui_p_sub.bin"); } test "rv64ui_p_sll" { try runTest("rv64ui_p_sll.bin"); } test "rv64ui_p_slt" { try runTest("rv64ui_p_slt.bin"); } test "rv64ui_p_sltu" { try runTest("rv64ui_p_sltu.bin"); } test "rv64ui_p_xor" { try runTest("rv64ui_p_xor.bin"); } test "rv64ui_p_srl" { try runTest("rv64ui_p_srl.bin"); } test "rv64ui_p_sra" { try runTest("rv64ui_p_sra.bin"); } test "rv64ui_p_or" { try runTest("rv64ui_p_or.bin"); } test "rv64ui_p_and" { try runTest("rv64ui_p_and.bin"); } test "rv64ui_p_lwu" { try runTest("rv64ui_p_lwu.bin"); } test "rv64ui_p_ld" { try runTest("rv64ui_p_ld.bin"); } test "rv64ui_p_sd" { try runTest("rv64ui_p_sd.bin"); } test "rv64ui_p_addiw" { try runTest("rv64ui_p_addiw.bin"); } test "rv64ui_p_slliw" { try runTest("rv64ui_p_slliw.bin"); } test "rv64ui_p_srliw" { try runTest("rv64ui_p_srliw.bin"); } test "rv64ui_p_sraiw" { try runTest("rv64ui_p_sraiw.bin"); } test "rv64ui_p_addw" { try runTest("rv64ui_p_addw.bin"); } test "rv64ui_p_subw" { try runTest("rv64ui_p_subw.bin"); } test "rv64ui_p_sllw" { try runTest("rv64ui_p_sllw.bin"); } test "rv64ui_p_srlw" { try runTest("rv64ui_p_srlw.bin"); } test "rv64ui_p_sraw" { try runTest("rv64ui_p_sraw.bin"); } test "rv64mi_p_scall" { try runTest("rv64mi_p_scall.bin"); } test "rv64ui_p_fence_i" { try runTest("rv64ui_p_fence_i.bin"); } test "rv64ui_p_simple" { try runTest("rv64ui_p_simple.bin"); } test "rv64mi_p_access" { try runTest("rv64mi_p_access.bin"); } test "rv64um_p_mul" { try runTest("rv64um_p_mul.bin"); } test "rv64um_p_mulh" { try runTest("rv64um_p_mulh.bin"); } test "rv64um_p_mulhsu" { try runTest("rv64um_p_mulhsu.bin"); } test "rv64um_p_mulhu" { try runTest("rv64um_p_mulhu.bin"); } test "rv64um_p_div" { try runTest("rv64um_p_div.bin"); } test "rv64um_p_divu" { try runTest("rv64um_p_divu.bin"); } test "rv64um_p_rem" { try runTest("rv64um_p_rem.bin"); } test "rv64um_p_remu" { try runTest("rv64um_p_remu.bin"); } test "rv64um_p_mulw" { try runTest("rv64um_p_mulw.bin"); } test "rv64um_p_divw" { try runTest("rv64um_p_divw.bin"); } test "rv64um_p_divuw" { try runTest("rv64um_p_divuw.bin"); } test "rv64um_p_remw" { try runTest("rv64um_p_remw.bin"); } test "rv64um_p_remuw" { try runTest("rv64um_p_remuw.bin"); } const TestContext = struct { file_name: []const u8, the_error: ?anyerror = null, reset_event: *std.Thread.ResetEvent, }; fn runTest(file_name: []const u8) !void { var reset_event = try std.testing.allocator.create(std.Thread.ResetEvent); defer std.testing.allocator.destroy(reset_event); try reset_event.init(); defer reset_event.deinit(); var context = TestContext{ .file_name = file_name, .reset_event = reset_event }; var runner_thread = try std.Thread.spawn(.{}, executeTest, .{&context}); if (reset_event.timedWait(std.time.ns_per_s * 2) == .timed_out) { runner_thread.detach(); return error.TestTimedOut; } defer runner_thread.join(); if (context.the_error) |err| return err; } fn executeTest(context: *TestContext) !void { defer context.reset_event.set(); const file_contents = blk: { var resource_dir = try std.fs.openDirAbsolute(resource_path, .{}); defer resource_dir.close(); var file = try resource_dir.openFile(context.file_name, .{}); defer file.close(); break :blk try file.readToEndAlloc(std.testing.allocator, std.math.maxInt(usize)); }; defer std.testing.allocator.free(file_contents); var cpu_state = zriscv.CpuState{ .memory = file_contents }; zriscv.Cpu(.{}).run(&cpu_state) catch |err| switch (err) { error.ExecutionOutOfBounds => { if (cpu_state.x[10] != 0) { context.the_error = err; } }, else => context.the_error = err, }; } comptime { std.testing.refAllDecls(@This()); }
tests/tests.zig
export fn mission2_main() noreturn { Bss.prepare(); Uart.prepare(); Timer0.prepare(); Timer1.prepare(); Timer2.prepare(); LedMatrix.prepare(); CycleActivity.prepare(); TerminalActivity.prepare(); ThrottleActivity.prepare(); Uart.setUpdater(LedMatrix.update); while (true) { CycleActivity.update(); TerminalActivity.update(); ThrottleActivity.update(); } } const CycleActivity = struct { var cycle_counter: u32 = undefined; var cycle_time: u32 = undefined; var cycles_per_second: u32 = undefined; var last_cycle_counter: u32 = undefined; var last_cycle_start: ?u32 = undefined; var max_cycle_time: u32 = undefined; var up_time_seconds: u32 = undefined; var up_timer: TimeKeeper = undefined; fn prepare() void { cycle_counter = 0; cycle_time = 0; cycles_per_second = 1; last_cycle_counter = 0; last_cycle_start = null; max_cycle_time = 0; up_time_seconds = 0; up_timer.prepare(1000 * 1000); } fn update() void { LedMatrix.update(); cycle_counter += 1; const new_cycle_start = Timer0.capture(); if (up_timer.isFinished()) { up_timer.reset(); up_time_seconds += 1; cycles_per_second = cycle_counter -% last_cycle_counter; last_cycle_counter = cycle_counter; } if (last_cycle_start) |start| { cycle_time = new_cycle_start -% start; max_cycle_time = math.max(cycle_time, max_cycle_time); } last_cycle_start = new_cycle_start; } }; const ThrottleActivity = struct { var buttons: [2]Button = undefined; var pwm_loop_back_counter: u32 = undefined; fn loopBackPercent() u32 { return pwm_loop_back_counter * 100 * 1000 / CycleActivity.cycles_per_second / 1000; } fn prepare() void { pwm_loop_back_counter = 0; Throttle.prepare(); for (buttons) |*b, i| { b.prepare(i); } LedScroller.prepare(); redraw(); update(); } fn redraw() void { for (buttons) |*b| { b.draw(); } } fn releaseSimulatedButtons() void { for (buttons) |*b| { if (b.is_simulation_pressed) { b.toggleSimulated(); } } } fn update() void { if (Gpio.registers.in & Gpio.registers_masks.ring0 != 0) { pwm_loop_back_counter += 1; } for (buttons) |*button| { button.update(); } LedScroller.update(); } const Button = struct { down_count: u32, index: u32, is_pressed: bool, is_simulation_pressed: bool, mask: u32, up_count: u32, fn draw(self: *Button) void { Terminal.hideCursor(); Terminal.move(6, 10 + self.index * 31); if (self.is_pressed) { Terminal.attribute(44); Uart.writeText(self.name()); Uart.writeText(" down"); Terminal.attribute(0); } else { Uart.writeText(self.name()); Uart.writeText(" "); } } fn name(self: *Button) []const u8 { return if (self.index == 0) "A" else "B"; } fn prepare(self: *Button, index: u32) void { self.down_count = 0; self.index = index; self.is_pressed = false; self.is_simulation_pressed = false; self.up_count = 0; if (index == 0) { self.mask = Gpio.registers_masks.button_a_active_low; } else if (index == 1) { self.mask = Gpio.registers_masks.button_b_active_low; } Gpio.config[@ctz(u32, self.mask)] = Gpio.config_masks.input; self.update(); } fn toggleSimulated(self: *Button) void { self.is_simulation_pressed = !self.is_simulation_pressed; self.update(); } fn update(self: *Button) void { const new = Gpio.registers.in & self.mask == 0 or self.is_simulation_pressed; if (new != self.is_pressed) { self.is_pressed = new; self.draw(); TerminalActivity.restoreInputLine(); if (self.is_pressed) { self.down_count += 1; if (self.index == 0 and !buttons[1].is_pressed) { Throttle.movePercent("button A pressed", -5); } else if (self.index == 1 and !buttons[0].is_pressed) { Throttle.movePercent("button B pressed", 5); } else { Throttle.setPercent("Both buttons A and B pressed (reset throttle to 0%)", 0); } } else { self.up_count += 1; } } } }; const LedScroller = struct { var column: u32 = undefined; var displayed_percent: u32 = undefined; var text: []u8 = undefined; var text_buf: [text_len_max]u8 = undefined; const text_len_max = 4; var timer: TimeKeeper = undefined; fn prepare() void { column = 0; text = text_buf[0..0]; timer.prepare(100 * 1000); } fn update() void { if (timer.isFinished()) { timer.reset(); var index = column / 6; if (column % 6 == 0) { if (index == text.len) { if (text.len == 0 or Throttle.percent != displayed_percent) { displayed_percent = Throttle.percent; text = text_buf[0..2]; text[0] = ' '; if (displayed_percent < 10) { text[1] = '0' + @truncate(u8, displayed_percent % 10); } else if (displayed_percent < 100) { text = text_buf[0..3]; text[1] = '0' + @truncate(u8, displayed_percent / 10); text[2] = '0' + @truncate(u8, displayed_percent % 10); } else { text = text_buf[0..4]; text[1] = '1'; text[2] = '0'; text[3] = '0'; } if (displayed_percent == 0) { log("scrolling '0' just once", .{}); } else { log("scrolling '{}' repeatedly", .{text}); } } else if (displayed_percent == 0) { return; } column = 0; index = 0; } } const mask: u32 = 0b1111011110111101111011110; const right = if (column % 6 == 0) 0 else LedMatrix.getImage(text[index]) >> @truncate(u5, 5 - column % 6); LedMatrix.putImage(LedMatrix.image << 1 & mask | (right & ~mask)); column += 1; } } }; const Throttle = struct { var pwm_width_ticks: u32 = undefined; const pwm_width_ticks_max = 312; var percent: u32 = undefined; fn movePercent(message: []const u8, delta: i32) void { setPercent(message, @intCast(i32, percent) + delta); } fn prepare() void { percent = 0; Gpio.config[02] = Gpio.config_masks.output; Gpio.config[03] = Gpio.config_masks.input; Ppi.setChannelEventAndTask(0, &Timer1.events.compare[0], &Gpiote.tasks.out[0]); Ppi.setChannelEventAndTask(1, &Timer1.events.compare[1], &Gpiote.tasks.out[0]); Timer1.short_cuts.shorts = 0x002; Timer1.capture_compare_registers[1] = pwm_width_ticks_max; } fn setPercent(message: []const u8, new: i32) void { const new_percent = @intCast(u32, math.min(math.max(new, 0), 100)); if (new_percent != percent) { log("{}: throttle changed from {} to {}", .{ message, percent, new_percent }); } else { log("{}: throttle remains at {}%", .{ message, percent }); } percent = new_percent; Timer1.tasks.stop = 1; const ppi_channels_0_and_1_mask = 1 << 0 | 1 << 1; Ppi.registers.channel_enable_clear = ppi_channels_0_and_1_mask; Gpiote.config[0] = Gpiote.config_masks.disable; Gpio.registers.out_clear = Gpio.registers_masks.ring1; pwm_width_ticks = 0; if (percent == 100) { Gpio.registers.out_set = Gpio.registers_masks.ring1; } else if (percent > 0) { pwm_width_ticks = 1000 * (100 - percent) * pwm_width_ticks_max / (100 * 1000); Timer1.capture_compare_registers[0] = pwm_width_ticks; Gpio.registers.out_clear = Gpio.registers_masks.ring1; Gpiote.config[0] = 0x30203; Ppi.registers.channel_enable_set = ppi_channels_0_and_1_mask; Timer1.tasks.clear = 1; Timer1.tasks.start = 1; } } }; }; const TerminalActivity = struct { var keyboard_column: u32 = undefined; var prev_led_image: u32 = undefined; var prev_now: u32 = undefined; fn prepare() void { keyboard_column = 1; prev_led_image = 0; prev_now = CycleActivity.up_time_seconds; redraw(); } fn redraw() void { Terminal.clearScreen(); Terminal.setScrollingRegion(status_display_lines, 99); Terminal.move(status_display_lines - 1, 1); log("keyboard input will be echoed below:", .{}); restoreInputLine(); } fn restoreInputLine() void { Terminal.move(999, TerminalActivity.keyboard_column); } fn update() void { if (Uart.isReadByteReady()) { const byte = Uart.readByte(); switch (byte) { 27 => { Uart.writeByteBlocking('$'); keyboard_column += 1; }, 'a' => { ThrottleActivity.releaseSimulatedButtons(); ThrottleActivity.buttons[0].toggleSimulated(); ThrottleActivity.buttons[0].toggleSimulated(); }, 'b' => { ThrottleActivity.releaseSimulatedButtons(); ThrottleActivity.buttons[1].toggleSimulated(); ThrottleActivity.buttons[1].toggleSimulated(); }, 'c' => { ThrottleActivity.releaseSimulatedButtons(); ThrottleActivity.buttons[0].toggleSimulated(); ThrottleActivity.buttons[1].toggleSimulated(); ThrottleActivity.buttons[0].toggleSimulated(); ThrottleActivity.buttons[1].toggleSimulated(); }, 'A' => { ThrottleActivity.buttons[0].toggleSimulated(); }, 'B' => { ThrottleActivity.buttons[1].toggleSimulated(); }, 3 => { SystemControlBlock.requestSystemReset(); }, 12 => { keyboard_column = 1; TerminalActivity.prev_led_image = 0; TerminalActivity.redraw(); ThrottleActivity.redraw(); }, '\r' => { Uart.writeText("\n"); keyboard_column = 1; }, else => { Uart.writeByteBlocking(byte); keyboard_column += 1; }, } } Uart.update(); const now = CycleActivity.up_time_seconds; if (now >= prev_now + 1) { Terminal.hideCursor(); Terminal.move(1, 1); Terminal.line("up {:3}s cycle {}Hz {}us max {}us led max {}us", .{ CycleActivity.up_time_seconds, CycleActivity.cycles_per_second, CycleActivity.cycle_time, CycleActivity.max_cycle_time, LedMatrix.max_elapsed }); Terminal.line("throttle {:2}% pwm {:2}% cc0 {} raw {}", .{ ThrottleActivity.Throttle.percent, ThrottleActivity.loopBackPercent(), ThrottleActivity.Throttle.pwm_width_ticks, ThrottleActivity.pwm_loop_back_counter }); Terminal.showCursor(); restoreInputLine(); prev_now = now; ThrottleActivity.pwm_loop_back_counter = 0; } else if (LedMatrix.image != prev_led_image) { Terminal.hideCursor(); Terminal.attribute(33); var mask: u32 = 0x1; var y: i32 = 4; while (y >= 0) : (y -= 1) { var x: i32 = 4; while (x >= 0) : (x -= 1) { const v = LedMatrix.image & mask; if (v != prev_led_image & mask) { Terminal.move(@intCast(u32, 4 + y), @intCast(u32, 21 + 2 * x)); Uart.writeText(if (v != 0) "[]" else " "); } mask <<= 1; } } prev_led_image = LedMatrix.image; Terminal.attribute(0); restoreInputLine(); } } }; comptime { const mission_id = 2; asm (typicalVectorTable(mission_id)); } const status_display_lines = 6 + 5; usingnamespace @import("lib_basics.zig").typical;
mission2_model_railroad_pwm.zig
const std = @import("std"); const wl = @import("wayland").server.wl; const B = struct { data: u32, link: wl.list.Link = undefined, }; const C = struct { data: u32, link: wl.list.Link = undefined, pub fn getLink(c: *C) *wl.list.Link { return &c.link; } pub fn fromLink(link: *wl.list.Link) *C { return @fieldParentPtr(C, "link", link); } }; pub fn main() void { { var a: wl.list.Head(B, "link") = undefined; a.init(); var one = B{ .data = 1 }; var two = B{ .data = 2 }; var three = B{ .data = 3 }; var four = B{ .data = 4 }; var five = B{ .data = 5 }; std.debug.print("length: {} empty: {}\n", .{ a.length(), a.empty() }); a.append(&one); a.append(&two); a.append(&three); a.append(&four); a.append(&five); std.debug.print("length: {} empty: {}\n", .{ a.length(), a.empty() }); { std.debug.print("forward\n", .{}); var it = a.iterator(.forward); while (it.next()) |b| std.debug.print("{}\n", .{b.data}); } three.link.remove(); a.prepend(&three); { std.debug.print("reverse moved three\n", .{}); var it = a.iterator(.reverse); while (it.next()) |b| std.debug.print("{}\n", .{b.data}); } } { var a: wl.list.Head(C, null) = undefined; a.init(); var one = C{ .data = 1 }; var two = C{ .data = 2 }; var three = C{ .data = 3 }; var four = C{ .data = 4 }; var five = C{ .data = 5 }; std.debug.print("length: {} empty: {}\n", .{ a.length(), a.empty() }); a.append(&one); a.append(&two); a.append(&three); a.append(&four); a.append(&five); std.debug.print("length: {} empty: {}\n", .{ a.length(), a.empty() }); { std.debug.print("forward\n", .{}); var it = a.iterator(.forward); while (it.next()) |b| std.debug.print("{}\n", .{b.data}); } three.link.remove(); a.prepend(&three); { std.debug.print("reverse moved three\n", .{}); var it = a.iterator(.reverse); while (it.next()) |b| std.debug.print("{}\n", .{b.data}); } } }
example/list.zig
usingnamespace @import("root").preamble; /// Node hook for the queue. Embedded inside queue element. pub const Node = struct { next: ?*Node = undefined, }; /// Non-atomic queue pub fn Queue(comptime T: type, comptime member_name: []const u8) type { return struct { head: ?*Node = null, tail: ?*Node = null, /// Convert reference to T to reference to atomic queue node fn refToNode(ref: *T) *Node { return &@field(ref, member_name); } /// Convert reference to atomic queue node to reference to T fn nodeToRef(node: *Node) *T { return @fieldParentPtr(T, member_name, node); } /// Enqueue node pub fn enqueue(self: *@This(), node: *T) void { const hook = refToNode(node); hook.next = null; if (self.tail) |tail_nonnull| { tail_nonnull.next = hook; self.tail = hook; } else { std.debug.assert(self.head == null); self.head = hook; self.tail = hook; } } // Dequeue node pub fn dequeue(self: *@This()) ?*T { if (self.head) |head_nonnull| { if (head_nonnull.next) |next| { self.head = next; } else { self.head = null; self.tail = null; } return nodeToRef(head_nonnull); } return null; } // Get queue head element pub fn front(self: *@This()) ?*T { return if (self.head) |head| nodeToRef(head) else null; } }; } test "insertion tests" { const TestNode = struct { hook: Node = undefined, val: u64, }; var queue: Queue(TestNode, "hook") = .{}; var elems = [_]TestNode{ .{ .val = 1 }, .{ .val = 2 }, .{ .val = 3 }, }; queue.enqueue(&elems[0]); queue.enqueue(&elems[1]); queue.enqueue(&elems[2]); try std.testing.expect(queue.dequeue() == &elems[0]); try std.testing.expect(queue.dequeue() == &elems[1]); try std.testing.expect(queue.dequeue() == &elems[2]); try std.testing.expect(queue.dequeue() == null); }
lib/containers/queue.zig
const tests = @import("tests.zig"); const std = @import("std"); const CrossTarget = std.zig.CrossTarget; pub fn addCases(cases: *tests.TranslateCContext) void { const default_enum_type = if (std.Target.current.abi == .msvc) "c_int" else "c_uint"; cases.add("field access is grouped if necessary", \\unsigned long foo(unsigned long x) { \\ return ((union{unsigned long _x}){x})._x; \\} , &[_][]const u8{ \\pub export fn foo(arg_x: c_ulong) c_ulong { \\ var x = arg_x; \\ const union_unnamed_1 = extern union { \\ _x: c_ulong, \\ }; \\ return (union_unnamed_1{ \\ ._x = x, \\ })._x; \\} }); cases.add("unnamed child types of typedef receive typedef's name", \\typedef enum { \\ FooA, \\ FooB, \\} Foo; \\typedef struct { \\ int a, b; \\} Bar; , &[_][]const u8{ \\pub const FooA: c_int = 0; \\pub const FooB: c_int = 1; \\pub const Foo = ++ " " ++ default_enum_type ++ \\; \\pub const Bar = extern struct { \\ a: c_int, \\ b: c_int, \\}; }); cases.add("if as while stmt has semicolon", \\void foo() { \\ while (1) if (1) { \\ int a = 1; \\ } else { \\ int b = 2; \\ } \\ if (1) if (1) {} \\} , &[_][]const u8{ \\pub export fn foo() void { \\ while (true) if (true) { \\ var a: c_int = 1; \\ _ = a; \\ } else { \\ var b: c_int = 2; \\ _ = b; \\ }; \\ if (true) if (true) {}; \\} }); cases.add("conditional operator cast to void", \\int bar(); \\void foo() { \\ int a; \\ a ? a = 2 : bar(); \\} , &[_][]const u8{ \\pub extern fn bar(...) c_int; \\pub export fn foo() void { \\ var a: c_int = undefined; \\ if (a != 0) a = 2 else _ = bar(); \\} }); cases.add("struct in struct init to zero", \\struct Foo { \\ int a; \\ struct Bar { \\ int a; \\ } b; \\} a = {}; \\#define PTR void * , &[_][]const u8{ \\pub const struct_Bar = extern struct { \\ a: c_int, \\}; \\pub const struct_Foo = extern struct { \\ a: c_int, \\ b: struct_Bar, \\}; \\pub export var a: struct_Foo = struct_Foo{ \\ .a = 0, \\ .b = @import("std").mem.zeroes(struct_Bar), \\}; , \\pub const PTR = ?*c_void; }); cases.add("scoped record", \\void foo() { \\ struct Foo { \\ int A; \\ int B; \\ int C; \\ }; \\ struct Foo a = {0}; \\ { \\ struct Foo { \\ int A; \\ int B; \\ int C; \\ }; \\ struct Foo a = {0}; \\ } \\} , &[_][]const u8{ \\pub export fn foo() void { \\ const struct_Foo = extern struct { \\ A: c_int, \\ B: c_int, \\ C: c_int, \\ }; \\ var a: struct_Foo = struct_Foo{ \\ .A = @as(c_int, 0), \\ .B = 0, \\ .C = 0, \\ }; \\ _ = a; \\ { \\ const struct_Foo_1 = extern struct { \\ A: c_int, \\ B: c_int, \\ C: c_int, \\ }; \\ var a_2: struct_Foo_1 = struct_Foo_1{ \\ .A = @as(c_int, 0), \\ .B = 0, \\ .C = 0, \\ }; \\ _ = a_2; \\ } \\} }); cases.add("scoped typedef", \\void foo() { \\ typedef union { \\ int A; \\ int B; \\ int C; \\ } Foo; \\ Foo a = {0}; \\ { \\ typedef union { \\ int A; \\ int B; \\ int C; \\ } Foo; \\ Foo a = {0}; \\ } \\} , &[_][]const u8{ \\pub export fn foo() void { \\ const union_unnamed_1 = extern union { \\ A: c_int, \\ B: c_int, \\ C: c_int, \\ }; \\ _ = union_unnamed_1; \\ const Foo = union_unnamed_1; \\ var a: Foo = Foo{ \\ .A = @as(c_int, 0), \\ }; \\ _ = a; \\ { \\ const union_unnamed_2 = extern union { \\ A: c_int, \\ B: c_int, \\ C: c_int, \\ }; \\ _ = union_unnamed_2; \\ const Foo_1 = union_unnamed_2; \\ var a_2: Foo_1 = Foo_1{ \\ .A = @as(c_int, 0), \\ }; \\ _ = a_2; \\ } \\} }); cases.add("use cast param as macro fn return type", \\#include <stdint.h> \\#define MEM_PHYSICAL_TO_K0(x) (void*)((uint32_t)(x) + SYS_BASE_CACHED) , &[_][]const u8{ \\pub inline fn MEM_PHYSICAL_TO_K0(x: anytype) ?*c_void { \\ return @import("std").zig.c_translation.cast(?*c_void, @import("std").zig.c_translation.cast(u32, x) + SYS_BASE_CACHED); \\} }); cases.add("variadic function demoted to extern", \\int foo(int bar, ...) { \\ return 1; \\} , &[_][]const u8{ \\warning: TODO unable to translate variadic function, demoted to extern \\pub extern fn foo(bar: c_int, ...) c_int; }); cases.add("pointer to opaque demoted struct", \\typedef struct { \\ _Atomic int foo; \\} Foo; \\ \\typedef struct { \\ Foo *bar; \\} Bar; , &[_][]const u8{ \\source.h:1:9: warning: struct demoted to opaque type - unable to translate type of field foo \\pub const Foo = opaque {}; \\pub const Bar = extern struct { \\ bar: ?*Foo, \\}; }); cases.add("macro expressions respect C operator precedence", \\#define FOO *((foo) + 2) \\#define VALUE (1 + 2 * 3 + 4 * 5 + 6 << 7 | 8 == 9) \\#define _AL_READ3BYTES(p) ((*(unsigned char *)(p)) \ \\ | (*((unsigned char *)(p) + 1) << 8) \ \\ | (*((unsigned char *)(p) + 2) << 16)) , &[_][]const u8{ \\pub const FOO = (foo + @as(c_int, 2)).*; , \\pub const VALUE = ((((@as(c_int, 1) + (@as(c_int, 2) * @as(c_int, 3))) + (@as(c_int, 4) * @as(c_int, 5))) + @as(c_int, 6)) << @as(c_int, 7)) | @boolToInt(@as(c_int, 8) == @as(c_int, 9)); , \\pub inline fn _AL_READ3BYTES(p: anytype) @TypeOf((@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16))) { \\ return (@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16)); \\} }); cases.add("static variable in block scope", \\float bar; \\int foo() { \\ _Thread_local static int bar = 2; \\} , &[_][]const u8{ \\pub export var bar: f32 = @import("std").mem.zeroes(f32); \\pub export fn foo() c_int { \\ const bar_1 = struct { \\ threadlocal var static: c_int = 2; \\ }; \\ _ = bar_1; \\ return 0; \\} }); cases.add("missing return stmt", \\int foo() {} \\int bar() { \\ int a = 2; \\} \\int baz() { \\ return 0; \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ return 0; \\} \\pub export fn bar() c_int { \\ var a: c_int = 2; \\ _ = a; \\ return 0; \\} \\pub export fn baz() c_int { \\ return 0; \\} }); cases.add("alignof", \\void main() { \\ int a = _Alignof(int); \\} , &[_][]const u8{ \\pub export fn main() void { \\ var a: c_int = @bitCast(c_int, @truncate(c_uint, @alignOf(c_int))); \\ _ = a; \\} }); cases.add("initializer list macro", \\typedef struct Color { \\ unsigned char r; \\ unsigned char g; \\ unsigned char b; \\ unsigned char a; \\} Color; \\#define CLITERAL(type) (type) \\#define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray \\typedef struct boom_t \\{ \\ int i1; \\} boom_t; \\#define FOO ((boom_t){1}) \\typedef struct { float x; } MyCStruct; \\#define A(_x) (MyCStruct) { .x = (_x) } \\#define B A(0.f) , &[_][]const u8{ \\pub const struct_Color = extern struct { \\ r: u8, \\ g: u8, \\ b: u8, \\ a: u8, \\}; \\pub const Color = struct_Color; , \\pub inline fn CLITERAL(@"type": anytype) @TypeOf(@"type") { \\ return @"type"; \\} , \\pub const LIGHTGRAY = @import("std").mem.zeroInit(CLITERAL(Color), .{ @as(c_int, 200), @as(c_int, 200), @as(c_int, 200), @as(c_int, 255) }); , \\pub const struct_boom_t = extern struct { \\ i1: c_int, \\}; \\pub const boom_t = struct_boom_t; , \\pub const FOO = @import("std").mem.zeroInit(boom_t, .{@as(c_int, 1)}); , \\pub const MyCStruct = extern struct { \\ x: f32, \\}; , \\pub inline fn A(_x: anytype) MyCStruct { \\ return @import("std").mem.zeroInit(MyCStruct, .{ \\ .x = _x, \\ }); \\} , \\pub const B = A(@as(f32, 0.0)); }); cases.add("complex switch", \\int main() { \\ int i = 2; \\ switch (i) { \\ case 0: { \\ case 2:{ \\ i += 2;} \\ i += 1; \\ } \\ } \\} , &[_][]const u8{ // TODO properly translate this \\source.h:5:13: warning: TODO complex switch , \\source.h:1:5: warning: unable to translate function, demoted to extern \\pub extern fn main() c_int; }); cases.add("correct semicolon after infixop", \\#define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0) , &[_][]const u8{ \\pub inline fn __ferror_unlocked_body(_fp: anytype) @TypeOf((_fp.*._flags & _IO_ERR_SEEN) != @as(c_int, 0)) { \\ return (_fp.*._flags & _IO_ERR_SEEN) != @as(c_int, 0); \\} }); cases.add("c booleans are just ints", \\#define FOO(x) ((x >= 0) + (x >= 0)) \\#define BAR 1 && 2 > 4 , &[_][]const u8{ \\pub inline fn FOO(x: anytype) @TypeOf(@boolToInt(x >= @as(c_int, 0)) + @boolToInt(x >= @as(c_int, 0))) { \\ return @boolToInt(x >= @as(c_int, 0)) + @boolToInt(x >= @as(c_int, 0)); \\} , \\pub const BAR = (@as(c_int, 1) != 0) and (@as(c_int, 2) > @as(c_int, 4)); }); cases.add("struct with aligned fields", \\struct foo { \\ __attribute__((aligned(1))) short bar; \\}; , &[_][]const u8{ \\pub const struct_foo = extern struct { \\ bar: c_short align(1), \\}; }); cases.add("struct with flexible array", \\struct foo { int x; int y[]; }; \\struct bar { int x; int y[0]; }; , &[_][]const u8{ \\pub const struct_foo = extern struct { \\ x: c_int align(4), \\ pub fn y(self: anytype) @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), c_int) { \\ const Intermediate = @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), u8); \\ const ReturnType = @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), c_int); \\ return @ptrCast(ReturnType, @alignCast(@alignOf(c_int), @ptrCast(Intermediate, self) + 4)); \\ } \\}; \\pub const struct_bar = extern struct { \\ x: c_int align(4), \\ pub fn y(self: anytype) @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), c_int) { \\ const Intermediate = @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), u8); \\ const ReturnType = @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), c_int); \\ return @ptrCast(ReturnType, @alignCast(@alignOf(c_int), @ptrCast(Intermediate, self) + 4)); \\ } \\}; }); cases.add("nested loops without blocks", \\void foo() { \\ while (0) while (0) {} \\ for (;;) while (0); \\ for (;;) do {} while (0); \\} , &[_][]const u8{ \\pub export fn foo() void { \\ while (false) while (false) {}; \\ while (true) while (false) {}; \\ while (true) {} \\} }); cases.add("macro comma operator", \\#define foo (foo, bar) \\#define bar(x) (&x, +3, 4 == 4, 5 * 6, baz(1, 2), 2 % 2, baz(1,2)) , &[_][]const u8{ \\pub const foo = blk: { \\ _ = foo; \\ break :blk bar; \\}; , \\pub inline fn bar(x: anytype) @TypeOf(baz(@as(c_int, 1), @as(c_int, 2))) { \\ return blk: { \\ _ = &x; \\ _ = @as(c_int, 3); \\ _ = @as(c_int, 4) == @as(c_int, 4); \\ _ = @as(c_int, 5) * @as(c_int, 6); \\ _ = baz(@as(c_int, 1), @as(c_int, 2)); \\ _ = @as(c_int, 2) % @as(c_int, 2); \\ break :blk baz(@as(c_int, 1), @as(c_int, 2)); \\ }; \\} }); cases.add("macro keyword define", \\#define foo 1 \\#define inline 2 , &[_][]const u8{ \\pub const foo = @as(c_int, 1); , \\pub const @"inline" = @as(c_int, 2); }); cases.add("macro line continuation", \\#define FOO -\ \\BAR , &[_][]const u8{ \\pub const FOO = -BAR; }); cases.add("struct with atomic field", \\struct arcan_shmif_cont { \\ struct arcan_shmif_page* addr; \\}; \\struct arcan_shmif_page { \\ volatile _Atomic int abufused[12]; \\}; , &[_][]const u8{ \\source.h:4:8: warning: struct demoted to opaque type - unable to translate type of field abufused \\pub const struct_arcan_shmif_page = opaque {}; \\pub const struct_arcan_shmif_cont = extern struct { \\ addr: ?*struct_arcan_shmif_page, \\}; }); cases.add("function prototype translated as optional", \\typedef void (*fnptr_ty)(void); \\typedef __attribute__((cdecl)) void (*fnptr_attr_ty)(void); \\struct foo { \\ __attribute__((cdecl)) void (*foo)(void); \\ void (*bar)(void); \\ fnptr_ty baz; \\ fnptr_attr_ty qux; \\}; , &[_][]const u8{ \\pub const fnptr_ty = ?fn () callconv(.C) void; \\pub const fnptr_attr_ty = ?fn () callconv(.C) void; \\pub const struct_foo = extern struct { \\ foo: ?fn () callconv(.C) void, \\ bar: ?fn () callconv(.C) void, \\ baz: fnptr_ty, \\ qux: fnptr_attr_ty, \\}; }); cases.add("function prototype with parenthesis", \\void (f0) (void *L); \\void ((f1)) (void *L); \\void (((f2))) (void *L); , &[_][]const u8{ \\pub extern fn f0(L: ?*c_void) void; \\pub extern fn f1(L: ?*c_void) void; \\pub extern fn f2(L: ?*c_void) void; }); cases.add("array initializer w/ typedef", \\typedef unsigned char uuid_t[16]; \\static const uuid_t UUID_NULL __attribute__ ((unused)) = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; , &[_][]const u8{ \\pub const uuid_t = [16]u8; \\pub const UUID_NULL: uuid_t = [16]u8{ \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\ 0, \\}; }); cases.add("empty declaration", \\; , &[_][]const u8{""}); cases.add("#define hex literal with capital X", \\#define VAL 0XF00D , &[_][]const u8{ \\pub const VAL = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xF00D, .hexadecimal); }); cases.add("anonymous struct & unions", \\typedef struct { \\ union { \\ char x; \\ struct { int y; }; \\ }; \\} outer; \\void foo(outer *x) { x->y = x->x; } , &[_][]const u8{ \\const struct_unnamed_2 = extern struct { \\ y: c_int, \\}; \\const union_unnamed_1 = extern union { \\ x: u8, \\ unnamed_0: struct_unnamed_2, \\}; \\pub const outer = extern struct { \\ unnamed_0: union_unnamed_1, \\}; \\pub export fn foo(arg_x: [*c]outer) void { \\ var x = arg_x; \\ x.*.unnamed_0.unnamed_0.y = @bitCast(c_int, @as(c_uint, x.*.unnamed_0.x)); \\} }); cases.add("union initializer", \\union { int x; char c[4]; } \\ ua = {1}, \\ ub = {.c={'a','b','b','a'}}; , &[_][]const u8{ \\const union_unnamed_1 = extern union { \\ x: c_int, \\ c: [4]u8, \\}; \\pub export var ua: union_unnamed_1 = union_unnamed_1{ \\ .x = @as(c_int, 1), \\}; \\pub export var ub: union_unnamed_1 = union_unnamed_1{ \\ .c = [4]u8{ \\ 'a', \\ 'b', \\ 'b', \\ 'a', \\ }, \\}; }); cases.add("struct initializer - simple", \\typedef struct { int x; } foo; \\struct {double x,y,z;} s0 = {1.2, 1.3}; \\struct {int sec,min,hour,day,mon,year;} s1 = {.day=31,12,2014,.sec=30,15,17}; \\struct {int x,y;} s2 = {.y = 2, .x=1}; \\foo s3 = { 123 }; , &[_][]const u8{ \\pub const foo = extern struct { \\ x: c_int, \\}; \\const struct_unnamed_1 = extern struct { \\ x: f64, \\ y: f64, \\ z: f64, \\}; \\pub export var s0: struct_unnamed_1 = struct_unnamed_1{ \\ .x = 1.2, \\ .y = 1.3, \\ .z = 0, \\}; \\const struct_unnamed_2 = extern struct { \\ sec: c_int, \\ min: c_int, \\ hour: c_int, \\ day: c_int, \\ mon: c_int, \\ year: c_int, \\}; \\pub export var s1: struct_unnamed_2 = struct_unnamed_2{ \\ .sec = @as(c_int, 30), \\ .min = @as(c_int, 15), \\ .hour = @as(c_int, 17), \\ .day = @as(c_int, 31), \\ .mon = @as(c_int, 12), \\ .year = @as(c_int, 2014), \\}; \\const struct_unnamed_3 = extern struct { \\ x: c_int, \\ y: c_int, \\}; \\pub export var s2: struct_unnamed_3 = struct_unnamed_3{ \\ .x = @as(c_int, 1), \\ .y = @as(c_int, 2), \\}; \\pub export var s3: foo = foo{ \\ .x = @as(c_int, 123), \\}; }); cases.add("simple ptrCast for casts between opaque types", \\struct opaque; \\struct opaque_2; \\void function(struct opaque *opaque) { \\ struct opaque_2 *cast = (struct opaque_2 *)opaque; \\} , &[_][]const u8{ \\pub const struct_opaque = opaque {}; \\pub const struct_opaque_2 = opaque {}; \\pub export fn function(arg_opaque_1: ?*struct_opaque) void { \\ var opaque_1 = arg_opaque_1; \\ var cast: ?*struct_opaque_2 = @ptrCast(?*struct_opaque_2, opaque_1); \\ _ = cast; \\} }); cases.add("struct initializer - packed", \\struct {int x,y,z;} __attribute__((packed)) s0 = {1, 2}; , &[_][]const u8{ \\const struct_unnamed_1 = packed struct { \\ x: c_int, \\ y: c_int, \\ z: c_int, \\}; \\pub export var s0: struct_unnamed_1 = struct_unnamed_1{ \\ .x = @as(c_int, 1), \\ .y = @as(c_int, 2), \\ .z = 0, \\}; }); cases.add("align() attribute", \\__attribute__ ((aligned(128))) \\extern char my_array[16]; \\__attribute__ ((aligned(128))) \\void my_fn(void) { } \\void other_fn(void) { \\ char ARR[16] __attribute__ ((aligned (16))); \\} , &[_][]const u8{ \\pub extern var my_array: [16]u8 align(128); \\pub export fn my_fn() align(128) void {} \\pub export fn other_fn() void { \\ var ARR: [16]u8 align(16) = undefined; \\ _ = ARR; \\} }); cases.add("linksection() attribute", \\// Use the "segment,section" format to make this test pass when \\// targeting the mach-o binary format \\__attribute__ ((__section__("NEAR,.data"))) \\extern char my_array[16]; \\__attribute__ ((__section__("NEAR,.data"))) \\void my_fn(void) { } , &[_][]const u8{ \\pub extern var my_array: [16]u8 linksection("NEAR,.data"); \\pub export fn my_fn() linksection("NEAR,.data") void {} }); cases.add("simple function prototypes", \\void __attribute__((noreturn)) foo(void); \\int bar(void); , &[_][]const u8{ \\pub extern fn foo() noreturn; \\pub extern fn bar() c_int; }); cases.add("simple var decls", \\void foo(void) { \\ int a; \\ char b = 123; \\ const int c; \\ const unsigned d = 440; \\ int e = 10; \\ unsigned int f = 10u; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: c_int = undefined; \\ _ = a; \\ var b: u8 = 123; \\ _ = b; \\ const c: c_int = undefined; \\ _ = c; \\ const d: c_uint = @bitCast(c_uint, @as(c_int, 440)); \\ _ = d; \\ var e: c_int = 10; \\ _ = e; \\ var f: c_uint = 10; \\ _ = f; \\} }); cases.add("ignore result, explicit function arguments", \\void foo(void) { \\ int a; \\ 1; \\ "hey"; \\ 1 + 1; \\ 1 - 1; \\ a = 1; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: c_int = undefined; \\ _ = @as(c_int, 1); \\ _ = "hey"; \\ _ = @as(c_int, 1) + @as(c_int, 1); \\ _ = @as(c_int, 1) - @as(c_int, 1); \\ a = 1; \\} }); cases.add("function with no prototype", \\int foo() { \\ return 5; \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ return 5; \\} }); cases.add("variables", \\extern int extern_var; \\static const int int_var = 13; \\int foo; , &[_][]const u8{ \\pub extern var extern_var: c_int; \\pub const int_var: c_int = 13; \\pub export var foo: c_int = @import("std").mem.zeroes(c_int); }); cases.add("const ptr initializer", \\static const char *v0 = "0.0.0"; , &[_][]const u8{ \\pub var v0: [*c]const u8 = "0.0.0"; }); cases.add("static incomplete array inside function", \\void foo(void) { \\ static const char v2[] = "2.2.2"; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ const v2 = struct { \\ const static: [5:0]u8 = "2.2.2".*; \\ }; \\ _ = v2; \\} }); cases.add("simple function definition", \\void foo(void) {} \\static void bar(void) {} , &[_][]const u8{ \\pub export fn foo() void {} \\pub fn bar() callconv(.C) void {} }); cases.add("typedef void", \\typedef void Foo; \\Foo fun(Foo *a); , &[_][]const u8{ \\pub const Foo = c_void; , \\pub extern fn fun(a: ?*Foo) Foo; }); cases.add("duplicate typedef", \\typedef long foo; \\typedef int bar; \\typedef long foo; \\typedef int baz; , &[_][]const u8{ \\pub const foo = c_long; \\pub const bar = c_int; \\pub const baz = c_int; }); cases.add("casting pointers to ints and ints to pointers", \\void foo(void); \\void bar(void) { \\ void *func_ptr = foo; \\ void (*typed_func_ptr)(void) = (void (*)(void)) (unsigned long) func_ptr; \\} , &[_][]const u8{ \\pub extern fn foo() void; \\pub export fn bar() void { \\ var func_ptr: ?*c_void = @ptrCast(?*c_void, foo); \\ var typed_func_ptr: ?fn () callconv(.C) void = @intToPtr(?fn () callconv(.C) void, @intCast(c_ulong, @ptrToInt(func_ptr))); \\ _ = typed_func_ptr; \\} }); cases.add("noreturn attribute", \\void foo(void) __attribute__((noreturn)); , &[_][]const u8{ \\pub extern fn foo() noreturn; }); cases.add("add, sub, mul, div, rem", \\int s() { \\ int a, b, c; \\ c = a + b; \\ c = a - b; \\ c = a * b; \\ c = a / b; \\ c = a % b; \\} \\unsigned u() { \\ unsigned a, b, c; \\ c = a + b; \\ c = a - b; \\ c = a * b; \\ c = a / b; \\ c = a % b; \\} , &[_][]const u8{ \\pub export fn s() c_int { \\ var a: c_int = undefined; \\ var b: c_int = undefined; \\ var c: c_int = undefined; \\ c = a + b; \\ c = a - b; \\ c = a * b; \\ c = @divTrunc(a, b); \\ c = @rem(a, b); \\ return 0; \\} \\pub export fn u() c_uint { \\ var a: c_uint = undefined; \\ var b: c_uint = undefined; \\ var c: c_uint = undefined; \\ c = a +% b; \\ c = a -% b; \\ c = a *% b; \\ c = a / b; \\ c = a % b; \\ return 0; \\} }); cases.add("typedef of function in struct field", \\typedef void lws_callback_function(void); \\struct Foo { \\ void (*func)(void); \\ lws_callback_function *callback_http; \\}; , &[_][]const u8{ \\pub const lws_callback_function = fn () callconv(.C) void; \\pub const struct_Foo = extern struct { \\ func: ?fn () callconv(.C) void, \\ callback_http: ?lws_callback_function, \\}; }); cases.add("pointer to struct demoted to opaque due to bit fields", \\struct Foo { \\ unsigned int: 1; \\}; \\struct Bar { \\ struct Foo *foo; \\}; , &[_][]const u8{ \\pub const struct_Foo = opaque {}; , \\pub const struct_Bar = extern struct { \\ foo: ?*struct_Foo, \\}; }); cases.add("macro with left shift", \\#define REDISMODULE_READ (1<<0) , &[_][]const u8{ \\pub const REDISMODULE_READ = @as(c_int, 1) << @as(c_int, 0); }); cases.add("macro with right shift", \\#define FLASH_SIZE 0x200000UL /* 2 MB */ \\#define FLASH_BANK_SIZE (FLASH_SIZE >> 1) /* 1 MB */ , &[_][]const u8{ \\pub const FLASH_SIZE = @as(c_ulong, 0x200000); , \\pub const FLASH_BANK_SIZE = FLASH_SIZE >> @as(c_int, 1); }); cases.add("double define struct", \\typedef struct Bar Bar; \\typedef struct Foo Foo; \\ \\struct Foo { \\ Foo *a; \\}; \\ \\struct Bar { \\ Foo *a; \\}; , &[_][]const u8{ \\pub const struct_Foo = extern struct { \\ a: [*c]Foo, \\}; , \\pub const Foo = struct_Foo; , \\pub const struct_Bar = extern struct { \\ a: [*c]Foo, \\}; , \\pub const Bar = struct_Bar; }); cases.add("simple struct", \\struct Foo { \\ int x; \\ char *y; \\}; , &[_][]const u8{ \\const struct_Foo = extern struct { \\ x: c_int, \\ y: [*c]u8, \\}; , \\pub const Foo = struct_Foo; }); cases.add("self referential struct with function pointer", \\struct Foo { \\ void (*derp)(struct Foo *foo); \\}; , &[_][]const u8{ \\pub const struct_Foo = extern struct { \\ derp: ?fn ([*c]struct_Foo) callconv(.C) void, \\}; , \\pub const Foo = struct_Foo; }); cases.add("struct prototype used in func", \\struct Foo; \\struct Foo *some_func(struct Foo *foo, int x); , &[_][]const u8{ \\pub const struct_Foo = opaque {}; , \\pub extern fn some_func(foo: ?*struct_Foo, x: c_int) ?*struct_Foo; , \\pub const Foo = struct_Foo; }); cases.add("#define an unsigned integer literal", \\#define CHANNEL_COUNT 24 , &[_][]const u8{ \\pub const CHANNEL_COUNT = @as(c_int, 24); }); cases.add("#define referencing another #define", \\#define THING2 THING1 \\#define THING1 1234 , &[_][]const u8{ \\pub const THING1 = @as(c_int, 1234); , \\pub const THING2 = THING1; }); cases.add("circular struct definitions", \\struct Bar; \\ \\struct Foo { \\ struct Bar *next; \\}; \\ \\struct Bar { \\ struct Foo *next; \\}; , &[_][]const u8{ \\pub const struct_Bar = extern struct { \\ next: [*c]struct_Foo, \\}; , \\pub const struct_Foo = extern struct { \\ next: [*c]struct_Bar, \\}; }); cases.add("#define string", \\#define foo "a string" , &[_][]const u8{ \\pub const foo = "a string"; }); cases.add("zig keywords in C code", \\struct comptime { \\ int defer; \\}; , &[_][]const u8{ \\pub const struct_comptime = extern struct { \\ @"defer": c_int, \\}; , \\pub const @"comptime" = struct_comptime; }); cases.add("macro with parens around negative number", \\#define LUA_GLOBALSINDEX (-10002) , &[_][]const u8{ \\pub const LUA_GLOBALSINDEX = -@as(c_int, 10002); }); cases.add( "u integer suffix after 0 (zero) in macro definition", "#define ZERO 0U", &[_][]const u8{ "pub const ZERO = @as(c_uint, 0);", }, ); cases.add( "l integer suffix after 0 (zero) in macro definition", "#define ZERO 0L", &[_][]const u8{ "pub const ZERO = @as(c_long, 0);", }, ); cases.add( "ul integer suffix after 0 (zero) in macro definition", "#define ZERO 0UL", &[_][]const u8{ "pub const ZERO = @as(c_ulong, 0);", }, ); cases.add( "lu integer suffix after 0 (zero) in macro definition", "#define ZERO 0LU", &[_][]const u8{ "pub const ZERO = @as(c_ulong, 0);", }, ); cases.add( "ll integer suffix after 0 (zero) in macro definition", "#define ZERO 0LL", &[_][]const u8{ "pub const ZERO = @as(c_longlong, 0);", }, ); cases.add( "ull integer suffix after 0 (zero) in macro definition", "#define ZERO 0ULL", &[_][]const u8{ "pub const ZERO = @as(c_ulonglong, 0);", }, ); cases.add( "llu integer suffix after 0 (zero) in macro definition", "#define ZERO 0LLU", &[_][]const u8{ "pub const ZERO = @as(c_ulonglong, 0);", }, ); cases.add( "bitwise not on u-suffixed 0 (zero) in macro definition", "#define NOT_ZERO (~0U)", &[_][]const u8{ "pub const NOT_ZERO = ~@as(c_uint, 0);", }, ); cases.add("float suffixes", \\#define foo 3.14f \\#define bar 16.e-2l \\#define FOO 0.12345 \\#define BAR .12345 , &[_][]const u8{ "pub const foo = @as(f32, 3.14);", "pub const bar = @as(c_longdouble, 16.0e-2);", "pub const FOO = 0.12345;", "pub const BAR = 0.12345;", }); cases.add("comments", \\#define foo 1 //foo \\#define bar /* bar */ 2 , &[_][]const u8{ "pub const foo = @as(c_int, 1);", "pub const bar = @as(c_int, 2);", }); cases.add("string prefix", \\#define foo L"hello" , &[_][]const u8{ "pub const foo = \"hello\";", }); cases.add("null statements", \\void foo(void) { \\ ;;;;; \\} , &[_][]const u8{ \\pub export fn foo() void {} }); if (std.Target.current.os.tag != .windows) { // Windows treats this as an enum with type c_int cases.add("big negative enum init values when C ABI supports long long enums", \\enum EnumWithInits { \\ VAL01 = 0, \\ VAL02 = 1, \\ VAL03 = 2, \\ VAL04 = 3, \\ VAL05 = -1, \\ VAL06 = -2, \\ VAL07 = -3, \\ VAL08 = -4, \\ VAL09 = VAL02 + VAL08, \\ VAL10 = -1000012000, \\ VAL11 = -1000161000, \\ VAL12 = -1000174001, \\ VAL13 = VAL09, \\ VAL14 = VAL10, \\ VAL15 = VAL11, \\ VAL16 = VAL13, \\ VAL17 = (VAL16 - VAL10 + 1), \\ VAL18 = 0x1000000000000000L, \\ VAL19 = VAL18 + VAL18 + VAL18 - 1, \\ VAL20 = VAL19 + VAL19, \\ VAL21 = VAL20 + 0xFFFFFFFFFFFFFFFF, \\ VAL22 = 0xFFFFFFFFFFFFFFFF + 1, \\ VAL23 = 0xFFFFFFFFFFFFFFFF, \\}; , &[_][]const u8{ \\pub const VAL01: c_int = 0; \\pub const VAL02: c_int = 1; \\pub const VAL03: c_int = 2; \\pub const VAL04: c_int = 3; \\pub const VAL05: c_int = -1; \\pub const VAL06: c_int = -2; \\pub const VAL07: c_int = -3; \\pub const VAL08: c_int = -4; \\pub const VAL09: c_int = -3; \\pub const VAL10: c_int = -1000012000; \\pub const VAL11: c_int = -1000161000; \\pub const VAL12: c_int = -1000174001; \\pub const VAL13: c_int = -3; \\pub const VAL14: c_int = -1000012000; \\pub const VAL15: c_int = -1000161000; \\pub const VAL16: c_int = -3; \\pub const VAL17: c_int = 1000011998; \\pub const VAL18: c_longlong = 1152921504606846976; \\pub const VAL19: c_longlong = 3458764513820540927; \\pub const VAL20: c_longlong = 6917529027641081854; \\pub const VAL21: c_longlong = 6917529027641081853; \\pub const VAL22: c_int = 0; \\pub const VAL23: c_longlong = -1; \\pub const enum_EnumWithInits = c_longlong; }); } cases.add("predefined expressions", \\void foo(void) { \\ __func__; \\ __FUNCTION__; \\ __PRETTY_FUNCTION__; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ _ = "foo"; \\ _ = "foo"; \\ _ = "void foo(void)"; \\} }); cases.add("constant size array", \\void func(int array[20]); , &[_][]const u8{ \\pub extern fn func(array: [*c]c_int) void; }); cases.add("__cdecl doesn't mess up function pointers", \\void foo(void (__cdecl *fn_ptr)(void)); , &[_][]const u8{ \\pub extern fn foo(fn_ptr: ?fn () callconv(.C) void) void; }); cases.add("void cast", \\void foo() { \\ int a; \\ (void) a; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: c_int = undefined; \\ _ = a; \\} }); cases.add("implicit cast to void *", \\void *foo() { \\ unsigned short *x; \\ return x; \\} , &[_][]const u8{ \\pub export fn foo() ?*c_void { \\ var x: [*c]c_ushort = undefined; \\ return @ptrCast(?*c_void, x); \\} }); cases.add("null pointer implicit cast", \\int* foo(void) { \\ return 0; \\} , &[_][]const u8{ \\pub export fn foo() [*c]c_int { \\ return null; \\} }); cases.add("simple union", \\union Foo { \\ int x; \\ double y; \\}; , &[_][]const u8{ \\pub const union_Foo = extern union { \\ x: c_int, \\ y: f64, \\}; , \\pub const Foo = union_Foo; }); cases.add("string literal", \\const char *foo(void) { \\ return "bar"; \\} , &[_][]const u8{ \\pub export fn foo() [*c]const u8 { \\ return "bar"; \\} }); cases.add("return void", \\void foo(void) { \\ return; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ return; \\} }); cases.add("for loop", \\void foo(void) { \\ for (int i = 0; i; i++) { } \\} , &[_][]const u8{ \\pub export fn foo() void { \\ { \\ var i: c_int = 0; \\ while (i != 0) : (i += 1) {} \\ } \\} }); cases.add("empty for loop", \\void foo(void) { \\ for (;;) { } \\} , &[_][]const u8{ \\pub export fn foo() void { \\ while (true) {} \\} }); cases.add("for loop with simple init expression", \\void foo(void) { \\ int i; \\ for (i = 3; i; i--) { } \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var i: c_int = undefined; \\ { \\ i = 3; \\ while (i != 0) : (i -= 1) {} \\ } \\} }); cases.add("break statement", \\void foo(void) { \\ for (;;) { \\ break; \\ } \\} , &[_][]const u8{ \\pub export fn foo() void { \\ while (true) { \\ break; \\ } \\} }); cases.add("continue statement", \\void foo(void) { \\ for (;;) { \\ continue; \\ } \\} , &[_][]const u8{ \\pub export fn foo() void { \\ while (true) { \\ continue; \\ } \\} }); cases.add("pointer casting", \\float *ptrcast() { \\ int *a; \\ return (float *)a; \\} , &[_][]const u8{ \\pub export fn ptrcast() [*c]f32 { \\ var a: [*c]c_int = undefined; \\ return @ptrCast([*c]f32, @alignCast(@import("std").meta.alignment(f32), a)); \\} }); cases.add("pointer conversion with different alignment", \\void test_ptr_cast() { \\ void *p; \\ { \\ char *to_char = (char *)p; \\ short *to_short = (short *)p; \\ int *to_int = (int *)p; \\ long long *to_longlong = (long long *)p; \\ } \\ { \\ char *to_char = p; \\ short *to_short = p; \\ int *to_int = p; \\ long long *to_longlong = p; \\ } \\} , &[_][]const u8{ \\pub export fn test_ptr_cast() void { \\ var p: ?*c_void = undefined; \\ { \\ var to_char: [*c]u8 = @ptrCast([*c]u8, @alignCast(@import("std").meta.alignment(u8), p)); \\ _ = to_char; \\ var to_short: [*c]c_short = @ptrCast([*c]c_short, @alignCast(@import("std").meta.alignment(c_short), p)); \\ _ = to_short; \\ var to_int: [*c]c_int = @ptrCast([*c]c_int, @alignCast(@import("std").meta.alignment(c_int), p)); \\ _ = to_int; \\ var to_longlong: [*c]c_longlong = @ptrCast([*c]c_longlong, @alignCast(@import("std").meta.alignment(c_longlong), p)); \\ _ = to_longlong; \\ } \\ { \\ var to_char: [*c]u8 = @ptrCast([*c]u8, @alignCast(@import("std").meta.alignment(u8), p)); \\ _ = to_char; \\ var to_short: [*c]c_short = @ptrCast([*c]c_short, @alignCast(@import("std").meta.alignment(c_short), p)); \\ _ = to_short; \\ var to_int: [*c]c_int = @ptrCast([*c]c_int, @alignCast(@import("std").meta.alignment(c_int), p)); \\ _ = to_int; \\ var to_longlong: [*c]c_longlong = @ptrCast([*c]c_longlong, @alignCast(@import("std").meta.alignment(c_longlong), p)); \\ _ = to_longlong; \\ } \\} }); cases.add("while on non-bool", \\int while_none_bool() { \\ int a; \\ float b; \\ void *c; \\ while (a) return 0; \\ while (b) return 1; \\ while (c) return 2; \\ return 3; \\} , &[_][]const u8{ \\pub export fn while_none_bool() c_int { \\ var a: c_int = undefined; \\ var b: f32 = undefined; \\ var c: ?*c_void = undefined; \\ while (a != 0) return 0; \\ while (b != 0) return 1; \\ while (c != null) return 2; \\ return 3; \\} }); cases.add("for on non-bool", \\int for_none_bool() { \\ int a; \\ float b; \\ void *c; \\ for (;a;) return 0; \\ for (;b;) return 1; \\ for (;c;) return 2; \\ return 3; \\} , &[_][]const u8{ \\pub export fn for_none_bool() c_int { \\ var a: c_int = undefined; \\ var b: f32 = undefined; \\ var c: ?*c_void = undefined; \\ while (a != 0) return 0; \\ while (b != 0) return 1; \\ while (c != null) return 2; \\ return 3; \\} }); cases.add("bitshift", \\int foo(void) { \\ return (1 << 2) >> 1; \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ return (@as(c_int, 1) << @intCast(@import("std").math.Log2Int(c_int), 2)) >> @intCast(@import("std").math.Log2Int(c_int), 1); \\} }); cases.add("sizeof", \\#include <stddef.h> \\size_t size_of(void) { \\ return sizeof(int); \\} , &[_][]const u8{ \\pub export fn size_of() usize { \\ return @sizeOf(c_int); \\} }); cases.add("normal deref", \\void foo() { \\ int *x; \\ *x = 1; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var x: [*c]c_int = undefined; \\ x.* = 1; \\} }); cases.add("address of operator", \\int foo(void) { \\ int x = 1234; \\ int *ptr = &x; \\ return *ptr; \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ var x: c_int = 1234; \\ var ptr: [*c]c_int = &x; \\ return ptr.*; \\} }); cases.add("bin not", \\int foo() { \\ int x; \\ return ~x; \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ var x: c_int = undefined; \\ return ~x; \\} }); cases.add("bool not", \\int foo() { \\ int a; \\ float b; \\ void *c; \\ return !(a == 0); \\ return !a; \\ return !b; \\ return !c; \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ var a: c_int = undefined; \\ var b: f32 = undefined; \\ var c: ?*c_void = undefined; \\ return @boolToInt(!(a == @as(c_int, 0))); \\ return @boolToInt(!(a != 0)); \\ return @boolToInt(!(b != 0)); \\ return @boolToInt(!(c != null)); \\} }); cases.add("__extension__ cast", \\int foo(void) { \\ return __extension__ 1; \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ return 1; \\} }); if (std.Target.current.os.tag != .windows) { // sysv_abi not currently supported on windows cases.add("Macro qualified functions", \\void __attribute__((sysv_abi)) foo(void); , &[_][]const u8{ \\pub extern fn foo() void; }); } cases.add("Forward-declared enum", \\extern enum enum_ty my_enum; \\enum enum_ty { FOO }; , &[_][]const u8{ \\pub const FOO: c_int = 0; \\pub const enum_enum_ty = c_int; \\pub extern var my_enum: enum_enum_ty; }); cases.add("Parameterless function pointers", \\typedef void (*fn0)(); \\typedef void (*fn1)(char); , &[_][]const u8{ \\pub const fn0 = ?fn (...) callconv(.C) void; \\pub const fn1 = ?fn (u8) callconv(.C) void; }); cases.addWithTarget("Calling convention", .{ .cpu_arch = .i386, .os_tag = .linux, .abi = .none, }, \\void __attribute__((fastcall)) foo1(float *a); \\void __attribute__((stdcall)) foo2(float *a); \\void __attribute__((vectorcall)) foo3(float *a); \\void __attribute__((cdecl)) foo4(float *a); \\void __attribute__((thiscall)) foo5(float *a); , &[_][]const u8{ \\pub extern fn foo1(a: [*c]f32) callconv(.Fastcall) void; \\pub extern fn foo2(a: [*c]f32) callconv(.Stdcall) void; \\pub extern fn foo3(a: [*c]f32) callconv(.Vectorcall) void; \\pub extern fn foo4(a: [*c]f32) void; \\pub extern fn foo5(a: [*c]f32) callconv(.Thiscall) void; }); cases.addWithTarget("Calling convention", CrossTarget.parse(.{ .arch_os_abi = "arm-linux-none", .cpu_features = "generic+v8_5a", }) catch unreachable, \\void __attribute__((pcs("aapcs"))) foo1(float *a); \\void __attribute__((pcs("aapcs-vfp"))) foo2(float *a); , &[_][]const u8{ \\pub extern fn foo1(a: [*c]f32) callconv(.AAPCS) void; \\pub extern fn foo2(a: [*c]f32) callconv(.AAPCSVFP) void; }); cases.addWithTarget("Calling convention", CrossTarget.parse(.{ .arch_os_abi = "aarch64-linux-none", .cpu_features = "generic+v8_5a", }) catch unreachable, \\void __attribute__((aarch64_vector_pcs)) foo1(float *a); , &[_][]const u8{ \\pub extern fn foo1(a: [*c]f32) callconv(.Vectorcall) void; }); cases.add("Parameterless function prototypes", \\void a() {} \\void b(void) {} \\void c(); \\void d(void); \\static void e() {} \\static void f(void) {} \\static void g(); \\static void h(void); , &[_][]const u8{ \\pub export fn a() void {} \\pub export fn b() void {} \\pub extern fn c(...) void; \\pub extern fn d() void; \\pub fn e() callconv(.C) void {} \\pub fn f() callconv(.C) void {} \\pub extern fn g() void; \\pub extern fn h() void; }); cases.add("variable declarations", \\extern char arr0[] = "hello"; \\static char arr1[] = "hello"; \\char arr2[] = "hello"; , &[_][]const u8{ \\pub export var arr0: [5:0]u8 = "hello".*; \\pub var arr1: [5:0]u8 = "hello".*; \\pub export var arr2: [5:0]u8 = "hello".*; }); cases.add("array initializer expr", \\static void foo(void){ \\ char arr[10] ={1}; \\ char *arr1[10] ={0}; \\} , &[_][]const u8{ \\pub fn foo() callconv(.C) void { \\ var arr: [10]u8 = [1]u8{ \\ 1, \\ } ++ [1]u8{0} ** 9; \\ _ = arr; \\ var arr1: [10][*c]u8 = [1][*c]u8{ \\ null, \\ } ++ [1][*c]u8{null} ** 9; \\ _ = arr1; \\} }); cases.add("enums", \\typedef enum { \\ a, \\ b, \\ c, \\} d; \\enum { \\ e, \\ f = 4, \\ g, \\} h = e; \\struct Baz { \\ enum { \\ i, \\ j, \\ k, \\ } l; \\ d m; \\}; \\enum i { \\ n, \\ o, \\ p, \\}; , &[_][]const u8{ \\pub const a: c_int = 0; \\pub const b: c_int = 1; \\pub const c: c_int = 2; \\pub const d = ++ " " ++ default_enum_type ++ \\; \\pub const e: c_int = 0; \\pub const f: c_int = 4; \\pub const g: c_int = 5; \\const enum_unnamed_1 = ++ " " ++ default_enum_type ++ \\; \\pub export var h: enum_unnamed_1 = @bitCast(c_uint, e); \\pub const i: c_int = 0; \\pub const j: c_int = 1; \\pub const k: c_int = 2; \\const enum_unnamed_2 = ++ " " ++ default_enum_type ++ \\; \\pub const struct_Baz = extern struct { \\ l: enum_unnamed_2, \\ m: d, \\}; \\pub const n: c_int = 0; \\pub const o: c_int = 1; \\pub const p: c_int = 2; \\pub const enum_i = ++ " " ++ default_enum_type ++ \\; , "pub const Baz = struct_Baz;", }); cases.add("#define a char literal", \\#define A_CHAR 'a' , &[_][]const u8{ \\pub const A_CHAR = 'a'; }); cases.add("comment after integer literal", \\#define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ , &[_][]const u8{ \\pub const SDL_INIT_VIDEO = @as(c_int, 0x00000020); }); cases.add("u integer suffix after hex literal", \\#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ , &[_][]const u8{ \\pub const SDL_INIT_VIDEO = @as(c_uint, 0x00000020); }); cases.add("l integer suffix after hex literal", \\#define SDL_INIT_VIDEO 0x00000020l /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ , &[_][]const u8{ \\pub const SDL_INIT_VIDEO = @as(c_long, 0x00000020); }); cases.add("ul integer suffix after hex literal", \\#define SDL_INIT_VIDEO 0x00000020ul /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ , &[_][]const u8{ \\pub const SDL_INIT_VIDEO = @as(c_ulong, 0x00000020); }); cases.add("lu integer suffix after hex literal", \\#define SDL_INIT_VIDEO 0x00000020lu /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ , &[_][]const u8{ \\pub const SDL_INIT_VIDEO = @as(c_ulong, 0x00000020); }); cases.add("ll integer suffix after hex literal", \\#define SDL_INIT_VIDEO 0x00000020ll /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ , &[_][]const u8{ \\pub const SDL_INIT_VIDEO = @as(c_longlong, 0x00000020); }); cases.add("ull integer suffix after hex literal", \\#define SDL_INIT_VIDEO 0x00000020ull /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ , &[_][]const u8{ \\pub const SDL_INIT_VIDEO = @as(c_ulonglong, 0x00000020); }); cases.add("llu integer suffix after hex literal", \\#define SDL_INIT_VIDEO 0x00000020llu /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ , &[_][]const u8{ \\pub const SDL_INIT_VIDEO = @as(c_ulonglong, 0x00000020); }); cases.add("generate inline func for #define global extern fn", \\extern void (*fn_ptr)(void); \\#define foo fn_ptr \\ \\extern char (*fn_ptr2)(int, float); \\#define bar fn_ptr2 , &[_][]const u8{ \\pub extern var fn_ptr: ?fn () callconv(.C) void; , \\pub inline fn foo() void { \\ return fn_ptr.?(); \\} , \\pub extern var fn_ptr2: ?fn (c_int, f32) callconv(.C) u8; , \\pub inline fn bar(arg_1: c_int, arg_2: f32) u8 { \\ return fn_ptr2.?(arg_1, arg_2); \\} }); cases.add("macros with field targets", \\typedef unsigned int GLbitfield; \\typedef void (*PFNGLCLEARPROC) (GLbitfield mask); \\typedef void(*OpenGLProc)(void); \\union OpenGLProcs { \\ OpenGLProc ptr[1]; \\ struct { \\ PFNGLCLEARPROC Clear; \\ } gl; \\}; \\extern union OpenGLProcs glProcs; \\#define glClearUnion glProcs.gl.Clear \\#define glClearPFN PFNGLCLEARPROC , &[_][]const u8{ \\pub const GLbitfield = c_uint; \\pub const PFNGLCLEARPROC = ?fn (GLbitfield) callconv(.C) void; \\pub const OpenGLProc = ?fn () callconv(.C) void; \\const struct_unnamed_1 = extern struct { \\ Clear: PFNGLCLEARPROC, \\}; \\pub const union_OpenGLProcs = extern union { \\ ptr: [1]OpenGLProc, \\ gl: struct_unnamed_1, \\}; \\pub extern var glProcs: union_OpenGLProcs; , \\pub const glClearPFN = PFNGLCLEARPROC; , \\pub inline fn glClearUnion(arg_2: GLbitfield) void { \\ return glProcs.gl.Clear.?(arg_2); \\} , \\pub const OpenGLProcs = union_OpenGLProcs; }); cases.add("macro pointer cast", \\typedef struct { int dummy; } NRF_GPIO_Type; \\#define NRF_GPIO ((NRF_GPIO_Type *) NRF_GPIO_BASE) , &[_][]const u8{ \\pub const NRF_GPIO = @import("std").zig.c_translation.cast([*c]NRF_GPIO_Type, NRF_GPIO_BASE); }); cases.add("basic macro function", \\extern int c; \\#define BASIC(c) (c*2) \\#define FOO(L,b) (L + b) \\#define BAR() (c*c) , &[_][]const u8{ \\pub extern var c: c_int; , \\pub inline fn BASIC(c_1: anytype) @TypeOf(c_1 * @as(c_int, 2)) { \\ return c_1 * @as(c_int, 2); \\} , \\pub inline fn FOO(L: anytype, b: anytype) @TypeOf(L + b) { \\ return L + b; \\} , \\pub inline fn BAR() @TypeOf(c * c) { \\ return c * c; \\} }); cases.add("macro defines string literal with hex", \\#define FOO "aoeu\xab derp" \\#define FOO2 "aoeu\x0007a derp" \\#define FOO_CHAR '\xfF' , &[_][]const u8{ \\pub const FOO = "aoeu\xab derp"; , \\pub const FOO2 = "aoeu\x7a derp"; , \\pub const FOO_CHAR = '\xff'; }); cases.add("macro add", \\#define PERIPH_BASE (0x40000000UL) /*!< Base address of : AHB/APB Peripherals */ \\#define D3_APB1PERIPH_BASE (PERIPH_BASE + 0x18000000UL) \\#define RCC_BASE (D3_AHB1PERIPH_BASE + 0x4400UL) , &[_][]const u8{ \\pub const PERIPH_BASE = @as(c_ulong, 0x40000000); , \\pub const D3_APB1PERIPH_BASE = PERIPH_BASE + @as(c_ulong, 0x18000000); , \\pub const RCC_BASE = D3_AHB1PERIPH_BASE + @as(c_ulong, 0x4400); }); cases.add("variable aliasing", \\static long a = 2; \\static long b = 2; \\static int c = 4; \\void foo(char c) { \\ int a; \\ char b = 123; \\ b = (char) a; \\ { \\ int d = 5; \\ } \\ unsigned d = 440; \\} , &[_][]const u8{ \\pub var a: c_long = 2; \\pub var b: c_long = 2; \\pub var c: c_int = 4; \\pub export fn foo(arg_c_1: u8) void { \\ var c_1 = arg_c_1; \\ _ = c_1; \\ var a_2: c_int = undefined; \\ var b_3: u8 = 123; \\ b_3 = @bitCast(u8, @truncate(i8, a_2)); \\ { \\ var d: c_int = 5; \\ _ = d; \\ } \\ var d: c_uint = @bitCast(c_uint, @as(c_int, 440)); \\ _ = d; \\} }); cases.add("comma operator", \\int foo() { \\ 2, 4; \\ return 2, 4, 6; \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ _ = blk: { \\ _ = @as(c_int, 2); \\ break :blk @as(c_int, 4); \\ }; \\ return blk: { \\ _ = blk_1: { \\ _ = @as(c_int, 2); \\ break :blk_1 @as(c_int, 4); \\ }; \\ break :blk @as(c_int, 6); \\ }; \\} }); cases.add("worst-case assign", \\void foo() { \\ int a; \\ int b; \\ a = b = 2; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: c_int = undefined; \\ var b: c_int = undefined; \\ a = blk: { \\ const tmp = @as(c_int, 2); \\ b = tmp; \\ break :blk tmp; \\ }; \\} }); cases.add("while loops", \\int foo() { \\ int a = 5; \\ while (2) \\ a = 2; \\ while (4) { \\ int a = 4; \\ a = 9; \\ return 6, a; \\ } \\ do { \\ int a = 2; \\ a = 12; \\ } while (4); \\ do \\ a = 7; \\ while (4); \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ var a: c_int = 5; \\ while (true) { \\ a = 2; \\ } \\ while (true) { \\ var a_1: c_int = 4; \\ a_1 = 9; \\ return blk: { \\ _ = @as(c_int, 6); \\ break :blk a_1; \\ }; \\ } \\ while (true) { \\ var a_1: c_int = 2; \\ a_1 = 12; \\ } \\ while (true) { \\ a = 7; \\ } \\ return 0; \\} }); cases.add("for loops", \\void foo() { \\ for (int i = 2, b = 4; i + 2; i = 2) { \\ int a = 2; \\ a = 6, 5, 7; \\ } \\ char i = 2; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ { \\ var i: c_int = 2; \\ var b: c_int = 4; \\ _ = b; \\ while ((i + @as(c_int, 2)) != 0) : (i = 2) { \\ var a: c_int = 2; \\ _ = blk: { \\ _ = blk_1: { \\ a = 6; \\ break :blk_1 @as(c_int, 5); \\ }; \\ break :blk @as(c_int, 7); \\ }; \\ } \\ } \\ var i: u8 = 2; \\ _ = i; \\} }); cases.add("shadowing primitive types", \\unsigned anyerror = 2; \\#define noreturn _Noreturn \\typedef enum { \\ f32, \\ u32, \\} BadEnum; , &[_][]const u8{ \\pub export var @"anyerror": c_uint = 2; , \\pub const @"noreturn" = @compileError("unable to translate C expr: unexpected token .Keyword_noreturn"); , \\pub const @"f32": c_int = 0; \\pub const @"u32": c_int = 1; \\pub const BadEnum = c_uint; }); cases.add("floats", \\float a = 3.1415; \\double b = 3.1415; \\int c = 3.1415; \\double d = 3; , &[_][]const u8{ \\pub export var a: f32 = @floatCast(f32, 3.1415); \\pub export var b: f64 = 3.1415; \\pub export var c: c_int = @floatToInt(c_int, 3.1415); \\pub export var d: f64 = 3; }); cases.add("conditional operator", \\int bar(void) { \\ if (2 ? 5 : 5 ? 4 : 6) 2; \\ return 2 ? 5 : 5 ? 4 : 6; \\} , &[_][]const u8{ \\pub export fn bar() c_int { \\ if ((if (true) @as(c_int, 5) else if (true) @as(c_int, 4) else @as(c_int, 6)) != 0) { \\ _ = @as(c_int, 2); \\ } \\ return if (true) @as(c_int, 5) else if (true) @as(c_int, 4) else @as(c_int, 6); \\} }); cases.add("switch on int", \\void switch_fn(int i) { \\ int res = 0; \\ switch (i) { \\ case 0: \\ res = 1; \\ case 1 ... 3: \\ res = 2; \\ default: \\ res = 3 * i; \\ break; \\ break; \\ case 7: { \\ res = 7; \\ break; \\ } \\ case 4: \\ case 5: \\ res = 69; \\ { \\ res = 5; \\ return; \\ } \\ case 6: \\ switch (res) { \\ case 9: break; \\ } \\ res = 1; \\ return; \\ } \\} , &[_][]const u8{ \\pub export fn switch_fn(arg_i: c_int) void { \\ var i = arg_i; \\ var res: c_int = 0; \\ while (true) { \\ switch (i) { \\ @as(c_int, 0) => { \\ res = 1; \\ res = 2; \\ res = @as(c_int, 3) * i; \\ break; \\ }, \\ @as(c_int, 1)...@as(c_int, 3) => { \\ res = 2; \\ res = @as(c_int, 3) * i; \\ break; \\ }, \\ else => { \\ res = @as(c_int, 3) * i; \\ break; \\ }, \\ @as(c_int, 7) => { \\ { \\ res = 7; \\ break; \\ } \\ }, \\ @as(c_int, 4), @as(c_int, 5) => { \\ res = 69; \\ { \\ res = 5; \\ return; \\ } \\ }, \\ @as(c_int, 6) => { \\ while (true) { \\ switch (res) { \\ @as(c_int, 9) => break, \\ else => {}, \\ } \\ break; \\ } \\ res = 1; \\ return; \\ }, \\ } \\ break; \\ } \\} }); if (std.Target.current.os.tag != .windows) { // When clang uses the <arch>-windows-none triple it behaves as MSVC and // interprets the inner `struct Bar` as an anonymous structure cases.add("type referenced struct", \\struct Foo { \\ struct Bar{ \\ int b; \\ }; \\ struct Bar c; \\}; , &[_][]const u8{ \\pub const struct_Bar = extern struct { \\ b: c_int, \\}; \\pub const struct_Foo = extern struct { \\ c: struct_Bar, \\}; }); } cases.add("undefined array global", \\int array[100] = {}; , &[_][]const u8{ \\pub export var array: [100]c_int = [1]c_int{0} ** 100; }); cases.add("restrict -> noalias", \\void foo(void *restrict bar, void *restrict); , &[_][]const u8{ \\pub extern fn foo(noalias bar: ?*c_void, noalias ?*c_void) void; }); cases.add("assign", \\void max(int a) { \\ int tmp; \\ tmp = a; \\ a = tmp; \\} , &[_][]const u8{ \\pub export fn max(arg_a: c_int) void { \\ var a = arg_a; \\ var tmp: c_int = undefined; \\ tmp = a; \\ a = tmp; \\} }); cases.add("chaining assign", \\void max(int a) { \\ int b, c; \\ c = b = a; \\} , &[_][]const u8{ \\pub export fn max(arg_a: c_int) void { \\ var a = arg_a; \\ var b: c_int = undefined; \\ var c: c_int = undefined; \\ c = blk: { \\ const tmp = a; \\ b = tmp; \\ break :blk tmp; \\ }; \\} }); cases.add("anonymous enum", \\enum { \\ One, \\ Two, \\}; , &[_][]const u8{ \\pub const One: c_int = 0; \\pub const Two: c_int = 1; \\const enum_unnamed_1 = ++ " " ++ default_enum_type ++ \\; }); cases.add("c style cast", \\int float_to_int(float a) { \\ return (int)a; \\} , &[_][]const u8{ \\pub export fn float_to_int(arg_a: f32) c_int { \\ var a = arg_a; \\ return @floatToInt(c_int, a); \\} }); cases.add("escape sequences", \\const char *escapes() { \\char a = '\'', \\ b = '\\', \\ c = '\a', \\ d = '\b', \\ e = '\f', \\ f = '\n', \\ g = '\r', \\ h = '\t', \\ i = '\v', \\ j = '\0', \\ k = '\"'; \\ return "\'\\\a\b\f\n\r\t\v\0\""; \\} \\ , &[_][]const u8{ \\pub export fn escapes() [*c]const u8 { \\ var a: u8 = '\''; \\ _ = a; \\ var b: u8 = '\\'; \\ _ = b; \\ var c: u8 = '\x07'; \\ _ = c; \\ var d: u8 = '\x08'; \\ _ = d; \\ var e: u8 = '\x0c'; \\ _ = e; \\ var f: u8 = '\n'; \\ _ = f; \\ var g: u8 = '\r'; \\ _ = g; \\ var h: u8 = '\t'; \\ _ = h; \\ var i: u8 = '\x0b'; \\ _ = i; \\ var j: u8 = '\x00'; \\ _ = j; \\ var k: u8 = '"'; \\ _ = k; \\ return "'\\\x07\x08\x0c\n\r\t\x0b\x00\""; \\} }); cases.add("do loop", \\void foo(void) { \\ int a = 2; \\ do { \\ a = a - 1; \\ } while (a); \\ \\ int b = 2; \\ do \\ b = b -1; \\ while (b); \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: c_int = 2; \\ while (true) { \\ a = a - @as(c_int, 1); \\ if (!(a != 0)) break; \\ } \\ var b: c_int = 2; \\ while (true) { \\ b = b - @as(c_int, 1); \\ if (!(b != 0)) break; \\ } \\} }); cases.add("logical and, logical or, on non-bool values, extra parens", \\enum Foo { \\ FooA, \\ FooB, \\ FooC, \\}; \\typedef int SomeTypedef; \\int and_or_non_bool(int a, float b, void *c) { \\ enum Foo d = FooA; \\ int e = (a && b); \\ int f = (b && c); \\ int g = (a && c); \\ int h = (a || b); \\ int i = (b || c); \\ int j = (a || c); \\ int k = (a || (int)d); \\ int l = ((int)d && b); \\ int m = (c || (unsigned int)d); \\ SomeTypedef td = 44; \\ int o = (td || b); \\ int p = (c && td); \\ return ((((((((((e + f) + g) + h) + i) + j) + k) + l) + m) + o) + p); \\} , &[_][]const u8{ \\pub const FooA: c_int = 0; \\pub const FooB: c_int = 1; \\pub const FooC: c_int = 2; \\pub const enum_Foo = ++ " " ++ default_enum_type ++ \\; \\pub const SomeTypedef = c_int; \\pub export fn and_or_non_bool(arg_a: c_int, arg_b: f32, arg_c: ?*c_void) c_int { \\ var a = arg_a; \\ var b = arg_b; \\ var c = arg_c; \\ var d: enum_Foo = @bitCast(c_uint, FooA); \\ var e: c_int = @boolToInt((a != 0) and (b != 0)); \\ var f: c_int = @boolToInt((b != 0) and (c != null)); \\ var g: c_int = @boolToInt((a != 0) and (c != null)); \\ var h: c_int = @boolToInt((a != 0) or (b != 0)); \\ var i: c_int = @boolToInt((b != 0) or (c != null)); \\ var j: c_int = @boolToInt((a != 0) or (c != null)); \\ var k: c_int = @boolToInt((a != 0) or (@bitCast(c_int, d) != 0)); \\ var l: c_int = @boolToInt((@bitCast(c_int, d) != 0) and (b != 0)); \\ var m: c_int = @boolToInt((c != null) or (d != 0)); \\ var td: SomeTypedef = 44; \\ var o: c_int = @boolToInt((td != 0) or (b != 0)); \\ var p: c_int = @boolToInt((c != null) and (td != 0)); \\ return (((((((((e + f) + g) + h) + i) + j) + k) + l) + m) + o) + p; \\} , \\pub const Foo = enum_Foo; }); cases.add("qualified struct and enum", \\struct Foo { \\ int x; \\ int y; \\}; \\enum Bar { \\ BarA, \\ BarB, \\}; \\void func(struct Foo *a, enum Bar **b); , &[_][]const u8{ \\pub const struct_Foo = extern struct { \\ x: c_int, \\ y: c_int, \\}; \\pub const BarA: c_int = 0; \\pub const BarB: c_int = 1; \\pub const enum_Bar = ++ " " ++ default_enum_type ++ \\; \\pub extern fn func(a: [*c]struct_Foo, b: [*c][*c]enum_Bar) void; , \\pub const Foo = struct_Foo; \\pub const Bar = enum_Bar; }); cases.add("bitwise binary operators, simpler parens", \\int max(int a, int b) { \\ return (a & b) ^ (a | b); \\} , &[_][]const u8{ \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { \\ var a = arg_a; \\ var b = arg_b; \\ return (a & b) ^ (a | b); \\} }); cases.add("comparison operators (no if)", // TODO Come up with less contrived tests? Make sure to cover all these comparisons. \\int test_comparisons(int a, int b) { \\ int c = (a < b); \\ int d = (a > b); \\ int e = (a <= b); \\ int f = (a >= b); \\ int g = (c < d); \\ int h = (e < f); \\ int i = (g < h); \\ return i; \\} , &[_][]const u8{ \\pub export fn test_comparisons(arg_a: c_int, arg_b: c_int) c_int { \\ var a = arg_a; \\ var b = arg_b; \\ var c: c_int = @boolToInt(a < b); \\ var d: c_int = @boolToInt(a > b); \\ var e: c_int = @boolToInt(a <= b); \\ var f: c_int = @boolToInt(a >= b); \\ var g: c_int = @boolToInt(c < d); \\ var h: c_int = @boolToInt(e < f); \\ var i: c_int = @boolToInt(g < h); \\ return i; \\} }); cases.add("==, !=", \\int max(int a, int b) { \\ if (a == b) \\ return a; \\ if (a != b) \\ return b; \\ return a; \\} , &[_][]const u8{ \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { \\ var a = arg_a; \\ var b = arg_b; \\ if (a == b) return a; \\ if (a != b) return b; \\ return a; \\} }); cases.add("typedeffed bool expression", \\typedef char* yes; \\void foo(void) { \\ yes a; \\ if (a) 2; \\} , &[_][]const u8{ \\pub const yes = [*c]u8; \\pub export fn foo() void { \\ var a: yes = undefined; \\ if (a != null) { \\ _ = @as(c_int, 2); \\ } \\} }); cases.add("statement expression", \\int foo(void) { \\ return ({ \\ int a = 1; \\ a; \\ a; \\ }); \\} , &[_][]const u8{ \\pub export fn foo() c_int { \\ return blk: { \\ var a: c_int = 1; \\ _ = a; \\ break :blk a; \\ }; \\} }); cases.add("field access expression", \\#define ARROW a->b \\#define DOT a.b \\extern struct Foo { \\ int b; \\}a; \\float b = 2.0f; \\void foo(void) { \\ struct Foo *c; \\ a.b; \\ c->b; \\} , &[_][]const u8{ \\pub const struct_Foo = extern struct { \\ b: c_int, \\}; \\pub extern var a: struct_Foo; \\pub export var b: f32 = 2.0; \\pub export fn foo() void { \\ var c: [*c]struct_Foo = undefined; \\ _ = a.b; \\ _ = c.*.b; \\} , \\pub const DOT = a.b; , \\pub const ARROW = a.*.b; }); cases.add("array access", \\#define ACCESS array[2] \\int array[100] = {}; \\int foo(int index) { \\ return array[index]; \\} , &[_][]const u8{ \\pub export var array: [100]c_int = [1]c_int{0} ** 100; \\pub export fn foo(arg_index: c_int) c_int { \\ var index = arg_index; \\ return array[@intCast(c_uint, index)]; \\} , \\pub const ACCESS = array[@as(c_int, 2)]; }); cases.add("cast signed array index to unsigned", \\void foo() { \\ int a[10], i = 0; \\ a[i] = 0; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: [10]c_int = undefined; \\ var i: c_int = 0; \\ a[@intCast(c_uint, i)] = 0; \\} }); cases.add("long long array index cast to usize", \\void foo() { \\ long long a[10], i = 0; \\ a[i] = 0; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: [10]c_longlong = undefined; \\ var i: c_longlong = 0; \\ a[@intCast(usize, i)] = 0; \\} }); cases.add("unsigned array index skips cast", \\void foo() { \\ unsigned int a[10], i = 0; \\ a[i] = 0; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: [10]c_uint = undefined; \\ var i: c_uint = 0; \\ a[i] = 0; \\} }); cases.add("macro call", \\#define CALL(arg) bar(arg) , &[_][]const u8{ \\pub inline fn CALL(arg: anytype) @TypeOf(bar(arg)) { \\ return bar(arg); \\} }); cases.add("macro call with no args", \\#define CALL(arg) bar() , &[_][]const u8{ \\pub inline fn CALL(arg: anytype) @TypeOf(bar()) { \\ _ = arg; \\ return bar(); \\} }); cases.add("logical and, logical or", \\int max(int a, int b) { \\ if (a < b || a == b) \\ return b; \\ if (a >= b && a == b) \\ return a; \\ return a; \\} , &[_][]const u8{ \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { \\ var a = arg_a; \\ var b = arg_b; \\ if ((a < b) or (a == b)) return b; \\ if ((a >= b) and (a == b)) return a; \\ return a; \\} }); cases.add("simple if statement", \\int max(int a, int b) { \\ if (a < b) \\ return b; \\ \\ if (a < b) \\ return b; \\ else \\ return a; \\ \\ if (a < b) ; else ; \\} , &[_][]const u8{ \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { \\ var a = arg_a; \\ var b = arg_b; \\ if (a < b) return b; \\ if (a < b) return b else return a; \\ if (a < b) {} else {} \\ return 0; \\} }); cases.add("if statements", \\void foo() { \\ if (2) { \\ int a = 2; \\ } \\ if (2, 5) { \\ int a = 2; \\ } \\} , &[_][]const u8{ \\pub export fn foo() void { \\ if (true) { \\ var a: c_int = 2; \\ _ = a; \\ } \\ if ((blk: { \\ _ = @as(c_int, 2); \\ break :blk @as(c_int, 5); \\ }) != 0) { \\ var a: c_int = 2; \\ _ = a; \\ } \\} }); cases.add("if on non-bool", \\enum SomeEnum { A, B, C }; \\int if_none_bool(int a, float b, void *c, enum SomeEnum d) { \\ if (a) return 0; \\ if (b) return 1; \\ if (c) return 2; \\ if (d) return 3; \\ return 4; \\} , &[_][]const u8{ \\pub const A: c_int = 0; \\pub const B: c_int = 1; \\pub const C: c_int = 2; \\pub const enum_SomeEnum = ++ " " ++ default_enum_type ++ \\; \\pub export fn if_none_bool(arg_a: c_int, arg_b: f32, arg_c: ?*c_void, arg_d: enum_SomeEnum) c_int { \\ var a = arg_a; \\ var b = arg_b; \\ var c = arg_c; \\ var d = arg_d; \\ if (a != 0) return 0; \\ if (b != 0) return 1; \\ if (c != null) return 2; \\ if (d != 0) return 3; \\ return 4; \\} }); cases.add("simple data types", \\#include <stdint.h> \\int foo(char a, unsigned char b, signed char c); \\int foo(char a, unsigned char b, signed char c); // test a duplicate prototype \\void bar(uint8_t a, uint16_t b, uint32_t c, uint64_t d); \\void baz(int8_t a, int16_t b, int32_t c, int64_t d); , &[_][]const u8{ \\pub extern fn foo(a: u8, b: u8, c: i8) c_int; \\pub extern fn bar(a: u8, b: u16, c: u32, d: u64) void; \\pub extern fn baz(a: i8, b: i16, c: i32, d: i64) void; }); cases.add("simple function", \\int abs(int a) { \\ return a < 0 ? -a : a; \\} , &[_][]const u8{ \\pub export fn abs(arg_a: c_int) c_int { \\ var a = arg_a; \\ return if (a < @as(c_int, 0)) -a else a; \\} }); cases.add("post increment", \\unsigned foo1(unsigned a) { \\ a++; \\ return a; \\} \\int foo2(int a) { \\ a++; \\ return a; \\} \\int *foo3(int *a) { \\ a++; \\ return a; \\} , &[_][]const u8{ \\pub export fn foo1(arg_a: c_uint) c_uint { \\ var a = arg_a; \\ a +%= 1; \\ return a; \\} \\pub export fn foo2(arg_a: c_int) c_int { \\ var a = arg_a; \\ a += 1; \\ return a; \\} \\pub export fn foo3(arg_a: [*c]c_int) [*c]c_int { \\ var a = arg_a; \\ a += 1; \\ return a; \\} }); cases.add("deref function pointer", \\void foo(void) {} \\int baz(void) { return 0; } \\void bar(void) { \\ void(*f)(void) = foo; \\ int(*b)(void) = baz; \\ f(); \\ (*(f))(); \\ foo(); \\ b(); \\ (*(b))(); \\ baz(); \\} , &[_][]const u8{ \\pub export fn foo() void {} \\pub export fn baz() c_int { \\ return 0; \\} \\pub export fn bar() void { \\ var f: ?fn () callconv(.C) void = foo; \\ var b: ?fn () callconv(.C) c_int = baz; \\ f.?(); \\ f.?(); \\ foo(); \\ _ = b.?(); \\ _ = b.?(); \\ _ = baz(); \\} }); cases.add("pre increment/decrement", \\void foo(void) { \\ int i = 0; \\ unsigned u = 0; \\ ++i; \\ --i; \\ ++u; \\ --u; \\ i = ++i; \\ i = --i; \\ u = ++u; \\ u = --u; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var i: c_int = 0; \\ var u: c_uint = 0; \\ i += 1; \\ i -= 1; \\ u +%= 1; \\ u -%= 1; \\ i = blk: { \\ const ref = &i; \\ ref.* += 1; \\ break :blk ref.*; \\ }; \\ i = blk: { \\ const ref = &i; \\ ref.* -= 1; \\ break :blk ref.*; \\ }; \\ u = blk: { \\ const ref = &u; \\ ref.* +%= 1; \\ break :blk ref.*; \\ }; \\ u = blk: { \\ const ref = &u; \\ ref.* -%= 1; \\ break :blk ref.*; \\ }; \\} }); cases.add("shift right assign", \\int log2(unsigned a) { \\ int i = 0; \\ while (a > 0) { \\ a >>= 1; \\ } \\ return i; \\} , &[_][]const u8{ \\pub export fn log2(arg_a: c_uint) c_int { \\ var a = arg_a; \\ var i: c_int = 0; \\ while (a > @bitCast(c_uint, @as(c_int, 0))) { \\ a >>= @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1)); \\ } \\ return i; \\} }); cases.add("shift right assign with a fixed size type", \\#include <stdint.h> \\int log2(uint32_t a) { \\ int i = 0; \\ while (a > 0) { \\ a >>= 1; \\ } \\ return i; \\} , &[_][]const u8{ \\pub export fn log2(arg_a: u32) c_int { \\ var a = arg_a; \\ var i: c_int = 0; \\ while (a > @bitCast(c_uint, @as(c_int, 0))) { \\ a >>= @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1)); \\ } \\ return i; \\} }); cases.add("compound assignment operators", \\void foo(void) { \\ int a = 0; \\ unsigned b = 0; \\ a += (a += 1); \\ a -= (a -= 1); \\ a *= (a *= 1); \\ a &= (a &= 1); \\ a |= (a |= 1); \\ a ^= (a ^= 1); \\ a >>= (a >>= 1); \\ a <<= (a <<= 1); \\ a /= (a /= 1); \\ a %= (a %= 1); \\ b /= (b /= 1); \\ b %= (b %= 1); \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: c_int = 0; \\ var b: c_uint = 0; \\ a += blk: { \\ const ref = &a; \\ ref.* += @as(c_int, 1); \\ break :blk ref.*; \\ }; \\ a -= blk: { \\ const ref = &a; \\ ref.* -= @as(c_int, 1); \\ break :blk ref.*; \\ }; \\ a *= blk: { \\ const ref = &a; \\ ref.* *= @as(c_int, 1); \\ break :blk ref.*; \\ }; \\ a &= blk: { \\ const ref = &a; \\ ref.* &= @as(c_int, 1); \\ break :blk ref.*; \\ }; \\ a |= blk: { \\ const ref = &a; \\ ref.* |= @as(c_int, 1); \\ break :blk ref.*; \\ }; \\ a ^= blk: { \\ const ref = &a; \\ ref.* ^= @as(c_int, 1); \\ break :blk ref.*; \\ }; \\ a >>= @intCast(@import("std").math.Log2Int(c_int), blk: { \\ const ref = &a; \\ ref.* >>= @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1)); \\ break :blk ref.*; \\ }); \\ a <<= @intCast(@import("std").math.Log2Int(c_int), blk: { \\ const ref = &a; \\ ref.* <<= @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1)); \\ break :blk ref.*; \\ }); \\ a = @divTrunc(a, blk: { \\ const ref = &a; \\ ref.* = @divTrunc(ref.*, @as(c_int, 1)); \\ break :blk ref.*; \\ }); \\ a = @rem(a, blk: { \\ const ref = &a; \\ ref.* = @rem(ref.*, @as(c_int, 1)); \\ break :blk ref.*; \\ }); \\ b /= blk: { \\ const ref = &b; \\ ref.* /= @bitCast(c_uint, @as(c_int, 1)); \\ break :blk ref.*; \\ }; \\ b %= blk: { \\ const ref = &b; \\ ref.* %= @bitCast(c_uint, @as(c_int, 1)); \\ break :blk ref.*; \\ }; \\} }); cases.add("compound assignment operators unsigned", \\void foo(void) { \\ unsigned a = 0; \\ a += (a += 1); \\ a -= (a -= 1); \\ a *= (a *= 1); \\ a &= (a &= 1); \\ a |= (a |= 1); \\ a ^= (a ^= 1); \\ a >>= (a >>= 1); \\ a <<= (a <<= 1); \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var a: c_uint = 0; \\ a +%= blk: { \\ const ref = &a; \\ ref.* +%= @bitCast(c_uint, @as(c_int, 1)); \\ break :blk ref.*; \\ }; \\ a -%= blk: { \\ const ref = &a; \\ ref.* -%= @bitCast(c_uint, @as(c_int, 1)); \\ break :blk ref.*; \\ }; \\ a *%= blk: { \\ const ref = &a; \\ ref.* *%= @bitCast(c_uint, @as(c_int, 1)); \\ break :blk ref.*; \\ }; \\ a &= blk: { \\ const ref = &a; \\ ref.* &= @bitCast(c_uint, @as(c_int, 1)); \\ break :blk ref.*; \\ }; \\ a |= blk: { \\ const ref = &a; \\ ref.* |= @bitCast(c_uint, @as(c_int, 1)); \\ break :blk ref.*; \\ }; \\ a ^= blk: { \\ const ref = &a; \\ ref.* ^= @bitCast(c_uint, @as(c_int, 1)); \\ break :blk ref.*; \\ }; \\ a >>= @intCast(@import("std").math.Log2Int(c_uint), blk: { \\ const ref = &a; \\ ref.* >>= @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1)); \\ break :blk ref.*; \\ }); \\ a <<= @intCast(@import("std").math.Log2Int(c_uint), blk: { \\ const ref = &a; \\ ref.* <<= @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1)); \\ break :blk ref.*; \\ }); \\} }); cases.add("post increment/decrement", \\void foo(void) { \\ int i = 0; \\ unsigned u = 0; \\ i++; \\ i--; \\ u++; \\ u--; \\ i = i++; \\ i = i--; \\ u = u++; \\ u = u--; \\} , &[_][]const u8{ \\pub export fn foo() void { \\ var i: c_int = 0; \\ var u: c_uint = 0; \\ i += 1; \\ i -= 1; \\ u +%= 1; \\ u -%= 1; \\ i = blk: { \\ const ref = &i; \\ const tmp = ref.*; \\ ref.* += 1; \\ break :blk tmp; \\ }; \\ i = blk: { \\ const ref = &i; \\ const tmp = ref.*; \\ ref.* -= 1; \\ break :blk tmp; \\ }; \\ u = blk: { \\ const ref = &u; \\ const tmp = ref.*; \\ ref.* +%= 1; \\ break :blk tmp; \\ }; \\ u = blk: { \\ const ref = &u; \\ const tmp = ref.*; \\ ref.* -%= 1; \\ break :blk tmp; \\ }; \\} }); cases.add("implicit casts", \\#include <stdbool.h> \\ \\void fn_int(int x); \\void fn_f32(float x); \\void fn_f64(double x); \\void fn_char(char x); \\void fn_bool(bool x); \\void fn_ptr(void *x); \\ \\void call() { \\ fn_int(3.0f); \\ fn_int(3.0); \\ fn_int('ABCD'); \\ fn_f32(3); \\ fn_f64(3); \\ fn_char('3'); \\ fn_char('\x1'); \\ fn_char(0); \\ fn_f32(3.0f); \\ fn_f64(3.0); \\ fn_bool(123); \\ fn_bool(0); \\ fn_bool(&fn_int); \\ fn_int(&fn_int); \\ fn_ptr(42); \\} , &[_][]const u8{ \\pub extern fn fn_int(x: c_int) void; \\pub extern fn fn_f32(x: f32) void; \\pub extern fn fn_f64(x: f64) void; \\pub extern fn fn_char(x: u8) void; \\pub extern fn fn_bool(x: bool) void; \\pub extern fn fn_ptr(x: ?*c_void) void; \\pub export fn call() void { \\ fn_int(@floatToInt(c_int, 3.0)); \\ fn_int(@floatToInt(c_int, 3.0)); \\ fn_int(@as(c_int, 1094861636)); \\ fn_f32(@intToFloat(f32, @as(c_int, 3))); \\ fn_f64(@intToFloat(f64, @as(c_int, 3))); \\ fn_char(@bitCast(u8, @truncate(i8, @as(c_int, '3')))); \\ fn_char(@bitCast(u8, @truncate(i8, @as(c_int, '\x01')))); \\ fn_char(@bitCast(u8, @truncate(i8, @as(c_int, 0)))); \\ fn_f32(3.0); \\ fn_f64(3.0); \\ fn_bool(@as(c_int, 123) != 0); \\ fn_bool(@as(c_int, 0) != 0); \\ fn_bool(@ptrToInt(fn_int) != 0); \\ fn_int(@intCast(c_int, @ptrToInt(fn_int))); \\ fn_ptr(@intToPtr(?*c_void, @as(c_int, 42))); \\} }); cases.add("function call", \\static void bar(void) { } \\void foo(int *(baz)(void)) { \\ bar(); \\ baz(); \\} , &[_][]const u8{ \\pub fn bar() callconv(.C) void {} \\pub export fn foo(arg_baz: ?fn () callconv(.C) [*c]c_int) void { \\ var baz = arg_baz; \\ bar(); \\ _ = baz.?(); \\} }); cases.add("macro defines string literal with octal", \\#define FOO "aoeu\023 derp" \\#define FOO2 "aoeu\0234 derp" \\#define FOO_CHAR '\077' , &[_][]const u8{ \\pub const FOO = "aoeu\x13 derp"; , \\pub const FOO2 = "aoeu\x134 derp"; , \\pub const FOO_CHAR = '\x3f'; }); cases.add("enums", \\enum Foo { \\ FooA = 2, \\ FooB = 5, \\ Foo1, \\}; , &[_][]const u8{ \\pub const FooA: c_int = 2; \\pub const FooB: c_int = 5; \\pub const Foo1: c_int = 6; \\pub const enum_Foo = ++ " " ++ default_enum_type ++ \\; , \\pub const Foo = enum_Foo; }); cases.add("macro cast", \\#include <stdint.h> \\#define FOO(bar) baz((void *)(baz)) \\#define BAR (void*) a \\#define BAZ (uint32_t)(2) , &[_][]const u8{ \\pub inline fn FOO(bar: anytype) @TypeOf(baz(@import("std").zig.c_translation.cast(?*c_void, baz))) { \\ _ = bar; \\ return baz(@import("std").zig.c_translation.cast(?*c_void, baz)); \\} , \\pub const BAR = @import("std").zig.c_translation.cast(?*c_void, a); , \\pub const BAZ = @import("std").zig.c_translation.cast(u32, @as(c_int, 2)); }); cases.add("macro with cast to unsigned short, long, and long long", \\#define CURLAUTH_BASIC_BUT_USHORT ((unsigned short) 1) \\#define CURLAUTH_BASIC ((unsigned long) 1) \\#define CURLAUTH_BASIC_BUT_ULONGLONG ((unsigned long long) 1) , &[_][]const u8{ \\pub const CURLAUTH_BASIC_BUT_USHORT = @import("std").zig.c_translation.cast(c_ushort, @as(c_int, 1)); \\pub const CURLAUTH_BASIC = @import("std").zig.c_translation.cast(c_ulong, @as(c_int, 1)); \\pub const CURLAUTH_BASIC_BUT_ULONGLONG = @import("std").zig.c_translation.cast(c_ulonglong, @as(c_int, 1)); }); cases.add("macro conditional operator", \\#define FOO a ? b : c , &[_][]const u8{ \\pub const FOO = if (a) b else c; }); cases.add("do while as expr", \\static void foo(void) { \\ if (1) \\ do {} while (0); \\} , &[_][]const u8{ \\pub fn foo() callconv(.C) void { \\ if (true) {} \\} }); cases.add("macro comparisions", \\#define MIN(a, b) ((b) < (a) ? (b) : (a)) \\#define MAX(a, b) ((b) > (a) ? (b) : (a)) , &[_][]const u8{ \\pub inline fn MIN(a: anytype, b: anytype) @TypeOf(if (b < a) b else a) { \\ return if (b < a) b else a; \\} , \\pub inline fn MAX(a: anytype, b: anytype) @TypeOf(if (b > a) b else a) { \\ return if (b > a) b else a; \\} }); cases.add("nested assignment", \\int foo(int *p, int x) { \\ return *p++ = x; \\} , &[_][]const u8{ \\pub export fn foo(arg_p: [*c]c_int, arg_x: c_int) c_int { \\ var p = arg_p; \\ var x = arg_x; \\ return blk: { \\ const tmp = x; \\ (blk_1: { \\ const ref = &p; \\ const tmp_2 = ref.*; \\ ref.* += 1; \\ break :blk_1 tmp_2; \\ }).* = tmp; \\ break :blk tmp; \\ }; \\} }); cases.add("widening and truncating integer casting to different signedness", \\unsigned long foo(void) { \\ return -1; \\} \\unsigned short bar(long x) { \\ return x; \\} , &[_][]const u8{ \\pub export fn foo() c_ulong { \\ return @bitCast(c_ulong, @as(c_long, -@as(c_int, 1))); \\} \\pub export fn bar(arg_x: c_long) c_ushort { \\ var x = arg_x; \\ return @bitCast(c_ushort, @truncate(c_short, x)); \\} }); cases.add("arg name aliasing decl which comes after", \\void foo(int bar) { \\ bar = 2; \\} \\int bar = 4; , &[_][]const u8{ \\pub export fn foo(arg_bar_1: c_int) void { \\ var bar_1 = arg_bar_1; \\ bar_1 = 2; \\} \\pub export var bar: c_int = 4; }); cases.add("arg name aliasing macro which comes after", \\void foo(int bar) { \\ bar = 2; \\} \\#define bar 4 , &[_][]const u8{ \\pub export fn foo(arg_bar_1: c_int) void { \\ var bar_1 = arg_bar_1; \\ bar_1 = 2; \\} , \\pub const bar = @as(c_int, 4); }); cases.add("don't export inline functions", \\inline void a(void) {} \\static void b(void) {} \\void c(void) {} \\static void foo() {} , &[_][]const u8{ \\pub fn a() callconv(.C) void {} \\pub fn b() callconv(.C) void {} \\pub export fn c() void {} \\pub fn foo() callconv(.C) void {} }); cases.add("casting away const and volatile", \\void foo(int *a) {} \\void bar(const int *a) { \\ foo((int *)a); \\} \\void baz(volatile int *a) { \\ foo((int *)a); \\} , &[_][]const u8{ \\pub export fn foo(arg_a: [*c]c_int) void { \\ var a = arg_a; \\ _ = a; \\} \\pub export fn bar(arg_a: [*c]const c_int) void { \\ var a = arg_a; \\ foo(@intToPtr([*c]c_int, @ptrToInt(a))); \\} \\pub export fn baz(arg_a: [*c]volatile c_int) void { \\ var a = arg_a; \\ foo(@intToPtr([*c]c_int, @ptrToInt(a))); \\} }); cases.add("handling of _Bool type", \\_Bool foo(_Bool x) { \\ _Bool a = x != 1; \\ _Bool b = a != 0; \\ _Bool c = foo; \\ return foo(c != b); \\} , &[_][]const u8{ \\pub export fn foo(arg_x: bool) bool { \\ var x = arg_x; \\ var a: bool = @as(c_int, @boolToInt(x)) != @as(c_int, 1); \\ var b: bool = @as(c_int, @boolToInt(a)) != @as(c_int, 0); \\ var c: bool = @ptrToInt(foo) != 0; \\ return foo(@as(c_int, @boolToInt(c)) != @as(c_int, @boolToInt(b))); \\} }); cases.add("Don't make const parameters mutable", \\int max(const int x, int y) { \\ return (x > y) ? x : y; \\} , &[_][]const u8{ \\pub export fn max(x: c_int, arg_y: c_int) c_int { \\ var y = arg_y; \\ return if (x > y) x else y; \\} }); cases.add("string concatenation in macros", \\#define FOO "hello" \\#define BAR FOO " world" \\#define BAZ "oh, " FOO , &[_][]const u8{ \\pub const FOO = "hello"; , \\pub const BAR = FOO ++ " world"; , \\pub const BAZ = "oh, " ++ FOO; }); cases.add("string concatenation in macros: two defines", \\#define FOO "hello" \\#define BAZ " world" \\#define BAR FOO BAZ , &[_][]const u8{ \\pub const FOO = "hello"; , \\pub const BAZ = " world"; , \\pub const BAR = FOO ++ BAZ; }); cases.add("string concatenation in macros: two strings", \\#define FOO "a" "b" \\#define BAR FOO "c" , &[_][]const u8{ \\pub const FOO = "a" ++ "b"; , \\pub const BAR = FOO ++ "c"; }); cases.add("string concatenation in macros: three strings", \\#define FOO "a" "b" "c" , &[_][]const u8{ \\pub const FOO = "a" ++ "b" ++ "c"; }); cases.add("multibyte character literals", \\#define FOO 'abcd' , &[_][]const u8{ \\pub const FOO = 0x61626364; }); cases.add("Make sure casts are grouped", \\typedef struct \\{ \\ int i; \\} \\*_XPrivDisplay; \\typedef struct _XDisplay Display; \\#define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen) \\ , &[_][]const u8{ \\pub inline fn DefaultScreen(dpy: anytype) @TypeOf(@import("std").zig.c_translation.cast(_XPrivDisplay, dpy).*.default_screen) { \\ return @import("std").zig.c_translation.cast(_XPrivDisplay, dpy).*.default_screen; \\} }); cases.add("macro integer literal casts", \\#define NULL ((void*)0) \\#define FOO ((int)0x8000) , &[_][]const u8{ \\pub const NULL = @import("std").zig.c_translation.cast(?*c_void, @as(c_int, 0)); , \\pub const FOO = @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x8000, .hexadecimal)); }); if (std.Target.current.abi == .msvc) { cases.add("nameless struct fields", \\typedef struct NAMED \\{ \\ long name; \\} NAMED; \\ \\typedef struct ONENAMEWITHSTRUCT \\{ \\ NAMED; \\ long b; \\} ONENAMEWITHSTRUCT; , &[_][]const u8{ \\pub const struct_NAMED = extern struct { \\ name: c_long, \\}; \\pub const NAMED = struct_NAMED; \\pub const struct_ONENAMEWITHSTRUCT = extern struct { \\ unnamed_0: struct_NAMED, \\ b: c_long, \\}; }); } else { cases.add("nameless struct fields", \\typedef struct NAMED \\{ \\ long name; \\} NAMED; \\ \\typedef struct ONENAMEWITHSTRUCT \\{ \\ NAMED; \\ long b; \\} ONENAMEWITHSTRUCT; , &[_][]const u8{ \\pub const struct_NAMED = extern struct { \\ name: c_long, \\}; \\pub const NAMED = struct_NAMED; \\pub const struct_ONENAMEWITHSTRUCT = extern struct { \\ b: c_long, \\}; }); } cases.add("unnamed fields have predictabile names", \\struct a { \\ struct {}; \\}; \\struct b { \\ struct {}; \\}; , &[_][]const u8{ \\const struct_unnamed_1 = extern struct {}; \\pub const struct_a = extern struct { \\ unnamed_0: struct_unnamed_1, \\}; \\const struct_unnamed_2 = extern struct {}; \\pub const struct_b = extern struct { \\ unnamed_0: struct_unnamed_2, \\}; }); cases.add("integer literal promotion", \\#define GUARANTEED_TO_FIT_1 1024 \\#define GUARANTEED_TO_FIT_2 10241024L \\#define GUARANTEED_TO_FIT_3 20482048LU \\#define MAY_NEED_PROMOTION_1 10241024 \\#define MAY_NEED_PROMOTION_2 307230723072L \\#define MAY_NEED_PROMOTION_3 819281928192LU \\#define MAY_NEED_PROMOTION_HEX 0x80000000 \\#define MAY_NEED_PROMOTION_OCT 020000000000 , &[_][]const u8{ \\pub const GUARANTEED_TO_FIT_1 = @as(c_int, 1024); \\pub const GUARANTEED_TO_FIT_2 = @as(c_long, 10241024); \\pub const GUARANTEED_TO_FIT_3 = @as(c_ulong, 20482048); \\pub const MAY_NEED_PROMOTION_1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 10241024, .decimal); \\pub const MAY_NEED_PROMOTION_2 = @import("std").zig.c_translation.promoteIntLiteral(c_long, 307230723072, .decimal); \\pub const MAY_NEED_PROMOTION_3 = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 819281928192, .decimal); \\pub const MAY_NEED_PROMOTION_HEX = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x80000000, .hexadecimal); \\pub const MAY_NEED_PROMOTION_OCT = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0o20000000000, .octal); }); // See __builtin_alloca_with_align comment in std.zig.c_builtins cases.add("demote un-implemented builtins", \\#define FOO(X) __builtin_alloca_with_align((X), 8) , &[_][]const u8{ \\pub const FOO = @compileError("TODO implement function '__builtin_alloca_with_align' in std.zig.c_builtins"); }); cases.add("null sentinel arrays when initialized from string literal. Issue #8256", \\#include <stdint.h> \\char zero[0] = "abc"; \\uint32_t zero_w[0] = U"💯💯💯"; \\char empty_incomplete[] = ""; \\uint32_t empty_incomplete_w[] = U""; \\char empty_constant[100] = ""; \\uint32_t empty_constant_w[100] = U""; \\char incomplete[] = "abc"; \\uint32_t incomplete_w[] = U"💯💯💯"; \\char truncated[1] = "abc"; \\uint32_t truncated_w[1] = U"💯💯💯"; \\char extend[5] = "a"; \\uint32_t extend_w[5] = U"💯"; \\char no_null[3] = "abc"; \\uint32_t no_null_w[3] = U"💯💯💯"; , &[_][]const u8{ \\pub export var zero: [0]u8 = [0]u8{}; \\pub export var zero_w: [0]u32 = [0]u32{}; \\pub export var empty_incomplete: [1]u8 = [1]u8{0} ** 1; \\pub export var empty_incomplete_w: [1]u32 = [1]u32{0} ** 1; \\pub export var empty_constant: [100]u8 = [1]u8{0} ** 100; \\pub export var empty_constant_w: [100]u32 = [1]u32{0} ** 100; \\pub export var incomplete: [3:0]u8 = "abc".*; \\pub export var incomplete_w: [3:0]u32 = [3:0]u32{ \\ '\u{1f4af}', \\ '\u{1f4af}', \\ '\u{1f4af}', \\}; \\pub export var truncated: [1]u8 = "abc"[0..1].*; \\pub export var truncated_w: [1]u32 = [1]u32{ \\ '\u{1f4af}', \\}; \\pub export var extend: [5]u8 = "a"[0..1].* ++ [1]u8{0} ** 4; \\pub export var extend_w: [5]u32 = [1]u32{ \\ '\u{1f4af}', \\} ++ [1]u32{0} ** 4; \\pub export var no_null: [3]u8 = "abc".*; \\pub export var no_null_w: [3]u32 = [3]u32{ \\ '\u{1f4af}', \\ '\u{1f4af}', \\ '\u{1f4af}', \\}; }); cases.add("global assembly", \\__asm__(".globl func\n\t" \\ ".type func, @function\n\t" \\ "func:\n\t" \\ ".cfi_startproc\n\t" \\ "movl $42, %eax\n\t" \\ "ret\n\t" \\ ".cfi_endproc"); , &[_][]const u8{ \\comptime { \\ asm (".globl func\n\t.type func, @function\n\tfunc:\n\t.cfi_startproc\n\tmovl $42, %eax\n\tret\n\t.cfi_endproc"); \\} }); cases.add("Demote function that initializes opaque struct", \\struct my_struct { \\ unsigned a: 15; \\ unsigned: 2; \\ unsigned b: 15; \\}; \\void initialize(void) { \\ struct my_struct S = {.a = 1, .b = 2}; \\} , &[_][]const u8{ \\warning: cannot initialize opaque type , \\warning: unable to translate function, demoted to extern \\pub extern fn initialize() void; }); cases.add("Demote function that dereferences opaque type", \\struct my_struct { \\ unsigned a: 1; \\}; \\void deref(struct my_struct *s) { \\ *s; \\} , &[_][]const u8{ \\warning: cannot dereference opaque type , \\warning: unable to translate function, demoted to extern \\pub extern fn deref(arg_s: ?*struct_my_struct) void; }); cases.add("Function prototype declared within function", \\int foo(void) { \\ extern int bar(int, int); \\ return bar(1, 2); \\} , &[_][]const u8{ \\pub extern fn bar(c_int, c_int) c_int; \\pub export fn foo() c_int { \\ return bar(@as(c_int, 1), @as(c_int, 2)); \\} }); cases.add("static local variable zero-initialized if no initializer", \\struct FOO {int x; int y;}; \\int bar(void) { \\ static struct FOO foo; \\ return foo.x; \\} , &[_][]const u8{ \\pub const struct_FOO = extern struct { \\ x: c_int, \\ y: c_int, \\}; \\pub export fn bar() c_int { \\ const foo = struct { \\ var static: struct_FOO = @import("std").mem.zeroes(struct_FOO); \\ }; \\ return foo.static.x; \\} }); cases.add("macro with nontrivial cast", \\#define MAP_FAILED ((void *) -1) \\typedef long long LONG_PTR; \\#define INVALID_HANDLE_VALUE ((void *)(LONG_PTR)-1) , &[_][]const u8{ \\pub const MAP_FAILED = @import("std").zig.c_translation.cast(?*c_void, -@as(c_int, 1)); \\pub const INVALID_HANDLE_VALUE = @import("std").zig.c_translation.cast(?*c_void, @import("std").zig.c_translation.cast(LONG_PTR, -@as(c_int, 1))); }); cases.add("discard unused local variables and function parameters", \\#define FOO(A, B) (A) \\int bar(int x, int y) { \\ return x; \\} , &[_][]const u8{ \\pub export fn bar(arg_x: c_int, arg_y: c_int) c_int { \\ var x = arg_x; \\ var y = arg_y; \\ _ = y; \\ return x; \\} , \\pub inline fn FOO(A: anytype, B: anytype) @TypeOf(A) { \\ _ = B; \\ return A; \\} }); cases.add("Use @ syntax for bare underscore identifier in macro or public symbol", \\#define FOO _ \\int _ = 42; , &[_][]const u8{ \\pub const FOO = @"_"; , \\pub export var @"_": c_int = 42; }); cases.add("Macro matching", \\#define FOO(X) (X ## U) , &[_][]const u8{ \\pub const FOO = @import("std").zig.c_translation.Macros.U_SUFFIX; }); cases.add("Simple array access of pointer with non-negative integer constant", \\void foo(int *p) { \\ p[0]; \\ p[1]; \\} , &[_][]const u8{ \\_ = p[@intCast(c_uint, @as(c_int, 0))]; , \\_ = p[@intCast(c_uint, @as(c_int, 1))]; }); }
test/translate_c.zig
const std = @import("std"); const analysis = @import("analysis.zig"); const offsets = @import("offsets.zig"); const DocumentStore = @import("document_store.zig"); const types = @import("types.zig"); const ast = std.zig.ast; const Token = std.zig.Token; const identifierFromPosition = @import("main.zig").identifierFromPosition; usingnamespace @import("ast.zig"); fn fnProtoToSignatureInfo( document_store: *DocumentStore, arena: *std.heap.ArenaAllocator, commas: u32, skip_self_param: bool, handle: *DocumentStore.Handle, fn_node: ast.Node.Index, proto: ast.full.FnProto, ) !types.SignatureInformation { const ParameterInformation = types.SignatureInformation.ParameterInformation; const tree = handle.tree; const token_starts = tree.tokens.items(.start); const alloc = &arena.allocator; const label = analysis.getFunctionSignature(tree, proto); const proto_comments = (try analysis.getDocComments(alloc, tree, fn_node, .Markdown)) orelse ""; const arg_idx = if (skip_self_param) blk: { const has_self_param = try analysis.hasSelfParam(arena, document_store, handle, proto); break :blk commas + @boolToInt(has_self_param); } else commas; var params = std.ArrayListUnmanaged(ParameterInformation){}; var param_it = proto.iterate(tree); while (param_it.next()) |param| { const param_comments = if (param.first_doc_comment) |dc| try analysis.collectDocComments(alloc, tree, dc, .Markdown, false) else ""; var param_label_start: usize = 0; var param_label_end: usize = 0; if (param.comptime_noalias) |cn| { param_label_start = token_starts[cn]; param_label_end = param_label_start + tree.tokenSlice(cn).len; } if (param.name_token) |nt| { if (param_label_start == 0) param_label_start = token_starts[nt]; param_label_end = token_starts[nt] + tree.tokenSlice(nt).len; } if (param.anytype_ellipsis3) |ae| { if (param_label_start == 0) param_label_start = token_starts[ae]; param_label_end = token_starts[ae] + tree.tokenSlice(ae).len; } if (param.type_expr != 0) { if (param_label_start == 0) param_label_start = token_starts[tree.firstToken(param.type_expr)]; const last_param_tok = lastToken(tree, param.type_expr); param_label_end = token_starts[last_param_tok] + tree.tokenSlice(last_param_tok).len; } const param_label = tree.source[param_label_start..param_label_end]; try params.append(alloc, .{ .label = param_label, .documentation = types.MarkupContent{ .value = param_comments }, }); } return types.SignatureInformation{ .label = label, .documentation = types.MarkupContent{ .value = proto_comments }, .parameters = params.items, .activeParameter = arg_idx, }; } pub fn getSignatureInfo( document_store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, absolute_index: usize, comptime data: type, ) !?types.SignatureInformation { const innermost_block = analysis.innermostBlockScope(handle.*, absolute_index); const tree = handle.tree; const token_tags = tree.tokens.items(.tag); const token_starts = tree.tokens.items(.start); // Use the innermost scope to determine the earliest token we would need // to scan up to find a function or buitin call const first_token = tree.firstToken(innermost_block); // We start by finding the token that includes the current cursor position const last_token = blk: { if (token_starts[0] >= absolute_index) return null; var i: u32 = 1; while (i < token_tags.len) : (i += 1) { if (token_starts[i] >= absolute_index) { break :blk i - 1; } } break :blk @truncate(u32, token_tags.len - 1); }; // We scan the tokens from last to first, adding and removing open and close // delimiter tokens to a stack, while keeping track of commas corresponding // to each of the blocks in a stack. // When we encounter a dangling left parenthesis token, we continue scanning // backwards for a compatible possible function call lhs expression or a // single builtin token. // When a function call expression is detected, it is resolved to a declaration // or a function type and the resulting function prototype is converted into // a signature information object. const StackSymbol = enum { l_paren, r_paren, l_brace, r_brace, l_bracket, r_bracket, fn from(tag: Token.Tag) @This() { return switch (tag) { .l_paren => .l_paren, .r_paren => .r_paren, .l_brace => .l_brace, .r_brace => .r_brace, .l_bracket => .l_bracket, .r_bracket => .r_bracket, else => unreachable, }; } }; const alloc = &arena.allocator; var symbol_stack = try std.ArrayListUnmanaged(StackSymbol).initCapacity(alloc, 8); var curr_commas: u32 = 0; var comma_stack = try std.ArrayListUnmanaged(u32).initCapacity(alloc, 4); var curr_token = last_token; while (curr_token >= first_token and curr_token != 0) : (curr_token -= 1) { switch (token_tags[curr_token]) { .comma => curr_commas += 1, .l_brace => { curr_commas = comma_stack.popOrNull() orelse 0; if (symbol_stack.items.len != 0) { const peek_sym = symbol_stack.items[symbol_stack.items.len - 1]; switch (peek_sym) { .r_brace => { _ = symbol_stack.pop(); continue; }, .r_bracket, .r_paren => { return null; }, else => {}, } } try symbol_stack.append(alloc, .l_brace); }, .l_bracket => { curr_commas = comma_stack.popOrNull() orelse 0; if (symbol_stack.items.len != 0) { const peek_sym = symbol_stack.items[symbol_stack.items.len - 1]; switch (peek_sym) { .r_bracket => { _ = symbol_stack.pop(); continue; }, .r_brace, .r_paren => { return null; }, else => {}, } } try symbol_stack.append(alloc, .l_bracket); }, .l_paren => { const paren_commas = curr_commas; curr_commas = comma_stack.popOrNull() orelse 0; if (symbol_stack.items.len != 0) { const peek_sym = symbol_stack.items[symbol_stack.items.len - 1]; switch (peek_sym) { .r_paren => { _ = symbol_stack.pop(); continue; }, .r_brace, .r_bracket => { return null; }, else => {}, } } // Try to find a function expression or a builtin identifier if (curr_token == first_token) return null; const expr_last_token = curr_token - 1; if (token_tags[expr_last_token] == .builtin) { // Builtin token, find the builtin and construct signature information. for (data.builtins) |builtin| { if (std.mem.eql(u8, builtin.name, tree.tokenSlice(expr_last_token))) { const param_infos = try alloc.alloc( types.SignatureInformation.ParameterInformation, builtin.arguments.len, ); for (param_infos) |*info, i| { info.* = .{ .label = builtin.arguments[i], .documentation = null, }; } return types.SignatureInformation{ .label = builtin.signature, .documentation = .{ .value = builtin.documentation, }, .parameters = param_infos, .activeParameter = paren_commas, }; } } return null; } // Scan for a function call lhs expression. var state: union(enum) { any, in_bracket: u32, in_paren: u32, } = .any; var i = expr_last_token; const expr_first_token = while (i > first_token) : (i -= 1) { switch (state) { .in_bracket => |*count| if (token_tags[i] == .r_bracket) { count.* += 1; } else if (token_tags[i] == .l_bracket) { count.* -= 1; if (count.* == 0) state = .any; }, .in_paren => |*count| if (token_tags[i] == .r_paren) { count.* += 1; } else if (token_tags[i] == .l_paren) { count.* -= 1; if (count.* == 0) state = .any; }, .any => switch (token_tags[i]) { .r_bracket => state = .{ .in_bracket = 1 }, .r_paren => state = .{ .in_paren = 1 }, .identifier, .period, .period_asterisk, => {}, else => break i + 1, }, } } else first_token + 1; if (state != .any or expr_first_token > expr_last_token) { try symbol_stack.append(alloc, .l_paren); continue; } const expr_start = token_starts[expr_first_token]; const last_token_slice = tree.tokenSlice(expr_last_token); const expr_end = token_starts[expr_last_token] + last_token_slice.len; var held_expr = handle.document.borrowNullTerminatedSlice(expr_start, expr_end); defer held_expr.release(); // Resolve the expression. var tokenizer = std.zig.Tokenizer.init(held_expr.data()); if (try analysis.getFieldAccessType( document_store, arena, handle, expr_start, &tokenizer, )) |result| { const type_handle = result.unwrapped orelse result.original; var node = switch (type_handle.type.data) { .other => |n| n, else => { try symbol_stack.append(alloc, .l_paren); continue; }, }; var buf: [1]ast.Node.Index = undefined; if (fnProto(type_handle.handle.tree, node, &buf)) |proto| { return try fnProtoToSignatureInfo( document_store, arena, paren_commas, false, type_handle.handle, node, proto, ); } const name = identifierFromPosition(expr_end - 1, handle.*); if (name.len == 0) { try symbol_stack.append(alloc, .l_paren); continue; } const skip_self_param = !type_handle.type.is_type_val; const decl_handle = (try analysis.lookupSymbolContainer( document_store, arena, .{ .node = node, .handle = type_handle.handle }, name, true, )) orelse { try symbol_stack.append(alloc, .l_paren); continue; }; var res_handle = decl_handle.handle; node = switch (decl_handle.decl.*) { .ast_node => |n| n, else => { try symbol_stack.append(alloc, .l_paren); continue; }, }; if (try analysis.resolveVarDeclAlias( document_store, arena, .{ .node = node, .handle = decl_handle.handle }, )) |resolved| { switch (resolved.decl.*) { .ast_node => |n| { res_handle = resolved.handle; node = n; }, else => {}, } } if (fnProto(res_handle.tree, node, &buf)) |proto| { return try fnProtoToSignatureInfo( document_store, arena, paren_commas, skip_self_param, res_handle, node, proto, ); } } }, .r_brace, .r_paren, .r_bracket => |tag| { try comma_stack.append(alloc, curr_commas); curr_commas = 0; try symbol_stack.append(alloc, StackSymbol.from(tag)); }, else => {}, } } return null; }
src/signature_help.zig
const std = @import("std"); const ast = std.zig.ast; const Tree = ast.Tree; const Node = ast.Node; const full = ast.full; const assert = std.debug.assert; fn fullPtrType(tree: Tree, info: full.PtrType.Ast) full.PtrType { const token_tags = tree.tokens.items(.tag); // TODO: looks like stage1 isn't quite smart enough to handle enum // literals in some places here const Size = std.builtin.TypeInfo.Pointer.Size; const size: Size = switch (token_tags[info.main_token]) { .asterisk, .asterisk_asterisk, => switch (token_tags[info.main_token + 1]) { .r_bracket, .colon => .Many, .identifier => if (token_tags[info.main_token - 1] == .l_bracket) Size.C else .One, else => .One, }, .l_bracket => Size.Slice, else => unreachable, }; var result: full.PtrType = .{ .size = size, .allowzero_token = null, .const_token = null, .volatile_token = null, .ast = info, }; // We need to be careful that we don't iterate over any sub-expressions // here while looking for modifiers as that could result in false // positives. Therefore, start after a sentinel if there is one and // skip over any align node and bit range nodes. var i = if (info.sentinel != 0) lastToken(tree, info.sentinel) + 1 else info.main_token; const end = tree.firstToken(info.child_type); while (i < end) : (i += 1) { switch (token_tags[i]) { .keyword_allowzero => result.allowzero_token = i, .keyword_const => result.const_token = i, .keyword_volatile => result.volatile_token = i, .keyword_align => { assert(info.align_node != 0); if (info.bit_range_end != 0) { assert(info.bit_range_start != 0); i = lastToken(tree, info.bit_range_end) + 1; } else { i = lastToken(tree, info.align_node) + 1; } }, else => {}, } } return result; } pub fn ptrTypeSimple(tree: Tree, node: Node.Index) full.PtrType { assert(tree.nodes.items(.tag)[node] == .ptr_type); const data = tree.nodes.items(.data)[node]; const extra = tree.extraData(data.lhs, Node.PtrType); return fullPtrType(tree, .{ .main_token = tree.nodes.items(.main_token)[node], .align_node = extra.align_node, .sentinel = extra.sentinel, .bit_range_start = 0, .bit_range_end = 0, .child_type = data.rhs, }); } pub fn ptrTypeSentinel(tree: Tree, node: Node.Index) full.PtrType { assert(tree.nodes.items(.tag)[node] == .ptr_type_sentinel); const data = tree.nodes.items(.data)[node]; return fullPtrType(tree, .{ .main_token = tree.nodes.items(.main_token)[node], .align_node = 0, .sentinel = data.lhs, .bit_range_start = 0, .bit_range_end = 0, .child_type = data.rhs, }); } pub fn ptrTypeAligned(tree: Tree, node: Node.Index) full.PtrType { assert(tree.nodes.items(.tag)[node] == .ptr_type_aligned); const data = tree.nodes.items(.data)[node]; return fullPtrType(tree, .{ .main_token = tree.nodes.items(.main_token)[node], .align_node = data.lhs, .sentinel = 0, .bit_range_start = 0, .bit_range_end = 0, .child_type = data.rhs, }); } pub fn ptrTypeBitRange(tree: Tree, node: Node.Index) full.PtrType { assert(tree.nodes.items(.tag)[node] == .ptr_type_bit_range); const data = tree.nodes.items(.data)[node]; const extra = tree.extraData(data.lhs, Node.PtrTypeBitRange); return fullPtrType(tree, .{ .main_token = tree.nodes.items(.main_token)[node], .align_node = extra.align_node, .sentinel = extra.sentinel, .bit_range_start = extra.bit_range_start, .bit_range_end = extra.bit_range_end, .child_type = data.rhs, }); } fn fullIf(tree: Tree, info: full.If.Ast) full.If { const token_tags = tree.tokens.items(.tag); var result: full.If = .{ .ast = info, .payload_token = null, .error_token = null, .else_token = undefined, }; // if (cond_expr) |x| // ^ ^ const payload_pipe = lastToken(tree, info.cond_expr) + 2; if (token_tags[payload_pipe] == .pipe) { result.payload_token = payload_pipe + 1; } if (info.else_expr != 0) { // then_expr else |x| // ^ ^ result.else_token = lastToken(tree, info.then_expr) + 1; if (token_tags[result.else_token + 1] == .pipe) { result.error_token = result.else_token + 2; } } return result; } pub fn ifFull(tree: Tree, node: Node.Index) full.If { const data = tree.nodes.items(.data)[node]; if (tree.nodes.items(.tag)[node] == .@"if") { const extra = tree.extraData(data.rhs, Node.If); return fullIf(tree, .{ .cond_expr = data.lhs, .then_expr = extra.then_expr, .else_expr = extra.else_expr, .if_token = tree.nodes.items(.main_token)[node], }); } else { assert(tree.nodes.items(.tag)[node] == .if_simple); return fullIf(tree, .{ .cond_expr = data.lhs, .then_expr = data.rhs, .else_expr = 0, .if_token = tree.nodes.items(.main_token)[node], }); } } fn fullWhile(tree: Tree, info: full.While.Ast) full.While { const token_tags = tree.tokens.items(.tag); var result: full.While = .{ .ast = info, .inline_token = null, .label_token = null, .payload_token = null, .else_token = undefined, .error_token = null, }; var tok_i = info.while_token - 1; if (token_tags[tok_i] == .keyword_inline) { result.inline_token = tok_i; tok_i -= 1; } if (token_tags[tok_i] == .colon and token_tags[tok_i - 1] == .identifier) { result.label_token = tok_i - 1; } const last_cond_token = lastToken(tree, info.cond_expr); if (token_tags[last_cond_token + 2] == .pipe) { result.payload_token = last_cond_token + 3; } if (info.else_expr != 0) { // then_expr else |x| // ^ ^ result.else_token = lastToken(tree, info.then_expr) + 1; if (token_tags[result.else_token + 1] == .pipe) { result.error_token = result.else_token + 2; } } return result; } pub fn whileSimple(tree: Tree, node: Node.Index) full.While { const data = tree.nodes.items(.data)[node]; return fullWhile(tree, .{ .while_token = tree.nodes.items(.main_token)[node], .cond_expr = data.lhs, .cont_expr = 0, .then_expr = data.rhs, .else_expr = 0, }); } pub fn whileCont(tree: Tree, node: Node.Index) full.While { const data = tree.nodes.items(.data)[node]; const extra = tree.extraData(data.rhs, Node.WhileCont); return fullWhile(tree, .{ .while_token = tree.nodes.items(.main_token)[node], .cond_expr = data.lhs, .cont_expr = extra.cont_expr, .then_expr = extra.then_expr, .else_expr = 0, }); } pub fn whileFull(tree: Tree, node: Node.Index) full.While { const data = tree.nodes.items(.data)[node]; const extra = tree.extraData(data.rhs, Node.While); return fullWhile(tree, .{ .while_token = tree.nodes.items(.main_token)[node], .cond_expr = data.lhs, .cont_expr = extra.cont_expr, .then_expr = extra.then_expr, .else_expr = extra.else_expr, }); } pub fn forSimple(tree: Tree, node: Node.Index) full.While { const data = tree.nodes.items(.data)[node]; return fullWhile(tree, .{ .while_token = tree.nodes.items(.main_token)[node], .cond_expr = data.lhs, .cont_expr = 0, .then_expr = data.rhs, .else_expr = 0, }); } pub fn forFull(tree: Tree, node: Node.Index) full.While { const data = tree.nodes.items(.data)[node]; const extra = tree.extraData(data.rhs, Node.If); return fullWhile(tree, .{ .while_token = tree.nodes.items(.main_token)[node], .cond_expr = data.lhs, .cont_expr = 0, .then_expr = extra.then_expr, .else_expr = extra.else_expr, }); } pub fn lastToken(tree: ast.Tree, node: ast.Node.Index) ast.TokenIndex { const TokenIndex = ast.TokenIndex; const tags = tree.nodes.items(.tag); const datas = tree.nodes.items(.data); const main_tokens = tree.nodes.items(.main_token); const token_starts = tree.tokens.items(.start); const token_tags = tree.tokens.items(.tag); var n = node; var end_offset: TokenIndex = 0; while (true) switch (tags[n]) { .root => return @intCast(TokenIndex, tree.tokens.len - 1), .@"usingnamespace" => { // lhs is the expression if (datas[n].lhs == 0) { return main_tokens[n] + end_offset; } else { n = datas[n].lhs; } }, .test_decl => { // rhs is the block // lhs is the name if (datas[n].rhs != 0) { n = datas[n].rhs; } else if (datas[n].lhs != 0) { n = datas[n].lhs; } else { return main_tokens[n] + end_offset; } }, .global_var_decl => { // rhs is init node if (datas[n].rhs != 0) { n = datas[n].rhs; } else { const extra = tree.extraData(datas[n].lhs, Node.GlobalVarDecl); if (extra.section_node != 0) { end_offset += 1; // for the rparen n = extra.section_node; } else if (extra.align_node != 0) { end_offset += 1; // for the rparen n = extra.align_node; } else if (extra.type_node != 0) { n = extra.type_node; } else { end_offset += 1; // from mut token to name return main_tokens[n] + end_offset; } } }, .local_var_decl => { // rhs is init node if (datas[n].rhs != 0) { n = datas[n].rhs; } else { const extra = tree.extraData(datas[n].lhs, Node.LocalVarDecl); if (extra.align_node != 0) { end_offset += 1; // for the rparen n = extra.align_node; } else if (extra.type_node != 0) { n = extra.type_node; } else { end_offset += 1; // from mut token to name return main_tokens[n] + end_offset; } } }, .simple_var_decl => { // rhs is init node if (datas[n].rhs != 0) { n = datas[n].rhs; } else if (datas[n].lhs != 0) { n = datas[n].lhs; } else { end_offset += 1; // from mut token to name return main_tokens[n] + end_offset; } }, .aligned_var_decl => { // rhs is init node, lhs is align node if (datas[n].rhs != 0) { n = datas[n].rhs; } else if (datas[n].lhs != 0) { end_offset += 1; // for the rparen n = datas[n].lhs; } else { end_offset += 1; // from mut token to name return main_tokens[n] + end_offset; } }, .@"errdefer" => { // lhs is the token payload, rhs is the expression if (datas[n].rhs != 0) { n = datas[n].rhs; } else if (datas[n].lhs != 0) { // right pipe end_offset += 1; n = datas[n].lhs; } else { return main_tokens[n] + end_offset; } }, .@"defer" => { // rhs is the defered expr if (datas[n].rhs != 0) { n = datas[n].rhs; } else { return main_tokens[n] + end_offset; } }, .bool_not, .negation, .bit_not, .negation_wrap, .address_of, .@"try", .@"await", .optional_type, .@"resume", .@"nosuspend", .@"comptime", => n = datas[n].lhs, .@"catch", .equal_equal, .bang_equal, .less_than, .greater_than, .less_or_equal, .greater_or_equal, .assign_mul, .assign_div, .assign_mod, .assign_add, .assign_sub, .assign_bit_shift_left, .assign_bit_shift_right, .assign_bit_and, .assign_bit_xor, .assign_bit_or, .assign_mul_wrap, .assign_add_wrap, .assign_sub_wrap, .assign, .merge_error_sets, .mul, .div, .mod, .array_mult, .mul_wrap, .add, .sub, .array_cat, .add_wrap, .sub_wrap, .bit_shift_left, .bit_shift_right, .bit_and, .bit_xor, .bit_or, .@"orelse", .bool_and, .bool_or, .anyframe_type, .error_union, .if_simple, .while_simple, .for_simple, .ptr_type_aligned, .ptr_type_sentinel, .ptr_type, .ptr_type_bit_range, .array_type, .switch_case_one, .switch_case, .switch_range, => n = datas[n].rhs, .field_access, .unwrap_optional, .grouped_expression, .multiline_string_literal, .error_set_decl, .asm_simple, .asm_output, .asm_input, .error_value, => return datas[n].rhs + end_offset, .@"anytype", .anyframe_literal, .char_literal, .integer_literal, .float_literal, .unreachable_literal, .identifier, .deref, .enum_literal, .string_literal, => return main_tokens[n] + end_offset, .@"return" => if (datas[n].lhs != 0) { n = datas[n].lhs; } else { return main_tokens[n] + end_offset; }, .call, .async_call => { end_offset += 1; // for the rparen const params = tree.extraData(datas[n].rhs, Node.SubRange); if (params.end - params.start == 0) { return main_tokens[n] + end_offset; } n = tree.extra_data[params.end - 1]; // last parameter }, .tagged_union_enum_tag => { const members = tree.extraData(datas[n].rhs, Node.SubRange); if (members.end - members.start == 0) { end_offset += 4; // for the rparen + rparen + lbrace + rbrace n = datas[n].lhs; } else { end_offset += 1; // for the rbrace n = tree.extra_data[members.end - 1]; // last parameter } }, .call_comma, .async_call_comma, .tagged_union_enum_tag_trailing, => { end_offset += 2; // for the comma/semicolon + rparen/rbrace const params = tree.extraData(datas[n].rhs, Node.SubRange); std.debug.assert(params.end > params.start); n = tree.extra_data[params.end - 1]; // last parameter }, .@"switch" => { const cases = tree.extraData(datas[n].rhs, Node.SubRange); if (cases.end - cases.start == 0) { end_offset += 3; // rparen, lbrace, rbrace n = datas[n].lhs; // condition expression } else { end_offset += 1; // for the rbrace n = tree.extra_data[cases.end - 1]; // last case } }, .container_decl_arg => { const members = tree.extraData(datas[n].rhs, Node.SubRange); if (members.end - members.start == 0) { end_offset += 3; // for the rparen + lbrace + rbrace n = datas[n].lhs; } else { end_offset += 1; // for the rbrace n = tree.extra_data[members.end - 1]; // last parameter } }, .@"asm" => { const extra = tree.extraData(datas[n].rhs, Node.Asm); return extra.rparen + end_offset; }, .array_init, .struct_init, => { const elements = tree.extraData(datas[n].rhs, Node.SubRange); std.debug.assert(elements.end - elements.start > 0); end_offset += 1; // for the rbrace n = tree.extra_data[elements.end - 1]; // last element }, .array_init_comma, .struct_init_comma, .container_decl_arg_trailing, .switch_comma, => { const members = tree.extraData(datas[n].rhs, Node.SubRange); std.debug.assert(members.end - members.start > 0); end_offset += 2; // for the comma + rbrace n = tree.extra_data[members.end - 1]; // last parameter }, .array_init_dot, .struct_init_dot, .block, .container_decl, .tagged_union, .builtin_call, => { std.debug.assert(datas[n].rhs - datas[n].lhs > 0); end_offset += 1; // for the rbrace n = tree.extra_data[datas[n].rhs - 1]; // last statement }, .array_init_dot_comma, .struct_init_dot_comma, .block_semicolon, .container_decl_trailing, .tagged_union_trailing, .builtin_call_comma, => { std.debug.assert(datas[n].rhs - datas[n].lhs > 0); end_offset += 2; // for the comma/semicolon + rbrace/rparen n = tree.extra_data[datas[n].rhs - 1]; // last member }, .call_one, .async_call_one, .array_access, => { end_offset += 1; // for the rparen/rbracket if (datas[n].rhs == 0) { return main_tokens[n] + end_offset; } n = datas[n].rhs; }, .array_init_dot_two, .block_two, .builtin_call_two, .struct_init_dot_two, .container_decl_two, .tagged_union_two, => { if (datas[n].rhs != 0) { end_offset += 1; // for the rparen/rbrace n = datas[n].rhs; } else if (datas[n].lhs != 0) { end_offset += 1; // for the rparen/rbrace n = datas[n].lhs; } else { switch (tags[n]) { .array_init_dot_two, .block_two, .struct_init_dot_two, => end_offset += 1, // rbrace .builtin_call_two => end_offset += 2, // lparen/lbrace + rparen/rbrace .container_decl_two => { var i: u32 = 2; // lbrace + rbrace while (token_tags[main_tokens[n] + i] == .container_doc_comment) i += 1; end_offset += i; }, .tagged_union_two => { var i: u32 = 5; // (enum) {} while (token_tags[main_tokens[n] + i] == .container_doc_comment) i += 1; end_offset += i; }, else => unreachable, } return main_tokens[n] + end_offset; } }, .array_init_dot_two_comma, .builtin_call_two_comma, .block_two_semicolon, .struct_init_dot_two_comma, .container_decl_two_trailing, .tagged_union_two_trailing, => { end_offset += 2; // for the comma/semicolon + rbrace/rparen if (datas[n].rhs != 0) { n = datas[n].rhs; } else if (datas[n].lhs != 0) { n = datas[n].lhs; } else { return main_tokens[n] + end_offset; // returns { } } }, .container_field_init => { if (datas[n].rhs != 0) { n = datas[n].rhs; } else if (datas[n].lhs != 0) { n = datas[n].lhs; } else { return main_tokens[n] + end_offset; } }, .container_field_align => { if (datas[n].rhs != 0) { end_offset += 1; // for the rparen n = datas[n].rhs; } else if (datas[n].lhs != 0) { n = datas[n].lhs; } else { return main_tokens[n] + end_offset; } }, .container_field => { const extra = tree.extraData(datas[n].rhs, Node.ContainerField); if (extra.value_expr != 0) { n = extra.value_expr; } else if (extra.align_expr != 0) { end_offset += 1; // for the rparen n = extra.align_expr; } else if (datas[n].lhs != 0) { n = datas[n].lhs; } else { return main_tokens[n] + end_offset; } }, .array_init_one, .struct_init_one, => { end_offset += 1; // rbrace if (datas[n].rhs == 0) { return main_tokens[n] + end_offset; } else { n = datas[n].rhs; } }, .slice_open, .call_one_comma, .async_call_one_comma, .array_init_one_comma, .struct_init_one_comma, => { end_offset += 2; // ellipsis2 + rbracket, or comma + rparen n = datas[n].rhs; std.debug.assert(n != 0); }, .slice => { const extra = tree.extraData(datas[n].rhs, Node.Slice); std.debug.assert(extra.end != 0); // should have used slice_open end_offset += 1; // rbracket n = extra.end; }, .slice_sentinel => { const extra = tree.extraData(datas[n].rhs, Node.SliceSentinel); if (extra.sentinel != 0) { end_offset += 1; // right bracket n = extra.sentinel; } else if (extra.end != 0) { end_offset += 2; // colon, right bracket n = extra.end; } else { // Assume both sentinel and end are completely devoid of tokens end_offset += 3; // ellipsis, colon, right bracket n = extra.start; } }, .@"continue" => { if (datas[n].lhs != 0) { return datas[n].lhs + end_offset; } else { return main_tokens[n] + end_offset; } }, .@"break" => { if (datas[n].rhs != 0) { n = datas[n].rhs; } else if (datas[n].lhs != 0) { return datas[n].lhs + end_offset; } else { return main_tokens[n] + end_offset; } }, .fn_decl => { if (datas[n].rhs != 0) { n = datas[n].rhs; } else { n = datas[n].lhs; } }, .fn_proto_multi => { const extra = tree.extraData(datas[n].lhs, Node.SubRange); // rhs can be 0 when no return type is provided if (datas[n].rhs != 0) { n = datas[n].rhs; } else { // Use the last argument and skip right paren n = tree.extra_data[extra.end - 1]; end_offset += 1; } }, .fn_proto_simple => { // rhs can be 0 when no return type is provided // lhs can be 0 when no parameter is provided if (datas[n].rhs != 0) { n = datas[n].rhs; } else if (datas[n].lhs != 0) { n = datas[n].lhs; // Skip right paren end_offset += 1; } else { // Skip left and right paren return main_tokens[n] + end_offset + 2; } }, .fn_proto_one => { const extra = tree.extraData(datas[n].lhs, Node.FnProtoOne); // linksection, callconv, align can appear in any order, so we // find the last one here. // rhs can be zero if no return type is provided var max_node: Node.Index = 0; var max_start: u32 = 0; if (datas[n].rhs != 0) { max_node = datas[n].rhs; max_start = token_starts[main_tokens[max_node]]; } var max_offset: TokenIndex = 0; if (extra.align_expr != 0) { const start = token_starts[main_tokens[extra.align_expr]]; if (start > max_start) { max_node = extra.align_expr; max_start = start; max_offset = 1; // for the rparen } } if (extra.section_expr != 0) { const start = token_starts[main_tokens[extra.section_expr]]; if (start > max_start) { max_node = extra.section_expr; max_start = start; max_offset = 1; // for the rparen } } if (extra.callconv_expr != 0) { const start = token_starts[main_tokens[extra.callconv_expr]]; if (start > max_start) { max_node = extra.callconv_expr; max_start = start; max_offset = 1; // for the rparen } } if (max_node == 0) { std.debug.assert(max_offset == 0); // No linksection, callconv, align, return type if (extra.param != 0) { n = extra.param; end_offset += 1; } else { // Skip left and right parens return main_tokens[n] + end_offset + 2; } } else { n = max_node; end_offset += max_offset; } }, .fn_proto => { const extra = tree.extraData(datas[n].lhs, Node.FnProto); // linksection, callconv, align can appear in any order, so we // find the last one here. // rhs can be zero if no return type is provided var max_node: Node.Index = 0; var max_start: u32 = 0; if (datas[n].rhs != 0) { max_node = datas[n].rhs; max_start = token_starts[main_tokens[max_node]]; } var max_offset: TokenIndex = 0; if (extra.align_expr != 0) { const start = token_starts[main_tokens[extra.align_expr]]; if (start > max_start) { max_node = extra.align_expr; max_start = start; max_offset = 1; // for the rparen } } if (extra.section_expr != 0) { const start = token_starts[main_tokens[extra.section_expr]]; if (start > max_start) { max_node = extra.section_expr; max_start = start; max_offset = 1; // for the rparen } } if (extra.callconv_expr != 0) { const start = token_starts[main_tokens[extra.callconv_expr]]; if (start > max_start) { max_node = extra.callconv_expr; max_start = start; max_offset = 1; // for the rparen } } if (max_node == 0) { std.debug.assert(max_offset == 0); // No linksection, callconv, align, return type // Use the last parameter and skip one extra token for the right paren n = extra.params_end; end_offset += 1; } else { n = max_node; end_offset += max_offset; } }, .while_cont => { const extra = tree.extraData(datas[n].rhs, Node.WhileCont); std.debug.assert(extra.then_expr != 0); n = extra.then_expr; }, .@"while" => { const extra = tree.extraData(datas[n].rhs, Node.While); std.debug.assert(extra.else_expr != 0); n = extra.else_expr; }, .@"if", .@"for" => { const extra = tree.extraData(datas[n].rhs, Node.If); std.debug.assert(extra.else_expr != 0); n = extra.else_expr; }, .@"suspend" => { if (datas[n].lhs != 0) { n = datas[n].lhs; } else { return main_tokens[n] + end_offset; } }, .array_type_sentinel => { const extra = tree.extraData(datas[n].rhs, Node.ArrayTypeSentinel); n = extra.elem_type; }, }; } pub fn containerField(tree: ast.Tree, node: ast.Node.Index) ?ast.full.ContainerField { return switch (tree.nodes.items(.tag)[node]) { .container_field => tree.containerField(node), .container_field_init => tree.containerFieldInit(node), .container_field_align => tree.containerFieldAlign(node), else => null, }; } pub fn ptrType(tree: ast.Tree, node: ast.Node.Index) ?ast.full.PtrType { return switch (tree.nodes.items(.tag)[node]) { .ptr_type => ptrTypeSimple(tree, node), .ptr_type_aligned => ptrTypeAligned(tree, node), .ptr_type_bit_range => ptrTypeBitRange(tree, node), .ptr_type_sentinel => ptrTypeSentinel(tree, node), else => null, }; } pub fn whileAst(tree: ast.Tree, node: ast.Node.Index) ?ast.full.While { return switch (tree.nodes.items(.tag)[node]) { .@"while" => whileFull(tree, node), .while_simple => whileSimple(tree, node), .while_cont => whileCont(tree, node), .@"for" => forFull(tree, node), .for_simple => forSimple(tree, node), else => null, }; } pub fn isContainer(tree: ast.Tree, node: ast.Node.Index) bool { return switch (tree.nodes.items(.tag)[node]) { .container_decl, .container_decl_trailing, .container_decl_arg, .container_decl_arg_trailing, .container_decl_two, .container_decl_two_trailing, .tagged_union, .tagged_union_trailing, .tagged_union_two, .tagged_union_two_trailing, .tagged_union_enum_tag, .tagged_union_enum_tag_trailing, .root, .error_set_decl, => true, else => false, }; } /// Returns the member indices of a given declaration container. /// Asserts given `tag` is a container node pub fn declMembers(tree: ast.Tree, node_idx: ast.Node.Index, buffer: *[2]ast.Node.Index) []const ast.Node.Index { std.debug.assert(isContainer(tree, node_idx)); return switch (tree.nodes.items(.tag)[node_idx]) { .container_decl, .container_decl_trailing => tree.containerDecl(node_idx).ast.members, .container_decl_arg, .container_decl_arg_trailing => tree.containerDeclArg(node_idx).ast.members, .container_decl_two, .container_decl_two_trailing => tree.containerDeclTwo(buffer, node_idx).ast.members, .tagged_union, .tagged_union_trailing => tree.taggedUnion(node_idx).ast.members, .tagged_union_enum_tag, .tagged_union_enum_tag_trailing => tree.taggedUnionEnumTag(node_idx).ast.members, .tagged_union_two, .tagged_union_two_trailing => tree.taggedUnionTwo(buffer, node_idx).ast.members, .root => tree.rootDecls(), .error_set_decl => &[_]ast.Node.Index{}, else => unreachable, }; } /// Returns an `ast.full.VarDecl` for a given node index. /// Returns null if the tag doesn't match pub fn varDecl(tree: ast.Tree, node_idx: ast.Node.Index) ?ast.full.VarDecl { return switch (tree.nodes.items(.tag)[node_idx]) { .global_var_decl => tree.globalVarDecl(node_idx), .local_var_decl => tree.localVarDecl(node_idx), .aligned_var_decl => tree.alignedVarDecl(node_idx), .simple_var_decl => tree.simpleVarDecl(node_idx), else => null, }; } pub fn isBuiltinCall(tree: ast.Tree, node: ast.Node.Index) bool { return switch (tree.nodes.items(.tag)[node]) { .builtin_call, .builtin_call_comma, .builtin_call_two, .builtin_call_two_comma, => true, else => false, }; } pub fn isCall(tree: ast.Tree, node: ast.Node.Index) bool { return switch (tree.nodes.items(.tag)[node]) { .call, .call_comma, .call_one, .call_one_comma, .async_call, .async_call_comma, .async_call_one, .async_call_one_comma, => true, else => false, }; } pub fn fnProto(tree: ast.Tree, node: ast.Node.Index, buf: *[1]ast.Node.Index) ?ast.full.FnProto { return switch (tree.nodes.items(.tag)[node]) { .fn_proto => tree.fnProto(node), .fn_proto_multi => tree.fnProtoMulti(node), .fn_proto_one => tree.fnProtoOne(buf, node), .fn_proto_simple => tree.fnProtoSimple(buf, node), .fn_decl => fnProto(tree, tree.nodes.items(.data)[node].lhs, buf), else => null, }; } pub fn callFull(tree: ast.Tree, node: ast.Node.Index, buf: *[1]ast.Node.Index) ?ast.full.Call { return switch (tree.nodes.items(.tag)[node]) { .call, .call_comma, .async_call, .async_call_comma, => tree.callFull(node), .call_one, .call_one_comma, .async_call_one, .async_call_one_comma, => tree.callOne(buf, node), else => null, }; }
src/ast.zig
const std = @import("std"); const builtin = @import("builtin"); pub const CityHash32 = struct { const Self = @This(); // Magic numbers for 32-bit hashing. Copied from Murmur3. const c1: u32 = 0xcc9e2d51; const c2: u32 = 0x1b873593; fn fetch32(ptr: [*]const u8) u32 { var v: u32 = undefined; @memcpy(@ptrCast([*]u8, &v), ptr, 4); if (builtin.endian == builtin.Endian.Big) return @byteSwap(u32, v); return v; } // A 32-bit to 32-bit integer hash copied from Murmur3. fn fmix(h: u32) u32 { var h1: u32 = h; h1 ^= h1 >> 16; h1 *%= 0x85ebca6b; h1 ^= h1 >> 13; h1 *%= 0xc2b2ae35; h1 ^= h1 >> 16; return h1; } // Rotate right helper fn rotr32(x: u32, comptime r: u32) u32 { return (x >> r) | (x << (32 - r)); } // Helper from Murmur3 for combining two 32-bit values. fn mur(a: u32, h: u32) u32 { var a1: u32 = a; var h1: u32 = h; a1 *%= c1; a1 = rotr32(a1, 17); a1 *%= c2; h1 ^= a1; h1 = rotr32(h1, 19); return h1 *% 5 +% 0xe6546b64; } fn hash32Len0To4(str: []const u8) u32 { const len: u32 = @truncate(u32, str.len); var b: u32 = 0; var c: u32 = 9; for (str) |v| { b = b *% c1 +% @bitCast(u32, @intCast(i32, @bitCast(i8, v))); c ^= b; } return fmix(mur(b, mur(len, c))); } fn hash32Len5To12(str: []const u8) u32 { var a: u32 = @truncate(u32, str.len); var b: u32 = a *% 5; var c: u32 = 9; const d: u32 = b; a +%= fetch32(str.ptr); b +%= fetch32(str.ptr + str.len - 4); c +%= fetch32(str.ptr + ((str.len >> 1) & 4)); return fmix(mur(c, mur(b, mur(a, d)))); } fn hash32Len13To24(str: []const u8) u32 { const len: u32 = @truncate(u32, str.len); const a: u32 = fetch32(str.ptr + (str.len >> 1) - 4); const b: u32 = fetch32(str.ptr + 4); const c: u32 = fetch32(str.ptr + str.len - 8); const d: u32 = fetch32(str.ptr + (str.len >> 1)); const e: u32 = fetch32(str.ptr); const f: u32 = fetch32(str.ptr + str.len - 4); return fmix(mur(f, mur(e, mur(d, mur(c, mur(b, mur(a, len))))))); } pub fn hash(str: []const u8) u32 { if (str.len <= 24) { if (str.len <= 4) { return hash32Len0To4(str); } else { if (str.len <= 12) return hash32Len5To12(str); return hash32Len13To24(str); } } const len: u32 = @truncate(u32, str.len); var h: u32 = len; var g: u32 = c1 *% len; var f: u32 = g; const a0: u32 = rotr32(fetch32(str.ptr + str.len - 4) *% c1, 17) *% c2; const a1: u32 = rotr32(fetch32(str.ptr + str.len - 8) *% c1, 17) *% c2; const a2: u32 = rotr32(fetch32(str.ptr + str.len - 16) *% c1, 17) *% c2; const a3: u32 = rotr32(fetch32(str.ptr + str.len - 12) *% c1, 17) *% c2; const a4: u32 = rotr32(fetch32(str.ptr + str.len - 20) *% c1, 17) *% c2; h ^= a0; h = rotr32(h, 19); h = h *% 5 +% 0xe6546b64; h ^= a2; h = rotr32(h, 19); h = h *% 5 +% 0xe6546b64; g ^= a1; g = rotr32(g, 19); g = g *% 5 +% 0xe6546b64; g ^= a3; g = rotr32(g, 19); g = g *% 5 +% 0xe6546b64; f +%= a4; f = rotr32(f, 19); f = f *% 5 +% 0xe6546b64; var iters = (str.len - 1) / 20; var ptr = str.ptr; while (iters != 0) : (iters -= 1) { const b0: u32 = rotr32(fetch32(ptr) *% c1, 17) *% c2; const b1: u32 = fetch32(ptr + 4); const b2: u32 = rotr32(fetch32(ptr + 8) *% c1, 17) *% c2; const b3: u32 = rotr32(fetch32(ptr + 12) *% c1, 17) *% c2; const b4: u32 = fetch32(ptr + 16); h ^= b0; h = rotr32(h, 18); h = h *% 5 +% 0xe6546b64; f +%= b1; f = rotr32(f, 19); f = f *% c1; g +%= b2; g = rotr32(g, 18); g = g *% 5 +% 0xe6546b64; h ^= b3 +% b1; h = rotr32(h, 19); h = h *% 5 +% 0xe6546b64; g ^= b4; g = @byteSwap(u32, g) *% 5; h +%= b4 *% 5; h = @byteSwap(u32, h); f +%= b0; const t: u32 = h; h = f; f = g; g = t; ptr += 20; } g = rotr32(g, 11) *% c1; g = rotr32(g, 17) *% c1; f = rotr32(f, 11) *% c1; f = rotr32(f, 17) *% c1; h = rotr32(h +% g, 19); h = h *% 5 +% 0xe6546b64; h = rotr32(h, 17) *% c1; h = rotr32(h +% f, 19); h = h *% 5 +% 0xe6546b64; h = rotr32(h, 17) *% c1; return h; } }; pub const CityHash64 = struct { const Self = @This(); // Some primes between 2^63 and 2^64 for various uses. const k0: u64 = 0xc3a5c85c97cb3127; const k1: u64 = 0xb492b66fbe98f273; const k2: u64 = 0x9ae16a3b2f90404f; fn fetch32(ptr: [*]const u8) u32 { var v: u32 = undefined; @memcpy(@ptrCast([*]u8, &v), ptr, 4); if (builtin.endian == builtin.Endian.Big) return @byteSwap(u32, v); return v; } fn fetch64(ptr: [*]const u8) u64 { var v: u64 = undefined; @memcpy(@ptrCast([*]u8, &v), ptr, 8); if (builtin.endian == builtin.Endian.Big) return @byteSwap(u64, v); return v; } // Rotate right helper fn rotr64(x: u64, comptime r: u64) u64 { return (x >> r) | (x << (64 - r)); } fn shiftmix(v: u64) u64 { return v ^ (v >> 47); } fn hashLen16(u: u64, v: u64) u64 { return @inlineCall(hash128To64, u, v); } fn hashLen16Mul(low: u64, high: u64, mul: u64) u64 { var a: u64 = (low ^ high) *% mul; a ^= (a >> 47); var b: u64 = (high ^ a) *% mul; b ^= (b >> 47); b *%= mul; return b; } fn hash128To64(low: u64, high: u64) u64 { return @inlineCall(hashLen16Mul, low, high, 0x9ddfea08eb382d69); } fn hashLen0To16(str: []const u8) u64 { const len: u64 = @as(u64, str.len); if (len >= 8) { const mul: u64 = k2 +% len *% 2; const a: u64 = fetch64(str.ptr) +% k2; const b: u64 = fetch64(str.ptr + str.len - 8); const c: u64 = rotr64(b, 37) *% mul +% a; const d: u64 = (rotr64(a, 25) +% b) *% mul; return hashLen16Mul(c, d, mul); } if (len >= 4) { const mul: u64 = k2 +% len *% 2; const a: u64 = fetch32(str.ptr); return hashLen16Mul(len +% (a << 3), fetch32(str.ptr + str.len - 4), mul); } if (len > 0) { const a: u8 = str[0]; const b: u8 = str[str.len >> 1]; const c: u8 = str[str.len - 1]; const y: u32 = @intCast(u32, a) +% (@intCast(u32, b) << 8); const z: u32 = @truncate(u32, str.len) +% (@intCast(u32, c) << 2); return shiftmix(@intCast(u64, y) *% k2 ^ @intCast(u64, z) *% k0) *% k2; } return k2; } fn hashLen17To32(str: []const u8) u64 { const len: u64 = @as(u64, str.len); const mul: u64 = k2 +% len *% 2; const a: u64 = fetch64(str.ptr) *% k1; const b: u64 = fetch64(str.ptr + 8); const c: u64 = fetch64(str.ptr + str.len - 8) *% mul; const d: u64 = fetch64(str.ptr + str.len - 16) *% k2; return hashLen16Mul(rotr64(a +% b, 43) +% rotr64(c, 30) +% d, a +% rotr64(b +% k2, 18) +% c, mul); } fn hashLen33To64(str: []const u8) u64 { const len: u64 = @as(u64, str.len); const mul: u64 = k2 +% len *% 2; const a: u64 = fetch64(str.ptr) *% k2; const b: u64 = fetch64(str.ptr + 8); const c: u64 = fetch64(str.ptr + str.len - 24); const d: u64 = fetch64(str.ptr + str.len - 32); const e: u64 = fetch64(str.ptr + 16) *% k2; const f: u64 = fetch64(str.ptr + 24) *% 9; const g: u64 = fetch64(str.ptr + str.len - 8); const h: u64 = fetch64(str.ptr + str.len - 16) *% mul; const u: u64 = rotr64(a +% g, 43) +% (rotr64(b, 30) +% c) *% 9; const v: u64 = ((a +% g) ^ d) +% f +% 1; const w: u64 = @byteSwap(u64, (u +% v) *% mul) +% h; const x: u64 = rotr64(e +% f, 42) +% c; const y: u64 = (@byteSwap(u64, (v +% w) *% mul) +% g) *% mul; const z: u64 = e +% f +% c; const a1: u64 = @byteSwap(u64, (x +% z) *% mul +% y) +% b; const b1: u64 = shiftmix((z +% a1) *% mul +% d +% h) *% mul; return b1 +% x; } const WeakPair = struct { first: u64, second: u64, }; fn weakHashLen32WithSeedsHelper(w: u64, x: u64, y: u64, z: u64, a: u64, b: u64) WeakPair { var a1: u64 = a; var b1: u64 = b; a1 +%= w; b1 = rotr64(b1 +% a1 +% z, 21); var c: u64 = a1; a1 +%= x; a1 +%= y; b1 +%= rotr64(a1, 44); return WeakPair{ .first = a1 +% z, .second = b1 +% c }; } fn weakHashLen32WithSeeds(ptr: [*]const u8, a: u64, b: u64) WeakPair { return @inlineCall(weakHashLen32WithSeedsHelper, fetch64(ptr), fetch64(ptr + 8), fetch64(ptr + 16), fetch64(ptr + 24), a, b); } pub fn hash(str: []const u8) u64 { if (str.len <= 32) { if (str.len <= 16) { return hashLen0To16(str); } else { return hashLen17To32(str); } } else if (str.len <= 64) { return hashLen33To64(str); } var len: u64 = @as(u64, str.len); var x: u64 = fetch64(str.ptr + str.len - 40); var y: u64 = fetch64(str.ptr + str.len - 16) +% fetch64(str.ptr + str.len - 56); var z: u64 = hashLen16(fetch64(str.ptr + str.len - 48) +% len, fetch64(str.ptr + str.len - 24)); var v: WeakPair = weakHashLen32WithSeeds(str.ptr + str.len - 64, len, z); var w: WeakPair = weakHashLen32WithSeeds(str.ptr + str.len - 32, y +% k1, x); x = x *% k1 +% fetch64(str.ptr); len = (len - 1) & ~@intCast(u64, 63); var ptr: [*]const u8 = str.ptr; while (true) { x = rotr64(x +% y +% v.first +% fetch64(ptr + 8), 37) *% k1; y = rotr64(y +% v.second +% fetch64(ptr + 48), 42) *% k1; x ^= w.second; y +%= v.first +% fetch64(ptr + 40); z = rotr64(z +% w.first, 33) *% k1; v = weakHashLen32WithSeeds(ptr, v.second *% k1, x +% w.first); w = weakHashLen32WithSeeds(ptr + 32, z +% w.second, y +% fetch64(ptr + 16)); const t: u64 = z; z = x; x = t; ptr += 64; len -= 64; if (len == 0) break; } return hashLen16(hashLen16(v.first, w.first) +% shiftmix(y) *% k1 +% z, hashLen16(v.second, w.second) +% x); } pub fn hashWithSeed(str: []const u8, seed: u64) u64 { return @inlineCall(Self.hashWithSeeds, str, k2, seed); } pub fn hashWithSeeds(str: []const u8, seed0: u64, seed1: u64) u64 { return hashLen16(hash(str) -% seed0, seed1); } }; fn SMHasherTest(comptime hash_fn: var, comptime hashbits: u32) u32 { const hashbytes = hashbits / 8; var key: [256]u8 = undefined; var hashes: [hashbytes * 256]u8 = undefined; var final: [hashbytes]u8 = undefined; @memset(@ptrCast([*]u8, &key[0]), 0, @sizeOf(@typeOf(key))); @memset(@ptrCast([*]u8, &hashes[0]), 0, @sizeOf(@typeOf(hashes))); @memset(@ptrCast([*]u8, &final[0]), 0, @sizeOf(@typeOf(final))); var i: u32 = 0; while (i < 256) : (i += 1) { key[i] = @intCast(u8, i); var h = hash_fn(key[0..i], 256 - i); if (builtin.endian == builtin.Endian.Big) h = @byteSwap(@typeOf(h), h); @memcpy(@ptrCast([*]u8, &hashes[i * hashbytes]), @ptrCast([*]u8, &h), hashbytes); } return @truncate(u32, hash_fn(hashes, 0)); } fn CityHash32hashIgnoreSeed(str: []const u8, seed: u32) u32 { return CityHash32.hash(str); } test "cityhash32" { // Note: SMHasher doesn't provide a 32bit version of the algorithm. // Note: The implementation was verified against the Google Abseil version. std.testing.expectEqual(SMHasherTest(CityHash32hashIgnoreSeed, 32), 0x68254F81); } test "cityhash64" { // Note: This is not compliant with the SMHasher implementation of CityHash64! // Note: The implementation was verified against the Google Abseil version. std.testing.expectEqual(SMHasherTest(CityHash64.hashWithSeed, 64), 0x5FABC5C5); }
lib/std/hash/cityhash.zig
// // AUTO GENERATED! DO NOT EDIT! // const std = @import("std"); pub const StateFlags = enum(c_ulong) { /// Enable R write. WriteR = 0x0000000000000001, /// Enable G write. WriteG = 0x0000000000000002, /// Enable B write. WriteB = 0x0000000000000004, /// Enable alpha write. WriteA = 0x0000000000000008, /// Enable depth write. WriteZ = 0x0000004000000000, /// Enable RGB write. WriteRgb = 0x0000000000000007, /// Write all channels mask. WriteMask = 0x000000400000000f, /// Enable depth test, less. DepthTestLess = 0x0000000000000010, /// Enable depth test, less or equal. DepthTestLequal = 0x0000000000000020, /// Enable depth test, equal. DepthTestEqual = 0x0000000000000030, /// Enable depth test, greater or equal. DepthTestGequal = 0x0000000000000040, /// Enable depth test, greater. DepthTestGreater = 0x0000000000000050, /// Enable depth test, not equal. DepthTestNotequal = 0x0000000000000060, /// Enable depth test, never. DepthTestNever = 0x0000000000000070, /// Enable depth test, always. DepthTestAlways = 0x0000000000000080, DepthTestShift = 4, DepthTestMask = 0x00000000000000f0, /// 0, 0, 0, 0 BlendZero = 0x0000000000001000, /// 1, 1, 1, 1 BlendOne = 0x0000000000002000, /// Rs, Gs, Bs, As BlendSrcColor = 0x0000000000003000, /// 1-Rs, 1-Gs, 1-Bs, 1-As BlendInvSrcColor = 0x0000000000004000, /// As, As, As, As BlendSrcAlpha = 0x0000000000005000, /// 1-As, 1-As, 1-As, 1-As BlendInvSrcAlpha = 0x0000000000006000, /// Ad, Ad, Ad, Ad BlendDstAlpha = 0x0000000000007000, /// 1-Ad, 1-Ad, 1-Ad ,1-Ad BlendInvDstAlpha = 0x0000000000008000, /// Rd, Gd, Bd, Ad BlendDstColor = 0x0000000000009000, /// 1-Rd, 1-Gd, 1-Bd, 1-Ad BlendInvDstColor = 0x000000000000a000, /// f, f, f, 1; f = min(As, 1-Ad) BlendSrcAlphaSat = 0x000000000000b000, /// Blend factor BlendFactor = 0x000000000000c000, /// 1-Blend factor BlendInvFactor = 0x000000000000d000, BlendShift = 12, BlendMask = 0x000000000ffff000, /// Blend add: src + dst. BlendEquationAdd = 0x0000000000000000, /// Blend subtract: src - dst. BlendEquationSub = 0x0000000010000000, /// Blend reverse subtract: dst - src. BlendEquationRevsub = 0x0000000020000000, /// Blend min: min(src, dst). BlendEquationMin = 0x0000000030000000, /// Blend max: max(src, dst). BlendEquationMax = 0x0000000040000000, BlendEquationShift = 28, BlendEquationMask = 0x00000003f0000000, /// Cull clockwise triangles. CullCw = 0x0000001000000000, /// Cull counter-clockwise triangles. CullCcw = 0x0000002000000000, CullShift = 36, CullMask = 0x0000003000000000, AlphaRefShift = 40, AlphaRefMask = 0x0000ff0000000000, /// Tristrip. PtTristrip = 0x0001000000000000, /// Lines. PtLines = 0x0002000000000000, /// Line strip. PtLinestrip = 0x0003000000000000, /// Points. PtPoints = 0x0004000000000000, PtShift = 48, PtMask = 0x0007000000000000, PointSizeShift = 52, PointSizeMask = 0x00f0000000000000, /// Enable MSAA rasterization. Msaa = 0x0100000000000000, /// Enable line AA rasterization. Lineaa = 0x0200000000000000, /// Enable conservative rasterization. ConservativeRaster = 0x0400000000000000, /// No state. None = 0x0000000000000000, /// Front counter-clockwise (default is clockwise). FrontCcw = 0x0000008000000000, /// Enable blend independent. BlendIndependent = 0x0000000400000000, /// Enable alpha to coverage. BlendAlphaToCoverage = 0x0000000800000000, /// Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise /// culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored). Default = 0x010000500000001f, Mask = 0xffffffffffffffff, ReservedShift = 61, ReservedMask = 0xe000000000000000, }; pub const StencilFlags = enum(c_uint) { FuncRefShift = 0, FuncRefMask = 0x000000ff, FuncRmaskShift = 8, FuncRmaskMask = 0x0000ff00, None = 0x00000000, Mask = 0xffffffff, Default = 0x00000000, /// Enable stencil test, less. TestLess = 0x00010000, /// Enable stencil test, less or equal. TestLequal = 0x00020000, /// Enable stencil test, equal. TestEqual = 0x00030000, /// Enable stencil test, greater or equal. TestGequal = 0x00040000, /// Enable stencil test, greater. TestGreater = 0x00050000, /// Enable stencil test, not equal. TestNotequal = 0x00060000, /// Enable stencil test, never. TestNever = 0x00070000, /// Enable stencil test, always. TestAlways = 0x00080000, TestShift = 16, TestMask = 0x000f0000, /// Zero. OpFailSZero = 0x00000000, /// Keep. OpFailSKeep = 0x00100000, /// Replace. OpFailSReplace = 0x00200000, /// Increment and wrap. OpFailSIncr = 0x00300000, /// Increment and clamp. OpFailSIncrsat = 0x00400000, /// Decrement and wrap. OpFailSDecr = 0x00500000, /// Decrement and clamp. OpFailSDecrsat = 0x00600000, /// Invert. OpFailSInvert = 0x00700000, OpFailSShift = 20, OpFailSMask = 0x00f00000, /// Zero. OpFailZZero = 0x00000000, /// Keep. OpFailZKeep = 0x01000000, /// Replace. OpFailZReplace = 0x02000000, /// Increment and wrap. OpFailZIncr = 0x03000000, /// Increment and clamp. OpFailZIncrsat = 0x04000000, /// Decrement and wrap. OpFailZDecr = 0x05000000, /// Decrement and clamp. OpFailZDecrsat = 0x06000000, /// Invert. OpFailZInvert = 0x07000000, OpFailZShift = 24, OpFailZMask = 0x0f000000, /// Zero. OpPassZZero = 0x00000000, /// Keep. OpPassZKeep = 0x10000000, /// Replace. OpPassZReplace = 0x20000000, /// Increment and wrap. OpPassZIncr = 0x30000000, /// Increment and clamp. OpPassZIncrsat = 0x40000000, /// Decrement and wrap. OpPassZDecr = 0x50000000, /// Decrement and clamp. OpPassZDecrsat = 0x60000000, /// Invert. OpPassZInvert = 0x70000000, OpPassZShift = 28, OpPassZMask = 0xf0000000, }; pub const ClearFlags = enum(c_ushort) { /// No clear flags. None = 0x0000, /// Clear color. Color = 0x0001, /// Clear depth. Depth = 0x0002, /// Clear stencil. Stencil = 0x0004, /// Discard frame buffer attachment 0. DiscardColor0 = 0x0008, /// Discard frame buffer attachment 1. DiscardColor1 = 0x0010, /// Discard frame buffer attachment 2. DiscardColor2 = 0x0020, /// Discard frame buffer attachment 3. DiscardColor3 = 0x0040, /// Discard frame buffer attachment 4. DiscardColor4 = 0x0080, /// Discard frame buffer attachment 5. DiscardColor5 = 0x0100, /// Discard frame buffer attachment 6. DiscardColor6 = 0x0200, /// Discard frame buffer attachment 7. DiscardColor7 = 0x0400, /// Discard frame buffer depth attachment. DiscardDepth = 0x0800, /// Discard frame buffer stencil attachment. DiscardStencil = 0x1000, DiscardColorMask = 0x07f8, DiscardMask = 0x1ff8, }; pub const DiscardFlags = enum(c_uint) { /// Preserve everything. None = 0x00000000, /// Discard texture sampler and buffer bindings. Bindings = 0x00000001, /// Discard index buffer. IndexBuffer = 0x00000002, /// Discard instance data. InstanceData = 0x00000004, /// Discard state and uniform bindings. State = 0x00000008, /// Discard transform. Transform = 0x00000010, /// Discard vertex streams. VertexStreams = 0x00000020, /// Discard all states. All = 0x000000ff, }; pub const DebugFlags = enum(c_uint) { /// No debug. None = 0x00000000, /// Enable wireframe for all primitives. Wireframe = 0x00000001, /// Enable infinitely fast hardware test. No draw calls will be submitted to driver. /// It's useful when profiling to quickly assess bottleneck between CPU and GPU. Ifh = 0x00000002, /// Enable statistics display. Stats = 0x00000004, /// Enable debug text display. Text = 0x00000008, /// Enable profiler. This causes per-view statistics to be collected, available through `bgfx::Stats::ViewStats`. This is unrelated to the profiler functions in `bgfx::CallbackI`. Profiler = 0x00000010, }; pub const BufferFlags = enum(c_ushort) { /// 1 8-bit value ComputeFormat8x1 = 0x0001, /// 2 8-bit values ComputeFormat8x2 = 0x0002, /// 4 8-bit values ComputeFormat8x4 = 0x0003, /// 1 16-bit value ComputeFormat16x1 = 0x0004, /// 2 16-bit values ComputeFormat16x2 = 0x0005, /// 4 16-bit values ComputeFormat16x4 = 0x0006, /// 1 32-bit value ComputeFormat32x1 = 0x0007, /// 2 32-bit values ComputeFormat32x2 = 0x0008, /// 4 32-bit values ComputeFormat32x4 = 0x0009, ComputeFormatShift = 0, ComputeFormatMask = 0x000f, /// Type `int`. ComputeTypeInt = 0x0010, /// Type `uint`. ComputeTypeUint = 0x0020, /// Type `float`. ComputeTypeFloat = 0x0030, ComputeTypeShift = 4, ComputeTypeMask = 0x0030, None = 0x0000, /// Buffer will be read by shader. ComputeRead = 0x0100, /// Buffer will be used for writing. ComputeWrite = 0x0200, /// Buffer will be used for storing draw indirect commands. DrawIndirect = 0x0400, /// Allow dynamic index/vertex buffer resize during update. AllowResize = 0x0800, /// Index buffer contains 32-bit indices. Index32 = 0x1000, ComputeReadWrite = 0x0300, }; pub const TextureFlags = enum(c_ulong) { None = 0x0000000000000000, /// Texture will be used for MSAA sampling. MsaaSample = 0x0000000800000000, /// Render target no MSAA. Rt = 0x0000001000000000, /// Texture will be used for compute write. ComputeWrite = 0x0000100000000000, /// Sample texture as sRGB. Srgb = 0x0000200000000000, /// Texture will be used as blit destination. BlitDst = 0x0000400000000000, /// Texture will be used for read back from GPU. ReadBack = 0x0000800000000000, /// Render target MSAAx2 mode. RtMsaaX2 = 0x0000002000000000, /// Render target MSAAx4 mode. RtMsaaX4 = 0x0000003000000000, /// Render target MSAAx8 mode. RtMsaaX8 = 0x0000004000000000, /// Render target MSAAx16 mode. RtMsaaX16 = 0x0000005000000000, RtMsaaShift = 36, RtMsaaMask = 0x0000007000000000, /// Render target will be used for writing RtWriteOnly = 0x0000008000000000, RtShift = 36, RtMask = 0x000000f000000000, }; pub const SamplerFlags = enum(c_uint) { /// Wrap U mode: Mirror UMirror = 0x00000001, /// Wrap U mode: Clamp UClamp = 0x00000002, /// Wrap U mode: Border UBorder = 0x00000003, UShift = 0, UMask = 0x00000003, /// Wrap V mode: Mirror VMirror = 0x00000004, /// Wrap V mode: Clamp VClamp = 0x00000008, /// Wrap V mode: Border VBorder = 0x0000000c, VShift = 2, VMask = 0x0000000c, /// Wrap W mode: Mirror WMirror = 0x00000010, /// Wrap W mode: Clamp WClamp = 0x00000020, /// Wrap W mode: Border WBorder = 0x00000030, WShift = 4, WMask = 0x00000030, /// Min sampling mode: Point MinPoint = 0x00000040, /// Min sampling mode: Anisotropic MinAnisotropic = 0x00000080, MinShift = 6, MinMask = 0x000000c0, /// Mag sampling mode: Point MagPoint = 0x00000100, /// Mag sampling mode: Anisotropic MagAnisotropic = 0x00000200, MagShift = 8, MagMask = 0x00000300, /// Mip sampling mode: Point MipPoint = 0x00000400, MipShift = 10, MipMask = 0x00000400, /// Compare when sampling depth texture: less. CompareLess = 0x00010000, /// Compare when sampling depth texture: less or equal. CompareLequal = 0x00020000, /// Compare when sampling depth texture: equal. CompareEqual = 0x00030000, /// Compare when sampling depth texture: greater or equal. CompareGequal = 0x00040000, /// Compare when sampling depth texture: greater. CompareGreater = 0x00050000, /// Compare when sampling depth texture: not equal. CompareNotequal = 0x00060000, /// Compare when sampling depth texture: never. CompareNever = 0x00070000, /// Compare when sampling depth texture: always. CompareAlways = 0x00080000, CompareShift = 16, CompareMask = 0x000f0000, BorderColorShift = 24, BorderColorMask = 0x0f000000, ReservedShift = 28, ReservedMask = 0xf0000000, None = 0x00000000, /// Sample stencil instead of depth. SampleStencil = 0x00100000, Point = 0x00000540, UvwMirror = 0x00000015, UvwClamp = 0x0000002a, UvwBorder = 0x0000003f, BitsMask = 0x000f07ff, }; pub const ResetFlags = enum(c_uint) { /// Enable 2x MSAA. MsaaX2 = 0x00000010, /// Enable 4x MSAA. MsaaX4 = 0x00000020, /// Enable 8x MSAA. MsaaX8 = 0x00000030, /// Enable 16x MSAA. MsaaX16 = 0x00000040, MsaaShift = 4, MsaaMask = 0x00000070, /// No reset flags. None = 0x00000000, /// Not supported yet. Fullscreen = 0x00000001, /// Enable V-Sync. Vsync = 0x00000080, /// Turn on/off max anisotropy. Maxanisotropy = 0x00000100, /// Begin screen capture. Capture = 0x00000200, /// Flush rendering after submitting to GPU. FlushAfterRender = 0x00002000, /// This flag specifies where flip occurs. Default behaviour is that flip occurs /// before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. FlipAfterRender = 0x00004000, /// Enable sRGB backbuffer. SrgbBackbuffer = 0x00008000, /// Enable HDR10 rendering. Hdr10 = 0x00010000, /// Enable HiDPI rendering. Hidpi = 0x00020000, /// Enable depth clamp. DepthClamp = 0x00040000, /// Suspend rendering. Suspend = 0x00080000, FullscreenShift = 0, FullscreenMask = 0x00000001, ReservedShift = 31, ReservedMask = 0x80000000, }; pub const CapsFlags = enum(c_ulong) { /// Alpha to coverage is supported. AlphaToCoverage = 0x0000000000000001, /// Blend independent is supported. BlendIndependent = 0x0000000000000002, /// Compute shaders are supported. Compute = 0x0000000000000004, /// Conservative rasterization is supported. ConservativeRaster = 0x0000000000000008, /// Draw indirect is supported. DrawIndirect = 0x0000000000000010, /// Fragment depth is available in fragment shader. FragmentDepth = 0x0000000000000020, /// Fragment ordering is available in fragment shader. FragmentOrdering = 0x0000000000000040, /// Graphics debugger is present. GraphicsDebugger = 0x0000000000000080, /// HDR10 rendering is supported. Hdr10 = 0x0000000000000100, /// HiDPI rendering is supported. Hidpi = 0x0000000000000200, /// Image Read/Write is supported. ImageRw = 0x0000000000000400, /// 32-bit indices are supported. Index32 = 0x0000000000000800, /// Instancing is supported. Instancing = 0x0000000000001000, /// Occlusion query is supported. OcclusionQuery = 0x0000000000002000, /// Renderer is on separate thread. RendererMultithreaded = 0x0000000000004000, /// Multiple windows are supported. SwapChain = 0x0000000000008000, /// 2D texture array is supported. Texture2dArray = 0x0000000000010000, /// 3D textures are supported. Texture3d = 0x0000000000020000, /// Texture blit is supported. TextureBlit = 0x0000000000040000, TextureCompareReserved = 0x0000000000080000, /// Texture compare less equal mode is supported. TextureCompareLequal = 0x0000000000100000, /// Cubemap texture array is supported. TextureCubeArray = 0x0000000000200000, /// CPU direct access to GPU texture memory. TextureDirectAccess = 0x0000000000400000, /// Read-back texture is supported. TextureReadBack = 0x0000000000800000, /// Vertex attribute half-float is supported. VertexAttribHalf = 0x0000000001000000, /// Vertex attribute 10_10_10_2 is supported. VertexAttribUint10 = 0x0000000002000000, /// Rendering with VertexID only is supported. VertexId = 0x0000000004000000, /// Viewport layer is available in vertex shader. ViewportLayerArray = 0x0000000008000000, /// All texture compare modes are supported. TextureCompareAll = 0x0000000000180000, }; pub const CapsFormatFlags = enum(c_uint) { /// Texture format is not supported. TextureNone = 0x00000000, /// Texture format is supported. Texture2d = 0x00000001, /// Texture as sRGB format is supported. Texture2dSrgb = 0x00000002, /// Texture format is emulated. Texture2dEmulated = 0x00000004, /// Texture format is supported. Texture3d = 0x00000008, /// Texture as sRGB format is supported. Texture3dSrgb = 0x00000010, /// Texture format is emulated. Texture3dEmulated = 0x00000020, /// Texture format is supported. TextureCube = 0x00000040, /// Texture as sRGB format is supported. TextureCubeSrgb = 0x00000080, /// Texture format is emulated. TextureCubeEmulated = 0x00000100, /// Texture format can be used from vertex shader. TextureVertex = 0x00000200, /// Texture format can be used as image and read from. TextureImageRead = 0x00000400, /// Texture format can be used as image and written to. TextureImageWrite = 0x00000800, /// Texture format can be used as frame buffer. TextureFramebuffer = 0x00001000, /// Texture format can be used as MSAA frame buffer. TextureFramebufferMsaa = 0x00002000, /// Texture can be sampled as MSAA. TextureMsaa = 0x00004000, /// Texture format supports auto-generated mips. TextureMipAutogen = 0x00008000, }; pub const ResolveFlags = enum(c_uint) { /// No resolve flags. None = 0x00000000, /// Auto-generate mip maps on resolve. AutoGenMips = 0x00000001, }; pub const PciIdFlags = enum(c_ushort) { /// Autoselect adapter. None = 0x0000, /// Software rasterizer. SoftwareRasterizer = 0x0001, /// AMD adapter. Amd = 0x1002, /// Apple adapter. Apple = 0x106b, /// Intel adapter. Intel = 0x8086, /// nVidia adapter. Nvidia = 0x10de, /// Microsoft adapter. Microsoft = 0x1414, }; pub const CubeMapFlags = enum(c_uint) { /// Cubemap +x. PositiveX = 0x00000000, /// Cubemap -x. NegativeX = 0x00000001, /// Cubemap +y. PositiveY = 0x00000002, /// Cubemap -y. NegativeY = 0x00000003, /// Cubemap +z. PositiveZ = 0x00000004, /// Cubemap -z. NegativeZ = 0x00000005, }; pub const Fatal = enum(c_int) { DebugCheck, InvalidShader, UnableToInitialize, UnableToCreateTexture, DeviceLost, Count }; pub const RendererType = enum(c_int) { /// No rendering. Noop, /// AGC Agc, /// Direct3D 9.0 Direct3D9, /// Direct3D 11.0 Direct3D11, /// Direct3D 12.0 Direct3D12, /// GNM Gnm, /// Metal Metal, /// NVN Nvn, /// OpenGL ES 2.0+ OpenGLES, /// OpenGL 2.1+ OpenGL, /// Vulkan Vulkan, /// WebGPU WebGPU, Count }; pub const Access = enum(c_int) { /// Read. Read, /// Write. Write, /// Read and write. ReadWrite, Count }; pub const Attrib = enum(c_int) { /// a_position Position, /// a_normal Normal, /// a_tangent Tangent, /// a_bitangent Bitangent, /// a_color0 Color0, /// a_color1 Color1, /// a_color2 Color2, /// a_color3 Color3, /// a_indices Indices, /// a_weight Weight, /// a_texcoord0 TexCoord0, /// a_texcoord1 TexCoord1, /// a_texcoord2 TexCoord2, /// a_texcoord3 TexCoord3, /// a_texcoord4 TexCoord4, /// a_texcoord5 TexCoord5, /// a_texcoord6 TexCoord6, /// a_texcoord7 TexCoord7, Count }; pub const AttribType = enum(c_int) { /// Uint8 Uint8, /// Uint10, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_UINT10`. Uint10, /// Int16 Int16, /// Half, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_HALF`. Half, /// Float Float, Count }; pub const TextureFormat = enum(c_int) { /// DXT1 R5G6B5A1 BC1, /// DXT3 R5G6B5A4 BC2, /// DXT5 R5G6B5A8 BC3, /// LATC1/ATI1 R8 BC4, /// LATC2/ATI2 RG8 BC5, /// BC6H RGB16F BC6H, /// BC7 RGB 4-7 bits per color channel, 0-8 bits alpha BC7, /// ETC1 RGB8 ETC1, /// ETC2 RGB8 ETC2, /// ETC2 RGBA8 ETC2A, /// ETC2 RGB8A1 ETC2A1, /// PVRTC1 RGB 2BPP PTC12, /// PVRTC1 RGB 4BPP PTC14, /// PVRTC1 RGBA 2BPP PTC12A, /// PVRTC1 RGBA 4BPP PTC14A, /// PVRTC2 RGBA 2BPP PTC22, /// PVRTC2 RGBA 4BPP PTC24, /// ATC RGB 4BPP ATC, /// ATCE RGBA 8 BPP explicit alpha ATCE, /// ATCI RGBA 8 BPP interpolated alpha ATCI, /// ASTC 4x4 8.0 BPP ASTC4x4, /// ASTC 5x5 5.12 BPP ASTC5x5, /// ASTC 6x6 3.56 BPP ASTC6x6, /// ASTC 8x5 3.20 BPP ASTC8x5, /// ASTC 8x6 2.67 BPP ASTC8x6, /// ASTC 10x5 2.56 BPP ASTC10x5, /// Compressed formats above. Unknown, R1, A8, R8, R8I, R8U, R8S, R16, R16I, R16U, R16F, R16S, R32I, R32U, R32F, RG8, RG8I, RG8U, RG8S, RG16, RG16I, RG16U, RG16F, RG16S, RG32I, RG32U, RG32F, RGB8, RGB8I, RGB8U, RGB8S, RGB9E5F, BGRA8, RGBA8, RGBA8I, RGBA8U, RGBA8S, RGBA16, RGBA16I, RGBA16U, RGBA16F, RGBA16S, RGBA32I, RGBA32U, RGBA32F, R5G6B5, RGBA4, RGB5A1, RGB10A2, RG11B10F, /// Depth formats below. UnknownDepth, D16, D24, D24S8, D32, D16F, D24F, D32F, D0S8, Count }; pub const UniformType = enum(c_int) { /// Sampler. Sampler, /// Reserved, do not use. End, /// 4 floats vector. Vec4, /// 3x3 matrix. Mat3, /// 4x4 matrix. Mat4, Count }; pub const BackbufferRatio = enum(c_int) { /// Equal to backbuffer. Equal, /// One half size of backbuffer. Half, /// One quarter size of backbuffer. Quarter, /// One eighth size of backbuffer. Eighth, /// One sixteenth size of backbuffer. Sixteenth, /// Double size of backbuffer. Double, Count }; pub const OcclusionQueryResult = enum(c_int) { /// Query failed test. Invisible, /// Query passed test. Visible, /// Query result is not available yet. NoResult, Count }; pub const Topology = enum(c_int) { /// Triangle list. TriList, /// Triangle strip. TriStrip, /// Line list. LineList, /// Line strip. LineStrip, /// Point list. PointList, Count }; pub const TopologyConvert = enum(c_int) { /// Flip winding order of triangle list. TriListFlipWinding, /// Flip winding order of triangle strip. TriStripFlipWinding, /// Convert triangle list to line list. TriListToLineList, /// Convert triangle strip to triangle list. TriStripToTriList, /// Convert line strip to line list. LineStripToLineList, Count }; pub const TopologySort = enum(c_int) { DirectionFrontToBackMin, DirectionFrontToBackAvg, DirectionFrontToBackMax, DirectionBackToFrontMin, DirectionBackToFrontAvg, DirectionBackToFrontMax, DistanceFrontToBackMin, DistanceFrontToBackAvg, DistanceFrontToBackMax, DistanceBackToFrontMin, DistanceBackToFrontAvg, DistanceBackToFrontMax, Count }; pub const ViewMode = enum(c_int) { /// Default sort order. Default, /// Sort in the same order in which submit calls were called. Sequential, /// Sort draw call depth in ascending order. DepthAscending, /// Sort draw call depth in descending order. DepthDescending, Count }; pub const RenderFrame = enum(c_int) { /// Renderer context is not created yet. NoContext, /// Renderer context is created and rendering. Render, /// Renderer context wait for main thread signal timed out without rendering. Timeout, /// Renderer context is getting destroyed. Exiting, Count }; pub const Caps = extern struct { pub const GPU = extern struct { vendorId: u16, deviceId: u16, }; pub const Limits = extern struct { maxDrawCalls: u32, maxBlits: u32, maxTextureSize: u32, maxTextureLayers: u32, maxViews: u32, maxFrameBuffers: u32, maxFBAttachments: u32, maxPrograms: u32, maxShaders: u32, maxTextures: u32, maxTextureSamplers: u32, maxComputeBindings: u32, maxVertexLayouts: u32, maxVertexStreams: u32, maxIndexBuffers: u32, maxVertexBuffers: u32, maxDynamicIndexBuffers: u32, maxDynamicVertexBuffers: u32, maxUniforms: u32, maxOcclusionQueries: u32, maxEncoders: u32, minResourceCbSize: u32, transientVbSize: u32, transientIbSize: u32, }; rendererType: RendererType, supported: u64, vendorId: u16, deviceId: u16, homogeneousDepth: bool, originBottomLeft: bool, numGPUs: u8, gpu: [4]GPU, limits: Limits, formats: [85]u16, }; pub const InternalData = extern struct { caps: [*c]Caps, context: ?*anyopaque, }; pub const PlatformData = extern struct { ndt: ?*anyopaque, nwh: ?*anyopaque, context: ?*anyopaque, backBuffer: ?*anyopaque, backBufferDS: ?*anyopaque, }; pub const Resolution = extern struct { format: TextureFormat, width: u32, height: u32, reset: u32, numBackBuffers: u8, maxFrameLatency: u8, }; pub const Init = extern struct { pub const Limits = extern struct { maxEncoders: u16, minResourceCbSize: u32, transientVbSize: u32, transientIbSize: u32, }; type: RendererType, vendorId: u16, deviceId: u16, capabilities: u64, debug: bool, profile: bool, platformData: PlatformData, resolution: Resolution, limits: Limits, callback: ?*anyopaque, allocator: ?*anyopaque, }; pub const Memory = extern struct { data: [*c]u8, size: u32, }; pub const TransientIndexBuffer = extern struct { data: [*c]u8, size: u32, startIndex: u32, handle: IndexBufferHandle, isIndex16: bool, }; pub const TransientVertexBuffer = extern struct { data: [*c]u8, size: u32, startVertex: u32, stride: u16, handle: VertexBufferHandle, layoutHandle: VertexLayoutHandle, }; pub const InstanceDataBuffer = extern struct { data: [*c]u8, size: u32, offset: u32, num: u32, stride: u16, handle: VertexBufferHandle, }; pub const TextureInfo = extern struct { format: TextureFormat, storageSize: u32, width: u16, height: u16, depth: u16, numLayers: u16, numMips: u8, bitsPerPixel: u8, cubeMap: bool, }; pub const UniformInfo = extern struct { name: [256]u8, type: UniformType, num: u16, }; pub const Attachment = extern struct { access: Access, handle: TextureHandle, mip: u16, layer: u16, numLayers: u16, resolve: u8, }; pub const Transform = extern struct { data: [*c]f32, num: u16, }; pub const ViewStats = extern struct { name: [256]u8, view: u16, cpuTimeBegin: i64, cpuTimeEnd: i64, gpuTimeBegin: i64, gpuTimeEnd: i64, }; pub const EncoderStats = extern struct { cpuTimeBegin: i64, cpuTimeEnd: i64, }; pub const Stats = extern struct { cpuTimeFrame: i64, cpuTimeBegin: i64, cpuTimeEnd: i64, cpuTimerFreq: i64, gpuTimeBegin: i64, gpuTimeEnd: i64, gpuTimerFreq: i64, waitRender: i64, waitSubmit: i64, numDraw: u32, numCompute: u32, numBlit: u32, maxGpuLatency: u32, numDynamicIndexBuffers: u16, numDynamicVertexBuffers: u16, numFrameBuffers: u16, numIndexBuffers: u16, numOcclusionQueries: u16, numPrograms: u16, numShaders: u16, numTextures: u16, numUniforms: u16, numVertexBuffers: u16, numVertexLayouts: u16, textureMemoryUsed: i64, rtMemoryUsed: i64, transientVbUsed: i32, transientIbUsed: i32, numPrims: [5]u32, gpuMemoryMax: i64, gpuMemoryUsed: i64, width: u16, height: u16, textWidth: u16, textHeight: u16, numViews: u16, viewStats: [*c]ViewStats, numEncoders: u8, encoderStats: [*c]EncoderStats, }; pub const VertexLayout = extern struct { hash: u32, stride: u16, offset: [18]u16, attributes: [18]u16, }; pub const Encoder = extern struct { }; pub const DynamicIndexBufferHandle = extern struct { idx: c_ushort, }; pub const DynamicVertexBufferHandle = extern struct { idx: c_ushort, }; pub const FrameBufferHandle = extern struct { idx: c_ushort, }; pub const IndexBufferHandle = extern struct { idx: c_ushort, }; pub const IndirectBufferHandle = extern struct { idx: c_ushort, }; pub const OcclusionQueryHandle = extern struct { idx: c_ushort, }; pub const ProgramHandle = extern struct { idx: c_ushort, }; pub const ShaderHandle = extern struct { idx: c_ushort, }; pub const TextureHandle = extern struct { idx: c_ushort, }; pub const UniformHandle = extern struct { idx: c_ushort, }; pub const VertexBufferHandle = extern struct { idx: c_ushort, }; pub const VertexLayoutHandle = extern struct { idx: c_ushort, }; /// Init attachment. /// <param name="_handle">Render target texture handle.</param> /// <param name="_access">Access. See `Access::Enum`.</param> /// <param name="_layer">Cubemap side or depth layer/slice to use.</param> /// <param name="_numLayers">Number of texture layer/slice(s) in array to use.</param> /// <param name="_mip">Mip level.</param> /// <param name="_resolve">Resolve flags. See: `BGFX_RESOLVE_*`</param> pub extern fn bgfx_attachment_init(self: [*c]Attachment, handle: TextureHandle, access: Access, layer: u16, numLayers: u16, mip: u16, resolve: u8) callconv(.C) void; /// Start VertexLayout. /// <param name="_rendererType">Renderer backend type. See: `bgfx::RendererType`</param> pub extern fn bgfx_vertex_layout_begin(self: [*c]VertexLayout, rendererType: RendererType) callconv(.C) [*c]VertexLayout; /// Add attribute to VertexLayout. /// @remarks Must be called between begin/end. /// <param name="_attrib">Attribute semantics. See: `bgfx::Attrib`</param> /// <param name="_num">Number of elements 1, 2, 3 or 4.</param> /// <param name="_type">Element type.</param> /// <param name="_normalized">When using fixed point AttribType (f.e. Uint8) value will be normalized for vertex shader usage. When normalized is set to true, AttribType::Uint8 value in range 0-255 will be in range 0.0-1.0 in vertex shader.</param> /// <param name="_asInt">Packaging rule for vertexPack, vertexUnpack, and vertexConvert for AttribType::Uint8 and AttribType::Int16. Unpacking code must be implemented inside vertex shader.</param> pub extern fn bgfx_vertex_layout_add(self: [*c]VertexLayout, attrib: Attrib, num: u8, type: AttribType, normalized: bool, asInt: bool) callconv(.C) [*c]VertexLayout; /// Decode attribute. /// <param name="_attrib">Attribute semantics. See: `bgfx::Attrib`</param> /// <param name="_num">Number of elements.</param> /// <param name="_type">Element type.</param> /// <param name="_normalized">Attribute is normalized.</param> /// <param name="_asInt">Attribute is packed as int.</param> pub extern fn bgfx_vertex_layout_decode(self: [*c]VertexLayout, attrib: Attrib, num: [*c]u8 , type: [*c]AttribType, normalized: [*c]bool, asInt: [*c]bool) callconv(.C) void; /// Returns `true` if VertexLayout contains attribute. /// <param name="_attrib">Attribute semantics. See: `bgfx::Attrib`</param> pub extern fn bgfx_vertex_layout_has(self: [*c]VertexLayout, attrib: Attrib) callconv(.C) bool; /// Skip `_num` bytes in vertex stream. /// <param name="_num">Number of bytes to skip.</param> pub extern fn bgfx_vertex_layout_skip(self: [*c]VertexLayout, num: u8) callconv(.C) [*c]VertexLayout; /// End VertexLayout. pub extern fn bgfx_vertex_layout_end(self: [*c]VertexLayout) callconv(.C) void; /// Pack vertex attribute into vertex stream format. /// <param name="_input">Value to be packed into vertex stream.</param> /// <param name="_inputNormalized">`true` if input value is already normalized.</param> /// <param name="_attr">Attribute to pack.</param> /// <param name="_layout">Vertex stream layout.</param> /// <param name="_data">Destination vertex stream where data will be packed.</param> /// <param name="_index">Vertex index that will be modified.</param> pub extern fn bgfx_vertex_pack(input: f32, inputNormalized: bool, attr: Attrib, layout: [*c]VertexLayout, data: ?*anyopaque, index: u32) callconv(.C) void; /// Unpack vertex attribute from vertex stream format. /// <param name="_output">Result of unpacking.</param> /// <param name="_attr">Attribute to unpack.</param> /// <param name="_layout">Vertex stream layout.</param> /// <param name="_data">Source vertex stream from where data will be unpacked.</param> /// <param name="_index">Vertex index that will be unpacked.</param> pub extern fn bgfx_vertex_unpack(output: f32, attr: Attrib, layout: [*c]VertexLayout, data: ?*anyopaque, index: u32) callconv(.C) void; /// Converts vertex stream data from one vertex stream format to another. /// <param name="_dstLayout">Destination vertex stream layout.</param> /// <param name="_dstData">Destination vertex stream.</param> /// <param name="_srcLayout">Source vertex stream layout.</param> /// <param name="_srcData">Source vertex stream data.</param> /// <param name="_num">Number of vertices to convert from source to destination.</param> pub extern fn bgfx_vertex_convert(dstLayout: [*c]VertexLayout, dstData: ?*anyopaque, srcLayout: [*c]VertexLayout, srcData: ?*anyopaque, num: u32) callconv(.C) void; /// Weld vertices. /// <param name="_output">Welded vertices remapping table. The size of buffer must be the same as number of vertices.</param> /// <param name="_layout">Vertex stream layout.</param> /// <param name="_data">Vertex stream.</param> /// <param name="_num">Number of vertices in vertex stream.</param> /// <param name="_index32">Set to `true` if input indices are 32-bit.</param> /// <param name="_epsilon">Error tolerance for vertex position comparison.</param> pub extern fn bgfx_weld_vertices(output: ?*anyopaque, layout: [*c]VertexLayout, data: ?*anyopaque, num: u32, index32: bool, epsilon: f32) callconv(.C) u32; /// Convert index buffer for use with different primitive topologies. /// <param name="_conversion">Conversion type, see `TopologyConvert::Enum`.</param> /// <param name="_dst">Destination index buffer. If this argument is NULL function will return number of indices after conversion.</param> /// <param name="_dstSize">Destination index buffer in bytes. It must be large enough to contain output indices. If destination size is insufficient index buffer will be truncated.</param> /// <param name="_indices">Source indices.</param> /// <param name="_numIndices">Number of input indices.</param> /// <param name="_index32">Set to `true` if input indices are 32-bit.</param> pub extern fn bgfx_topology_convert(conversion: TopologyConvert, dst: ?*anyopaque, dstSize: u32, indices: ?*anyopaque, numIndices: u32, index32: bool) callconv(.C) u32; /// Sort indices. /// <param name="_sort">Sort order, see `TopologySort::Enum`.</param> /// <param name="_dst">Destination index buffer.</param> /// <param name="_dstSize">Destination index buffer in bytes. It must be large enough to contain output indices. If destination size is insufficient index buffer will be truncated.</param> /// <param name="_dir">Direction (vector must be normalized).</param> /// <param name="_pos">Position.</param> /// <param name="_vertices">Pointer to first vertex represented as float x, y, z. Must contain at least number of vertices referencende by index buffer.</param> /// <param name="_stride">Vertex stride.</param> /// <param name="_indices">Source indices.</param> /// <param name="_numIndices">Number of input indices.</param> /// <param name="_index32">Set to `true` if input indices are 32-bit.</param> pub extern fn bgfx_topology_sort_tri_list(sort: TopologySort, dst: ?*anyopaque, dstSize: u32, dir: f32, pos: f32, vertices: ?*anyopaque, stride: u32, indices: ?*anyopaque, numIndices: u32, index32: bool) callconv(.C) void; /// Returns supported backend API renderers. /// <param name="_max">Maximum number of elements in _enum array.</param> /// <param name="_enum">Array where supported renderers will be written.</param> pub extern fn bgfx_get_supported_renderers(max: u8, enumeration: [*c]RendererType) callconv(.C) u8; /// Returns name of renderer. /// <param name="_type">Renderer backend type. See: `bgfx::RendererType`</param> pub extern fn bgfx_get_renderer_name(type: RendererType) callconv(.C) [*c]const u8; pub extern fn bgfx_init_ctor(init: [*c]Init) callconv(.C) void; /// Initialize the bgfx library. /// <param name="_init">Initialization parameters. See: `bgfx::Init` for more info.</param> pub extern fn bgfx_init(init: [*c]Init) callconv(.C) bool; /// Shutdown bgfx library. pub extern fn bgfx_shutdown() callconv(.C) void; /// Reset graphic settings and back-buffer size. /// @attention This call doesn’t change the window size, it just resizes /// the back-buffer. Your windowing code controls the window size. /// <param name="_width">Back-buffer width.</param> /// <param name="_height">Back-buffer height.</param> /// <param name="_flags">See: `BGFX_RESET_*` for more info. - `BGFX_RESET_NONE` - No reset flags. - `BGFX_RESET_FULLSCREEN` - Not supported yet. - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA. - `BGFX_RESET_VSYNC` - Enable V-Sync. - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy. - `BGFX_RESET_CAPTURE` - Begin screen capture. - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU. - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip occurs. Default behaviour is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> pub extern fn bgfx_reset(width: u32, height: u32, flags: u32, format: TextureFormat) callconv(.C) void; /// Advance to next frame. When using multithreaded renderer, this call /// just swaps internal buffers, kicks render thread, and returns. In /// singlethreaded renderer this call does frame rendering. /// <param name="_capture">Capture frame with graphics debugger.</param> pub extern fn bgfx_frame(capture: bool) callconv(.C) u32; /// Returns current renderer backend API type. /// @remarks /// Library must be initialized. pub extern fn bgfx_get_renderer_type() callconv(.C) RendererType; /// Returns renderer capabilities. /// @remarks /// Library must be initialized. pub extern fn bgfx_get_caps() callconv(.C) [*c]Caps; /// Returns performance counters. /// @attention Pointer returned is valid until `bgfx::frame` is called. pub extern fn bgfx_get_stats() callconv(.C) [*c]Stats; /// Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. /// <param name="_size">Size to allocate.</param> pub extern fn bgfx_alloc(size: u32) callconv(.C) [*c]Memory; /// Allocate buffer and copy data into it. Data will be freed inside bgfx. /// <param name="_data">Pointer to data to be copied.</param> /// <param name="_size">Size of data to be copied.</param> pub extern fn bgfx_copy(data: ?*anyopaque, size: u32) callconv(.C) [*c]Memory; /// Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call /// doesn't allocate memory for data. It just copies the _data pointer. You /// can pass `ReleaseFn` function pointer to release this memory after it's /// consumed, otherwise you must make sure _data is available for at least 2 /// `bgfx::frame` calls. `ReleaseFn` function must be able to be called /// from any thread. /// @attention Data passed must be available for at least 2 `bgfx::frame` calls. /// <param name="_data">Pointer to data.</param> /// <param name="_size">Size of data.</param> pub extern fn bgfx_make_ref(data: ?*anyopaque, size: u32) callconv(.C) [*c]Memory; /// Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call /// doesn't allocate memory for data. It just copies the _data pointer. You /// can pass `ReleaseFn` function pointer to release this memory after it's /// consumed, otherwise you must make sure _data is available for at least 2 /// `bgfx::frame` calls. `ReleaseFn` function must be able to be called /// from any thread. /// @attention Data passed must be available for at least 2 `bgfx::frame` calls. /// <param name="_data">Pointer to data.</param> /// <param name="_size">Size of data.</param> /// <param name="_releaseFn">Callback function to release memory after use.</param> /// <param name="_userData">User data to be passed to callback function.</param> pub extern fn bgfx_make_ref_release(data: ?*anyopaque, size: u32, releaseFn: ?*anyopaque, userData: ?*anyopaque) callconv(.C) [*c]Memory; /// Set debug flags. /// <param name="_debug">Available flags: - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set all rendering calls will be skipped. This is useful when profiling to quickly assess potential bottlenecks between CPU and GPU. - `BGFX_DEBUG_PROFILER` - Enable profiler. - `BGFX_DEBUG_STATS` - Display internal statistics. - `BGFX_DEBUG_TEXT` - Display debug text. - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering primitives will be rendered as lines.</param> pub extern fn bgfx_set_debug(debug: u32) callconv(.C) void; /// Clear internal debug text buffer. /// <param name="_attr">Background color.</param> /// <param name="_small">Default 8x16 or 8x8 font.</param> pub extern fn bgfx_dbg_text_clear(attr: u8, small: bool) callconv(.C) void; /// Print formatted data to internal debug text character-buffer (VGA-compatible text mode). /// <param name="_x">Position x from the left corner of the window.</param> /// <param name="_y">Position y from the top corner of the window.</param> /// <param name="_attr">Color palette. Where top 4-bits represent index of background, and bottom 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).</param> /// <param name="_format">`printf` style format.</param> pub extern fn bgfx_dbg_text_printf(x: u16, y: u16, attr: u8, format: [*c]const u8, ...) callconv(.C) void; /// Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode). /// <param name="_x">Position x from the left corner of the window.</param> /// <param name="_y">Position y from the top corner of the window.</param> /// <param name="_attr">Color palette. Where top 4-bits represent index of background, and bottom 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).</param> /// <param name="_format">`printf` style format.</param> /// <param name="_argList">Variable arguments list for format string.</param> pub extern fn bgfx_dbg_text_vprintf(x: u16, y: u16, attr: u8, format: [*c]const u8, argList: ?*anyopaque) callconv(.C) void; /// Draw image into internal debug text buffer. /// <param name="_x">Position x from the left corner of the window.</param> /// <param name="_y">Position y from the top corner of the window.</param> /// <param name="_width">Image width.</param> /// <param name="_height">Image height.</param> /// <param name="_data">Raw image data (character/attribute raw encoding).</param> /// <param name="_pitch">Image pitch in bytes.</param> pub extern fn bgfx_dbg_text_image(x: u16, y: u16, width: u16, height: u16, data: ?*anyopaque, pitch: u16) callconv(.C) void; /// Create static index buffer. /// <param name="_mem">Index buffer data.</param> /// <param name="_flags">Buffer creation flags. - `BGFX_BUFFER_NONE` - No flags. - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.</param> pub extern fn bgfx_create_index_buffer(mem: [*c]Memory, flags: u16) callconv(.C) IndexBufferHandle; /// Set static index buffer debug name. /// <param name="_handle">Static index buffer handle.</param> /// <param name="_name">Static index buffer name.</param> /// <param name="_len">Static index buffer name length (if length is INT32_MAX, it's expected that _name is zero terminated string.</param> pub extern fn bgfx_set_index_buffer_name(handle: IndexBufferHandle, name: [*c]const u8, len: i32) callconv(.C) void; /// Destroy static index buffer. /// <param name="_handle">Static index buffer handle.</param> pub extern fn bgfx_destroy_index_buffer(handle: IndexBufferHandle) callconv(.C) void; /// Create vertex layout. /// <param name="_layout">Vertex layout.</param> pub extern fn bgfx_create_vertex_layout(layout: [*c]VertexLayout) callconv(.C) VertexLayoutHandle; /// Destroy vertex layout. /// <param name="_layoutHandle">Vertex layout handle.</param> pub extern fn bgfx_destroy_vertex_layout(layoutHandle: VertexLayoutHandle) callconv(.C) void; /// Create static vertex buffer. /// <param name="_mem">Vertex buffer data.</param> /// <param name="_layout">Vertex layout.</param> /// <param name="_flags">Buffer creation flags. - `BGFX_BUFFER_NONE` - No flags. - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.</param> pub extern fn bgfx_create_vertex_buffer(mem: [*c]Memory, layout: [*c]VertexLayout, flags: u16) callconv(.C) VertexBufferHandle; /// Set static vertex buffer debug name. /// <param name="_handle">Static vertex buffer handle.</param> /// <param name="_name">Static vertex buffer name.</param> /// <param name="_len">Static vertex buffer name length (if length is INT32_MAX, it's expected that _name is zero terminated string.</param> pub extern fn bgfx_set_vertex_buffer_name(handle: VertexBufferHandle, name: [*c]const u8, len: i32) callconv(.C) void; /// Destroy static vertex buffer. /// <param name="_handle">Static vertex buffer handle.</param> pub extern fn bgfx_destroy_vertex_buffer(handle: VertexBufferHandle) callconv(.C) void; /// Create empty dynamic index buffer. /// <param name="_num">Number of indices.</param> /// <param name="_flags">Buffer creation flags. - `BGFX_BUFFER_NONE` - No flags. - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.</param> pub extern fn bgfx_create_dynamic_index_buffer(num: u32, flags: u16) callconv(.C) DynamicIndexBufferHandle; /// Create a dynamic index buffer and initialize it. /// <param name="_mem">Index buffer data.</param> /// <param name="_flags">Buffer creation flags. - `BGFX_BUFFER_NONE` - No flags. - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.</param> pub extern fn bgfx_create_dynamic_index_buffer_mem(mem: [*c]Memory, flags: u16) callconv(.C) DynamicIndexBufferHandle; /// Update dynamic index buffer. /// <param name="_handle">Dynamic index buffer handle.</param> /// <param name="_startIndex">Start index.</param> /// <param name="_mem">Index buffer data.</param> pub extern fn bgfx_update_dynamic_index_buffer(handle: DynamicIndexBufferHandle, startIndex: u32, mem: [*c]Memory) callconv(.C) void; /// Destroy dynamic index buffer. /// <param name="_handle">Dynamic index buffer handle.</param> pub extern fn bgfx_destroy_dynamic_index_buffer(handle: DynamicIndexBufferHandle) callconv(.C) void; /// Create empty dynamic vertex buffer. /// <param name="_num">Number of vertices.</param> /// <param name="_layout">Vertex layout.</param> /// <param name="_flags">Buffer creation flags. - `BGFX_BUFFER_NONE` - No flags. - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.</param> pub extern fn bgfx_create_dynamic_vertex_buffer(num: u32, layout: [*c]VertexLayout, flags: u16) callconv(.C) DynamicVertexBufferHandle; /// Create dynamic vertex buffer and initialize it. /// <param name="_mem">Vertex buffer data.</param> /// <param name="_layout">Vertex layout.</param> /// <param name="_flags">Buffer creation flags. - `BGFX_BUFFER_NONE` - No flags. - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.</param> pub extern fn bgfx_create_dynamic_vertex_buffer_mem(mem: [*c]Memory, layout: [*c]VertexLayout, flags: u16) callconv(.C) DynamicVertexBufferHandle; /// Update dynamic vertex buffer. /// <param name="_handle">Dynamic vertex buffer handle.</param> /// <param name="_startVertex">Start vertex.</param> /// <param name="_mem">Vertex buffer data.</param> pub extern fn bgfx_update_dynamic_vertex_buffer(handle: DynamicVertexBufferHandle, startVertex: u32, mem: [*c]Memory) callconv(.C) void; /// Destroy dynamic vertex buffer. /// <param name="_handle">Dynamic vertex buffer handle.</param> pub extern fn bgfx_destroy_dynamic_vertex_buffer(handle: DynamicVertexBufferHandle) callconv(.C) void; /// Returns number of requested or maximum available indices. /// <param name="_num">Number of required indices.</param> /// <param name="_index32">Set to `true` if input indices will be 32-bit.</param> pub extern fn bgfx_get_avail_transient_index_buffer(num: u32, index32: bool) callconv(.C) u32; /// Returns number of requested or maximum available vertices. /// <param name="_num">Number of required vertices.</param> /// <param name="_layout">Vertex layout.</param> pub extern fn bgfx_get_avail_transient_vertex_buffer(num: u32, layout: [*c]VertexLayout) callconv(.C) u32; /// Returns number of requested or maximum available instance buffer slots. /// <param name="_num">Number of required instances.</param> /// <param name="_stride">Stride per instance.</param> pub extern fn bgfx_get_avail_instance_data_buffer(num: u32, stride: u16) callconv(.C) u32; /// Allocate transient index buffer. /// <param name="_tib">TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param> /// <param name="_num">Number of indices to allocate.</param> /// <param name="_index32">Set to `true` if input indices will be 32-bit.</param> pub extern fn bgfx_alloc_transient_index_buffer(tib: [*c]TransientIndexBuffer, num: u32, index32: bool) callconv(.C) void; /// Allocate transient vertex buffer. /// <param name="_tvb">TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param> /// <param name="_num">Number of vertices to allocate.</param> /// <param name="_layout">Vertex layout.</param> pub extern fn bgfx_alloc_transient_vertex_buffer(tvb: [*c]TransientVertexBuffer, num: u32, layout: [*c]VertexLayout) callconv(.C) void; /// Check for required space and allocate transient vertex and index /// buffers. If both space requirements are satisfied function returns /// true. /// <param name="_tvb">TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param> /// <param name="_layout">Vertex layout.</param> /// <param name="_numVertices">Number of vertices to allocate.</param> /// <param name="_tib">TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param> /// <param name="_numIndices">Number of indices to allocate.</param> /// <param name="_index32">Set to `true` if input indices will be 32-bit.</param> pub extern fn bgfx_alloc_transient_buffers(tvb: [*c]TransientVertexBuffer, layout: [*c]VertexLayout, numVertices: u32, tib: [*c]TransientIndexBuffer, numIndices: u32, index32: bool) callconv(.C) bool; /// Allocate instance data buffer. /// <param name="_idb">InstanceDataBuffer structure is filled and is valid for duration of frame, and it can be reused for multiple draw calls.</param> /// <param name="_num">Number of instances.</param> /// <param name="_stride">Instance stride. Must be multiple of 16.</param> pub extern fn bgfx_alloc_instance_data_buffer(idb: [*c]InstanceDataBuffer, num: u32, stride: u16) callconv(.C) void; /// Create draw indirect buffer. /// <param name="_num">Number of indirect calls.</param> pub extern fn bgfx_create_indirect_buffer(num: u32) callconv(.C) IndirectBufferHandle; /// Destroy draw indirect buffer. /// <param name="_handle">Indirect buffer handle.</param> pub extern fn bgfx_destroy_indirect_buffer(handle: IndirectBufferHandle) callconv(.C) void; /// Create shader from memory buffer. /// <param name="_mem">Shader binary.</param> pub extern fn bgfx_create_shader(mem: [*c]Memory) callconv(.C) ShaderHandle; /// Returns the number of uniforms and uniform handles used inside a shader. /// @remarks /// Only non-predefined uniforms are returned. /// <param name="_handle">Shader handle.</param> /// <param name="_uniforms">UniformHandle array where data will be stored.</param> /// <param name="_max">Maximum capacity of array.</param> pub extern fn bgfx_get_shader_uniforms(handle: ShaderHandle, uniforms: [*c]UniformHandle, max: u16) callconv(.C) u16; /// Set shader debug name. /// <param name="_handle">Shader handle.</param> /// <param name="_name">Shader name.</param> /// <param name="_len">Shader name length (if length is INT32_MAX, it's expected that _name is zero terminated string).</param> pub extern fn bgfx_set_shader_name(handle: ShaderHandle, name: [*c]const u8, len: i32) callconv(.C) void; /// Destroy shader. /// @remark Once a shader program is created with _handle, /// it is safe to destroy that shader. /// <param name="_handle">Shader handle.</param> pub extern fn bgfx_destroy_shader(handle: ShaderHandle) callconv(.C) void; /// Create program with vertex and fragment shaders. /// <param name="_vsh">Vertex shader.</param> /// <param name="_fsh">Fragment shader.</param> /// <param name="_destroyShaders">If true, shaders will be destroyed when program is destroyed.</param> pub extern fn bgfx_create_program(vsh: ShaderHandle, fsh: ShaderHandle, destroyShaders: bool) callconv(.C) ProgramHandle; /// Create program with compute shader. /// <param name="_csh">Compute shader.</param> /// <param name="_destroyShaders">If true, shaders will be destroyed when program is destroyed.</param> pub extern fn bgfx_create_compute_program(csh: ShaderHandle, destroyShaders: bool) callconv(.C) ProgramHandle; /// Destroy program. /// <param name="_handle">Program handle.</param> pub extern fn bgfx_destroy_program(handle: ProgramHandle) callconv(.C) void; /// Validate texture parameters. /// <param name="_depth">Depth dimension of volume texture.</param> /// <param name="_cubeMap">Indicates that texture contains cubemap.</param> /// <param name="_numLayers">Number of layers in texture array.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> /// <param name="_flags">Texture flags. See `BGFX_TEXTURE_*`.</param> pub extern fn bgfx_is_texture_valid(depth: u16, cubeMap: bool, numLayers: u16, format: TextureFormat, flags: u64) callconv(.C) bool; /// Validate frame buffer parameters. /// <param name="_num">Number of attachments.</param> /// <param name="_attachment">Attachment texture info. See: `bgfx::Attachment`.</param> pub extern fn bgfx_is_frame_buffer_valid(num: u8, attachment: [*c]Attachment) callconv(.C) bool; /// Calculate amount of memory required for texture. /// <param name="_info">Resulting texture info structure. See: `TextureInfo`.</param> /// <param name="_width">Width.</param> /// <param name="_height">Height.</param> /// <param name="_depth">Depth dimension of volume texture.</param> /// <param name="_cubeMap">Indicates that texture contains cubemap.</param> /// <param name="_hasMips">Indicates that texture contains full mip-map chain.</param> /// <param name="_numLayers">Number of layers in texture array.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> pub extern fn bgfx_calc_texture_size(info: [*c]TextureInfo, width: u16, height: u16, depth: u16, cubeMap: bool, hasMips: bool, numLayers: u16, format: TextureFormat) callconv(.C) void; /// Create texture from memory buffer. /// <param name="_mem">DDS, KTX or PVR texture binary data.</param> /// <param name="_flags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> /// <param name="_skip">Skip top level mips when parsing texture.</param> /// <param name="_info">When non-`NULL` is specified it returns parsed texture information.</param> pub extern fn bgfx_create_texture(mem: [*c]Memory, flags: u64, skip: u8, info: [*c]TextureInfo) callconv(.C) TextureHandle; /// Create 2D texture. /// <param name="_width">Width.</param> /// <param name="_height">Height.</param> /// <param name="_hasMips">Indicates that texture contains full mip-map chain.</param> /// <param name="_numLayers">Number of layers in texture array. Must be 1 if caps `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> /// <param name="_flags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> /// <param name="_mem">Texture data. If `_mem` is non-NULL, created texture will be immutable. If `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than 1, expected memory layout is texture and all mips together for each array element.</param> pub extern fn bgfx_create_texture_2d(width: u16, height: u16, hasMips: bool, numLayers: u16, format: TextureFormat, flags: u64, mem: [*c]Memory) callconv(.C) TextureHandle; /// Create texture with size based on back-buffer ratio. Texture will maintain ratio /// if back buffer resolution changes. /// <param name="_ratio">Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.</param> /// <param name="_hasMips">Indicates that texture contains full mip-map chain.</param> /// <param name="_numLayers">Number of layers in texture array. Must be 1 if caps `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> /// <param name="_flags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> pub extern fn bgfx_create_texture_2d_scaled(ratio: BackbufferRatio, hasMips: bool, numLayers: u16, format: TextureFormat, flags: u64) callconv(.C) TextureHandle; /// Create 3D texture. /// <param name="_width">Width.</param> /// <param name="_height">Height.</param> /// <param name="_depth">Depth.</param> /// <param name="_hasMips">Indicates that texture contains full mip-map chain.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> /// <param name="_flags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> /// <param name="_mem">Texture data. If `_mem` is non-NULL, created texture will be immutable. If `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than 1, expected memory layout is texture and all mips together for each array element.</param> pub extern fn bgfx_create_texture_3d(width: u16, height: u16, depth: u16, hasMips: bool, format: TextureFormat, flags: u64, mem: [*c]Memory) callconv(.C) TextureHandle; /// Create Cube texture. /// <param name="_size">Cube side size.</param> /// <param name="_hasMips">Indicates that texture contains full mip-map chain.</param> /// <param name="_numLayers">Number of layers in texture array. Must be 1 if caps `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> /// <param name="_flags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> /// <param name="_mem">Texture data. If `_mem` is non-NULL, created texture will be immutable. If `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than 1, expected memory layout is texture and all mips together for each array element.</param> pub extern fn bgfx_create_texture_cube(size: u16, hasMips: bool, numLayers: u16, format: TextureFormat, flags: u64, mem: [*c]Memory) callconv(.C) TextureHandle; /// Update 2D texture. /// @attention It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info. /// <param name="_handle">Texture handle.</param> /// <param name="_layer">Layer in texture array.</param> /// <param name="_mip">Mip level.</param> /// <param name="_x">X offset in texture.</param> /// <param name="_y">Y offset in texture.</param> /// <param name="_width">Width of texture block.</param> /// <param name="_height">Height of texture block.</param> /// <param name="_mem">Texture update data.</param> /// <param name="_pitch">Pitch of input image (bytes). When _pitch is set to UINT16_MAX, it will be calculated internally based on _width.</param> pub extern fn bgfx_update_texture_2d(handle: TextureHandle, layer: u16, mip: u8, x: u16, y: u16, width: u16, height: u16, mem: [*c]Memory, pitch: u16) callconv(.C) void; /// Update 3D texture. /// @attention It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info. /// <param name="_handle">Texture handle.</param> /// <param name="_mip">Mip level.</param> /// <param name="_x">X offset in texture.</param> /// <param name="_y">Y offset in texture.</param> /// <param name="_z">Z offset in texture.</param> /// <param name="_width">Width of texture block.</param> /// <param name="_height">Height of texture block.</param> /// <param name="_depth">Depth of texture block.</param> /// <param name="_mem">Texture update data.</param> pub extern fn bgfx_update_texture_3d(handle: TextureHandle, mip: u8, x: u16, y: u16, z: u16, width: u16, height: u16, depth: u16, mem: [*c]Memory) callconv(.C) void; /// Update Cube texture. /// @attention It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info. /// <param name="_handle">Texture handle.</param> /// <param name="_layer">Layer in texture array.</param> /// <param name="_side">Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`, where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z. +----------+ |-z 2| | ^ +y | | | | Unfolded cube: | +---->+x | +----------+----------+----------+----------+ |+y 1|+y 4|+y 0|+y 5| | ^ -x | ^ +z | ^ +x | ^ -z | | | | | | | | | | | +---->+z | +---->+x | +---->-z | +---->-x | +----------+----------+----------+----------+ |+z 3| | ^ -y | | | | | +---->+x | +----------+</param> /// <param name="_mip">Mip level.</param> /// <param name="_x">X offset in texture.</param> /// <param name="_y">Y offset in texture.</param> /// <param name="_width">Width of texture block.</param> /// <param name="_height">Height of texture block.</param> /// <param name="_mem">Texture update data.</param> /// <param name="_pitch">Pitch of input image (bytes). When _pitch is set to UINT16_MAX, it will be calculated internally based on _width.</param> pub extern fn bgfx_update_texture_cube(handle: TextureHandle, layer: u16, side: u8, mip: u8, x: u16, y: u16, width: u16, height: u16, mem: [*c]Memory, pitch: u16) callconv(.C) void; /// Read back texture content. /// @attention Texture must be created with `BGFX_TEXTURE_READ_BACK` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`. /// <param name="_handle">Texture handle.</param> /// <param name="_data">Destination buffer.</param> /// <param name="_mip">Mip level.</param> pub extern fn bgfx_read_texture(handle: TextureHandle, data: ?*anyopaque, mip: u8) callconv(.C) u32; /// Set texture debug name. /// <param name="_handle">Texture handle.</param> /// <param name="_name">Texture name.</param> /// <param name="_len">Texture name length (if length is INT32_MAX, it's expected that _name is zero terminated string.</param> pub extern fn bgfx_set_texture_name(handle: TextureHandle, name: [*c]const u8, len: i32) callconv(.C) void; /// Returns texture direct access pointer. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature /// is available on GPUs that have unified memory architecture (UMA) support. /// <param name="_handle">Texture handle.</param> pub extern fn bgfx_get_direct_access_ptr(handle: TextureHandle) callconv(.C) ?*anyopaque; /// Destroy texture. /// <param name="_handle">Texture handle.</param> pub extern fn bgfx_destroy_texture(handle: TextureHandle) callconv(.C) void; /// Create frame buffer (simple). /// <param name="_width">Texture width.</param> /// <param name="_height">Texture height.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> /// <param name="_textureFlags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> pub extern fn bgfx_create_frame_buffer(width: u16, height: u16, format: TextureFormat, textureFlags: u64) callconv(.C) FrameBufferHandle; /// Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio /// if back buffer resolution changes. /// <param name="_ratio">Frame buffer size in respect to back-buffer size. See: `BackbufferRatio::Enum`.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> /// <param name="_textureFlags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> pub extern fn bgfx_create_frame_buffer_scaled(ratio: BackbufferRatio, format: TextureFormat, textureFlags: u64) callconv(.C) FrameBufferHandle; /// Create MRT frame buffer from texture handles (simple). /// <param name="_num">Number of texture handles.</param> /// <param name="_handles">Texture attachments.</param> /// <param name="_destroyTexture">If true, textures will be destroyed when frame buffer is destroyed.</param> pub extern fn bgfx_create_frame_buffer_from_handles(num: u8, handles: [*c]TextureHandle, destroyTexture: bool) callconv(.C) FrameBufferHandle; /// Create MRT frame buffer from texture handles with specific layer and /// mip level. /// <param name="_num">Number of attachments.</param> /// <param name="_attachment">Attachment texture info. See: `bgfx::Attachment`.</param> /// <param name="_destroyTexture">If true, textures will be destroyed when frame buffer is destroyed.</param> pub extern fn bgfx_create_frame_buffer_from_attachment(num: u8, attachment: [*c]Attachment, destroyTexture: bool) callconv(.C) FrameBufferHandle; /// Create frame buffer for multiple window rendering. /// @remarks /// Frame buffer cannot be used for sampling. /// @attention Availability depends on: `BGFX_CAPS_SWAP_CHAIN`. /// <param name="_nwh">OS' target native window handle.</param> /// <param name="_width">Window back buffer width.</param> /// <param name="_height">Window back buffer height.</param> /// <param name="_format">Window back buffer color format.</param> /// <param name="_depthFormat">Window back buffer depth format.</param> pub extern fn bgfx_create_frame_buffer_from_nwh(nwh: ?*anyopaque, width: u16, height: u16, format: TextureFormat, depthFormat: TextureFormat) callconv(.C) FrameBufferHandle; /// Set frame buffer debug name. /// <param name="_handle">Frame buffer handle.</param> /// <param name="_name">Frame buffer name.</param> /// <param name="_len">Frame buffer name length (if length is INT32_MAX, it's expected that _name is zero terminated string.</param> pub extern fn bgfx_set_frame_buffer_name(handle: FrameBufferHandle, name: [*c]const u8, len: i32) callconv(.C) void; /// Obtain texture handle of frame buffer attachment. /// <param name="_handle">Frame buffer handle.</param> pub extern fn bgfx_get_texture(handle: FrameBufferHandle, attachment: u8) callconv(.C) TextureHandle; /// Destroy frame buffer. /// <param name="_handle">Frame buffer handle.</param> pub extern fn bgfx_destroy_frame_buffer(handle: FrameBufferHandle) callconv(.C) void; /// Create shader uniform parameter. /// @remarks /// 1. Uniform names are unique. It's valid to call `bgfx::createUniform` /// multiple times with the same uniform name. The library will always /// return the same handle, but the handle reference count will be /// incremented. This means that the same number of `bgfx::destroyUniform` /// must be called to properly destroy the uniform. /// 2. Predefined uniforms (declared in `bgfx_shader.sh`): /// - `u_viewRect vec4(x, y, width, height)` - view rectangle for current /// view, in pixels. /// - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse /// width and height /// - `u_view mat4` - view matrix /// - `u_invView mat4` - inverted view matrix /// - `u_proj mat4` - projection matrix /// - `u_invProj mat4` - inverted projection matrix /// - `u_viewProj mat4` - concatenated view projection matrix /// - `u_invViewProj mat4` - concatenated inverted view projection matrix /// - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices. /// - `u_modelView mat4` - concatenated model view matrix, only first /// model matrix from array is used. /// - `u_modelViewProj mat4` - concatenated model view projection matrix. /// - `u_alphaRef float` - alpha reference value for alpha test. /// <param name="_name">Uniform name in shader.</param> /// <param name="_type">Type of uniform (See: `bgfx::UniformType`).</param> /// <param name="_num">Number of elements in array.</param> pub extern fn bgfx_create_uniform(name: [*c]const u8, type: UniformType, num: u16) callconv(.C) UniformHandle; /// Retrieve uniform info. /// <param name="_handle">Handle to uniform object.</param> /// <param name="_info">Uniform info.</param> pub extern fn bgfx_get_uniform_info(handle: UniformHandle, info: [*c]UniformInfo) callconv(.C) void; /// Destroy shader uniform parameter. /// <param name="_handle">Handle to uniform object.</param> pub extern fn bgfx_destroy_uniform(handle: UniformHandle) callconv(.C) void; /// Create occlusion query. pub extern fn bgfx_create_occlusion_query() callconv(.C) OcclusionQueryHandle; /// Retrieve occlusion query result from previous frame. /// <param name="_handle">Handle to occlusion query object.</param> /// <param name="_result">Number of pixels that passed test. This argument can be `NULL` if result of occlusion query is not needed.</param> pub extern fn bgfx_get_result(handle: OcclusionQueryHandle, result: [*c]i32) callconv(.C) OcclusionQueryResult; /// Destroy occlusion query. /// <param name="_handle">Handle to occlusion query object.</param> pub extern fn bgfx_destroy_occlusion_query(handle: OcclusionQueryHandle) callconv(.C) void; /// Set palette color value. /// <param name="_index">Index into palette.</param> /// <param name="_rgba">RGBA floating point values.</param> pub extern fn bgfx_set_palette_color(index: u8, rgba: f32) callconv(.C) void; /// Set palette color value. /// <param name="_index">Index into palette.</param> /// <param name="_rgba">Packed 32-bit RGBA value.</param> pub extern fn bgfx_set_palette_color_rgba8(index: u8, rgba: u32) callconv(.C) void; /// Set view name. /// @remarks /// This is debug only feature. /// In graphics debugger view name will appear as: /// "nnnc <view name>" /// ^ ^ ^ /// | +--- compute (C) /// +------ view id /// <param name="_id">View id.</param> /// <param name="_name">View name.</param> pub extern fn bgfx_set_view_name(id: u16, name: [*c]const u8) callconv(.C) void; /// Set view rectangle. Draw primitive outside view will be clipped. /// <param name="_id">View id.</param> /// <param name="_x">Position x from the left corner of the window.</param> /// <param name="_y">Position y from the top corner of the window.</param> /// <param name="_width">Width of view port region.</param> /// <param name="_height">Height of view port region.</param> pub extern fn bgfx_set_view_rect(id: u16, x: u16, y: u16, width: u16, height: u16) callconv(.C) void; /// Set view rectangle. Draw primitive outside view will be clipped. /// <param name="_id">View id.</param> /// <param name="_x">Position x from the left corner of the window.</param> /// <param name="_y">Position y from the top corner of the window.</param> /// <param name="_ratio">Width and height will be set in respect to back-buffer size. See: `BackbufferRatio::Enum`.</param> pub extern fn bgfx_set_view_rect_ratio(id: u16, x: u16, y: u16, ratio: BackbufferRatio) callconv(.C) void; /// Set view scissor. Draw primitive outside view will be clipped. When /// _x, _y, _width and _height are set to 0, scissor will be disabled. /// <param name="_id">View id.</param> /// <param name="_x">Position x from the left corner of the window.</param> /// <param name="_y">Position y from the top corner of the window.</param> /// <param name="_width">Width of view scissor region.</param> /// <param name="_height">Height of view scissor region.</param> pub extern fn bgfx_set_view_scissor(id: u16, x: u16, y: u16, width: u16, height: u16) callconv(.C) void; /// Set view clear flags. /// <param name="_id">View id.</param> /// <param name="_flags">Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear operation. See: `BGFX_CLEAR_*`.</param> /// <param name="_rgba">Color clear value.</param> /// <param name="_depth">Depth clear value.</param> /// <param name="_stencil">Stencil clear value.</param> pub extern fn bgfx_set_view_clear(id: u16, flags: u16, rgba: u32, depth: f32, stencil: u8) callconv(.C) void; /// Set view clear flags with different clear color for each /// frame buffer texture. `bgfx::setPaletteColor` must be used to set up a /// clear color palette. /// <param name="_id">View id.</param> /// <param name="_flags">Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear operation. See: `BGFX_CLEAR_*`.</param> /// <param name="_depth">Depth clear value.</param> /// <param name="_stencil">Stencil clear value.</param> /// <param name="_c0">Palette index for frame buffer attachment 0.</param> /// <param name="_c1">Palette index for frame buffer attachment 1.</param> /// <param name="_c2">Palette index for frame buffer attachment 2.</param> /// <param name="_c3">Palette index for frame buffer attachment 3.</param> /// <param name="_c4">Palette index for frame buffer attachment 4.</param> /// <param name="_c5">Palette index for frame buffer attachment 5.</param> /// <param name="_c6">Palette index for frame buffer attachment 6.</param> /// <param name="_c7">Palette index for frame buffer attachment 7.</param> pub extern fn bgfx_set_view_clear_mrt(id: u16, flags: u16, depth: f32, stencil: u8, c0: u8, c1: u8, c2: u8, c3: u8, c4: u8, c5: u8, c6: u8, c7: u8) callconv(.C) void; /// Set view sorting mode. /// @remarks /// View mode must be set prior calling `bgfx::submit` for the view. /// <param name="_id">View id.</param> /// <param name="_mode">View sort mode. See `ViewMode::Enum`.</param> pub extern fn bgfx_set_view_mode(id: u16, mode: ViewMode) callconv(.C) void; /// Set view frame buffer. /// @remarks /// Not persistent after `bgfx::reset` call. /// <param name="_id">View id.</param> /// <param name="_handle">Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as frame buffer handle will draw primitives from this view into default back buffer.</param> pub extern fn bgfx_set_view_frame_buffer(id: u16, handle: FrameBufferHandle) callconv(.C) void; /// Set view's view matrix and projection matrix, /// all draw primitives in this view will use these two matrices. /// <param name="_id">View id.</param> /// <param name="_view">View matrix.</param> /// <param name="_proj">Projection matrix.</param> pub extern fn bgfx_set_view_transform(id: u16, view: ?*anyopaque, proj: ?*anyopaque) callconv(.C) void; /// Post submit view reordering. /// <param name="_id">First view id.</param> /// <param name="_num">Number of views to remap.</param> /// <param name="_order">View remap id table. Passing `NULL` will reset view ids to default state.</param> pub extern fn bgfx_set_view_order(id: u16, num: u16, order: [*c]c_ushort) callconv(.C) void; /// Reset all view settings to default. pub extern fn bgfx_reset_view(id: u16) callconv(.C) void; /// Begin submitting draw calls from thread. /// <param name="_forThread">Explicitly request an encoder for a worker thread.</param> pub extern fn bgfx_encoder_begin(forThread: bool) callconv(.C) [*c]Encoder; /// End submitting draw calls from thread. /// <param name="_encoder">Encoder.</param> pub extern fn bgfx_encoder_end(encoder: [*c]Encoder) callconv(.C) void; /// Sets a debug marker. This allows you to group graphics calls together for easy browsing in /// graphics debugging tools. /// <param name="_marker">Marker string.</param> pub extern fn bgfx_encoder_set_marker(self: [*c]Encoder, marker: [*c]const u8) callconv(.C) void; /// Set render states for draw primitive. /// @remarks /// 1. To set up more complex states use: /// `BGFX_STATE_ALPHA_REF(_ref)`, /// `BGFX_STATE_POINT_SIZE(_size)`, /// `BGFX_STATE_BLEND_FUNC(_src, _dst)`, /// `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, /// `BGFX_STATE_BLEND_EQUATION(_equation)`, /// `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` /// 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend /// equation is specified. /// <param name="_state">State flags. Default state for primitive type is triangles. See: `BGFX_STATE_DEFAULT`. - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. - `BGFX_STATE_CULL_*` - Backface culling mode. - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.</param> /// <param name="_rgba">Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and `BGFX_STATE_BLEND_INV_FACTOR` blend modes.</param> pub extern fn bgfx_encoder_set_state(self: [*c]Encoder, state: u64, rgba: u32) callconv(.C) void; /// Set condition for rendering. /// <param name="_handle">Occlusion query handle.</param> /// <param name="_visible">Render if occlusion query is visible.</param> pub extern fn bgfx_encoder_set_condition(self: [*c]Encoder, handle: OcclusionQueryHandle, visible: bool) callconv(.C) void; /// Set stencil test state. /// <param name="_fstencil">Front stencil state.</param> /// <param name="_bstencil">Back stencil state. If back is set to `BGFX_STENCIL_NONE` _fstencil is applied to both front and back facing primitives.</param> pub extern fn bgfx_encoder_set_stencil(self: [*c]Encoder, fstencil: u32, bstencil: u32) callconv(.C) void; /// Set scissor for draw primitive. /// @remark /// To scissor for all primitives in view see `bgfx::setViewScissor`. /// <param name="_x">Position x from the left corner of the window.</param> /// <param name="_y">Position y from the top corner of the window.</param> /// <param name="_width">Width of view scissor region.</param> /// <param name="_height">Height of view scissor region.</param> pub extern fn bgfx_encoder_set_scissor(self: [*c]Encoder, x: u16, y: u16, width: u16, height: u16) callconv(.C) u16; /// Set scissor from cache for draw primitive. /// @remark /// To scissor for all primitives in view see `bgfx::setViewScissor`. /// <param name="_cache">Index in scissor cache.</param> pub extern fn bgfx_encoder_set_scissor_cached(self: [*c]Encoder, cache: u16) callconv(.C) void; /// Set model matrix for draw primitive. If it is not called, /// the model will be rendered with an identity model matrix. /// <param name="_mtx">Pointer to first matrix in array.</param> /// <param name="_num">Number of matrices in array.</param> pub extern fn bgfx_encoder_set_transform(self: [*c]Encoder, mtx: ?*anyopaque, num: u16) callconv(.C) u32; /// Set model matrix from matrix cache for draw primitive. /// <param name="_cache">Index in matrix cache.</param> /// <param name="_num">Number of matrices from cache.</param> pub extern fn bgfx_encoder_set_transform_cached(self: [*c]Encoder, cache: u32, num: u16) callconv(.C) void; /// Reserve matrices in internal matrix cache. /// @attention Pointer returned can be modified until `bgfx::frame` is called. /// <param name="_transform">Pointer to `Transform` structure.</param> /// <param name="_num">Number of matrices.</param> pub extern fn bgfx_encoder_alloc_transform(self: [*c]Encoder, transform: [*c]Transform, num: u16) callconv(.C) u32; /// Set shader uniform parameter for draw primitive. /// <param name="_handle">Uniform.</param> /// <param name="_value">Pointer to uniform data.</param> /// <param name="_num">Number of elements. Passing `UINT16_MAX` will use the _num passed on uniform creation.</param> pub extern fn bgfx_encoder_set_uniform(self: [*c]Encoder, handle: UniformHandle, value: ?*anyopaque, num: u16) callconv(.C) void; /// Set index buffer for draw primitive. /// <param name="_handle">Index buffer.</param> /// <param name="_firstIndex">First index to render.</param> /// <param name="_numIndices">Number of indices to render.</param> pub extern fn bgfx_encoder_set_index_buffer(self: [*c]Encoder, handle: IndexBufferHandle, firstIndex: u32, numIndices: u32) callconv(.C) void; /// Set index buffer for draw primitive. /// <param name="_handle">Dynamic index buffer.</param> /// <param name="_firstIndex">First index to render.</param> /// <param name="_numIndices">Number of indices to render.</param> pub extern fn bgfx_encoder_set_dynamic_index_buffer(self: [*c]Encoder, handle: DynamicIndexBufferHandle, firstIndex: u32, numIndices: u32) callconv(.C) void; /// Set index buffer for draw primitive. /// <param name="_tib">Transient index buffer.</param> /// <param name="_firstIndex">First index to render.</param> /// <param name="_numIndices">Number of indices to render.</param> pub extern fn bgfx_encoder_set_transient_index_buffer(self: [*c]Encoder, tib: [*c]TransientIndexBuffer, firstIndex: u32, numIndices: u32) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_handle">Vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> pub extern fn bgfx_encoder_set_vertex_buffer(self: [*c]Encoder, stream: u8, handle: VertexBufferHandle, startVertex: u32, numVertices: u32) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_handle">Vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> /// <param name="_layoutHandle">Vertex layout for aliasing vertex buffer. If invalid handle is used, vertex layout used for creation of vertex buffer will be used.</param> pub extern fn bgfx_encoder_set_vertex_buffer_with_layout(self: [*c]Encoder, stream: u8, handle: VertexBufferHandle, startVertex: u32, numVertices: u32, layoutHandle: VertexLayoutHandle) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_handle">Dynamic vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> pub extern fn bgfx_encoder_set_dynamic_vertex_buffer(self: [*c]Encoder, stream: u8, handle: DynamicVertexBufferHandle, startVertex: u32, numVertices: u32) callconv(.C) void; pub extern fn bgfx_encoder_set_dynamic_vertex_buffer_with_layout(self: [*c]Encoder, stream: u8, handle: DynamicVertexBufferHandle, startVertex: u32, numVertices: u32, layoutHandle: VertexLayoutHandle) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_tvb">Transient vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> pub extern fn bgfx_encoder_set_transient_vertex_buffer(self: [*c]Encoder, stream: u8, tvb: [*c]TransientVertexBuffer, startVertex: u32, numVertices: u32) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_tvb">Transient vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> /// <param name="_layoutHandle">Vertex layout for aliasing vertex buffer. If invalid handle is used, vertex layout used for creation of vertex buffer will be used.</param> pub extern fn bgfx_encoder_set_transient_vertex_buffer_with_layout(self: [*c]Encoder, stream: u8, tvb: [*c]TransientVertexBuffer, startVertex: u32, numVertices: u32, layoutHandle: VertexLayoutHandle) callconv(.C) void; /// Set number of vertices for auto generated vertices use in conjunction /// with gl_VertexID. /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. /// <param name="_numVertices">Number of vertices.</param> pub extern fn bgfx_encoder_set_vertex_count(self: [*c]Encoder, numVertices: u32) callconv(.C) void; /// Set instance data buffer for draw primitive. /// <param name="_idb">Transient instance data buffer.</param> /// <param name="_start">First instance data.</param> /// <param name="_num">Number of data instances.</param> pub extern fn bgfx_encoder_set_instance_data_buffer(self: [*c]Encoder, idb: [*c]InstanceDataBuffer, start: u32, num: u32) callconv(.C) void; /// Set instance data buffer for draw primitive. /// <param name="_handle">Vertex buffer.</param> /// <param name="_startVertex">First instance data.</param> /// <param name="_num">Number of data instances. Set instance data buffer for draw primitive.</param> pub extern fn bgfx_encoder_set_instance_data_from_vertex_buffer(self: [*c]Encoder, handle: VertexBufferHandle, startVertex: u32, num: u32) callconv(.C) void; /// Set instance data buffer for draw primitive. /// <param name="_handle">Dynamic vertex buffer.</param> /// <param name="_startVertex">First instance data.</param> /// <param name="_num">Number of data instances.</param> pub extern fn bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(self: [*c]Encoder, handle: DynamicVertexBufferHandle, startVertex: u32, num: u32) callconv(.C) void; /// Set number of instances for auto generated instances use in conjunction /// with gl_InstanceID. /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. pub extern fn bgfx_encoder_set_instance_count(self: [*c]Encoder, numInstances: u32) callconv(.C) void; /// Set texture stage for draw primitive. /// <param name="_stage">Texture unit.</param> /// <param name="_sampler">Program sampler.</param> /// <param name="_handle">Texture handle.</param> /// <param name="_flags">Texture sampling mode. Default value UINT32_MAX uses texture sampling settings from the texture. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> pub extern fn bgfx_encoder_set_texture(self: [*c]Encoder, stage: u8, sampler: UniformHandle, handle: TextureHandle, flags: u32) callconv(.C) void; /// Submit an empty primitive for rendering. Uniforms and draw state /// will be applied but no geometry will be submitted. Useful in cases /// when no other draw/compute primitive is submitted to view, but it's /// desired to execute clear view. /// @remark /// These empty draw calls will sort before ordinary draw calls. /// <param name="_id">View id.</param> pub extern fn bgfx_encoder_touch(self: [*c]Encoder, id: u16) callconv(.C) void; /// Submit primitive for rendering. /// <param name="_id">View id.</param> /// <param name="_program">Program.</param> /// <param name="_depth">Depth for sorting.</param> /// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_encoder_submit(self: [*c]Encoder, id: u16, program: ProgramHandle, depth: u32, flags: u8) callconv(.C) void; /// Submit primitive with occlusion query for rendering. /// <param name="_id">View id.</param> /// <param name="_program">Program.</param> /// <param name="_occlusionQuery">Occlusion query.</param> /// <param name="_depth">Depth for sorting.</param> /// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_encoder_submit_occlusion_query(self: [*c]Encoder, id: u16, program: ProgramHandle, occlusionQuery: OcclusionQueryHandle, depth: u32, flags: u8) callconv(.C) void; /// Submit primitive for rendering with index and instance data info from /// indirect buffer. /// <param name="_id">View id.</param> /// <param name="_program">Program.</param> /// <param name="_indirectHandle">Indirect buffer.</param> /// <param name="_start">First element in indirect buffer.</param> /// <param name="_num">Number of dispatches.</param> /// <param name="_depth">Depth for sorting.</param> /// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_encoder_submit_indirect(self: [*c]Encoder, id: u16, program: ProgramHandle, indirectHandle: IndirectBufferHandle, start: u16, num: u16, depth: u32, flags: u8) callconv(.C) void; /// Set compute index buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Index buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_encoder_set_compute_index_buffer(self: [*c]Encoder, stage: u8, handle: IndexBufferHandle, access: Access) callconv(.C) void; /// Set compute vertex buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Vertex buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_encoder_set_compute_vertex_buffer(self: [*c]Encoder, stage: u8, handle: VertexBufferHandle, access: Access) callconv(.C) void; /// Set compute dynamic index buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Dynamic index buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_encoder_set_compute_dynamic_index_buffer(self: [*c]Encoder, stage: u8, handle: DynamicIndexBufferHandle, access: Access) callconv(.C) void; /// Set compute dynamic vertex buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Dynamic vertex buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_encoder_set_compute_dynamic_vertex_buffer(self: [*c]Encoder, stage: u8, handle: DynamicVertexBufferHandle, access: Access) callconv(.C) void; /// Set compute indirect buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Indirect buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_encoder_set_compute_indirect_buffer(self: [*c]Encoder, stage: u8, handle: IndirectBufferHandle, access: Access) callconv(.C) void; /// Set compute image from texture. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Texture handle.</param> /// <param name="_mip">Mip level.</param> /// <param name="_access">Image access. See `Access::Enum`.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> pub extern fn bgfx_encoder_set_image(self: [*c]Encoder, stage: u8, handle: TextureHandle, mip: u8, access: Access, format: TextureFormat) callconv(.C) void; /// Dispatch compute. /// <param name="_id">View id.</param> /// <param name="_program">Compute program.</param> /// <param name="_numX">Number of groups X.</param> /// <param name="_numY">Number of groups Y.</param> /// <param name="_numZ">Number of groups Z.</param> /// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_encoder_dispatch(self: [*c]Encoder, id: u16, program: ProgramHandle, numX: u32, numY: u32, numZ: u32, flags: u8) callconv(.C) void; /// Dispatch compute indirect. /// <param name="_id">View id.</param> /// <param name="_program">Compute program.</param> /// <param name="_indirectHandle">Indirect buffer.</param> /// <param name="_start">First element in indirect buffer.</param> /// <param name="_num">Number of dispatches.</param> /// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_encoder_dispatch_indirect(self: [*c]Encoder, id: u16, program: ProgramHandle, indirectHandle: IndirectBufferHandle, start: u16, num: u16, flags: u8) callconv(.C) void; /// Discard previously set state for draw or compute call. /// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_encoder_discard(self: [*c]Encoder, flags: u8) callconv(.C) void; /// Blit 2D texture region between two 2D textures. /// @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. /// <param name="_id">View id.</param> /// <param name="_dst">Destination texture handle.</param> /// <param name="_dstMip">Destination texture mip level.</param> /// <param name="_dstX">Destination texture X position.</param> /// <param name="_dstY">Destination texture Y position.</param> /// <param name="_dstZ">If texture is 2D this argument should be 0. If destination texture is cube this argument represents destination texture cube face. For 3D texture this argument represents destination texture Z position.</param> /// <param name="_src">Source texture handle.</param> /// <param name="_srcMip">Source texture mip level.</param> /// <param name="_srcX">Source texture X position.</param> /// <param name="_srcY">Source texture Y position.</param> /// <param name="_srcZ">If texture is 2D this argument should be 0. If source texture is cube this argument represents source texture cube face. For 3D texture this argument represents source texture Z position.</param> /// <param name="_width">Width of region.</param> /// <param name="_height">Height of region.</param> /// <param name="_depth">If texture is 3D this argument represents depth of region, otherwise it's unused.</param> pub extern fn bgfx_encoder_blit(self: [*c]Encoder, id: u16, dst: TextureHandle, dstMip: u8, dstX: u16, dstY: u16, dstZ: u16, src: TextureHandle, srcMip: u8, srcX: u16, srcY: u16, srcZ: u16, width: u16, height: u16, depth: u16) callconv(.C) void; /// Request screen shot of window back buffer. /// @remarks /// `bgfx::CallbackI::screenShot` must be implemented. /// @attention Frame buffer handle must be created with OS' target native window handle. /// <param name="_handle">Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be made for main window back buffer.</param> /// <param name="_filePath">Will be passed to `bgfx::CallbackI::screenShot` callback.</param> pub extern fn bgfx_request_screen_shot(handle: FrameBufferHandle, filePath: [*c]const u8) callconv(.C) void; /// Render frame. /// @attention `bgfx::renderFrame` is blocking call. It waits for /// `bgfx::frame` to be called from API thread to process frame. /// If timeout value is passed call will timeout and return even /// if `bgfx::frame` is not called. /// @warning This call should be only used on platforms that don't /// allow creating separate rendering thread. If it is called before /// to bgfx::init, render thread won't be created by bgfx::init call. /// <param name="_msecs">Timeout in milliseconds.</param> pub extern fn bgfx_render_frame(msecs: i32) callconv(.C) RenderFrame; /// Set platform data. /// @warning Must be called before `bgfx::init`. /// <param name="_data">Platform data.</param> pub extern fn bgfx_set_platform_data(data: [*c]PlatformData) callconv(.C) void; /// Get internal data for interop. /// @attention It's expected you understand some bgfx internals before you /// use this call. /// @warning Must be called only on render thread. pub extern fn bgfx_get_internal_data() callconv(.C) [*c]InternalData; /// Override internal texture with externally created texture. Previously /// created internal texture will released. /// @attention It's expected you understand some bgfx internals before you /// use this call. /// @warning Must be called only on render thread. /// <param name="_handle">Texture handle.</param> /// <param name="_ptr">Native API pointer to texture.</param> pub extern fn bgfx_override_internal_texture_ptr(handle: TextureHandle, ptr: usize) callconv(.C) usize; /// Override internal texture by creating new texture. Previously created /// internal texture will released. /// @attention It's expected you understand some bgfx internals before you /// use this call. /// @returns Native API pointer to texture. If result is 0, texture is not created yet from the /// main thread. /// @warning Must be called only on render thread. /// <param name="_handle">Texture handle.</param> /// <param name="_width">Width.</param> /// <param name="_height">Height.</param> /// <param name="_numMips">Number of mip-maps.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> /// <param name="_flags">Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) flags. Default texture sampling mode is linear, and wrap mode is repeat. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> pub extern fn bgfx_override_internal_texture(handle: TextureHandle, width: u16, height: u16, numMips: u8, format: TextureFormat, flags: u64) callconv(.C) usize; /// Sets a debug marker. This allows you to group graphics calls together for easy browsing in /// graphics debugging tools. /// <param name="_marker">Marker string.</param> pub extern fn bgfx_set_marker(marker: [*c]const u8) callconv(.C) void; /// Set render states for draw primitive. /// @remarks /// 1. To set up more complex states use: /// `BGFX_STATE_ALPHA_REF(_ref)`, /// `BGFX_STATE_POINT_SIZE(_size)`, /// `BGFX_STATE_BLEND_FUNC(_src, _dst)`, /// `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, /// `BGFX_STATE_BLEND_EQUATION(_equation)`, /// `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` /// 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend /// equation is specified. /// <param name="_state">State flags. Default state for primitive type is triangles. See: `BGFX_STATE_DEFAULT`. - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. - `BGFX_STATE_CULL_*` - Backface culling mode. - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.</param> /// <param name="_rgba">Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and `BGFX_STATE_BLEND_INV_FACTOR` blend modes.</param> pub extern fn bgfx_set_state(state: u64, rgba: u32) callconv(.C) void; /// Set condition for rendering. /// <param name="_handle">Occlusion query handle.</param> /// <param name="_visible">Render if occlusion query is visible.</param> pub extern fn bgfx_set_condition(handle: OcclusionQueryHandle, visible: bool) callconv(.C) void; /// Set stencil test state. /// <param name="_fstencil">Front stencil state.</param> /// <param name="_bstencil">Back stencil state. If back is set to `BGFX_STENCIL_NONE` _fstencil is applied to both front and back facing primitives.</param> pub extern fn bgfx_set_stencil(fstencil: u32, bstencil: u32) callconv(.C) void; /// Set scissor for draw primitive. /// @remark /// To scissor for all primitives in view see `bgfx::setViewScissor`. /// <param name="_x">Position x from the left corner of the window.</param> /// <param name="_y">Position y from the top corner of the window.</param> /// <param name="_width">Width of view scissor region.</param> /// <param name="_height">Height of view scissor region.</param> pub extern fn bgfx_set_scissor(x: u16, y: u16, width: u16, height: u16) callconv(.C) u16; /// Set scissor from cache for draw primitive. /// @remark /// To scissor for all primitives in view see `bgfx::setViewScissor`. /// <param name="_cache">Index in scissor cache.</param> pub extern fn bgfx_set_scissor_cached(cache: u16) callconv(.C) void; /// Set model matrix for draw primitive. If it is not called, /// the model will be rendered with an identity model matrix. /// <param name="_mtx">Pointer to first matrix in array.</param> /// <param name="_num">Number of matrices in array.</param> pub extern fn bgfx_set_transform(mtx: ?*anyopaque, num: u16) callconv(.C) u32; /// Set model matrix from matrix cache for draw primitive. /// <param name="_cache">Index in matrix cache.</param> /// <param name="_num">Number of matrices from cache.</param> pub extern fn bgfx_set_transform_cached(cache: u32, num: u16) callconv(.C) void; /// Reserve matrices in internal matrix cache. /// @attention Pointer returned can be modified until `bgfx::frame` is called. /// <param name="_transform">Pointer to `Transform` structure.</param> /// <param name="_num">Number of matrices.</param> pub extern fn bgfx_alloc_transform(transform: [*c]Transform, num: u16) callconv(.C) u32; /// Set shader uniform parameter for draw primitive. /// <param name="_handle">Uniform.</param> /// <param name="_value">Pointer to uniform data.</param> /// <param name="_num">Number of elements. Passing `UINT16_MAX` will use the _num passed on uniform creation.</param> pub extern fn bgfx_set_uniform(handle: UniformHandle, value: ?*anyopaque, num: u16) callconv(.C) void; /// Set index buffer for draw primitive. /// <param name="_handle">Index buffer.</param> /// <param name="_firstIndex">First index to render.</param> /// <param name="_numIndices">Number of indices to render.</param> pub extern fn bgfx_set_index_buffer(handle: IndexBufferHandle, firstIndex: u32, numIndices: u32) callconv(.C) void; /// Set index buffer for draw primitive. /// <param name="_handle">Dynamic index buffer.</param> /// <param name="_firstIndex">First index to render.</param> /// <param name="_numIndices">Number of indices to render.</param> pub extern fn bgfx_set_dynamic_index_buffer(handle: DynamicIndexBufferHandle, firstIndex: u32, numIndices: u32) callconv(.C) void; /// Set index buffer for draw primitive. /// <param name="_tib">Transient index buffer.</param> /// <param name="_firstIndex">First index to render.</param> /// <param name="_numIndices">Number of indices to render.</param> pub extern fn bgfx_set_transient_index_buffer(tib: [*c]TransientIndexBuffer, firstIndex: u32, numIndices: u32) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_handle">Vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> pub extern fn bgfx_set_vertex_buffer(stream: u8, handle: VertexBufferHandle, startVertex: u32, numVertices: u32) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_handle">Vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> /// <param name="_layoutHandle">Vertex layout for aliasing vertex buffer. If invalid handle is used, vertex layout used for creation of vertex buffer will be used.</param> pub extern fn bgfx_set_vertex_buffer_with_layout(stream: u8, handle: VertexBufferHandle, startVertex: u32, numVertices: u32, layoutHandle: VertexLayoutHandle) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_handle">Dynamic vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> pub extern fn bgfx_set_dynamic_vertex_buffer(stream: u8, handle: DynamicVertexBufferHandle, startVertex: u32, numVertices: u32) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_handle">Dynamic vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> /// <param name="_layoutHandle">Vertex layout for aliasing vertex buffer. If invalid handle is used, vertex layout used for creation of vertex buffer will be used.</param> pub extern fn bgfx_set_dynamic_vertex_buffer_with_layout(stream: u8, handle: DynamicVertexBufferHandle, startVertex: u32, numVertices: u32, layoutHandle: VertexLayoutHandle) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_tvb">Transient vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> pub extern fn bgfx_set_transient_vertex_buffer(stream: u8, tvb: [*c]TransientVertexBuffer, startVertex: u32, numVertices: u32) callconv(.C) void; /// Set vertex buffer for draw primitive. /// <param name="_stream">Vertex stream.</param> /// <param name="_tvb">Transient vertex buffer.</param> /// <param name="_startVertex">First vertex to render.</param> /// <param name="_numVertices">Number of vertices to render.</param> /// <param name="_layoutHandle">Vertex layout for aliasing vertex buffer. If invalid handle is used, vertex layout used for creation of vertex buffer will be used.</param> pub extern fn bgfx_set_transient_vertex_buffer_with_layout(stream: u8, tvb: [*c]TransientVertexBuffer, startVertex: u32, numVertices: u32, layoutHandle: VertexLayoutHandle) callconv(.C) void; /// Set number of vertices for auto generated vertices use in conjunction /// with gl_VertexID. /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. /// <param name="_numVertices">Number of vertices.</param> pub extern fn bgfx_set_vertex_count(numVertices: u32) callconv(.C) void; /// Set instance data buffer for draw primitive. /// <param name="_idb">Transient instance data buffer.</param> /// <param name="_start">First instance data.</param> /// <param name="_num">Number of data instances.</param> pub extern fn bgfx_set_instance_data_buffer(idb: [*c]InstanceDataBuffer, start: u32, num: u32) callconv(.C) void; /// Set instance data buffer for draw primitive. /// <param name="_handle">Vertex buffer.</param> /// <param name="_startVertex">First instance data.</param> /// <param name="_num">Number of data instances. Set instance data buffer for draw primitive.</param> pub extern fn bgfx_set_instance_data_from_vertex_buffer(handle: VertexBufferHandle, startVertex: u32, num: u32) callconv(.C) void; /// Set instance data buffer for draw primitive. /// <param name="_handle">Dynamic vertex buffer.</param> /// <param name="_startVertex">First instance data.</param> /// <param name="_num">Number of data instances.</param> pub extern fn bgfx_set_instance_data_from_dynamic_vertex_buffer(handle: DynamicVertexBufferHandle, startVertex: u32, num: u32) callconv(.C) void; /// Set number of instances for auto generated instances use in conjunction /// with gl_InstanceID. /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. pub extern fn bgfx_set_instance_count(numInstances: u32) callconv(.C) void; /// Set texture stage for draw primitive. /// <param name="_stage">Texture unit.</param> /// <param name="_sampler">Program sampler.</param> /// <param name="_handle">Texture handle.</param> /// <param name="_flags">Texture sampling mode. Default value UINT32_MAX uses texture sampling settings from the texture. - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap mode. - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic sampling.</param> pub extern fn bgfx_set_texture(stage: u8, sampler: UniformHandle, handle: TextureHandle, flags: u32) callconv(.C) void; /// Submit an empty primitive for rendering. Uniforms and draw state /// will be applied but no geometry will be submitted. /// @remark /// These empty draw calls will sort before ordinary draw calls. /// <param name="_id">View id.</param> pub extern fn bgfx_touch(id: u16) callconv(.C) void; /// Submit primitive for rendering. /// <param name="_id">View id.</param> /// <param name="_program">Program.</param> /// <param name="_depth">Depth for sorting.</param> /// <param name="_flags">Which states to discard for next draw. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_submit(id: u16, program: ProgramHandle, depth: u32, flags: u8) callconv(.C) void; /// Submit primitive with occlusion query for rendering. /// <param name="_id">View id.</param> /// <param name="_program">Program.</param> /// <param name="_occlusionQuery">Occlusion query.</param> /// <param name="_depth">Depth for sorting.</param> /// <param name="_flags">Which states to discard for next draw. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_submit_occlusion_query(id: u16, program: ProgramHandle, occlusionQuery: OcclusionQueryHandle, depth: u32, flags: u8) callconv(.C) void; /// Submit primitive for rendering with index and instance data info from /// indirect buffer. /// <param name="_id">View id.</param> /// <param name="_program">Program.</param> /// <param name="_indirectHandle">Indirect buffer.</param> /// <param name="_start">First element in indirect buffer.</param> /// <param name="_num">Number of dispatches.</param> /// <param name="_depth">Depth for sorting.</param> /// <param name="_flags">Which states to discard for next draw. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_submit_indirect(id: u16, program: ProgramHandle, indirectHandle: IndirectBufferHandle, start: u16, num: u16, depth: u32, flags: u8) callconv(.C) void; /// Set compute index buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Index buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_set_compute_index_buffer(stage: u8, handle: IndexBufferHandle, access: Access) callconv(.C) void; /// Set compute vertex buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Vertex buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_set_compute_vertex_buffer(stage: u8, handle: VertexBufferHandle, access: Access) callconv(.C) void; /// Set compute dynamic index buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Dynamic index buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_set_compute_dynamic_index_buffer(stage: u8, handle: DynamicIndexBufferHandle, access: Access) callconv(.C) void; /// Set compute dynamic vertex buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Dynamic vertex buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_set_compute_dynamic_vertex_buffer(stage: u8, handle: DynamicVertexBufferHandle, access: Access) callconv(.C) void; /// Set compute indirect buffer. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Indirect buffer handle.</param> /// <param name="_access">Buffer access. See `Access::Enum`.</param> pub extern fn bgfx_set_compute_indirect_buffer(stage: u8, handle: IndirectBufferHandle, access: Access) callconv(.C) void; /// Set compute image from texture. /// <param name="_stage">Compute stage.</param> /// <param name="_handle">Texture handle.</param> /// <param name="_mip">Mip level.</param> /// <param name="_access">Image access. See `Access::Enum`.</param> /// <param name="_format">Texture format. See: `TextureFormat::Enum`.</param> pub extern fn bgfx_set_image(stage: u8, handle: TextureHandle, mip: u8, access: Access, format: TextureFormat) callconv(.C) void; /// Dispatch compute. /// <param name="_id">View id.</param> /// <param name="_program">Compute program.</param> /// <param name="_numX">Number of groups X.</param> /// <param name="_numY">Number of groups Y.</param> /// <param name="_numZ">Number of groups Z.</param> /// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_dispatch(id: u16, program: ProgramHandle, numX: u32, numY: u32, numZ: u32, flags: u8) callconv(.C) void; /// Dispatch compute indirect. /// <param name="_id">View id.</param> /// <param name="_program">Compute program.</param> /// <param name="_indirectHandle">Indirect buffer.</param> /// <param name="_start">First element in indirect buffer.</param> /// <param name="_num">Number of dispatches.</param> /// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param> pub extern fn bgfx_dispatch_indirect(id: u16, program: ProgramHandle, indirectHandle: IndirectBufferHandle, start: u16, num: u16, flags: u8) callconv(.C) void; /// Discard previously set state for draw or compute call. /// <param name="_flags">Draw/compute states to discard.</param> pub extern fn bgfx_discard(flags: u8) callconv(.C) void; /// Blit 2D texture region between two 2D textures. /// @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. /// <param name="_id">View id.</param> /// <param name="_dst">Destination texture handle.</param> /// <param name="_dstMip">Destination texture mip level.</param> /// <param name="_dstX">Destination texture X position.</param> /// <param name="_dstY">Destination texture Y position.</param> /// <param name="_dstZ">If texture is 2D this argument should be 0. If destination texture is cube this argument represents destination texture cube face. For 3D texture this argument represents destination texture Z position.</param> /// <param name="_src">Source texture handle.</param> /// <param name="_srcMip">Source texture mip level.</param> /// <param name="_srcX">Source texture X position.</param> /// <param name="_srcY">Source texture Y position.</param> /// <param name="_srcZ">If texture is 2D this argument should be 0. If source texture is cube this argument represents source texture cube face. For 3D texture this argument represents source texture Z position.</param> /// <param name="_width">Width of region.</param> /// <param name="_height">Height of region.</param> /// <param name="_depth">If texture is 3D this argument represents depth of region, otherwise it's unused.</param> pub extern fn bgfx_blit(id: u16, dst: TextureHandle, dstMip: u8, dstX: u16, dstY: u16, dstZ: u16, src: TextureHandle, srcMip: u8, srcX: u16, srcY: u16, srcZ: u16, width: u16, height: u16, depth: u16) callconv(.C) void;
bindings/zig/bgfx.zig
const upaya = @import("upaya.zig"); usingnamespace upaya.imgui; pub fn setTintColor(color: ImVec4) void { var colors = &igGetStyle().Colors; colors[ImGuiCol_FrameBg] = hsvShiftColor(color, 0, 0, -0.2); colors[ImGuiCol_Border] = hsvShiftColor(color, 0, 0, -0.2); const header = hsvShiftColor(color, 0, -0.2, 0); colors[ImGuiCol_Header] = header; colors[ImGuiCol_HeaderHovered] = hsvShiftColor(header, 0, 0, 0.1); colors[ImGuiCol_HeaderActive] = hsvShiftColor(header, 0, 0, -0.1); const title = hsvShiftColor(color, 0, 0.1, 0); colors[ImGuiCol_TitleBg] = title; colors[ImGuiCol_TitleBgActive] = title; const tab = hsvShiftColor(color, 0, 0.1, 0); colors[ImGuiCol_Tab] = tab; colors[ImGuiCol_TabActive] = hsvShiftColor(tab, 0.05, 0.2, 0.2); colors[ImGuiCol_TabHovered] = hsvShiftColor(tab, 0.02, 0.1, 0.2); colors[ImGuiCol_TabUnfocused] = hsvShiftColor(tab, 0, -0.1, 0); colors[ImGuiCol_TabUnfocusedActive] = colors[ImGuiCol_TabActive]; const button = hsvShiftColor(color, -0.05, 0, 0); colors[ImGuiCol_Button] = button; colors[ImGuiCol_ButtonHovered] = hsvShiftColor(button, 0, 0, 0.1); colors[ImGuiCol_ButtonActive] = hsvShiftColor(button, 0, 0, -0.1); } pub fn hsvShiftColor(color: ImVec4, h_shift: f32, s_shift: f32, v_shift: f32) ImVec4 { var h: f32 = undefined; var s: f32 = undefined; var v: f32 = undefined; igColorConvertRGBtoHSV(color.x, color.y, color.z, &h, &s, &v); h += h_shift; s += s_shift; v += v_shift; var out_color = color; igColorConvertHSVtoRGB(h, s, v, &out_color.x, &out_color.y, &out_color.z); return out_color; } pub fn rgbToU32(r: i32, g: i32, b: i32) ImU32 { return ogColorConvertFloat4ToU32(.{ .x = @intToFloat(f32, r) / 255, .y = @intToFloat(f32, g) / 255, .z = @intToFloat(f32, b) / 255, .w = 1 }); } pub fn rgbToVec4(r: i32, g: i32, b: i32) ImVec4 { return .{ .x = @intToFloat(f32, r) / 255, .y = @intToFloat(f32, g) / 255, .z = @intToFloat(f32, b) / 255, .w = 1 }; } pub fn rgbaToU32(r: i32, g: i32, b: i32, a: i32) ImU32 { return ogColorConvertFloat4ToU32(.{ .x = @intToFloat(f32, r) / 255, .y = @intToFloat(f32, g) / 255, .z = @intToFloat(f32, b) / 255, .w = @intToFloat(f32, a) / 255 }); } pub fn rgbaToVec4(r: i32, g: i32, b: i32, a: i32) ImVec4 { return .{ .x = @intToFloat(f32, r) / 255, .y = @intToFloat(f32, g) / 255, .z = @intToFloat(f32, b) / 255, .w = @intToFloat(f32, a) }; }
src/colors.zig
const std = @import("std"); const fs = std.fs; const mem = @import("std").mem; const assert = std.debug.assert; const expect = std.testing.expect; // Simulator: http://spacetech.github.io/LC3Simulator/ // https://wchargin.com/lc3web/ // Specification: https://justinmeiners.github.io/lc3-vm/supplies/lc3-isa.pdf const memory_size = 65536; const program_start_offset = 0x3000; const Reg = enum(u16) { R0 = 0, R1, R2, R3, R4, R5, R6, R7, PC, COND, COUNT }; const Op = enum(u16) { // branch BR = 0, // add ADD, // load LD, // store ST, // jump register JSR, // bitwise and AND, // load register LDR, // store register STR, // unused RTI, // bitwise not NOT, // load indirect LDI, // store indirect STI, // jump JMP, // reserved (unused) RES, // load effective address LEA, // execute trap TRAP }; const Flag = enum(u8) { POS = 1 << 0, ZRO = 1 << 1, NEG = 1 << 2, }; fn sign_extend(val: u16, comptime bit_count: u16) u16 { var extended: u16 = val; // When negative sign, extend with 1's to maintain "negative" values. if (extended & (1 << bit_count - 1) > 0) { extended |= @truncate(u16, (0xFFFF << bit_count)); return extended; } return extended; } const LC3 = struct { running: bool = false, memory: [memory_size]u16 = undefined, reg: [@enumToInt(Reg.COUNT)]u16 = undefined, pub fn init() LC3 { var lc3 = LC3{}; lc3.reset(); return lc3; } pub fn reset(self: *LC3) void { self.running = false; self.memory = [_]u16{0} ** memory_size; self.reg = [_]u16{0} ** @enumToInt(Reg.COUNT); self.reg[@enumToInt(Reg.PC)] = program_start_offset; self.reg[@enumToInt(Reg.COND)] = @enumToInt(Flag.ZRO); } pub fn load_rom(self: *LC3) !void { var f = try fs.cwd().openFile("src/roms/rogue.obj", .{}); defer f.close(); var buf_reader = std.io.bufferedReader(f.reader()); var in_stream = buf_reader.reader(); var buf: [1024]u8 = undefined; var offset: usize = 0; while (try in_stream.readUntilDelimiterOrEof(&buf, '\n')) |line| { for (line) |val| { self.memory[program_start_offset + offset] = val; offset += 1; } } } pub fn update_flags(self: *LC3, r: u16) void { if (self.reg[r] == 0) { self.reg[@enumToInt(Reg.COND)] = @enumToInt(Flag.ZRO); } else if ((self.reg[r] >> 15) > 0) { self.reg[@enumToInt(Reg.COND)] = @enumToInt(Flag.NEG); } else { self.reg[@enumToInt(Reg.COND)] = @enumToInt(Flag.POS); } } pub fn dump_registers(self: *LC3) void { std.debug.warn("\n", .{}); var i: usize = 0; while (i < self.reg.len) : (i += 1) { std.debug.warn(" reg[{d}] => {d}/{d}/({x})\n", .{ i, self.reg[i], @bitCast(i16, self.reg[i]), self.reg[i] }); } } pub fn start(self: *LC3) void { self.running = true; while (self.running) { const instr = self.memory[self.reg[@enumToInt(Reg.PC)]]; self.reg[@enumToInt(Reg.PC)] = self.reg[@enumToInt(Reg.PC)] + 1; const op = @intToEnum(Op, instr >> 12); switch (op) { .ADD => self.op_add(instr), .LD => self.op_ld(instr), .JMP => self.op_jmp(instr), .AND => self.op_and(instr), .NOT => self.op_not(instr), .LDI => self.op_ldi(instr), .RES => self.op_ignore(instr), .RTI => self.op_ignore(instr), .BR => self.op_branch(instr), // TODO ops. .ST => self.op_nop(instr), .JSR => self.op_nop(instr), .LDR => self.op_nop(instr), .STR => self.op_nop(instr), .STI => self.op_nop(instr), .LEA => self.op_nop(instr), .TRAP => self.op_nop(instr), } } } pub fn op_ignore(_: *LC3, _: u16) void { @panic("instruction not implemented by design!"); } pub fn op_nop(_: *LC3, _: u16) void {} pub fn op_not(self: *LC3, instr: u16) void { const dr = (instr >> 9) & 0x7; const lr = (instr >> 6) & 0x7; self.reg[dr] = ~self.reg[lr]; self.update_flags(dr); } pub fn op_add(self: *LC3, instr: u16) void { const dr = (instr >> 9) & 0x7; const lr = (instr >> 6) & 0x7; const imm_mode = (instr >> 5) & 0x1; if (imm_mode > 0) { const imm5 = sign_extend(instr & 0x1f, 5); self.reg[dr] = self.reg[lr] + imm5; } else { const rr = instr & 0x7; self.reg[dr] = self.reg[lr] + self.reg[rr]; } self.update_flags(dr); } pub fn op_and(self: *LC3, instr: u16) void { const dr = (instr >> 9) & 0x7; const lr = (instr >> 6) & 0x7; const imm_mode = (instr >> 5) & 0x1; if (imm_mode > 0) { const imm5 = sign_extend(instr & 0x1f, 5); self.reg[dr] = self.reg[lr] & imm5; } else { const rr = instr & 0x7; self.reg[dr] = self.reg[lr] & self.reg[rr]; } self.update_flags(dr); } pub fn op_jmp(self: *LC3, instr: u16) void { // per the docs, JMP is also a stand-in for RET via r7 done by assemblers. const jr = self.reg[(instr >> 6) & 0x7]; self.reg[@enumToInt(Reg.PC)] = jr; } pub fn op_ld(self: *LC3, instr: u16) void { const dr = (instr >> 9) & 0x7; const pc_offset = sign_extend(instr & 0x1ff, 9); self.reg[dr] = self.memory[self.reg[@enumToInt(Reg.PC)] + pc_offset]; self.update_flags(dr); } pub fn op_ldi(self: *LC3, instr: u16) void { const dr = (instr >> 9) & 0x7; const pc_offset = sign_extend(instr & 0x1ff, 9); self.reg[dr] = self.memory[self.memory[self.reg[@enumToInt(Reg.PC)] + pc_offset]]; self.update_flags(dr); } pub fn op_branch(self: *LC3, instr: u16) void { const cond_flag = (instr >> 9) & 0x7; if (cond_flag & self.reg[@enumToInt(Reg.PC)]) { const pc_offset = sign_extend(instr & 0x1ff, 9); self.reg[@enumToInt(Reg.PC)] = self.reg[@enumToInt(Reg.PC)] + pc_offset; } } }; pub fn main() anyerror!void { std.log.info("All your codebase are belong to us.", .{}); var lc3 = LC3.init(); lc3.reset(); try lc3.load_rom(); //std.log.info("dump: {s}", .{lc3}); //lc3.start(); var x: u8 = 0xfb; var y: u16 = x; std.log.info("before: {b}", .{y}); const result = sign_extend(y, 5); std.log.info("after : {b}", .{result}); } test "op_add" { var lc3 = LC3.init(); // AND R0 R0 #0 (clear to zero) lc3.op_and(0x5020); // ADD R0, R0, #1 (add immediate 1) lc3.op_add(0x1021); // ADD R0, R0, #6 (add immediate 6) lc3.op_add(0x1026); try expect(lc3.reg[0x0] == 0x7); //TODO: assert register and flag state. } test "op_not" { var lc3 = LC3.init(); lc3.op_and(0x5020); lc3.op_add(0x1026); lc3.op_not(0x903F); try expect(lc3.reg[0x0] == 0xFFF9); //TODO: assert register and flag state. }
src/main.zig
//-------------------------------------------------------------------------------- // Section: Types (92) //-------------------------------------------------------------------------------- const CLSID_MbnConnectionProfileManager_Value = Guid.initString("bdfee05a-4418-11dd-90ed-001c257ccff1"); pub const CLSID_MbnConnectionProfileManager = &CLSID_MbnConnectionProfileManager_Value; const CLSID_MbnInterfaceManager_Value = Guid.initString("bdfee05b-4418-11dd-90ed-001c257ccff1"); pub const CLSID_MbnInterfaceManager = &CLSID_MbnInterfaceManager_Value; const CLSID_MbnConnectionManager_Value = Guid.initString("bdfee05c-4418-11dd-90ed-001c257ccff1"); pub const CLSID_MbnConnectionManager = &CLSID_MbnConnectionManager_Value; const CLSID_MbnDeviceServicesManager_Value = Guid.initString("2269daa3-2a9f-4165-a501-ce00a6f7a75b"); pub const CLSID_MbnDeviceServicesManager = &CLSID_MbnDeviceServicesManager_Value; const IID_IDummyMBNUCMExt_Value = Guid.initString("dcbbbab6-ffff-4bbb-aaee-338e368af6fa"); pub const IID_IDummyMBNUCMExt = &IID_IDummyMBNUCMExt_Value; pub const IDummyMBNUCMExt = 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()); }; pub const MBN_SIGNAL_CONSTANTS = enum(i32) { RSSI_DEFAULT = -1, RSSI_DISABLE = 0, RSSI_UNKNOWN = 99, // ERROR_RATE_UNKNOWN = 99, this enum value conflicts with RSSI_UNKNOWN }; pub const MBN_RSSI_DEFAULT = MBN_SIGNAL_CONSTANTS.RSSI_DEFAULT; pub const MBN_RSSI_DISABLE = MBN_SIGNAL_CONSTANTS.RSSI_DISABLE; pub const MBN_RSSI_UNKNOWN = MBN_SIGNAL_CONSTANTS.RSSI_UNKNOWN; pub const MBN_ERROR_RATE_UNKNOWN = MBN_SIGNAL_CONSTANTS.RSSI_UNKNOWN; pub const MBN_CELLULAR_CLASS = enum(i32) { NONE = 0, GSM = 1, CDMA = 2, }; pub const MBN_CELLULAR_CLASS_NONE = MBN_CELLULAR_CLASS.NONE; pub const MBN_CELLULAR_CLASS_GSM = MBN_CELLULAR_CLASS.GSM; pub const MBN_CELLULAR_CLASS_CDMA = MBN_CELLULAR_CLASS.CDMA; pub const MBN_VOICE_CLASS = enum(i32) { NONE = 0, NO_VOICE = 1, SEPARATE_VOICE_DATA = 2, SIMULTANEOUS_VOICE_DATA = 3, }; pub const MBN_VOICE_CLASS_NONE = MBN_VOICE_CLASS.NONE; pub const MBN_VOICE_CLASS_NO_VOICE = MBN_VOICE_CLASS.NO_VOICE; pub const MBN_VOICE_CLASS_SEPARATE_VOICE_DATA = MBN_VOICE_CLASS.SEPARATE_VOICE_DATA; pub const MBN_VOICE_CLASS_SIMULTANEOUS_VOICE_DATA = MBN_VOICE_CLASS.SIMULTANEOUS_VOICE_DATA; pub const MBN_PROVIDER_STATE = enum(i32) { NONE = 0, HOME = 1, FORBIDDEN = 2, PREFERRED = 4, VISIBLE = 8, REGISTERED = 16, PREFERRED_MULTICARRIER = 32, }; pub const MBN_PROVIDER_STATE_NONE = MBN_PROVIDER_STATE.NONE; pub const MBN_PROVIDER_STATE_HOME = MBN_PROVIDER_STATE.HOME; pub const MBN_PROVIDER_STATE_FORBIDDEN = MBN_PROVIDER_STATE.FORBIDDEN; pub const MBN_PROVIDER_STATE_PREFERRED = MBN_PROVIDER_STATE.PREFERRED; pub const MBN_PROVIDER_STATE_VISIBLE = MBN_PROVIDER_STATE.VISIBLE; pub const MBN_PROVIDER_STATE_REGISTERED = MBN_PROVIDER_STATE.REGISTERED; pub const MBN_PROVIDER_STATE_PREFERRED_MULTICARRIER = MBN_PROVIDER_STATE.PREFERRED_MULTICARRIER; pub const MBN_PROVIDER_CONSTANTS = enum(i32) { NAME_LEN = 20, ID_LEN = 6, }; pub const MBN_PROVIDERNAME_LEN = MBN_PROVIDER_CONSTANTS.NAME_LEN; pub const MBN_PROVIDERID_LEN = MBN_PROVIDER_CONSTANTS.ID_LEN; pub const MBN_INTERFACE_CAPS_CONSTANTS = enum(i32) { DEVICEID_LEN = 18, MANUFACTURER_LEN = 32, // MODEL_LEN = 32, this enum value conflicts with MANUFACTURER_LEN // FIRMWARE_LEN = 32, this enum value conflicts with MANUFACTURER_LEN }; pub const MBN_DEVICEID_LEN = MBN_INTERFACE_CAPS_CONSTANTS.DEVICEID_LEN; pub const MBN_MANUFACTURER_LEN = MBN_INTERFACE_CAPS_CONSTANTS.MANUFACTURER_LEN; pub const MBN_MODEL_LEN = MBN_INTERFACE_CAPS_CONSTANTS.MANUFACTURER_LEN; pub const MBN_FIRMWARE_LEN = MBN_INTERFACE_CAPS_CONSTANTS.MANUFACTURER_LEN; pub const MBN_DATA_CLASS = enum(i32) { NONE = 0, GPRS = 1, EDGE = 2, UMTS = 4, HSDPA = 8, HSUPA = 16, LTE = 32, @"5G_NSA" = 64, @"5G_SA" = 128, @"1XRTT" = 65536, @"1XEVDO" = 131072, @"1XEVDO_REVA" = 262144, @"1XEVDV" = 524288, @"3XRTT" = 1048576, @"1XEVDO_REVB" = 2097152, UMB = 4194304, CUSTOM = -2147483648, }; pub const MBN_DATA_CLASS_NONE = MBN_DATA_CLASS.NONE; pub const MBN_DATA_CLASS_GPRS = MBN_DATA_CLASS.GPRS; pub const MBN_DATA_CLASS_EDGE = MBN_DATA_CLASS.EDGE; pub const MBN_DATA_CLASS_UMTS = MBN_DATA_CLASS.UMTS; pub const MBN_DATA_CLASS_HSDPA = MBN_DATA_CLASS.HSDPA; pub const MBN_DATA_CLASS_HSUPA = MBN_DATA_CLASS.HSUPA; pub const MBN_DATA_CLASS_LTE = MBN_DATA_CLASS.LTE; pub const MBN_DATA_CLASS_5G_NSA = MBN_DATA_CLASS.@"5G_NSA"; pub const MBN_DATA_CLASS_5G_SA = MBN_DATA_CLASS.@"5G_SA"; pub const MBN_DATA_CLASS_1XRTT = MBN_DATA_CLASS.@"1XRTT"; pub const MBN_DATA_CLASS_1XEVDO = MBN_DATA_CLASS.@"1XEVDO"; pub const MBN_DATA_CLASS_1XEVDO_REVA = MBN_DATA_CLASS.@"1XEVDO_REVA"; pub const MBN_DATA_CLASS_1XEVDV = MBN_DATA_CLASS.@"1XEVDV"; pub const MBN_DATA_CLASS_3XRTT = MBN_DATA_CLASS.@"3XRTT"; pub const MBN_DATA_CLASS_1XEVDO_REVB = MBN_DATA_CLASS.@"1XEVDO_REVB"; pub const MBN_DATA_CLASS_UMB = MBN_DATA_CLASS.UMB; pub const MBN_DATA_CLASS_CUSTOM = MBN_DATA_CLASS.CUSTOM; pub const MBN_CTRL_CAPS = enum(i32) { NONE = 0, REG_MANUAL = 1, HW_RADIO_SWITCH = 2, CDMA_MOBILE_IP = 4, CDMA_SIMPLE_IP = 8, PROTECT_UNIQUEID = 16, MODEL_MULTI_CARRIER = 32, USSD = 64, MULTI_MODE = 128, }; pub const MBN_CTRL_CAPS_NONE = MBN_CTRL_CAPS.NONE; pub const MBN_CTRL_CAPS_REG_MANUAL = MBN_CTRL_CAPS.REG_MANUAL; pub const MBN_CTRL_CAPS_HW_RADIO_SWITCH = MBN_CTRL_CAPS.HW_RADIO_SWITCH; pub const MBN_CTRL_CAPS_CDMA_MOBILE_IP = MBN_CTRL_CAPS.CDMA_MOBILE_IP; pub const MBN_CTRL_CAPS_CDMA_SIMPLE_IP = MBN_CTRL_CAPS.CDMA_SIMPLE_IP; pub const MBN_CTRL_CAPS_PROTECT_UNIQUEID = MBN_CTRL_CAPS.PROTECT_UNIQUEID; pub const MBN_CTRL_CAPS_MODEL_MULTI_CARRIER = MBN_CTRL_CAPS.MODEL_MULTI_CARRIER; pub const MBN_CTRL_CAPS_USSD = MBN_CTRL_CAPS.USSD; pub const MBN_CTRL_CAPS_MULTI_MODE = MBN_CTRL_CAPS.MULTI_MODE; pub const MBN_SMS_CAPS = enum(i32) { NONE = 0, PDU_RECEIVE = 1, PDU_SEND = 2, TEXT_RECEIVE = 4, TEXT_SEND = 8, }; pub const MBN_SMS_CAPS_NONE = MBN_SMS_CAPS.NONE; pub const MBN_SMS_CAPS_PDU_RECEIVE = MBN_SMS_CAPS.PDU_RECEIVE; pub const MBN_SMS_CAPS_PDU_SEND = MBN_SMS_CAPS.PDU_SEND; pub const MBN_SMS_CAPS_TEXT_RECEIVE = MBN_SMS_CAPS.TEXT_RECEIVE; pub const MBN_SMS_CAPS_TEXT_SEND = MBN_SMS_CAPS.TEXT_SEND; pub const MBN_BAND_CLASS = enum(i32) { NONE = 0, @"0" = 1, I = 2, II = 4, III = 8, IV = 16, V = 32, VI = 64, VII = 128, VIII = 256, IX = 512, X = 1024, XI = 2048, XII = 4096, XIII = 8192, XIV = 16384, XV = 32768, XVI = 65536, XVII = 131072, CUSTOM = -2147483648, }; pub const MBN_BAND_CLASS_NONE = MBN_BAND_CLASS.NONE; pub const MBN_BAND_CLASS_0 = MBN_BAND_CLASS.@"0"; pub const MBN_BAND_CLASS_I = MBN_BAND_CLASS.I; pub const MBN_BAND_CLASS_II = MBN_BAND_CLASS.II; pub const MBN_BAND_CLASS_III = MBN_BAND_CLASS.III; pub const MBN_BAND_CLASS_IV = MBN_BAND_CLASS.IV; pub const MBN_BAND_CLASS_V = MBN_BAND_CLASS.V; pub const MBN_BAND_CLASS_VI = MBN_BAND_CLASS.VI; pub const MBN_BAND_CLASS_VII = MBN_BAND_CLASS.VII; pub const MBN_BAND_CLASS_VIII = MBN_BAND_CLASS.VIII; pub const MBN_BAND_CLASS_IX = MBN_BAND_CLASS.IX; pub const MBN_BAND_CLASS_X = MBN_BAND_CLASS.X; pub const MBN_BAND_CLASS_XI = MBN_BAND_CLASS.XI; pub const MBN_BAND_CLASS_XII = MBN_BAND_CLASS.XII; pub const MBN_BAND_CLASS_XIII = MBN_BAND_CLASS.XIII; pub const MBN_BAND_CLASS_XIV = MBN_BAND_CLASS.XIV; pub const MBN_BAND_CLASS_XV = MBN_BAND_CLASS.XV; pub const MBN_BAND_CLASS_XVI = MBN_BAND_CLASS.XVI; pub const MBN_BAND_CLASS_XVII = MBN_BAND_CLASS.XVII; pub const MBN_BAND_CLASS_CUSTOM = MBN_BAND_CLASS.CUSTOM; pub const MBN_INTERFACE_CAPS = extern struct { cellularClass: MBN_CELLULAR_CLASS, voiceClass: MBN_VOICE_CLASS, dataClass: u32, customDataClass: ?BSTR, gsmBandClass: u32, cdmaBandClass: u32, customBandClass: ?BSTR, smsCaps: u32, controlCaps: u32, deviceID: ?BSTR, manufacturer: ?BSTR, model: ?BSTR, firmwareInfo: ?BSTR, }; pub const MBN_PROVIDER = extern struct { providerID: ?BSTR, providerState: u32, providerName: ?BSTR, dataClass: u32, }; pub const MBN_PROVIDER2 = extern struct { provider: MBN_PROVIDER, cellularClass: MBN_CELLULAR_CLASS, signalStrength: u32, signalError: u32, }; pub const MBN_READY_STATE = enum(i32) { OFF = 0, INITIALIZED = 1, SIM_NOT_INSERTED = 2, BAD_SIM = 3, FAILURE = 4, NOT_ACTIVATED = 5, DEVICE_LOCKED = 6, DEVICE_BLOCKED = 7, NO_ESIM_PROFILE = 8, }; pub const MBN_READY_STATE_OFF = MBN_READY_STATE.OFF; pub const MBN_READY_STATE_INITIALIZED = MBN_READY_STATE.INITIALIZED; pub const MBN_READY_STATE_SIM_NOT_INSERTED = MBN_READY_STATE.SIM_NOT_INSERTED; pub const MBN_READY_STATE_BAD_SIM = MBN_READY_STATE.BAD_SIM; pub const MBN_READY_STATE_FAILURE = MBN_READY_STATE.FAILURE; pub const MBN_READY_STATE_NOT_ACTIVATED = MBN_READY_STATE.NOT_ACTIVATED; pub const MBN_READY_STATE_DEVICE_LOCKED = MBN_READY_STATE.DEVICE_LOCKED; pub const MBN_READY_STATE_DEVICE_BLOCKED = MBN_READY_STATE.DEVICE_BLOCKED; pub const MBN_READY_STATE_NO_ESIM_PROFILE = MBN_READY_STATE.NO_ESIM_PROFILE; pub const MBN_ACTIVATION_STATE = enum(i32) { NONE = 0, ACTIVATED = 1, ACTIVATING = 2, DEACTIVATED = 3, DEACTIVATING = 4, }; pub const MBN_ACTIVATION_STATE_NONE = MBN_ACTIVATION_STATE.NONE; pub const MBN_ACTIVATION_STATE_ACTIVATED = MBN_ACTIVATION_STATE.ACTIVATED; pub const MBN_ACTIVATION_STATE_ACTIVATING = MBN_ACTIVATION_STATE.ACTIVATING; pub const MBN_ACTIVATION_STATE_DEACTIVATED = MBN_ACTIVATION_STATE.DEACTIVATED; pub const MBN_ACTIVATION_STATE_DEACTIVATING = MBN_ACTIVATION_STATE.DEACTIVATING; pub const MBN_CONNECTION_MODE = enum(i32) { PROFILE = 0, TMP_PROFILE = 1, }; pub const MBN_CONNECTION_MODE_PROFILE = MBN_CONNECTION_MODE.PROFILE; pub const MBN_CONNECTION_MODE_TMP_PROFILE = MBN_CONNECTION_MODE.TMP_PROFILE; pub const MBN_VOICE_CALL_STATE = enum(i32) { NONE = 0, IN_PROGRESS = 1, HANGUP = 2, }; pub const MBN_VOICE_CALL_STATE_NONE = MBN_VOICE_CALL_STATE.NONE; pub const MBN_VOICE_CALL_STATE_IN_PROGRESS = MBN_VOICE_CALL_STATE.IN_PROGRESS; pub const MBN_VOICE_CALL_STATE_HANGUP = MBN_VOICE_CALL_STATE.HANGUP; pub const MBN_REGISTRATION_CONSTANTS = enum(i32) { ROAMTEXT_LEN = 64, CDMA_DEFAULT_PROVIDER_ID = 0, }; pub const MBN_ROAMTEXT_LEN = MBN_REGISTRATION_CONSTANTS.ROAMTEXT_LEN; pub const MBN_CDMA_DEFAULT_PROVIDER_ID = MBN_REGISTRATION_CONSTANTS.CDMA_DEFAULT_PROVIDER_ID; pub const MBN_REGISTER_STATE = enum(i32) { NONE = 0, DEREGISTERED = 1, SEARCHING = 2, HOME = 3, ROAMING = 4, PARTNER = 5, DENIED = 6, }; pub const MBN_REGISTER_STATE_NONE = MBN_REGISTER_STATE.NONE; pub const MBN_REGISTER_STATE_DEREGISTERED = MBN_REGISTER_STATE.DEREGISTERED; pub const MBN_REGISTER_STATE_SEARCHING = MBN_REGISTER_STATE.SEARCHING; pub const MBN_REGISTER_STATE_HOME = MBN_REGISTER_STATE.HOME; pub const MBN_REGISTER_STATE_ROAMING = MBN_REGISTER_STATE.ROAMING; pub const MBN_REGISTER_STATE_PARTNER = MBN_REGISTER_STATE.PARTNER; pub const MBN_REGISTER_STATE_DENIED = MBN_REGISTER_STATE.DENIED; pub const MBN_REGISTER_MODE = enum(i32) { NONE = 0, AUTOMATIC = 1, MANUAL = 2, }; pub const MBN_REGISTER_MODE_NONE = MBN_REGISTER_MODE.NONE; pub const MBN_REGISTER_MODE_AUTOMATIC = MBN_REGISTER_MODE.AUTOMATIC; pub const MBN_REGISTER_MODE_MANUAL = MBN_REGISTER_MODE.MANUAL; pub const MBN_PIN_CONSTANTS = enum(i32) { ATTEMPTS_REMAINING_UNKNOWN = -1, // PIN_LENGTH_UNKNOWN = -1, this enum value conflicts with ATTEMPTS_REMAINING_UNKNOWN }; pub const MBN_ATTEMPTS_REMAINING_UNKNOWN = MBN_PIN_CONSTANTS.ATTEMPTS_REMAINING_UNKNOWN; pub const MBN_PIN_LENGTH_UNKNOWN = MBN_PIN_CONSTANTS.ATTEMPTS_REMAINING_UNKNOWN; pub const MBN_PIN_STATE = enum(i32) { NONE = 0, ENTER = 1, UNBLOCK = 2, }; pub const MBN_PIN_STATE_NONE = MBN_PIN_STATE.NONE; pub const MBN_PIN_STATE_ENTER = MBN_PIN_STATE.ENTER; pub const MBN_PIN_STATE_UNBLOCK = MBN_PIN_STATE.UNBLOCK; pub const MBN_PIN_TYPE = enum(i32) { NONE = 0, CUSTOM = 1, PIN1 = 2, PIN2 = 3, DEVICE_SIM_PIN = 4, DEVICE_FIRST_SIM_PIN = 5, NETWORK_PIN = 6, NETWORK_SUBSET_PIN = 7, SVC_PROVIDER_PIN = 8, CORPORATE_PIN = 9, SUBSIDY_LOCK = 10, }; pub const MBN_PIN_TYPE_NONE = MBN_PIN_TYPE.NONE; pub const MBN_PIN_TYPE_CUSTOM = MBN_PIN_TYPE.CUSTOM; pub const MBN_PIN_TYPE_PIN1 = MBN_PIN_TYPE.PIN1; pub const MBN_PIN_TYPE_PIN2 = MBN_PIN_TYPE.PIN2; pub const MBN_PIN_TYPE_DEVICE_SIM_PIN = MBN_PIN_TYPE.DEVICE_SIM_PIN; pub const MBN_PIN_TYPE_DEVICE_FIRST_SIM_PIN = MBN_PIN_TYPE.DEVICE_FIRST_SIM_PIN; pub const MBN_PIN_TYPE_NETWORK_PIN = MBN_PIN_TYPE.NETWORK_PIN; pub const MBN_PIN_TYPE_NETWORK_SUBSET_PIN = MBN_PIN_TYPE.NETWORK_SUBSET_PIN; pub const MBN_PIN_TYPE_SVC_PROVIDER_PIN = MBN_PIN_TYPE.SVC_PROVIDER_PIN; pub const MBN_PIN_TYPE_CORPORATE_PIN = MBN_PIN_TYPE.CORPORATE_PIN; pub const MBN_PIN_TYPE_SUBSIDY_LOCK = MBN_PIN_TYPE.SUBSIDY_LOCK; pub const MBN_PIN_INFO = extern struct { pinState: MBN_PIN_STATE, pinType: MBN_PIN_TYPE, attemptsRemaining: u32, }; pub const MBN_PIN_MODE = enum(i32) { ENABLED = 1, DISABLED = 2, }; pub const MBN_PIN_MODE_ENABLED = MBN_PIN_MODE.ENABLED; pub const MBN_PIN_MODE_DISABLED = MBN_PIN_MODE.DISABLED; pub const MBN_PIN_FORMAT = enum(i32) { NONE = 0, NUMERIC = 1, ALPHANUMERIC = 2, }; pub const MBN_PIN_FORMAT_NONE = MBN_PIN_FORMAT.NONE; pub const MBN_PIN_FORMAT_NUMERIC = MBN_PIN_FORMAT.NUMERIC; pub const MBN_PIN_FORMAT_ALPHANUMERIC = MBN_PIN_FORMAT.ALPHANUMERIC; pub const MBN_CONTEXT_CONSTANTS = enum(i32) { ACCESSSTRING_LEN = 100, USERNAME_LEN = 255, // PASSWORD_LEN = 255, this enum value conflicts with USERNAME_LEN CONTEXT_ID_APPEND = -1, }; pub const MBN_ACCESSSTRING_LEN = MBN_CONTEXT_CONSTANTS.ACCESSSTRING_LEN; pub const MBN_USERNAME_LEN = MBN_CONTEXT_CONSTANTS.USERNAME_LEN; pub const MBN_PASSWORD_LEN = MBN_CONTEXT_CONSTANTS.USERNAME_LEN; pub const MBN_CONTEXT_ID_APPEND = MBN_CONTEXT_CONSTANTS.CONTEXT_ID_APPEND; pub const MBN_AUTH_PROTOCOL = enum(i32) { NONE = 0, PAP = 1, CHAP = 2, MSCHAPV2 = 3, }; pub const MBN_AUTH_PROTOCOL_NONE = MBN_AUTH_PROTOCOL.NONE; pub const MBN_AUTH_PROTOCOL_PAP = MBN_AUTH_PROTOCOL.PAP; pub const MBN_AUTH_PROTOCOL_CHAP = MBN_AUTH_PROTOCOL.CHAP; pub const MBN_AUTH_PROTOCOL_MSCHAPV2 = MBN_AUTH_PROTOCOL.MSCHAPV2; pub const MBN_COMPRESSION = enum(i32) { NONE = 0, ENABLE = 1, }; pub const MBN_COMPRESSION_NONE = MBN_COMPRESSION.NONE; pub const MBN_COMPRESSION_ENABLE = MBN_COMPRESSION.ENABLE; pub const MBN_CONTEXT_TYPE = enum(i32) { NONE = 0, INTERNET = 1, VPN = 2, VOICE = 3, VIDEO_SHARE = 4, CUSTOM = 5, PURCHASE = 6, }; pub const MBN_CONTEXT_TYPE_NONE = MBN_CONTEXT_TYPE.NONE; pub const MBN_CONTEXT_TYPE_INTERNET = MBN_CONTEXT_TYPE.INTERNET; pub const MBN_CONTEXT_TYPE_VPN = MBN_CONTEXT_TYPE.VPN; pub const MBN_CONTEXT_TYPE_VOICE = MBN_CONTEXT_TYPE.VOICE; pub const MBN_CONTEXT_TYPE_VIDEO_SHARE = MBN_CONTEXT_TYPE.VIDEO_SHARE; pub const MBN_CONTEXT_TYPE_CUSTOM = MBN_CONTEXT_TYPE.CUSTOM; pub const MBN_CONTEXT_TYPE_PURCHASE = MBN_CONTEXT_TYPE.PURCHASE; pub const MBN_CONTEXT = extern struct { contextID: u32, contextType: MBN_CONTEXT_TYPE, accessString: ?BSTR, userName: ?BSTR, password: ?<PASSWORD>, compression: MBN_COMPRESSION, authType: MBN_AUTH_PROTOCOL, }; pub const WWAEXT_SMS_CONSTANTS = enum(i32) { MESSAGE_INDEX_NONE = 0, // CDMA_SHORT_MSG_SIZE_UNKNOWN = 0, this enum value conflicts with MESSAGE_INDEX_NONE CDMA_SHORT_MSG_SIZE_MAX = 160, }; pub const MBN_MESSAGE_INDEX_NONE = WWAEXT_SMS_CONSTANTS.MESSAGE_INDEX_NONE; pub const MBN_CDMA_SHORT_MSG_SIZE_UNKNOWN = WWAEXT_SMS_CONSTANTS.MESSAGE_INDEX_NONE; pub const MBN_CDMA_SHORT_MSG_SIZE_MAX = WWAEXT_SMS_CONSTANTS.CDMA_SHORT_MSG_SIZE_MAX; pub const MBN_MSG_STATUS = enum(i32) { NEW = 0, OLD = 1, DRAFT = 2, SENT = 3, }; pub const MBN_MSG_STATUS_NEW = MBN_MSG_STATUS.NEW; pub const MBN_MSG_STATUS_OLD = MBN_MSG_STATUS.OLD; pub const MBN_MSG_STATUS_DRAFT = MBN_MSG_STATUS.DRAFT; pub const MBN_MSG_STATUS_SENT = MBN_MSG_STATUS.SENT; pub const MBN_SMS_CDMA_LANG = enum(i32) { NONE = 0, ENGLISH = 1, FRENCH = 2, SPANISH = 3, JAPANESE = 4, KOREAN = 5, CHINESE = 6, HEBREW = 7, }; pub const MBN_SMS_CDMA_LANG_NONE = MBN_SMS_CDMA_LANG.NONE; pub const MBN_SMS_CDMA_LANG_ENGLISH = MBN_SMS_CDMA_LANG.ENGLISH; pub const MBN_SMS_CDMA_LANG_FRENCH = MBN_SMS_CDMA_LANG.FRENCH; pub const MBN_SMS_CDMA_LANG_SPANISH = MBN_SMS_CDMA_LANG.SPANISH; pub const MBN_SMS_CDMA_LANG_JAPANESE = MBN_SMS_CDMA_LANG.JAPANESE; pub const MBN_SMS_CDMA_LANG_KOREAN = MBN_SMS_CDMA_LANG.KOREAN; pub const MBN_SMS_CDMA_LANG_CHINESE = MBN_SMS_CDMA_LANG.CHINESE; pub const MBN_SMS_CDMA_LANG_HEBREW = MBN_SMS_CDMA_LANG.HEBREW; pub const MBN_SMS_CDMA_ENCODING = enum(i32) { OCTET = 0, EPM = 1, @"7BIT_ASCII" = 2, IA5 = 3, UNICODE = 4, SHIFT_JIS = 5, KOREAN = 6, LATIN_HEBREW = 7, LATIN = 8, GSM_7BIT = 9, }; pub const MBN_SMS_CDMA_ENCODING_OCTET = MBN_SMS_CDMA_ENCODING.OCTET; pub const MBN_SMS_CDMA_ENCODING_EPM = MBN_SMS_CDMA_ENCODING.EPM; pub const MBN_SMS_CDMA_ENCODING_7BIT_ASCII = MBN_SMS_CDMA_ENCODING.@"7BIT_ASCII"; pub const MBN_SMS_CDMA_ENCODING_IA5 = MBN_SMS_CDMA_ENCODING.IA5; pub const MBN_SMS_CDMA_ENCODING_UNICODE = MBN_SMS_CDMA_ENCODING.UNICODE; pub const MBN_SMS_CDMA_ENCODING_SHIFT_JIS = MBN_SMS_CDMA_ENCODING.SHIFT_JIS; pub const MBN_SMS_CDMA_ENCODING_KOREAN = MBN_SMS_CDMA_ENCODING.KOREAN; pub const MBN_SMS_CDMA_ENCODING_LATIN_HEBREW = MBN_SMS_CDMA_ENCODING.LATIN_HEBREW; pub const MBN_SMS_CDMA_ENCODING_LATIN = MBN_SMS_CDMA_ENCODING.LATIN; pub const MBN_SMS_CDMA_ENCODING_GSM_7BIT = MBN_SMS_CDMA_ENCODING.GSM_7BIT; pub const MBN_SMS_FLAG = enum(i32) { ALL = 0, INDEX = 1, NEW = 2, OLD = 3, SENT = 4, DRAFT = 5, }; pub const MBN_SMS_FLAG_ALL = MBN_SMS_FLAG.ALL; pub const MBN_SMS_FLAG_INDEX = MBN_SMS_FLAG.INDEX; pub const MBN_SMS_FLAG_NEW = MBN_SMS_FLAG.NEW; pub const MBN_SMS_FLAG_OLD = MBN_SMS_FLAG.OLD; pub const MBN_SMS_FLAG_SENT = MBN_SMS_FLAG.SENT; pub const MBN_SMS_FLAG_DRAFT = MBN_SMS_FLAG.DRAFT; pub const MBN_SMS_FILTER = extern struct { flag: MBN_SMS_FLAG, messageIndex: u32, }; pub const MBN_SMS_STATUS_FLAG = enum(i32) { NONE = 0, MESSAGE_STORE_FULL = 1, NEW_MESSAGE = 2, }; pub const MBN_SMS_FLAG_NONE = MBN_SMS_STATUS_FLAG.NONE; pub const MBN_SMS_FLAG_MESSAGE_STORE_FULL = MBN_SMS_STATUS_FLAG.MESSAGE_STORE_FULL; pub const MBN_SMS_FLAG_NEW_MESSAGE = MBN_SMS_STATUS_FLAG.NEW_MESSAGE; pub const MBN_SMS_STATUS_INFO = extern struct { flag: u32, messageIndex: u32, }; pub const MBN_SMS_FORMAT = enum(i32) { NONE = 0, PDU = 1, TEXT = 2, }; pub const MBN_SMS_FORMAT_NONE = MBN_SMS_FORMAT.NONE; pub const MBN_SMS_FORMAT_PDU = MBN_SMS_FORMAT.PDU; pub const MBN_SMS_FORMAT_TEXT = MBN_SMS_FORMAT.TEXT; pub const MBN_RADIO = enum(i32) { FF = 0, N = 1, }; pub const MBN_RADIO_OFF = MBN_RADIO.FF; pub const MBN_RADIO_ON = MBN_RADIO.N; pub const MBN_DEVICE_SERVICE_SESSIONS_STATE = enum(i32) { D = 0, }; pub const MBN_DEVICE_SERVICE_SESSIONS_RESTORED = MBN_DEVICE_SERVICE_SESSIONS_STATE.D; pub const MBN_DEVICE_SERVICE = extern struct { deviceServiceID: ?BSTR, dataWriteSupported: i16, dataReadSupported: i16, }; pub const MBN_DEVICE_SERVICES_INTERFACE_STATE = enum(i32) { ARRIVAL = 0, REMOVAL = 1, }; pub const MBN_DEVICE_SERVICES_CAPABLE_INTERFACE_ARRIVAL = MBN_DEVICE_SERVICES_INTERFACE_STATE.ARRIVAL; pub const MBN_DEVICE_SERVICES_CAPABLE_INTERFACE_REMOVAL = MBN_DEVICE_SERVICES_INTERFACE_STATE.REMOVAL; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnection_Value = Guid.initString("dcbbbab6-200d-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnection = &IID_IMbnConnection_Value; pub const IMbnConnection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ConnectionID: fn( self: *const IMbnConnection, ConnectionID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InterfaceID: fn( self: *const IMbnConnection, InterfaceID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Connect: fn( self: *const IMbnConnection, connectionMode: MBN_CONNECTION_MODE, strProfile: ?[*:0]const u16, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disconnect: fn( self: *const IMbnConnection, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConnectionState: fn( self: *const IMbnConnection, ConnectionState: ?*MBN_ACTIVATION_STATE, ProfileName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVoiceCallState: fn( self: *const IMbnConnection, voiceCallState: ?*MBN_VOICE_CALL_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetActivationNetworkError: fn( self: *const IMbnConnection, networkError: ?*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 IMbnConnection_get_ConnectionID(self: *const T, ConnectionID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnection.VTable, self.vtable).get_ConnectionID(@ptrCast(*const IMbnConnection, self), ConnectionID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnection_get_InterfaceID(self: *const T, InterfaceID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnection.VTable, self.vtable).get_InterfaceID(@ptrCast(*const IMbnConnection, self), InterfaceID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnection_Connect(self: *const T, connectionMode: MBN_CONNECTION_MODE, strProfile: ?[*:0]const u16, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnection.VTable, self.vtable).Connect(@ptrCast(*const IMbnConnection, self), connectionMode, strProfile, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnection_Disconnect(self: *const T, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnection.VTable, self.vtable).Disconnect(@ptrCast(*const IMbnConnection, self), requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnection_GetConnectionState(self: *const T, ConnectionState: ?*MBN_ACTIVATION_STATE, ProfileName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnection.VTable, self.vtable).GetConnectionState(@ptrCast(*const IMbnConnection, self), ConnectionState, ProfileName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnection_GetVoiceCallState(self: *const T, voiceCallState: ?*MBN_VOICE_CALL_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnection.VTable, self.vtable).GetVoiceCallState(@ptrCast(*const IMbnConnection, self), voiceCallState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnection_GetActivationNetworkError(self: *const T, networkError: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnection.VTable, self.vtable).GetActivationNetworkError(@ptrCast(*const IMbnConnection, self), networkError); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnectionEvents_Value = Guid.initString("dcbbbab6-200e-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnectionEvents = &IID_IMbnConnectionEvents_Value; pub const IMbnConnectionEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnConnectComplete: fn( self: *const IMbnConnectionEvents, newConnection: ?*IMbnConnection, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDisconnectComplete: fn( self: *const IMbnConnectionEvents, newConnection: ?*IMbnConnection, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnConnectStateChange: fn( self: *const IMbnConnectionEvents, newConnection: ?*IMbnConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnVoiceCallStateChange: fn( self: *const IMbnConnectionEvents, newConnection: ?*IMbnConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionEvents_OnConnectComplete(self: *const T, newConnection: ?*IMbnConnection, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionEvents.VTable, self.vtable).OnConnectComplete(@ptrCast(*const IMbnConnectionEvents, self), newConnection, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionEvents_OnDisconnectComplete(self: *const T, newConnection: ?*IMbnConnection, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionEvents.VTable, self.vtable).OnDisconnectComplete(@ptrCast(*const IMbnConnectionEvents, self), newConnection, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionEvents_OnConnectStateChange(self: *const T, newConnection: ?*IMbnConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionEvents.VTable, self.vtable).OnConnectStateChange(@ptrCast(*const IMbnConnectionEvents, self), newConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionEvents_OnVoiceCallStateChange(self: *const T, newConnection: ?*IMbnConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionEvents.VTable, self.vtable).OnVoiceCallStateChange(@ptrCast(*const IMbnConnectionEvents, self), newConnection); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnInterface_Value = Guid.initString("dcbbbab6-2001-4bbb-aaee-338e368af6fa"); pub const IID_IMbnInterface = &IID_IMbnInterface_Value; pub const IMbnInterface = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InterfaceID: fn( self: *const IMbnInterface, InterfaceID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInterfaceCapability: fn( self: *const IMbnInterface, interfaceCaps: ?*MBN_INTERFACE_CAPS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSubscriberInformation: fn( self: *const IMbnInterface, subscriberInformation: ?*?*IMbnSubscriberInformation, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetReadyState: fn( self: *const IMbnInterface, readyState: ?*MBN_READY_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InEmergencyMode: fn( self: *const IMbnInterface, emergencyMode: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHomeProvider: fn( self: *const IMbnInterface, homeProvider: ?*MBN_PROVIDER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPreferredProviders: fn( self: *const IMbnInterface, preferredProviders: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPreferredProviders: fn( self: *const IMbnInterface, preferredProviders: ?*SAFEARRAY, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVisibleProviders: fn( self: *const IMbnInterface, age: ?*u32, visibleProviders: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScanNetwork: fn( self: *const IMbnInterface, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConnection: fn( self: *const IMbnInterface, mbnConnection: ?*?*IMbnConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_get_InterfaceID(self: *const T, InterfaceID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).get_InterfaceID(@ptrCast(*const IMbnInterface, self), InterfaceID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_GetInterfaceCapability(self: *const T, interfaceCaps: ?*MBN_INTERFACE_CAPS) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).GetInterfaceCapability(@ptrCast(*const IMbnInterface, self), interfaceCaps); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_GetSubscriberInformation(self: *const T, subscriberInformation: ?*?*IMbnSubscriberInformation) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).GetSubscriberInformation(@ptrCast(*const IMbnInterface, self), subscriberInformation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_GetReadyState(self: *const T, readyState: ?*MBN_READY_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).GetReadyState(@ptrCast(*const IMbnInterface, self), readyState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_InEmergencyMode(self: *const T, emergencyMode: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).InEmergencyMode(@ptrCast(*const IMbnInterface, self), emergencyMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_GetHomeProvider(self: *const T, homeProvider: ?*MBN_PROVIDER) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).GetHomeProvider(@ptrCast(*const IMbnInterface, self), homeProvider); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_GetPreferredProviders(self: *const T, preferredProviders: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).GetPreferredProviders(@ptrCast(*const IMbnInterface, self), preferredProviders); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_SetPreferredProviders(self: *const T, preferredProviders: ?*SAFEARRAY, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).SetPreferredProviders(@ptrCast(*const IMbnInterface, self), preferredProviders, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_GetVisibleProviders(self: *const T, age: ?*u32, visibleProviders: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).GetVisibleProviders(@ptrCast(*const IMbnInterface, self), age, visibleProviders); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_ScanNetwork(self: *const T, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).ScanNetwork(@ptrCast(*const IMbnInterface, self), requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterface_GetConnection(self: *const T, mbnConnection: ?*?*IMbnConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterface.VTable, self.vtable).GetConnection(@ptrCast(*const IMbnInterface, self), mbnConnection); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnInterfaceEvents_Value = Guid.initString("dcbbbab6-2002-4bbb-aaee-338e368af6fa"); pub const IID_IMbnInterfaceEvents = &IID_IMbnInterfaceEvents_Value; pub const IMbnInterfaceEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnInterfaceCapabilityAvailable: fn( self: *const IMbnInterfaceEvents, newInterface: ?*IMbnInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSubscriberInformationChange: fn( self: *const IMbnInterfaceEvents, newInterface: ?*IMbnInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnReadyStateChange: fn( self: *const IMbnInterfaceEvents, newInterface: ?*IMbnInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnEmergencyModeChange: fn( self: *const IMbnInterfaceEvents, newInterface: ?*IMbnInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnHomeProviderAvailable: fn( self: *const IMbnInterfaceEvents, newInterface: ?*IMbnInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnPreferredProvidersChange: fn( self: *const IMbnInterfaceEvents, newInterface: ?*IMbnInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSetPreferredProvidersComplete: fn( self: *const IMbnInterfaceEvents, newInterface: ?*IMbnInterface, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnScanNetworkComplete: fn( self: *const IMbnInterfaceEvents, newInterface: ?*IMbnInterface, requestID: u32, status: 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 IMbnInterfaceEvents_OnInterfaceCapabilityAvailable(self: *const T, newInterface: ?*IMbnInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceEvents.VTable, self.vtable).OnInterfaceCapabilityAvailable(@ptrCast(*const IMbnInterfaceEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceEvents_OnSubscriberInformationChange(self: *const T, newInterface: ?*IMbnInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceEvents.VTable, self.vtable).OnSubscriberInformationChange(@ptrCast(*const IMbnInterfaceEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceEvents_OnReadyStateChange(self: *const T, newInterface: ?*IMbnInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceEvents.VTable, self.vtable).OnReadyStateChange(@ptrCast(*const IMbnInterfaceEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceEvents_OnEmergencyModeChange(self: *const T, newInterface: ?*IMbnInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceEvents.VTable, self.vtable).OnEmergencyModeChange(@ptrCast(*const IMbnInterfaceEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceEvents_OnHomeProviderAvailable(self: *const T, newInterface: ?*IMbnInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceEvents.VTable, self.vtable).OnHomeProviderAvailable(@ptrCast(*const IMbnInterfaceEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceEvents_OnPreferredProvidersChange(self: *const T, newInterface: ?*IMbnInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceEvents.VTable, self.vtable).OnPreferredProvidersChange(@ptrCast(*const IMbnInterfaceEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceEvents_OnSetPreferredProvidersComplete(self: *const T, newInterface: ?*IMbnInterface, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceEvents.VTable, self.vtable).OnSetPreferredProvidersComplete(@ptrCast(*const IMbnInterfaceEvents, self), newInterface, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceEvents_OnScanNetworkComplete(self: *const T, newInterface: ?*IMbnInterface, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceEvents.VTable, self.vtable).OnScanNetworkComplete(@ptrCast(*const IMbnInterfaceEvents, self), newInterface, requestID, status); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnInterfaceManager_Value = Guid.initString("dcbbbab6-201b-4bbb-aaee-338e368af6fa"); pub const IID_IMbnInterfaceManager = &IID_IMbnInterfaceManager_Value; pub const IMbnInterfaceManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetInterface: fn( self: *const IMbnInterfaceManager, interfaceID: ?[*:0]const u16, mbnInterface: ?*?*IMbnInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInterfaces: fn( self: *const IMbnInterfaceManager, mbnInterfaces: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceManager_GetInterface(self: *const T, interfaceID: ?[*:0]const u16, mbnInterface: ?*?*IMbnInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceManager.VTable, self.vtable).GetInterface(@ptrCast(*const IMbnInterfaceManager, self), interfaceID, mbnInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceManager_GetInterfaces(self: *const T, mbnInterfaces: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceManager.VTable, self.vtable).GetInterfaces(@ptrCast(*const IMbnInterfaceManager, self), mbnInterfaces); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnInterfaceManagerEvents_Value = Guid.initString("dcbbbab6-201c-4bbb-aaee-338e368af6fa"); pub const IID_IMbnInterfaceManagerEvents = &IID_IMbnInterfaceManagerEvents_Value; pub const IMbnInterfaceManagerEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnInterfaceArrival: fn( self: *const IMbnInterfaceManagerEvents, newInterface: ?*IMbnInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInterfaceRemoval: fn( self: *const IMbnInterfaceManagerEvents, oldInterface: ?*IMbnInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceManagerEvents_OnInterfaceArrival(self: *const T, newInterface: ?*IMbnInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceManagerEvents.VTable, self.vtable).OnInterfaceArrival(@ptrCast(*const IMbnInterfaceManagerEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnInterfaceManagerEvents_OnInterfaceRemoval(self: *const T, oldInterface: ?*IMbnInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnInterfaceManagerEvents.VTable, self.vtable).OnInterfaceRemoval(@ptrCast(*const IMbnInterfaceManagerEvents, self), oldInterface); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnRegistration_Value = Guid.initString("dcbbbab6-2009-4bbb-aaee-338e368af6fa"); pub const IID_IMbnRegistration = &IID_IMbnRegistration_Value; pub const IMbnRegistration = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetRegisterState: fn( self: *const IMbnRegistration, registerState: ?*MBN_REGISTER_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRegisterMode: fn( self: *const IMbnRegistration, registerMode: ?*MBN_REGISTER_MODE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProviderID: fn( self: *const IMbnRegistration, providerID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProviderName: fn( self: *const IMbnRegistration, providerName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRoamingText: fn( self: *const IMbnRegistration, roamingText: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAvailableDataClasses: fn( self: *const IMbnRegistration, availableDataClasses: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrentDataClass: fn( self: *const IMbnRegistration, currentDataClass: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRegistrationNetworkError: fn( self: *const IMbnRegistration, registrationNetworkError: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPacketAttachNetworkError: fn( self: *const IMbnRegistration, packetAttachNetworkError: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRegisterMode: fn( self: *const IMbnRegistration, registerMode: MBN_REGISTER_MODE, providerID: ?[*:0]const u16, dataClass: u32, requestID: ?*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 IMbnRegistration_GetRegisterState(self: *const T, registerState: ?*MBN_REGISTER_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).GetRegisterState(@ptrCast(*const IMbnRegistration, self), registerState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistration_GetRegisterMode(self: *const T, registerMode: ?*MBN_REGISTER_MODE) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).GetRegisterMode(@ptrCast(*const IMbnRegistration, self), registerMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistration_GetProviderID(self: *const T, providerID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).GetProviderID(@ptrCast(*const IMbnRegistration, self), providerID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistration_GetProviderName(self: *const T, providerName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).GetProviderName(@ptrCast(*const IMbnRegistration, self), providerName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistration_GetRoamingText(self: *const T, roamingText: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).GetRoamingText(@ptrCast(*const IMbnRegistration, self), roamingText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistration_GetAvailableDataClasses(self: *const T, availableDataClasses: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).GetAvailableDataClasses(@ptrCast(*const IMbnRegistration, self), availableDataClasses); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistration_GetCurrentDataClass(self: *const T, currentDataClass: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).GetCurrentDataClass(@ptrCast(*const IMbnRegistration, self), currentDataClass); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistration_GetRegistrationNetworkError(self: *const T, registrationNetworkError: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).GetRegistrationNetworkError(@ptrCast(*const IMbnRegistration, self), registrationNetworkError); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistration_GetPacketAttachNetworkError(self: *const T, packetAttachNetworkError: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).GetPacketAttachNetworkError(@ptrCast(*const IMbnRegistration, self), packetAttachNetworkError); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistration_SetRegisterMode(self: *const T, registerMode: MBN_REGISTER_MODE, providerID: ?[*:0]const u16, dataClass: u32, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistration.VTable, self.vtable).SetRegisterMode(@ptrCast(*const IMbnRegistration, self), registerMode, providerID, dataClass, requestID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnRegistrationEvents_Value = Guid.initString("dcbbbab6-200a-4bbb-aaee-338e368af6fa"); pub const IID_IMbnRegistrationEvents = &IID_IMbnRegistrationEvents_Value; pub const IMbnRegistrationEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnRegisterModeAvailable: fn( self: *const IMbnRegistrationEvents, newInterface: ?*IMbnRegistration, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnRegisterStateChange: fn( self: *const IMbnRegistrationEvents, newInterface: ?*IMbnRegistration, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnPacketServiceStateChange: fn( self: *const IMbnRegistrationEvents, newInterface: ?*IMbnRegistration, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSetRegisterModeComplete: fn( self: *const IMbnRegistrationEvents, newInterface: ?*IMbnRegistration, requestID: u32, status: 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 IMbnRegistrationEvents_OnRegisterModeAvailable(self: *const T, newInterface: ?*IMbnRegistration) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistrationEvents.VTable, self.vtable).OnRegisterModeAvailable(@ptrCast(*const IMbnRegistrationEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistrationEvents_OnRegisterStateChange(self: *const T, newInterface: ?*IMbnRegistration) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistrationEvents.VTable, self.vtable).OnRegisterStateChange(@ptrCast(*const IMbnRegistrationEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistrationEvents_OnPacketServiceStateChange(self: *const T, newInterface: ?*IMbnRegistration) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistrationEvents.VTable, self.vtable).OnPacketServiceStateChange(@ptrCast(*const IMbnRegistrationEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRegistrationEvents_OnSetRegisterModeComplete(self: *const T, newInterface: ?*IMbnRegistration, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRegistrationEvents.VTable, self.vtable).OnSetRegisterModeComplete(@ptrCast(*const IMbnRegistrationEvents, self), newInterface, requestID, status); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnectionManager_Value = Guid.initString("dcbbbab6-201d-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnectionManager = &IID_IMbnConnectionManager_Value; pub const IMbnConnectionManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetConnection: fn( self: *const IMbnConnectionManager, connectionID: ?[*:0]const u16, mbnConnection: ?*?*IMbnConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConnections: fn( self: *const IMbnConnectionManager, mbnConnections: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionManager_GetConnection(self: *const T, connectionID: ?[*:0]const u16, mbnConnection: ?*?*IMbnConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionManager.VTable, self.vtable).GetConnection(@ptrCast(*const IMbnConnectionManager, self), connectionID, mbnConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionManager_GetConnections(self: *const T, mbnConnections: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionManager.VTable, self.vtable).GetConnections(@ptrCast(*const IMbnConnectionManager, self), mbnConnections); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnectionManagerEvents_Value = Guid.initString("dcbbbab6-201e-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnectionManagerEvents = &IID_IMbnConnectionManagerEvents_Value; pub const IMbnConnectionManagerEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnConnectionArrival: fn( self: *const IMbnConnectionManagerEvents, newConnection: ?*IMbnConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnConnectionRemoval: fn( self: *const IMbnConnectionManagerEvents, oldConnection: ?*IMbnConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionManagerEvents_OnConnectionArrival(self: *const T, newConnection: ?*IMbnConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionManagerEvents.VTable, self.vtable).OnConnectionArrival(@ptrCast(*const IMbnConnectionManagerEvents, self), newConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionManagerEvents_OnConnectionRemoval(self: *const T, oldConnection: ?*IMbnConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionManagerEvents.VTable, self.vtable).OnConnectionRemoval(@ptrCast(*const IMbnConnectionManagerEvents, self), oldConnection); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnPinManager_Value = Guid.initString("dcbbbab6-2005-4bbb-aaee-338e368af6fa"); pub const IID_IMbnPinManager = &IID_IMbnPinManager_Value; pub const IMbnPinManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPinList: fn( self: *const IMbnPinManager, pinList: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPin: fn( self: *const IMbnPinManager, pinType: MBN_PIN_TYPE, pin: ?*?*IMbnPin, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPinState: fn( self: *const IMbnPinManager, requestID: ?*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 IMbnPinManager_GetPinList(self: *const T, pinList: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinManager.VTable, self.vtable).GetPinList(@ptrCast(*const IMbnPinManager, self), pinList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPinManager_GetPin(self: *const T, pinType: MBN_PIN_TYPE, pin: ?*?*IMbnPin) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinManager.VTable, self.vtable).GetPin(@ptrCast(*const IMbnPinManager, self), pinType, pin); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPinManager_GetPinState(self: *const T, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinManager.VTable, self.vtable).GetPinState(@ptrCast(*const IMbnPinManager, self), requestID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnPinManagerEvents_Value = Guid.initString("dcbbbab6-2006-4bbb-aaee-338e368af6fa"); pub const IID_IMbnPinManagerEvents = &IID_IMbnPinManagerEvents_Value; pub const IMbnPinManagerEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnPinListAvailable: fn( self: *const IMbnPinManagerEvents, pinManager: ?*IMbnPinManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnGetPinStateComplete: fn( self: *const IMbnPinManagerEvents, pinManager: ?*IMbnPinManager, pinInfo: MBN_PIN_INFO, requestID: u32, status: 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 IMbnPinManagerEvents_OnPinListAvailable(self: *const T, pinManager: ?*IMbnPinManager) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinManagerEvents.VTable, self.vtable).OnPinListAvailable(@ptrCast(*const IMbnPinManagerEvents, self), pinManager); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPinManagerEvents_OnGetPinStateComplete(self: *const T, pinManager: ?*IMbnPinManager, pinInfo: MBN_PIN_INFO, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinManagerEvents.VTable, self.vtable).OnGetPinStateComplete(@ptrCast(*const IMbnPinManagerEvents, self), pinManager, pinInfo, requestID, status); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnPinEvents_Value = Guid.initString("dcbbbab6-2008-4bbb-aaee-338e368af6fa"); pub const IID_IMbnPinEvents = &IID_IMbnPinEvents_Value; pub const IMbnPinEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnEnableComplete: fn( self: *const IMbnPinEvents, pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDisableComplete: fn( self: *const IMbnPinEvents, pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnEnterComplete: fn( self: *const IMbnPinEvents, Pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnChangeComplete: fn( self: *const IMbnPinEvents, Pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnUnblockComplete: fn( self: *const IMbnPinEvents, Pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: 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 IMbnPinEvents_OnEnableComplete(self: *const T, pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinEvents.VTable, self.vtable).OnEnableComplete(@ptrCast(*const IMbnPinEvents, self), pin, pinInfo, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPinEvents_OnDisableComplete(self: *const T, pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinEvents.VTable, self.vtable).OnDisableComplete(@ptrCast(*const IMbnPinEvents, self), pin, pinInfo, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPinEvents_OnEnterComplete(self: *const T, Pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinEvents.VTable, self.vtable).OnEnterComplete(@ptrCast(*const IMbnPinEvents, self), Pin, pinInfo, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPinEvents_OnChangeComplete(self: *const T, Pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinEvents.VTable, self.vtable).OnChangeComplete(@ptrCast(*const IMbnPinEvents, self), Pin, pinInfo, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPinEvents_OnUnblockComplete(self: *const T, Pin: ?*IMbnPin, pinInfo: ?*MBN_PIN_INFO, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPinEvents.VTable, self.vtable).OnUnblockComplete(@ptrCast(*const IMbnPinEvents, self), Pin, pinInfo, requestID, status); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnSubscriberInformation_Value = Guid.initString("459ecc43-bcf5-11dc-a8a8-001321f1405f"); pub const IID_IMbnSubscriberInformation = &IID_IMbnSubscriberInformation_Value; pub const IMbnSubscriberInformation = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SubscriberID: fn( self: *const IMbnSubscriberInformation, SubscriberID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SimIccID: fn( self: *const IMbnSubscriberInformation, SimIccID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TelephoneNumbers: fn( self: *const IMbnSubscriberInformation, TelephoneNumbers: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSubscriberInformation_get_SubscriberID(self: *const T, SubscriberID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSubscriberInformation.VTable, self.vtable).get_SubscriberID(@ptrCast(*const IMbnSubscriberInformation, self), SubscriberID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSubscriberInformation_get_SimIccID(self: *const T, SimIccID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSubscriberInformation.VTable, self.vtable).get_SimIccID(@ptrCast(*const IMbnSubscriberInformation, self), SimIccID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSubscriberInformation_get_TelephoneNumbers(self: *const T, TelephoneNumbers: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSubscriberInformation.VTable, self.vtable).get_TelephoneNumbers(@ptrCast(*const IMbnSubscriberInformation, self), TelephoneNumbers); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnSignal_Value = Guid.initString("dcbbbab6-2003-4bbb-aaee-338e368af6fa"); pub const IID_IMbnSignal = &IID_IMbnSignal_Value; pub const IMbnSignal = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSignalStrength: fn( self: *const IMbnSignal, signalStrength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignalError: fn( self: *const IMbnSignal, signalError: ?*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 IMbnSignal_GetSignalStrength(self: *const T, signalStrength: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSignal.VTable, self.vtable).GetSignalStrength(@ptrCast(*const IMbnSignal, self), signalStrength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSignal_GetSignalError(self: *const T, signalError: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSignal.VTable, self.vtable).GetSignalError(@ptrCast(*const IMbnSignal, self), signalError); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnSignalEvents_Value = Guid.initString("dcbbbab6-2004-4bbb-aaee-338e368af6fa"); pub const IID_IMbnSignalEvents = &IID_IMbnSignalEvents_Value; pub const IMbnSignalEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnSignalStateChange: fn( self: *const IMbnSignalEvents, newInterface: ?*IMbnSignal, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSignalEvents_OnSignalStateChange(self: *const T, newInterface: ?*IMbnSignal) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSignalEvents.VTable, self.vtable).OnSignalStateChange(@ptrCast(*const IMbnSignalEvents, self), newInterface); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnectionContext_Value = Guid.initString("dcbbbab6-200b-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnectionContext = &IID_IMbnConnectionContext_Value; pub const IMbnConnectionContext = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetProvisionedContexts: fn( self: *const IMbnConnectionContext, provisionedContexts: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetProvisionedContext: fn( self: *const IMbnConnectionContext, provisionedContexts: MBN_CONTEXT, providerID: ?[*:0]const u16, requestID: ?*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 IMbnConnectionContext_GetProvisionedContexts(self: *const T, provisionedContexts: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionContext.VTable, self.vtable).GetProvisionedContexts(@ptrCast(*const IMbnConnectionContext, self), provisionedContexts); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionContext_SetProvisionedContext(self: *const T, provisionedContexts: MBN_CONTEXT, providerID: ?[*:0]const u16, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionContext.VTable, self.vtable).SetProvisionedContext(@ptrCast(*const IMbnConnectionContext, self), provisionedContexts, providerID, requestID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnectionContextEvents_Value = Guid.initString("dcbbbab6-200c-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnectionContextEvents = &IID_IMbnConnectionContextEvents_Value; pub const IMbnConnectionContextEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnProvisionedContextListChange: fn( self: *const IMbnConnectionContextEvents, newInterface: ?*IMbnConnectionContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSetProvisionedContextComplete: fn( self: *const IMbnConnectionContextEvents, newInterface: ?*IMbnConnectionContext, requestID: u32, status: 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 IMbnConnectionContextEvents_OnProvisionedContextListChange(self: *const T, newInterface: ?*IMbnConnectionContext) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionContextEvents.VTable, self.vtable).OnProvisionedContextListChange(@ptrCast(*const IMbnConnectionContextEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionContextEvents_OnSetProvisionedContextComplete(self: *const T, newInterface: ?*IMbnConnectionContext, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionContextEvents.VTable, self.vtable).OnSetProvisionedContextComplete(@ptrCast(*const IMbnConnectionContextEvents, self), newInterface, requestID, status); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnectionProfileManager_Value = Guid.initString("dcbbbab6-200f-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnectionProfileManager = &IID_IMbnConnectionProfileManager_Value; pub const IMbnConnectionProfileManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetConnectionProfiles: fn( self: *const IMbnConnectionProfileManager, mbnInterface: ?*IMbnInterface, connectionProfiles: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConnectionProfile: fn( self: *const IMbnConnectionProfileManager, mbnInterface: ?*IMbnInterface, profileName: ?[*:0]const u16, connectionProfile: ?*?*IMbnConnectionProfile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateConnectionProfile: fn( self: *const IMbnConnectionProfileManager, xmlProfile: ?[*: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 IMbnConnectionProfileManager_GetConnectionProfiles(self: *const T, mbnInterface: ?*IMbnInterface, connectionProfiles: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionProfileManager.VTable, self.vtable).GetConnectionProfiles(@ptrCast(*const IMbnConnectionProfileManager, self), mbnInterface, connectionProfiles); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionProfileManager_GetConnectionProfile(self: *const T, mbnInterface: ?*IMbnInterface, profileName: ?[*:0]const u16, connectionProfile: ?*?*IMbnConnectionProfile) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionProfileManager.VTable, self.vtable).GetConnectionProfile(@ptrCast(*const IMbnConnectionProfileManager, self), mbnInterface, profileName, connectionProfile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionProfileManager_CreateConnectionProfile(self: *const T, xmlProfile: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionProfileManager.VTable, self.vtable).CreateConnectionProfile(@ptrCast(*const IMbnConnectionProfileManager, self), xmlProfile); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnectionProfile_Value = Guid.initString("dcbbbab6-2010-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnectionProfile = &IID_IMbnConnectionProfile_Value; pub const IMbnConnectionProfile = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetProfileXmlData: fn( self: *const IMbnConnectionProfile, profileData: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UpdateProfile: fn( self: *const IMbnConnectionProfile, strProfile: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IMbnConnectionProfile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionProfile_GetProfileXmlData(self: *const T, profileData: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionProfile.VTable, self.vtable).GetProfileXmlData(@ptrCast(*const IMbnConnectionProfile, self), profileData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionProfile_UpdateProfile(self: *const T, strProfile: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionProfile.VTable, self.vtable).UpdateProfile(@ptrCast(*const IMbnConnectionProfile, self), strProfile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionProfile_Delete(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionProfile.VTable, self.vtable).Delete(@ptrCast(*const IMbnConnectionProfile, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnectionProfileEvents_Value = Guid.initString("dcbbbab6-2011-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnectionProfileEvents = &IID_IMbnConnectionProfileEvents_Value; pub const IMbnConnectionProfileEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnProfileUpdate: fn( self: *const IMbnConnectionProfileEvents, newProfile: ?*IMbnConnectionProfile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionProfileEvents_OnProfileUpdate(self: *const T, newProfile: ?*IMbnConnectionProfile) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionProfileEvents.VTable, self.vtable).OnProfileUpdate(@ptrCast(*const IMbnConnectionProfileEvents, self), newProfile); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnSmsConfiguration_Value = Guid.initString("dcbbbab6-2012-4bbb-aaee-338e368af6fa"); pub const IID_IMbnSmsConfiguration = &IID_IMbnSmsConfiguration_Value; pub const IMbnSmsConfiguration = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ServiceCenterAddress: fn( self: *const IMbnSmsConfiguration, scAddress: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ServiceCenterAddress: fn( self: *const IMbnSmsConfiguration, scAddress: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaxMessageIndex: fn( self: *const IMbnSmsConfiguration, index: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CdmaShortMsgSize: fn( self: *const IMbnSmsConfiguration, shortMsgSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SmsFormat: fn( self: *const IMbnSmsConfiguration, smsFormat: ?*MBN_SMS_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SmsFormat: fn( self: *const IMbnSmsConfiguration, smsFormat: MBN_SMS_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsConfiguration_get_ServiceCenterAddress(self: *const T, scAddress: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsConfiguration.VTable, self.vtable).get_ServiceCenterAddress(@ptrCast(*const IMbnSmsConfiguration, self), scAddress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsConfiguration_put_ServiceCenterAddress(self: *const T, scAddress: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsConfiguration.VTable, self.vtable).put_ServiceCenterAddress(@ptrCast(*const IMbnSmsConfiguration, self), scAddress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsConfiguration_get_MaxMessageIndex(self: *const T, index: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsConfiguration.VTable, self.vtable).get_MaxMessageIndex(@ptrCast(*const IMbnSmsConfiguration, self), index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsConfiguration_get_CdmaShortMsgSize(self: *const T, shortMsgSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsConfiguration.VTable, self.vtable).get_CdmaShortMsgSize(@ptrCast(*const IMbnSmsConfiguration, self), shortMsgSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsConfiguration_get_SmsFormat(self: *const T, smsFormat: ?*MBN_SMS_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsConfiguration.VTable, self.vtable).get_SmsFormat(@ptrCast(*const IMbnSmsConfiguration, self), smsFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsConfiguration_put_SmsFormat(self: *const T, smsFormat: MBN_SMS_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsConfiguration.VTable, self.vtable).put_SmsFormat(@ptrCast(*const IMbnSmsConfiguration, self), smsFormat); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnSmsReadMsgPdu_Value = Guid.initString("dcbbbab6-2013-4bbb-aaee-338e368af6fa"); pub const IID_IMbnSmsReadMsgPdu = &IID_IMbnSmsReadMsgPdu_Value; pub const IMbnSmsReadMsgPdu = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Index: fn( self: *const IMbnSmsReadMsgPdu, Index: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Status: fn( self: *const IMbnSmsReadMsgPdu, Status: ?*MBN_MSG_STATUS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PduData: fn( self: *const IMbnSmsReadMsgPdu, PduData: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Message: fn( self: *const IMbnSmsReadMsgPdu, Message: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgPdu_get_Index(self: *const T, Index: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgPdu.VTable, self.vtable).get_Index(@ptrCast(*const IMbnSmsReadMsgPdu, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgPdu_get_Status(self: *const T, Status: ?*MBN_MSG_STATUS) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgPdu.VTable, self.vtable).get_Status(@ptrCast(*const IMbnSmsReadMsgPdu, self), Status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgPdu_get_PduData(self: *const T, PduData: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgPdu.VTable, self.vtable).get_PduData(@ptrCast(*const IMbnSmsReadMsgPdu, self), PduData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgPdu_get_Message(self: *const T, Message: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgPdu.VTable, self.vtable).get_Message(@ptrCast(*const IMbnSmsReadMsgPdu, self), Message); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnSmsReadMsgTextCdma_Value = Guid.initString("dcbbbab6-2014-4bbb-aaee-338e368af6fa"); pub const IID_IMbnSmsReadMsgTextCdma = &IID_IMbnSmsReadMsgTextCdma_Value; pub const IMbnSmsReadMsgTextCdma = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Index: fn( self: *const IMbnSmsReadMsgTextCdma, Index: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Status: fn( self: *const IMbnSmsReadMsgTextCdma, Status: ?*MBN_MSG_STATUS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Address: fn( self: *const IMbnSmsReadMsgTextCdma, Address: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Timestamp: fn( self: *const IMbnSmsReadMsgTextCdma, Timestamp: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EncodingID: fn( self: *const IMbnSmsReadMsgTextCdma, EncodingID: ?*MBN_SMS_CDMA_ENCODING, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LanguageID: fn( self: *const IMbnSmsReadMsgTextCdma, LanguageID: ?*MBN_SMS_CDMA_LANG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SizeInCharacters: fn( self: *const IMbnSmsReadMsgTextCdma, SizeInCharacters: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Message: fn( self: *const IMbnSmsReadMsgTextCdma, Message: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgTextCdma_get_Index(self: *const T, Index: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgTextCdma.VTable, self.vtable).get_Index(@ptrCast(*const IMbnSmsReadMsgTextCdma, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgTextCdma_get_Status(self: *const T, Status: ?*MBN_MSG_STATUS) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgTextCdma.VTable, self.vtable).get_Status(@ptrCast(*const IMbnSmsReadMsgTextCdma, self), Status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgTextCdma_get_Address(self: *const T, Address: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgTextCdma.VTable, self.vtable).get_Address(@ptrCast(*const IMbnSmsReadMsgTextCdma, self), Address); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgTextCdma_get_Timestamp(self: *const T, Timestamp: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgTextCdma.VTable, self.vtable).get_Timestamp(@ptrCast(*const IMbnSmsReadMsgTextCdma, self), Timestamp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgTextCdma_get_EncodingID(self: *const T, EncodingID: ?*MBN_SMS_CDMA_ENCODING) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgTextCdma.VTable, self.vtable).get_EncodingID(@ptrCast(*const IMbnSmsReadMsgTextCdma, self), EncodingID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgTextCdma_get_LanguageID(self: *const T, LanguageID: ?*MBN_SMS_CDMA_LANG) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgTextCdma.VTable, self.vtable).get_LanguageID(@ptrCast(*const IMbnSmsReadMsgTextCdma, self), LanguageID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgTextCdma_get_SizeInCharacters(self: *const T, SizeInCharacters: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgTextCdma.VTable, self.vtable).get_SizeInCharacters(@ptrCast(*const IMbnSmsReadMsgTextCdma, self), SizeInCharacters); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsReadMsgTextCdma_get_Message(self: *const T, Message: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsReadMsgTextCdma.VTable, self.vtable).get_Message(@ptrCast(*const IMbnSmsReadMsgTextCdma, self), Message); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnSms_Value = Guid.initString("dcbbbab6-2015-4bbb-aaee-338e368af6fa"); pub const IID_IMbnSms = &IID_IMbnSms_Value; pub const IMbnSms = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSmsConfiguration: fn( self: *const IMbnSms, smsConfiguration: ?*?*IMbnSmsConfiguration, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSmsConfiguration: fn( self: *const IMbnSms, smsConfiguration: ?*IMbnSmsConfiguration, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SmsSendPdu: fn( self: *const IMbnSms, pduData: ?[*:0]const u16, size: u8, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SmsSendCdma: fn( self: *const IMbnSms, address: ?[*:0]const u16, encoding: MBN_SMS_CDMA_ENCODING, language: MBN_SMS_CDMA_LANG, sizeInCharacters: u32, message: ?*SAFEARRAY, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SmsSendCdmaPdu: fn( self: *const IMbnSms, message: ?*SAFEARRAY, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SmsRead: fn( self: *const IMbnSms, smsFilter: ?*MBN_SMS_FILTER, smsFormat: MBN_SMS_FORMAT, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SmsDelete: fn( self: *const IMbnSms, smsFilter: ?*MBN_SMS_FILTER, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSmsStatus: fn( self: *const IMbnSms, smsStatusInfo: ?*MBN_SMS_STATUS_INFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSms_GetSmsConfiguration(self: *const T, smsConfiguration: ?*?*IMbnSmsConfiguration) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSms.VTable, self.vtable).GetSmsConfiguration(@ptrCast(*const IMbnSms, self), smsConfiguration); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSms_SetSmsConfiguration(self: *const T, smsConfiguration: ?*IMbnSmsConfiguration, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSms.VTable, self.vtable).SetSmsConfiguration(@ptrCast(*const IMbnSms, self), smsConfiguration, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSms_SmsSendPdu(self: *const T, pduData: ?[*:0]const u16, size: u8, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSms.VTable, self.vtable).SmsSendPdu(@ptrCast(*const IMbnSms, self), pduData, size, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSms_SmsSendCdma(self: *const T, address: ?[*:0]const u16, encoding: MBN_SMS_CDMA_ENCODING, language: MBN_SMS_CDMA_LANG, sizeInCharacters: u32, message: ?*SAFEARRAY, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSms.VTable, self.vtable).SmsSendCdma(@ptrCast(*const IMbnSms, self), address, encoding, language, sizeInCharacters, message, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSms_SmsSendCdmaPdu(self: *const T, message: ?*SAFEARRAY, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSms.VTable, self.vtable).SmsSendCdmaPdu(@ptrCast(*const IMbnSms, self), message, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSms_SmsRead(self: *const T, smsFilter: ?*MBN_SMS_FILTER, smsFormat: MBN_SMS_FORMAT, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSms.VTable, self.vtable).SmsRead(@ptrCast(*const IMbnSms, self), smsFilter, smsFormat, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSms_SmsDelete(self: *const T, smsFilter: ?*MBN_SMS_FILTER, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSms.VTable, self.vtable).SmsDelete(@ptrCast(*const IMbnSms, self), smsFilter, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSms_GetSmsStatus(self: *const T, smsStatusInfo: ?*MBN_SMS_STATUS_INFO) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSms.VTable, self.vtable).GetSmsStatus(@ptrCast(*const IMbnSms, self), smsStatusInfo); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnSmsEvents_Value = Guid.initString("dcbbbab6-2016-4bbb-aaee-338e368af6fa"); pub const IID_IMbnSmsEvents = &IID_IMbnSmsEvents_Value; pub const IMbnSmsEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnSmsConfigurationChange: fn( self: *const IMbnSmsEvents, sms: ?*IMbnSms, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSetSmsConfigurationComplete: fn( self: *const IMbnSmsEvents, sms: ?*IMbnSms, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSmsSendComplete: fn( self: *const IMbnSmsEvents, sms: ?*IMbnSms, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSmsReadComplete: fn( self: *const IMbnSmsEvents, sms: ?*IMbnSms, smsFormat: MBN_SMS_FORMAT, readMsgs: ?*SAFEARRAY, moreMsgs: i16, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSmsNewClass0Message: fn( self: *const IMbnSmsEvents, sms: ?*IMbnSms, smsFormat: MBN_SMS_FORMAT, readMsgs: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSmsDeleteComplete: fn( self: *const IMbnSmsEvents, sms: ?*IMbnSms, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSmsStatusChange: fn( self: *const IMbnSmsEvents, sms: ?*IMbnSms, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsEvents_OnSmsConfigurationChange(self: *const T, sms: ?*IMbnSms) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsEvents.VTable, self.vtable).OnSmsConfigurationChange(@ptrCast(*const IMbnSmsEvents, self), sms); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsEvents_OnSetSmsConfigurationComplete(self: *const T, sms: ?*IMbnSms, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsEvents.VTable, self.vtable).OnSetSmsConfigurationComplete(@ptrCast(*const IMbnSmsEvents, self), sms, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsEvents_OnSmsSendComplete(self: *const T, sms: ?*IMbnSms, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsEvents.VTable, self.vtable).OnSmsSendComplete(@ptrCast(*const IMbnSmsEvents, self), sms, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsEvents_OnSmsReadComplete(self: *const T, sms: ?*IMbnSms, smsFormat: MBN_SMS_FORMAT, readMsgs: ?*SAFEARRAY, moreMsgs: i16, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsEvents.VTable, self.vtable).OnSmsReadComplete(@ptrCast(*const IMbnSmsEvents, self), sms, smsFormat, readMsgs, moreMsgs, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsEvents_OnSmsNewClass0Message(self: *const T, sms: ?*IMbnSms, smsFormat: MBN_SMS_FORMAT, readMsgs: ?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsEvents.VTable, self.vtable).OnSmsNewClass0Message(@ptrCast(*const IMbnSmsEvents, self), sms, smsFormat, readMsgs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsEvents_OnSmsDeleteComplete(self: *const T, sms: ?*IMbnSms, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsEvents.VTable, self.vtable).OnSmsDeleteComplete(@ptrCast(*const IMbnSmsEvents, self), sms, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnSmsEvents_OnSmsStatusChange(self: *const T, sms: ?*IMbnSms) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnSmsEvents.VTable, self.vtable).OnSmsStatusChange(@ptrCast(*const IMbnSmsEvents, self), sms); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnServiceActivation_Value = Guid.initString("dcbbbab6-2017-4bbb-aaee-338e368af6fa"); pub const IID_IMbnServiceActivation = &IID_IMbnServiceActivation_Value; pub const IMbnServiceActivation = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Activate: fn( self: *const IMbnServiceActivation, vendorSpecificData: ?*SAFEARRAY, requestID: ?*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 IMbnServiceActivation_Activate(self: *const T, vendorSpecificData: ?*SAFEARRAY, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnServiceActivation.VTable, self.vtable).Activate(@ptrCast(*const IMbnServiceActivation, self), vendorSpecificData, requestID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnServiceActivationEvents_Value = Guid.initString("dcbbbab6-2018-4bbb-aaee-338e368af6fa"); pub const IID_IMbnServiceActivationEvents = &IID_IMbnServiceActivationEvents_Value; pub const IMbnServiceActivationEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnActivationComplete: fn( self: *const IMbnServiceActivationEvents, serviceActivation: ?*IMbnServiceActivation, vendorSpecificData: ?*SAFEARRAY, requestID: u32, status: HRESULT, networkError: 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 IMbnServiceActivationEvents_OnActivationComplete(self: *const T, serviceActivation: ?*IMbnServiceActivation, vendorSpecificData: ?*SAFEARRAY, requestID: u32, status: HRESULT, networkError: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnServiceActivationEvents.VTable, self.vtable).OnActivationComplete(@ptrCast(*const IMbnServiceActivationEvents, self), serviceActivation, vendorSpecificData, requestID, status, networkError); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnVendorSpecificOperation_Value = Guid.initString("dcbbbab6-2019-4bbb-aaee-338e368af6fa"); pub const IID_IMbnVendorSpecificOperation = &IID_IMbnVendorSpecificOperation_Value; pub const IMbnVendorSpecificOperation = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetVendorSpecific: fn( self: *const IMbnVendorSpecificOperation, vendorSpecificData: ?*SAFEARRAY, requestID: ?*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 IMbnVendorSpecificOperation_SetVendorSpecific(self: *const T, vendorSpecificData: ?*SAFEARRAY, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnVendorSpecificOperation.VTable, self.vtable).SetVendorSpecific(@ptrCast(*const IMbnVendorSpecificOperation, self), vendorSpecificData, requestID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnVendorSpecificEvents_Value = Guid.initString("dcbbbab6-201a-4bbb-aaee-338e368af6fa"); pub const IID_IMbnVendorSpecificEvents = &IID_IMbnVendorSpecificEvents_Value; pub const IMbnVendorSpecificEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnEventNotification: fn( self: *const IMbnVendorSpecificEvents, vendorOperation: ?*IMbnVendorSpecificOperation, vendorSpecificData: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSetVendorSpecificComplete: fn( self: *const IMbnVendorSpecificEvents, vendorOperation: ?*IMbnVendorSpecificOperation, vendorSpecificData: ?*SAFEARRAY, requestID: 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 IMbnVendorSpecificEvents_OnEventNotification(self: *const T, vendorOperation: ?*IMbnVendorSpecificOperation, vendorSpecificData: ?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnVendorSpecificEvents.VTable, self.vtable).OnEventNotification(@ptrCast(*const IMbnVendorSpecificEvents, self), vendorOperation, vendorSpecificData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnVendorSpecificEvents_OnSetVendorSpecificComplete(self: *const T, vendorOperation: ?*IMbnVendorSpecificOperation, vendorSpecificData: ?*SAFEARRAY, requestID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnVendorSpecificEvents.VTable, self.vtable).OnSetVendorSpecificComplete(@ptrCast(*const IMbnVendorSpecificEvents, self), vendorOperation, vendorSpecificData, requestID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnConnectionProfileManagerEvents_Value = Guid.initString("dcbbbab6-201f-4bbb-aaee-338e368af6fa"); pub const IID_IMbnConnectionProfileManagerEvents = &IID_IMbnConnectionProfileManagerEvents_Value; pub const IMbnConnectionProfileManagerEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnConnectionProfileArrival: fn( self: *const IMbnConnectionProfileManagerEvents, newConnectionProfile: ?*IMbnConnectionProfile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnConnectionProfileRemoval: fn( self: *const IMbnConnectionProfileManagerEvents, oldConnectionProfile: ?*IMbnConnectionProfile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionProfileManagerEvents_OnConnectionProfileArrival(self: *const T, newConnectionProfile: ?*IMbnConnectionProfile) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionProfileManagerEvents.VTable, self.vtable).OnConnectionProfileArrival(@ptrCast(*const IMbnConnectionProfileManagerEvents, self), newConnectionProfile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnConnectionProfileManagerEvents_OnConnectionProfileRemoval(self: *const T, oldConnectionProfile: ?*IMbnConnectionProfile) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnConnectionProfileManagerEvents.VTable, self.vtable).OnConnectionProfileRemoval(@ptrCast(*const IMbnConnectionProfileManagerEvents, self), oldConnectionProfile); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnRadio_Value = Guid.initString("dccccab6-201f-4bbb-aaee-338e368af6fa"); pub const IID_IMbnRadio = &IID_IMbnRadio_Value; pub const IMbnRadio = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SoftwareRadioState: fn( self: *const IMbnRadio, SoftwareRadioState: ?*MBN_RADIO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_HardwareRadioState: fn( self: *const IMbnRadio, HardwareRadioState: ?*MBN_RADIO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSoftwareRadioState: fn( self: *const IMbnRadio, radioState: MBN_RADIO, requestID: ?*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 IMbnRadio_get_SoftwareRadioState(self: *const T, SoftwareRadioState: ?*MBN_RADIO) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRadio.VTable, self.vtable).get_SoftwareRadioState(@ptrCast(*const IMbnRadio, self), SoftwareRadioState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRadio_get_HardwareRadioState(self: *const T, HardwareRadioState: ?*MBN_RADIO) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRadio.VTable, self.vtable).get_HardwareRadioState(@ptrCast(*const IMbnRadio, self), HardwareRadioState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRadio_SetSoftwareRadioState(self: *const T, radioState: MBN_RADIO, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRadio.VTable, self.vtable).SetSoftwareRadioState(@ptrCast(*const IMbnRadio, self), radioState, requestID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnRadioEvents_Value = Guid.initString("dcdddab6-201f-4bbb-aaee-338e368af6fa"); pub const IID_IMbnRadioEvents = &IID_IMbnRadioEvents_Value; pub const IMbnRadioEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnRadioStateChange: fn( self: *const IMbnRadioEvents, newInterface: ?*IMbnRadio, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSetSoftwareRadioStateComplete: fn( self: *const IMbnRadioEvents, newInterface: ?*IMbnRadio, requestID: u32, status: 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 IMbnRadioEvents_OnRadioStateChange(self: *const T, newInterface: ?*IMbnRadio) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRadioEvents.VTable, self.vtable).OnRadioStateChange(@ptrCast(*const IMbnRadioEvents, self), newInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnRadioEvents_OnSetSoftwareRadioStateComplete(self: *const T, newInterface: ?*IMbnRadio, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnRadioEvents.VTable, self.vtable).OnSetSoftwareRadioStateComplete(@ptrCast(*const IMbnRadioEvents, self), newInterface, requestID, status); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IMbnMultiCarrier_Value = Guid.initString("dcbbbab6-2020-4bbb-aaee-338e368af6fa"); pub const IID_IMbnMultiCarrier = &IID_IMbnMultiCarrier_Value; pub const IMbnMultiCarrier = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetHomeProvider: fn( self: *const IMbnMultiCarrier, homeProvider: ?*MBN_PROVIDER2, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPreferredProviders: fn( self: *const IMbnMultiCarrier, preferredMulticarrierProviders: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVisibleProviders: fn( self: *const IMbnMultiCarrier, age: ?*u32, visibleProviders: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedCellularClasses: fn( self: *const IMbnMultiCarrier, cellularClasses: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrentCellularClass: fn( self: *const IMbnMultiCarrier, currentCellularClass: ?*MBN_CELLULAR_CLASS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScanNetwork: fn( self: *const IMbnMultiCarrier, requestID: ?*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 IMbnMultiCarrier_SetHomeProvider(self: *const T, homeProvider: ?*MBN_PROVIDER2, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrier.VTable, self.vtable).SetHomeProvider(@ptrCast(*const IMbnMultiCarrier, self), homeProvider, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrier_GetPreferredProviders(self: *const T, preferredMulticarrierProviders: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrier.VTable, self.vtable).GetPreferredProviders(@ptrCast(*const IMbnMultiCarrier, self), preferredMulticarrierProviders); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrier_GetVisibleProviders(self: *const T, age: ?*u32, visibleProviders: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrier.VTable, self.vtable).GetVisibleProviders(@ptrCast(*const IMbnMultiCarrier, self), age, visibleProviders); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrier_GetSupportedCellularClasses(self: *const T, cellularClasses: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrier.VTable, self.vtable).GetSupportedCellularClasses(@ptrCast(*const IMbnMultiCarrier, self), cellularClasses); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrier_GetCurrentCellularClass(self: *const T, currentCellularClass: ?*MBN_CELLULAR_CLASS) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrier.VTable, self.vtable).GetCurrentCellularClass(@ptrCast(*const IMbnMultiCarrier, self), currentCellularClass); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrier_ScanNetwork(self: *const T, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrier.VTable, self.vtable).ScanNetwork(@ptrCast(*const IMbnMultiCarrier, self), requestID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IMbnMultiCarrierEvents_Value = Guid.initString("dcdddab6-2021-4bbb-aaee-338e368af6fa"); pub const IID_IMbnMultiCarrierEvents = &IID_IMbnMultiCarrierEvents_Value; pub const IMbnMultiCarrierEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnSetHomeProviderComplete: fn( self: *const IMbnMultiCarrierEvents, mbnInterface: ?*IMbnMultiCarrier, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnCurrentCellularClassChange: fn( self: *const IMbnMultiCarrierEvents, mbnInterface: ?*IMbnMultiCarrier, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnPreferredProvidersChange: fn( self: *const IMbnMultiCarrierEvents, mbnInterface: ?*IMbnMultiCarrier, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnScanNetworkComplete: fn( self: *const IMbnMultiCarrierEvents, mbnInterface: ?*IMbnMultiCarrier, requestID: u32, status: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInterfaceCapabilityChange: fn( self: *const IMbnMultiCarrierEvents, mbnInterface: ?*IMbnMultiCarrier, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrierEvents_OnSetHomeProviderComplete(self: *const T, mbnInterface: ?*IMbnMultiCarrier, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrierEvents.VTable, self.vtable).OnSetHomeProviderComplete(@ptrCast(*const IMbnMultiCarrierEvents, self), mbnInterface, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrierEvents_OnCurrentCellularClassChange(self: *const T, mbnInterface: ?*IMbnMultiCarrier) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrierEvents.VTable, self.vtable).OnCurrentCellularClassChange(@ptrCast(*const IMbnMultiCarrierEvents, self), mbnInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrierEvents_OnPreferredProvidersChange(self: *const T, mbnInterface: ?*IMbnMultiCarrier) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrierEvents.VTable, self.vtable).OnPreferredProvidersChange(@ptrCast(*const IMbnMultiCarrierEvents, self), mbnInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrierEvents_OnScanNetworkComplete(self: *const T, mbnInterface: ?*IMbnMultiCarrier, requestID: u32, status: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrierEvents.VTable, self.vtable).OnScanNetworkComplete(@ptrCast(*const IMbnMultiCarrierEvents, self), mbnInterface, requestID, status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnMultiCarrierEvents_OnInterfaceCapabilityChange(self: *const T, mbnInterface: ?*IMbnMultiCarrier) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnMultiCarrierEvents.VTable, self.vtable).OnInterfaceCapabilityChange(@ptrCast(*const IMbnMultiCarrierEvents, self), mbnInterface); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMbnDeviceServiceStateEvents_Value = Guid.initString("5d3ff196-89ee-49d8-8b60-33ffddffc58d"); pub const IID_IMbnDeviceServiceStateEvents = &IID_IMbnDeviceServiceStateEvents_Value; pub const IMbnDeviceServiceStateEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnSessionsStateChange: fn( self: *const IMbnDeviceServiceStateEvents, interfaceID: ?BSTR, stateChange: MBN_DEVICE_SERVICE_SESSIONS_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServiceStateEvents_OnSessionsStateChange(self: *const T, interfaceID: ?BSTR, stateChange: MBN_DEVICE_SERVICE_SESSIONS_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServiceStateEvents.VTable, self.vtable).OnSessionsStateChange(@ptrCast(*const IMbnDeviceServiceStateEvents, self), interfaceID, stateChange); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IMbnDeviceServicesManager_Value = Guid.initString("20a26258-6811-4478-ac1d-13324e45e41c"); pub const IID_IMbnDeviceServicesManager = &IID_IMbnDeviceServicesManager_Value; pub const IMbnDeviceServicesManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDeviceServicesContext: fn( self: *const IMbnDeviceServicesManager, networkInterfaceID: ?BSTR, mbnDevicesContext: ?*?*IMbnDeviceServicesContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesManager_GetDeviceServicesContext(self: *const T, networkInterfaceID: ?BSTR, mbnDevicesContext: ?*?*IMbnDeviceServicesContext) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesManager.VTable, self.vtable).GetDeviceServicesContext(@ptrCast(*const IMbnDeviceServicesManager, self), networkInterfaceID, mbnDevicesContext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IMbnDeviceServicesContext_Value = Guid.initString("fc5ac347-1592-4068-80bb-6a57580150d8"); pub const IID_IMbnDeviceServicesContext = &IID_IMbnDeviceServicesContext_Value; pub const IMbnDeviceServicesContext = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumerateDeviceServices: fn( self: *const IMbnDeviceServicesContext, deviceServices: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceService: fn( self: *const IMbnDeviceServicesContext, deviceServiceID: ?BSTR, mbnDeviceService: ?*?*IMbnDeviceService, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaxCommandSize: fn( self: *const IMbnDeviceServicesContext, maxCommandSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaxDataSize: fn( self: *const IMbnDeviceServicesContext, maxDataSize: ?*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 IMbnDeviceServicesContext_EnumerateDeviceServices(self: *const T, deviceServices: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesContext.VTable, self.vtable).EnumerateDeviceServices(@ptrCast(*const IMbnDeviceServicesContext, self), deviceServices); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesContext_GetDeviceService(self: *const T, deviceServiceID: ?BSTR, mbnDeviceService: ?*?*IMbnDeviceService) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesContext.VTable, self.vtable).GetDeviceService(@ptrCast(*const IMbnDeviceServicesContext, self), deviceServiceID, mbnDeviceService); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesContext_get_MaxCommandSize(self: *const T, maxCommandSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesContext.VTable, self.vtable).get_MaxCommandSize(@ptrCast(*const IMbnDeviceServicesContext, self), maxCommandSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesContext_get_MaxDataSize(self: *const T, maxDataSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesContext.VTable, self.vtable).get_MaxDataSize(@ptrCast(*const IMbnDeviceServicesContext, self), maxDataSize); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IMbnDeviceServicesEvents_Value = Guid.initString("0a900c19-6824-4e97-b76e-cf239d0ca642"); pub const IID_IMbnDeviceServicesEvents = &IID_IMbnDeviceServicesEvents_Value; pub const IMbnDeviceServicesEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnQuerySupportedCommandsComplete: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, commandIDList: ?*SAFEARRAY, status: HRESULT, requestID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnOpenCommandSessionComplete: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnCloseCommandSessionComplete: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSetCommandComplete: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, responseID: u32, deviceServiceData: ?*SAFEARRAY, status: HRESULT, requestID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnQueryCommandComplete: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, responseID: u32, deviceServiceData: ?*SAFEARRAY, status: HRESULT, requestID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnEventNotification: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, eventID: u32, deviceServiceData: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnOpenDataSessionComplete: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnCloseDataSessionComplete: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnWriteDataComplete: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnReadData: fn( self: *const IMbnDeviceServicesEvents, deviceService: ?*IMbnDeviceService, deviceServiceData: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInterfaceStateChange: fn( self: *const IMbnDeviceServicesEvents, interfaceID: ?BSTR, stateChange: MBN_DEVICE_SERVICES_INTERFACE_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnQuerySupportedCommandsComplete(self: *const T, deviceService: ?*IMbnDeviceService, commandIDList: ?*SAFEARRAY, status: HRESULT, requestID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnQuerySupportedCommandsComplete(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, commandIDList, status, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnOpenCommandSessionComplete(self: *const T, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnOpenCommandSessionComplete(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, status, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnCloseCommandSessionComplete(self: *const T, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnCloseCommandSessionComplete(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, status, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnSetCommandComplete(self: *const T, deviceService: ?*IMbnDeviceService, responseID: u32, deviceServiceData: ?*SAFEARRAY, status: HRESULT, requestID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnSetCommandComplete(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, responseID, deviceServiceData, status, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnQueryCommandComplete(self: *const T, deviceService: ?*IMbnDeviceService, responseID: u32, deviceServiceData: ?*SAFEARRAY, status: HRESULT, requestID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnQueryCommandComplete(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, responseID, deviceServiceData, status, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnEventNotification(self: *const T, deviceService: ?*IMbnDeviceService, eventID: u32, deviceServiceData: ?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnEventNotification(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, eventID, deviceServiceData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnOpenDataSessionComplete(self: *const T, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnOpenDataSessionComplete(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, status, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnCloseDataSessionComplete(self: *const T, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnCloseDataSessionComplete(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, status, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnWriteDataComplete(self: *const T, deviceService: ?*IMbnDeviceService, status: HRESULT, requestID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnWriteDataComplete(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, status, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnReadData(self: *const T, deviceService: ?*IMbnDeviceService, deviceServiceData: ?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnReadData(@ptrCast(*const IMbnDeviceServicesEvents, self), deviceService, deviceServiceData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceServicesEvents_OnInterfaceStateChange(self: *const T, interfaceID: ?BSTR, stateChange: MBN_DEVICE_SERVICES_INTERFACE_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceServicesEvents.VTable, self.vtable).OnInterfaceStateChange(@ptrCast(*const IMbnDeviceServicesEvents, self), interfaceID, stateChange); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IMbnDeviceService_Value = Guid.initString("b3bb9a71-dc70-4be9-a4da-7886ae8b191b"); pub const IID_IMbnDeviceService = &IID_IMbnDeviceService_Value; pub const IMbnDeviceService = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QuerySupportedCommands: fn( self: *const IMbnDeviceService, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenCommandSession: fn( self: *const IMbnDeviceService, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseCommandSession: fn( self: *const IMbnDeviceService, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCommand: fn( self: *const IMbnDeviceService, commandID: u32, deviceServiceData: ?*SAFEARRAY, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryCommand: fn( self: *const IMbnDeviceService, commandID: u32, deviceServiceData: ?*SAFEARRAY, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenDataSession: fn( self: *const IMbnDeviceService, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseDataSession: fn( self: *const IMbnDeviceService, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteData: fn( self: *const IMbnDeviceService, deviceServiceData: ?*SAFEARRAY, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InterfaceID: fn( self: *const IMbnDeviceService, InterfaceID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DeviceServiceID: fn( self: *const IMbnDeviceService, DeviceServiceID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IsCommandSessionOpen: fn( self: *const IMbnDeviceService, value: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IsDataSessionOpen: fn( self: *const IMbnDeviceService, value: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_QuerySupportedCommands(self: *const T, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).QuerySupportedCommands(@ptrCast(*const IMbnDeviceService, self), requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_OpenCommandSession(self: *const T, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).OpenCommandSession(@ptrCast(*const IMbnDeviceService, self), requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_CloseCommandSession(self: *const T, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).CloseCommandSession(@ptrCast(*const IMbnDeviceService, self), requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_SetCommand(self: *const T, commandID: u32, deviceServiceData: ?*SAFEARRAY, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).SetCommand(@ptrCast(*const IMbnDeviceService, self), commandID, deviceServiceData, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_QueryCommand(self: *const T, commandID: u32, deviceServiceData: ?*SAFEARRAY, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).QueryCommand(@ptrCast(*const IMbnDeviceService, self), commandID, deviceServiceData, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_OpenDataSession(self: *const T, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).OpenDataSession(@ptrCast(*const IMbnDeviceService, self), requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_CloseDataSession(self: *const T, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).CloseDataSession(@ptrCast(*const IMbnDeviceService, self), requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_WriteData(self: *const T, deviceServiceData: ?*SAFEARRAY, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).WriteData(@ptrCast(*const IMbnDeviceService, self), deviceServiceData, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_get_InterfaceID(self: *const T, InterfaceID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).get_InterfaceID(@ptrCast(*const IMbnDeviceService, self), InterfaceID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_get_DeviceServiceID(self: *const T, DeviceServiceID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).get_DeviceServiceID(@ptrCast(*const IMbnDeviceService, self), DeviceServiceID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_get_IsCommandSessionOpen(self: *const T, value: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).get_IsCommandSessionOpen(@ptrCast(*const IMbnDeviceService, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnDeviceService_get_IsDataSessionOpen(self: *const T, value: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnDeviceService.VTable, self.vtable).get_IsDataSessionOpen(@ptrCast(*const IMbnDeviceService, self), value); } };} pub usingnamespace MethodMixin(@This()); }; pub const __mbnapi_ReferenceRemainingTypes__ = extern struct { bandClass: MBN_BAND_CLASS, contextConstants: MBN_CONTEXT_CONSTANTS, ctrlCaps: MBN_CTRL_CAPS, dataClass: MBN_DATA_CLASS, interfaceCapsConstants: MBN_INTERFACE_CAPS_CONSTANTS, pinConstants: MBN_PIN_CONSTANTS, providerConstants: MBN_PROVIDER_CONSTANTS, providerState: MBN_PROVIDER_STATE, registrationConstants: MBN_REGISTRATION_CONSTANTS, signalConstants: MBN_SIGNAL_CONSTANTS, smsCaps: MBN_SMS_CAPS, smsConstants: WWAEXT_SMS_CONSTANTS, wwaextSmsConstants: WWAEXT_SMS_CONSTANTS, smsStatusFlag: MBN_SMS_STATUS_FLAG, }; pub const __DummyPinType__ = extern struct { pinType: u32, }; // TODO: this type is limited to platform 'windows6.1' const IID_IMbnPin_Value = Guid.initString("dcbbbab6-2007-4bbb-aaee-338e368af6fa"); pub const IID_IMbnPin = &IID_IMbnPin_Value; pub const IMbnPin = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PinType: fn( self: *const IMbnPin, PinType: ?*MBN_PIN_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PinFormat: fn( self: *const IMbnPin, PinFormat: ?*MBN_PIN_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PinLengthMin: fn( self: *const IMbnPin, PinLengthMin: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PinLengthMax: fn( self: *const IMbnPin, PinLengthMax: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PinMode: fn( self: *const IMbnPin, PinMode: ?*MBN_PIN_MODE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enable: fn( self: *const IMbnPin, pin: ?[*:0]const u16, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disable: fn( self: *const IMbnPin, pin: ?[*:0]const u16, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enter: fn( self: *const IMbnPin, pin: ?[*:0]const u16, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Change: fn( self: *const IMbnPin, pin: ?[*:0]const u16, newPin: ?[*:0]const u16, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unblock: fn( self: *const IMbnPin, puk: ?[*:0]const u16, newPin: ?[*:0]const u16, requestID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPinManager: fn( self: *const IMbnPin, pinManager: ?*?*IMbnPinManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_get_PinType(self: *const T, PinType: ?*MBN_PIN_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).get_PinType(@ptrCast(*const IMbnPin, self), PinType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_get_PinFormat(self: *const T, PinFormat: ?*MBN_PIN_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).get_PinFormat(@ptrCast(*const IMbnPin, self), PinFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_get_PinLengthMin(self: *const T, PinLengthMin: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).get_PinLengthMin(@ptrCast(*const IMbnPin, self), PinLengthMin); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_get_PinLengthMax(self: *const T, PinLengthMax: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).get_PinLengthMax(@ptrCast(*const IMbnPin, self), PinLengthMax); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_get_PinMode(self: *const T, PinMode: ?*MBN_PIN_MODE) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).get_PinMode(@ptrCast(*const IMbnPin, self), PinMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_Enable(self: *const T, pin: ?[*:0]const u16, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).Enable(@ptrCast(*const IMbnPin, self), pin, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_Disable(self: *const T, pin: ?[*:0]const u16, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).Disable(@ptrCast(*const IMbnPin, self), pin, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_Enter(self: *const T, pin: ?[*:0]const u16, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).Enter(@ptrCast(*const IMbnPin, self), pin, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_Change(self: *const T, pin: ?[*:0]const u16, newPin: ?[*:0]const u16, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).Change(@ptrCast(*const IMbnPin, self), pin, newPin, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_Unblock(self: *const T, puk: ?[*:0]const u16, newPin: ?[*:0]const u16, requestID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).Unblock(@ptrCast(*const IMbnPin, self), puk, newPin, requestID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMbnPin_GetPinManager(self: *const T, pinManager: ?*?*IMbnPinManager) callconv(.Inline) HRESULT { return @ptrCast(*const IMbnPin.VTable, self.vtable).GetPinManager(@ptrCast(*const IMbnPin, self), pinManager); } };} 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 (8) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BSTR = @import("../foundation.zig").BSTR; const HRESULT = @import("../foundation.zig").HRESULT; const IDispatch = @import("../system/com.zig").IDispatch; const IUnknown = @import("../system/com.zig").IUnknown; const PWSTR = @import("../foundation.zig").PWSTR; const SAFEARRAY = @import("../system/com.zig").SAFEARRAY; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/network_management/mobile_broadband.zig
const std = @import("std"); const TypeInfo = std.builtin.TypeInfo; pub fn Bitmask(comptime BackingType: type, comptime fields: anytype) type { const BaseStruct = packed struct {}; var base_struct_info = @typeInfo(BaseStruct); var incoming_fields: [fields.len]TypeInfo.StructField = undefined; inline for (fields) |field, i| { incoming_fields[i] = .{ .name = field[0], .field_type = bool, .default_value = false, .is_comptime = false, .alignment = @alignOf(bool) }; } base_struct_info.Struct.fields = incoming_fields[0..]; const BitmaskFields = @Type(base_struct_info); return struct{ pub const Result = BitmaskFields; /// Given a masked value, create an instance of the bitmask fields struct /// with the appropriate fields set to "true" based on the input value. pub fn applyBitmask(value: BackingType) callconv(.Inline) Result { var result = Result{}; inline for (fields) |field| { if (value & field[1] == field[1]) { @field(result, field[0]) = true; } } return result; } /// Given a bitmask field struct, generate a masked value using the configured mask values /// for each field. pub fn createBitmask(bitmask_fields: BitmaskFields) callconv(.Inline) BackingType { var result: BackingType = 0; inline for (fields) |field| { if (@field(bitmask_fields, field[0])) { result |= field[1]; } } return result; } }; } pub fn EnumErrorSet(comptime BaseEnum: type) type { switch (@typeInfo(BaseEnum)) { .Enum => |info| { var error_set: [info.fields.len]TypeInfo.Error = undefined; inline for (info.fields) |field, index| { error_set[index] = .{ .name = field.name }; } return @Type(TypeInfo{ .ErrorSet = error_set[0..] }); }, else => @compileError("EnumErrorSet requires an enum, found " ++ @typeName(BaseEnum)) } } /// Initialize a tagged union with a comptime-known enum value. This is just a thin wrapper over the builtin function @unionInit. pub fn unionInitEnum(comptime U: type, comptime E: std.meta.Tag(U), value: std.meta.TagPayload(U, E)) callconv(.Inline) U { return @unionInit(U, @tagName(E), value); } pub fn sliceToValue(comptime T: type, slice: []u8) callconv(.Inline) T { const ptr = @ptrCast(*const [@sizeOf(T)]u8, slice[0..@sizeOf(T)]); return std.mem.bytesToValue(T, ptr); } test "bitmask" { const TestType = Bitmask(u4, .{ .{ "fieldA", 0b0001 }, .{ "fieldB", 0b0010 }, .{ "fieldC", 0b0100 } }); const test_value = TestType.applyBitmask(0b0110); try std.testing.expect(!test_value.fieldA); try std.testing.expect(test_value.fieldB); try std.testing.expect(test_value.fieldC); const test_set: TestType.Result = .{ .fieldA = true, .fieldB = false, .fieldC = true }; const test_set_result = TestType.createBitmask(test_set); try std.testing.expectEqual(@as(u4, 0b0101), test_set_result); } test "enum error" { const Base = enum { A, B, C }; const BaseError = EnumErrorSet(Base); try std.testing.expectEqualStrings("A", @typeInfo(BaseError).ErrorSet.?[0].name); try std.testing.expectEqualStrings("B", @typeInfo(BaseError).ErrorSet.?[1].name); try std.testing.expectEqualStrings("C", @typeInfo(BaseError).ErrorSet.?[2].name); // Just making sure everything compiles, that BaseError is accepted in the error // spot of the return type. // The actual logic below is pretty basic and not really the point here const test_func = (struct { pub fn f() BaseError!void { return BaseError.B; } }).f; try std.testing.expectError(BaseError.B, test_func()); }
src/util.zig
const std = @import("std"); const Planet = struct { parent: []const u8, childs: u32 = 0, }; const Hash = std.StringHashMap(Planet); pub fn main() anyerror!void { const allocator = &std.heap.ArenaAllocator.init(std.heap.page_allocator).allocator; const limit = 1 * 1024 * 1024 * 1024; const text = try std.fs.cwd().readFileAlloc(allocator, "problem6.txt", limit); var table = Hash.init(allocator); defer table.deinit(); _ = try table.put("COM", Planet{ .parent = "" }); { var it = std.mem.split(u8, text, "\n"); while (it.next()) |line| { const l = std.fmt.trim(line); if (l.len == 0) continue; const sep = std.mem.indexOf(u8, l, ")"); if (sep) |s| { const parent = l[0..s]; const cur = l[s + 1 ..]; const entry = table.get(cur); if (entry) |_| { return error.DuplicateEntry; } _ = try table.put(cur, Planet{ .parent = parent }); } else { std.debug.print("while reading '{}'\n", .{line}); return error.ParseError; } } } { var total: u32 = 0; var it = table.iterator(); while (it.next()) |cur| { var next = cur.value.parent; while (next.len > 0) { const planet = table.get(next); if (planet) |p| { p.value.childs += 1; next = p.value.parent; } else { std.debug.print("while examining '{}'\n", .{cur}); return error.UnknowParentPlanet; } } } } { var total: u32 = 0; var it = table.iterator(); while (it.next()) |planet| { total += planet.value.childs; } const out = std.io.getStdOut().writer(); try out.print("{}\n", .{total}); } // return error.SolutionNotFound; }
2019/day6a.zig
const rl = @import("raylib"); pub fn main() anyerror!void { // Initialization //-------------------------------------------------------------------------------------- const screenWidth = 800; const screenHeight = 450; rl.InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - mouse input"); var ballPosition = rl.Vector2 { .x = -100.0, .y = -100.0 }; var ballColor = rl.DARKBLUE; rl.SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop while (!rl.WindowShouldClose()) // Detect window close button or ESC key { // Update //---------------------------------------------------------------------------------- ballPosition = rl.GetMousePosition(); ballPosition.x = @intToFloat(f32, rl.GetMouseX()); ballPosition.y = @intToFloat(f32, rl.GetMouseY()); if (rl.IsMouseButtonPressed(rl.MouseButton.MOUSE_LEFT_BUTTON)) { ballColor = rl.MAROON; } else if (rl.IsMouseButtonPressed(rl.MouseButton.MOUSE_MIDDLE_BUTTON)) { ballColor = rl.LIME; } else if (rl.IsMouseButtonPressed(rl.MouseButton.MOUSE_RIGHT_BUTTON)) { ballColor = rl.DARKBLUE; } //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- rl.BeginDrawing(); rl.ClearBackground(rl.RAYWHITE); rl.DrawCircle(@floatToInt(c_int, ballPosition.x), @floatToInt(c_int, ballPosition.y), 50, ballColor); //DrawCircleV(ballPosition, 40, ballColor); rl.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.DARKGRAY); rl.EndDrawing(); //---------------------------------------------------------------------------------- } // De-Initialization //-------------------------------------------------------------------------------------- rl.CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- }
examples/core/input_mouse.zig
const std = @import("std"); pub extern const tinyfd_version: [8]u8; pub extern const tinyfd_needs: [*c]const u8; pub extern var tinyfd_verbose: c_int; pub extern var tinyfd_silent: c_int; pub extern var tinyfd_forceConsole: c_int; pub extern var tinyfd_response: [1024]u8; pub extern fn tinyfd_beep() void; pub extern fn tinyfd_notifyPopup(aTitle: [*c]const u8, aMessage: [*c]const u8, aIconType: [*c]const u8) c_int; pub extern fn tinyfd_messageBox(aTitle: [*c]const u8, aMessage: [*c]const u8, aDialogType: [*c]const u8, aIconType: [*c]const u8, aDefaultButton: c_int) c_int; pub extern fn tinyfd_inputBox(aTitle: [*c]const u8, aMessage: [*c]const u8, aDefaultInput: [*c]const u8) [*c]u8; pub extern fn tinyfd_saveFileDialog(aTitle: [*c]const u8, aDefaultPathAndFile: [*c]const u8, aNumOfFilterPatterns: c_int, aFilterPatterns: [*c]const [*c]const u8, aSingleFilterDescription: [*c]const u8) [*c]u8; pub extern fn tinyfd_openFileDialog(aTitle: [*c]const u8, aDefaultPathAndFile: [*c]const u8, aNumOfFilterPatterns: c_int, aFilterPatterns: [*c]const [*c]const u8, aSingleFilterDescription: [*c]const u8, aAllowMultipleSelects: c_int) [*c]u8; pub extern fn tinyfd_selectFolderDialog(aTitle: [*c]const u8, aDefaultPath: [*c]const u8) [*c]u8; pub extern fn tinyfd_colorChooser(aTitle: [*c]const u8, aDefaultHexRGB: [*c]const u8, aDefaultRGB: [*c]const u8, aoResultRGB: [*c]u8) [*c]u8; pub extern fn tinyfd_arrayDialog(aTitle: [*c]const u8, aNumOfColumns: c_int, aColumns: [*c]const [*c]const u8, aNumOfRows: c_int, aCells: [*c]const [*c]const u8) [*c]u8; pub fn openFileDialog(title: [:0]const u8, path: [:0]const u8, filter: [:0]const u8) [*c]u8 { if (std.mem.eql(u8, "", filter)) { return tinyfd_openFileDialog(title, path, 0, null, null, 0); } const filters = &[_][*c]const u8{@ptrCast([*c]const u8, filter)}; return tinyfd_openFileDialog(title, path, 1, filters, null, 0); } pub fn selectFolderDialog(title: [:0]const u8, path: [:0]const u8) [*c]u8 { return tinyfd_selectFolderDialog(title, path); } pub fn saveFileDialog(title: [:0]const u8, path: [:0]const u8, filter: [:0]const u8) [*c]u8 { if (std.mem.eql(u8, "", filter)) { return tinyfd_saveFileDialog(title, path, 0, null, null); } const filters = &[_][*c]const u8{@ptrCast([*c]const u8, filter)}; return tinyfd_saveFileDialog(title, path, 1, filters, null); }
src/deps/filebrowser/filebrowser.zig
const std = @import("std.zig"); const assert = debug.assert; const autoHash = std.hash.autoHash; const debug = std.debug; const warn = debug.warn; const math = std.math; const mem = std.mem; const meta = std.meta; const trait = meta.trait; const Allocator = mem.Allocator; const Wyhash = std.hash.Wyhash; pub fn getAutoHashFn(comptime K: type, comptime Context: type) (fn (Context, K) u64) { comptime { assert(@hasDecl(std, "StringHashMap")); // detect when the following message needs updated if (K == []const u8) { @compileError("std.auto_hash.autoHash does not allow slices here (" ++ @typeName(K) ++ ") because the intent is unclear. " ++ "Consider using std.StringHashMap for hashing the contents of []const u8. " ++ "Alternatively, consider using std.auto_hash.hash or providing your own hash function instead."); } } return struct { fn hash(ctx: Context, key: K) u64 { _ = ctx; if (comptime trait.hasUniqueRepresentation(K)) { return Wyhash.hash(0, std.mem.asBytes(&key)); } else { var hasher = Wyhash.init(0); autoHash(&hasher, key); return hasher.final(); } } }.hash; } pub fn getAutoEqlFn(comptime K: type, comptime Context: type) (fn (Context, K, K) bool) { return struct { fn eql(ctx: Context, a: K, b: K) bool { _ = ctx; return meta.eql(a, b); } }.eql; } pub fn AutoHashMap(comptime K: type, comptime V: type) type { return HashMap(K, V, AutoContext(K), default_max_load_percentage); } pub fn AutoHashMapUnmanaged(comptime K: type, comptime V: type) type { return HashMapUnmanaged(K, V, AutoContext(K), default_max_load_percentage); } pub fn AutoContext(comptime K: type) type { return struct { pub const hash = getAutoHashFn(K, @This()); pub const eql = getAutoEqlFn(K, @This()); }; } /// Builtin hashmap for strings as keys. /// Key memory is managed by the caller. Keys and values /// will not automatically be freed. pub fn StringHashMap(comptime V: type) type { return HashMap([]const u8, V, StringContext, default_max_load_percentage); } /// Key memory is managed by the caller. Keys and values /// will not automatically be freed. pub fn StringHashMapUnmanaged(comptime V: type) type { return HashMapUnmanaged([]const u8, V, StringContext, default_max_load_percentage); } pub const StringContext = struct { pub fn hash(self: @This(), s: []const u8) u64 { _ = self; return hashString(s); } pub fn eql(self: @This(), a: []const u8, b: []const u8) bool { _ = self; return eqlString(a, b); } }; pub fn eqlString(a: []const u8, b: []const u8) bool { return mem.eql(u8, a, b); } pub fn hashString(s: []const u8) u64 { return std.hash.Wyhash.hash(0, s); } /// Deprecated use `default_max_load_percentage` pub const DefaultMaxLoadPercentage = default_max_load_percentage; pub const default_max_load_percentage = 80; /// This function issues a compile error with a helpful message if there /// is a problem with the provided context type. A context must have the following /// member functions: /// - hash(self, PseudoKey) Hash /// - eql(self, PseudoKey, Key) bool /// If you are passing a context to a *Adapted function, PseudoKey is the type /// of the key parameter. Otherwise, when creating a HashMap or HashMapUnmanaged /// type, PseudoKey = Key = K. pub fn verifyContext(comptime RawContext: type, comptime PseudoKey: type, comptime Key: type, comptime Hash: type) void { comptime { var allow_const_ptr = false; var allow_mutable_ptr = false; // Context is the actual namespace type. RawContext may be a pointer to Context. var Context = RawContext; // Make sure the context is a namespace type which may have member functions switch (@typeInfo(Context)) { .Struct, .Union, .Enum => {}, // Special-case .Opaque for a better error message .Opaque => @compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context) ++ " because it is opaque. Use a pointer instead."), .Pointer => |ptr| { if (ptr.size != .One) { @compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context) ++ " because it is not a single pointer."); } Context = ptr.child; allow_const_ptr = true; allow_mutable_ptr = !ptr.is_const; switch (@typeInfo(Context)) { .Struct, .Union, .Enum, .Opaque => {}, else => @compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context)), } }, else => @compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context)), } // Keep track of multiple errors so we can report them all. var errors: []const u8 = ""; // Put common errors here, they will only be evaluated // if the error is actually triggered. const lazy = struct { const prefix = "\n "; const deep_prefix = prefix ++ " "; const hash_signature = "fn (self, " ++ @typeName(PseudoKey) ++ ") " ++ @typeName(Hash); const eql_signature = "fn (self, " ++ @typeName(PseudoKey) ++ ", " ++ @typeName(Key) ++ ") bool"; const err_invalid_hash_signature = prefix ++ @typeName(Context) ++ ".hash must be " ++ hash_signature ++ deep_prefix ++ "but is actually " ++ @typeName(@TypeOf(Context.hash)); const err_invalid_eql_signature = prefix ++ @typeName(Context) ++ ".eql must be " ++ eql_signature ++ deep_prefix ++ "but is actually " ++ @typeName(@TypeOf(Context.eql)); }; // Verify Context.hash(self, PseudoKey) => Hash if (@hasDecl(Context, "hash")) { const hash = Context.hash; const info = @typeInfo(@TypeOf(hash)); if (info == .Fn) { const func = info.Fn; if (func.args.len != 2) { errors = errors ++ lazy.err_invalid_hash_signature; } else { var emitted_signature = false; if (func.args[0].arg_type) |Self| { if (Self == Context) { // pass, this is always fine. } else if (Self == *const Context) { if (!allow_const_ptr) { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_hash_signature; emitted_signature = true; } errors = errors ++ lazy.deep_prefix ++ "First parameter must be " ++ @typeName(Context) ++ ", but is " ++ @typeName(Self); errors = errors ++ lazy.deep_prefix ++ "Note: Cannot be a pointer because it is passed by value."; } } else if (Self == *Context) { if (!allow_mutable_ptr) { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_hash_signature; emitted_signature = true; } if (!allow_const_ptr) { errors = errors ++ lazy.deep_prefix ++ "First parameter must be " ++ @typeName(Context) ++ ", but is " ++ @typeName(Self); errors = errors ++ lazy.deep_prefix ++ "Note: Cannot be a pointer because it is passed by value."; } else { errors = errors ++ lazy.deep_prefix ++ "First parameter must be " ++ @typeName(Context) ++ " or " ++ @typeName(*const Context) ++ ", but is " ++ @typeName(Self); errors = errors ++ lazy.deep_prefix ++ "Note: Cannot be non-const because it is passed by const pointer."; } } } else { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_hash_signature; emitted_signature = true; } errors = errors ++ lazy.deep_prefix ++ "First parameter must be " ++ @typeName(Context); if (allow_const_ptr) { errors = errors ++ " or " ++ @typeName(*const Context); if (allow_mutable_ptr) { errors = errors ++ " or " ++ @typeName(*Context); } } errors = errors ++ ", but is " ++ @typeName(Self); } } if (func.args[1].arg_type != null and func.args[1].arg_type.? != PseudoKey) { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_hash_signature; emitted_signature = true; } errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].arg_type.?); } if (func.return_type != null and func.return_type.? != Hash) { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_hash_signature; emitted_signature = true; } errors = errors ++ lazy.deep_prefix ++ "Return type must be " ++ @typeName(Hash) ++ ", but was " ++ @typeName(func.return_type.?); } // If any of these are generic (null), we cannot verify them. // The call sites check the return type, but cannot check the // parameters. This may cause compile errors with generic hash/eql functions. } } else { errors = errors ++ lazy.err_invalid_hash_signature; } } else { errors = errors ++ lazy.prefix ++ @typeName(Context) ++ " must declare a hash function with signature " ++ lazy.hash_signature; } // Verify Context.eql(self, PseudoKey, Key) => bool if (@hasDecl(Context, "eql")) { const eql = Context.eql; const info = @typeInfo(@TypeOf(eql)); if (info == .Fn) { const func = info.Fn; if (func.args.len != 3) { errors = errors ++ lazy.err_invalid_eql_signature; } else { var emitted_signature = false; if (func.args[0].arg_type) |Self| { if (Self == Context) { // pass, this is always fine. } else if (Self == *const Context) { if (!allow_const_ptr) { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_eql_signature; emitted_signature = true; } errors = errors ++ lazy.deep_prefix ++ "First parameter must be " ++ @typeName(Context) ++ ", but is " ++ @typeName(Self); errors = errors ++ lazy.deep_prefix ++ "Note: Cannot be a pointer because it is passed by value."; } } else if (Self == *Context) { if (!allow_mutable_ptr) { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_eql_signature; emitted_signature = true; } if (!allow_const_ptr) { errors = errors ++ lazy.deep_prefix ++ "First parameter must be " ++ @typeName(Context) ++ ", but is " ++ @typeName(Self); errors = errors ++ lazy.deep_prefix ++ "Note: Cannot be a pointer because it is passed by value."; } else { errors = errors ++ lazy.deep_prefix ++ "First parameter must be " ++ @typeName(Context) ++ " or " ++ @typeName(*const Context) ++ ", but is " ++ @typeName(Self); errors = errors ++ lazy.deep_prefix ++ "Note: Cannot be non-const because it is passed by const pointer."; } } } else { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_eql_signature; emitted_signature = true; } errors = errors ++ lazy.deep_prefix ++ "First parameter must be " ++ @typeName(Context); if (allow_const_ptr) { errors = errors ++ " or " ++ @typeName(*const Context); if (allow_mutable_ptr) { errors = errors ++ " or " ++ @typeName(*Context); } } errors = errors ++ ", but is " ++ @typeName(Self); } } if (func.args[1].arg_type.? != PseudoKey) { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_eql_signature; emitted_signature = true; } errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].arg_type.?); } if (func.args[2].arg_type.? != Key) { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_eql_signature; emitted_signature = true; } errors = errors ++ lazy.deep_prefix ++ "Third parameter must be " ++ @typeName(Key) ++ ", but is " ++ @typeName(func.args[2].arg_type.?); } if (func.return_type.? != bool) { if (!emitted_signature) { errors = errors ++ lazy.err_invalid_eql_signature; emitted_signature = true; } errors = errors ++ lazy.deep_prefix ++ "Return type must be bool, but was " ++ @typeName(func.return_type.?); } // If any of these are generic (null), we cannot verify them. // The call sites check the return type, but cannot check the // parameters. This may cause compile errors with generic hash/eql functions. } } else { errors = errors ++ lazy.err_invalid_eql_signature; } } else { errors = errors ++ lazy.prefix ++ @typeName(Context) ++ " must declare a eql function with signature " ++ lazy.eql_signature; } if (errors.len != 0) { // errors begins with a newline (from lazy.prefix) @compileError("Problems found with hash context type " ++ @typeName(Context) ++ ":" ++ errors); } } } /// General purpose hash table. /// No order is guaranteed and any modification invalidates live iterators. /// It provides fast operations (lookup, insertion, deletion) with quite high /// load factors (up to 80% by default) for a low memory usage. /// For a hash map that can be initialized directly that does not store an Allocator /// field, see `HashMapUnmanaged`. /// If iterating over the table entries is a strong usecase and needs to be fast, /// prefer the alternative `std.ArrayHashMap`. /// Context must be a struct type with two member functions: /// hash(self, K) u64 /// eql(self, K, K) bool /// Adapted variants of many functions are provided. These variants /// take a pseudo key instead of a key. Their context must have the functions: /// hash(self, PseudoKey) u64 /// eql(self, PseudoKey, K) bool pub fn HashMap( comptime K: type, comptime V: type, comptime Context: type, comptime max_load_percentage: u64, ) type { comptime verifyContext(Context, K, K, u64); return struct { unmanaged: Unmanaged, allocator: *Allocator, ctx: Context, /// The type of the unmanaged hash map underlying this wrapper pub const Unmanaged = HashMapUnmanaged(K, V, Context, max_load_percentage); /// An entry, containing pointers to a key and value stored in the map pub const Entry = Unmanaged.Entry; /// A copy of a key and value which are no longer in the map pub const KV = Unmanaged.KV; /// The integer type that is the result of hashing pub const Hash = Unmanaged.Hash; /// The iterator type returned by iterator() pub const Iterator = Unmanaged.Iterator; pub const KeyIterator = Unmanaged.KeyIterator; pub const ValueIterator = Unmanaged.ValueIterator; /// The integer type used to store the size of the map pub const Size = Unmanaged.Size; /// The type returned from getOrPut and variants pub const GetOrPutResult = Unmanaged.GetOrPutResult; const Self = @This(); /// Create a managed hash map with an empty context. /// If the context is not zero-sized, you must use /// initContext(allocator, ctx) instead. pub fn init(allocator: *Allocator) Self { if (@sizeOf(Context) != 0) { @compileError("Context must be specified! Call initContext(allocator, ctx) instead."); } return .{ .unmanaged = .{}, .allocator = allocator, .ctx = undefined, // ctx is zero-sized so this is safe. }; } /// Create a managed hash map with a context pub fn initContext(allocator: *Allocator, ctx: Context) Self { return .{ .unmanaged = .{}, .allocator = allocator, .ctx = ctx, }; } /// Release the backing array and invalidate this map. /// This does *not* deinit keys, values, or the context! /// If your keys or values need to be released, ensure /// that that is done before calling this function. pub fn deinit(self: *Self) void { self.unmanaged.deinit(self.allocator); self.* = undefined; } /// Empty the map, but keep the backing allocation for future use. /// This does *not* free keys or values! Be sure to /// release them if they need deinitialization before /// calling this function. pub fn clearRetainingCapacity(self: *Self) void { return self.unmanaged.clearRetainingCapacity(); } /// Empty the map and release the backing allocation. /// This does *not* free keys or values! Be sure to /// release them if they need deinitialization before /// calling this function. pub fn clearAndFree(self: *Self) void { return self.unmanaged.clearAndFree(self.allocator); } /// Return the number of items in the map. pub fn count(self: Self) Size { return self.unmanaged.count(); } /// Create an iterator over the entries in the map. /// The iterator is invalidated if the map is modified. pub fn iterator(self: *const Self) Iterator { return self.unmanaged.iterator(); } /// Create an iterator over the keys in the map. /// The iterator is invalidated if the map is modified. pub fn keyIterator(self: *const Self) KeyIterator { return self.unmanaged.keyIterator(); } /// Create an iterator over the values in the map. /// The iterator is invalidated if the map is modified. pub fn valueIterator(self: *const Self) ValueIterator { return self.unmanaged.valueIterator(); } /// If key exists this function cannot fail. /// If there is an existing item with `key`, then the result /// `Entry` pointers point to it, and found_existing is true. /// Otherwise, puts a new item with undefined value, and /// the `Entry` pointers point to it. Caller should then initialize /// the value (but not the key). pub fn getOrPut(self: *Self, key: K) !GetOrPutResult { return self.unmanaged.getOrPutContext(self.allocator, key, self.ctx); } /// If key exists this function cannot fail. /// If there is an existing item with `key`, then the result /// `Entry` pointers point to it, and found_existing is true. /// Otherwise, puts a new item with undefined key and value, and /// the `Entry` pointers point to it. Caller must then initialize /// the key and value. pub fn getOrPutAdapted(self: *Self, key: anytype, ctx: anytype) !GetOrPutResult { return self.unmanaged.getOrPutContextAdapted(self.allocator, key, ctx, self.ctx); } /// If there is an existing item with `key`, then the result /// `Entry` pointers point to it, and found_existing is true. /// Otherwise, puts a new item with undefined value, and /// the `Entry` pointers point to it. Caller should then initialize /// the value (but not the key). /// If a new entry needs to be stored, this function asserts there /// is enough capacity to store it. pub fn getOrPutAssumeCapacity(self: *Self, key: K) GetOrPutResult { return self.unmanaged.getOrPutAssumeCapacityContext(key, self.ctx); } /// If there is an existing item with `key`, then the result /// `Entry` pointers point to it, and found_existing is true. /// Otherwise, puts a new item with undefined value, and /// the `Entry` pointers point to it. Caller must then initialize /// the key and value. /// If a new entry needs to be stored, this function asserts there /// is enough capacity to store it. pub fn getOrPutAssumeCapacityAdapted(self: *Self, key: anytype, ctx: anytype) GetOrPutResult { return self.unmanaged.getOrPutAssumeCapacityAdapted(self.allocator, key, ctx); } pub fn getOrPutValue(self: *Self, key: K, value: V) !Entry { return self.unmanaged.getOrPutValueContext(self.allocator, key, value, self.ctx); } /// Deprecated: call `ensureUnusedCapacity` or `ensureTotalCapacity`. pub const ensureCapacity = ensureTotalCapacity; /// Increases capacity, guaranteeing that insertions up until the /// `expected_count` will not cause an allocation, and therefore cannot fail. pub fn ensureTotalCapacity(self: *Self, expected_count: Size) !void { return self.unmanaged.ensureTotalCapacityContext(self.allocator, expected_count, self.ctx); } /// Increases capacity, guaranteeing that insertions up until /// `additional_count` **more** items will not cause an allocation, and /// therefore cannot fail. pub fn ensureUnusedCapacity(self: *Self, additional_count: Size) !void { return self.unmanaged.ensureUnusedCapacityContext(self.allocator, additional_count, self.ctx); } /// Returns the number of total elements which may be present before it is /// no longer guaranteed that no allocations will be performed. pub fn capacity(self: *Self) Size { return self.unmanaged.capacity(); } /// Clobbers any existing data. To detect if a put would clobber /// existing data, see `getOrPut`. pub fn put(self: *Self, key: K, value: V) !void { return self.unmanaged.putContext(self.allocator, key, value, self.ctx); } /// Inserts a key-value pair into the hash map, asserting that no previous /// entry with the same key is already present pub fn putNoClobber(self: *Self, key: K, value: V) !void { return self.unmanaged.putNoClobberContext(self.allocator, key, value, self.ctx); } /// Asserts there is enough capacity to store the new key-value pair. /// Clobbers any existing data. To detect if a put would clobber /// existing data, see `getOrPutAssumeCapacity`. pub fn putAssumeCapacity(self: *Self, key: K, value: V) void { return self.unmanaged.putAssumeCapacityContext(key, value, self.ctx); } /// Asserts there is enough capacity to store the new key-value pair. /// Asserts that it does not clobber any existing data. /// To detect if a put would clobber existing data, see `getOrPutAssumeCapacity`. pub fn putAssumeCapacityNoClobber(self: *Self, key: K, value: V) void { return self.unmanaged.putAssumeCapacityNoClobberContext(key, value, self.ctx); } /// Inserts a new `Entry` into the hash map, returning the previous one, if any. pub fn fetchPut(self: *Self, key: K, value: V) !?KV { return self.unmanaged.fetchPutContext(self.allocator, key, value, self.ctx); } /// Inserts a new `Entry` into the hash map, returning the previous one, if any. /// If insertion happuns, asserts there is enough capacity without allocating. pub fn fetchPutAssumeCapacity(self: *Self, key: K, value: V) ?KV { return self.unmanaged.fetchPutAssumeCapacityContext(key, value, self.ctx); } /// Removes a value from the map and returns the removed kv pair. pub fn fetchRemove(self: *Self, key: K) ?KV { return self.unmanaged.fetchRemoveContext(key, self.ctx); } pub fn fetchRemoveAdapted(self: *Self, key: anytype, ctx: anytype) ?KV { return self.unmanaged.fetchRemoveAdapted(key, ctx); } /// Finds the value associated with a key in the map pub fn get(self: Self, key: K) ?V { return self.unmanaged.getContext(key, self.ctx); } pub fn getAdapted(self: Self, key: anytype, ctx: anytype) ?V { return self.unmanaged.getAdapted(key, ctx); } pub fn getPtr(self: Self, key: K) ?*V { return self.unmanaged.getPtrContext(key, self.ctx); } pub fn getPtrAdapted(self: Self, key: anytype, ctx: anytype) ?*V { return self.unmanaged.getPtrAdapted(key, self.ctx); } /// Finds the key and value associated with a key in the map pub fn getEntry(self: Self, key: K) ?Entry { return self.unmanaged.getEntryContext(key, self.ctx); } pub fn getEntryAdapted(self: Self, key: anytype, ctx: anytype) ?Entry { return self.unmanaged.getEntryAdapted(key, ctx); } /// Check if the map contains a key pub fn contains(self: Self, key: K) bool { return self.unmanaged.containsContext(key, self.ctx); } pub fn containsAdapted(self: Self, key: anytype, ctx: anytype) bool { return self.unmanaged.containsAdapted(key, ctx); } /// If there is an `Entry` with a matching key, it is deleted from /// the hash map, and then returned from this function. pub fn remove(self: *Self, key: K) bool { return self.unmanaged.removeContext(key, self.ctx); } pub fn removeAdapted(self: *Self, key: anytype, ctx: anytype) bool { return self.unmanaged.removeAdapted(key, ctx); } /// Creates a copy of this map, using the same allocator pub fn clone(self: Self) !Self { var other = try self.unmanaged.cloneContext(self.allocator, self.ctx); return other.promoteContext(self.allocator, self.ctx); } /// Creates a copy of this map, using a specified allocator pub fn cloneWithAllocator(self: Self, new_allocator: *Allocator) !Self { var other = try self.unmanaged.cloneContext(new_allocator, self.ctx); return other.promoteContext(new_allocator, self.ctx); } /// Creates a copy of this map, using a specified context pub fn cloneWithContext(self: Self, new_ctx: anytype) !HashMap(K, V, @TypeOf(new_ctx), max_load_percentage) { var other = try self.unmanaged.cloneContext(self.allocator, new_ctx); return other.promoteContext(self.allocator, new_ctx); } /// Creates a copy of this map, using a specified allocator and context pub fn cloneWithAllocatorAndContext(new_allocator: *Allocator, new_ctx: anytype) !HashMap(K, V, @TypeOf(new_ctx), max_load_percentage) { var other = try self.unmanaged.cloneContext(new_allocator, new_ctx); return other.promoteContext(new_allocator, new_ctx); } }; } /// A HashMap based on open addressing and linear probing. /// A lookup or modification typically occurs only 2 cache misses. /// No order is guaranteed and any modification invalidates live iterators. /// It achieves good performance with quite high load factors (by default, /// grow is triggered at 80% full) and only one byte of overhead per element. /// The struct itself is only 16 bytes for a small footprint. This comes at /// the price of handling size with u32, which should be reasonnable enough /// for almost all uses. /// Deletions are achieved with tombstones. pub fn HashMapUnmanaged( comptime K: type, comptime V: type, comptime Context: type, comptime max_load_percentage: u64, ) type { if (max_load_percentage <= 0 or max_load_percentage >= 100) @compileError("max_load_percentage must be between 0 and 100."); comptime verifyContext(Context, K, K, u64); return struct { const Self = @This(); // This is actually a midway pointer to the single buffer containing // a `Header` field, the `Metadata`s and `Entry`s. // At `-@sizeOf(Header)` is the Header field. // At `sizeOf(Metadata) * capacity + offset`, which is pointed to by // self.header().entries, is the array of entries. // This means that the hashmap only holds one live allocation, to // reduce memory fragmentation and struct size. /// Pointer to the metadata. metadata: ?[*]Metadata = null, /// Current number of elements in the hashmap. size: Size = 0, // Having a countdown to grow reduces the number of instructions to // execute when determining if the hashmap has enough capacity already. /// Number of available slots before a grow is needed to satisfy the /// `max_load_percentage`. available: Size = 0, // This is purely empirical and not a /very smart magic constant™/. /// Capacity of the first grow when bootstrapping the hashmap. const minimal_capacity = 8; // This hashmap is specially designed for sizes that fit in a u32. pub const Size = u32; // u64 hashes guarantee us that the fingerprint bits will never be used // to compute the index of a slot, maximizing the use of entropy. pub const Hash = u64; pub const Entry = struct { key_ptr: *K, value_ptr: *V, }; pub const KV = struct { key: K, value: V, }; const Header = packed struct { values: [*]V, keys: [*]K, capacity: Size, }; /// Metadata for a slot. It can be in three states: empty, used or /// tombstone. Tombstones indicate that an entry was previously used, /// they are a simple way to handle removal. /// To this state, we add 7 bits from the slot's key hash. These are /// used as a fast way to disambiguate between entries without /// having to use the equality function. If two fingerprints are /// different, we know that we don't have to compare the keys at all. /// The 7 bits are the highest ones from a 64 bit hash. This way, not /// only we use the `log2(capacity)` lowest bits from the hash to determine /// a slot index, but we use 7 more bits to quickly resolve collisions /// when multiple elements with different hashes end up wanting to be in the same slot. /// Not using the equality function means we don't have to read into /// the entries array, likely avoiding a cache miss and a potentially /// costly function call. const Metadata = packed struct { const FingerPrint = u7; const free: FingerPrint = 0; const tombstone: FingerPrint = 1; fingerprint: FingerPrint = free, used: u1 = 0, pub fn isUsed(self: Metadata) bool { return self.used == 1; } pub fn isTombstone(self: Metadata) bool { return !self.isUsed() and self.fingerprint == tombstone; } pub fn takeFingerprint(hash: Hash) FingerPrint { const hash_bits = @typeInfo(Hash).Int.bits; const fp_bits = @typeInfo(FingerPrint).Int.bits; return @truncate(FingerPrint, hash >> (hash_bits - fp_bits)); } pub fn fill(self: *Metadata, fp: FingerPrint) void { self.used = 1; self.fingerprint = fp; } pub fn remove(self: *Metadata) void { self.used = 0; self.fingerprint = tombstone; } }; comptime { assert(@sizeOf(Metadata) == 1); assert(@alignOf(Metadata) == 1); } pub const Iterator = struct { hm: *const Self, index: Size = 0, pub fn next(it: *Iterator) ?Entry { assert(it.index <= it.hm.capacity()); if (it.hm.size == 0) return null; const cap = it.hm.capacity(); const end = it.hm.metadata.? + cap; var metadata = it.hm.metadata.? + it.index; while (metadata != end) : ({ metadata += 1; it.index += 1; }) { if (metadata[0].isUsed()) { const key = &it.hm.keys()[it.index]; const value = &it.hm.values()[it.index]; it.index += 1; return Entry{ .key_ptr = key, .value_ptr = value }; } } return null; } }; pub const KeyIterator = FieldIterator(K); pub const ValueIterator = FieldIterator(V); fn FieldIterator(comptime T: type) type { return struct { len: usize, metadata: [*]const Metadata, items: [*]T, pub fn next(self: *@This()) ?*T { while (self.len > 0) { self.len -= 1; const used = self.metadata[0].isUsed(); const item = &self.items[0]; self.metadata += 1; self.items += 1; if (used) { return item; } } return null; } }; } pub const GetOrPutResult = struct { key_ptr: *K, value_ptr: *V, found_existing: bool, }; pub const Managed = HashMap(K, V, Context, max_load_percentage); pub fn promote(self: Self, allocator: *Allocator) Managed { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call promoteContext instead."); return promoteContext(self, allocator, undefined); } pub fn promoteContext(self: Self, allocator: *Allocator, ctx: Context) Managed { return .{ .unmanaged = self, .allocator = allocator, .ctx = ctx, }; } fn isUnderMaxLoadPercentage(size: Size, cap: Size) bool { return size * 100 < max_load_percentage * cap; } pub fn deinit(self: *Self, allocator: *Allocator) void { self.deallocate(allocator); self.* = undefined; } fn capacityForSize(size: Size) Size { var new_cap = @truncate(u32, (@as(u64, size) * 100) / max_load_percentage + 1); new_cap = math.ceilPowerOfTwo(u32, new_cap) catch unreachable; return new_cap; } /// Deprecated: call `ensureUnusedCapacity` or `ensureTotalCapacity`. pub const ensureCapacity = ensureTotalCapacity; pub fn ensureTotalCapacity(self: *Self, allocator: *Allocator, new_size: Size) !void { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call ensureTotalCapacityContext instead."); return ensureTotalCapacityContext(self, allocator, new_size, undefined); } pub fn ensureTotalCapacityContext(self: *Self, allocator: *Allocator, new_size: Size, ctx: Context) !void { if (new_size > self.size) try self.growIfNeeded(allocator, new_size - self.size, ctx); } pub fn ensureUnusedCapacity(self: *Self, allocator: *Allocator, additional_size: Size) !void { return ensureUnusedCapacityContext(self, allocator, additional_size, undefined); } pub fn ensureUnusedCapacityContext(self: *Self, allocator: *Allocator, additional_size: Size, ctx: Context) !void { return ensureTotalCapacityContext(self, allocator, self.capacity() + additional_size, ctx); } pub fn clearRetainingCapacity(self: *Self) void { if (self.metadata) |_| { self.initMetadatas(); self.size = 0; self.available = @truncate(u32, (self.capacity() * max_load_percentage) / 100); } } pub fn clearAndFree(self: *Self, allocator: *Allocator) void { self.deallocate(allocator); self.size = 0; self.available = 0; } pub fn count(self: *const Self) Size { return self.size; } fn header(self: *const Self) *Header { return @ptrCast(*Header, @ptrCast([*]Header, self.metadata.?) - 1); } fn keys(self: *const Self) [*]K { return self.header().keys; } fn values(self: *const Self) [*]V { return self.header().values; } pub fn capacity(self: *const Self) Size { if (self.metadata == null) return 0; return self.header().capacity; } pub fn iterator(self: *const Self) Iterator { return .{ .hm = self }; } pub fn keyIterator(self: *const Self) KeyIterator { if (self.metadata) |metadata| { return .{ .len = self.capacity(), .metadata = metadata, .items = self.keys(), }; } else { return .{ .len = 0, .metadata = undefined, .items = undefined, }; } } pub fn valueIterator(self: *const Self) ValueIterator { if (self.metadata) |metadata| { return .{ .len = self.capacity(), .metadata = metadata, .items = self.values(), }; } else { return .{ .len = 0, .metadata = undefined, .items = undefined, }; } } /// Insert an entry in the map. Assumes it is not already present. pub fn putNoClobber(self: *Self, allocator: *Allocator, key: K, value: V) !void { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call putNoClobberContext instead."); return self.putNoClobberContext(allocator, key, value, undefined); } pub fn putNoClobberContext(self: *Self, allocator: *Allocator, key: K, value: V, ctx: Context) !void { assert(!self.containsContext(key, ctx)); try self.growIfNeeded(allocator, 1, ctx); self.putAssumeCapacityNoClobberContext(key, value, ctx); } /// Asserts there is enough capacity to store the new key-value pair. /// Clobbers any existing data. To detect if a put would clobber /// existing data, see `getOrPutAssumeCapacity`. pub fn putAssumeCapacity(self: *Self, key: K, value: V) void { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call putAssumeCapacityContext instead."); return self.putAssumeCapacityContext(key, value, undefined); } pub fn putAssumeCapacityContext(self: *Self, key: K, value: V, ctx: Context) void { const gop = self.getOrPutAssumeCapacityContext(key, ctx); gop.value_ptr.* = value; } /// Insert an entry in the map. Assumes it is not already present, /// and that no allocation is needed. pub fn putAssumeCapacityNoClobber(self: *Self, key: K, value: V) void { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call putAssumeCapacityNoClobberContext instead."); return self.putAssumeCapacityNoClobberContext(key, value, undefined); } pub fn putAssumeCapacityNoClobberContext(self: *Self, key: K, value: V, ctx: Context) void { assert(!self.containsContext(key, ctx)); const hash = ctx.hash(key); const mask = self.capacity() - 1; var idx = @truncate(usize, hash & mask); var metadata = self.metadata.? + idx; while (metadata[0].isUsed()) { idx = (idx + 1) & mask; metadata = self.metadata.? + idx; } if (!metadata[0].isTombstone()) { assert(self.available > 0); self.available -= 1; } const fingerprint = Metadata.takeFingerprint(hash); metadata[0].fill(fingerprint); self.keys()[idx] = key; self.values()[idx] = value; self.size += 1; } /// Inserts a new `Entry` into the hash map, returning the previous one, if any. pub fn fetchPut(self: *Self, allocator: *Allocator, key: K, value: V) !?KV { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call fetchPutContext instead."); return self.fetchPutContext(allocator, key, value, undefined); } pub fn fetchPutContext(self: *Self, allocator: *Allocator, key: K, value: V, ctx: Context) !?KV { const gop = try self.getOrPutContext(allocator, key, ctx); var result: ?KV = null; if (gop.found_existing) { result = KV{ .key = gop.key_ptr.*, .value = gop.value_ptr.*, }; } gop.value_ptr.* = value; return result; } /// Inserts a new `Entry` into the hash map, returning the previous one, if any. /// If insertion happens, asserts there is enough capacity without allocating. pub fn fetchPutAssumeCapacity(self: *Self, key: K, value: V) ?KV { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call fetchPutAssumeCapacityContext instead."); return self.fetchPutAssumeCapacityContext(key, value, undefined); } pub fn fetchPutAssumeCapacityContext(self: *Self, key: K, value: V, ctx: Context) ?KV { const gop = self.getOrPutAssumeCapacityContext(key, ctx); var result: ?KV = null; if (gop.found_existing) { result = KV{ .key = gop.key_ptr.*, .value = gop.value_ptr.*, }; } gop.value_ptr.* = value; return result; } /// If there is an `Entry` with a matching key, it is deleted from /// the hash map, and then returned from this function. pub fn fetchRemove(self: *Self, key: K) ?KV { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call fetchRemoveContext instead."); return self.fetchRemoveContext(key, undefined); } pub fn fetchRemoveContext(self: *Self, key: K, ctx: Context) ?KV { return self.fetchRemoveAdapted(key, ctx); } pub fn fetchRemoveAdapted(self: *Self, key: anytype, ctx: anytype) ?KV { if (self.getIndex(key, ctx)) |idx| { const old_key = &self.keys()[idx]; const old_val = &self.values()[idx]; const result = KV{ .key = old_key.*, .value = old_val.*, }; self.metadata.?[idx].remove(); old_key.* = undefined; old_val.* = undefined; self.size -= 1; return result; } return null; } /// Find the index containing the data for the given key. /// Whether this function returns null is almost always /// branched on after this function returns, and this function /// returns null/not null from separate code paths. We /// want the optimizer to remove that branch and instead directly /// fuse the basic blocks after the branch to the basic blocks /// from this function. To encourage that, this function is /// marked as inline. inline fn getIndex(self: Self, key: anytype, ctx: anytype) ?usize { comptime verifyContext(@TypeOf(ctx), @TypeOf(key), K, Hash); if (self.size == 0) { return null; } // If you get a compile error on this line, it means that your generic hash // function is invalid for these parameters. const hash = ctx.hash(key); // verifyContext can't verify the return type of generic hash functions, // so we need to double-check it here. if (@TypeOf(hash) != Hash) { @compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic hash function that returns the wrong type! " ++ @typeName(Hash) ++ " was expected, but found " ++ @typeName(@TypeOf(hash))); } const mask = self.capacity() - 1; const fingerprint = Metadata.takeFingerprint(hash); var idx = @truncate(usize, hash & mask); var metadata = self.metadata.? + idx; while (metadata[0].isUsed() or metadata[0].isTombstone()) { if (metadata[0].isUsed() and metadata[0].fingerprint == fingerprint) { const test_key = &self.keys()[idx]; // If you get a compile error on this line, it means that your generic eql // function is invalid for these parameters. const eql = ctx.eql(key, test_key.*); // verifyContext can't verify the return type of generic eql functions, // so we need to double-check it here. if (@TypeOf(eql) != bool) { @compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic eql function that returns the wrong type! bool was expected, but found " ++ @typeName(@TypeOf(eql))); } if (eql) { return idx; } } idx = (idx + 1) & mask; metadata = self.metadata.? + idx; } return null; } pub fn getEntry(self: Self, key: K) ?Entry { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call getEntryContext instead."); return self.getEntryContext(key, undefined); } pub fn getEntryContext(self: Self, key: K, ctx: Context) ?Entry { return self.getEntryAdapted(key, ctx); } pub fn getEntryAdapted(self: Self, key: anytype, ctx: anytype) ?Entry { if (self.getIndex(key, ctx)) |idx| { return Entry{ .key_ptr = &self.keys()[idx], .value_ptr = &self.values()[idx], }; } return null; } /// Insert an entry if the associated key is not already present, otherwise update preexisting value. pub fn put(self: *Self, allocator: *Allocator, key: K, value: V) !void { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call putContext instead."); return self.putContext(allocator, key, value, undefined); } pub fn putContext(self: *Self, allocator: *Allocator, key: K, value: V, ctx: Context) !void { const result = try self.getOrPutContext(allocator, key, ctx); result.value_ptr.* = value; } /// Get an optional pointer to the value associated with key, if present. pub fn getPtr(self: Self, key: K) ?*V { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call getPtrContext instead."); return self.getPtrContext(key, undefined); } pub fn getPtrContext(self: Self, key: K, ctx: Context) ?*V { return self.getPtrAdapted(key, ctx); } pub fn getPtrAdapted(self: Self, key: anytype, ctx: anytype) ?*V { if (self.getIndex(key, ctx)) |idx| { return &self.values()[idx]; } return null; } /// Get a copy of the value associated with key, if present. pub fn get(self: Self, key: K) ?V { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call getContext instead."); return self.getContext(key, undefined); } pub fn getContext(self: Self, key: K, ctx: Context) ?V { return self.getAdapted(key, ctx); } pub fn getAdapted(self: Self, key: anytype, ctx: anytype) ?V { if (self.getIndex(key, ctx)) |idx| { return self.values()[idx]; } return null; } pub fn getOrPut(self: *Self, allocator: *Allocator, key: K) !GetOrPutResult { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call getOrPutContext instead."); return self.getOrPutContext(allocator, key, undefined); } pub fn getOrPutContext(self: *Self, allocator: *Allocator, key: K, ctx: Context) !GetOrPutResult { const gop = try self.getOrPutContextAdapted(allocator, key, ctx, ctx); if (!gop.found_existing) { gop.key_ptr.* = key; } return gop; } pub fn getOrPutAdapted(self: *Self, allocator: *Allocator, key: anytype, key_ctx: anytype) !GetOrPutResult { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call getOrPutContextAdapted instead."); return self.getOrPutContextAdapted(allocator, key, key_ctx, undefined); } pub fn getOrPutContextAdapted(self: *Self, allocator: *Allocator, key: anytype, key_ctx: anytype, ctx: Context) !GetOrPutResult { self.growIfNeeded(allocator, 1, ctx) catch |err| { // If allocation fails, try to do the lookup anyway. // If we find an existing item, we can return it. // Otherwise return the error, we could not add another. const index = self.getIndex(key, key_ctx) orelse return err; return GetOrPutResult{ .key_ptr = &self.keys()[index], .value_ptr = &self.values()[index], .found_existing = true, }; }; return self.getOrPutAssumeCapacityAdapted(key, key_ctx); } pub fn getOrPutAssumeCapacity(self: *Self, key: K) GetOrPutResult { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call getOrPutAssumeCapacityContext instead."); return self.getOrPutAssumeCapacityContext(key, undefined); } pub fn getOrPutAssumeCapacityContext(self: *Self, key: K, ctx: Context) GetOrPutResult { const result = self.getOrPutAssumeCapacityAdapted(key, ctx); if (!result.found_existing) { result.key_ptr.* = key; } return result; } pub fn getOrPutAssumeCapacityAdapted(self: *Self, key: anytype, ctx: anytype) GetOrPutResult { comptime verifyContext(@TypeOf(ctx), @TypeOf(key), K, Hash); // If you get a compile error on this line, it means that your generic hash // function is invalid for these parameters. const hash = ctx.hash(key); // verifyContext can't verify the return type of generic hash functions, // so we need to double-check it here. if (@TypeOf(hash) != Hash) { @compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic hash function that returns the wrong type! " ++ @typeName(Hash) ++ " was expected, but found " ++ @typeName(@TypeOf(hash))); } const mask = self.capacity() - 1; const fingerprint = Metadata.takeFingerprint(hash); var idx = @truncate(usize, hash & mask); var first_tombstone_idx: usize = self.capacity(); // invalid index var metadata = self.metadata.? + idx; while (metadata[0].isUsed() or metadata[0].isTombstone()) { if (metadata[0].isUsed() and metadata[0].fingerprint == fingerprint) { const test_key = &self.keys()[idx]; // If you get a compile error on this line, it means that your generic eql // function is invalid for these parameters. const eql = ctx.eql(key, test_key.*); // verifyContext can't verify the return type of generic eql functions, // so we need to double-check it here. if (@TypeOf(eql) != bool) { @compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic eql function that returns the wrong type! bool was expected, but found " ++ @typeName(@TypeOf(eql))); } if (eql) { return GetOrPutResult{ .key_ptr = test_key, .value_ptr = &self.values()[idx], .found_existing = true, }; } } else if (first_tombstone_idx == self.capacity() and metadata[0].isTombstone()) { first_tombstone_idx = idx; } idx = (idx + 1) & mask; metadata = self.metadata.? + idx; } if (first_tombstone_idx < self.capacity()) { // Cheap try to lower probing lengths after deletions. Recycle a tombstone. idx = first_tombstone_idx; metadata = self.metadata.? + idx; } else { // We're using a slot previously free. self.available -= 1; } metadata[0].fill(fingerprint); const new_key = &self.keys()[idx]; const new_value = &self.values()[idx]; new_key.* = undefined; new_value.* = undefined; self.size += 1; return GetOrPutResult{ .key_ptr = new_key, .value_ptr = new_value, .found_existing = false, }; } pub fn getOrPutValue(self: *Self, allocator: *Allocator, key: K, value: V) !Entry { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call getOrPutValueContext instead."); return self.getOrPutValueContext(allocator, key, value, undefined); } pub fn getOrPutValueContext(self: *Self, allocator: *Allocator, key: K, value: V, ctx: Context) !Entry { const res = try self.getOrPutAdapted(allocator, key, ctx); if (!res.found_existing) { res.key_ptr.* = key; res.value_ptr.* = value; } return Entry{ .key_ptr = res.key_ptr, .value_ptr = res.value_ptr }; } /// Return true if there is a value associated with key in the map. pub fn contains(self: *const Self, key: K) bool { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call containsContext instead."); return self.containsContext(key, undefined); } pub fn containsContext(self: *const Self, key: K, ctx: Context) bool { return self.containsAdapted(key, ctx); } pub fn containsAdapted(self: *const Self, key: anytype, ctx: anytype) bool { return self.getIndex(key, ctx) != null; } /// If there is an `Entry` with a matching key, it is deleted from /// the hash map, and this function returns true. Otherwise this /// function returns false. pub fn remove(self: *Self, key: K) bool { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call removeContext instead."); return self.removeContext(key, undefined); } pub fn removeContext(self: *Self, key: K, ctx: Context) bool { return self.removeAdapted(key, ctx); } pub fn removeAdapted(self: *Self, key: anytype, ctx: anytype) bool { if (self.getIndex(key, ctx)) |idx| { self.metadata.?[idx].remove(); self.keys()[idx] = undefined; self.values()[idx] = undefined; self.size -= 1; return true; } return false; } fn initMetadatas(self: *Self) void { @memset(@ptrCast([*]u8, self.metadata.?), 0, @sizeOf(Metadata) * self.capacity()); } // This counts the number of occupied slots, used + tombstones, which is // what has to stay under the max_load_percentage of capacity. fn load(self: *const Self) Size { const max_load = (self.capacity() * max_load_percentage) / 100; assert(max_load >= self.available); return @truncate(Size, max_load - self.available); } fn growIfNeeded(self: *Self, allocator: *Allocator, new_count: Size, ctx: Context) !void { if (new_count > self.available) { try self.grow(allocator, capacityForSize(self.load() + new_count), ctx); } } pub fn clone(self: Self, allocator: *Allocator) !Self { if (@sizeOf(Context) != 0) @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call cloneContext instead."); return self.cloneContext(allocator, @as(Context, undefined)); } pub fn cloneContext(self: Self, allocator: *Allocator, new_ctx: anytype) !HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage) { var other = HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage){}; if (self.size == 0) return other; const new_cap = capacityForSize(self.size); try other.allocate(allocator, new_cap); other.initMetadatas(); other.available = @truncate(u32, (new_cap * max_load_percentage) / 100); var i: Size = 0; var metadata = self.metadata.?; var keys_ptr = self.keys(); var values_ptr = self.values(); while (i < self.capacity()) : (i += 1) { if (metadata[i].isUsed()) { other.putAssumeCapacityNoClobberContext(keys_ptr[i], values_ptr[i], new_ctx); if (other.size == self.size) break; } } return other; } fn grow(self: *Self, allocator: *Allocator, new_capacity: Size, ctx: Context) !void { @setCold(true); const new_cap = std.math.max(new_capacity, minimal_capacity); assert(new_cap > self.capacity()); assert(std.math.isPowerOfTwo(new_cap)); var map = Self{}; defer map.deinit(allocator); try map.allocate(allocator, new_cap); map.initMetadatas(); map.available = @truncate(u32, (new_cap * max_load_percentage) / 100); if (self.size != 0) { const old_capacity = self.capacity(); var i: Size = 0; var metadata = self.metadata.?; var keys_ptr = self.keys(); var values_ptr = self.values(); while (i < old_capacity) : (i += 1) { if (metadata[i].isUsed()) { map.putAssumeCapacityNoClobberContext(keys_ptr[i], values_ptr[i], ctx); if (map.size == self.size) break; } } } self.size = 0; std.mem.swap(Self, self, &map); } fn allocate(self: *Self, allocator: *Allocator, new_capacity: Size) !void { const header_align = @alignOf(Header); const key_align = if (@sizeOf(K) == 0) 1 else @alignOf(K); const val_align = if (@sizeOf(V) == 0) 1 else @alignOf(V); const max_align = comptime math.max3(header_align, key_align, val_align); const meta_size = @sizeOf(Header) + new_capacity * @sizeOf(Metadata); comptime assert(@alignOf(Metadata) == 1); const keys_start = std.mem.alignForward(meta_size, key_align); const keys_end = keys_start + new_capacity * @sizeOf(K); const vals_start = std.mem.alignForward(keys_end, val_align); const vals_end = vals_start + new_capacity * @sizeOf(V); const total_size = std.mem.alignForward(vals_end, max_align); const slice = try allocator.alignedAlloc(u8, max_align, total_size); const ptr = @ptrToInt(slice.ptr); const metadata = ptr + @sizeOf(Header); const hdr = @intToPtr(*Header, ptr); if (@sizeOf([*]V) != 0) { hdr.values = @intToPtr([*]V, ptr + vals_start); } if (@sizeOf([*]K) != 0) { hdr.keys = @intToPtr([*]K, ptr + keys_start); } hdr.capacity = new_capacity; self.metadata = @intToPtr([*]Metadata, metadata); } fn deallocate(self: *Self, allocator: *Allocator) void { if (self.metadata == null) return; const header_align = @alignOf(Header); const key_align = if (@sizeOf(K) == 0) 1 else @alignOf(K); const val_align = if (@sizeOf(V) == 0) 1 else @alignOf(V); const max_align = comptime math.max3(header_align, key_align, val_align); const cap = self.capacity(); const meta_size = @sizeOf(Header) + cap * @sizeOf(Metadata); comptime assert(@alignOf(Metadata) == 1); const keys_start = std.mem.alignForward(meta_size, key_align); const keys_end = keys_start + cap * @sizeOf(K); const vals_start = std.mem.alignForward(keys_end, val_align); const vals_end = vals_start + cap * @sizeOf(V); const total_size = std.mem.alignForward(vals_end, max_align); const slice = @intToPtr([*]align(max_align) u8, @ptrToInt(self.header()))[0..total_size]; allocator.free(slice); self.metadata = null; self.available = 0; } }; } const testing = std.testing; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; test "std.hash_map basic usage" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); const count = 5; var i: u32 = 0; var total: u32 = 0; while (i < count) : (i += 1) { try map.put(i, i); total += i; } var sum: u32 = 0; var it = map.iterator(); while (it.next()) |kv| { sum += kv.key_ptr.*; } try expectEqual(total, sum); i = 0; sum = 0; while (i < count) : (i += 1) { try expectEqual(i, map.get(i).?); sum += map.get(i).?; } try expectEqual(total, sum); } test "std.hash_map ensureCapacity" { var map = AutoHashMap(i32, i32).init(std.testing.allocator); defer map.deinit(); try map.ensureCapacity(20); const initial_capacity = map.capacity(); try testing.expect(initial_capacity >= 20); var i: i32 = 0; while (i < 20) : (i += 1) { try testing.expect(map.fetchPutAssumeCapacity(i, i + 10) == null); } // shouldn't resize from putAssumeCapacity try testing.expect(initial_capacity == map.capacity()); } test "std.hash_map ensureCapacity with tombstones" { var map = AutoHashMap(i32, i32).init(std.testing.allocator); defer map.deinit(); var i: i32 = 0; while (i < 100) : (i += 1) { try map.ensureCapacity(@intCast(u32, map.count() + 1)); map.putAssumeCapacity(i, i); // Remove to create tombstones that still count as load in the hashmap. _ = map.remove(i); } } test "std.hash_map clearRetainingCapacity" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); map.clearRetainingCapacity(); try map.put(1, 1); try expectEqual(map.get(1).?, 1); try expectEqual(map.count(), 1); map.clearRetainingCapacity(); map.putAssumeCapacity(1, 1); try expectEqual(map.get(1).?, 1); try expectEqual(map.count(), 1); const cap = map.capacity(); try expect(cap > 0); map.clearRetainingCapacity(); map.clearRetainingCapacity(); try expectEqual(map.count(), 0); try expectEqual(map.capacity(), cap); try expect(!map.contains(1)); } test "std.hash_map grow" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); const growTo = 12456; var i: u32 = 0; while (i < growTo) : (i += 1) { try map.put(i, i); } try expectEqual(map.count(), growTo); i = 0; var it = map.iterator(); while (it.next()) |kv| { try expectEqual(kv.key_ptr.*, kv.value_ptr.*); i += 1; } try expectEqual(i, growTo); i = 0; while (i < growTo) : (i += 1) { try expectEqual(map.get(i).?, i); } } test "std.hash_map clone" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); var a = try map.clone(); defer a.deinit(); try expectEqual(a.count(), 0); try a.put(1, 1); try a.put(2, 2); try a.put(3, 3); var b = try a.clone(); defer b.deinit(); try expectEqual(b.count(), 3); try expectEqual(b.get(1).?, 1); try expectEqual(b.get(2).?, 2); try expectEqual(b.get(3).?, 3); } test "std.hash_map ensureCapacity with existing elements" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); try map.put(0, 0); try expectEqual(map.count(), 1); try expectEqual(map.capacity(), @TypeOf(map).Unmanaged.minimal_capacity); try map.ensureCapacity(65); try expectEqual(map.count(), 1); try expectEqual(map.capacity(), 128); } test "std.hash_map ensureCapacity satisfies max load factor" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); try map.ensureCapacity(127); try expectEqual(map.capacity(), 256); } test "std.hash_map remove" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); var i: u32 = 0; while (i < 16) : (i += 1) { try map.put(i, i); } i = 0; while (i < 16) : (i += 1) { if (i % 3 == 0) { _ = map.remove(i); } } try expectEqual(map.count(), 10); var it = map.iterator(); while (it.next()) |kv| { try expectEqual(kv.key_ptr.*, kv.value_ptr.*); try expect(kv.key_ptr.* % 3 != 0); } i = 0; while (i < 16) : (i += 1) { if (i % 3 == 0) { try expect(!map.contains(i)); } else { try expectEqual(map.get(i).?, i); } } } test "std.hash_map reverse removes" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); var i: u32 = 0; while (i < 16) : (i += 1) { try map.putNoClobber(i, i); } i = 16; while (i > 0) : (i -= 1) { _ = map.remove(i - 1); try expect(!map.contains(i - 1)); var j: u32 = 0; while (j < i - 1) : (j += 1) { try expectEqual(map.get(j).?, j); } } try expectEqual(map.count(), 0); } test "std.hash_map multiple removes on same metadata" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); var i: u32 = 0; while (i < 16) : (i += 1) { try map.put(i, i); } _ = map.remove(7); _ = map.remove(15); _ = map.remove(14); _ = map.remove(13); try expect(!map.contains(7)); try expect(!map.contains(15)); try expect(!map.contains(14)); try expect(!map.contains(13)); i = 0; while (i < 13) : (i += 1) { if (i == 7) { try expect(!map.contains(i)); } else { try expectEqual(map.get(i).?, i); } } try map.put(15, 15); try map.put(13, 13); try map.put(14, 14); try map.put(7, 7); i = 0; while (i < 16) : (i += 1) { try expectEqual(map.get(i).?, i); } } test "std.hash_map put and remove loop in random order" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); var keys = std.ArrayList(u32).init(std.testing.allocator); defer keys.deinit(); const size = 32; const iterations = 100; var i: u32 = 0; while (i < size) : (i += 1) { try keys.append(i); } var rng = std.rand.DefaultPrng.init(0); while (i < iterations) : (i += 1) { std.rand.Random.shuffle(&rng.random, u32, keys.items); for (keys.items) |key| { try map.put(key, key); } try expectEqual(map.count(), size); for (keys.items) |key| { _ = map.remove(key); } try expectEqual(map.count(), 0); } } test "std.hash_map remove one million elements in random order" { const Map = AutoHashMap(u32, u32); const n = 1000 * 1000; var map = Map.init(std.heap.page_allocator); defer map.deinit(); var keys = std.ArrayList(u32).init(std.heap.page_allocator); defer keys.deinit(); var i: u32 = 0; while (i < n) : (i += 1) { keys.append(i) catch unreachable; } var rng = std.rand.DefaultPrng.init(0); std.rand.Random.shuffle(&rng.random, u32, keys.items); for (keys.items) |key| { map.put(key, key) catch unreachable; } std.rand.Random.shuffle(&rng.random, u32, keys.items); i = 0; while (i < n) : (i += 1) { const key = keys.items[i]; _ = map.remove(key); } } test "std.hash_map put" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); var i: u32 = 0; while (i < 16) : (i += 1) { try map.put(i, i); } i = 0; while (i < 16) : (i += 1) { try expectEqual(map.get(i).?, i); } i = 0; while (i < 16) : (i += 1) { try map.put(i, i * 16 + 1); } i = 0; while (i < 16) : (i += 1) { try expectEqual(map.get(i).?, i * 16 + 1); } } test "std.hash_map putAssumeCapacity" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); try map.ensureCapacity(20); var i: u32 = 0; while (i < 20) : (i += 1) { map.putAssumeCapacityNoClobber(i, i); } i = 0; var sum = i; while (i < 20) : (i += 1) { sum += map.getPtr(i).?.*; } try expectEqual(sum, 190); i = 0; while (i < 20) : (i += 1) { map.putAssumeCapacity(i, 1); } i = 0; sum = i; while (i < 20) : (i += 1) { sum += map.get(i).?; } try expectEqual(sum, 20); } test "std.hash_map getOrPut" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); var i: u32 = 0; while (i < 10) : (i += 1) { try map.put(i * 2, 2); } i = 0; while (i < 20) : (i += 1) { _ = try map.getOrPutValue(i, 1); } i = 0; var sum = i; while (i < 20) : (i += 1) { sum += map.get(i).?; } try expectEqual(sum, 30); } test "std.hash_map basic hash map usage" { var map = AutoHashMap(i32, i32).init(std.testing.allocator); defer map.deinit(); try testing.expect((try map.fetchPut(1, 11)) == null); try testing.expect((try map.fetchPut(2, 22)) == null); try testing.expect((try map.fetchPut(3, 33)) == null); try testing.expect((try map.fetchPut(4, 44)) == null); try map.putNoClobber(5, 55); try testing.expect((try map.fetchPut(5, 66)).?.value == 55); try testing.expect((try map.fetchPut(5, 55)).?.value == 66); const gop1 = try map.getOrPut(5); try testing.expect(gop1.found_existing == true); try testing.expect(gop1.value_ptr.* == 55); gop1.value_ptr.* = 77; try testing.expect(map.getEntry(5).?.value_ptr.* == 77); const gop2 = try map.getOrPut(99); try testing.expect(gop2.found_existing == false); gop2.value_ptr.* = 42; try testing.expect(map.getEntry(99).?.value_ptr.* == 42); const gop3 = try map.getOrPutValue(5, 5); try testing.expect(gop3.value_ptr.* == 77); const gop4 = try map.getOrPutValue(100, 41); try testing.expect(gop4.value_ptr.* == 41); try testing.expect(map.contains(2)); try testing.expect(map.getEntry(2).?.value_ptr.* == 22); try testing.expect(map.get(2).? == 22); const rmv1 = map.fetchRemove(2); try testing.expect(rmv1.?.key == 2); try testing.expect(rmv1.?.value == 22); try testing.expect(map.fetchRemove(2) == null); try testing.expect(map.remove(2) == false); try testing.expect(map.getEntry(2) == null); try testing.expect(map.get(2) == null); try testing.expect(map.remove(3) == true); } test "std.hash_map clone" { var original = AutoHashMap(i32, i32).init(std.testing.allocator); defer original.deinit(); var i: u8 = 0; while (i < 10) : (i += 1) { try original.putNoClobber(i, i * 10); } var copy = try original.clone(); defer copy.deinit(); i = 0; while (i < 10) : (i += 1) { try testing.expect(copy.get(i).? == i * 10); } } test "std.hash_map getOrPutAdapted" { const AdaptedContext = struct { fn eql(self: @This(), adapted_key: []const u8, test_key: u64) bool { _ = self; return std.fmt.parseInt(u64, adapted_key, 10) catch unreachable == test_key; } fn hash(self: @This(), adapted_key: []const u8) u64 { _ = self; const key = std.fmt.parseInt(u64, adapted_key, 10) catch unreachable; return (AutoContext(u64){}).hash(key); } }; var map = AutoHashMap(u64, u64).init(testing.allocator); defer map.deinit(); const keys = [_][]const u8{ "1231", "4564", "7894", "1132", "65235", "95462", "0112305", "00658", "0", "2", }; var real_keys: [keys.len]u64 = undefined; inline for (keys) |key_str, i| { const result = try map.getOrPutAdapted(key_str, AdaptedContext{}); try testing.expect(!result.found_existing); real_keys[i] = std.fmt.parseInt(u64, key_str, 10) catch unreachable; result.key_ptr.* = real_keys[i]; result.value_ptr.* = i * 2; } try testing.expectEqual(map.count(), keys.len); inline for (keys) |key_str, i| { const result = try map.getOrPutAdapted(key_str, AdaptedContext{}); try testing.expect(result.found_existing); try testing.expectEqual(real_keys[i], result.key_ptr.*); try testing.expectEqual(@as(u64, i) * 2, result.value_ptr.*); } } test "compile everything" { std.testing.refAllDecls(AutoHashMap(i32, i32)); std.testing.refAllDecls(StringHashMap([]const u8)); std.testing.refAllDecls(AutoHashMap(i32, void)); std.testing.refAllDecls(StringHashMap(u0)); std.testing.refAllDecls(AutoHashMapUnmanaged(i32, i32)); std.testing.refAllDecls(StringHashMapUnmanaged([]const u8)); std.testing.refAllDecls(AutoHashMapUnmanaged(i32, void)); std.testing.refAllDecls(StringHashMapUnmanaged(u0)); }
lib/std/hash_map.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day10.txt"); pub const ChunkType = enum { Paren, Bracket, CurlyBrace, Angle, }; /// Given a valid chunk-opening character, map it to the enum type for the type of chunk it is starting. fn openingType(char: u8) ChunkType { return switch (char) { '(' => .Paren, '[' => .Bracket, '{' => .CurlyBrace, '<' => .Angle, else => unreachable, }; } // Given a chunk-closing character, map it to the enum type for the type of chunk it is closing. fn closingType(char: u8) ChunkType { return switch (char) { ')' => .Paren, ']' => .Bracket, '}' => .CurlyBrace, '>' => .Angle, else => unreachable, }; } /// Given a chunk type, return the score for that chunk if it is found to be invalid, as per part 1 /// problem statement. fn invalidScore(chunk_type: ChunkType) u32 { return switch (chunk_type) { .Paren => 3, .Bracket => 57, .CurlyBrace => 1197, .Angle => 25137, }; } /// Given a chunk type, return the score for that chunk if it is found to be incomplete, as per part 2 /// problem statement. fn incompleteScore(chunk_type: ChunkType) u64 { return switch (chunk_type) { .Paren => 1, .Bracket => 2, .CurlyBrace => 3, .Angle => 4, }; } pub fn main() !void { defer { const leaks = util.gpa_impl.deinit(); std.debug.assert(!leaks); } // Go through each line and parse appropriately var it = util.tokenize(u8, data, "\n"); var invalid_close = util.List(ChunkType).init(util.gpa); defer invalid_close.deinit(); var incomplete_scores = util.List(u64).init(util.gpa); defer incomplete_scores.deinit(); line_loop: while (it.next()) |line| { var queue = std.ArrayList(ChunkType).init(util.gpa); defer queue.deinit(); for (line) |ch| { switch (ch) { '(', '[', '{', '<' => |val| try queue.append(openingType(val)), ')', ']', '}', '>' => |val| { const closing = closingType(val); // Found invalid character; add to list for later and move on to next line if (closing != queue.items[queue.items.len - 1]) { try invalid_close.append(closing); continue :line_loop; } else { // Pop off character so we can deal with the next _ = queue.pop(); } }, ',' => continue, else => return error.InvalidInput, } } // If we get here, line is either correct or incomplete; if it's incomplete, the queue will // not be empty, and the characters we need to finish it are simply the characters that are // in the queue (in order). So we'll calculate the total score for incomplete. // Score tracked for incomplete lines, per part 2 problem description var incomplete_score: u64 = 0; while (queue.items.len != 0) { const item = queue.pop(); incomplete_score *= 5; incomplete_score += incompleteScore(item); } if (incomplete_score != 0) { try incomplete_scores.append(incomplete_score); } } // Sum up invalid scores var invalid_score: u32 = 0; for (invalid_close.items) |invalid_value| { invalid_score += invalidScore(invalid_value); } util.print("Part 1: Total score of invalid chunks is: {d}\n", .{invalid_score}); // Sort incomplete scores and select middle one if (incomplete_scores.items.len % 2 != 1) return error.InvalidInput; util.sort(u64, incomplete_scores.items, {}, comptime util.asc(u64)); util.print("Part 2: Middle score of incomplete chunks is: {d}\n", .{incomplete_scores.items[incomplete_scores.items.len / 2]}); }
src/day10.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const test_allocator = std.testing.allocator; const FLIR = @import("./Old_FLIR.zig"); const CFO = @import("./CFO.zig"); const print = std.debug.print; const Self = @This(); const Inst = FLIR.Inst; flir: *FLIR, // tmp: [10]?u16 = .{null} ** 10, tmp: [10]?u16 = ([1]?u16{null}) ** 10, str: []const u8, pos: usize, pub fn nonws(self: *Self) ?u8 { while (self.pos < self.str.len) : (self.pos += 1) { if (self.str[self.pos] != ' ') { return self.str[self.pos]; } } return null; } pub fn num(self: *Self) ?u4 { const c = self.nonws() orelse return null; if ('0' <= c and c < '9') { self.pos += 1; return @intCast(u4, c - '0'); } return null; } pub fn idx(self: *Self) u8 { const c = self.nonws() orelse return 0; if (c == 'i') { self.pos += 1; return 0x10; } return 0; } pub fn expr_0(self: *Self) !?u16 { const char = self.nonws() orelse return null; switch (char) { 'a'...'d' => { const arg = char - 'a'; if (arg >= self.flir.narg) return error.InvalidSyntax; self.pos += 1; return arg; }, 'x'...'z' => { var arg = char - 'x'; self.pos += 1; arg += self.idx(); const op1 = self.num() orelse 0; var inst: Inst = .{ .tag = .load, .opspec = arg, .op1 = op1 }; return try self.flir.put(inst); }, 't' => { self.pos += 1; const i = self.num() orelse return error.InvalidSyntax; return self.tmp[i] orelse return error.UndefTemporary; }, 'k' => { self.pos += 1; const i = self.num() orelse return error.InvalidSyntax; var inst: Inst = .{ .tag = .constant, .op1 = i }; return try self.flir.put(inst); }, else => return null, } } pub fn expr_1(self: *Self) !?u16 { var val = (try self.expr_0()) orelse return null; while (self.nonws()) |char| { const theop: CFO.VMathOp = switch (char) { '*' => .mul, '/' => .div, else => return val, }; self.pos += 1; const op = (try self.expr_0()) orelse return error.EXPR1; const inst: Inst = .{ .tag = .vmath, .opspec = theop.off(), .op1 = val, .op2 = op }; val = try self.flir.put(inst); } return val; } pub fn expr_2(self: *Self) !?u16 { var val = (try self.expr_1()) orelse return null; while (self.nonws()) |char| { const theop: CFO.VMathOp = switch (char) { '+' => .add, '-' => .sub, else => return val, }; self.pos += 1; const op = (try self.expr_1()) orelse return error.EXPR2; val = try self.flir.put(Inst{ .tag = .vmath, .opspec = theop.off(), .op1 = val, .op2 = op }); } return val; } pub fn stmt(self: *Self) !?bool { const char = self.nonws() orelse return null; var i: u8 = 0; self.pos += 1; const extra: u8 = switch (char) { 'r' => undefined, 'x'...'z' => y: { i = self.idx(); break :y self.num() orelse 0; }, 't' => self.num() orelse return error.SyntaxError, else => return error.SyntaxError, }; if (self.nonws() != @as(u8, '=')) return error.SyntaxError; self.pos += 1; const res = (try self.expr_2()) orelse return error.EOFError; if (self.nonws() != @as(u8, ';')) return error.SyntaxError; self.pos += 1; const inst: Inst = switch (char) { 'r' => .{ .tag = .ret, .op1 = res }, 'x'...'z' => .{ .tag = .store, .opspec = i + char - 'x', .op1 = res, .op2 = extra }, 't' => { self.tmp[extra] = res; return false; }, else => return error.SyntaxError, }; _ = try self.flir.put(inst); return (inst.tag == .ret); } pub fn parse(flir: *FLIR, str: []const u8) !bool { var didret = false; var self: Self = .{ .flir = flir, .str = str, .pos = 0 }; while (try self.stmt()) |res| { if (res) { didret = true; break; } } if (self.nonws() != null) return error.SyntaxError; return didret; } pub fn main() !void { const arg1 = std.os.argv[1]; var flir = try FLIR.init(4, test_allocator); defer flir.deinit(); _ = try flir.add_constant(std.math.pi); _ = try flir.add_constant(std.math.e); try flir.loop_start(); const ret = try parse(&flir, std.mem.span(arg1)); try flir.loop_end(); if (!ret) print("gör du ens\n", .{}); const anyindex = true; flir.live(anyindex); var pressure = try flir.scanreg(false); print("pressure {} of 16\n", .{pressure}); try flir.hoist_loopy(pressure); flir.live(anyindex); pressure = try flir.scanreg(true); print("NEW pressure {} of 16\n", .{pressure}); flir.debug_print(false); var cfo = try CFO.init(test_allocator); defer cfo.deinit(); try cfo.enter(); var pos = try cfo.lealink(.rax); _ = try flir.codegen(&cfo, false); try cfo.leave(); try cfo.ret(); var target = try flir.emit_constants(&cfo); cfo.set_lea(pos, target); // try cfo.dbg_nasm(test_allocator); }
src/parse.zig
map: std.AutoArrayHashMapUnmanaged(void, void) = .{}, items: std.MultiArrayList(Item) = .{}, extra: std.ArrayListUnmanaged(u32) = .{}, const InternArena = @This(); const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const KeyAdapter = struct { intern_arena: *const InternArena, pub fn eql(ctx: @This(), a: Key, b_void: void, b_map_index: usize) bool { _ = b_void; return ctx.intern_arena.indexToKey(@intToEnum(Index, b_map_index)).eql(a); } pub fn hash(ctx: @This(), a: Key) u32 { _ = ctx; return a.hash(); } }; pub const Key = union(enum) { int_type: struct { signedness: std.builtin.Signedness, bits: u16, }, ptr_type: struct { elem_type: Index, sentinel: Index, alignment: u16, size: std.builtin.Type.Pointer.Size, is_const: bool, is_volatile: bool, is_allowzero: bool, address_space: std.builtin.AddressSpace, }, array_type: struct { len: u64, child: Index, sentinel: Index, }, vector_type: struct { len: u32, child: Index, }, optional_type: struct { payload_type: Index, }, error_union_type: struct { error_set_type: Index, payload_type: Index, }, simple: Simple, pub fn hash(key: Key) u32 { var hasher = std.hash.Wyhash.init(0); switch (key) { .int_type => |int_type| { std.hash.autoHash(&hasher, int_type); }, .array_type => |array_type| { std.hash.autoHash(&hasher, array_type); }, else => @panic("TODO"), } return @truncate(u32, hasher.final()); } pub fn eql(a: Key, b: Key) bool { const KeyTag = std.meta.Tag(Key); const a_tag: KeyTag = a; const b_tag: KeyTag = b; if (a_tag != b_tag) return false; switch (a) { .int_type => |a_info| { const b_info = b.int_type; return std.meta.eql(a_info, b_info); }, .array_type => |a_info| { const b_info = b.array_type; return std.meta.eql(a_info, b_info); }, else => @panic("TODO"), } } }; pub const Item = struct { tag: Tag, /// The doc comments on the respective Tag explain how to interpret this. data: u32, }; /// Represents an index into `map`. It represents the canonical index /// of a `Value` within this `InternArena`. The values are typed. /// Two values which have the same type can be equality compared simply /// by checking if their indexes are equal, provided they are both in /// the same `InternArena`. pub const Index = enum(u32) { none = std.math.maxInt(u32), _, }; pub const Tag = enum(u8) { /// An integer type. /// data is number of bits type_int_signed, /// An integer type. /// data is number of bits type_int_unsigned, /// An array type. /// data is payload to Array. type_array, /// A type or value that can be represented with only an enum tag. /// data is Simple enum value simple, /// An unsigned integer value that can be represented by u32. /// data is integer value int_u32, /// An unsigned integer value that can be represented by i32. /// data is integer value bitcasted to u32. int_i32, /// A positive integer value that does not fit in 32 bits. /// data is a extra index to BigInt. int_big_positive, /// A negative integer value that does not fit in 32 bits. /// data is a extra index to BigInt. int_big_negative, /// A float value that can be represented by f32. /// data is float value bitcasted to u32. float_f32, /// A float value that can be represented by f64. /// data is payload index to Float64. float_f64, /// A float value that can be represented by f128. /// data is payload index to Float128. float_f128, }; pub const Simple = enum(u32) { f16, f32, f64, f80, f128, usize, isize, c_short, c_ushort, c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong, c_longdouble, anyopaque, bool, void, type, anyerror, comptime_int, comptime_float, noreturn, @"anyframe", null_type, undefined_type, enum_literal_type, @"undefined", void_value, @"null", bool_true, bool_false, }; pub const Array = struct { len: u32, child: Index, }; pub fn deinit(ia: *InternArena, gpa: Allocator) void { ia.map.deinit(gpa); ia.items.deinit(gpa); ia.extra.deinit(gpa); } pub fn indexToKey(ia: InternArena, index: Index) Key { const item = ia.items.get(@enumToInt(index)); const data = item.data; return switch (item.tag) { .type_int_signed => .{ .int_type = .{ .signedness = .signed, .bits = @intCast(u16, data), }, }, .type_int_unsigned => .{ .int_type = .{ .signedness = .unsigned, .bits = @intCast(u16, data), }, }, .type_array => { const array_info = ia.extraData(Array, data); return .{ .array_type = .{ .len = array_info.len, .child = array_info.child, .sentinel = .none, } }; }, .simple => .{ .simple = @intToEnum(Simple, data) }, else => @panic("TODO"), }; } pub fn get(ia: *InternArena, gpa: Allocator, key: Key) Allocator.Error!Index { const adapter: KeyAdapter = .{ .intern_arena = ia }; const gop = try ia.map.getOrPutAdapted(gpa, key, adapter); if (gop.found_existing) { return @intToEnum(Index, gop.index); } switch (key) { .int_type => |int_type| { const tag: Tag = switch (int_type.signedness) { .signed => .type_int_signed, .unsigned => .type_int_unsigned, }; try ia.items.append(gpa, .{ .tag = tag, .data = int_type.bits, }); }, .array_type => |array_type| { const len = @intCast(u32, array_type.len); // TODO have a big_array encoding assert(array_type.sentinel == .none); // TODO have a sentinel_array encoding try ia.items.append(gpa, .{ .tag = .type_array, .data = try ia.addExtra(gpa, Array{ .len = len, .child = array_type.child, }), }); }, else => @panic("TODO"), } return @intToEnum(Index, ia.items.len - 1); } fn addExtra(ia: *InternArena, gpa: Allocator, extra: anytype) Allocator.Error!u32 { const fields = std.meta.fields(@TypeOf(extra)); try ia.extra.ensureUnusedCapacity(gpa, fields.len); return ia.addExtraAssumeCapacity(extra); } fn addExtraAssumeCapacity(ia: *InternArena, extra: anytype) u32 { const fields = std.meta.fields(@TypeOf(extra)); const result = @intCast(u32, ia.extra.items.len); inline for (fields) |field| { ia.extra.appendAssumeCapacity(switch (field.field_type) { u32 => @field(extra, field.name), Index => @enumToInt(@field(extra, field.name)), i32 => @bitCast(u32, @field(extra, field.name)), else => @compileError("bad field type"), }); } return result; } fn extraData(ia: InternArena, comptime T: type, index: usize) T { 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 => ia.extra.items[i], Index => @intToEnum(Index, ia.extra.items[i]), i32 => @bitCast(i32, ia.extra.items[i]), else => @compileError("bad field type"), }; i += 1; } return result; } test "basic usage" { const gpa = std.testing.allocator; var ia: InternArena = .{}; defer ia.deinit(gpa); const i32_type = try ia.get(gpa, .{ .int_type = .{ .signedness = .signed, .bits = 32, } }); const array_i32 = try ia.get(gpa, .{ .array_type = .{ .len = 10, .child = i32_type, .sentinel = .none, } }); const another_i32_type = try ia.get(gpa, .{ .int_type = .{ .signedness = .signed, .bits = 32, } }); try std.testing.expect(another_i32_type == i32_type); const another_array_i32 = try ia.get(gpa, .{ .array_type = .{ .len = 10, .child = i32_type, .sentinel = .none, } }); try std.testing.expect(another_array_i32 == array_i32); }
src/InternArena.zig
const std = @import("std"); const c = @import("../../c.zig"); const zupnp = @import("../../lib.zig"); const xml = @import("xml"); const logger = std.log.scoped(.@"zupnp.upnp.device.action"); pub const ActionRequest = struct { allocator: std.mem.Allocator, handle: *const c.UpnpActionRequest, pub fn getDeviceUdn(self: *const ActionRequest) [:0]const u8 { return c.UpnpActionRequest_get_DevUDN_cstr(self.handle)[0..c.UpnpActionRequest_get_DevUDN_Length(self.handle):0]; } pub fn getServiceId(self: *const ActionRequest) [:0]const u8 { return c.UpnpActionRequest_get_ServiceID_cstr(self.handle)[0..c.UpnpActionRequest_get_ServiceID_Length(self.handle):0]; } pub fn getActionName(self: *const ActionRequest) [:0]const u8 { return c.UpnpActionRequest_get_ActionName_cstr(self.handle)[0..c.UpnpActionRequest_get_ActionName_Length(self.handle):0]; } pub fn getActionRequest(self: *const ActionRequest) xml.Document { return xml.Document.init(c.mutate(*xml.c.IXML_Document, c.UpnpActionRequest_get_ActionRequest(self.handle))); } pub fn getClientAddress(self: *const ActionRequest) zupnp.util.ClientAddress { return zupnp.util.ClientAddress.fromSockaddStorage(c.UpnpActionRequest_get_CtrlPtIPAddr(self.handle)); } }; pub const ActionResult = struct { action_result: ?xml.Document, // DO NOT DEINIT! Once passed to UpnpActionRequest_set_ActionResult, it'll get automatically free'd. err_code: c_int, pub fn createResult(service_type: [:0]const u8, arguments: anytype) !ActionResult { const action_name = @TypeOf(arguments).action_name; var doc: ?*c.IXML_Document = null; inline for (@typeInfo(@TypeOf(arguments)).Struct.fields) |field| { const key = field.name ++ "\x00"; const value: [:0]const u8 = @field(arguments, field.name); if (c.is_error(c.UpnpAddToActionResponse(&doc, action_name, service_type, key, value))) |err| { logger.err("Cannot create response: {s}", .{err}); return zupnp.Error; } } return ActionResult { .action_result = xml.Document.init(c.mutate(*xml.c.IXML_Document, doc.?)), .err_code = 0, }; } pub fn createError(err_code: c_int) ActionResult { return .{ .action_result = null, .err_code = err_code, }; } };
src/upnp/device/action.zig
const std = @import("std"); const imgui = @import("imgui"); const glfw = @import("glfw"); const assert = std.debug.assert; const Allocator = std.mem.Allocator; // ----------------------- Engine submodules ------------------------- pub const render = @import("render.zig"); pub const time = @import("time.zig"); pub const net = @import("net.zig"); // ----------------------- Engine state ------------------------- pub var _engineInitialized = false; pub var allocator: *Allocator = undefined; pub var window: *glfw.GLFWwindow = undefined; // ----------------------- Public functions ------------------------- pub fn init(windowName: [:0]const u8, heap_allocator: *Allocator) !void { assert(!_engineInitialized); allocator = heap_allocator; try time._init(); // Setup GLFW window _ = glfw.glfwSetErrorCallback(glfw_error_callback); if (glfw.glfwInit() == 0) return error.GlfwInitFailed; glfw.glfwWindowHint(glfw.GLFW_CLIENT_API, glfw.GLFW_NO_API); window = glfw.glfwCreateWindow(1280, 720, windowName, null, null).?; try render._init(allocator, window); try render._initImgui(allocator); try net._init(); _engineInitialized = true; } pub fn deinit() void { assert(_engineInitialized); // Cleanup net._deinit(); render._deinitImgui(); render._deinit(); glfw.glfwDestroyWindow(window); glfw.glfwTerminate(); _engineInitialized = false; } pub fn beginFrame() !bool { if (glfw.glfwWindowShouldClose(window) != 0) return false; time._beginFrame(); // Poll and handle events (inputs, window resize, etc.) // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. glfw.glfwPollEvents(); try render._beginFrame(); render._beginImgui(); return true; } pub fn endFrame() void {} // ----------------------- Internal functions ------------------------- fn glfw_error_callback(err: c_int, description: ?[*:0]const u8) callconv(.C) void { std.debug.warn("Glfw Error {}: {}\n", .{ err, std.mem.spanZ(description.?) }); }
src/engine.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day04.txt"); const Tile = struct { number: u8, marked: bool = false, }; const Board = struct { const Self = @This(); const board_size = 5; tiles: [board_size * board_size]Tile, pub fn initFromSerializedBoard(serialized_board: []const u8) !Self { var result: Board = undefined; var it = util.tokenize(u8, serialized_board, "\n "); var idx: usize = 0; while (it.next()) |board_num_data| { defer idx += 1; if (idx >= result.tiles.len) return error.InvalidInput; const board_num = util.parseInt(u8, board_num_data, 10) catch { return error.InvalidInput; }; result.tiles[idx] = Tile{ .number = board_num }; } if (idx != result.tiles.len) return error.InvalidInput; return result; } /// Maps a board location to the index in the tiles array containing its tile. pub fn toIndex(x: u8, y: u8) usize { return util.Point(u8).xyToIndex(x, y, board_size); } /// Checks rows/columns as per part 1 problem statement pub fn isWinningState(self: Self) bool { // Check rows { var y: u8 = 0; while (y < board_size) : (y += 1) { var x: u8 = 0; var row_filled = while (x < board_size) : (x += 1) { if (!self.tiles[toIndex(x, y)].marked) break false; } else true; if (row_filled) return true; } } // Check columns { var x: u8 = 0; while (x < board_size) : (x += 1) { var y: u8 = 0; var col_filled = while (y < board_size) : (y += 1) { if (!self.tiles[toIndex(x, y)].marked) break false; } else true; if (col_filled) return true; } } return false; } /// Produces the sum of all numbers on the board that are not marked. pub fn sumUnmarkedNumbers(self: Self) u16 { var sum: u16 = 0; for (self.tiles) |tile| { if (!tile.marked) sum += tile.number; } return sum; } }; /// The board that won, its index in the boards slice given to the sim function, and the number it won on, /// as well as that number's index in the numbers array given. const WinnerInfo = struct { /// Board that won. board: *Board, /// Index of the winning board in the list of boards that was processed. board_idx: usize, /// Final number called before the winning board won. number: u8, /// Index of the final number called before the winning board won. number_idx: usize, }; /// Simulates bingo on the boards given using the given numbers until a winner is found; then /// returns information about the winning values. fn simulateBingo(numbers: []const u8, boards: []*Board) !WinnerInfo { for (numbers) |number, number_idx| { // Mark number on all boards, assuming it only occurs once per board for (boards) |board, board_idx| { const marked = for (board.tiles) |*tile| { if (tile.number == number) { tile.marked = true; break true; } } else false; // If we marked something, check for winner if (marked and board.isWinningState()) return WinnerInfo{ .board = board, .board_idx = board_idx, .number = number, .number_idx = number_idx, }; } } // No winner return error.InvalidInput; } pub fn main() !void { defer { const leaks = util.gpa_impl.deinit(); std.debug.assert(!leaks); } var it = util.split(u8, data, "\n\n"); // Read in number list const numbers = blk: { var numbers_list = util.List(u8).init(util.gpa); defer numbers_list.deinit(); var numbers_data = it.next() orelse return error.InvalidInput; var numbers_it = util.tokenize(u8, numbers_data, ","); while (numbers_it.next()) |num_data| { try numbers_list.append(util.parseInt(u8, num_data, 10) catch { return error.InvalidInput; }); } break :blk numbers_list.toOwnedSlice(); }; defer util.gpa.free(numbers); if (numbers.len == 0) return error.InvalidInput; // Read in boards var boards = blk: { var boards_list = util.List(Board).init(util.gpa); defer boards_list.deinit(); while (it.next()) |board_data| { try boards_list.append(try Board.initFromSerializedBoard(board_data)); } break :blk boards_list.toOwnedSlice(); }; defer util.gpa.free(boards); if (boards.len == 0) return error.InvalidInput; // Duplicate board list so we can track winners repeatedly var current_boards = try util.List(*Board).initCapacity(util.gpa, boards.len); defer current_boards.deinit(); for (boards) |*board| { try current_boards.append(board); } // We also need to track what numbers we've used; just move the slice along as we go var current_numbers = numbers[0..]; // We'll track the first winner (for part 1), and last winner (for part 2). var first_winner: ?WinnerInfo = null; var last_winner: WinnerInfo = undefined; // This is safe; we assert that there is at least one board previously. while (current_boards.items.len > 0) { // Simulate until bingo and remove the numbers we used last_winner = try simulateBingo(current_numbers, current_boards.items); current_numbers = current_numbers[last_winner.number_idx..]; // Record first winner as needed if (first_winner == null) first_winner = last_winner; // Remove current winning board from list for next sim step _ = current_boards.swapRemove(last_winner.board_idx); } // Print first winner and score (as per part 1) if (first_winner) |winner| { util.print("Winning board score is: {d}\n", .{winner.board.sumUnmarkedNumbers() * winner.number}); } else unreachable; // Print losing board and score (as per part 2) util.print("Losing board score is: {d}\n", .{last_winner.board.sumUnmarkedNumbers() * last_winner.number}); }
src/day04.zig