code
stringlengths
38
801k
repo_path
stringlengths
6
263
const builtin = @import("builtin"); const std = @import("../../std.zig"); const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; const ldexp_cexp = @import("ldexp.zig").ldexp_cexp; /// Returns the hyperbolic sine of z. pub fn sinh(z: anytype) @TypeOf(z) { c...
lib/std/math/complex/sinh.zig
const std = @import("../std.zig"); const builtin = @import("builtin"); const assert = std.debug.assert; const maxInt = std.math.maxInt; const elf = std.elf; const vdso = @import("linux/vdso.zig"); const dl = @import("../dynamic_library.zig"); const native_arch = builtin.cpu.arch; const native_endian = native_arch.endia...
lib/std/os/linux.zig
const Atom = @This(); const std = @import("std"); const elf = std.elf; const log = std.log.scoped(.elf); const math = std.math; const mem = std.mem; const Allocator = mem.Allocator; const Elf = @import("../Elf.zig"); /// Each decl always gets a local symbol with the fully qualified name. /// The vaddr and size are f...
src/Elf/Atom.zig
const std = @import("std"); const vk = @import("vulkan"); const c = @import("c.zig"); const err = @import("err.zig"); pub usingnamespace @import("types.zig"); //// Misc //// pub fn init() !void { // This is a backcompat thing and we're a new library, so disable it unconditionally glfwInitHint(c.GLFW_JOYSTICK...
glfz.zig
const builtin = @import("builtin"); const is_test = builtin.is_test; const std = @import("std"); const maxInt = std.math.maxInt; const LDBL_MANT_DIG = 113; pub extern fn __floattitf(arg: i128) f128 { @setRuntimeSafety(is_test); if (arg == 0) return 0.0; var ai = arg; const N: u32 = 128; ...
lib/std/special/compiler_rt/floattitf.zig
const std = @import("../../../std.zig"); const pid_t = linux.pid_t; const uid_t = linux.uid_t; const clock_t = linux.clock_t; const stack_t = linux.stack_t; const sigset_t = linux.sigset_t; const linux = std.os.linux; const sockaddr = linux.sockaddr; const socklen_t = linux.socklen_t; const iovec = linux.iovec; const ...
lib/std/os/bits/linux/sparc64.zig
const std = @import("std"); const warn = @import("nonsecure-common/debug.zig").warn; const port = @import("ports/" ++ @import("build_options").BOARD ++ "/nonsecure.zig"); // FreeRTOS-related thingy const os = @cImport({ @cInclude("FreeRTOS.h"); @cInclude("task.h"); @cInclude("timers.h"); }); comptime { ...
examples/nonsecure-rtosbasic.zig
const std = @import("std"); const root = @import("main.zig"); const math = std.math; const assert = std.debug.assert; const panic = std.debug.panic; const expectEqual = std.testing.expectEqual; pub const Vec3 = Vector3(f32); pub const Vec3_f64 = Vector3(f64); pub const Vec3_i32 = Vector3(i32); pub const Vec3_usize = V...
src/vec3.zig
const __fixsfti = @import("fixsfti.zig").__fixsfti; const std = @import("std"); const math = std.math; const testing = std.testing; const warn = std.debug.warn; fn test__fixsfti(a: f32, expected: i128) void { const x = __fixsfti(a); //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u128, {x})\n", .{a, @bitCast(u32...
lib/std/special/compiler_rt/fixsfti_test.zig
const std = @import("std"); const testing = std.testing; const mimalloc_allocator = @import("main.zig").mimalloc_allocator; test "allocate memory and free" { const TestStruct = struct { width: i32, height: i32, title: []const u8, index: usize, }; const memory: []TestStruct ...
src/tests.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const expect = std.testing.expect; pub fn DynamicArray(comptime T: type) type { return struct { const Self = @This(); count: usize, capacity: usize, items: []T, allocator: *Allocator, pub fn init(allo...
src/dynamic_array.zig
export fn mission3_main() noreturn { Bss.prepare(); Exceptions.prepare(); Uart.prepare(); Timer0.prepare(); Timer1.prepare(); Timer2.prepare(); LedMatrix.prepare(); ClockManagement.prepareHf(); CycleActivity.prepare(); TerminalActivity.prepare(); I2c0.prepare(); Accel....
mission3_sensors.zig
const std = @import("std"); const c = @import("c.zig"); const util = @import("util.zig"); // TODO: calculate this whole error and function below at comptime const CompilationError = error{ // Success = 0 InvalidStage, CompilationError, InternalError, NullResultObject, InvalidAssembly, Vali...
src/shaderc.zig
const std = @import("std"); const path = std.fs.path; const lexer = @import("lexer.zig"); const parser = @import("parser.zig"); const errors = @import("errors.zig"); pub const ProcessDetails = struct { included_files: [][]const u8 }; pub fn process( alloc: std.mem.Allocator, tokens: []const lexer.Token, ra...
src/preproc.zig
const std = @import("std"); const upaya = @import("upaya"); const ts = @import("../tilescript.zig"); usingnamespace @import("imgui"); var buffer: [5]u8 = undefined; var inspected_object_index: ?usize = null; pub fn draw(state: *ts.AppState) void { if (state.prefs.windows.object_editor) { igPushStyleVarVec...
tilescript/windows/object_editor.zig
usingnamespace @import("../engine/engine.zig"); const std = @import("std"); const testing = std.testing; const mem = std.mem; pub const AlwaysVoid = struct { pub fn deinit(self: *const @This(), allocator: *mem.Allocator) void {} }; /// If the result is not `null`, its `.offset` value will be updated to reflect t...
src/combn/combinator/always.zig
const std = @import("std"); const Span = @import("basics.zig").Span; pub const InterpolationFunction = enum { linear, smoothstep, }; pub const CurveNode = struct { value: f32, t: f32, }; // curves are like notes except the value will be interpolated in between them. // they can't be created in real-t...
src/zang/mod_curve.zig
const std = @import("std"); pub fn main() anyerror!void { std.log.info("All your codebase are belong to us.", .{}); } const expect = @import("std").testing.expect; const mem = @import("std").mem; // Declare an enum. const Type = enum { ok, not_ok, }; // Declare a specific instance of the enum variant. co...
enums/src/main.zig
pub const WLDP_LOCKDOWN_UNDEFINED = @as(u32, 0); pub const WLDP_LOCKDOWN_DEFINED_FLAG = @as(u32, 2147483648); pub const WLDP_LOCKDOWN_CONFIG_CI_FLAG = @as(u32, 1); pub const WLDP_LOCKDOWN_CONFIG_CI_AUDIT_FLAG = @as(u32, 2); pub const WLDP_LOCKDOWN_UMCIENFORCE_FLAG = @as(u32, 4); pub const WLDP_LOCKDOWN_AUDIT_FLAG = @as...
win32/system/windows_programming.zig
pub const InstructionName = enum(u8) { nop = 0, scope_push = 1, // deprecated scope_pop = 2, // deprecated declare = 3, // deprecated store_global_name = 4, // deprecated load_global_name = 5, // deprecated push_str = 6, push_num = 7, array_pack = 8, call_fn = 9, call_obj = 1...
src/library/common/ir.zig
const std = @import("std"); const common = @import("common.zig"); const rom = @import("rom.zig"); pub const encodings = @import("gen4/encodings.zig"); pub const offsets = @import("gen4/offsets.zig"); pub const script = @import("gen4/script.zig"); comptime { _ = encodings; } const debug = std.debug; const io = s...
src/core/gen4.zig
const common = @import("common.zig"); const mecha = @import("mecha"); const std = @import("std"); const ston = @import("ston"); const util = @import("util"); const fmt = std.fmt; const math = std.math; const mem = std.mem; const meta = std.meta; const testing = std.testing; const escape = util.escape; // The tm35 fo...
src/core/format.zig
usingnamespace @import("aoc-lib.zig"); const rollWays = [_]usize{1,3,6,7,6,3,1}; const Game = struct { start : [2]usize, d : usize, fn fromInput(inp: []const u8, allocator: *Allocator) !*Game { var g = try allocator.create(Game); var n : usize = 0; var p : usize = 0; for (...
2021/21/aoc.zig
const std = @import("std"); const gc = @import("gc.zig"); const InterpreterError = @import("vm.zig").InterpreterError; const Heap = gc.Heap; const HeapId = gc.HeapId; const vm = @import("vm.zig").vm; const range = @import("utils.zig").range; var format_level: u8 = 0; pub const Object = struct { id: HeapId, ...
src/value.zig
const std = @import("std"); const print = std.debug.print; const ParseIntError = std.fmt.ParseIntError; const util = @import("util.zig"); const data = @embedFile("../data/day01.txt"); const Str = []const u8; pub const LineIter = struct { _iter: std.mem.SplitIterator(u8), const Self = @This(); pub fn in...
src/day01.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; const with_dissassemble = false; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const Computer = tools.IntCode_Computer; pub fn run(input...
2019/day21.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const Registers = [6]u64; const Opcode = enum { addi, addr, muli, mulr, bani, banr, bori, borr, setr, seti, gtir, gtri, gtrr, eqir, eqri, eqrr }; fn eval(op: Opcode, par: [3]u32, r: Registers) Registers { var o = r; sw...
2018/day19.zig
const std = @import("std"); const utils = @import("utils"); const georgios = @import("georgios.zig"); const memory = @import("memory.zig"); pub const FileError = error { /// The operation is not supported. Unsupported, /// An Implementation-Related Error Occured. Internal, InvalidFileId, } || uti...
libs/georgios/io.zig
const sf = @import("../sfml.zig"); const Time = @This(); // Constructors /// Converts a time from a csfml object /// For inner workings pub fn _fromCSFML(time: sf.c.sfTime) Time { return Time{ .us = time.microseconds }; } /// Converts a time to a csfml object /// For inner workings pub fn _toCSFML(self: Time) ...
src/sfml/system/Time.zig
const std = @import("std"); pub fn build(b: *std.build.Builder) void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for rest...
build.zig
const expect = @import("std").testing.expect; const mem = @import("std").mem; const Tag = @import("std").meta.Tag; const Small2 = enum(u2) { One, Two }; const A = enum(u3) { One, Two, Three, Four, One2, Two2, Three2, Four2 }; const B = enum(u3) { One3, Two3, Three3, Four3, One23, Two23, Three23, Four23 }; const C = e...
test/behavior/enum_stage1.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const Metadata = @import("metadata.zig").Metadata; const id3v1 = @import("id3v1.zig"); // needed for genre ID lookup for gnre atom // Some atoms can be "full atoms", meaning they have an additional 4 bytes // for a version and some flags. pub const FullA...
src/mp4.zig
pub fn Register(comptime R: type) type { return RegisterRW(R, R); } pub fn RegisterRW(comptime Read: type, comptime Write: type) type { return struct { raw_ptr: *volatile u32, const Self = @This(); pub fn init(address: usize) Self { return Self{ .raw_ptr = @intToPtr(*volat...
registers.zig
usingnamespace @import("bits.zig"); pub const SOCKET = *opaque {}; pub const INVALID_SOCKET = @intToPtr(SOCKET, ~@as(usize, 0)); pub const SOCKET_ERROR = -1; pub const WSADESCRIPTION_LEN = 256; pub const WSASYS_STATUS_LEN = 128; pub const WSADATA = if (@sizeOf(usize) == @sizeOf(u64)) extern struct { wVer...
lib/std/os/windows/ws2_32.zig
const std = @import("std"); const mem = std.mem; const primes = [_]u64{ 0xa0761d6478bd642f, 0xe7037ed1a0b428db, 0x8ebc6af09c88c6e3, 0x589965cc75374cc3, 0x1d8e4e27c47d124f, }; fn read_bytes(comptime bytes: u8, data: []const u8) u64 { return mem.readVarInt(u64, data[0..bytes], .Little); } fn re...
std/hash/wyhash.zig
const Archive = @This(); const std = @import("std"); const assert = std.debug.assert; const fs = std.fs; const log = std.log.scoped(.macho); const macho = std.macho; const mem = std.mem; const fat = @import("fat.zig"); const Allocator = mem.Allocator; const Object = @import("Object.zig"); file: fs.File, name: []cons...
src/MachO/Archive.zig
const std = @import("std"); const assert = std.debug.assert; const zephyr = @import("zephyr.zig"); const FlashArea = zephyr.flash.FlashArea; const image = @import("image.zig"); const Image = image.Image; pub const TlvTag = enum(u16) { KeyHash = 0x01, PubKey = 0x02, Sha256 = 0x10, RSA2048_PSS = 0x20, ...
tlv.zig
const Allocator = std.mem.Allocator; const Header = @import("http").Header; const Headers = @import("http").Headers; const Method = @import("http").Method; const std = @import("std"); const Uri = @import("http").Uri; const Version = @import("http").Version; const BodyType = enum { ContentLength, Empty, }; co...
src/request.zig
const fmath = @import("index.zig"); pub fn log2(x: var) -> @typeOf(x) { const T = @typeOf(x); switch (T) { f32 => @inlineCall(log2f, x), f64 => @inlineCall(log2d, x), else => @compileError("log2 not implemented for " ++ @typeName(T)), } } fn log2f(x_: f32) -> f32 { const ivln2h...
src/log2.zig
pub const DWRITE_ALPHA_MAX = @as(u32, 255); pub const FACILITY_DWRITE = @as(u32, 2200); pub const DWRITE_ERR_BASE = @as(u32, 20480); pub const DWRITE_E_REMOTEFONT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2003283955)); pub const DWRITE_E_DOWNLOADCANCELLED = @import("../zig.zig").typedConst(HRESULT, @as(i32,...
win32/graphics/direct_write.zig
pub const PERCEIVEDFLAG_UNDEFINED = @as(u32, 0); pub const PERCEIVEDFLAG_SOFTCODED = @as(u32, 1); pub const PERCEIVEDFLAG_HARDCODED = @as(u32, 2); pub const PERCEIVEDFLAG_NATIVESUPPORT = @as(u32, 4); pub const PERCEIVEDFLAG_GDIPLUS = @as(u32, 16); pub const PERCEIVEDFLAG_WMSDK = @as(u32, 32); pub const PERCEIVEDFLAG_ZI...
win32/ui/shell/common.zig
pub const MBEDTLS_ERR_PK_ALLOC_FAILED = -0x3F80; pub const MBEDTLS_ERR_PK_BAD_INPUT_DATA = -0x3E80; pub const MBEDTLS_ERR_PK_FILE_IO_ERROR = -0x3E00; pub const MBEDTLS_ERR_ERROR_GENERIC_ERROR = -0x0001; pub const MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED = -0x006E; pub...
src/bits.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 parseInt = std.fmt.parseInt; const tokenize = std.mem.tokenize; const split = std.mem.split; const util = @import("util.zig...
src/day02.zig
const std = @import("std"); const assert = std.debug.assert; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); var input_file = try std.fs.cwd().openFile("input/13.txt", .{}); defer input_file.close(); var buffe...
src/13.zig
const std = @import("std"); const Target = std.Target; const llvm = @import("llvm.zig"); pub fn getDarwinArchString(self: Target) [:0]const u8 { const arch = self.getArch(); switch (arch) { .aarch64 => return "arm64", .thumb, .arm, => return "arm", .powerpc => return "pp...
src-self-hosted/util.zig
const sqrt = @import("std").math.sqrt; pub fn Vector(comptime T: type) type { return struct { const Self = @This(); x: T, y: T, z: T, pub fn new(x: T, y: T, z: T) Self { return Self{ .x = x, .y = y, .z = z }; } pub fn up() Self { ret...
zigray/vector.zig
const std = @import("std"); const palette = @import("palette.zig"); const Palette = palette.Palette; const Color = palette.Color; const mem = std.mem; usingnamespace @import("mecha"); fn testParser(comptime parser: anytype, comptime examples: anytype) !void { var fail = std.testing.FailingAllocator.init(std.te...
pal/pal/parser.zig
const builtin = @import("builtin"); const std = @import("std"); //===========================================================================// /// A simple spin-lock. pub const SpinLock = struct { // TODO: Instead of just storing 1 for held, we should store the thread ID // of the holding thread. Then we co...
src/ziegfried/spinlock.zig
const tIndex = enum(u3) { Alpha, Hex, Space, Digit, Lower, Upper, // Ctrl, < 0x20 || == DEL // Print, = Graph || == ' '. NOT '\t' et cetera Punct, Graph, //ASCII, | ~0b01111111 //isBlank, == ' ' || == '\x09' }; const combinedTable = init: { comptime var table: [256]...
std/ascii.zig
const std = @import("std"); pub fn build(b: *std.build.Builder) !void { // Working Windows target provided for convenience const target = if (b.option(bool, "windows", "Cross-compile to Windows") orelse false) std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu } e...
examples/build.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 Note = opaque { pub fn deinit(self: *Note) void { log.debug("Note.deinit called", .{}); c.git_note_free(@...
src/notes.zig
const var extern packed export pub noalias inline comptime nakedcc stdcallcc volatile align linksection threadlocal const as = 2; union struct enum error asd { .asd = asd, } fn dump( value: var.asda.ad.asd, // NYI some arg asdasd: Baddad ) void { } "for" break return continue asm defer errde...
Syntaxes/samples.zig
const zm = @import("zetamath"); usingnamespace @import("zetarender"); const std = @import("std"); const UBO = extern struct { model: zm.Mat44f, view: zm.Mat44f, proj: zm.Mat44f, }; const Vertex = extern struct { const Self = @This(); pos: zm.Vec2f, color: zm.Vec3f, pub fn new(pos: zm.Ve...
examples/simple-render/main.zig
pub const D3DCOMPILER_DLL = "d3dcompiler_47.dll"; pub const D3DCOMPILE_OPTIMIZATION_LEVEL2 = @as(u32, 49152); pub const D3D_COMPILE_STANDARD_FILE_INCLUDE = @as(u32, 1); pub const D3D_COMPILER_VERSION = @as(u32, 47); pub const D3DCOMPILE_DEBUG = @as(u32, 1); pub const D3DCOMPILE_SKIP_VALIDATION = @as(u32, 2); pub const ...
deps/zigwin32/win32/graphics/hlsl.zig
const kernel = @import("../kernel.zig"); const TODO = kernel.TODO; const log = kernel.log.scoped(.x86_64); pub const page_size = kernel.arch.check_page_size(0x1000); pub const Stivale2 = @import("x86_64/limine/stivale2/stivale2.zig"); pub const Spinlock = @import("x86_64/spinlock.zig"); pub const PIC = @import("x86_...
src/kernel/arch/x86_64.zig
/// Esc represents the Ansi Escape code. pub const Esc: []const u8 = "\x1b"; /// EscapePrefix represents the common "Esc[" escaping prefix pattern. pub const EscapePrefix: []const u8 = Esc ++ "["; /// Reset represents the reset code. All text attributes will be turned off. pub const Reset: []const u8 = "0"; /// cur...
src/codes.zig
const std = @import("std"); const mem = std.mem; const Ambiguous = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 161, hi: u21 = 1114109, pub fn init(allocator: *mem.Allocator) !Ambiguous { var instance = Ambiguous{ .allocator = allocator, .array = try allocator.alloc(bool, 1113949...
src/components/autogen/DerivedEastAsianWidth/Ambiguous.zig
const std = @import("std"); const c = @cImport({ @cInclude("stdio.h"); @cInclude("stdlib.h"); @cInclude("string.h"); @cInclude("time.h"); @cInclude("lauxlib.h"); @cInclude("lua.h"); @cInclude("lualib.h"); @cInclude("libavcodec/avcodec.h"); @cInclude("libavformat/avformat.h"); ...
src/main.zig
const std = @import("std"); const Timezone = @import("datetime.zig").Timezone; const create = Timezone.create; // Timezones pub const Africa = struct { pub const Abidjan = create("Africa/Abidjan", 0); pub const Accra = create("Africa/Accra", 0); pub const Addis_Ababa = create("Africa/Addis_Ababa", 180); ...
src/time/timezones.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const GPA = std.heap.GeneralPurposeAllocator; const Error = std.mem.Allocator.Error; // set io_mode pub const io_mode = .evented; /// Buff struct /// size the size of the buffer /// addr the address of the undelying memory block /// offset the first unu...
async_buff.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); pub fn run(input_text: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { const ans1 = ans: { var mem = try allocator.alloc(u36, 100000); defer allocator.free(mem); std.mem.set(u36, mem, 0);...
2020/day14.zig
const std = @import("std"); const testing = std.testing; const seperatorBonus = 5; const adjacentCaseEqualBonus: i32 = 3; const unmatchedLetterPenalty = -1; const adjecencyBonus = 5; const adjecencyIncrease = 1.2; const caseEqualBonus: i32 = 7; const firstLetterBonus = 12; const leadingLetterPenalty = -3; const maxLea...
src/main.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_test.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const testing = std.testing; const input_file = "input08.txt"; const Op = enum(u8) { /// No Operation nop, /// Add signed 16-bit immediate to accumulator acc16, /// Jump by signed 16-bit immediate jmp16, _, pub fn len(se...
src/08.zig
const std = @import("std"); const bigint = std.math.big.int; const math = std.math; var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var global_allocator = &gpa.allocator; const Pair = struct { p: bigint.Managed, q: bigint.Managed, pub fn deinit(self: *Pair) void { defer self.p.deinit(); ...
bench/algorithm/edigits/1.zig
const watchdog = @import("watchdog.zig"); const cpu = @import("mk20dx256.zig"); const interrupt = @import("interrupt.zig"); const config = @import("config.zig"); const systick = @import("systick.zig"); extern fn _eram() void; extern var _etext: usize; extern var _sdata: usize; extern var _edata: usize; extern var _s...
src/teensy3_2/init.zig
const std = @import("std"); const args_parser = @import("args"); const img = @import("img"); const qoi = @import("qoi"); const Cli = struct { help: bool = false, }; pub fn main() !u8 { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); v...
src/convert.zig
const c = @cImport({ @cInclude("cfl_group.h"); }); const widget = @import("widget.zig"); pub const GroupPtr = ?*c.Fl_Group; pub const Group = struct { inner: ?*c.Fl_Group, pub fn new(x: i32, y: i32, w: i32, h: i32, title: [*c]const u8) Group { const ptr = c.Fl_Group_new(x, y, w, h, title); ...
src/group.zig
const std = @import("std"); const mem = std.mem; const unicode = std.unicode; const CaseFoldMap = @This(); allocator: *std.mem.Allocator, map: std.AutoHashMap(u21, []const u21), pub fn init(allocator: *std.mem.Allocator) !CaseFoldMap { var instance = CaseFoldMap{ .allocator = allocator, .map = st...
src/components/autogen/CaseFolding/CaseFoldMap.zig
const std = @import("std"); const fs = std.fs; const io = std.io; const math = std.math; const mem = std.mem; const net = std.net; const os = std.os; const rand = std.rand; const time = std.time; const assert = std.debug.assert; const expect = std.testing.expect; const avl = @import("avl.zig"); const config = @impor...
src/main.zig
const builtin = @import("builtin"); const build_options = @import("build_options"); const std = @import("std"); const json = std.json; const log = std.log; const fs = std.fs; const Sha1 = std.crypto.hash.Sha1; const Base64 = std.base64.url_safe_no_pad.Encoder; // Foilz Archive Util const foilz = @import("archiver.zi...
src/wrapper.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const input = @embedFile("../input/day19.txt"); var rules: [133][]const u8 = undefined; const Key = struct { start: usize, len: usize, rule: usize, }; var cache: std.AutoHashMap...
src/day19.zig
const Self = @This(); const std = @import("std"); const zt = @import("zt"); const ig = @import("imgui"); const sling = @import("sling.zig"); /// Do not manipulate this directly, instead used the setX methods provided. position: sling.math.Vec2 = .{}, /// Do not manipulate this directly, instead used the setX methods p...
src/camera.zig
const std = @import("std"); pub fn build(b: *std.build.Builder) void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for rest...
build.zig
const std = @import("std"); const hyperia = @import("hyperia.zig"); const mem = std.mem; const mpmc = hyperia.mpmc; const testing = std.testing; pub fn ObjectPool(comptime T: type, comptime capacity: comptime_int) type { return struct { const Self = @This(); queue: mpmc.Queue(*T, capacity) align(...
object_pool.zig
const arduino = @import("arduino"); const std = @import("std"); const dht = arduino.lib.dht; // Necessary, and has the side effect of pulling in the needed _start method pub const panic = arduino.start.panicLogUart; // until the compilert works, code from __udivmodhi4: fn udivmod(_num: u16, _den: u16) struct { div: u...
examples/dht22_to_uart.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const meta = std.meta; const trait = std.meta.trait; const assert = std.debug.assert; const testing = std.testing; const mustache = @import("../mustache.zig"); const RenderOptions = mustache.options.RenderOptions; const Delimiters = mustache.Delimiters;...
src/rendering/context.zig
const std = @import("std"); const Value = @import("value.zig").Value; const assert = std.debug.assert; const Allocator = std.mem.Allocator; const Target = std.Target; const Module = @import("Module.zig"); /// This is the raw data, with no bookkeeping, no memory awareness, no de-duplication. /// It's important for this...
src/type.zig
const std = @import("std.zig"); const mem = std.mem; const builtin = std.builtin; const Version = std.builtin.Version; /// TODO Nearly all the functions in this namespace would be /// better off if https://github.com/ziglang/zig/issues/425 /// was solved. pub const Target = struct { cpu: Cpu, os: Os, abi: ...
lib/std/target.zig
const std = @import("std"); const Compilation = @import("compilation.zig").Compilation; const llvm = @import("llvm.zig"); const c = @import("c.zig"); const ir = @import("ir.zig"); const Value = @import("value.zig").Value; const Type = @import("type.zig").Type; const Scope = @import("scope.zig").Scope; const util = @imp...
src-self-hosted/codegen.zig
const uefi = @import("std").os.uefi; const Guid = uefi.Guid; const Time = uefi.Time; const Status = uefi.Status; pub const FileProtocol = extern struct { revision: u64, _open: extern fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) Status, _close: extern fn (*const FileProtocol) Sta...
lib/std/os/uefi/protocols/file_protocol.zig
const std = @import("std"); const mem = std.mem; const math = std.math; const assert = std.debug.assert; const Allocator = mem.Allocator; const term = @import("prim.zig"); // promote some primitive ops pub const size = term.size; pub const ignoreSignalInput = term.ignoreSignalInput; pub const handleSignalInput = term....
src/box.zig
const std = @import("std"); const Trigger = @import("trigger.zig").Trigger; const Impulse = @import("notes.zig").Impulse; const Notes = @import("notes.zig").Notes; const Span = @import("basics.zig").Span; const span = Span.init(0, 1024); const ExpectedResult = struct { start: usize, end: usize, params: f...
src/zang/trigger_test.zig
const std = @import("std"); const ELF = @import("../elf.zig"); const phdr = @import("../data-structures/phdr.zig"); const shdr = @import("../data-structures/shdr.zig"); const ehdr10 = @import("../data-structures/ehdr.zig"); const shdrErrors = error{ no_string_table, E_Shoff_shnum_shentsize_is_zero, }; fn shdr...
src/functions/shdr.zig
const std = @import("std"); const assert = std.debug.assert; pub const Accum = struct { count: usize, values: std.AutoHashMap(usize, isize), pub fn init() Accum { const allocator = std.heap.direct_allocator; return Accum{ .count = 0, .values = std.AutoHashMap(usize,...
2018/p01/accum.zig
const std = @import("std"); const epoch = std.time.epoch; const testing = std.testing; const DateError = error{ InvalidDate, }; const Date = struct { year: u16, month: u8, day: u8, }; const MeacalDate = struct { year: u8, month: u8, day: u8, }; pub fn convertDateStringToDate(date_string...
zig/src/date.zig
//-------------------------------------------------------------------------------- // Section: Types (10) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows10.0.10240' const IID_IRandomAccessStreamFileAccessMode_Value = @import("../../z...
win32/system/win_rt/storage.zig
const std = @import("std"); const mecha = @import("mecha/mecha.zig"); const reflect = @import("reflect.zig"); const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const net = std.net; const os = std.os; const testing = std.testing; usingnamespac...
src/xcb.zig
const std = @import("std"); const flags = @import("flags"); const path = std.fs.path; const fmt = @import("../fmt.zig"); const exports = @import("pkg/exports"); const Export = exports.Export; const Pkg = Export.Pkg; const File = std.fs.File; const Command = flags.Command; const Flag = flags.Flag; const Context = flags...
src/cmd/pkg/exports.zig
const std = @import("std"); const gl = @import("zgl"); const glfw = @import("zglfw"); const renz = @import("renz"); pub fn main() !void { try glfw.init(); defer glfw.terminate(); glfw.windowHint(.ClientAPI, @enumToInt(glfw.APIAttribute.OpenGLAPI)); glfw.windowHint(.ContextVersionMajor, 4); glfw.wi...
example/hello.zig
const std = @import("std"); const root = @import("main.zig"); const tls = root.tls; const Self = @This(); tls_configuration: root.TlsConfiguration, tls_context: *tls.tls, tcp_stream: std.net.Stream, address: ?std.net.Address = null, const WrapError = error{ OutOfMemory, BadTlsConfiguration, TlsConnectSocket, TlsAcce...
src/SslStream.zig
const std = @import("std"); const testing = std.testing; const allocator = std.heap.page_allocator; const memory_size = 30_000; const max_file_size = 1024 * 1024 * 1024; pub fn main() anyerror!void { const args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); const std...
src/main.zig
const std = @import("std"); const c = @import("c.zig"); const shaderc = @import("shaderc.zig"); pub const Blit = struct { const Self = @This(); device: c.WGPUDeviceId, bind_group_layout: c.WGPUBindGroupLayoutId, tex_sampler: c.WGPUSamplerId, bind_group: ?c.WGPUBindGroupId, render_pipeline: ...
src/blit.zig
const std = @import("std"); const bcm2835 = @import("../bcm2835.zig"); const gpio = @import("../gpio.zig"); const mocks = @import("mocks.zig"); const peripherals = @import("../peripherals.zig"); test "SetLevel - High" { std.testing.log_level = .debug; var allocator = std.testing.allocator; var gpiomem = tr...
src/integration-tests/bcm2835.zig
const Allocator = std.mem.Allocator; const Headers = @import("http").Headers; const parseHeaders = @import("headers.zig").parse; const ParsingError = @import("errors.zig").ParsingError; const StatusCode = @import("http").StatusCode; const std = @import("std"); const Version = @import("http").Version; pub const Respons...
src/events/response.zig
const std = @import("std"); const pike = @import("pike.zig"); const windows = @import("os/windows.zig"); const ws2_32 = @import("os/windows/ws2_32.zig"); const io = std.io; const os = std.os; const net = std.net; const mem = std.mem; const meta = std.meta; var OVERLAPPED = windows.OVERLAPPED{ .Internal = 0, .Internal...
socket_windows.zig
usingnamespace @import("root").preamble; const kb = lib.input.keyboard; pub const KeyboardLayout = enum { en_US_QWERTY, sv_SE_QWERTY, }; // Keys that are common between keyboard layouts fn keyLookupDefault(key: kb.keys.Location) error{UnknownKey}!kb.keys.Input { return switch (key) { .escape => ....
lib/input/keyboard/layouts.zig
const std = @import("std"); const Channel = @import("../utils/channel.zig").Channel; const url = @import("../utils/url.zig"); const GlobalEventUnion = @import("../main.zig").Event; const Chat = @import("../Chat.zig"); const BorkConfig = @import("../main.zig").BorkConfig; const Network = @import("../Network.zig"); const...
src/remote/Server.zig
const std = @import("std"); const Token = struct { kind: enum { nil, comment, section, identifier, value, }, value: ?[]const u8, }; const TokenizerState = enum(u3) { nil, comment, section, identifier, value, string, }; const booleanMap = std....
src/ini.zig
const std = @import("../std.zig"); const builtin = std.builtin; const mem = std.mem; pub fn Writer( comptime Context: type, comptime WriteError: type, comptime writeFn: fn (context: Context, bytes: []const u8) WriteError!usize, ) type { return struct { context: Context, const Self = @T...
lib/std/io/writer.zig