code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const input = [_]i32{ 0, 12, 6, 13, 20, 1, 17 }; usingnamespace @import("util.zig"); pub fn main() !void { var allocator_state = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer allocator_state.deinit(); const allocator = &allocator_state.allocator; const part1 ...
src/day15.zig
const std = @import("std"); const Self = @This(); pub const HexColor = enum(u4) { White = 15, // Spec name is bright white LightGray = 7, // Spec name is white DarkGray = 8, // Spec name is bright black Black = 0, Red = 1, Green = 2, Yellow = 3, Blue = 4, Magenta = 5, Cyan = 6...
libs/utils/AnsiEscProcessor.zig
const builtin = @import("std").builtin; const utils = @import("utils"); const io = @import("io.zig"); const File = io.File; const FileError = io.FileError; /// Print a char pub fn char(file: *File, ch: u8) FileError!void { _ = try file.write(([_]u8{ch})[0..]); } /// Print a string. pub fn string(file: *File, st...
kernel/fprint.zig
const std = @import("std"); const assert = std.debug.assert; const builtin = std.builtin; const TypeId = builtin.TypeId; // usingnamespace @import("../main/util.zig"); pub fn zero_struct(comptime T: type) T { var out: T = undefined; std.mem.set(u8, @ptrCast([*]u8, &out)[0..@sizeOf(T)], 0); return out; } p...
code/main/util.zig
const xbeam = @import("../index.zig"); const std = @import("std"); const AtomicUsize = std.atomic.Atomic(usize); /// A bounded multi-producer multi-consumer queue. /// /// This queue allocates a fixed-capacity buffer on construction, which is used to store pushed /// elements. The queue cannot hold more elements tha...
src/queue/array_queue.zig
const std = @import("std"); const koino = @import("koino"); const markdown_options = koino.Options{ .extensions = .{ .table = true, .autolink = true, .strikethrough = true, }, .render = .{ .header_anchors = true, .anchor_icon = "§ ", }, }; /// verifies and parse...
src/main.zig
const std = @import("std"); const server = &@import("../main.zig").server; const Direction = @import("../command.zig").Direction; const Error = @import("../command.zig").Error; const Seat = @import("../Seat.zig"); const View = @import("../View.zig"); const ViewStack = @import("../view_stack.zig").ViewStack; /// Foc...
source/river-0.1.0/river/command/focus_view.zig
const std = @import("std"); const options = @import("build_options"); const encode = @import("encoder.zig"); const decode = @import("decoder.zig"); const encoder = encode.BottomEncoder; const decoder = decode.BottomDecoder; const CSlice = extern struct { ptr: ?[*]const u8, len: usize, }; /// Error code 0 - no ...
src/clib.zig
const std = @import("std"); const Allocator = std.mem.Allocator; // This is used to keep track of values that // are defined. const Environment = std.StringHashMap(*Value); const EvaluationError = error{ Undefined, NonFunctionCalled, } || Allocator.Error; const Expression = union(enum) { variable: []con...
src/main.zig
const std = @import("std"); const formats = @import("formats.zig"); const int = @import("../int.zig"); const nds = @import("../nds.zig"); const debug = std.debug; const fmt = std.fmt; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; const testing = std.testing; ...
src/core/rom/nds/fs.zig
usingnamespace @import("root").preamble; const fmt_lib = @import("fmt.zig"); const Mutex = os.thread.Mutex; var mutex = Mutex{}; noinline fn getLock() Mutex.Held { return mutex.acquire(); } const enable_all_logging = false; fn enabled(comptime tag: anytype, comptime log_level: ?std.log.Level) bool { if (en...
lib/output/log.zig
const std = @import("std"); const path = std.fs.path; const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; const glslc_command = if (std.builtin.os.tag == .windows) "tools/win/glslc.exe" else "glslc"; pub fn build(b: *Builder) void { { const exe = exampleExe(b, "example_glfw_v...
examples/build.zig
const std = @import("std"); const builtin = @import("builtin"); const shared = @import("./src/shared.zig"); pub fn build(b: *std.build.Builder) !void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const exe = b.addExecutable("zls", "src/main.zig"); const exe_op...
build.zig
const zang = @import("zang"); const note_frequencies = @import("zang-12tet"); const common = @import("common.zig"); const c = @import("common/c.zig"); pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb; pub const AUDIO_SAMPLE_RATE = 48000; pub const AUDIO_BUFFER_SIZE = 1024; pub const DESCRIPTION = \\exampl...
examples/example_envelope.zig
const std = @import("std"); const expect = std.testing.expect; const expectEq = std.testing.expectEqual; const Op = @import("./ops.zig").Op; pub const RecordLengthType: type = usize; pub const KeyLengthType: type = u16; pub const RecordError = error{ BufferTooSmall, KeyTooBig }; /// A record is an array of contiguou...
src/record.zig
const parsers = @import("parsers.zig"); const ParseNumber = parsers.ParseNumber; const ParseAllocated = parsers.ParseAllocated; const std = @import("std"); const debug = std.debug; const assert = debug.assert; const assertError = debug.assertError; const warn = debug.warn; const fmt = std.fmt; const mem = std.mem; con...
parse_args.zig
const std = @import("std"); const tracy = @import("tracy"); const PAGE_SIZE = 4096; const LEAF_CELL_SIZE = 32; const INTERNAL_CELL_SIZE = 32; const MAX_LEAF_CELLS = (PAGE_SIZE - @sizeOf(NodeHeader)) / LEAF_CELL_SIZE; const MAX_INTERNAL_CELLS = (PAGE_SIZE - @sizeOf(NodeHeader)) / INTERNAL_CELL_SIZE; const MAX_DEPTH = 1...
src/transaction_tree.zig
const std = @import("std"); const assert = std.debug.assert; const buf = @import("Buffer.zig"); const window = @import("Window.zig"); const c = @import("c.zig").c; const ReferenceCounter = @import("../RefCount.zig").ReferenceCounter; var null_vao: ?VertexMeta = null; pub const VertexMeta = struct { ref_count: Ref...
src/WindowGraphicsInput/VertexMeta.zig
const std = @import("std"); const io = std.io; const mem = std.mem; const meta = std.meta; const net = std.net; const os = std.os; const testing = @import("testing.zig"); pub const Value = union(enum) { Set: []const u8, NotSet: void, Null: void, }; /// This struct is intended to be used as a field in a s...
src/primitive_types.zig
const std = @import("std"); const mem = std.mem; const v = @import("vector_types.zig"); const _mm256_storeu_si256 = @import("llvm_intrinsics.zig")._mm256_storeu_si256; const common = @import("common.zig"); const escape_map = [256]u8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x0. 0, 0, 0, 0, 0, ...
src/string_parsing.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const gui = @import("gui"); const nvg = @import("nanovg"); const geometry = @import("gui/geometry.zig"); const Rect = geometry.Rect; pub const Buttons = enum { ok, ok_cancel, yes_no, yes_no_cancel, }; pub const Icon = enum { none, ...
src/MessageBoxWidget.zig
const std = @import("std"); const gui = @import("gui.zig"); const Gradient = @import("gradient.zig").Gradient; const prefs = @import("prefs.zig"); const VTE = @import("vte"); const c = VTE.c; const gtk = VTE.gtk; const vte = VTE.vte; const known_folders = @import("known-folders"); const nt = @import("nestedtext"); cons...
src/config.zig
const std = @import("std"); // glslc -mfmt=num graphics/src/backend/vk/shaders/tex_vert.glsl -o - pub const tex_vert_spv = std.mem.toBytes([_]u32{ 0x07230203,0x00010000,0x000d000a,0x00000026, 0x00000000,0x00020011,0x00000001,0x0006000b, 0x00000001,0x4c534c47,0x6474732e,0x3035342e, 0x00000000,0x0003000e,0x00000000,0x00...
graphics/src/backend/vk/shaders/shaders.zig
const std = @import("../std.zig"); const mem = std.mem; const testing = std.testing; // Apply sbox0 to each byte in w. fn subw(w: u32) u32 { return @as(u32, sbox0[w >> 24]) << 24 | @as(u32, sbox0[w >> 16 & 0xff]) << 16 | @as(u32, sbox0[w >> 8 & 0xff]) << 8 | @as(u32, sbox0[w & 0xff]); } fn rotw(w: u32) u32 { ...
lib/std/crypto/aes.zig
const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; pub fn acos(x: var) @typeOf(x) { const T = @typeOf(x); return switch (T) { f32 => acos32(x), f64 => acos64(x), else => @compileError("acos not implemented for " ++ @typeName(T)), }; } fn r...
std/math/acos.zig
const Emit = @This(); const std = @import("std"); const math = std.math; const Mir = @import("Mir.zig"); const bits = @import("bits.zig"); const link = @import("../../link.zig"); const Module = @import("../../Module.zig"); const ErrorMsg = Module.ErrorMsg; const assert = std.debug.assert; const DW = std.dwarf; const l...
src/arch/aarch64/Emit.zig
const std = @import("std"); const core = @import("../core.zig"); const debug = std.debug; const fs = std.fs; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; pub const History = core.List(core.Text); pub const File = struct { path: []const u8, stat: ?os.Stat, }; pub const E...
src/core/editor.zig
const std = @import("std"); const common = @import("common.zig"); const slimy = @import("slimy.zig"); const zc = @import("zcompute"); const log = std.log.scoped(.gpu); pub fn search( params: slimy.SearchParams, callback_context: anytype, comptime resultCallback: fn (@TypeOf(callback_context), slimy.Result)...
src/gpu.zig
pub const ptrdiff_t = c_long; pub const wchar_t = c_int; pub const max_align_t = extern struct { __clang_max_align_nonce1: c_longlong, __clang_max_align_nonce2: c_longdouble, }; pub extern fn memcpy(__dest: ?*c_void, __src: ?*const c_void, __n: c_ulong) ?*c_void; pub extern fn memmove(__dest: ?*c_void, __src: ?...
freetype2.original.zig
const std = @import("std"); const os = std.os; const builtin = @import("builtin"); const assert = std.debug.assert; const Allocator = std.mem.Allocator; const page_size = std.os.page_size; const posix = std.os.posix; fn up_to_nearest_power_of_2(comptime T: type, n: T) T { var power: T = 1; while (power < n) ...
gpda.zig
const std = @import("../std.zig"); const builtin = @import("builtin"); const Futex = @This(); const os = std.os; const assert = std.debug.assert; const testing = std.testing; const Atomic = std.atomic.Atomic; /// Checks if `ptr` still contains the value `expect` and, if so, blocks the caller until either: /// - The ...
lib/std/Thread/Futex.zig
const libpoke = @import("../src/pokemon/index.zig"); const nds = @import("../src/nds/index.zig"); const gba = @import("../src/gba.zig"); const utils = @import("../src/utils/index.zig"); const std = @import("std"); const fun = @import("../lib/fun-with-zig/src/index.zig"); // TODO: Package stuff const mem = std.mem; con...
test/fake_roms.zig
const std = @import("std"); const assert = std.debug.assert; pub fn Rc(comptime T: type) type { return struct { const refSize = u16; refs: std.atomic.Int(refSize), ptr: ?*T, allocator: *std.mem.Allocator, pub const Self = @This(); pub fn init(alloc: *std.mem.Alloca...
zrc.zig
const builtin = @import("builtin"); // Zig's own stack-probe routine (available only on x86 and x86_64) pub fn zig_probe_stack() callconv(.Naked) void { @setRuntimeSafety(false); // Versions of the Linux kernel before 5.1 treat any access below SP as // invalid so let's update it on the go, otherwise we'l...
lib/std/special/compiler_rt/stack_probe.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const testing = std.testing; /// Determin the runtime size requirement of N types continues in memory (in bytes). fn runtimeSize(comptime fields: var) comptime_int { var res = 0; for (fields) |field| { res += @sizeOf(field.Value)...
src/struct.zig
const std = @import("std"); const builtin = @import("builtin"); const testing = std.testing; const expect = testing.expect; const expectEqual = testing.expectEqual; test "params" { try expect(testParamsAdd(22, 11) == 33); } fn testParamsAdd(a: i32, b: i32) i32 { return a + b; } test "local variables" { te...
test/behavior/fn.zig
const std = @import("std"); const builtin = @import("builtin"); const native_endian = builtin.target.cpu.arch.endian(); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const expectEqualSlices = std.testing.expectEqualSlices; const maxInt = std.math.maxInt; const Node = struct { val:...
test/behavior/struct_llvm.zig
const std = @import("std"); const ray = @import("ray.zig"); const camera = @import("camera.zig"); const config = @import("config.zig"); const sphere = @import("sphere.zig"); const vector = @import("vector.zig"); const material = @import("material.zig"); const Vec3 = config.Vec3; pub const Hit = struct { object_id...
src/scene.zig
const core = @import("../index.zig"); const Coord = core.geometry.Coord; const ThingPosition = core.protocol.ThingPosition; const Species = core.protocol.Species; const Wall = core.protocol.Wall; const assert = @import("std").debug.assert; pub const view_distance = 8; pub fn getAttackRange(species: Species) i32 { ...
src/core/game_logic.zig
// SPDX-License-Identifier: MIT // This file is part of the Termelot project under the MIT license. const std = @import("std"); pub const Style = struct { fg_color: Color, bg_color: Color, decorations: Decorations, pub fn default() Style { return Style{ .fg_color = Color.Default,...
src/style.zig
const std = @import("std"); const BuildStep = @import("./build_step.zig"); const Self = @This(); builder: *std.build.Builder, hosted_step: *BuildStep, plugin_step: *BuildStep, step: std.build.Step, pub fn create(build_step: *BuildStep) *Self { const builder = build_step.builder; const self = builder.allocato...
src/reload_step.zig
const std = @import("std"); const xml = @import("xml.zig"); const Peripheral = @import("Peripheral.zig"); const Register = @import("Register.zig"); const Field = @import("Field.zig"); const ArenaAllocator = std.heap.ArenaAllocator; const Allocator = std.mem.Allocator; pub const Device = struct { vendor: ?[]const ...
src/svd.zig
const std = @import("std"); const c = @import("c.zig"); const gl = @import("gl.zig"); const fs = @import("fs.zig"); const m = @import("math/math.zig"); const utf8 = @import("utf8.zig"); const alog = std.log.scoped(.alka_core_renderer); /// Error set pub const Error = error{ ObjectOverflow, VertexOverflow, ...
src/core/renderer.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const EffectTimer = u8; const HitPoints = u8; const Mana = u16; const TurnResult = enum { CONTINUE, WIN, FAIL, }; const InstantSpell = struct { cost: Mana, heal: HitPoints, damage: HitPoints }; const Spell = union(enum) { Instant: InstantSpell, ...
src/main/zig/2015/day22.zig
const std = @import("std.zig"); const tokenizer = @import("zig/tokenizer.zig"); pub const Token = tokenizer.Token; pub const Tokenizer = tokenizer.Tokenizer; pub const parse = @import("zig/parse.zig").parse; pub const parseStringLiteral = @import("zig/string_literal.zig").parse; pub const render = @import("zig/render....
lib/std/zig.zig
const std = @import("std"); pub const c = @import("c.zig"); pub const content = @import("content.zig"); pub const coordinates = @import("coordinates.zig"); pub const events = @import("events.zig"); pub const frame_timer = @import("frame_timer.zig"); pub const gfx = @import("gfx.zig"); pub const gltf = @import("gltf.zi...
src/main.zig
const std = @import("std"); const expect = @import("std").testing.expect; const expectEqual = @import("std").testing.expectEqual; const math = @import("std").math; const Vec3 = struct { x: f32, y: f32, z: f32, pub fn init(x: f32, y: f32, z: f32) Vec3 { return Vec3{ .x = x, ...
src/main.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const Chemical = []const u8; const Chemicals = std.ArrayList(Chemical); const Reaction = st...
2019/day14.zig
const std = @import("std"); const pokemon = @import("index.zig"); const nds = @import("../nds/index.zig"); const utils = @import("../utils/index.zig"); const common = @import("common.zig"); const fun = @import("../../lib/fun-with-zig/src/index.zig"); const mem = std.mem; const Narc = nds.fs.Narc; const Nitro = nds.fs...
src/pokemon/gen5.zig
pub const mco_state = extern enum(c_int) { Dead = 0, Normal = 1, Running = 2, Suspended = 3, _, }; pub const mco_result = extern enum(c_int) { Success = 0, GenericError = 1, InvalidPointer = 2, InvalidCoroutine = 3, NotSuspended = 4, NotRunning = 5, MakeCont...
src/coro.zig
const std = @import("std"); const match = @import("match.zig"); const Options = @import("Options.zig"); const Choices = @This(); const ScoredResult = struct { score: match.Score, str: []const u8, }; const ResultList = std.ArrayList(ScoredResult); const SearchJob = struct { lock: std.Thread.Mutex = .{},...
src/Choices.zig
const std = @import("std"); usingnamespace @import("kira").log; const kira_utils = @import("kira").utils; const kira_glfw = @import("kira").glfw; const kira_gl = @import("kira").gl; const kira_renderer = @import("kira").renderer; const kira_window = @import("kira").window; const math = @import("kira").math; ...
examples/primitive-renderer.zig
const c = @cImport({ @cInclude("X11/Xlib.h"); @cInclude("X11/cursorfont.h"); @cInclude("X11/Xft/Xft.h"); }); const std = @import("std"); const print = std.debug.warn; const allocator = std.heap.c_allocator; fn process_client_message(message: [20]u8, display: *c.Display) void { print("Message arrived: {...
src/main.zig
const graph = @import("graph.zig").Graph; const std = @import("std"); const ArrayList = std.ArrayList; const graph_err = @import("graph.zig").GraphError; const testing = std.testing; const AutoArrayHashMap = std.AutoArrayHashMap; const mem = std.mem; const testing_alloc = std.testing.allocator; pub fn DataGraph(compti...
src/data_graph.zig
const std = @import("std"); const assert = std.debug.assert; const ArrayList = std.ArrayList; const c_allocator = std.heap.c_allocator; const page_allocator = std.heap.page_allocator; const Allocator = std.mem.Allocator; // POSIX function extern fn ffsll(c_longlong) c_int; pub const OnAllocErrors = error{OnAllocError...
src/ObjectPool.zig
const Unit = @import("./_utils.zig").Unit; pub const GEORADIUS = struct { key: []const u8, longitude: f64, latitude: f64, radius: f64, unit: Unit, withcoord: bool, withdist: bool, withhash: bool, count: ?u64, ordering: ?Ordering, store: ?[]const u8, storedist: ?[]const...
src/commands/geo/georadius.zig
// SPDX-License-Identifier: MIT // This file is part of the Termelot project under the MIT license. const std = @import("std"); pub const backend = @import("backend.zig"); pub const style = @import("style.zig"); usingnamespace style; pub const event = @import("event.zig"); usingnamespace event; pub const Backend = ...
src/termelot.zig
pub const STDIN_FILENO = 0; pub const STDOUT_FILENO = 1; pub const STDERR_FILENO = 2; pub const timespec = struct { tv_sec: isize, tv_nsec: isize, }; pub const fd_t = usize; pub const ino_t = u64; pub const mode_t = u32; pub const PATH_MAX = 1024; pub const EPERM = 1; // Not super-user pub const ENOENT = 2;...
src/psp/os/bits.zig
const std = @import("std"); const gl = @import("zig-opengl"); const log = std.log.scoped(.@"brucelib.graphics.opengl"); const common = @import("common.zig"); const VertexBufferHandle = common.VertexBufferHandle; const VertexLayoutDesc = common.VertexLayoutDesc; const VertexLayoutHandle = common.VertexLayoutHandle; co...
modules/graphics/src/opengl.zig
const std = @import("std"); const windows = @import("windows.zig"); const d3d12 = @import("d3d12.zig"); const UINT = windows.UINT; const UINT64 = windows.UINT64; const FLOAT = windows.FLOAT; const IUnknown = windows.IUnknown; const HRESULT = windows.HRESULT; const WINAPI = windows.WINAPI; const GUID = windows.GUID; con...
modules/platform/vendored/zwin32/src/directml.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const bog = @import("bog.zig"); const Op = bog.Op; const Value = bog.Value; const RegRef = bog.RegRef; const Module = bog.Module; const Gc = bog.Gc; const Errors = bog.Errors; const max_params = @import("compiler.zig").max_params; pub c...
src/vm.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const HeightMap = std.AutoHashMap(aoc.Coord, u8); pub fn run(problem: *aoc.Problem) !aoc.Solution { var heights = HeightMap.init(problem.allocator); defer heights.deinit(); var row: isize = 0; while (problem.line()) |line| { var col...
src/main/zig/2021/day09.zig
const std = @import("std"); const Allocator = std.mem.Allocator; pub const LineIterator = struct { buffer: []u8, index: usize, const Self = @This(); /// Returns the next line pub fn next(self: *Self) ?[]u8 { if (self.index == self.buffer.len) { return null; } ...
shared/utils.zig
const std = @import("std"); const math = std.math; const data = @embedFile("input.txt"); const STEPS = std.math.maxInt(i32); // const STEPS = 1000; const Node = struct { height: u16 = 9, on_path: bool = false, }; const Point = struct { x: i32 = 0, y: i32 = 0, fn equal(self: *const Point, other: ...
day15/main.zig
const MMIO = @import("mmio.zig").MMIO; pub const PINB = MMIO(0x23, u8, packed struct { PINB0: u1 = 0, PINB1: u1 = 0, PINB2: u1 = 0, PINB3: u1 = 0, PINB4: u1 = 0, PINB5: u1 = 0, PINB6: u1 = 0, PINB7: u1 = 0, }); pub const DDRB = MMIO(0x24, u8, packed struct { DDB0: u1 = 0, DDB1:...
boilerplate/gpio.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/day06.txt", run); pub fn run(input: []const u8, gp...
2021/day06.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); } fn regIndex(name: []const u8) u32 { var num: u32 = 0; for (name) |c| { num =...
2017/day10.zig
const std = @import("std"); const strings = @import("strings.zig"); const math = std.math; const testing = std.testing; const warn = std.debug.warn; test "StringFinder.next" { var a = std.debug.global_allocator; const TestCase = struct { pattern: []const u8, text: []const u8, index: ?u...
src/strings/strings_test.zig
const std = @import("std"); const mem = std.mem; const meta = std.meta; const net = std.net; const ArrayList = std.ArrayList; usingnamespace @import("../frame.zig"); usingnamespace @import("../primitive_types.zig"); const testing = @import("../testing.zig"); /// AUTHENTICATE is sent by a node in response to a STARTUP...
src/frames/auth.zig
const std = @import("std"); const expect = std.testing.expect; const expectError = std.testing.expectError; /// Value that serializes a !T /// The T value is memset to all zeros. pub fn ErrorVal(comptime T: type) type { return packed struct { const Self = @This(); err: u32, val: T, ...
error_abi.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const Value = @import("Value.zig"); const Vm = @import("vm.zig").Vm; const root = @import("root"); //! Mark-and-sweep based garbage collector //! defining `gc_trigger_size` within the root file of your //! program will allow to set the byte size of the ...
src/Gc.zig
const psp = @import("psp/pspsdk.zig"); pub const panic = psp.debug.panic; comptime { asm (psp.module_info("Zig PSP App", 0, 1, 0)); } var display_list: [0x40000]u32 align(16) = [_]u32{0} ** 0x40000; const Vertex = packed struct { u: f32, v: f32, c: u32, x: f32, y: f32, z: f32, }; var ver...
src/main.zig
const std = @import("std"); const hzzp = @import("hzzp"); const tls = @import("iguanaTLS"); const build_opts = @import("build_options"); const hostname = "id.twitch.tv"; pub fn checkTokenValidity(allocator: std.mem.Allocator, token: []const u8) !bool { if (build_opts.local) return true; const TLSStream = tls...
src/network/auth.zig
pub const __builtin_bswap16 = @import("std").zig.c_builtins.__builtin_bswap16; pub const __builtin_bswap32 = @import("std").zig.c_builtins.__builtin_bswap32; pub const __builtin_bswap64 = @import("std").zig.c_builtins.__builtin_bswap64; pub const __builtin_signbit = @import("std").zig.c_builtins.__builtin_signbit; pub ...
modules/platform/src/linux/X11/c.zig
const std = @import("std"); const stdx = @import("stdx"); const v8 = @import("v8"); const log = stdx.log.scoped(.v8x); pub const ExecuteResult = struct { const Self = @This(); alloc: std.mem.Allocator, result: ?[]const u8, err: ?[]const u8, success: bool, pub fn deinit(self: Self) void { ...
runtime/v8x.zig
const builtin = @import("builtin"); const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; const expo2 = @import("expo2.zig").expo2; const maxInt = std.math.maxInt; /// Returns the hyperbolic tangent of x. /// /// Special Cases: /// - sinh(+-0) = +-0 /// - sinh(+-inf) = +-1 /...
lib/std/math/tanh.zig
const std = @import("std"); const Type = @import("type.zig").Type; const log2 = std.math.log2; const assert = std.debug.assert; const BigIntConst = std.math.big.int.Const; const BigIntMutable = std.math.big.int.Mutable; const Target = std.Target; const Allocator = std.mem.Allocator; const Module = @import("Module.zig")...
src/value.zig
const std = @import("std"); const argsParser = @import("zig-args"); const glob = @import("glob"); var allocator: std.mem.Allocator = undefined; pub fn main() !u8 { const stdout = std.io.getStdOut().writer(); var stderr = std.io.bufferedWriter(std.io.getStdErr().writer()); var gpa = std.heap.GeneralPurpos...
src/main.zig
const std = @import("std"); const io = std.io; const mem = std.mem; const fs = std.fs; const process = std.process; const Allocator = mem.Allocator; const ArrayList = std.ArrayList; const Buffer = std.Buffer; const arg = @import("arg.zig"); const self_hosted_main = @import("main.zig"); const Args = arg.Args; const Fla...
src-self-hosted/stage1.zig
const std = @import("std.zig"); const target = std.Target.current; pub const Ordering = std.builtin.AtomicOrder; pub const Stack = @import("atomic/stack.zig").Stack; pub const Queue = @import("atomic/queue.zig").Queue; pub const Atomic = @import("atomic/Atomic.zig").Atomic; test "std.atomic" { _ = @import("atom...
lib/std/atomic.zig
const std = @import("std"); const utils = @import("utils"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const print = utils.print; const eql = std.mem.eql; const isLower = std.ascii.isLower; const Kind = union(enum) { Start, End, Small, Large, }; const Cave = ...
day12/src/main.zig
const io = @import("./io.zig"); const Terminal = @import("tty.zig"); const cpu = @import("./cpu.zig"); // The slave 8259 is connected to the master's IRQ2 line. // This is really only to enhance clarity. pub const SLAVE_INDEX = 2; pub const PIC0_CTL = 0x20; pub const PIC0_CMD = 0x21; pub const PIC1_CTL = 0xA0; pub co...
src/kernel/arch/x86/boot/pic.zig
const std = @import("std"); const upaya = @import("upaya.zig"); usingnamespace upaya.sokol; pub const Texture = extern struct { img: sg_image = undefined, width: i32 = 0, height: i32 = 0, pub const Filter = enum { linear, nearest }; pub fn initOffscreen(width: i32, height: i32, filter: Filter) Te...
src/texture.zig
const std = @import("std"); const vk = @import("../vk.zig"); const c = @import("../c.zig"); const tracy = @import("../tracy.zig"); const vkctxt = @import("../vulkan_wrapper/vulkan_context.zig"); const Allocator = std.mem.Allocator; const Application = @import("../application/application.zig").Application; pub const S...
src/renderer/default_renderer.zig
const std = @import("std"); const bmp = @import("bmp.zig"); const png = @import("png.zig"); const Image = @import("image.zig").Image; const IcoHeader = struct { reserved: u16, image_type: u16, image_count: u16, pub fn read(reader: anytype) !IcoHeader { var ico_header: IcoHeader = undefined; ...
src/image/ico.zig
//-------------------------------------------------------------------------------- // Section: Types (6) //-------------------------------------------------------------------------------- pub const HCN_NOTIFICATIONS = enum(i32) { Invalid = 0, NetworkPreCreate = 1, NetworkCreate = 2, NetworkPreDelete = ...
win32/system/host_compute_network.zig
pub const CLSID_XFeedsManager = Guid.initString("fe6b11c3-c72e-4061-86c6-9d163121f229"); pub const WMPGC_FLAGS_ALLOW_PREROLL = @as(u32, 1); pub const WMPGC_FLAGS_SUPPRESS_DIALOGS = @as(u32, 2); pub const WMPGC_FLAGS_IGNORE_AV_SYNC = @as(u32, 4); pub const WMPGC_FLAGS_DISABLE_PLUGINS = @as(u32, 8); pub const WMPGC_FLAGS...
win32/media/media_player.zig
const std = @import("../std.zig"); const maxInt = std.math.maxInt; const iovec = std.os.iovec; extern "c" threadlocal var errno: c_int; pub fn _errno() *c_int { return &errno; } pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize; pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack...
lib/std/c/dragonfly.zig
const std = @import("std"); const AnalysisContext = @import("document_store.zig").AnalysisContext; const ast = std.zig.ast; const types = @import("types.zig"); /// REALLY BAD CODE, PLEASE DON'T USE THIS!!!!!!! (only for testing) pub fn getFunctionByName(tree: *ast.Tree, name: []const u8) ?*ast.Node.FnProto { var d...
src/analysis.zig
const std = @import("std"); const SYS = @import("./consts.zig").SYS; inline fn syscall0(n: SYS) usize { return asm volatile ("int $0x80" : [ret] "={eax}" (-> usize), : [n] "{eax}" (n), : "memory", "cc" ); } inline fn syscall1(n: SYS, arg1: usize) usize { return asm volatile ("int $...
src/linux/i386/calls.zig
const std = @import("std"); const gl = @import("renderkit").gl; const gk = @import("gamekit"); const math = gk.math; const gfx = gk.gfx; const draw = gfx.draw; const Thing = struct { dir: f32, pos: math.Vec2 = .{}, col: math.Color, }; var white_tex: gfx.Texture = undefined; var pass: gfx.OffscreenPass = u...
examples/stencil.zig
pub const SI_EDIT_PERMS = @as(i32, 0); pub const SI_EDIT_OWNER = @as(i32, 1); pub const SI_CONTAINER = @as(i32, 4); pub const SI_READONLY = @as(i32, 8); pub const SI_RESET = @as(i32, 32); pub const SI_OWNER_READONLY = @as(i32, 64); pub const SI_OWNER_RECURSE = @as(i32, 256); pub const SI_NO_ACL_PROTECT = @as(i32, 512);...
win32/security/authorization/ui.zig
const std = @import("std"); const utils = @import("utils.zig"); pub const Error = error { InvalidUtf8, IncompleteUtf8, } || utils.Error; /// Possibly incomplete decode state to save if we don't have the entire /// sequence at the moment. pub const State = struct { byte_pos: u8 = 0, seqlen: u8 = 0, ...
libs/utils/unicode.zig
const Atom = @This(); const std = @import("std"); const types = @import("types.zig"); const Wasm = @import("../Wasm.zig"); const Symbol = @import("Symbol.zig"); const Dwarf = @import("../Dwarf.zig"); const leb = std.leb; const log = std.log.scoped(.link); const mem = std.mem; const Allocator = mem.Allocator; /// sym...
src/link/Wasm/Atom.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "E1000", .filter = .info, }).write; const num_rx_desc = 32; const num_tx_desc = 8; const rx_block_size = 2048; const Register = extern enum(u16) { ctrl = 0x0000, status = 0x0008, eeprom = 0x0014, ctrl_ex ...
subprojects/flork/src/drivers/net/e1000.zig
const std = @import("std"); const expect = @import("std").testing.expect; const Lexer = @import("lexer/lexer.zig").Lexer; const utils = @import("./utils.zig"); pub const Errors = error{ UNKNOWN_TOKEN, UNIMPLEMENTED, END_OF_FILE, NOT_CLOSED_STR, NOT_CLOSED_CHAR, EXP_STR_AFTER_IMPORT, EXP_ST...
src/log.zig
const std = @import("std"); pub fn getAllPkg(comptime T: type) CalculatePkg(T) { const info: std.builtin.TypeInfo = @typeInfo(T); const declarations: []const std.builtin.TypeInfo.Declaration = info.Struct.decls; var pkgs: CalculatePkg(T) = undefined; var index: usize = 0; inline for (declarations) |...
build.zig
const c = @cImport({ @cInclude("X11/Xlib.h"); @cInclude("GL/glx.h"); }); const std = @import("std"); pub const Screen = c.Screen; pub const _XPrivDisplay = c._XPrivDisplay; pub const XSetWindowAttributes = c.XSetWindowAttributes; pub const XWindowAttributes = c.XWindowAttributes; pub const Window = c.Window; p...
didot-x11/c.zig
const std = @import("std"); const raiseException = @import("cpu.zig").raiseException; /// COP0 register aliases pub const COP0Reg = enum(u32) { Index = 0, Random = 1, EntryLo0 = 2, EntryLo1 = 3, Context = 4, PageMask = 5, Wired = 6, R7 = ...
src/core/cop0.zig
const std = @import("std"); pub const ArrayIterator = @import("array.zig").ArrayIterator; const PathItem = union(enum) { key: []const u8, index: usize, }; /// Represents possible errors in this library. pub const Error = error{ InvalidJSON, InvalidBlock, KeyNotFound, IndexNotFound, Invali...
src/lib.zig