code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day10.txt"); const Input = struct { lines: std.ArrayList([]const u8), pub fn init(input_text: []const u8, allocator: std.mem.Allocator) !@This() { _ = allocator; var input = Input{ .line...
src/day10.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day14.txt"); const Input = struct { template: []const u8 = undefined, rules: std.StringHashMap(u8) = undefined, pub fn init(input_text: []const u8, allocator: std.mem.Allocator) !@This() { _ = allocator...
src/day14.zig
const std = @import("std"); const buildns = std.build; const fs = std.fs; const Builder = buildns.Builder; const Version = buildns.Version; fn deleteOldDll(dllNameExt: []const u8) !void { // delete existing dll if it's there const workingDir = fs.cwd(); var binDir = try workingDir.openDir("zig-cache", .{})...
build.zig
pub const Block = struct { from: u21, to: u21, name: []const u8, }; pub const data = [_]Block{ .{ .from = 0x0000, .to = 0x007F, .name = "Basic Latin" }, .{ .from = 0x0080, .to = 0x00FF, .name = "Latin-1 Supplement" }, .{ .from = 0x0100, .to = 0x017F, .name = "Latin Extended-A" }, .{ .from ...
src/blocks.zig
const std = @import("std"); const hyperia = @import("hyperia.zig"); const mem = std.mem; const meta = std.meta; const builtin = std.builtin; const oneshot = hyperia.oneshot; pub fn ResultUnionOf(comptime Cases: type) type { var union_fields: [@typeInfo(Cases).Struct.fields.len]builtin.TypeInfo.UnionField = undefi...
select.zig
const std = @import("std"); const zua = @import("zua.zig"); const Token = zua.lex.Token; // From lopcodes.h: // // We assume that instructions are unsigned numbers. // All instructions have an opcode in the first 6 bits. // Instructions can have the following fields: // 'A': 8 bits // 'B': 9 bits // 'C': 9 bits // ...
src/opcodes.zig
const std = @import("std"); const net = std.net; const meta = std.meta; const Allocator = std.mem.Allocator; const deflate = std.compress.deflate; const io = std.io; const zlib = @import("zlib"); const c = @cImport({ @cInclude("zlib.h"); @cInclude("stddef.h"); }); const mcp = @import("mcproto.zig"); pub cons...
src/mcnet.zig
const Coff = @This(); const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const coff = std.coff; const fs = std.fs; const log = std.log.scoped(.coff); const mem = std.mem; const Allocator = mem.Allocator; const Object = @import("Coff/Object.zig"); const Zld = @import("Zld....
src/Coff.zig
const std = @import("std"); const mem = std.mem; const Allocator = std.mem.Allocator; const Value = @import("value.zig").Value; const Type = @import("type.zig").Type; const assert = std.debug.assert; const text = @import("ir/text.zig"); const BigInt = std.math.big.Int; const Target = std.Target; /// These are in-memor...
src-self-hosted/ir.zig
const std = @import("std"); const Builder = std.build.Builder; const Pkg = std.build.Pkg; const Step = std.build.Step; const debug = std.debug; const Allocator = std.mem.Allocator; const CrossTarget = std.zig.CrossTarget; const ClumsyArch = enum { x86, x64 }; const ClumsyConf = enum { Debug, Release, Ship }; const Clu...
build.zig
const std = @import("std"); const Ip4Packet = @This(); pub const Flags = enum(u3) { dont_fragment = 0b010, more_fragments = 0b001, _, }; pub const Protocol = enum(u8) { ipv6_hop_by_hop = 0, icmpv4 = 1, igmp = 2, ipv4 = 4, tcp = 6, udp = 17, rudp = 27, ipv6 = 41, ipv6_r...
src/Ip4Packet.zig
// Copyright (c) 2015 <NAME> // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distrib...
src/fileformats/glue.zig
const std = @import("std"); const openssl = @cImport({ @cInclude("openssl/crypto.h"); @cInclude("openssl/obj_mac.h"); @cInclude("openssl/ec.h"); @cInclude("openssl/err.h"); @cInclude("openssl/evp.h"); }); const crypto = std.crypto; const builtin = std.builtin; const aes = crypto.core.aes; const hmac...
src/main.zig
// SPDX-License-Identifier: MIT // This file is part of the `termcon` project under the MIT license. //! Ziro is a super-simple terminal text editor written in Zig. //! Ziro is inspired by [kilo](https://github.com/antirez/kilo), //! and is intended to provide an example of using the `termcon` //! library. const std...
examples/ziro.zig
const std = @import("std"); const builtin = @import("builtin"); extern fn git_mbedtls__set_cert_location(path: ?[*:0]const u8, file: ?[*:0]const u8) c_int; extern fn git_mbedtls__set_cert_buf(buf: [*]const u8, len: usize) c_int; /// based off of golang's system cert finding code: https://golang.org/src/crypto/x509/ p...
src/certs.zig
const std = @import("../std.zig"); /// This allocator is used in front of another allocator and counts the numbers of allocs and frees. /// The test runner asserts every alloc has a corresponding free at the end of each test. /// /// The detection algorithm is incredibly primitive and only accounts for number of calls...
lib/std/testing/leak_count_allocator.zig
const std = @import("std"); test "example" { const data = @embedFile("4_example.txt"); const result = try run(data); try std.testing.expectEqual(@as(u32, 4512), result); } pub fn main() !void { const data = @embedFile("4.txt"); const result = try run(data); std.debug.print("{}\n", .{result}); ...
shritesh+zig/4a.zig
// These are the addresses where some GPIO control registers are mapped to. They // are marked as `volatile` to let the compiler know that accessing these // addresses has side effects (and therefore these accesses will not be // reordered or optimized away -- a property I'll explicitly make use of below). const GPFSE...
src/main.zig
const std = @import("std"); const utils = @import("utils.zig"); const vector = @import("vector.zig"); const Vec4 = vector.Vec4; const initPoint = vector.initPoint; const initVector = vector.initVector; const Mat4 = @import("matrix.zig").Mat4; const Color = @import("color.zig").Color; const Shape = @import("shape.zi...
pattern.zig
const std = @import("std"); const builtin = @import("builtin"); const log = std.log.scoped(.@"brucelib.platform.win32"); const common = @import("common.zig"); const InitFn = common.InitFn; const DeinitFn = common.DeinitFn; const FrameFn = common.FrameFn; const AudioPlaybackFn = common.AudioPlaybackFn; const FrameInpu...
modules/platform/src/win32.zig
const std = @import("std"); const mem = std.mem; const assert = std.debug.assert; const AesBlock = std.crypto.core.aes.Block; const State128L = struct { blocks: [8]AesBlock, fn init(key: [16]u8, nonce: [16]u8) State128L { const c1 = AesBlock.fromBytes(&[16]u8{ 0xdb, 0x3d, 0x18, 0x55, 0x6d, 0xc2, 0x2f...
lib/std/crypto/aegis.zig
const Allocator = std.mem.Allocator; const File = std.fs.File; 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 = @...
src/formats/tga.zig
const std = @import("std"); const utils = @import("utils"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const print = utils.print; const Cell = struct { number: i32, marked: bool }; const Bingo = struct { drawn_numbers: []i32, board_count: usize, board_lines: [][]...
day4/src/main.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const Token = @import("lex.zig").Token; pub const Tree = struct { node: *Node, /// not owned by the tree source: []const u8, arena: std.heap.ArenaAllocator.State, allocator: Allocator, pub fn deinit(self: *Tree) void { ...
src/ast.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const assert = std.debug.assert; const Compilation = @import("Compilation.zig"); const Source = @import("Source.zig"); const Tokenizer = @import("Tokenizer.zig"); const Preprocessor = @import("Preprocessor.zig"); const Tree = @import("Tre...
src/Parser.zig
const assert = @import("std").debug.assert; const mem = @import("std").mem; test "enum type" { const foo1 = Foo{ .One = 13}; const foo2 = Foo{. Two = Point { .x = 1234, .y = 5678, }}; const bar = Bar.B; assert(bar == Bar.B); assert(@memberCount(Foo) == 3); assert(@memberCount(Bar) == 4); a...
test/cases/enum.zig
const std = @import("std"); const mem = std.mem; usingnamespace @import("headers.zig"); usingnamespace @import("request.zig"); usingnamespace @import("common.zig"); usingnamespace @import("zuri"); const Context = @import("../server.zig").Server.Context; const t = std.testing; pub fn parse(req: *Request, ctx: *Context)...
src/routez/http/parser.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 Carac = struct { name: []const u8, speed: u32, duration: u32, rest: u32, }; fn parse_line(line: []con...
2015/day14.zig
const std = @import("std"); const common = @import("common.zig"); const rom = @import("rom.zig"); pub const offsets = @import("gen5/offsets.zig"); pub const script = @import("gen5/script.zig"); const debug = std.debug; const fmt = std.fmt; const io = std.io; const math = std.math; const mem = std.mem; const testing ...
src/core/gen5.zig
const std = @import("std"); const fmt = std.fmt; const math = std.math; // The test input uses 12-bit numbers. const Number = u12; // The test input has 1000 lines. We can count up to that in `u16`. const Count = u16; pub fn run(input: anytype, output: anytype) !void { // Build a binary max heap where a left br...
src/zig/2021_03.zig
const std = @import("std"); const daemon = @import("daemon.zig"); const util = @import("util.zig"); const DaemonState = daemon.DaemonState; const ServiceDecl = daemon.ServiceDecl; const Service = daemon.Service; const ServiceStateType = daemon.ServiceStateType; const ServiceLogger = @import("service_logger.zig").Serv...
src/supervisor.zig
const std = @import("std"); const builtin = @import("builtin"); const Allocator = std.mem.Allocator; pub const DisplayInfo = struct { unix: bool, host: []const u8, display: u6, screen: u8, pub fn init(allocator: *Allocator, host_override: ?[]const u8, display_override: ?u6, screen_override: ?u8) !...
didot-zwl/zwl/src/x11/display_info.zig
const std = @import("std"); const warn = std.debug.print; const Allocator = std.mem.Allocator; const util = @import("./util.zig"); const filter_lib = @import("./filter.zig"); const toot_lib = @import("./toot.zig"); const toot_list = @import("./toot_list.zig"); var allocator: *Allocator = undefined; const c = @cImport(...
src/config.zig
const std = @import("std"); const builtin = @import("builtin"); const zee_alloc = @import("zee_alloc"); const Fundude = @import("main.zig"); const util = @import("util.zig"); const CYCLES_PER_MS = Fundude.MHz / 1000; pub const is_profiling = false; const allocator = if (builtin.link_libc) std.heap.c_allocator e...
src/exports.zig
pub const OBJ_HANDLE_TAGBITS = @as(i32, 3); pub const RTL_BALANCED_NODE_RESERVED_PARENT_MASK = @as(u32, 3); pub const OBJ_INHERIT = @as(i32, 2); pub const OBJ_PERMANENT = @as(i32, 16); pub const OBJ_EXCLUSIVE = @as(i32, 32); pub const OBJ_CASE_INSENSITIVE = @as(i32, 64); pub const OBJ_OPENIF = @as(i32, 128); pub const ...
deps/zigwin32/win32/system/kernel.zig
const std = @import("std"); const hash_map = std.hash_map; const math = std.math; const testing = std.testing; const Allocator = std.mem.Allocator; pub const GraphError = error{ VertexNotFoundError, }; /// A directed graph that contains nodes of a given type. /// /// The Context is the same as the Context for std...
lib/src/data/graph.zig
const std = @import("std"); const mem = std.mem; const OtherGraphemeExtend = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 2494, hi: u21 = 917631, pub fn init(allocator: *mem.Allocator) !OtherGraphemeExtend { var instance = OtherGraphemeExtend{ .allocator = allocator, .array = try...
src/components/autogen/PropList/OtherGraphemeExtend.zig
const std = @import("std"); const mem = std.mem; const MathSymbol = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 43, hi: u21 = 126705, pub fn init(allocator: *mem.Allocator) !MathSymbol { var instance = MathSymbol{ .allocator = allocator, .array = try allocator.alloc(bool, 126663...
src/components/autogen/DerivedGeneralCategory/MathSymbol.zig
const std = @import("std"); const rg = @import("../render_graph.zig"); const shader_util = @import("../../../shaders/shader_util.zig"); const vk = @import("../../../vk.zig"); const vkctxt = @import("../../../vulkan_wrapper/vulkan_context.zig"); const RGPass = @import("../render_graph_pass.zig").RGPass; const Swapchai...
src/renderer/render_graph/passes/screen_render_pass.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const c = @import("c.zig"); const odbc = @import("types.zig"); /// Errors that can be returned from Odbc functions, as indicated by the /// SQLRETURN value. pub const ReturnError = error{Error, NoData, InvalidHandle, StillExecuting}; fn StringEnum(compt...
src/error.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const RunFn = fn (input: []const u8, allocator: std.mem.Allocator) tools.RunError![2][]const u8; // it.runFn = @import(name); -> marche pas. doit être un string litteral const alldays = [_]struct { runFn: RunFn, input: []co...
2020/alldays.zig
const std = @import("std"); const app = @import("app"); pub const Measurement = struct { median: u64, mean: u64, min: u64, max: u64, fn compute(all_samples: []Sample, comptime field: []const u8) Measurement { const S = struct { fn order(a: Sample, b: Sample) bool { ...
bench.zig
const std = @import("std"); pub const zgt = @import("zgt"); pub usingnamespace zgt; pub fn ZervoView() zgt.Canvas_Impl { var canvas = zgt.Canvas(.{}); return canvas; } pub const FontMetrics = struct { ascent: f64, descent: f64, height: f64 }; pub const TextMetrics = struct { width: f64, h...
src/zgt.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day23.txt"); const Input = struct { stack1: [2]u8, stack2: [2]u8, stack3: [2]u8, stack4: [2]u8, pub fn init(input_text: []const u8, allocator: std.mem.Allocator) !@This() { _ = allocator; ...
src/day23.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const Instruction = [3][]const u8; const Computer = struct { const Registers = std.StringHashMap(usize); const Instructions = std.StringHashMap(fn(*Computer, Instruction)std.fmt.ParseIntError!isize); registers: Registers, instructions: In...
src/main/zig/2015/day23.zig
const std = @import("std"); const c = @import("internal/c.zig"); const internal = @import("internal/internal.zig"); const log = std.log.scoped(.git); const git = @import("git.zig"); pub const Repository = opaque { pub fn deinit(self: *Repository) void { log.debug("Repository.deinit called", .{}); ...
src/repository.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const Vec2 = tools.Vec2; pub fn run(input_text: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { var arena = std.heap.ArenaAllocator.init(allocator); defer arena.deinit(); const Food = struct { ing: []c...
2020/day21.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const mat = @import("zalgebra"); const mat4 = mat.mat4; const vec = mat.vec3; const model = @import("model.zig"); usingnamespace @import("utils.zig"); const base = @import("main.zig"); const roundUp = base.roundUp; const getKey = base.getKey; const log ...
src/app.zig
const col = struct { usingnamespace @import("./colors.zig"); }; const color = @import("colors.zig"); const Spec = color.Spec; const Brightness = color.Spec.Brightness; const Location = color.Spec.Location; const Color = color.Color; const code = @import("./code.zig"); const std = @import("std"); const fmt = std.fmt...
src/term/style.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const expect = std.testing.expect; const expectError = std.testing.expectError; const bu = @import("./bits.zig"); // bits utilities const hm = @import("./huffman.zig"); test "huffman_decode_basic" { const lens = [_]u8{ 3,...
src/huffman_test.zig
const std = @import("std"); const Builder = std.build.Builder; pub fn build(b: *Builder) void { const build_mode = b.standardReleaseOptions(); const target = b.standardTargetOptions(.{}); var exe = b.addExecutable("buzz", "src/main.zig"); exe.setTarget(target); exe.install(); exe.setBuildMode(...
build.zig
const std = @import("std"); const is_windows = @import("builtin").os.tag == .windows; pub const Color = enum { reset, red, green, blue, cyan, purple, yellow, white, }; pub fn setColor(color: Color, w: anytype) void { if (is_windows) { const stderr_file = std.io.getStdErr();...
src/util.zig
const std = @import("std"); 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 MouseMoveEvent = platform....
ui/src/widgets/slider.zig
const expect = @import("std").testing.expect; const builtin = @import("builtin"); var foo: u8 align(4) = 100; test "global variable alignment" { expect(@typeOf(&foo).alignment == 4); expect(@typeOf(&foo) == *align(4) u8); const slice = (*[1]u8)(&foo)[0..]; expect(@typeOf(slice) == []align(4) u8); } f...
test/stage1/behavior/align.zig
const std = @import("../index.zig"); const builtin = @import("builtin"); const Endian = builtin.Endian; const readIntSliceLittle = std.mem.readIntSliceLittle; const writeIntSliceLittle = std.mem.writeIntSliceLittle; pub const Poly1305 = struct { const Self = @This(); pub const mac_length = 16; pub const...
std/crypto/poly1305.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const debug = @import("./debug.zig"); const Chunk = @import("./chunk.zig").Chunk; const OpCode = @import("./chunk.zig").OpCode; const Value = @import("./value.zig").Value; const debug_trace_execution = true; const debug_stack_execution = false; cons...
src/vm.zig
mod: *Module, /// Alias to `mod.gpa`. gpa: *Allocator, /// Points to the arena allocator of the Decl. arena: *Allocator, code: Zir, /// Maps ZIR to AIR. inst_map: InstMap = .{}, /// When analyzing an inline function call, owner_decl is the Decl of the caller /// and `src_decl` of `Scope.Block` is the `Decl` of the cal...
src/Sema.zig
const uefi = @import("std").os.uefi; const Event = uefi.Event; const Guid = uefi.Guid; const Status = uefi.Status; pub const SimpleNetworkProtocol = extern struct { revision: u64, _start: fn (*const SimpleNetworkProtocol) callconv(.C) Status, _stop: fn (*const SimpleNetworkProtocol) callconv(.C) Status, ...
lib/std/os/uefi/protocols/simple_network_protocol.zig
const std = @import("std"); const Builder = std.build.Builder; pub fn createPackage(comptime root: []const u8) std.build.Pkg { return std.build.Pkg{ .name = "zzz", .path = root ++ "/src/main.zig", .dependencies = &[_]std.build.Pkg{}, }; } const pkgs = struct { const zzz = std.build...
build.zig
const std = @import("std"); const math = std.math; const expect = std.testing.expect; pub fn __roundh(x: f16) callconv(.C) f16 { // TODO: more efficient implementation return @floatCast(f16, roundf(x)); } pub fn roundf(x_: f32) callconv(.C) f32 { const f32_toint = 1.0 / math.floatEps(f32); var x = x...
lib/std/special/compiler_rt/round.zig
const builtin = @import("builtin"); const std = @import("std"); const testing = std.testing; const expect = testing.expect; test "tuple concatenation" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO c...
test/behavior/tuple.zig
const std = @import("std"); const a5 = @cImport({ @cInclude("allegro5/allegro.h"); @cInclude("allegro5/allegro_font.h"); @cInclude("allegro5/allegro_image.h"); @cInclude("allegro5/allegro_color.h"); @cInclude("shim.h"); }); // Soon these shims can go away... fn al_color_name(name: []const u8) a5.AL...
src/main.zig
const std = @import("std"); const prompt = @import("./prompt.zig"); const rng = @import("../main.zig").rng; const State = @import("../main.zig").State; const CommandLineOptions = @import("../args.zig").CommandLineOptions; fn doComputerTurn(state: *State) void { const current = state.getCurrentPlayer(); state....
src/cli/ui.zig
/// The function fiatP224AddcarryxU32 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^32 /// out2 = ⌊(arg1 + arg2 + arg3) / 2^32⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffff] /// arg3: [0x0 ~> 0xffffffff] /// Output Bounds: /// out1: [0x0 ...
fiat-zig/src/p224_32.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/day16.txt", run); const BitStream = struct { h...
2021/day16.zig
pub usingnamespace @import("std").c.builtins; pub const __m64 = @import("std").meta.Vector(1, c_longlong); pub const __v1di = @import("std").meta.Vector(1, c_longlong); pub const __v2si = @import("std").meta.Vector(2, c_int); pub const __v4hi = @import("std").meta.Vector(4, c_short); pub const __v8qi = @import("st...
hmm.zig
const std = @import("../../std.zig"); const builtin = @import("builtin"); const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; /// Returns the arc-tangent of z. pub fn atan(z: var) @typeOf(z) { const T = @typeOf(z.re); return switch (T) { f32 =...
lib/std/math/complex/atan.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 stdout = std.io.getStdOut().writer(); const stderr = std.io.getStdErr().writer(); const stdin = std.io.getStdIn(); const Options = @import("Options.zig"); const Choices = @import("Choices.zig"); const Tty = @import("Tty.zig"); const TtyInterface = @...
src/main.zig
const Self = @This(); const build_options = @import("build_options"); const std = @import("std"); const mem = std.mem; const wlr = @import("wlroots"); const wl = @import("wayland").server.wl; const c = @import("c.zig"); const util = @import("util.zig"); const Config = @import("Config.zig"); const Control = @import(...
source/river-0.1.0/river/Server.zig
const std = @import("std"); const fmt = std.fmt; const mem = std.mem; const assert = std.debug.assert; const io_uring_cqe = std.os.linux.io_uring_cqe; /// Callback encapsulates a context and a function pointer that will be called when /// the server loop will process the CQEs. /// Pointers to this structure is what ...
src/callback.zig
const std = @import("std"); const leb = std.leb; pub const Opcode = enum(u8) { @"unreachable" = 0x0, nop = 0x01, block = 0x02, loop = 0x03, @"if" = 0x04, @"else" = 0x05, end = 0x0b, br = 0x0c, br_if = 0x0d, br_table = 0x0e, @"return" = 0x0f, call = 0x10, call_indirec...
src/opcode.zig
const VTE = @import("vte"); const c = VTE.c; const gtk = VTE.gtk; const vte = VTE.vte; const std = @import("std"); const config = @import("config.zig"); const keys = @import("keys.zig"); const menus = @import("menus.zig"); const prefs = @import("prefs.zig"); const version = @import("version.zig").version; const Keys = ...
src/gui.zig
const std = @import("std"); const olin = @import("./olin/olin.zig"); pub const os = olin; pub const panic = os.panic; const log = @import("./olin/log.zig"); const stdout = @import("./olin/resource.zig").Resource.stdout; // Dark -> Light color map const colorMap = " ,:!=+%#$"; // Hardcoded terminal size const fbWidth ...
zig/src/triangle.zig
const std = @import("std"); const stdx = @import("stdx"); const uv = @import("uv"); const builtin = @import("builtin"); const log = stdx.log.scoped(.uv_poller); const mac_sys = @import("mac_sys.zig"); const runtime = @import("runtime.zig"); /// A dedicated thread is used to poll libuv's backend fd. pub const UvPoller...
runtime/uv_poller.zig
const std = @import("std"); const math = std.math; const stdx = @import("stdx"); const t = stdx.testing; const Vec2 = stdx.math.Vec2; const vec2 = Vec2.init; const graphics = @import("../../graphics.zig"); const QuadBez = graphics.curve.QuadBez; const SubQuadBez = graphics.curve.SubQuadBez; const CubicBez = graphics.cu...
graphics/src/backend/gpu/stroke.zig
const std = @import("std"); const zig = std.zig.Ast; const mem = std.mem; const meta = std.meta; const Allocator = std.mem.Allocator; const Token = @import("./Token.zig"); pub const Op = @import("./token/op.zig").Op; pub const Kwd = @import("./token/kw.zig").Kwd; pub const Symbol = @import("./token/sym.zig"); pub const...
lib/idla/src/Ast.zig
const opt = @import("opt.zig"); const warn = std.debug.warn; const std = @import("std"); const stdout = &std.io.getStdOut().writer(); const BUFSIZ: u16 = 4096; pub fn cat(file: std.fs.File) !void { // print file from start pos var in_stream = std.fs.File.reader(file); print_stream(&in_stream) catch |err| ...
src/cat.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day04.txt"); //...
src/day04.zig
const std = @import("std"); const nvg = @import("nanovg"); const gui = @import("../gui.zig"); const Rect = @import("../geometry.zig").Rect; pub fn Spinner(comptime T: type) type { comptime if (T != i32 and T != f32) @compileError("Spinner needs to be i32 or f32"); const StepMode = enum(u1) { linear, ...
src/gui/widgets/Spinner.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const windows = std.os.windows; const Buffer = @import("../buffer.zig").Buffer; const AudioMode = @import("../index.zig").AudioMode; const winnm = @import("winnm.zig"); const Header = struct { const Self = @This(); pub const Error = error { ...
src/windows/index.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const expectEqual = std.testing.expectEqual; const expectEqualSlices = std.testing.expectEqualSlices; const fixedBufferStream = std.io.fixedBufferStream; const ChemicalQuantity = struct { chem: []const u8, quant: ...
zig/14.zig
const CTRL_SECURITY_ERROR_RESPONSE: u32 = 1 << 4; const CTRL_AUTOINCREMENT: u32 = 1 << 8; /// The device driver for the TrustZone Memory Protection Controller. /// /// It is documented in the ARM CoreLink SIE-200 System IP for Embedded TRM /// (DDI 0571G): /// <https://developer.arm.com/products/architecture/m-profile...
src/drivers/tz_mpc.zig
const std = @import("std"); const assert = std.debug.assert; //===========================================================================// /// Newly allocated memory will be memset to this value in debug mode, to help /// users catch bugs where they use uninitialized memory. pub const allocated_byte_memset: u8 = 0x...
src/ziegfried/params.zig
const Subsurface = @This(); const std = @import("std"); const assert = std.debug.assert; const wlr = @import("wlroots"); const wl = @import("wayland").server.wl; const server = &@import("main.zig").server; const util = @import("util.zig"); const DragIcon = @import("DragIcon.zig"); const LayerSurface = @import("Laye...
source/river-0.1.0/river/Subsurface.zig
const std = @import("std"); const testing = std.testing; const queen_attack = @import("queen_attack.zig"); const QueenError = queen_attack.QueenError; test "queen with a valid position" { const queen = try queen_attack.Queen.init(2, 2); try testing.expectEqual( @as(queen_attack.Queen, .{.x = 2, .y = 2...
exercises/practice/queen-attack/test_queen_attack.zig
const std = @import("std"); const log = @import("log.zig"); const api = @import("api.zig"); const ModSpec = struct { name: []const u8, version: std.SemanticVersion, }; pub const Mod = struct { pub const THudComponent = struct { _cbk: fn (slot: u8, fmt: [*:0]const u8, buf: [*]u8, size: usize) callc...
src/mods.zig
pub const c = @import("c.zig"); pub const World = c.CbtWorldHandle; pub const Shape = c.CbtShapeHandle; pub const Body = c.CbtBodyHandle; pub const Vector3 = c.CbtVector3; pub const RayCastResult = c.CbtRayCastResult; pub const Constraint = c.CbtConstraintHandle; pub const worldCreate = c.cbtWorldCreate; pub const worl...
src/deps/bullet/bullet.zig
const std = @import("std"); const assert = std.debug.assert; pub const Bool32 = i32; pub const CString = [*:0]const u8; pub const MutCString = [*:0]u8; pub const FileType = enum(c_int) { invalid, gltf, glb, }; pub const Result = enum(c_int) { success, data_too_short, unknown_format, inval...
modules/graphics/vendored/zmesh/src/zcgltf.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const Part1 = struct { vowels: u8 = 0, last: u8 = 0, has_double: bool = false, dead: bool = false, fn feed(self: *Part1, c: u8) void { if (self.dead) { return; } switch (c) { 'a', 'e', 'i...
src/main/zig/2015/day05.zig
const std = @import("std"); const math = std.math; // Struct Declarations pub const Color = struct { r: f32 = 0.0, g: f32 = 0.0, b: f32 = 0.0, a: f32 = 0.0, pub inline fn c(r: f32, g: f32, b: f32, a: f32) Color { return Color{ .r = r, .g = g, .b = b, .a = a }; } }; pub const Vec2 = st...
src/vector_math.zig
//-------------------------------------------------------------------------------- // Section: Types (1) //-------------------------------------------------------------------------------- const IID_IGraphicsCaptureItemInterop_Value = Guid.initString("3628e81b-3cac-4c60-b7f4-23ce0e0c3356"); pub const IID_IGraphicsCaptu...
win32/system/win_rt/graphics/capture.zig
const std = @import("std"); pub const Value = union(enum) { String: []const u8, Integer: usize, List: []Value, Dictionary: []std.StringArrayHashMap(Value).Entry, }; fn peek(r: anytype) ?u8 { const c = r.context; if (c.pos == c.buffer.len) { return null; } return c.buffer[c.pos]...
src/lib.zig
const std = @import("std"); //-------------------------------------------------------------------------------------------------- const Vec2 = struct { x: u16, y: u16, pub fn init(x: u16, y: u16) Vec2 { return Vec2{ .x = x, .y = y }; } }; //-----------------------------------------------------...
src/day13.zig
const std = @import("std"); const warn = std.debug.warn; const c = @cImport({ @cInclude("GL/gl3w.h"); @cInclude("GLFW/glfw3.h"); }); usingnamespace @import("shader"); pub fn main() !u8 { if (c.glfwInit() == 0) { warn("failed to initialize c.glfw\n", .{}); return 255; } c.glfwWind...
02/src/main.zig
const std = @import("std"); const fmod = @import("fmod.zig"); const testing = std.testing; fn test_fmodq(a: f128, b: f128, exp: f128) !void { const res = fmod.fmodq(a, b); try testing.expect(exp == res); } fn test_fmodq_nans() !void { try testing.expect(std.math.isNan(fmod.fmodq(1.0, std.math.nan(f128))))...
lib/compiler_rt/fmodq_test.zig
const Zld = @This(); const std = @import("std"); const assert = std.debug.assert; const leb = std.leb; const mem = std.mem; const meta = std.meta; const fs = std.fs; const macho = std.macho; const math = std.math; const log = std.log.scoped(.zld); const aarch64 = @import("../../codegen/aarch64.zig"); const reloc = @im...
src/link/MachO/Zld.zig
const builtin = @import("builtin"); const testing = @import("std").testing; const udivmod = @import("udivmod.zig").udivmod; pub fn __divmoddi4(a: i64, b: i64, rem: *i64) callconv(.C) i64 { @setRuntimeSafety(builtin.is_test); const d = __divdi3(a, b); rem.* = a -% (d *% b); return d; } pub fn __udivm...
lib/std/special/compiler_rt/int.zig
const std = @import("std"); const builtin = std.builtin; const Log2Int = std.math.Log2Int; fn Dwords(comptime T: type, comptime signed_half: bool) type { return extern union { pub const HalfTU = std.meta.IntType(false, @divExact(T.bit_count, 2)); pub const HalfTS = std.meta.IntType(true, @divExact(...
lib/std/special/compiler_rt/shift.zig
const std = @import("../../../std.zig"); const linux = std.os.linux; const socklen_t = linux.socklen_t; const iovec = linux.iovec; const iovec_const = linux.iovec_const; const uid_t = linux.uid_t; const gid_t = linux.gid_t; pub const SYS_Linux = 4000; pub const SYS_syscall = (SYS_Linux + 0); pub const SYS_exit = (SYS_...
lib/std/os/bits/linux/mipsel.zig