code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const Builder = std.build.Builder; const builtin = @import("builtin"); const CrossTarget = std.zig.CrossTarget; pub fn build(b: *Builder) !void { const target = CrossTarget{ .cpu_arch = .aarch64, .os_tag = .freestanding, .cpu_model = .{ .explicit = &std.Target.aa...
build.zig
const Wasm = @This(); const std = @import("std"); const mem = std.mem; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const fs = std.fs; const leb = std.leb; const log = std.log.scoped(.link); const wasm = std.wasm; const Module = @import("../Module.zig"); const Compilation = @import("../Compil...
src/link/Wasm.zig
const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const mem = std.mem; const meta = std.meta; /// Describes how pointer types should be hashed. pub const HashStrategy = enum { /// Do not follow pointers, only hash their value. Shallow, /// Follow pointers, ha...
lib/std/hash/auto_hash.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqualSlices = std.testing.expectEqualSlices; const expectEqual = std.testing.expectEqual; const mem = std.mem; const x = @intToPtr([*]i32, 0x1000)[0..0x500]; const y = x[0x100..]; test "compile time slice of pointer to hard coded address" { ...
test/behavior/slice.zig
const std = @import("std"); const unicode = std.unicode; bytes: []const u8, current: ?u21, i: usize, prev: ?u21, prev_i: usize, const Self = @This(); pub fn init(str: []const u8) !Self { if (!unicode.utf8ValidateSlice(str)) { return error.InvalidUtf8; } return Self{ .bytes = str, ...
src/zigstr/CodePointIterator.zig
const std = @import("std"); usingnamespace @import("imgui.zig"); pub const icons = @import("font_awesome.zig"); extern fn _ogImage(user_texture_id: ImTextureID, size: *const ImVec2, uv0: *const ImVec2, uv1: *const ImVec2) void; extern fn _ogImageButton(user_texture_id: ImTextureID, size: *const ImVec2, uv0: *const ImV...
src/deps/imgui/wrapper.zig
const std = @import("std"); const root = @import("root"); const req = @import("request.zig"); const resp = @import("response.zig"); const net = std.net; const atomic = std.atomic; const log = std.log.scoped(.apple_pie); const Response = resp.Response; const Request = req.Request; const Allocator = std.mem.Allocator; co...
src/server.zig
pub fn isWhiteSpace(cp: u21) bool { if (cp < 0x9 or cp > 0x3000) return false; return switch (cp) { 0x9...0xd => true, 0x20 => true, 0x85 => true, 0xa0 => true, 0x1680 => true, 0x2000...0x200a => true, 0x2028 => true, 0x2029 => true, 0x202...
src/components/autogen/PropList.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); } fn is_nice1(s: []const u8) bool { const voyelles = "aeiou"; var nbvoy: u32 = 0; var hasdouble = false; var h...
2015/day5.zig
const ImageReader = zigimg.ImageReader; const ImageSeekStream = zigimg.ImageSeekStream; const PixelFormat = zigimg.PixelFormat; const assert = std.debug.assert; const color = zigimg.color; const errors = zigimg.errors; const png = zigimg.png; const std = @import("std"); const testing = std.testing; const zigimg = @impo...
tests/formats/png_odd_sizes_test.zig
const std = @import("std"); const assert = std.debug.assert; comptime { assert(@alignOf(i8) == 1); assert(@alignOf(u8) == 1); assert(@alignOf(i16) == 2); assert(@alignOf(u16) == 2); assert(@alignOf(i32) == 4); assert(@alignOf(u32) == 4); // assert(@alignOf(i64) == 8); // assert(@alignOf...
lib/std/os/wasi.zig
const __floatundidf = @import("floatundidf.zig").__floatundidf; const testing = @import("std").testing; fn test__floatundidf(a: u64, expected: f64) void { const r = __floatundidf(a); testing.expect(r == expected); } test "floatundidf" { test__floatundidf(0, 0.0); test__floatundidf(1, 1.0); test__f...
lib/std/special/compiler_rt/floatundidf_test.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const ArrayListUnmanaged = std.ArrayListUnmanaged; const assert = std.debug.assert; const expect = std.testing.expect; fn FindResultType(comptime Node: type) type { return struct { parent: ?*const Node, ...
source/prefix_tree_map.zig
const std = @import("std"); const mem = std.mem; const maxInt = std.math.maxInt; const Error = std.crypto.Error; // RFC 2898 Section 5.2 // // FromSpec: // // PBKDF2 applies a pseudorandom function (see Appendix B.1 for an // example) to derive keys. The length of the derived key is essentially // unbounded. (However...
lib/std/crypto/pbkdf2.zig
const std = @import("std"); const lpc = @import("lpc1768"); const F_CPU = 100_000_000; comptime { // Provides the initialization routines _ = @import("boot.zig"); } const LED1 = GPIO(1, 18); const LED2 = GPIO(1, 20); const LED3 = GPIO(1, 21); const LED4 = GPIO(1, 23); const SD_SELECT = GPIO(0, 16); // DIP14 ...
research-chamber/src/main.zig
const std = @import("std"); const bitjuggle = @import("bitjuggle"); 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 Sa...
lib/cpu.zig
const std = @import("std"); const clap = @import("clap"); pub fn main() anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer std.debug.assert(gpa.deinit() == false); const allocator = gpa.allocator(); const params = comptime [_]clap.Param(clap.Help){ clap.parseParam("-h, --...
src/main.zig
const std = @import("std"); const util = @import("util"); const input = @embedFile("4.txt"); pub fn main(n: util.Utils) !void { var num_complete: usize = 0; var num_valid: usize = 0; var batches = std.mem.split(input, "\n\n"); while (batches.next()) |batch| { const document = Document.parse(ba...
2020/4.zig
const std = @import("std"); const math = std.math; const testing = std.testing; const Allocator = std.mem.Allocator; /// A list of strongly connected components. /// /// This is effectively [][]u64 for a DirectedGraph. The u64 value is the /// hash code, NOT the type T. You should use the lookup function to get the //...
src/tarjan.zig
const std = @import("std"); const log = std.log; const testing = std.testing; pub const Token = struct { id: Id, loc: Loc, pub const Loc = struct { start: usize, end: usize, }; pub const keywords = std.ComptimeStringMap(Id, .{ .{ "enum", .keyword_enum }, .{ "messag...
src/tokenizer.zig
const std = @import("std"); const assert = std.debug.assert; const wren = @import("./wren.zig"); const Vm = @import("./vm.zig").Vm; const Configuration = @import("./vm.zig").Configuration; const ErrorType = @import("./vm.zig").ErrorType; const WrenError = @import("./error.zig").WrenError; const call = @import("./call...
src/zapata/function_handle.zig
const std = @import("std"); const CPU = @import("CPU.zig"); const PIO = @import("PIO.zig"); const CTC = @import("CTC.zig"); const Memory = @import("Memory.zig"); const Clock = @import("Clock.zig"); const Beeper = @import("Beeper.zig"); const KeyBuffer = @import("KeyBuffer.zig"); const KC85 = @This(); cpu: CPU, ctc: ...
src/emu/KC85.zig
pub fn isPrepend(cp: u21) bool { if (cp < 0x600 or cp > 0x11d46) return false; return switch (cp) { 0x600...0x605 => true, 0x6dd => true, 0x70f => true, 0x890...0x891 => true, 0x8e2 => true, 0xd4e => true, 0x110bd => true, 0x110cd => true, ...
.gyro/ziglyph-jecolon-github.com-c37d93b6/pkg/src/autogen/grapheme_break_property.zig
const std = @import("std"); const stdx = @import("../stdx.zig"); const t = stdx.testing; const log = stdx.log.scoped(.rb_tree); const Color = enum(u1) { Black, Red, }; /// Based on Zig's rb node pointer based implementation: /// https://github.com/ziglang/std-lib-orphanage/blob/master/std/rb.zig /// Deletion...
stdx/ds/rb_tree.zig
const kernel = @import("kernel.zig"); const PhysicalAddress = @This(); const Virtual = kernel.Virtual; const Physical = kernel.Physical; value: u64, pub var max: u64 = 0; pub var max_bit: u6 = 0; pub inline fn new(value: u64) PhysicalAddress { const physical_address = PhysicalAddress{ .value = value, ...
src/kernel/physical_address.zig
const std = @import("std"); const DW = std.dwarf; const assert = std.debug.assert; const testing = std.testing; // TODO: this is only tagged to facilitate the monstrosity. // Once packed structs work make it packed. pub const Instruction = union(enum) { R: packed struct { opcode: u7, rd: u5, ...
src/codegen/riscv64.zig
const std = @import("std"); const gpa = std.heap.c_allocator; const fs = std.fs; const zig = std.zig; const known_folders = @import("known-folders"); const u = @import("./util/index.zig"); // // pub fn execute(args: [][]u8) !void { // const dir = try fs.path.join(gpa, &[_][]const u8{".zigmod", "deps"}); ...
src/cmd_fetch.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/day12.txt"); //...
src/day12.zig
const std = @import("std"); const string = []const u8; const print = std.debug.print; const expect = @import("std").testing.expect; var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var allocator = &gpa.allocator; //-------------------------------------------------------------------------------- test "basic" { pr...
src/test_async.zig
const std = @import("std"); const warn = std.debug.warn; const Allocator = std.mem.Allocator; const Stream = std.io.OutStream(std.os.WriteError); //showcases conventional method of implementing //interfaces in zig as of 0.5.0 const Animal = struct { const Self = @This(); const SpeakFn = fn(*const Self, *Strea...
interface_test.zig
const std = @import("std"); const panic = std.debug.panic; const print = std.debug.print; const fmt = std.fmt; const ascii = std.ascii; const alloc = std.heap.page_allocator; const ArrayList = std.ArrayList; const HashMap = std.AutoHashMap; const PREAMBLE_SIZE: usize = 25; pub fn main() !void { var numbers = Arra...
src/09.zig
const std = @import("std"); const math = std.math; const testing = std.testing; pub fn __logh(a: f16) callconv(.C) f16 { // TODO: more efficient implementation return @floatCast(f16, logf(a)); } pub fn logf(x_: f32) callconv(.C) f32 { const ln2_hi: f32 = 6.9313812256e-01; const ln2_lo: f32 = 9.058000...
lib/compiler_rt/log.zig
const std = @import("std"); const builtin = std.builtin; const build = std.build; const ArrayList = std.ArrayList; const fmt = std.fmt; const mem = std.mem; const fs = std.fs; const warn = std.debug.warn; const Mode = builtin.Mode; pub const CompareOutputContext = struct { b: *build.Builder, step: *build.Step,...
test/src/compare_output.zig
pub const Oid = enum(u32) { T_bool = 16, T_bytea = 17, T_char = 18, T_name = 19, T_int8 = 20, T_int2 = 21, T_int2vector = 22, T_int4 = 23, T_regproc = 24, T_text = 25, T_oid = 26, T_tid = 27, T_xid = 28, T_cid = 29, T_oidvector = 30, T_pg_ddl_command = 32,...
src/db/pq/oid.zig
const std = @import("std"); pub const VirtualMachineError = error{OutOfMemory}; pub const VirtualMachine = struct { allocator: std.mem.Allocator, stack: [stack_size]i32, program: std.ArrayList(u8), sp: usize, // stack pointer pc: usize, // program counter string_pool: std.ArrayList([]const u8)...
vm.zig
const Self = @This(); const std = @import("std"); const wlr = @import("wlroots"); const wl = @import("wayland").server.wl; const server = &@import("main.zig").server; const util = @import("util.zig"); const Box = @import("Box.zig"); /// The corresponding wlroots object xwayland_surface: *wlr.XwaylandSurface, // L...
source/river-0.1.0/river/XwaylandUnmanaged.zig
const std = @import("std"); const colors = @import("../term/colors.zig"); const Color = colors.Color; const ast = @import("./ast.zig"); const Ast = ast.Ast; const Fg = colors.Fg; const eq = std.mem.eql; const meta = std.meta; const mem = std.mem; const enums = std.enums; const fieldNames = meta.fieldNames; const lex = ...
src/lang/token.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const chunks = @import("./chunks.zig"); const values = @import("./value.zig"); const debug = @import("./debug.zig"); const compiler = @import("./compiler.zig"); const Obj = @import("object.zig").Obj; const Value = values.Value; const Chunk = chunks.Chunk;...
src/vm.zig
const arch = @import("arch.zig"); const hw = @import("../hw.zig"); const ExceptionContext = packed struct { regs: [30]u64, elr_el1: u64, spsr_el1: u64, lr: u64, far_el1: u64, }; fn handle(ctx: *ExceptionContext, comptime name: []const u8) callconv(.Inline) noreturn { hw.entry_uart.carefully(.{...
dainkrnl/src/arm64/exception.zig
const std = @import("std"); const string = []const u8; const yaml = @import("yaml"); pub fn main() !void { // const source_url = "https://docs.docker.com/engine/api/v1.41.yaml"; var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const alloc = gpa.allocator(); // Using local document because upstream ...
generate.zig
const std = @import("std"); pub fn Callback( comptime ReturnType: type, comptime ArgType: type, comptime inline_capacity: usize, comptime deinitable: bool, ) type { return struct { callFn: fn (usize, ArgType) ReturnType, deinitFn: if (deinitable) fn (usize) void else void, i...
lib/util/callback.zig
const windows = @import("windows.zig"); const IUnknown = windows.IUnknown; const UINT = windows.UINT; const WINAPI = windows.WINAPI; const SIZE_T = windows.SIZE_T; const LPCSTR = windows.LPCSTR; const GUID = windows.GUID; pub const PRIMITIVE_TOPOLOGY = enum(UINT) { UNDEFINED = 0, POINTLIST = 1, LINELIST = ...
modules/platform/vendored/zwin32/src/d3dcommon.zig
const std = @import("std"); const Token = @import("lexer.zig").Token; const Slice = @import("util.zig").IndexedSlice; pub const Error = error{ InvalidTokenConversion, InvalidArgs, } || std.mem.Allocator.Error; pub const NodeList = std.ArrayList(Node); pub const RefList = std.ArrayList(Node.Index); const log...
src/ast.zig
const std = @import("std"); const mem = std.mem; const CurrencySymbol = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 36, hi: u21 = 126128, pub fn init(allocator: *mem.Allocator) !CurrencySymbol { var instance = CurrencySymbol{ .allocator = allocator, .array = try allocator.alloc(...
src/components/autogen/DerivedGeneralCategory/CurrencySymbol.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const input = @embedFile("../in08.txt"); const ExecutedArray = std.PackedIntArray(u1, 2048); var line: [2048]usize = undefined; var line_len: usize = 0; fn load() void { line[0] = 0; ...
src/day08.zig
const std = @import("std"); const ArrayList = std.ArrayList; const TypeInfo = std.builtin.TypeInfo; const meta = std.meta; const ParseError = error { ParseError } || anyerror; fn parse(comptime Type: type, buf: []const u8) ParseError!Type { const typeInfo = @typeInfo(Type); const TypeId = std.builtin.TypeId; ...
df.zig
const std = @import("std"); const expect = std.testing.expect; // zig gets polymorphism/generics by using compile time functions that return a type /// DFS Iterator that visits/emits Nodes twice, once on start and when closing/ending /// skip_start_wo_children: skips is_end=false NodeInfo for items without children pu...
src/utils.zig
const std = @import("std"); const assert = std.debug.assert; const math = std.math; const mem = std.mem; const testing = std.testing; const log = std.log.scoped(.yaml); const Allocator = mem.Allocator; pub const Tokenizer = @import("Tokenizer.zig"); pub const parse = @import("parse.zig"); const Node = parse.Node; co...
src/main.zig
const LibExeObjStep = @import("std").build.LibExeObjStep; pub const Pkg = struct { name: []const u8, path: []const u8, }; pub const packages = [_]Pkg{ Pkg{ .name = "cmd/commands", .path = "src/cmd/commands.zig" }, Pkg{ .name = "cmd/doc", .path = "src/cmd/doc.zig" }, Pkg{ .name = "cmd/docs/html", .pa...
EXPORTS.zig
const zt = @import("deps/ZT/src/zt.zig"); const std = @import("std"); const sling = @import("sling.zig"); const ig = @import("imgui"); const glfw = @import("glfw"); pub var worldMouseDelta: sling.math.Vec2 = .{}; pub var worldMouse: sling.math.Vec2 = .{}; pub var mouse: sling.math.Vec2 = .{}; pub var mouseDelta: slin...
src/input.zig
const math = @import("std").math; // => https://youtu.be/LWFzPP8ZbdU?list=FLOZKYzNJILemcDKZwSBSoyg&t=2817 squirrel3 code in C++ // => https://youtu.be/LWFzPP8ZbdU?list=FLOZKYzNJILemcDKZwSBSoyg&t=3167 SquirrelRng API in C++ // => https://github.com/sublee/squirrel3-python/blob/master/squirrel3.py pub fn squirrel3_u32(...
lib/squirrel3noise.zig
const std = @import("std"); pub fn flameShotLinux(alloc: *std.mem.Allocator) !bool { const args = [_][]const u8{ "/usr/bin/flameshot", "full", "-p", "/tmp/slide_shots", }; if (std.ChildProcess.init(args[0..], alloc)) |child| { defer child.deinit(); // TODO:...
src/screenshot.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const mem = std.mem; test "continue in for loop" { const array = [_]i32{ 1, 2, 3, 4, 5, }; var sum: i32 = 0; for (array) |x| { sum += x; if...
test/stage1/behavior/for.zig
const std = @import("std"); const builtin = @import("builtin"); const mem = std.mem; const expect = std.testing.expect; const Vector = std.meta.Vector; test "@shuffle" { // TODO investigate why this fails when cross-compiling to wasm. if (builtin.os.tag == .wasi) return error.SkipZigTest; const S = struct...
test/stage1/behavior/shuffle.zig
const std = @import("std"); const builtin = @import("builtin"); const TestContext = @import("../src/test.zig").TestContext; pub fn addCases(ctx: *TestContext) !void { { const case = ctx.obj("callconv(.Interrupt) on unsupported platform", .{ .cpu_arch = .aarch64, .os_tag = .linux, ...
test/compile_errors.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 BigIntConst = std.math.big.int.Const; const BigIntMutable = std.math.big.int.Mutable; const Target = std.Target; ...
src-self-hosted/ir.zig
const std = @import("std.zig"); const builtin = @import("builtin"); const testing = std.testing; const SpinLock = std.SpinLock; const assert = std.debug.assert; const c = std.c; const os = std.os; const time = std.time; const linux = os.linux; const windows = os.windows; /// A resource object which supports blocking u...
lib/std/reset_event.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/day03-tst.tx...
src/day03.zig
const std = @import("std"); const print = std.debug.print; pub fn main() anyerror!void { const input = "iwrupvqb"; var running = true; const t0 = try std.Thread.spawn(.{}, find_md5, .{ true, input, &running, 0, 4 }); const t1 = try std.Thread.spawn(.{}, find_md5, .{ true, input, &running, 1, 4 }); ...
src/day04.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const zwin32 = @import("zwin32"); const w = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hrPanicOnFail; const zd3d12 = @import("zd3d12"); const common = @import("common"); const c...
samples/simple3d/src/simple3d.zig
const nvg = @import("nanovg"); pub fn iconNew() void { nvg.beginPath(); nvg.moveTo(2.5, 0.5); nvg.lineTo(2.5, 15.5); nvg.lineTo(13.5, 15.5); nvg.lineTo(13.5, 3.5); nvg.lineTo(10.5, 0.5); nvg.closePath(); nvg.fillColor(nvg.rgb(255, 255, 255)); nvg.fill(); nvg.strokeColor(nvg.rgb(...
src/icons.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; const Vec2 = tools.Vec2; const BBox = tools.BBox; pub const main = tools.defaultMain("2021/...
2021/day17.zig
pub const PROP_ID_SECURE_MIN = @as(u32, 26608); pub const PROP_ID_SECURE_MAX = @as(u32, 26623); pub const MAPI_DIM = @as(u32, 1); pub const MAPI_P1 = @as(u32, 268435456); pub const MAPI_SUBMITTED = @as(u32, 2147483648); pub const MAPI_SHORTTERM = @as(u32, 128); pub const MAPI_NOTRECIP = @as(u32, 64); pub const MAPI_THI...
win32/system/address_book.zig
const std = @import("std"); const print = std.debug.print; const assert = std.debug.assert; const gnss = @import("gnss.zig"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const c = @cImport({ @cInclude("libexif/exif-data.h"); }); pub extern "c" fn free(?*c_void) void; const bounded_array = @import("boun...
src/exif.zig
const __extenddftf2 = @import("extendXfYf2.zig").__extenddftf2; const __extendhfsf2 = @import("extendXfYf2.zig").__extendhfsf2; const __extendsftf2 = @import("extendXfYf2.zig").__extendsftf2; const assert = @import("std").debug.assert; fn test__extenddftf2(a: f64, expectedHi: u64, expectedLo: u64) void { const x =...
std/special/compiler_rt/extendXfYf2_test.zig
const Gdt = @import("global_descriptor_table.zig").GlobalDescriptorTable; const Port = @import("port.zig").X86Port; // temporary. const Video = @import("video_buffer.zig"); // //////////////////////////////////////////////////////////////////// // TYPES /// type of interrupt id. pub const int_t = u8; /// type of the ...
kernel/interrupts.zig
const std = @import("std"); const testing = std.testing; const log = std.log.scoped(.tzif); pub const TimeZone = struct { allocator: *std.mem.Allocator, version: Version, transitionTimes: []i64, transitionTypes: []u8, localTimeTypes: []LocalTimeType, designations: []u8, leapSeconds: []Leap...
tzif.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const cpu = @import("cpu.zig"); const execution = @import("execution.zig"); const keyboard = @import("keyboard.zig"); test "CLS" { var state = try cpu.createCPUState(); defer cpu.destroyCPUState(&state)...
src/chip8/test.zig
pub const MimeMapping = struct { extension: []const u8, mime_type: []const u8, }; /// List of mappings between extensions and its mime type pub const mime_database = [_]MimeMapping{ MimeMapping{ .extension = ".123", .mime_type = "application/vnd.lotus-1-2-3" }, MimeMapping{ .extension = ".3dml", .mime_...
src/mime_db.zig
const std = @import("std"); const Game = @import("game.zig"); const Board = Game.Board; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const split = std.mem.split; const print = std.debug.print; const Data = struct { numbers: []i32, boards: []*Board, }; fn load(allocator: *Allocator, fi...
Day4/src/main.zig
const std = @import("std"); const eql = std.mem.eql; const min = std.math.min; const max = std.math.max; const mem = std.mem; const parseInt = std.fmt.parseInt; const print = std.debug.print; const testing = std.testing; const tokenize = std.mem.tokenize; var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; const g...
src/day13/day13.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"); const bitjuggle = @import("internal/bitjuggle.zig"); pub const Index = opaque { pub fn deinit(self: *Index) void { log.debug...
src/index.zig
const std = @import("std"); const mi = @import("mi.zig"); const changeScreen = @import("n64.zig").changeScreen; const InterruptSource = mi.InterruptSource; const setPending = mi.setPending; const clearPending = mi.clearPending; const VIReg = enum(u64) { VIControl = 0x00, VIOrigin = 0x04, VIWidth ...
src/core/vi.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const L = std.unicode.utf8ToUtf16LeStringLiteral; const zwin32 = @import("zwin32"); const w32 = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hrPanicOnFail; const zd3d12 = @import(...
samples/procedural_mesh/src/procedural_mesh.zig
const graphics = @import("didot-graphics"); const objects = @import("didot-objects"); const std = @import("std"); const single_threaded = @import("builtin").single_threaded; const Allocator = std.mem.Allocator; const Window = graphics.Window; const Scene = objects.Scene; pub const Application = struct { /// How ma...
didot-app/app.zig
const std = @import("std"); const StateType = enum(i32) { Match = 256, Split = 257, }; const State = struct { c: i32, out: ?*State, out1: ?*State, lastlist: int32 }; const Frag = struct { start: ?*State, out: ?*Ptrlist }; const Ptrlist = union { next: ?*Ptrlist, s: ?*State }; fn push(stack: *Fr...
src/main.zig
pub const SYS = enum(usize) { // BSD's syscalls exit = 0x2000001, fork = 0x2000002, read = 0x2000003, write = 0x2000004, open = 0x2000005, close = 0x2000006, wait4 = 0x2000007, link = 0x2000009, unlink = 0x200000a, chdir = 0x200000c, fchdir = 0x200000d, mknod = 0x2000...
src/apple/consts.zig
const std = @import("std"); var allocator_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); pub const default_allocator = &allocator_arena.allocator; extern fn wngx_log(level: u32, msg: [*]const u8, msglen: u32) void; extern fn wngx_request_size() u32; extern fn wngx_get_request(buf: [*]u8, buflen: u32...
wngx.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; /// This input file has been preprocesed with find-and-replace operations /// Example of the input after preprocessing: /// /// vibrant orange:3 striped olive,1 muted olive /// light lime:1...
src/day07.zig
pub const Keysym = enum(u32) { NoSymbol = 0x000000, VoidSymbol = 0xffffff, _, pub const BackSpace = 0xff08; pub const Tab = 0xff09; pub const Linefeed = 0xff0a; pub const Clear = 0xff0b; pub const Return = 0xff0d; pub const Pause = 0xff13; pub const Scroll_Lock = 0xff14; pu...
src/xkbcommon_keysyms.zig
const std = @import("std"); const pkmn = @import("pkmn"); const gen1 = pkmn.gen1.helpers; pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); const args = try std.process.argsAlloc(allocator); defer s...
src/tools/serde.zig
const std = @import("std"); const tvg = @import("tvg"); // pub const everything_16 = blk: { // @setEvalBranchQuota(100_000); // comptime var buf: [2048]u8 = undefined; // var stream = std.io.fixedBufferStream(&buf); // writeEverything(stream.writer(), .default) catch unreachable; // break :blk stre...
src/data/ground-truth.zig
const std = @import("std"); const mem = std.mem; const testing = std.testing; const vk = @import("vk"); pub const AllocationType = enum { Free, Buffer, Image, ImageLinear, ImageOptimal, }; pub const MemoryUsage = enum { GpuOnly, CpuOnly, CpuToGpu, GpuToCpu, }; pub const Allocatio...
src/lib.zig
const std = @import("std"); const Builder = std.build.Builder; const Paths = struct { upnp_header_path: []const u8, ixml_header_superpath: []const u8, upnp_lib_path: []const u8, ixml_lib_path: []const u8, }; pub fn queryPaths(b: *Builder) Paths { return Paths { .upnp_header_path = b.option...
build.zig
const std = @import("std"); const builtin = @import("builtin"); const log = std.log; const fs = @import("src/build/fs.zig"); const Builder = std.build.Builder; const building_os = builtin.target.os.tag; const current_arch = std.Target.Cpu.Arch.x86_64; const cache_dir = "zig-cache"; const kernel_name = "kernel.elf"; ...
build.zig
const builtin = @import("builtin"); const std = @import("std"); const core = @import("core.zig"); const draw = @import("draw.zig"); const input = @import("input.zig"); const terminal = @import("terminal.zig"); const vt100 = @import("vt100.zig"); const ascii = std.ascii; const debug = std.debug; const fs = std.fs; con...
src/main.zig
const std = @import("std"); const mem = std.mem; const NoncharacterCodePoint = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 64976, hi: u21 = 1114111, pub fn init(allocator: *mem.Allocator) !NoncharacterCodePoint { var instance = NoncharacterCodePoint{ .allocator = allocator, .arr...
src/components/autogen/PropList/NoncharacterCodePoint.zig
const std = @import("std"); pub const AudioFormat = enum { signed8, signed16_lsb, }; pub fn mixDown( dst: []u8, mix_buffer: []const f32, audio_format: AudioFormat, num_channels: usize, channel_index: usize, vol: f32, ) void { switch (audio_format) { .signed8 => { ...
src/zang/mixdown.zig
const std = @import("std"); const CaveList = [12]Node; const HashList = [24]u8; //-------------------------------------------------------------------------------------------------- const Node = struct { name: []const u8, hash: u8, connection_indices: [6]usize, connection_count: u8, is_small: bool,...
src/day12.zig
const base = @import("base.zig"); const letter = @import("letter.zig"); const tables = @import("tables.zig"); const warn = @import("std").debug.warn; /// isUpper reports whether the rune is an upper case letter. pub fn isUpper(rune: u32) bool { if (rune <= base.max_latin1) { const p = tables.properties[@in...
src/unicode/index.zig
const std = @import("std"); const os = @import("root").os; const platform = os.platform; const range = os.lib.range.range; const scheduler = os.thread.scheduler; const idt = @import("idt.zig"); const gdt = @import("gdt.zig"); const pic = @import("pic.zig"); const thread = @import("thread.zig"); pub const num_ha...
src/platform/x86_64/interrupts.zig
const std = @import("std"); const ArrayList = std.ArrayList; pub const ShelfType = enum { top_result, song, video, artist, album, community_playlists, featured_playlists, pub fn from_str(str: []const u8) !ShelfType { std.log.warn("{s}", .{str}); if (std.mem.eql(u8, str...
src/model.zig
const std = @import("std"); const util = @import("util"); const input = @embedFile("17.txt"); const CubeState = enum(u1) { inactive = 0, active = 1, }; const World = struct { buf: [2]Buf = buf_init, const Buf = [30][30][30][30]CubeState; const buf_init = comptime blk: { var buf = [_][30][...
2020/17.zig
const std = @import("std"); const api = @import("./buzz_api.zig"); const utils = @import("../src/utils.zig"); const builtin = @import("builtin"); export fn time(vm: *api.VM) c_int { vm.bz_pushNum(@intToFloat(f64, std.time.milliTimestamp())); return 1; } export fn env(vm: *api.VM) c_int { const key = api....
lib/buzz_os.zig
const std = @import("std"); const Wat = @import("../wat.zig"); const Instance = @import("../instance.zig"); const Memory = @import("../Memory.zig"); test "import" { var fbs = std.io.fixedBufferStream( \\(module \\ (type (;0;) (func (param i32) (result i32))) \\ (import "env" "thing" (fun...
src/func/imports.zig
const std = @import("std"); const input = @import("input.zig"); pub fn run(stdout: anytype) anyerror!void { { var input_ = try input.readFile("inputs/day2"); defer input_.deinit(); const result = try part1(&input_); try stdout.print("2a: {}\n", .{ result }); std.debug.asse...
src/day2.zig
const std = @import("std"); fn getSrcPtrType(comptime T: type) ?type { return switch (@typeInfo(T)) { .Pointer => T, .Fn => T, .AnyFrame => T, .Optional => |o| switch (@typeInfo(o.child)) { .Pointer => |p| if (p.is_allowzero) null else o.child, .Fn => o.child...
PeerType.zig
const std = @import("std"); const net = std.net; const os = std.os; const linux = os.linux; const io_uring_sqe = linux.io_uring_sqe; const io_uring_cqe = linux.io_uring_cqe; const assert = std.debug.assert; const Server = struct { ring: linux.IO_Uring, fn q_accept( self: *Server, user_data: u6...
src/io_uring-tcp-hasher/main.zig
pub const MSSIP_FLAGS_PROHIBIT_RESIZE_ON_CREATE = @as(u32, 65536); pub const MSSIP_FLAGS_USE_CATALOG = @as(u32, 131072); pub const MSSIP_FLAGS_MULTI_HASH = @as(u32, 262144); pub const SPC_INC_PE_RESOURCES_FLAG = @as(u32, 128); pub const SPC_INC_PE_DEBUG_INFO_FLAG = @as(u32, 64); pub const SPC_INC_PE_IMPORT_ADDR_TABLE_F...
win32/security/cryptography/sip.zig
pub const DIALENG_OperationComplete = @as(u32, 65536); pub const DIALENG_RedialAttempt = @as(u32, 65537); pub const DIALENG_RedialWait = @as(u32, 65538); pub const INTERNET_INVALID_PORT_NUMBER = @as(u32, 0); pub const INTERNET_DEFAULT_FTP_PORT = @as(u32, 21); pub const INTERNET_DEFAULT_GOPHER_PORT = @as(u32, 70); pub c...
win32/networking/win_inet.zig