code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const mecha = @import("mecha"); const testing = std.testing; const mem = std.mem; const Allocator = mem.Allocator; pub const Semver = struct { major: u64, minor: u64, patch: u64, const semver = mecha.combine(.{ mecha.int(u64, .{ .base = 10 }), mecha.utf8.ch...
src/main.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const print = std.debug.print; const data = @embedFile("../inputs/day19.txt"); pub fn main() anyerror!void { var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa_impl.deinit(); const gpa = gpa_impl.allocator(); return m...
src/day19.zig
const std = @import("std"); const process = @import("../process.zig"); const platform = @import("../platform.zig"); const util = @import("../util.zig"); const w3 = @import("../wasm3.zig"); const wasi = @import("wasm/wasi.zig"); const Process = process.Process; pub const Runtime = struct { pub const Args = struc...
kernel/runtime/wasm.zig
const std = @import("std"); const math = std.math; const Allocator = std.mem.Allocator; const FLIR = @This(); const print = std.debug.print; const CFO = @import("./CFO.zig"); const swap = std.mem.swap; const builtin = @import("builtin"); const s2 = builtin.zig_backend != .stage1; const ArrayList = std.ArrayList; cons...
src/Old_FLIR.zig
const std = @import("std"); const fs = std.fs; const Allocator = std.mem.Allocator; pub const SpectralType = enum(u8) { O, B, A, F, G, K, M, }; pub const SkyCoord = packed struct { right_ascension: f32, declination: f32, }; pub const Constellation = struct { boundaries: []SkyC...
prepare-data/src/main.zig
const std = @import("../std.zig"); const os = std.os; const testing = std.testing; const expect = std.testing.expect; const io = std.io; const fs = std.fs; const mem = std.mem; const elf = std.elf; const File = std.fs.File; const Thread = std.Thread; const a = std.debug.global_allocator; const builtin = @import("buil...
lib/std/os/test.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const builtin = @import("builtin"); test "compile time recursion" { expect(some_data.len == 21); } var some_data: [@intCast(usize, fibonacci(7))]u8 = undefined; fn fibonacci(x: i32) i32 { if (x <= 1) ret...
test/stage1/behavior/eval.zig
const std = @import("std"); const raw = struct { extern fn zig_log_message(level: c_int, msg: [*:0]const u8) void; extern fn printk(msg: [*:0]const u8, data: u8) void; extern fn uptime_ticks() i64; }; // Get the uptime in ticks. pub fn uptime() i64 { return raw.uptime_ticks(); } // A single shared ...
zephyr.zig
const std = @import("std"); const upaya = @import("upaya.zig"); /// reads the contents of a file. Returned value is owned by the caller and must be freed! pub fn read(allocator: *std.mem.Allocator, filename: []const u8) ![]u8 { const file = try std.fs.cwd().openFile(filename, .{}); defer file.close(); con...
src/fs.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/day13.txt"); co...
src/day13.zig
pub const CTL_E_ILLEGALFUNCTIONCALL = @as(i32, -2146828283); pub const CONNECT_E_FIRST = @as(i32, -2147220992); pub const SELFREG_E_FIRST = @as(i32, -2147220992); pub const PERPROP_E_FIRST = @as(i32, -2147220992); pub const OLECMDERR_E_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221248)); pub const ...
win32/system/ole.zig
//-------------------------------------------------------------------------------- // Section: Types (15) //-------------------------------------------------------------------------------- const CLSID_Catalog_Value = Guid.initString("6eb22881-8a19-11d0-81b6-00a0c9231c29"); pub const CLSID_Catalog = &CLSID_Catalog_Valu...
win32/system/transaction_server.zig
const std = @import("std"); const print = std.debug.print; const Pos = struct { x: usize, y: usize }; const Grid = struct { allocator: *std.mem.Allocator, grid: *[1000][1000]bool, pub fn init(allocator: *std.mem.Allocator) !Grid { var grid = try allocator.create([1000][1000]bool); for (g...
src/day06.zig
const std = @import("std"); const Allocator = std.mem.Allocator; /// A node in a circular double linked list. // /// The most useful property is that a node can remove itself from a list without having a referece /// to it with O(1) time complexity. One node is selected to act as the head of the list. Iteration /// i...
list.zig
pub const E_SURFACE_CONTENTS_LOST = @as(u32, 2150301728); //-------------------------------------------------------------------------------- // Section: Types (19) //-------------------------------------------------------------------------------- const IID_ISurfaceImageSourceNative_Value = @import("../../zig.zig").Gui...
win32/system/win_rt/xaml.zig
const std = @import("std"); const TypeInfo = std.builtin.TypeInfo; const warn = std.debug.warn; pub fn CanonicalHuffmanTree(comptime Tlen: type, max_len: usize) type { return struct { const Self = @This(); pub const Tval: type = @Type(TypeInfo{ .Int = .{ .is_signed = fa...
src/huffman.zig
const std = @import("std"); usingnamespace @import("common.zig"); usingnamespace @import("compiler.zig"); usingnamespace @import("lexer.zig"); usingnamespace @import("parser.zig"); usingnamespace @import("ast.zig"); usingnamespace @import("type_checker.zig"); usingnamespace @import("error_handler.zig"); using...
src/job.zig
const os = @import("root").os; const paging = os.memory.paging; const platform = os.platform; const libalign = os.lib.libalign; const std = @import("std"); pub const MemmapEntry = packed struct { base: u64, length: u64, type: u32, unused: u32, pub fn format(self: *const MemmapEntry, fmt: []const u8, opt...
src/boot/stivale_common.zig
const std = @import("std"); const path = std.fs.path; const assert = std.debug.assert; const target_util = @import("target.zig"); const Compilation = @import("Compilation.zig"); const build_options = @import("build_options"); const trace = @import("tracy.zig").trace; const libcxxabi_files = [_][]const u8{ "src/ab...
src/libcxx.zig
const std = @import("std"); const builtin = @import("builtin"); const mem = std.mem; const expectEqual = std.testing.expectEqual; const Vector = std.meta.Vector; const minInt = std.math.minInt; const maxInt = std.math.maxInt; const Op = enum { add, sub, mul, shl }; fn testSaturatingOp(comptime op: Op, comptime T: type...
test/behavior/saturating_arithmetic.zig
const math = @import("std").math; const gmath = @import("gmath.zig").gmath(f64); const Jazbz = @import("jabz.zig").Jazbz(f64); const AzBz = Jazbz.AzBz; const colors = @import("colors.zig").Colors(Jazbz); const GridSize = @import("gridsize.zig").GridSize; const V2 = @import("affine.zig").V2; const v2 = @import("affine...
lib/debug_shaders.zig
const std = @import("std"); const zp = @import("zplay.zig"); const GraphicsContext = zp.graphics.common.Context; const event = zp.event; const sdl = zp.deps.sdl; /// application context pub const Context = struct { /// internal window window: sdl.Window, /// graphics context graphics: GraphicsContext ...
src/core.zig
const std = @import("std"); const gemtext = @import("../gemtext.zig"); const Fragment = gemtext.Fragment; /// Renders a sequence of fragments into a gemini text document. /// `fragments` is a slice of fragments which describe the document, /// `writer` is a `std.io.Writer` structure that will be the target of the docu...
src/renderers/gemtext.zig
const std = @import("std"); const Arena = std.heap.ArenaAllocator; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const yeti = @import("yeti"); const initCodebase = yeti.initCodebase; const tokenize = yeti.tokenize; const parse = yeti.parse; const analyzeSemanti...
src/tests/test_arrays.zig
pub const D3D10_16BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 65535); pub const D3D10_32BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 4294967295); pub const D3D10_8BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 255); pub const D3D10_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT = @as(u32, 9); pub const D3D10_CLIP_OR_CULL_DISTANCE_COUNT = @as(u32, 8); pub ...
deps/zigwin32/win32/graphics/direct3d10.zig
const std = @import("std"); const assert = std.debug.assert; /// All integers are in big-endian format (needs a byteswap). pub const ExecHdr = extern struct { magic: u32, text: u32, data: u32, bss: u32, syms: u32, /// You should truncate this to 32 bits on 64 bit systems, then but the actual 8 ...
src/link/Plan9/aout.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const SueComparison = enum { eq, gt, lt }; const SueComparer = struct { value: u8 = 0, real_comparer: SueComparison = SueComparison.eq, fn real_compare(self: SueComparer, other: u8) bool { return switch (self.real_comparer) { S...
src/main/zig/2015/day16.zig
const std = @import("std"); const zang = @import("zang"); const note_frequencies = @import("zang-12tet"); const common = @import("common.zig"); const c = @import("common/c.zig"); const Instrument = @import("scriptgen.zig").Instrument; pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb; pub const AUDIO_SAMPLE_RAT...
examples/example_script.zig
const std = @import("std"); const os = std.os; const utils = @import("utils.zig"); // Shorthand for comparing a [*:0] to a []const u8 const eql = utils.eql; const print = utils.print; const Files = std.ArrayList(File); const File = struct { time: i128, name: []const u8, kind: std.fs.Dir.Entry.Kind, }; co...
main.zig
pub const PRINTTICKET_ISTREAM_APIS = @as(u32, 1); pub const S_PT_NO_CONFLICT = @as(u32, 262145); pub const S_PT_CONFLICT_RESOLVED = @as(u32, 262146); pub const E_PRINTTICKET_FORMAT = @as(u32, 2147745795); pub const E_PRINTCAPABILITIES_FORMAT = @as(u32, 2147745796); pub const E_DELTA_PRINTTICKET_FORMAT = @as(u32, 214774...
win32/graphics/printing/print_ticket.zig
const std = @import("std"); const SDL = @import("sdl2"); const zigimg = @import("zigimg"); const utils = @import("utils.zig"); /// # Usage /// Specify the relative path to an image from the command line as an argument to this executable. /// This image will be displayed. /// # Example /// This will open the given bmp ...
src/main.zig
const std = @import("std"); const print = std.debug.print; pub fn main() anyerror!void { const allocator = std.heap.page_allocator; var file = try std.fs.cwd().openFile( "./inputs/day08.txt", .{ .read = true, }, ); var reader = std.io.bufferedReader(file.reader())....
src/day08.zig
const std = @import("std"); const os = std.os; const print = std.debug.print; const net = std.net; const fmt = std.fmt; const mem = std.mem; const io = std.io; pub fn main() !void { var allocator = std.heap.page_allocator; var args = os.argv; if (args.len < 3) { print("usage: tcp_client hostname po...
chap03/tcp_client.zig
const std = @import("std"); const math = std.math; const testing = std.testing; const __divxf3 = @import("divxf3.zig").__divxf3; fn compareResult(result: f80, expected: u80) bool { const rep = @bitCast(u80, result); if (rep == expected) return true; // test other possible NaN representations (signal NaN)...
lib/compiler_rt/divxf3_test.zig
const std = @import("std"); const terminal = @import("zig-terminal"); const ArrayList = std.ArrayList; const Op = enum { add, subtract, multiply, divide, }; const Token = union(enum) { paren: u8, op: Op, number: []u8, }; fn tokenize(src: []u8, allocator: *std.mem.Allocator) ![]Token { ...
src/main.zig
const std = @import("std"); pub const DebugInterface = struct { const Self = @This(); pub const TraceError = error{DebugBreak}; traceInstructionFn: fn (self: *Self, ip: u16, instruction: Instruction, input0: u16, input1: u16, output: u16) void, traceAddressFn: fn (self: *Self, virt: u16) TraceError!v...
tools/common/spu-mk2.zig
const std = @import("std"); const xr = @import("openxr"); const c = @import("c.zig"); const Allocator = std.mem.Allocator; const BaseDispatch = struct { xrCreateInstance: xr.PfnCreateInstance, usingnamespace xr.BaseWrapper(@This()); }; const InstanceDispatch = struct { xrDestroyInstance: xr.PfnDestroyInst...
examples/test.zig
const std = @import("std"); const big = std.math.big; const heap = std.heap; const io = std.io; const mem = std.mem; usingnamespace @import("primitive_types.zig"); const bigint = @import("bigint.zig"); const PrimitiveReader = @import("primitive/reader.zig").PrimitiveReader; const RowData = @import("frame.zig").RowD...
src/iterator.zig
const std = @import("std"); const object = @import("object.zig"); const Value = object.Value; const Allocator = std.mem.Allocator; const assert = std.debug.assert; // Notes: // // Lua tables are a combination of an array and a hash table // where contiguous integer keys from 1..n are stored in an array // while any ot...
src/table.zig
const __fixdfsi = @import("fixdfsi.zig").__fixdfsi; const std = @import("std"); const math = std.math; const testing = std.testing; const warn = std.debug.warn; fn test__fixdfsi(a: f64, expected: i32) !void { const x = __fixdfsi(a); //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", .{a, @bitCast(u64,...
lib/std/special/compiler_rt/fixdfsi_test.zig
const std = @import("std"); pub const MethodType = enum { Connect, Custom, Delete, Get, Head, Options, Patch, Post, Put, Trace, }; pub const Method = union(MethodType) { Connect: void, Custom: []const u8, Delete: void, Get: void, Head: void, Options: voi...
src/methods.zig
usingnamespace @import("../engine/engine.zig"); const Literal = @import("../parser/literal.zig").Literal; const LiteralValue = @import("../parser/literal.zig").LiteralValue; const MapTo = @import("mapto.zig").MapTo; const MapToValue = @import("mapto.zig").MapToValue; const std = @import("std"); const testing = std.tes...
src/combn/combinator/sequence.zig
const std = @import("std"); const fs = std.fs; const io = std.io; const log = std.log; const mem = std.mem; const process = std.process; const time = std.time; const allocator = std.heap.page_allocator; const c = @cImport({ @cInclude("SDL.h"); }); const chip8 = @import("chip8.zig"); const ErrorSet = error{SDLE...
src/main.zig
const std = @import("std"); const instr = @import("instr.zig"); const Bus = @import("Bus.zig"); const Self = @This(); const Reg0 = 0; const Reg1 = 1; const Reg2 = 2; const Reg3 = 3; const Reg4 = 4; const Reg5 = 5; const Reg6 = 6; const Reg7 = 7; const Reg8 = 8; const Reg9 = 9; const Reg10 = 10; const Reg11 = 11; const...
src/Cpu.zig
const std = @import("std"); const zCord = @import("zCord"); const WorkContext = @import("WorkContext.zig"); const util = @import("util.zig"); test { _ = WorkContext; _ = util; } const auto_restart = true; //const auto_restart = std.builtin.mode == .Debug; pub usingnamespace if (auto_restart) RestartHandler ...
src/main.zig
const std = @import("std"); const ArrayList = std.ArrayList; const expect = std.testing.expect; const print = std.debug.print; const eql = std.mem.eql; const meta = std.meta; const Vector = meta.Vector; const len = std.mem.len; const test_allocator = std.testing.allocator; pub fn main() void { print("Hello, {s}!\n...
main.zig
const Server = @This(); const lsp = @import("lsp"); const std = @import("std"); const tres = @import("tres"); arena: std.heap.ArenaAllocator, parser: std.json.Parser, read_buf: std.ArrayList(u8), write_buf: std.ArrayList(u8), const SampleDirection = enum { client_to_server, server_to_client, }; const Sampl...
tests/tests.zig
const std = @import("std"); const Answer = struct { @"0": u32, @"1": u32 }; fn count_candidates(candidates: []bool) u32 { var n: u32 = 0; for (candidates) |candidate| { if (candidate) { n += 1; } } return n; } fn find_candidate(candidates: []bool) ?usize { for (candidat...
src/day03.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const testing = std.testing; const Allocator = mem.Allocator; const ArrayList = std.ArrayList; /// String struct; compatible with c-style strings pub const String = struct { bytes: []const u8 = "\x00", allocator: ?*Allocator = null, ...
strings.zig
const std = @import("std"); const printf = std.debug.print; const fs = std.fs; const os = std.os; const io = std.io; const mem = std.mem; const c = @cImport({ @cInclude("sys/ioctl.h"); @cInclude("linux/if_tun.h"); @cInclude("net/if.h"); }); const Error = error{ Create, Read, IfConfig, Get...
src/dev.zig
const x86_64 = @import("../../index.zig"); const bitjuggle = @import("bitjuggle"); const std = @import("std"); /// A physical memory frame. Page size 4 KiB pub const PhysFrame = extern struct { const size: x86_64.structures.paging.PageSize = .Size4KiB; start_address: x86_64.PhysAddr, /// Returns the fram...
src/structures/paging/frame.zig
usingnamespace @import("c.zig"); var initialized: bool = false; var muted: bool = false; //al related data that we save to cleanup later var source: ALuint = undefined; var context: *ALCcontext = undefined; /// Initializes the audio system and opens the wave file. /// Note that it's currently only possible to have 1...
src/audio.zig
const std = @import("std"); const core = @import("graph.zig"); const graph_type = core.Graph; const graph_err = core.GraphError; const print = std.debug.print; const testing = std.testing; const ArrayList = std.ArrayList; const AutoArrayHashMap = std.AutoArrayHashMap; const mem = std.mem; const testing_alloc = std.test...
src/weighted_graph.zig
const std = @import("std"); const math = std.math; const Ip4Address = std.net.Ip4Address; fn permuteFwd(state: *[4]u8) void { state[0] +%= state[1]; state[2] +%= state[3]; state[1] = math.rotl(u8, state[1], 2) ^ state[0]; state[3] = math.rotl(u8, state[3], 5) ^ state[2]; state[0] = math.rotl(u8, s...
src/ipcrypt.zig
const std = @import("std"); const core = @import("core/core.zig"); const glfw = core.glfw; const renderer = core.renderer; const gl = core.gl; const input = core.input; const window = core.window; const fs = core.fs; const c = core.c; const m = core.math; const utils = core.utils; pub const AssetManager = @import("as...
src/private.zig
const builtin = @import("builtin"); const MultiBoot = packed struct { magic: i32, flags: i32, checksum: i32, }; const ALIGN = 1 << 0; const MEMINFO = 1 << 1; const MAGIC = 0x1BADB002; const FLAGS = ALIGN | MEMINFO; export var multiboot align(4) linksection(".multiboot") = MultiBoot{ .magic = MAGIC, ...
src/main.zig
const std = @import("std"); const Builder = @import("std").build.Builder; const c_flags = &[_][]const u8{ "-mcmodel=medany", "-mno-relax", }; const s_files = &[_][]const u8{ "kernel/entry.S", "kernel/swtch.S", "kernel/trampoline.S", "kernel/kernelvec.S", }; const kernel_c_files = &[_][]const ...
build.zig
const c = @import("c.zig"); pub const WindowError = error { InitializationError }; const std = @import("std"); const zlm = @import("zlm"); const Vec2 = zlm.Vec2; // TODO: more inputs and a more efficient way to do them pub const Input = struct { pub const KEY_A = 0; pub const KEY_D = 0; pub const KE...
didot-x11/window.zig
const std = @import("std"); const expect = std.testing.expect; const test_allocator = std.testing.allocator; const Allocator = std.mem.Allocator; const Crabs = struct { const Self = @This(); allocator: Allocator, robots: []i64, pub fn load(allocator: Allocator, str: []const u8) !Self { var rob...
day07/src/main.zig
pub const COMPRESS_ALGORITHM_INVALID = @as(u32, 0); pub const COMPRESS_ALGORITHM_NULL = @as(u32, 1); pub const COMPRESS_ALGORITHM_MAX = @as(u32, 6); pub const COMPRESS_RAW = @as(u32, 536870912); //-------------------------------------------------------------------------------- // Section: Types (6) //-----------------...
win32/storage/compression.zig
const std = @import("std"); const zwin32 = @import("../../libs/zwin32/build.zig"); const ztracy = @import("../../libs/ztracy/build.zig"); const zd3d12 = @import("../../libs/zd3d12/build.zig"); const zmesh = @import("../../libs/zmesh/build.zig"); const common = @import("../../libs/common/build.zig"); const Options = @i...
samples/physically_based_rendering/build.zig
const std = @import("std"); const assert = std.debug.assert; usingnamespace @import("tigerbeetle.zig"); pub const Header = @import("vr.zig").Header; pub const Operation = @import("state_machine.zig").Operation; var accounts = [_]Account{ Account{ .id = 1, .custom = 0, .flags = .{}, ...
src/benchmark.zig
// DO NOT MODIFY. This is not actually a source file; it is a textual representation of generated code. // Use only for debugging purposes. // Auto-generated constructor // Access: public Method <init> : V ( // (no arguments) ) { ALOAD 0 // Method descriptor: ()V INVOKESPECIAL java/lang/Object#<init>...
target/generated-sources/gizmo/io/quarkus/runner/AutoFeature.zig
comptime { asm ( \\.section .text.start \\.globl _start \\_start: \\ .long __stack_start \\ .long ipl_main \\ .long nm_interrupt \\ .long hard_fault \\ .long irq4 \\ .long irq5 \\ .long irq6 \\ .long irq7 \\ .long irq8 ...
src/ipl.zig
const std = @import("std"); const root = @import("root"); const mem = std.mem; const os = std.os; /// We use this as a layer of indirection because global const pointers cannot /// point to thread-local variables. pub var interface = std.rand.Random{ .fillFn = tlsCsprngFill }; const os_has_fork = switch (std.Target....
lib/std/crypto/tlcsprng.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 int = i64; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../dat...
src/template.zig
const Wwise = @import("../wwise.zig").Wwise; const ImGui = @import("../imgui.zig").ImGui; const DemoInterface = @import("demo_interface.zig").DemoInterface; const std = @import("std"); pub const SubtitleDemo = struct { subtitleText: [:0]const u8 = undefined, subtitleIndex: u32 = 0, subtitlePosition: u32 = ...
src/demos/subtitle_demo.zig
const std = @import("std"); const builtin = @import("builtin"); const warn = std.debug.print; const Allocator = std.mem.Allocator; const thread = @import("../thread.zig"); const config = @import("../config.zig"); const GUIError = error{ Init, Setup }; var vg: [*c]c.NVGcontext = undefined; const c = @cImport({ @c...
src/gui/glfw.zig
const std = @import("std"); const os = std.os; const mem = std.mem; const testing = std.testing; const assert = std.debug.assert; test "communication via dgram connection-less unix domain socket" { const socket = try os.socket( os.AF_UNIX, os.SOCK_DGRAM | os.SOCK_CLOEXEC, os.PF_UNIX, );...
poc/ipc_dgram_socket.zig
const Allocator = std.mem.Allocator; const Data = @import("../events/events.zig").Data; const Event = @import("../events/events.zig").Event; const Headers = @import("http").Headers; const Method = @import("http").Method; const Request = @import("../events/events.zig").Request; const State = @import("states.zig").State;...
src/state_machines/client.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const Validation = struct { const Validators = std.StringHashMap(aoc.Regex); validators: Validators, fn init(allocator: std.mem.Allocator) !Validation { var validation = Validation { .validators = Validators.init(allocator) }; ...
src/main/zig/2020/day04.zig
pub extern fn sg_setup(desc: [*c]const sg_desc) void; pub extern fn sg_shutdown() void; pub extern fn sg_isvalid() bool; pub extern fn sg_reset_state_cache() void; pub extern fn sg_install_trace_hooks(trace_hooks: [*c]const sg_trace_hooks) sg_trace_hooks; pub extern fn sg_push_debug_group(name: [*c]const u8) void; pub ...
src/deps/sokol/sokol_gfx.zig
const zang = @import("zang"); const note_frequencies = @import("zang-12tet"); const common = @import("common.zig"); const c = @import("common/c.zig"); const PMOscInstrument = @import("modules.zig").PMOscInstrument; const FilteredSawtoothInstrument = @import("modules.zig").FilteredSawtoothInstrument; pub const AUDIO_FO...
examples/example_play.zig
const std = @import("std"); pub fn Fixbuf(comptime max_len: usize) type { return struct { const Self = @This(); data: [max_len]u8 = undefined, len: usize = 0, pub fn copyFrom(self: *@This(), data: []const u8) void { std.mem.copy(u8, &self.data, data); self....
src/util.zig
const std = @import("std"); const Url = @import("../url.zig").Url; pub const TagList = std.ArrayList(Tag); const Real = f64; pub const TagType = enum { container, text }; pub const Color = packed struct { red: u8, green: u8, blue: u8, alpha: u8 = 255 }; pub const SizeUnit = union(enum) { ...
zervo/markups/imr.zig
const std = @import("std"); const assert = std.debug.assert; const Allocator = std.mem.Allocator; const termios = @cImport(@cInclude("termios.h")); const Vec2 = @import("geometry.zig").Vec2; const World = @import("World.zig"); var old_settings_global: termios.struct_termios = undefined; var in_raw_mode_global: bool ...
src/main.zig
const std = @import("std"); const sdl = @import("sdl"); const renderkit = @import("renderkit"); pub const WindowConfig = struct { title: [:0]const u8 = "Zig GameKit", // the window title as UTF-8 encoded string width: i32 = 800, // the preferred width of the window / canvas height: i32 = 600, // the prefer...
gamekit/window.zig
const std = @import("../../std.zig"); const maxInt = std.math.maxInt; const linux = std.os.linux; const SYS = linux.SYS; const iovec = std.os.iovec; const iovec_const = std.os.iovec_const; const pid_t = linux.pid_t; const uid_t = linux.uid_t; const gid_t = linux.gid_t; const clock_t = linux.clock_t; const stack_t = li...
lib/std/os/linux/x86_64.zig
const std = @import("std"); const zig = std.zig; const fs = std.fs; const mem = std.mem; const Allocator = mem.Allocator; const Node = zig.ast.Node; const Tree = zig.ast.Tree; const TokenIndex = zig.ast.TokenIndex; const Options = @import("main.zig").Options; const rules = @import("rules.zig"); pub const Message = str...
src/linter.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "PS2", .filter = .info, }).write; const apic = @import("apic.zig"); const ports = @import("ports.zig"); const eoi = @import("apic.zig").eoi; const interrupts = @import("interrupts.zig"); const kb = lib.input.keyboard; con...
subprojects/flork/src/platform/x86_64/ps2.zig
const std = @import("std"); const mem = std.mem; pub const Token = struct { id: Id, start: usize, end: usize, pub const Id = enum { invalid, identifier, string_literal, integer_literal, float_literal, char_literal, colon, comma, l...
src/tokenize.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day20.txt"); const Input = struct { enhancement: [512]u8 = undefined, image: [100][100]u8 = undefined, dim: usize, pub fn init(input_text: []const u8, allocator: std.mem.Allocator) !@This() { _ = al...
src/day20.zig
const std = @import("std"); const math = std.math; /// A radian-to-degree converter specialized for longitude values. /// If the resulting degree value would be greater than 180 degrees, /// 360 degrees will be subtracted - meaning that this function returns /// values in a range of [-180, 180] degrees. const rad...
night-math/src/math_utils.zig
const clap = @import("clap"); const format = @import("format"); const std = @import("std"); const ston = @import("ston"); const util = @import("util"); const debug = std.debug; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const log = std.log; const mem = std.mem; const os = std.os;...
src/randomizers/tm35-rand-learned-moves.zig
const c = @import("c.zig"); const builtin = @import("builtin"); const debug = @import("std").debug; const math = @import("std").math; pub const ClientApi = enum { Unknown, OpenGL, Vulkan, }; // Data var g_Window: ?*c.GLFWwindow = null; var g_ClientApi: ClientApi = .Unknown; var g_Time: f64 = 0.0; var g_Mo...
examples/imgui-dice-roller/src/glfw_impl.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const crc32 = std.hash.crc; const mem = std.mem; const testing = std.testing; const tagLiteral = 0x00; const tagCopy1 = 0x01; const tagCopy2 = 0x02; const tagCopy4 = 0x03; const checksumSize = 4; const chunkHeaderSize = 4; const magicBody = "sNaPpY"; co...
snappy.zig
const getty = @import("../../../lib.zig"); const std = @import("std"); pub fn Visitor(comptime Array: type) type { return struct { const Self = @This(); pub usingnamespace getty.de.Visitor( Self, Value, undefined, undefined, undefined, ...
src/de/impl/visitor/array.zig
const std = @import("std"); const zloppy = @import("zloppy.zig"); // zig fmt: off const test_cases_off = [_]TestCase{ .{ .input = \\fn foo(bar: bool) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ , .expected = \\fn foo...
src/test.zig
const std = @import("std"); const expect = std.testing.expect; const test_allocator = std.testing.allocator; const Allocator = std.mem.Allocator; const Point = struct { const Self = @This(); x: u64, y: u64, pub fn parse(str: []const u8) !Self { var numIter = std.mem.tokenize(u8, str, ","); ...
day05/src/main.zig
pub const std = @import("std"); pub const math = @import("../math/math.zig"); pub const sdf = @import("sdf.zig"); pub const SdfInfo = @import("sdf_info.zig").SdfInfo; pub const IterationContext = @import("iteration_context.zig").IterationContext; pub const EnterInfo = IterationContext.EnterInfo; pub fn combinatorExitC...
src/sdf/sdf_util.zig
//-------------------------------------------------------------------------------- // Section: Types (1) //-------------------------------------------------------------------------------- pub const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE = enum(u32) { NEAREST_NEIGHBOR = 0, LINEAR = 1, CUBIC = 2, MULT...
win32/graphics.zig
const std = @import("std"); const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; /// Chart building block characters const Font = struct { blankspace: u8, horizontal: []const u8, vertical: []const u8, top_left: []const u8, mid_left: []const u8, low_left: []const u8, top_cen...
src-zig/chart.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const fmt = std.fmt; const testing = std.testing; const heap = std.heap; const meta = std.meta; const ArrayList = std.ArrayList; pub const Request = struct { const Self = @This(); request_line: RequestLine, headers: ArrayList(Heade...
src/parsing.zig
const std = @import("std"); pub use std.os.windows; pub const ATOM = u16; pub const LONG_PTR = usize; pub const HWND = HANDLE; pub const HICON = HANDLE; pub const HCURSOR = HANDLE; pub const HBRUSH = HANDLE; pub const HMENU = HANDLE; pub const HDC = HANDLE; pub const HDROP = HANDLE; pub const LPARAM = LONG_...
src/app/windows/native.zig
const std = @import("std"); const Square = struct { opened: bool, mine: bool, flagged: bool, }; pub const SquareInfo = struct { opened: bool, mine: bool, flagged: bool, n_mines_around: u8, }; pub const GameStatus = enum { PLAY, WIN, LOSE }; pub const Game = struct { allocator: *std....
src/core.zig
const std = @import("std"); const assert = std.debug.assert; const zp = @import("../../zplay.zig"); const stb_image = zp.deps.stb.image; const Texture = zp.graphics.common.Texture; const Self = @This(); pub const Error = error{ LoadImageError, }; /// gpu texture tex: *Texture, /// format of image format: Texture...
src/graphics/texture/TextureCube.zig
const std = @import("std"); const webgpu = @import("../../webgpu.zig"); const dummy = @import("./dummy.zig"); pub const CommandBuffer = struct { const vtable = webgpu.CommandBuffer.VTable{ .destroy_fn = destroy, }; super: webgpu.CommandBuffer, pub fn create(device: *dummy.Device, descriptor:...
src/backends/dummy/command.zig
const std = @import("std"); const crypto = std.crypto; const fmt = std.fmt; const testing = std.testing; pub const Error = error{InvalidUUID}; pub const UUID = struct { bytes: [16]u8, pub fn init() UUID { var uuid = UUID{ .bytes = undefined }; crypto.random.bytes(&uuid.bytes); // Ve...
uuid.zig
const std = @import("std"); const u = @import("util.zig"); const CodePoint = struct { bytes: u.Txt, offset: usize, scalar: u21, pub fn end(self: CodePoint) usize { return self.offset + self.bytes.len; } }; bytes: u.Txt, i: usize = 0, cur: ?CodePoint, const Self = @This(); const eofBytes ...
src/TextIterator.zig
const std = @import("index.zig"); const builtin = @import("builtin"); const io = std.io; const mem = std.mem; const debug = std.debug; const assert = debug.assert; const warn = std.debug.warn; const ArrayList = std.ArrayList; const HashMap = std.HashMap; const Allocator = mem.Allocator; const os = std.os; const StdIo =...
std/build.zig