code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std.zig"); const math = std.math; const mem = std.mem; const io = std.io; const os = std.os; const fs = std.fs; const process = std.process; const elf = std.elf; const DW = std.dwarf; const macho = std.macho; const coff = std.coff; const pdb = std.pdb; const ArrayList = std.ArrayList; const builtin...
lib/std/debug.zig
const std = @import("../std.zig"); const mem = std.mem; const math = std.math; const debug = std.debug; const htest = @import("test.zig"); pub const Sha3_224 = Keccak(224, 0x06); pub const Sha3_256 = Keccak(256, 0x06); pub const Sha3_384 = Keccak(384, 0x06); pub const Sha3_512 = Keccak(512, 0x06); fn Keccak(comptime ...
lib/std/crypto/sha3.zig
const std = @import("std"); const print = std.debug.print; const mem = std.mem; const log = std.log.scoped(.keys); const Dirs = @import("core").Dirs; const Allocator = std.mem.Allocator; const crypto = std.crypto; const Atomic = std.atomic.Atomic; const Ed25519 = crypto.sign.Ed25519; const Blake3 = crypto.hash.Blake3; ...
src/keys.zig
const std = @import("std"); const span = std.mem.span; const bog = @import("bog.zig"); const gpa = std.heap.c_allocator; //! ABI WARNING -- REMEMBER TO CHANGE include/bog.h const Error = extern enum { None, OutOfMemory, TokenizeError, ParseError, CompileError, RuntimeError, MalformedByteCo...
src/lib.zig
const std = @import("../index.zig"); const crypto = std.crypto; const debug = std.debug; const mem = std.mem; pub const HmacMd5 = Hmac(crypto.Md5); pub const HmacSha1 = Hmac(crypto.Sha1); pub const HmacSha256 = Hmac(crypto.Sha256); pub fn Hmac(comptime Hash: type) type { return struct { const Self = @This...
std/crypto/hmac.zig
const assert = @import("std").debug.assert; const mem = @import("std").mem; const reflection = @This(); test "reflection: array, pointer, optional, error union type child" { comptime { assert(([10]u8).Child == u8); assert((*u8).Child == u8); assert((error!u8).Payload == u8); assert(...
test/cases/reflection.zig
const std = @import("std"); const mach = @import("mach"); const gpu = @import("gpu"); const glfw = @import("glfw"); const zm = @import("zmath"); const Vertex = @import("cube_mesh.zig").Vertex; const vertices = @import("cube_mesh.zig").vertices; const App = mach.App(*FrameParams, .{}); const UniformBufferObject = stru...
examples/instanced-cube/main.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const Operand = union(enum) { constant: u16, wire: []const u8, fn parse(op: []const u8) Operand { const constant = std.fmt.parseInt(u16, op, 10) catch return Operand { .wire = op }; return Operand { .constant = constant }; } ...
src/main/zig/2015/day07.zig
pub const QOS_MAX_OBJECT_STRING_LENGTH = @as(u32, 256); pub const QOS_TRAFFIC_GENERAL_ID_BASE = @as(u32, 4000); pub const SERVICETYPE_NOTRAFFIC = @as(u32, 0); pub const SERVICETYPE_BESTEFFORT = @as(u32, 1); pub const SERVICETYPE_CONTROLLEDLOAD = @as(u32, 2); pub const SERVICETYPE_GUARANTEED = @as(u32, 3); pub const SER...
win32/network_management/qo_s.zig
const std = @import("std"); const hash_map = std.hash_map; const murmur = std.hash.murmur; const WordMap = std.HashMap([]const u8, u32, hashString, hash_map.eqlString, 80); pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); const ally = &arena.allocator; var words = W...
optimized.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const testing = std.testing; const adler32 = @import("./adler32.zig"); const crc32 = @import("./crc-32.zig"); test "adler32 - updateByteArray" { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); var allo...
src/lib.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); // version "generale" pas du tout specialisée pour l'input // dans l'input il y a genre 2 repetitions donc genre a(b*)c(d*) ou un truc comme ça // mais du coup c'est un peu lent. -> memoize et voilà. const Grammar = struc...
2020/day19.zig
const std = @import("std"); const buildLibressl = @import("vendor/zelda/zig-libressl/build.zig"); 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) ...
build.zig
const Dylib = @This(); const std = @import("std"); const assert = std.debug.assert; const fs = std.fs; const fmt = std.fmt; const log = std.log.scoped(.link); const macho = std.macho; const math = std.math; const mem = std.mem; const fat = @import("fat.zig"); const Allocator = mem.Allocator; const LibStub = @import("...
src/link/MachO/Dylib.zig
const std = @import("std"); const Uart = @import("./mmio.zig").Uart; const interpreter = @import("./interpreter.zig"); const heap = @import("./heap.zig"); const debug = @import("build_options").log_uart; /// Initialize the UART. Should be called very, *very* early. Must /// have been called before any write/read occ...
src/uart.zig
const std = @import("std"); pub const ParseMode = struct { /// When pedantic is true, the parser will not allow data between /// records. pedantic: bool = true, }; /// An intel hex data record. /// Resembles a single line in the hex file. pub const Record = union(enum) { data: Data, end_of_file: v...
ihex.zig
const std = @import("std"); const ig = @import("imgui"); const cgltf = @import("cgltf"); const vk = @import("vk"); const gltf = @import("gltf_wrap.zig"); const engine = @import("engine.zig"); const autogui = @import("autogui.zig"); const Allocator = std.mem.Allocator; const warn = std.debug.warn; const assert = std.d...
src/main.zig
const std = @import("std"); const warn = std.debug.warn; const win = std.os.windows; usingnamespace @import("externs.zig"); //usage: ./injector process-id absolute-path-of-dll pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const mem = &arena.a...
src/main.zig
const std = @import("std"); const c = @import("c"); const Buffer = @import("buffer.zig").Buffer; const Font = @import("font.zig").Font; const Face = @import("face.zig").Face; const SegmentProps = @import("buffer.zig").SegmentProps; const Feature = @import("common.zig").Feature; pub const ShapePlan = struct { handl...
freetype/src/harfbuzz/shape_plan.zig
const std = @import("std"); const ast = @import("ast.zig"); const Location = @import("location.zig").Location; const Scope = @import("scope.zig").Scope; const Diagnostics = @import("diagnostics.zig").Diagnostics; const CompileUnit = @import("../common/compile-unit.zig").CompileUnit; const CodeWriter = @import("code-w...
src/library/compiler/codegen.zig
const color = @import("color.zig"); const t = @import("../util/index.zig"); const TestCase = struct { x: u32, y: u32, expect: u32, }; const test_cases = []TestCase{ TestCase{ .x = 0x0, .y = 0x0, .expect = 0x0 }, TestCase{ .x = 0x0, .y = 0x1, .expect = 0x0 }, TestCase{ .x = 0x0, .y = 0x2, .expe...
src/color/color_test.zig
const std = @import("std"); pub const Command = struct { pub const Arg = struct { name: []const u8, takes_value: bool = true, }; name: []const u8, takes_arg: bool, }; const ArgvIterator = struct { argv: []const [:0]const u8, current_index: usize, next_index: usize, pu...
src/command.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/day16.txt"); //...
src/day16.zig
const std = @import("std"); const assert = std.debug.assert; pub const Fabric = struct { pub const Pos = struct { x: usize, y: usize, pub fn init(x: usize, y: usize) Pos { return Pos{ .x = x, .y = y, }; } }; pub const...
2018/p03/fabric.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); } pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); var arena = std.heap.ArenaAllocator.init(s...
2016/day4.zig
const std = @import("std"); pub const FlagRegister = packed union { raw: u8, flags: Flags, symbols: FlagsSymbol, }; pub const FlagsSymbol = packed struct { C: bool, N: bool, V: bool, dummmy1: bool, H: bool, dummy2: bool, Z: bool, S: bool, }; pub const Flags = packed struct...
lib/cpu/z80.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; const ModelData = @import("../ModelFiles/ModelFiles.zig").ModelData; const VertexAttributeType = ModelData.VertexAttributeType; const Buffer = @import("../WindowGraphicsInput/WindowGraphicsInput.zig").Buffer; const VertexMeta = @i...
src/RTRenderEngine/Mesh.zig
pub usingnamespace @import("std").os.windows; // General pub const KEY_EVENT = 0x0001; pub const MOUSE_EVENT = 0x0002; pub const WINDOW_BUFFER_SIZE_EVENT = 0x0004; pub const MENU_EVENT = 0x0008; pub const FOCUS_EVENT = 0x0010; pub extern fn GetConsoleOutputCP() c_uint; pub extern fn SetConsoleOutputCP(wCode...
src/c/c.zig
const std = @import("std"); const spu = @import("spu-mk2"); const common = @import("shared.zig"); var emulator: spu.SpuMk2(common.WasmDemoMachine) = undefined; const bootrom = @embedFile("../../zig-out/firmware/wasm.bin"); pub fn dumpState(emu: *spu.SpuMk2) !void { _ = emu; } pub fn dumpTrace(emu: *spu.SpuMk2,...
tools/emulator/web-main.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "APIC", .filter = .info, }).write; const regs = @import("regs.zig"); const builtin = @import("builtin"); const interrupts = @import("interrupts.zig"); // LAPIC fn lapic_ptr() ?*volatile [0x100]u32 { if (os.platform.t...
subprojects/flork/src/platform/x86_64/apic.zig
const std = @import("std"); //const filters = @import("filters"); const build_options = @import("build_options"); const debugDisp = build_options.debugDisp; const debugLoop = build_options.debugLoop; const debugStageTypes = build_options.debugStageTypes; const debugCmd = build_options.debugCmd; const debugStart = bui...
pipes.zig
const std = @import("std"); const mem = std.mem; const testing = std.testing; const Metric = @import("metric.zig").Metric; pub fn GaugeCallFnType(comptime StateType: type) type { const CallFnArgType = switch (@typeInfo(StateType)) { .Pointer => StateType, .Optional => |opt| opt.child, else...
src/Gauge.zig
const std = @import("std"); const zap = @import("zap"); const hyperia = @import("hyperia.zig"); const mem = std.mem; const mpsc = hyperia.mpsc; const builtin = std.builtin; const testing = std.testing; const assert = std.debug.assert; pub const cache_line_length = switch (builtin.cpu.arch) { .x86_64, .aarch64, ....
spsc.zig
const sf = struct { pub usingnamespace @import("../sfml.zig"); pub usingnamespace sf.network; }; const UdpSocket = @This(); // Constructor/destructor /// Creates a new udp socket pub fn create() !UdpSocket { var sock = sf.c.sfUdpSocket_create(); if (sock) |s| { return UdpSocket{ ._ptr = s };...
src/sfml/network/UdpSocket.zig
const gllparser = @import("../gllparser/gllparser.zig"); const Error = gllparser.Error; const Parser = gllparser.Parser; const ParserContext = gllparser.Context; const Result = gllparser.Result; const NodeName = gllparser.NodeName; const std = @import("std"); const testing = std.testing; const mem = std.mem; pub cons...
src/combn/combinator/always.zig
const builtin = @import("builtin"); const std = @import("std"); const c = @import("c.zig"); const examples = @import("scene/examples.zig"); const Debounce = @import("debounce.zig").Debounce; const Options = @import("options.zig").Options; const Renderer = @import("renderer.zig").Renderer; const Scene = @import("scene...
src/window.zig
const std = @import("std"); const Scope = @import("Scope.zig"); const value = @import("value.zig"); const Value = value.Value; const p2z = @import("pcre2zig"); const ScopeStack = @This(); allocator: std.mem.Allocator, columns: Value = value.val_nil, value_cache: std.StringHashMap(Value), func_memo: std.AutoHashMap(...
src/ScopeStack.zig
const std = @import("std"); const aoc = @import("aoc-lib.zig"); fn parts(alloc: std.mem.Allocator, inp: []const u8) ![2]u16 { var si = std.mem.indexOfScalar(u8, inp, @as(u8, '\n')) orelse unreachable; var calls = try aoc.Ints(alloc, u8, inp[0..si]); defer alloc.free(calls); var rounds: [100]u8 = @splat...
2021/04/aoc.zig
usingnamespace @import("../engine/engine.zig"); const Literal = @import("../parser/literal.zig").Literal; const LiteralValue = @import("../parser/literal.zig").LiteralValue; const std = @import("std"); const testing = std.testing; const mem = std.mem; pub fn OneOfContext(comptime Payload: type, comptime Value: type) ...
src/combn/combinator/oneof.zig
const zang = @import("zang"); 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 = \\example_curve \\ \\Trigger a weird sound effec...
examples/example_curve.zig
/// Listen address for the server. pub const address = "127.0.0.1:6667"; /// Word bank for use by local bots. pub const word_bank = [_][]const u8{ "lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit", "sed", "do", "eiusmod", "tempor", "incididu...
src/config.zig
const std = @import("std"); const zlm = @import("zlm"); const Vec3 = zlm.Vec3; const Allocator = std.mem.Allocator; const graphics = @import("didot-graphics"); const objects = @import("didot-objects"); const models = @import("didot-models"); const bmp = @import("didot-image").bmp; const obj = models.obj; const Applica...
examples/flight-test/flight-sim.zig
const ImageInStream = zigimg.ImageInStream; const ImageSeekStream = zigimg.ImageSeekStream; const PixelFormat = zigimg.PixelFormat; const assert = std.debug.assert; const color = zigimg.color; const errors = zigimg.errors; const pcx = zigimg.pcx; const std = @import("std"); const testing = std.testing; const zigimg = @...
tests/pcx_test.zig
const std = @import("std"); const assert = std.debug.assert; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const ExecError = error{ InvalidOpcode, InvalidParamMode, }; fn opcode(ins: i32) i32 { return @...
zig/07_2.zig
const std = @import("std"); const grail = @import("grailsort.zig"); const testing = std.testing; const print = std.debug.print; const tracy = @import("tracy.zig"); var gpa_storage = std.heap.GeneralPurposeAllocator(.{}){}; const gpa = &gpa_storage.allocator; const verify_sorted = true; var test_words: []const [:0]co...
src/benchmark.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const print = std.debug.print; const data = @embedFile("../data/day02.txt"); const Verb = enum { Forward, Down, Up, }; const Command = struct { verb: Verb, amount: u32, pub fn from(line: []const u8) !Command { var split...
src/day02.zig
pub const ArrayError = error{CapacityError}; pub fn ArrayVec(comptime T: type, comptime SIZE: usize) type { return struct { array: [SIZE]T, length: usize, const Self = @This(); fn set_len(self: *Self, new_len: usize) void { self.length = new_len; } ///...
src/array.zig
pub const uart = @import("hw/uart.zig"); pub const psci = @import("hw/psci.zig"); pub const entry_uart = @import("hw/entry_uart.zig"); pub const syscon = @import("hw/syscon.zig"); const std = @import("std"); const fb = @import("console/fb.zig"); const printf = fb.printf; const dtblib = @import("dtb"); const SysconCon...
dainkrnl/src/hw.zig
const std = @import("std"); const gl = @import("zgl"); const glfw = @import("glfw"); const nvg = @import("nanovg"); /// An unsigned int that can be losslessly converted to an f32 pub const I = u24; /// A 2-vector of unsigned integers that can be losslessly converted to f32 pub const Vec2 = std.meta.Vector(2, I); ///...
src/ui.zig
const std = @import("std"); /// State transition errors pub const StateError = error{ /// Invalid transition Invalid, /// A state transition was canceled Canceled, /// A trigger or state transition has already been defined AlreadyDefined, }; /// Transition handlers must return whether the tra...
src/main.zig
pub const Message = struct { sender: MailboxId, receiver: MailboxId, type: usize, payload: usize, pub fn from(mailbox_id: *const MailboxId) Message { return Message{ .sender = MailboxId.Undefined, .receiver = *mailbox_id, .type = 0, .payload ...
std/os/zen.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; top_level_field: i32, test "t...
test/behavior/struct.zig
/// Authenticated Encryption with Associated Data pub const aead = struct { pub const aegis = struct { pub const Aegis128L = @import("crypto/aegis.zig").Aegis128L; pub const Aegis256 = @import("crypto/aegis.zig").Aegis256; }; pub const aes_gcm = struct { pub const Aes128Gcm = @impo...
lib/std/crypto.zig
const std = @import("std"); const liu = @import("./liu/lib.zig"); // This file stores the specifications of created assets and the code to // re-generate them from valid data, where the valid data is easier to reason // about than the produced asset files. Ideally the valid data is human-readable. const assert = std....
src/assets.zig
const std = @import("std"); const builtin = std.builtin; const linkage: builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak; // This parameter is true iff the target architecture supports the bare minimum // to implement the atomic load/store intrinsics. // Some architectures support atomic load/stores ...
lib/std/special/compiler_rt/atomics.zig
const std = @import("std"); const ast = @import("ast.zig"); const Location = @import("location.zig").Location; const Scope = @import("scope.zig").Scope; const Diagnostics = @import("diagnostics.zig").Diagnostics; const Type = @import("typeset.zig").Type; const TypeSet = @import("typeset.zig").TypeSet; const Analysis...
src/library/compiler/analysis.zig
const builtin = @import("builtin"); const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; /// Returns the hyperbolic arc-cosine of x. /// /// Special cases: /// - acosh(x) = snan if x < 1 /// - acosh(nan) = nan pub fn acosh(x: anytype) @TypeOf(x) { const T = @TypeOf(x); ...
lib/std/math/acosh.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const HappinessTable = aoc.StringTable(i16); const HappinessPermutator = aoc.Permutator([]const u8); pub fn run(problem: *aoc.Problem) !aoc.Solution { var happiness = HappinessTable.init(problem.allocator); while (problem.line()) |line| { ...
src/main/zig/2015/day13.zig
const std = @import("std"); const mc = @import("mc.zig"); const color = @import("color.zig"); const tracy = @import("tracy.zig"); const audio = @import("audio-extractor.zig"); const FrameProcessor = @import("frame-processor.zig").FrameProcessor; usingnamespace @import("threadpool"); const sdl = @cImport({ @cInclu...
nativemap/src/sdl-app.zig
const FILE = @import("std").c.FILE; pub fn ErrUnion(comptime t: type) type { return union(enum) { err: status, ok: t, pub fn init(result: t, stat: status) @This() { return if (stat == .OK) .{ .ok = result } else .{ .err = stat }; ...
src/zdns.zig
pub const SQLITE_VERSION_NUMBER = @as(u32, 3029000); pub const SQLITE_OK = @as(u32, 0); pub const SQLITE_ERROR = @as(u32, 1); pub const SQLITE_INTERNAL = @as(u32, 2); pub const SQLITE_PERM = @as(u32, 3); pub const SQLITE_ABORT = @as(u32, 4); pub const SQLITE_BUSY = @as(u32, 5); pub const SQLITE_LOCKED = @as(u32, 6); pu...
win32/system/sql_lite.zig
//-------------------------------------------------------------------------------- // Section: Types (2) //-------------------------------------------------------------------------------- const IID_IThumbnailExtractor_Value = Guid.initString("969dc708-5c76-11d1-8d86-0000f804b057"); pub const IID_IThumbnailExtractor = ...
win32/system/com/ui.zig
const ImageReader = zigimg.ImageReader; const ImageSeekStream = zigimg.ImageSeekStream; const PixelFormat = zigimg.PixelFormat; const assert = std.debug.assert; const bmp = zigimg.bmp; const color = zigimg.color; const errors = zigimg.errors; const std = @import("std"); const testing = std.testing; const zigimg = @impo...
tests/formats/bmp_test.zig
const std = @import("std"); const assert = std.debug.assert; pub const Image = struct { const Color = enum(u8) { Black = 0, White = 1, Transparent = 2, LAST = 3, OTHER = 99, }; allocator: *std.mem.Allocator, w: usize, h: usize, l: usize, data: [128 *...
2019/p08/img.zig
const std = @import("std"); const sg = @import("sokol").gfx; const sapp = @import("sokol").app; const sgapp = @import("sokol").app_gfx_glue; const vec2 = @import("shaders/sokol_math.zig").Vec2; const vec3 = @import("shaders/sokol_math.zig").Vec3; const mat4 = @import("shaders/sokol_math.zig").Mat4; const shd = @import(...
main.zig
const std = @import("std"); const warn = std.debug.warn; const BlockTree = @import("./block_tree.zig").BlockTree; const DeflateSlidingWindow = @import("./raw_deflate_reader.zig").DeflateSlidingWindow; pub fn RawBlock(comptime InputBitStream: type) type { return struct { const Self = @This(); const...
src/block.zig
const std = @import("std"); const Type = @import("../../type.zig").Type; const Target = std.Target; /// Defines how to pass a type as part of a function signature, /// both for parameters as well as return values. pub const Class = enum { direct, indirect, none }; const none: [2]Class = .{ .none, .none }; const memo...
src/arch/wasm/abi.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const ArrayList = std.ArrayList; const HashMap = std.HashMap; fn trimStart(slice: []const u8, ch: u8) []const u8 { var i: usize = 0; for (slice) |b| { if (b != '-') break; i += 1; } return slice[i..]; } ...
src/arg.zig
const builtin = @import("builtin"); const std = @import("std"); const dwarf = std.dwarf; const platform = @import("../platform.zig"); const out = platform.out; const in = platform.in; pub const SERIAL_COM1: u16 = 0x3F8; var port: u16 = undefined; fn configureBaudRate(com: u16, divisor: u16) void { // Enable DLAB ...
src/kernel/debug/serial.zig
const std = @import("std"); const DiscordLogger = @import("./discord_logger/discord_logger.zig").DiscordLogger; const TwitchLogger = @import("./twitch_logger/twitch_logger.zig").TwitchLogger; // Set the log level to warning pub const log_level: std.log.Level = .warn; pub var discord: ?DiscordLogger = null; const disc...
src/main.zig
const std = @import("std"); const pkmn = @import("pkmn"); const Timer = std.time.Timer; pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); var fuzz = false; const args = try std.process.argsAlloc(allo...
src/test/benchmark.zig
const std = @import("std"); const fs = std.fs; const testing = std.testing; /// Reads contents from path, relative to cwd, and store in target_buf pub fn readFileRaw(path: []const u8, target_buf: []u8) !usize { return try readFileRawRel(fs.cwd(), path, target_buf); } /// Reads contents from path, relative to dir,...
src/io.zig
const std = @import("std"); const stdx = @import("../stdx.zig"); const t = stdx.testing; const vec2 = Vec2.init; pub const geom = @import("geom.zig"); usingnamespace @import("matrix.zig"); pub fn Point2(comptime T: type) type { return struct { x: T, y: T, pub fn init(x: T, y: T) @This() ...
stdx/math/math.zig
const MachO = @This(); const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const fs = std.fs; const log = std.log.scoped(.link); const macho = std.macho; const math = std.math; const mem = std.mem; const Module = @import("../Module.zig"); const link = @import("../link.zig...
src-self-hosted/link/MachO.zig
const std = @import("std"); const Args = std.process.args; // mem pub const halloc = std.heap.page_allocator; pub const talloc = std.testing.allocator; // sort pub const sort = std.sort; pub fn i64LessThan(_: void, a: i64, b: i64) bool { return a < b; } pub fn i64GreaterThan(_: void, a: i64, b: i64) bool { r...
2021/05/aoc-lib.zig
const std = @import("std"); const readIntLittle = std.mem.readIntLittle; const writeIntLittle = std.mem.writeIntLittle; pub const Fe = struct { limbs: [5]u64, const MASK51: u64 = 0x7ffffffffffff; pub const zero = Fe{ .limbs = .{ 0, 0, 0, 0, 0 } }; pub const one = Fe{ .limbs = .{ 1, 0, 0, 0, 0 } }; ...
lib/std/crypto/25519/field.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const BagsHeld = struct { name: []const u8, qty: u8 }; pub fn run(problem: *aoc.Problem) !aoc.Solution { var contains_in = aoc.StringMultimap([]const u8).init(problem.allocator); defer contains_in.deinit(); var containing = aoc.StringMultimap(...
src/main/zig/2020/day07.zig
const kernel = @import("kernel.zig"); const log = kernel.log.scoped(.CoreHeap); const TODO = kernel.TODO; const Physical = kernel.Physical; const Virtual = kernel.Virtual; const Heap = @This(); pub const AllocationResult = struct { physical: u64, virtual: u64, asked_size: u64, given_size: u64, }; con...
src/kernel/core_heap.zig
const SDL = @import("sdl2"); const std = @import("std"); const zigimg = @import("zigimg"); const Allocator = std.mem.Allocator; /// Convert a zigimg.Image into an SDL Texture /// # Arguments /// * `renderer`: the renderer onto which to generate the texture. /// Use the same renderer to display that texture. /// * `ima...
src/utils.zig
const std = @import("std"); const states = @import("state.zig"); const State = states.State; const style = @embedFile("style.css"); fn printToc(state: *State, stream: var) !void { var it = state.map.iterator(); try stream.print("<ul>", .{}); var buf = try state.allocator.alloc(u8, 1024); defer state...
src/htmlgen.zig
const std = @import("std"); const mem = std.mem; const State = @import("ast.zig").State; const Parser = @import("parse.zig").Parser; const Node = @import("parse.zig").Node; const Lexer = @import("lexer.zig").Lexer; const TokenId = @import("token.zig").TokenId; const log = @import("log.zig"); pub fn stateAtxHeader(p: *...
src/md/parse_atx_heading.zig
const std = @import("std"); const essence = @import("essence"); const sga = essence.sga; fn decompress(allocator: std.mem.Allocator, args: [][:0]const u8) !void { if (args.len != 2) return error.InvalidArgs; var archive_path = args[0]; var out_dir_path = args[1]; var archive_file = try std.fs.cwd().o...
tools/sgatool.zig
const sf = struct { pub usingnamespace @import("../sfml.zig"); pub usingnamespace sf.system; pub usingnamespace sf.graphics; }; const CircleShape = @This(); // Constructor/destructor /// Inits a circle shape with a radius. The circle will be white and have 30 points pub fn create(radius: f32) !CircleSha...
src/sfml/graphics/CircleShape.zig
usingnamespace @import("./DOtherSideTypes.zig"); pub extern fn dos_qcoreapplication_application_dir_path() [*c]u8; pub extern fn dos_qcoreapplication_process_events(flags: enum_DosQEventLoopProcessEventFlag) void; pub extern fn dos_qcoreapplication_process_events_timed(flags: enum_DosQEventLoopProcessEventFlag, ms: c_...
src/DOtherSide.zig
const std = @import("std"); const info = std.log.info; const warn = std.log.warn; const n64 = @import("n64.zig"); const Controller = n64.Controller; const PIFCommand = enum(u8) { GetStatus = 0x00, GetButtons = 0x01, WriteMemcard = 0x03, Reset = 0xFF, }; // PIF constants pub const pifRA...
src/core/pif.zig
const std = @import("std"); const utils = @import("utils.zig"); const Registry = @import("registry.zig").Registry; const Storage = @import("registry.zig").Storage; const Entity = @import("registry.zig").Entity; /// single item view. Iterating raw() directly is the fastest way to get at the data. An iterator is also a...
src/ecs/views.zig
const std = @import("std"); const mem = std.mem; const assert = std.debug.assert; const ir = @import("ir.zig"); const Type = @import("type.zig").Type; const Value = @import("value.zig").Value; const Target = std.Target; pub const ErrorMsg = struct { byte_offset: usize, msg: []const u8, }; pub const Symbol = s...
src-self-hosted/codegen.zig
const std = @import("std"); const testing = std.testing; const triangle = @import("triangle.zig"); test "equilateral all sides are equal" { const actual = comptime try triangle.Triangle.init(2, 2, 2); comptime testing.expect(actual.isEquilateral()); } test "equilateral any side is unequal" { const actual...
exercises/practice/triangle/test_triangle.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
pub const STBI_default = @enumToInt(enum_unnamed_1.STBI_default); pub const STBI_grey = @enumToInt(enum_unnamed_1.STBI_grey); pub const STBI_grey_alpha = @enumToInt(enum_unnamed_1.STBI_grey_alpha); pub const STBI_rgb = @enumToInt(enum_unnamed_1.STBI_rgb); pub const STBI_rgb_alpha = @enumToInt(enum_unnamed_1.STBI_rgb_al...
src/deps/stb/stb_image.zig
const std = @import("std"); const Currency = @import("Currency.zig"); const armors = @import("armors.zig"); const Armor = armors.Armor; const Shield = armors.Shield; const weapons = @import("weapons.zig"); const Weapon = weapons.Weapon; const tools = @import("tools.zig"); const Tool = tools.Tool; const tt = @import("...
src/dnd/char.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; //-------------------------------------------------------------------------------------------------- pub fn print(grid: [10][10]u8) void { for (grid) |row| { std.log.info("{d}", .{row}); } std.log.inf...
src/day11.zig
const std = @import("std"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const alloc = &gpa.allocator; const PassportCheck = struct { byr: bool = false, iyr: bool = false, eyr: bool = false, hgt: bool = false, hcl: bool = false, ecl: bool = false, pid: bool = false, //cid: bool =...
Day4/day4.zig
const std = @import("std"); const c = @import("../../c_global.zig").c_imp; // dross-zig const Vector2 = @import("../../core/vector2.zig").Vector2; const tx = @import("../texture.zig"); const Texture = tx.Texture; // ----------------------------------------------------------------------------- // --------------...
src/utils/profiling/frame_statistics.zig
const DEBUGMODE = @import("builtin").mode == @import("builtin").Mode.Debug; const std = @import("std"); const sg = @import("sokol").gfx; const sapp = @import("sokol").app; const stime = @import("sokol").time; const sgapp = @import("sokol").app_gfx_glue; const sdtx = @import("sokol").debugtext; const sa = @import("sok...
src/main.zig
const c = @import("c.zig"); const utils = @import("utils.zig"); const std = @import("std"); usingnamespace @import("log.zig"); // zig fmt: off pub const Load = struct { pub const default = 0x0; pub const no_scale = 1 << 0; pub const no_hinting = 1 << 1; pub const render = 1 << 2; pub const no_bitm...
src/kiragine/kira/freetype2.zig
const std = @import("std"); const sfml = @import("sfml.zig"); const system = @import("system.zig"); pub const c = @cImport({ @cInclude("SFML/Window.h"); }); fn cStringLength(buffer: anytype) usize { var len: usize = 0; while (buffer[len] != 0) : (len += 1) {} return len; } pub const clipboard = struct { ...
src/window.zig
const std = @import("std"); const assert = std.debug.assert; const zig = std.zig; pub fn build(b: *std.build.Builder) !void { try generateEntities(); const mode = b.standardReleaseOptions(); const lib = b.addStaticLibrary("htmlentities.zig", "src/main.zig"); lib.setBuildMode(mode); lib.install(); ...
build.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const meta = std.meta; const mcp = @import("mcproto.zig"); const serde = @import("serde.zig"); const VarNum = @import("varnum.zig").VarNum; const VarInt = VarNum(i32); const VarLong = VarNum(i64); const nbt = @import("nbt.zig"); pub const blockgen = @imp...
src/chunk.zig
const std = @import("std"); const os = std.os; const unistd = @cImport({ @cInclude("unistd.h"); }); const signal = @cImport({ @cInclude("signal.h"); }); const stat = @cImport({ @cInclude("sys/stat.h"); }); /// Any error that might come up during process daemonization const DaemonizeError = error{FailedT...
src/daemonize.zig