code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("../index.zig"); const assert = std.debug.assert; const mem = std.mem; const ast = std.zig.ast; const Tokenizer = std.zig.Tokenizer; const Token = std.zig.Token; const TokenIndex = ast.TokenIndex; const Error = ast.Error; /// Result should be freed with tree.deinit() when there are /// no more refe...
std/zig/parse.zig
const std = @import("std.zig"); const builtin = std.builtin; const os = std.os; const mem = std.mem; const windows = std.os.windows; const c = std.c; const assert = std.debug.assert; const bad_startfn_ret = "expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'"; pub const Thread = struct { d...
lib/std/thread.zig
//! A lock that supports one writer or many readers. //! This API is for kernel threads, not evented I/O. //! This API requires being initialized at runtime, and initialization //! can fail. Once initialized, the core operations cannot fail. impl: Impl, const RwLock = @This(); const std = @import("../std.zig"); cons...
lib/std/Thread/RwLock.zig
const std = @import("std"); const expect = @import("std").testing.expect; const mem = @import("std").mem; pub fn codebaseOwnership() void { std.log.info("All your codebase are belong to us.", .{}); } test "while with continue expression" { var sum: u8 = 0; var i: u8 = 1; while (i <= 10) : (i += 1) { ...
src/tests.zig
const std = @import("std"); const expect = std.testing.expect; const Image = @import("image.zig").Image; // ref: https://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf // ref: http://www.paulbourke.net/dataformats/tga/ test "" { std.testing.refAllDecls(@This()); std.testing.refAllDecls(Header); ...
src/tga.zig
const std = @import("std"); pub const pkgs = struct { pub const clap = std.build.Pkg{ .name = "clap", .path = .{ .path = ".gyro/clap-mattnite-0.4.0-54d7cbbdb9bc1d8a78583857764d0888/pkg/clap.zig" }, }; pub const zfetch = std.build.Pkg{ .name = "zfetch", .path = .{ .path = ".g...
deps.zig
const std = @import("std"); const utils = @import("utils.zig"); const page_size = std.mem.page_size / 1024; // in KiB const Process = struct { pid: u32, private: u32, shared: u32, swap: u32, counter: u8 = 1, // owned by the process name: []const u8, fn showUsage(self: Process, writer:...
src/main.zig
//-------------------------------------------------------------------------------- // Section: Types (16) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows10.0.15063' const IID_IMFDeviceTransform_Value = Guid.initString("d818fbd8-fc46-...
win32/media/streaming.zig
pub const DISPID_RDPSRAPI_METHOD_OPEN = @as(u32, 100); pub const DISPID_RDPSRAPI_METHOD_CLOSE = @as(u32, 101); pub const DISPID_RDPSRAPI_METHOD_SETSHAREDRECT = @as(u32, 102); pub const DISPID_RDPSRAPI_METHOD_GETSHAREDRECT = @as(u32, 103); pub const DISPID_RDPSRAPI_METHOD_VIEWERCONNECT = @as(u32, 104); pub const DISPID_...
win32/system/desktop_sharing.zig
const std = @import("std"); const builtin = @import("builtin"); const panic = std.debug.panic; const join = std.fs.path.join; usingnamespace @import("c.zig"); const Shader = @import("shader.zig").Shader; // settings const SCR_WIDTH: u32 = 1920; const SCR_HEIGHT: u32 = 1080; pub fn main() !void { const allocator...
src/1_3_shaders.zig
const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; const maxInt = std.math.maxInt; /// Returns the hyperbolic arc-sin of x. /// /// Special Cases: /// - asinh(+-0) = +-0 /// - asinh(+-inf) = +-inf /// - asinh(nan) = nan pub fn asinh(x: anytype) @TypeOf(x) { const T...
lib/std/math/asinh.zig
const std = @import("std"); const isr = @import("isr.zig"); const scheduler = @import("scheduler.zig"); const syscall = @import("syscall.zig"); const tty = @import("tty.zig"); const x86 = @import("x86.zig"); const send = @import("ipc.zig").send; const MailboxId = std.os.zen.MailboxId; const Message = std.os.zen.Message...
kernel/interrupt.zig
const std = @import("../std.zig"); const debug = std.debug; const testing = std.testing; pub const Polynomial = struct { pub const IEEE = 0xedb88320; pub const Castagnoli = 0x82f63b78; pub const Koopman = 0xeb31d82e; }; // IEEE is by far the most common CRC and so is aliased by default. pub const Crc32 =...
lib/std/hash/crc.zig
const std = @import("std"); const assert = std.debug.assert; pub const Mode86 = enum { x86_16 = 0, x86_32 = 1, x64 = 2, }; pub const AsmError = error{ InvalidOperand, InvalidMode, InvalidImmediate, InvalidMemoryAddressing, InvalidRegisterCombination, InstructionTooLong, Invalid...
src/x86/types.zig
const zlm = @import("zlm.zig"); const struct__iobuf = extern struct { _ptr: [*c]u8, _cnt: c_int, _base: [*c]u8, _flag: c_int, _file: c_int, _charbuf: c_int, _bufsiz: c_int, _tmpfname: [*c]u8, }; const FILE = struct__iobuf; const int_least8_t = i8; const uint_least8_t = u8; const int_leas...
src/pkg/imgui.zig
const wlr = @import("../wlroots.zig"); const wayland = @import("wayland"); const wl = wayland.server.wl; pub const TextInputManagerV3 = extern struct { global: *wl.Global, text_inputs: wl.list.Head(TextInputV3, "link"), server_destroy: wl.Listener(*wl.Server), events: extern struct { text_in...
source/river-0.1.0/deps/zig-wlroots/src/types/text_input_v3.zig
pub const MMIO_BASE = 0x3F000000; const MMIO_BANK = RegBank.base(0x3F000000); const AUX_BANK = MMIO_BANK.sub(0x215000); pub const AUX_ENABLES = AUX_BANK.reg(0x04); pub const AUX_MU_IO = AUX_BANK.reg(0x40); pub const AUX_MU_IER = AUX_BANK.reg(0x44); pub const AUX_MU_IIR = AUX_BANK.reg(0x48); pub const AUX_MU_LCR = AUX_...
src/platform/pi3_aarch64/regs.zig
const std = @import("std"); const sling = @import("sling.zig"); const zt = @import("zt"); const ig = @import("imgui"); /// Produces an enum of declarations found in a type. Useful for parameters /// aimed at a declaration in a type. pub fn DeclEnum(comptime T: type) type { const declInfos = std.meta.declarations(T...
src/util.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const webgpu = @import("../../../webgpu.zig"); const vulkan = @import("../vulkan.zig"); const vk = @import("../vk.zig"); const module = @import("../../../utilities/module.zig"); const QueueFamilies = @import("../QueueFamilies.zig"); const log = @import(...
src/backends/vulkan/instance/Instance.zig
const std = @import("std"); const c = @cImport({ @cInclude("Windows.h"); }); const Image = @import("Image.zig"); pub fn hasImage() bool { const png_format = c.RegisterClipboardFormatA("PNG"); if (png_format != 0 and c.IsClipboardFormatAvailable(png_format) != 0) return true; if (c.IsClipboardFormatAvai...
src/ClipboardWin32.zig
const std = @import("std"); const linux = std.os.linux; const c = @cImport({ @cInclude("xf86drm.h"); @cInclude("xf86drmMode.h"); }); const epoll = @import("../../epoll.zig"); const Dispatchable = @import("../../epoll.zig").Dispatchable; pub const DRM = struct { fd: i32, conn_id: u32, conn: c.drmM...
src/backend/drm/drm.zig
const Builder = @import("std").build.Builder; const Build = @import("std").build; const lib = @import("libbuild.zig"); pub fn build(b: *Builder) void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const engine_path = "./"; lib.strip = b.option(bool, "strip", ...
build.zig
const Allocator = std.mem.Allocator; const FormatInterface = @import("../format_interface.zig").FormatInterface; const ImageFormat = image.ImageFormat; const ImageReader = image.ImageReader; const ImageInfo = image.ImageInfo; const ImageSeekStream = image.ImageSeekStream; const PixelFormat = @import("../pixel_format.zi...
src/formats/netpbm.zig
const getty = @import("../../lib.zig"); const std = @import("std"); /// Deserializer interface. /// /// Deserializers are responsible for the following conversion: /// /// Getty Data Model /// /// ▲ <------- /// | | /// ...
src/de/interface/deserializer.zig
pub const c = @import("../c.zig"); pub const accelerometer_as_joystick = c.SDL_HINT_ACCELEROMETER_AS_JOYSTICK; pub const android_apk_expansion_main_file_version = c.SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION; pub const android_apk_expansion_patch_file_version = c.SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION...
sdl/hint.zig
const std = @import("std"); const mem = std.mem; const LVT = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 44033, hi: u21 = 55203, pub fn init(allocator: *mem.Allocator) !LVT { var instance = LVT{ .allocator = allocator, .array = try allocator.alloc(bool, 11171), }; mem.s...
src/components/autogen/GraphemeBreakProperty/LVT.zig
const std = @import("std"); const expect = std.testing.expect; const test_allocator = std.testing.allocator; const Allocator = std.mem.Allocator; const Count = struct { ones: i64 = 0, zeros: i64 = 0, pub fn max(self: *const Count) u64 { if (self.ones >= self.zeros) { return 1; ...
day03/src/main.zig
pub const HVSOCKET_CONNECT_TIMEOUT = @as(u32, 1); pub const HVSOCKET_CONNECT_TIMEOUT_MAX = @as(u32, 300000); pub const HVSOCKET_CONTAINER_PASSTHRU = @as(u32, 2); pub const HVSOCKET_CONNECTED_SUSPEND = @as(u32, 4); pub const HV_PROTOCOL_RAW = @as(u32, 1); pub const HVSOCKET_ADDRESS_FLAG_PASSTHRU = @as(u32, 1); pub const...
win32/system/hypervisor.zig
const std = @import("std"); const mem = std.mem; const c = @import("./c.zig"); const glfw = @import("./main.zig"); pub const Window = struct { const Self = @This(); handle: *c.GLFWwindow, pub const ClientApi = enum(i32) { OpenGLApi = c.GLFW_OPENGL_API, OpenGLESApi = c.GLFW_OPENGL_ES_AP...
src/window.zig
const std = @import("std"); const print = std.debug.print; pub fn main() anyerror!void { const global_allocator = std.heap.page_allocator; var file = try std.fs.cwd().openFile( "./inputs/day14.txt", .{ .read = true, }, ); var reader = std.io.bufferedReader(file.rea...
src/day14.zig
const builtin = @import("builtin"); const Builder = @import("std").build.Builder; const fs = @import("std").fs; pub fn build(b: *Builder) void { const mode = b.standardReleaseOptions(); const windows = b.option(bool, "windows", "compile windows build") orelse false; const use_bundled_deps = b.option(bool,...
build.zig
const std = @import("../std.zig"); const mem = std.mem; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const assert = std.debug.assert; const process = std.process; const is_windows = std.Target.current.isWindows(); pub const NativePaths = struct { include_dirs: ArrayList([:0]u8), lib_d...
lib/std/zig/system.zig
const std = @import("std"); const Allocator = mem.Allocator; const mem = std.mem; const warn = std.debug.warn; pub const OpList = std.ArrayList(*Op); pub const Lines = std.ArrayList([]const u8); pub const Diff = struct { list: OpList, arena: std.heap.ArenaAllocator, fn init(a: *Allocator) Diff { ...
src/lsp/diff/diff.zig
const std = @import("std"); const imgui = @import("imgui.zig"); pub const icons = @import("font_awesome.zig"); extern fn _ogImage(user_texture_id: imgui.ImTextureID, size: *const imgui.ImVec2, uv0: *const imgui.ImVec2, uv1: *const imgui.ImVec2) void; extern fn _ogImageButton(user_texture_id: imgui.ImTextureID, size: ...
src/deps/imgui/wrapper.zig
const out = @import("platform.zig").out; const in = @import("platform.zig").in; const isr = @import("isr.zig"); const x86 = @import("platform.zig"); const sti = x86.sti; const hlt = x86.hlt; const serial = @import("../../debug/serial.zig"); const PIC1_CMD = 0x20; const PIC1_DATA = 0x21; const PIC2_CMD = 0xA0; const PI...
src/kernel/arch/x86/interrupts.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "Process", .filter = .info, }).write; pub const address_space = @import("process/address_space.zig"); pub const memory_object = @import("process/memory_object.zig"); const platform = os.platform; const copernicus = os.ker...
subprojects/flork/src/kernel/process.zig
/// Another way to get the output in intel mnemonics and with source code is: /// $ zig build-obj --release-fast emit-asm-example/optional.i32.zig && objdump --source -d -M intel optional.i32.o > emit-asm-example/optional.i32.src.s /// $ cat -n emit-asm-example/optional.i32.src.s /// 1 /// 2 optional.i32.o...
emit-asm-example/optional.i32.zig
pub const Token = @import("json_grammar.tokens.zig").Token; pub const Id = @import("json_grammar.tokens.zig").Id; pub const Lexer = struct { first: usize, index: usize, source: []const u8, char: i32, peek: i32, const Self = @This(); pub fn init(source: []const u8) Lexer { var peek...
json/json_lexer.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const Writer = std.io.Writer; // All magics are little-endian values. const UF2_MAGIC_FIRST: u32 = 0x0A324655; const UF2_MAGIC_SECOND: u32 = 0x9E5D5157; const UF2_MAGIC_FINAL: u32 = 0x0AB16F30; pub const UF2Config = stru...
build/uf2.zig
const std = @import("std"); const alphabet = @import("bio/alphabet.zig"); const Sequence = @import("sequence.zig").Sequence; const Cigar = @import("cigar.zig").Cigar; const CigarOp = @import("cigar.zig").CigarOp; pub const BandedAlignOptions = struct { bandwidth: usize = 16, gap_interior_open_score: i32 = -2...
src/banded_align.zig
const windows = @import("windows.zig"); const IUnknown = windows.IUnknown; const HRESULT = windows.HRESULT; const WINAPI = windows.WINAPI; const GUID = windows.GUID; const UINT = windows.UINT; const UINT64 = windows.UINT64; const SIZE_T = windows.SIZE_T; const BOOL = windows.BOOL; pub const MESSAGE_CATEGORY = enum(UIN...
modules/platform/vendored/zwin32/src/d3d11sdklayers.zig
const std = @import("std"); const stdx = @import("../stdx.zig"); const ds = stdx.ds; const t = stdx.testing; const log = stdx.log.scoped(.complete_tree); // Like a BTree but doesn't do self balancing. // Nodes can have at most BF (branching factor) children. // Appending a node will insert into the next slot to prese...
stdx/ds/complete_tree.zig
const std = @import("std"); const is_debug = std.debug.runtime_safety; const is_single_threaded = std.builtin.single_threaded; pub const Runtime = @This(); async_scheduler: RuntimeScheduler, blocking_scheduler: if (is_single_threaded) void else RuntimeScheduler, blocking_thread: ?*OsThread, pub const RuntimeSchedule...
src/runtime.zig
const std = @import("std"); const os = std.os; const io = std.io; pub const PassphraseTooLong = error.PassphraseTooLong; pub const NoPassphraseGiven = error.NoPassphraseGiven; // *nix only // OpenBSD has readpassphrase in libc. // This is pretty much musl's getpass implementation. pub fn getpass(prompt: []const u8, p...
getpass.zig
const std = @import("std"); // we ignore whitespace and comments pub const Token = union(enum) { comment, section: []const u8, key: []const u8, value: []const u8 }; pub const State = enum { normal, section, key, value, comment }; pub fn getTok(data: []const u8, pos: *usize, state: *State) ?Token ...
ini.zig
const builtin = @import("builtin"); const std = @import("std"); const input = @import("input.zig"); pub fn run(stdout: anytype) anyerror!void { if (builtin.mode != .Debug) { var input_ = try input.readFile("inputs/day19"); defer input_.deinit(); var scanners = try parseInput(&input_); ...
src/day19.zig
pub const SAFER_SCOPEID_MACHINE = @as(u32, 1); pub const SAFER_SCOPEID_USER = @as(u32, 2); pub const SAFER_LEVELID_FULLYTRUSTED = @as(u32, 262144); pub const SAFER_LEVELID_NORMALUSER = @as(u32, 131072); pub const SAFER_LEVELID_CONSTRAINED = @as(u32, 65536); pub const SAFER_LEVELID_UNTRUSTED = @as(u32, 4096); pub const ...
win32/security/app_locker.zig
const std = @import("std"); const panic = std.debug.panic; const utils = @import("lib/utils.zig"); const print = utils.print; const puts = utils.puts; const puts_e = utils.puts_e; const putskv_e = utils.putskv_e; const strncmp = utils.strncmp; const indexOf = utils.indexOf; fn matchSpace(ch: u8) usize { if (ch =...
vglexer.zig
const std = @import("std"); const fs = std.fs; const File = std.fs.File; const CommentBuffer = struct { buf: [2048]u8 = undefined, cursor: u64 = 0, }; pub fn codegen(self: *std.build.Step) !void { // READ-FILE: https://zigforum.org/t/read-file-or-buffer-by-line/317/4 var currentDir = std.fs.cwd(); ...
codegen.zig
/// image.zig /// Module image offers structs and functions for pixel /// and image data. const std = @import("std"); const Allocator = std.mem.Allocator; const stbImageWrite = @cImport({ @cInclude("stb_image_write.h"); }); const testing = std.testing; /// RGB values for a single pixel pub fn RGB(comptime T: typ...
Zig/benchmark/src/image.zig
const std = @import("std"); const math = std.math; const c = @import("c.zig"); const window_name = "generative art experiment 0000"; const window_width = 1920; const window_height = 1080; var oglppo: c.GLuint = undefined; pub fn main() !void { _ = c.glfwSetErrorCallback(handleGlfwError); if (c.glfwInit() == c...
src/0000.zig
//-------------------------------------------------------------------------------- // Section: Types (4) //-------------------------------------------------------------------------------- pub const USER_OBJECT_INFORMATION_INDEX = enum(u32) { FLAGS = 1, HEAPSIZE = 5, IO = 6, NAME = 2, TYPE = 3, ...
deps/zigwin32/win32/system/stations_and_desktops.zig
const std = @import("std"); const command = @import("command.zig"); pub fn print_command_help(current_command: *const command.Command, command_path: []const *const command.Command) !void { var out = std.io.getStdOut().writer(); try std.fmt.format(out, "USAGE:\n ", .{}); for (command_path) |cmd| { ...
src/help.zig
const getty = @import("getty"); const std = @import("std"); pub const ser = struct { pub usingnamespace @import("ser/serializer.zig"); pub usingnamespace @import("ser/interface/formatter.zig"); pub usingnamespace @import("ser/impl/formatter/compact.zig"); pub usingnamespace @import("ser/impl/formatte...
src/ser.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const testing = std.testing; const unicode = std.unicode; const CodePoint = @import("CodePoint.zig"); const CodePointIterator = CodePoint.CodePointIterator; const emoji = @import("../ziglyph.zig").emoji_data; const gbp = @import("../ziglyph.zig...
src/segmenter/Grapheme.zig
const std = @import("std"); const stdx = @import("stdx"); const MaybeOwned = stdx.ds.MaybeOwned; const builtin = @import("builtin"); const uv = @import("uv"); const h2o = @import("h2o"); const ssl = @import("openssl"); const v8 = @import("v8"); const runtime = @import("runtime.zig"); const RuntimeContext = runtime.Run...
runtime/server.zig
const std = @import("std"); const builtin = @import("builtin"); const maxInt = std.math.maxInt; const isNan = std.math.isNan; const is_wasm = switch (builtin.arch) { .wasm32, .wasm64 => true, else => false, }; const is_msvc = switch (builtin.abi) { .msvc => true, else => false, }; const is_freestandin...
lib/std/special/c.zig
const tests = @import("tests.zig"); const std = @import("std"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add("lazy pointer with undefined element type", \\export fn foo() void { \\ comptime var T: type = undefined; \\ const S = struct { x: *T }; \\ co...
test/compile_errors.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const expectEqualSlices = std.testing.expectEqualSlices; const maxInt = std.math.maxInt; const minInt = std.math.minInt; const mem = std.mem; test "assignment operators" { var i: u32 = 0; i += 5; try...
test/behavior/math.zig
const Allocator = std.mem.Allocator; const FormatInterface = @import("../format_interface.zig").FormatInterface; const ImageFormat = image.ImageFormat; const ImageReader = image.ImageReader; const ImageInfo = image.ImageInfo; const ImageSeekStream = image.ImageSeekStream; const PixelFormat = @import("../pixel_format.zi...
src/formats/pcx.zig
const std = @import("std"); const network = @import("network"); const Allocator = std.mem.Allocator; const print = std.debug.print; const log = std.math.log; const G = @import("global_config.zig"); const I = @import("instruments.zig"); const Note = struct { instr_id: u8, note: u8, octave: u8, fn getFr...
src/network.zig
const std = @import("std"); const core = @import("../core.zig"); const debug = std.debug; const math = std.math; const mem = std.mem; const unicode = std.unicode; // TODO: Currently we are using this location abstraction to get line, column from a // Cursor. Think about replacing this with the Cursor being a l...
src/core/text.zig
pub const SOCKET_DEFAULT2_QM_POLICY = Guid.initString("aec2ef9c-3a4d-4d3e-8842-239942e39a47"); pub const REAL_TIME_NOTIFICATION_CAPABILITY = Guid.initString("6b59819a-5cae-492d-a901-2a3c2c50164f"); pub const REAL_TIME_NOTIFICATION_CAPABILITY_EX = Guid.initString("6843da03-154a-4616-a508-44371295f96b"); pub const ASSOCI...
win32/networking/win_sock.zig
pub const CLUSTER_VERSION_FLAG_MIXED_MODE = @as(u32, 1); pub const CLUSTER_VERSION_UNKNOWN = @as(u32, 4294967295); pub const NT4_MAJOR_VERSION = @as(u32, 1); pub const NT4SP4_MAJOR_VERSION = @as(u32, 2); pub const NT5_MAJOR_VERSION = @as(u32, 3); pub const NT51_MAJOR_VERSION = @as(u32, 4); pub const NT6_MAJOR_VERSION =...
win32/networking/clustering.zig
pub const FIND_RESOURCE_DIRECTORY_TYPES = @as(u32, 256); pub const FIND_RESOURCE_DIRECTORY_NAMES = @as(u32, 512); pub const FIND_RESOURCE_DIRECTORY_LANGUAGES = @as(u32, 1024); pub const RESOURCE_ENUM_LN = @as(u32, 1); pub const RESOURCE_ENUM_MUI = @as(u32, 2); pub const RESOURCE_ENUM_MUI_SYSTEM = @as(u32, 4); pub const...
win32/system/library_loader.zig
const std = @import("std"); const Options = @import("../../build.zig").Options; pub fn build(b: *std.build.Builder, options: Options) *std.build.LibExeObjStep { const exe_options = b.addOptions(); exe_options.addOption(bool, "enable_pix", options.enable_pix); exe_options.addOption(bool, "enable_dx_debug",...
samples/vector_graphics_test/build.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = true; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); var arena ...
2017/day12.zig
const std = @import("std"); const regs = @import("registers.zig"); pub const port = struct { pub const a = GpioWrapper(regs.GPIOA){}; pub const b = GpioWrapper(regs.GPIOB){}; pub const c = GpioWrapper(regs.GPIOC){}; pub const d = GpioWrapper(regs.GPIOD){}; pub const e = GpioWrapper(regs.GPIOE){}; ...
src/gpio.zig
const std = @import("std"); usingnamespace @import("semaphore.zig"); pub const Lock = struct { const Self = @This(); inner_mutex: std.Mutex = std.Mutex{}, pub fn acquire(self: *Self) void { _ = self.inner_mutex.acquire(); } pub fn release(self: *Self) void { (std.Mutex.Held{ .mu...
Mutlithreading/condition_variable.zig
const std = @import("std"); const SegmentedList = std.SegmentedList; const Token = std.c.Token; const Source = std.c.tokenizer.Source; pub const TokenIndex = usize; pub const Tree = struct { tokens: TokenList, sources: SourceList, root_node: *Node.Root, arena_allocator: std.heap.ArenaAllocator, ms...
lib/std/c/ast.zig
const cli = @import("flags.zig"); const std = @import("std"); const Args = cli.Args; const Cli = cli.Cli; const Command = cli.Command; const Context = cli.Context; const Flag = cli.Flag; const FlagItem = cli.FlagSet.FlagItem; const testing = std.testing; const warn = std.debug.warn; test "command" { var a = std.d...
src/flags/cli_test.zig
const std = @import("std"); const reg = @import("registry.zig"); const xml = @import("../xml.zig"); const renderRegistry = @import("render.zig").render; const parseXml = @import("parse.zig").parseXml; const IdRenderer = @import("../id_render.zig").IdRenderer; const mem = std.mem; const Allocator = mem.Allocator; const ...
generator/openxr/generator.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqualSlices = std.testing.expectEqualSlices; const expectEqualStrings = std.testing.expectEqualStrings; const mem = std.mem; const builtin = @import("builtin"); fn emptyFn() void {} const addr1 = @ptrCast(*const u8, emptyFn); test "comptime ca...
test/behavior/misc.zig
const std = @import("std"); const zort = @import("main.zig"); const testing = std.testing; pub const ItemsType = i32; pub const items = [_]i32{ -9, 1, -4, 12, 3, 4 }; pub const expectedASC = [_]i32{ -9, -4, 1, 3, 4, 12 }; pub const expectedDESC = [_]i32{ 12, 4, 3, 1, -4, -9 }; fn asc(a: i32, b: i32) bool { return...
src/test.zig
const std = @import("std"); const gemini = @import("gemtext.zig"); const c = @cImport({ @cInclude("gemtext.h"); }); const allocator = if (@import("builtin").is_test) std.testing.allocator else std.heap.c_allocator; const Error = error{ OutOfMemory, }; fn errorToC(err: Error) c.gemtext_error { re...
src/lib.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "platform/devicetree", .filter = .info, }).write; const assert = std.debug.assert; var parsed_dt: bool = false; pub fn parse_dt(dt_data: []u8) !void { if (parsed_dt) return; parsed_dt = true; var p ...
subprojects/flork/src/platform/devicetree.zig
const std = @import("std"); const util = @import("util.zig"); const Allocator = std.mem.Allocator; const testing = std.testing; const Error = util.Error; const FUSE_ARITY = 3; const FUSE_SEGMENT_COUNT = 100; const FUSE_SLOTS = FUSE_SEGMENT_COUNT + FUSE_ARITY - 1; /// Fuse8 provides a fuse filter with 8-bit fingerprin...
src/fusefilter.zig
comptime { asm ( \\.section .text.start \\.globl _start \\_start: \\ .long __stack_start \\ .long runtime_entry \\ .long nm_interrupt \\ .long hard_fault \\ .long rsvd4 \\ .long rsvd5 \\ .long rsvd6 \\ .long rsvd7 \\ .lo...
src/runtime.zig
const layout = @import("layout.zig"); const tty = @import("tty.zig"); const vmem = @import("vmem.zig"); const mem = @import("std").mem; const assert = @import("std").debug.assert; const Color = tty.Color; // Standard allocator interface. pub var allocator = mem.Allocator { .allocFn = alloc, .reallocFn = real...
kernel/mem.zig
const std = @import("std"); const zwin32 = @import("zwin32"); const w32 = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hrPanicOnFail; const zd3d12 = @import("zd3d12"); const common = @import("common"); const c = common.c; const vm = common.vectormath; const GuiRe...
samples/triangle/src/triangle.zig
const std = @import("std"); const c = @import("c.zig").c; const Error = @import("errors.zig").Error; const getError = @import("errors.zig").getError; const internal_debug = @import("internal_debug.zig"); /// Sets the clipboard to the specified string. /// /// This function sets the system clipboard to the specified,...
glfw/src/clipboard.zig
const cfg = @import("cfg.zig"); const minify = @import("minify.zig"); const serde = @import("serde.zig"); const stb = @cImport({ @cInclude("stb/stb_image.h"); }); const std = @import("std"); const qoi = @import("qoi.zig"); pub const Shader = struct { bytes: []const u8, pub fn bake( allocator: std....
src/bake.zig
const std = @import("std"); const Version = std.builtin.Version; pub const log = std.log.scoped(.hzzp); pub const supported_versions = Version.Range{ .min = .{ .major = 1, .minor = 0, }, .max = .{ .major = 1, .minor = 1, }, }; pub const TransferEncoding = enum { c...
src/common.zig
const vk = @import("../../../vk.zig"); const std = @import("std"); const vkctxt = @import("../../../vulkan_wrapper/vulkan_context.zig"); const printError = @import("../../../application/print_error.zig").printError; const RGResource = @import("../render_graph_resource.zig").RGResource; const Application = @import(".....
src/renderer/render_graph/resources/swapchain.zig
const std = @import("std"); const ascii = std.ascii; const fmt = std.fmt; const io = std.io; const heap = std.heap; const mem = std.mem; const os = std.os; const _c = @cImport({ @cInclude("ctype.h"); @cInclude("limits.h"); @cInclude("sys/ioctl.h"); @cInclude("stdio.h"); @cInclude("stdlib.h"); ...
.save/ff.zig
const PORTC_PIN7: u32 = 7; // USER GREEN LED on GPIO A Bus, Pin 5 const LED_GRN: u32 = PORTC_PIN7; // USER GREEN LED on GPIO A Bus, Pin 5 const PORTB_PIN7: u32 = 7; // USER BLUE...
src/main.zig
const std = @import("std"); const with_trace = true; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const gsize = 100; const Grid = [gsize * gsize]u1; fn readgrid(g: Grid, x: i32, y: i32) u32 { if (x < 0 or x >= gsize) ...
2015/day18.zig
const sf = @import("../sfml.zig"); pub const Music = struct { const Self = @This(); // Constructor/destructor /// Loads music from a file pub fn initFromFile(path: [:0]const u8) !Self { var music = sf.c.sfMusic_createFromFile(path); if (music == null) return sf.Error.reso...
src/sfml/audio/music.zig
pub const DXC_HASHFLAG_INCLUDES_SOURCE = @as(u32, 1); pub const DxcValidatorFlags_Default = @as(u32, 0); pub const DxcValidatorFlags_InPlaceEdit = @as(u32, 1); pub const DxcValidatorFlags_RootSignatureOnly = @as(u32, 2); pub const DxcValidatorFlags_ModuleOnly = @as(u32, 4); pub const DxcValidatorFlags_ValidMask = @as(u...
win32/graphics/direct3d/dxc.zig
const std = @import("std"); const cstr = std.cstr; pub const Flag = struct { name: [*:0]const u8, kind: enum { boolean, arg }, }; pub fn ParseResult(comptime flags: []const Flag) type { return struct { const Self = @This(); const FlagData = struct { name: [*:0]const u8, ...
source/river-0.1.0/common/flags.zig
const std = @import("std"); const print = std.debug.print; const Map = std.AutoHashMap(u8, u8); const Set = std.StaticBitSet(7); const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day08.txt"); fn mask(pattern: []const u8) Set { var set = Set.initEmpty(); for (pattern) |l...
2021/src/day08.zig
const std = @import("std"); var a: *std.mem.Allocator = undefined; const stdout = std.io.getStdOut().writer(); //prepare stdout to write in //const LENGTH = 5; // testing const LENGTH = 12; // prod fn run(input: [:0]u8) u32 { // Stores the current bit position var bit_pos: u8 = 0; // Stores the number of...
day-03/part-2/lelithium.zig
const std = @import("std"); const testing = std.testing; const Token = @import("Token.zig"); //! The `Lexer` parses the source code into Tokens. //! The definition of all tokens can be found in token.zig /// Lexer reads the source code and turns it into tokens const Lexer = @This(); /// Source code that is being tok...
src/Lexer.zig
const std = @import("std"); const real_input = @embedFile("day-16_real-input"); pub fn main() !void { std.debug.print("--- Day 16 ---\n", .{}); const version_sum = try sumVersions(real_input); std.debug.print("sum of all versions is {}\n", .{ version_sum }); const expression_value = try evaluate(real...
day-16.zig
const stdx = @import("stdx.zig"); const t = stdx.testing; const Closure = stdx.Closure; const ClosureIface = stdx.ClosureIface; const ClosureSimple = stdx.ClosureSimple; const ClosureSimpleIface = stdx.ClosureSimpleIface; /// An interface for a free function or a closure. pub fn Function(comptime Fn: type) type { ...
stdx/function.zig
const std = @import("std"); const expect = std.testing.expect; const assert = std.debug.assert; pub const Color = packed enum(u8) { white, red, blue, orange, green, yellow, pub fn toStr(self: Color) []const u8 { return switch (self) { .white => "\x1B[37mw\x1B[m", ...
src/rubik.zig
const testing = @import("std").testing; const freetype = @import("freetype"); const firasnas_font_path = "upstream/assets/FiraSans-Regular.ttf"; const firasnas_font_data = @embedFile("../upstream/assets/FiraSans-Regular.ttf"); test "new face from file" { const lib = try freetype.Library.init(); _ = try lib.ne...
freetype/test/main.zig
const std = @import("std"); const mem = std.mem; const SoftDotted = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 105, hi: u21 = 120467, pub fn init(allocator: *mem.Allocator) !SoftDotted { var instance = SoftDotted{ .allocator = allocator, .array = try allocator.alloc(bool, 12036...
src/components/autogen/PropList/SoftDotted.zig
const std = @import("std"); const print = std.debug.print; const Allocator = std.mem.Allocator; // We are brave with our reading. const u32_max = 4294967295; pub const LineDef = struct { // Represents a line with [start..end] start : usize, end : usize, }; pub const Lines = struct { backing: []const ...
src/dan/lines.zig
const std = @import("std"); const assert = std.debug.assert; pub const Computer = struct { mem: [1024]u32, pos: usize, const OP = enum(u32) { ADD = 1, MUL = 2, STOP = 99, }; pub fn init(str: []const u8) Computer { var self = Computer{ .mem = undefined, ...
2019/p02/computer.zig