code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const builtin = @import("builtin"); const testing = std.testing; const Allocator = std.mem.Allocator; /// /// A comptime bitmap that uses a specific type to store the entries. No allocators needed. /// /// Arguments: /// IN BitmapType: type - The integer type to use to store entries. //...
src/kernel/lib/bitmap.zig
const std = @import("std"); const testing = std.testing; const VARIABLE_START_CHAR: u8 = '{'; const VARIABLE_END_CHAR: u8 = '}'; const VARIABLE_PATH_CHAR: u8 = '.'; const EtchTokenScanner = struct { const Self = @This(); const State = enum { TopLevel, BeginReadingVariable, ReadingVariable }; const Token ...
src/main.zig
const std = @import("std"); const testing = std.testing; const SYS = std.os.SYS; const allocator = std.testing.allocator; const syspect = @import("syspect"); const utils = @import("utils.zig"); /// Runs 'target_argv' program using syspect.Inspector. /// Inspects each syscall. /// Ensures any 'gettid()' calls return ...
tests/src/generic.zig
const std = @import("std"); test "example" { const input = @embedFile("14_example.txt"); const result10 = try run(input, 10); const result40 = try run(input, 40); try std.testing.expectEqual(@as(usize, 1588), result10); try std.testing.expectEqual(@as(usize, 2188189693529), result40); } pub fn mai...
shritesh+zig/14.zig
const bs = @import("./bitstream.zig"); const bu = @import("./bits.zig"); // bits utilities const hm = @import("./huffman.zig"); const lz = @import("./lz77.zig"); const tables = @import("./tables.zig"); const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const math = std.math; const SIZE...
src/deflate.zig
const std = @import("std"); const ascii = std.ascii; const fmt = std.fmt; const mem = std.mem; const unicode = std.unicode; const testing = std.testing; const expect = testing.expect; // Key is a key of hash tables to be used in this package. pub const Key = std.ArrayList(u8); // Table is a table from a key to a TOM...
toml.zig
pub const Size = usize; pub const Float = f32; pub const Int = c_int; pub const UInt = c_uint; pub const Bool = c_int; 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, inv...
libs/zmesh/src/zcgltf.zig
const sdl = @import("./sdl.zig"); const core = @import("core"); const geometry = core.geometry; const Coord = geometry.Coord; const Rect = geometry.Rect; const makeCoord = geometry.makeCoord; const textures = @import("./textures.zig"); pub const LinearMenuState = struct { cursor_position: usize, entry_count: u...
src/gui/gui.zig
const std = @import("std"); fn setup(step: *std.build.LibExeObjStep, mode: std.builtin.Mode, target: anytype, options: *std.build.OptionsStep) void { step.addCSourceFile("src/utils.c", &[_][]const u8{ "-Wall", "-Wextra", "-Werror", "-O3" }); step.setTarget(target); step.linkLibC(); step.setBuildMode(mo...
build.zig
const std = @import("../std.zig"); const build = @import("../build.zig"); const Step = build.Step; const Builder = build.Builder; const fs = std.fs; const warn = std.debug.warn; const ArrayList = std.ArrayList; const WriteFileStep = @This(); pub const base_id = .write_file; step: Step, builder: *Builder, output_dir:...
lib/std/build/WriteFileStep.zig
const kernel = @import("kernel.zig"); const Physical = kernel.Physical; const Virtual = kernel.Virtual; const log = kernel.log.scoped(.PhysicalMemory); const TODO = kernel.TODO; pub var map: Map = undefined; /// This contains physical memory regions pub const Map = struct { usable: []Entry, reclaimable: []Entr...
src/kernel/physical_memory.zig
const std = @import("std"); const testing = std.testing; pub fn Entry(comptime T: type) type { return struct { const Self = @This(); storage: *const std.ArrayList(T), idx: usize, // index into .storage.items pub fn get(self: *Self) *T { return &self.storage.items[self....
libdaya/src/indexedarraylist.zig
const c = @import("../c.zig"); const vk = @import("../vk.zig"); const std = @import("std"); const shader_util = @import("../shaders/shader_util.zig"); usingnamespace @cImport({ @cInclude("fira_sans_regular.h"); }); const vkctxt = @import("../vulkan_wrapper/vulkan_context.zig"); const Buffer = vkctxt.Buffer; cons...
src/ui/ui_vulkan.zig
const base = @import("../base.zig"); const gen = @import("../gen.zig"); const COMMON = [_:null]?base.Segment{ .{ .offset = 0, .month = 1, .day_start = 1, .day_end = 31 }, .{ .offset = 31, .month = 2, .day_start = 1, .day_end = 28 }, .{ .offset = 59, .month = 3, .day_start = 1, .day_end = 31 }, .{ .offs...
src/cal/gregorian.zig
const std = @import("std"); const gdt = @import("gdt.zig"); const isr = @import("isr.zig"); const layout = @import("layout.zig"); const mem = @import("mem.zig"); const vmem = @import("vmem.zig"); const scheduler = @import("scheduler.zig"); const x86 = @import("x86.zig"); const Array = std.ArrayList; const List = std.In...
kernel/thread.zig
const std = @import("std"); const pokemon = @import("pokemon"); const gba = @import("gba"); const gb = @import("gb"); const gen3 = @import("gen3.zig"); const gen2 = @import("gen2.zig"); const io = std.io; const os = std.os; const math = std.math; const mem = std.mem; const debug = std.debug; const common = pokemon.co...
tools/offset-finder/main.zig
const std = @import("std"); usingnamespace @import("ast.zig"); usingnamespace @import("types.zig"); //digraph graphname { // "A" -> {B C} // "A" -> X // X -> " lol hi" //} pub const DotPrinter = struct { printTypes: bool, const Self = @This(); pub fn init(writer: anytype, printTy...
src/dot_printer.zig
const std = @import("std"); const Edge = enum{ left, right, top, bottom }; pub const RectF = struct { x: f32 = 0, y: f32 = 0, width: f32 = 0, height: f32 = 0, }; pub const Rect = struct { x: i32 = 0, y: i32 = 0, width: i32 = 0, height: i32 = 0, pub fn right(self: R...
src/math/rect.zig
const std = @import("std"); const mem = std.mem; const net = std.net; const os = std.os; const time = std.time; const IO = @import("tigerbeetle-io").IO; const http = @import("http"); const Client = struct { io: IO, sock: os.socket_t, address: std.net.Address, recv_timeout_ns: u63, send_buf: []u8, ...
examples/tcp_echo_client_timeout.zig
const std = @import("std"); const os = std.os; const wayland = @import("wayland"); const wl = wayland.client.wl; const xdg = wayland.client.xdg; const Context = struct { shm: ?*wl.Shm, compositor: ?*wl.Compositor, wm_base: ?*xdg.WmBase, }; pub fn main() anyerror!void { const display = try wl.Display....
hello.zig
const std = @import("std"); const platform = @import("platform"); const util = @import("util.zig"); const vfs = @import("vfs.zig"); const task = @import("task.zig"); const wasm_rt = @import("runtime/wasm.zig"); const Error = error{NotImplemented, NotCapable}; pub const RuntimeType = enum { wasm, native, // T...
kernel/process.zig
const std = @import("std"); const Module = @import("module.zig"); const Op = @import("op.zig"); const util = @import("util.zig"); const debug_buffer = std.builtin.mode == .Debug; fn sexpr(reader: anytype) Sexpr(@TypeOf(reader)) { return .{ .reader = reader, ._debug_buffer = if (debug_buffer) ...
src/wat.zig
const std = @import("std"); const math = std.math; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const log = std.log.scoped(.vsr); const config = @import("config.zig"); /// The version of our Viewstamped Replication protocol in use, including customizations. /// For backwards compatibility thr...
src/vsr.zig
const std = @import("std"); const rand = std.rand; const fs = std.fs; const print = std.debug.print; const m = std.math; pub fn Vec3(comptime T: type) type { return struct { const Self = @This(); x: T, y: T, z: T, pub fn init(x: T, y: T, z: T) Self { return Vec...
src/main.zig
const std = @import("std"); usingnamespace @import("interpreter.zig"); usingnamespace @import("intrinsics.zig"); usingnamespace @import("gc.zig"); usingnamespace @import("sourcelocation.zig"); pub const ExprErrors = error{ AlreadyReported, UnexpectedRightParen, ExpectedNumber, InvalidArgumentType, InvalidArgumentCount...
src/ast.zig
const warn = std.debug.warn; const time = std.os.time; const std = @import("std"); const date = @import("gregorianDate.zig"); fn today() date.Date { // Get UTC and manually adjust to Pacific Daylight Time // (For demonstration only -- This is not the correct way to convert to civil time!) const now = time....
src/example.zig
const std = @import("std"); const testing = std.testing; const Vector2 = @import("zalgebra").Vector2; const za = @import("zalgebra"); pub const RectInt = Rect(i32); pub const RectFloat = Rect(f32); pub fn Rect(comptime T: type) type { return struct { pub const Vec2 = Vector2(T); const Sel...
src/physic/rect.zig
const vk = @import("../../../vk.zig"); const std = @import("std"); const printError = @import("../../../application/print_error.zig").printError; const RGResource = @import("../render_graph_resource.zig").RGResource; const RenderGraph = @import("../render_graph.zig").RenderGraph; const Texture = @import("texture.zig"...
src/renderer/render_graph/resources/viewport_texture.zig
const std = @import("std"); const states = @import("state.zig"); const build_map = @import("build_map.zig"); const searches = @import("search.zig"); const htmlgen = @import("htmlgen.zig"); const State = states.State; const OutError = std.fs.File.ReadError; const InError = std.fs.File.WriteError; fn loadState(state_pa...
src/main.zig
const std = @import("std"); const os = std.os; const mem = std.mem; const process = std.process; const Allocator = std.mem.Allocator; const util = @import("util.zig"); const ResponseEntry = struct { title: []const u8, name: []const u8, }; const Response = struct { examples: []ResponseEntry, }; pub fn mai...
src/file.zig
const std = @import("std"); test "example" { const input = @embedFile("13_example.txt"); const result = try run(input, 1); try std.testing.expectEqual(@as(usize, 17), result); } pub fn main() !void { const input = @embedFile("13.txt"); const result = try run(input, 1); std.debug.print("{}\n", ...
shritesh+zig/13a.zig
const std = @import("std"); const win = std.os.windows; const ascii = std.ascii; const fmt = std.fmt; const heap = std.heap; const fs = std.fs; const mem = std.mem; const process = std.process; export fn handlerRoutine(dwCtrlType: win.DWORD) callconv(win.WINAPI) win.BOOL { return switch (dwCtrlType) { win...
src/main.zig
const std = @import("std"); const mem = std.mem; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const BigIntConst = std.math.big.int.Const; const BigIntMutable = std.math.big.int.Mutable; const Type = @import("type.zig").Type; const Value = @import("value.zig").Value; const TypedValue = @import(...
src/zir.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const SnailfishNumber = struct { const Elements = std.ArrayList(struct { number: u8, depth: u8, }); elements: Elements, fn initFromLine(allocator: std.mem.Allocator, line: []const u8) !SnailfishNumber { var snailfi...
src/main/zig/2021/day18.zig
const Target = @import("std").Target; pub const CInt = struct { id: Id, zig_name: []const u8, c_name: []const u8, is_signed: bool, pub const Id = enum { Short, UShort, Int, UInt, Long, ULong, LongLong, ULongLong, }; pub const...
src-self-hosted/c_int.zig
const std = @import("std"); const mem = std.mem; const Format = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 173, hi: u21 = 917631, pub fn init(allocator: *mem.Allocator) !Format { var instance = Format{ .allocator = allocator, .array = try allocator.alloc(bool, 917459), }; ...
src/components/autogen/DerivedGeneralCategory/Format.zig
const wlr = @import("../wlroots.zig"); const os = @import("std").os; const pixman = @import("pixman"); const wayland = @import("wayland"); const wl = wayland.server.wl; pub const Surface = extern struct { pub const State = extern struct { pub const field = struct { pub const buffer = 1 << 0;...
src/types/surface.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/day21.txt", run); pub fn run(input: []const u8, gp...
2021/day21.zig
const std = @import("std"); const fmt = std.fmt; const Allocator = std.mem.Allocator; const testing = std.testing; /// Parses the different types of Redis strings and keeps /// track of the string metadata information when present. /// Useful to know when Redis is replying with a verbatim /// markdown string, for exam...
src/types/verbatim.zig
const std = @import("std"); const c = @import("c.zig"); const shaderc = @import("shaderc.zig"); pub const Preview = struct { const Self = @This(); device: c.WGPUDeviceId, queue: c.WGPUQueueId, // We render into tex[0] in tiles to keep up a good framerate, then // copy to tex[1] to render the com...
src/preview.zig
const std = @import("../../std.zig"); const builtin = @import("builtin"); const linux = std.os.linux; const mem = std.mem; const elf = std.elf; const expect = std.testing.expect; test "getpid" { expect(linux.getpid() != 0); } test "timer" { const epoll_fd = linux.epoll_create(); var err = linux.getErrno(e...
std/os/linux/test.zig
const std = @import("std"); const mem = std.mem; const u = std.unicode; const t = @import("testing.zig"); const Input = @import("input.zig"); usingnamespace @import("ghost_party.zig"); usingnamespace @import("meta.zig"); usingnamespace @import("parser.zig"); usingnamespace @import("result.zig"); const Str = []const...
src/string_parser.zig
usingnamespace @import("enum.zig"); usingnamespace @import("../../types.zig"); pub const BlendDesc = extern struct { AlphaToCoverageEnable: BOOL, IndependentBlendEnable: BOOL, RenderTarget: [8]RenderTargetBlendDesc, }; pub const BlendDesc1 = extern struct { AlphaToCoverageEnable: BOOL, Independen...
directx11/core/struct.zig
const std = @import("std"); const p_alloc = std.heap.page_allocator; const mem = std.mem; const Allocator = mem.Allocator; const print = std.debug.print; const StringHashMap = std.StringHashMap; const AutoHashMap = std.AutoHashMap; pub fn StringBufSet(comptime T: anytype) type { return struct { hash_map: ...
demo/common/utils.zig
const std = @import("std"); const SUBCOMMANDS = @import("src/subcommands.zig").SUBCOMMANDS; const coreutils_version = std.builtin.Version{ .major = 0, .minor = 0, .patch = 6 }; pub fn build(b: *std.build.Builder) !void { b.prominent_compile_errors = true; const target = b.standardTargetOptions(.{}); cons...
build.zig
const std = @import("std"); const bcm2835 = @import("bcm2835.zig"); const mocks = @import("integration-tests/mocks.zig"); const gpio = @import("gpio.zig"); pub fn main() anyerror!void { // var gpalloc = std.heap.GeneralPurposeAllocator(.{}){}; // defer _= gpalloc.deinit(); // var mock_mem = try mocks....
src/main.zig
const std = @import("std"); const HashMap = std.HashMap; const core = @import("../index.zig"); const Coord = core.geometry.Coord; const Species = core.protocol.Species; const Floor = core.protocol.Floor; const Wall = core.protocol.Wall; const ThingPosition = core.protocol.ThingPosition; const TerrainSpace = core.proto...
src/server/game_model.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 QueueFamilies = @import("../QueueFamilies.zig"); const Adapter = @This(); pub const vtable = webgpu.Adapter.VTable{ .req...
src/backends/vulkan/instance/Adapter.zig
test "" { @import("std").meta.refAllDecls(@This()); } usingnamespace @import("../include/psploadexec.zig"); usingnamespace @import("../include/pspthreadman.zig"); usingnamespace @import("../include/psptypes.zig"); usingnamespace @import("debug.zig"); const root = @import("root"); //If there's an issue this is th...
src/psp/utils/module.zig
//-------------------------------------------------------------------------------- // Section: Types (12) //-------------------------------------------------------------------------------- pub const GAMING_DEVICE_VENDOR_ID = enum(i32) { NONE = 0, MICROSOFT = -1024700366, }; pub const GAMING_DEVICE_VENDOR_ID_NO...
deps/zigwin32/win32/gaming.zig
const ffs = @import("count0bits.zig"); const testing = @import("std").testing; fn test__ffsdi2(a: u64, expected: i32) !void { var x = @bitCast(i64, a); var result = ffs.__ffsdi2(x); try testing.expectEqual(expected, result); } test "ffsdi2" { try test__ffsdi2(0x00000000_00000001, 1); try test__ffs...
lib/std/special/compiler_rt/ffsdi2_test.zig
const std = @import("std"); pub usingnamespace @import("./Formatter/property.zig"); pub fn format(allocator: *std.mem.Allocator, string: []const u8, prop: []Property) ![]const u8 { var str = std.ArrayList(u8).init(allocator); var i: usize = 0; while (true) { if (i == prop.len) break; _ = t...
src/Formatter.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 ArrayList = std.ArrayList; const assert = std.debug.assert; const utils = @import("utils.zig"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const P2Type = stru...
day_21/src/main.zig
const std = @import("std"); const crypto = std.crypto; const debug = std.debug; const fmt = std.fmt; const math = std.math; const mem = std.mem; const pwhash = crypto.pwhash; const testing = std.testing; const Sha512 = crypto.hash.sha2.Sha512; const utils = crypto.utils; const phc_format = @import("phc_encoding.zig");...
lib/std/crypto/bcrypt.zig
const std = @import("index.zig"); const debug = std.debug; const assert = debug.assert; const mem = std.mem; const Allocator = mem.Allocator; pub fn ArrayList(comptime T: type) type { return AlignedArrayList(T, @alignOf(T)); } pub fn AlignedArrayList(comptime T: type, comptime A: u29) type{ return struct { ...
std/array_list.zig
const std = @import("std"); const ELF = @import("../elf.zig"); const phdr = @import("../data-structures/phdr.zig"); const ehdr = @import("../data-structures/ehdr.zig"); const PhdrErrors = error{ E_Phoff_Phentsize_or_Phnum_is_zero, }; fn phdrParse32( elf: ELF.ELF, alloc: std.mem.Allocator, ) !std.ArrayList...
src/functions/phdr.zig
const std = @import("std"); const testing = std.testing; const expect = testing.expect; const expectEqual = testing.expectEqual; const expectApproxEqRel = testing.expectApproxEqRel; pub const Vector2 = packed struct { x: f32, y: f32, pub fn init(x: f32, y: f32) Vector2 { return .{ .x = x, .y = y }...
src/vector2.zig
const std = @import("std"); const assert = std.debug.assert; usingnamespace @import("types.zig"); const OperandType = @import("operand.zig").OperandType; // When we want to refer to a register but don't care about it's bit size pub const RegisterName = enum(u8) { AX = 0x00, CX, DX, BX, SP, BP,...
src/x86/register.zig
const std = @import("std"); const builtin = @import("builtin"); const mem = std.mem; const testing = std.testing; const TypeId = builtin.TypeId; const TypeInfo = builtin.TypeInfo; pub fn lessThan(comptime T: type, a: T, b: T) bool { const info = @typeInfo(T); switch (info) { .Int, .Float, .ComptimeFl...
src/generic/compare.zig
const std = @import("std"); const foilz = @import("src/archiver.zig"); const log = std.log; const Builder = std.build.Builder; const CrossTarget = std.zig.CrossTarget; const Mode = std.builtin.Mode; const LibExeObjStep = std.build.LibExeObjStep; var builder: *Builder = undefined; var target: *CrossTarget = undefine...
build.zig
const std = @import("std"); const net = std.net; usingnamespace @import("primitive_types.zig"); // TODO(vincent): test all error codes pub const ErrorCode = packed enum(u32) { ServerError = 0x0000, ProtocolError = 0x000A, AuthError = 0x0100, UnavailableReplicas = 0x1000, CoordinatorOverloaded = 0x...
src/error.zig
pub const TIMER0 = struct { const base = 0xe0002800; pub const LOAD3 = @intToPtr(*volatile u8, base + 0x0); pub const LOAD2 = @intToPtr(*volatile u8, base + 0x4); pub const LOAD1 = @intToPtr(*volatile u8, base + 0x8); pub const LOAD0 = @intToPtr(*volatile u8, base + 0xc); /// Load value when T...
riscv-zig-blink/src/fomu/timer0.zig
pub const Vertex = struct { pos: @Vector(4, f32), col: @Vector(4, f32), uv: @Vector(2, f32), }; pub const vertices = [_]Vertex{ .{ .pos = .{ 1, -1, 1, 1 }, .col = .{ 1, 0, 1, 1 }, .uv = .{ 0, 1 } }, .{ .pos = .{ -1, -1, 1, 1 }, .col = .{ 0, 0, 1, 1 }, .uv = .{ 1, 1 } }, .{ .pos = .{ -1, -1, -1,...
examples/textured-cube/cube_mesh.zig
const stdx = @import("stdx"); const Function = stdx.Function; const graphics = @import("graphics"); const Color = graphics.Color; const platform = @import("platform"); const MouseUpEvent = platform.MouseUpEvent; const MouseDownEvent = platform.MouseDownEvent; const ui = @import("../ui.zig"); const Padding = ui.widgets...
ui/src/widgets/button.zig
const std = @import("std"); const stdx = @import("stdx"); const t = stdx.testing; const string = stdx.string; const ds = stdx.ds; const algo = stdx.algo; const log = stdx.log.scoped(.ttf); // NOTES: // Chrome does not support SVG in fonts but they support colored bitmaps. // - https://bugs.chromium.org/p/chromium/iss...
graphics/src/ttf.zig
const std = @import("std"); const link = @import("../link.zig"); const Module = @import("../Module.zig"); const Compilation = @import("../Compilation.zig"); const Inst = @import("../ir.zig").Inst; const Value = @import("../value.zig").Value; const Type = @import("../type.zig").Type; const C = link.File.C; const Decl...
src/codegen/c.zig
const kernel = @import("../../kernel.zig"); const TODO = kernel.TODO; var plic_base: u64 = 0; var plic_size: u64 = 0; const max_interrupt = 32; pub const Interrupt = struct { handler: fn () u64, pending_operations_handler: fn () void, pub fn register(interrupt: Interrupt, index: u64) void { inter...
src/kernel/arch/riscv64/interrupts.zig
const std = @import("std"); const types = @import("types.zig"); const ast = std.zig.ast; pub const Encoding = enum { utf8, utf16, }; pub const DocumentPosition = struct { line: []const u8, line_index: usize, absolute_index: usize, }; pub fn documentPosition(doc: types.TextDocument, position: type...
src/offsets.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; const with_dissassemble = false; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const Computer = tools.IntCode_Computer; const Tile = str...
2019/day11.zig
const std = @import("std"); const io = std.io; const crypto = std.crypto; const stdin = io.getStdIn().reader(); const stdout = io.getStdOut().writer(); const print = stdout.print; // TODO: figure out how to not need this everywhere const maxConsoleInputLength: u8 = 64; const User = struct { username: [maxConsole...
src/main.zig
const std = @import("std"); const json = std.json; const testing = std.testing; const assert = std.debug.assert; const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const ArrayList = std.ArrayList; const StringArrayHashMap = std.StringArrayHashMap; const Writer = std.io.Writer; const ...
src/nestedtext.zig
const std = @import("std"); const mem = std.mem; const uefi = std.os.uefi; const Allocator = mem.Allocator; const Guid = uefi.Guid; pub const DevicePathProtocol = packed struct { type: DevicePathType, subtype: u8, length: u16, pub const guid align(8) = Guid{ .time_low = 0x09576e91, .ti...
lib/std/os/uefi/protocols/device_path_protocol.zig
const std = @import("std"); const Csr = @import("csr.zig").Csr; const Mstatus = @import("csr.zig").Mstatus; const MCause = @import("csr.zig").MCause; const Mtvec = @import("csr.zig").Mtvec; const Stvec = @import("csr.zig").Stvec; const SCause = @import("csr.zig").SCause; const Satp = @import("csr.zig").Satp; const Inst...
lib/CpuState.zig
const std = @import("std"); const sdk = @import("sdk"); const surface = @import("surface.zig"); const mods = @import("mods.zig"); const hud = @import("hud.zig"); pub const THud = struct { pub const Part = union(enum) { text: []u8, component: struct { mod: []u8, name: []u8, ...
src/thud.zig
const common = @import("common.zig"); const rom = @import("rom.zig"); const std = @import("std"); const fs = std.fs; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; const gba = rom.gba; const li16 = rom.int.li16; const li32 = rom.int.li32; const lu16 = rom.int.lu16; const lu32 = rom...
src/core/gen3.zig
usingnamespace @import("root").preamble; const build_options = @import("build_options"); const copernicus_data = @embedFile(build_options.copernicus_path); const process = os.kernel.process; const blob = copernicus_data[32..]; const text_base = std.mem.readIntLittle(usize, copernicus_data[0..8]); const text_size = d...
subprojects/flork/src/kernel/copernicus.zig
const c = @import("c.zig"); const nk = @import("../nuklear.zig"); const std = @import("std"); const mem = std.mem; const testing = std.testing; pub const Colors = enum(u8) { text = c.NK_COLOR_TEXT, window = c.NK_COLOR_WINDOW, header = c.NK_COLOR_HEADER, border = c.NK_COLOR_BORDER, button = c.NK_CO...
src/style.zig
const std = @import("std"); const bld = std.build; var ldns_path: ?[]const u8 = undefined; var rabbitmq_path: ?[]const u8 = undefined; var ssl_path: ?[]const u8 = undefined; var crypto_path: ?[]const u8 = undefined; var zamqp_path: []const u8 = undefined; var zdns_path: []const u8 = undefined; var version: []const u8...
build.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(.{}){}; const PassportField = struct { is_set: bool = false, is_ok: bool = false, }; ...
day_04/src/main.zig
const compiler_rt_armhf_target = false; // TODO const ConditionalOperator = enum { Eq, Lt, Le, Ge, Gt, }; pub nakedcc fn __aeabi_fcmpeq() noreturn { @setRuntimeSafety(false); @call(.{ .modifier = .always_inline }, aeabi_fcmp, .{.Eq}); unreachable; } pub nakedcc fn __aeabi_fcmplt() no...
lib/std/special/compiler_rt/arm/aeabi_fcmp.zig
const builtin = @import("builtin"); const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const h = @cImport(@cInclude("behavior/translate_c_macros.h")); test "casting to void with a macro" { h.IGNORE_ME_1(42); h.IGNORE_ME_2(42); h.IGNORE_ME_3(42); ...
test/behavior/translate_c_macros.zig
const std = @import("std"); const Builder = std.build.Builder; const Step = std.build.Step; const assert = std.debug.assert; const print = std.debug.print; const Exercise = struct { /// main_file must have the format key_name.zig. /// The key will be used as a shorthand to build /// just one example. m...
build.zig
const print = @import("std").debug.print; pub fn main() void { // A "tuple": const foo = .{ true, false, @as(i32, 42), @as(f32, 3.141592), }; // We'll be implementing this: printTuple(foo); // This is just for fun, because we can: const nothing = .{}; p...
exercises/082_anonymous_structs3.zig
const std = @import("std.zig"); const StringHashMap = std.StringHashMap; const mem = @import("mem.zig"); const Allocator = mem.Allocator; const testing = std.testing; pub const BufSet = struct { hash_map: BufSetHashMap, const BufSetHashMap = StringHashMap(void); pub fn init(a: *Allocator) BufSet { ...
lib/std/buf_set.zig
const std = @import("std"); const Extent3D = @import("data.zig").Extent3D; const TextureView = @import("TextureView.zig"); const Texture = @This(); /// The type erased pointer to the Texture implementation /// Equal to c.WGPUTexture for NativeInstance. ptr: *anyopaque, vtable: *const VTable, pub const VTable = str...
gpu/src/Texture.zig
const sabaton = @import("root").sabaton; const std = @import("std"); const RSDP = packed struct { signature: [8]u8, checksum: u8, oemid: [6]u8, revision: u8, rsdt_addr: u32, extended_length: u32, xsdt_addr: u64, extended_checksum: u8, }; fn signature(name: []const u8) u32 { return std.mem.readInt(u...
src/platform/acpi.zig
pub const HH_DISPLAY_TOPIC = @as(u32, 0); pub const HH_HELP_FINDER = @as(u32, 0); pub const HH_DISPLAY_TOC = @as(u32, 1); pub const HH_DISPLAY_INDEX = @as(u32, 2); pub const HH_DISPLAY_SEARCH = @as(u32, 3); pub const HH_SET_WIN_TYPE = @as(u32, 4); pub const HH_GET_WIN_TYPE = @as(u32, 5); pub const HH_GET_WIN_HANDLE = @...
win32/data/html_help.zig
const std = @import("std"); const assert = std.debug.assert; const crypto = std.crypto; const log = std.log.scoped(.state_machine); const mem = std.mem; const Allocator = mem.Allocator; usingnamespace @import("tigerbeetle.zig"); const HashMapAccounts = std.AutoHashMap(u128, Account); const HashMapTransfers = std.Auto...
src/state_machine.zig
pub const WM_ADSPROP_NOTIFY_PAGEINIT = @as(u32, 2125); pub const WM_ADSPROP_NOTIFY_PAGEHWND = @as(u32, 2126); pub const WM_ADSPROP_NOTIFY_CHANGE = @as(u32, 2127); pub const WM_ADSPROP_NOTIFY_APPLY = @as(u32, 2128); pub const WM_ADSPROP_NOTIFY_SETFOCUS = @as(u32, 2129); pub const WM_ADSPROP_NOTIFY_FOREGROUND = @as(u32, ...
win32/networking/active_directory.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const Allocator = mem.Allocator; const math = std.math; const maxInt = math.maxInt; const vk = @import("vk.zig"); const glfw = @import("glfw.zig"); const util = @import("util.zig"); const arrayPtr = util.arrayPtr; const emptySlice = ut...
src/main.zig
const builtin = @import("builtin"); const std = @import("std"); const json = std.json; const mem = std.mem; const fieldIndex = std.meta.fieldIndex; const TypeId = builtin.TypeId; pub fn main() anyerror!void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const al...
tools/merge_anal_dumps.zig
const std = @import("std"); const io = std.io; const warn = std.debug.warn; const assert = std.debug.assert; fn jumpForward(prog: []const u8, prog_ptr: usize) usize { var bracket_stack: usize = 1; var ptr: usize = prog_ptr; while (bracket_stack > 0) { ptr += 1; // if (ptr >= prog.len) //...
004-brainfuck/src/main.zig
const std = @import("std"); const dbg = std.debug.print; pub fn Encoder(comptime WriterType: type) type { return struct { writer: WriterType, const Self = @This(); pub const Error = WriterType.Error; fn put(self: Self, comptime T: type, val: T) Error!void { if (T == u8...
src/mpack.zig
const std = @import("std"); pub const core = @import("gen/core.zig"); pub const glsl = @import("gen/glsl.zig"); pub const Builder = struct { allocator: *std.mem.Allocator, generator: u32, id_count: u32 = 0, insns: std.ArrayListUnmanaged(Instruction) = .{}, pub fn init(allocator: *std.mem.Allocator...
src/spirv.zig
const std = @import("std"); const builtin = @import("builtin"); const io = std.io; const os = std.os; const fs = std.fs; const windows = os.windows; const posix = os.posix; const Mutex = std.Mutex; const TtyColor = enum { Red, Green, Yellow, Magenta, Cyan, Blue, Reset, }; fn Protected(...
src/index.zig
usingnamespace @import("root").preamble; /// Features that should be enabled in the code for the red black tree pub const Features = struct { enable_iterators_cache: bool, enable_kth_queries: bool, enable_not_associatve_augment: bool, }; /// Config for red black tree. Includes enabled features and callbac...
lib/containers/rbtree.zig
const std = @import("std"); const iup = @import("iup.zig"); const MainLoop = iup.MainLoop; const Dialog = iup.Dialog; const Button = iup.Button; const MessageDlg = iup.MessageDlg; const Multiline = iup.Multiline; const Label = iup.Label; const Text = iup.Text; const VBox = iup.VBox; const HBox = iup.HBox; const Menu =...
src/tabs_example.zig
//-------------------------------------------------------------------------------- // Section: Types (4) //-------------------------------------------------------------------------------- pub const OPERATION_START_FLAGS = enum(u32) { D = 1, _, pub fn initFlags(o: struct { D: u1 = 0, }) OPERATIO...
win32/storage/operation_recorder.zig
const std = @import("std"); const Gateway = @import("../Gateway.zig"); const util = @import("../util.zig"); const log = std.log.scoped(.zCord); const Heartbeat = @This(); handler: union(enum) { thread: *ThreadHandler, callback: CallbackHandler, }, pub const Strategy = union(enum) { thread, callback: ...
src/Gateway/Heartbeat.zig
const std = @import("std"); const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; const Chunk = @import("./chunk.zig").Chunk; const OpCode = @import("./chunk.zig").OpCode; const Value = @import("./value.zig").Value; const compile = @import("./compiler.zig").compile; const Parser = @import("./compiler.zi...
src/vm.zig