code
stringlengths
38
801k
repo_path
stringlengths
6
263
const TestContext = @import("../../src-self-hosted/test.zig").TestContext; const std = @import("std"); const ErrorMsg = @import("../../src-self-hosted/Module.zig").ErrorMsg; const linux_x64 = std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .linux, }; pub fn addCases(ctx: *TestContext) !void { ctx.com...
test/stage2/compile_errors.zig
const inputFile = @embedFile("./input/day15.txt"); const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Str = []const u8; const BitSet = std.DynamicBitSet; const StrMap = std.StringHashMap; const HashMap = std.HashMap; const Map = std.AutoHashMap; const PriorityQueue = std...
src/day15.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/day15.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; pub var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; pub const gpa = gpa_impl.allocator(); // Add...
src/util.zig
const c = @import("c.zig"); const nk = @import("../nuklear.zig"); const std = @import("std"); const testing = std.testing; pub const Text = c.nk_text_edit; pub const Flags = struct { read_only: bool = false, auto_select: bool = false, sig_enter: bool = false, allow_tab: bool = false, no_cursor: b...
src/edit.zig
const std = @import("std"); const core = @import("core/core.zig"); const renderer = core.renderer; const gl = core.gl; const alog = std.log.scoped(.alka); pub const Error = error{ AssetAlreadyExists, FailedToAllocate, InvalidAssetID } || core.Error; pub const AssetManager = struct { fn GenericType(comptime T: t...
src/assetmanager.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/parser/byte_range.zig
const std = @import("std"); const mem = std.mem; const log = std.log; const fs = std.fs; const exempt_files = [_][]const u8{ // This file is maintained by a separate project and does not come from glibc. "abilists", // Generated files. "include/libc-modules.h", "include/config.h", // These a...
tools/update_glibc.zig
const std = @import("std"); const clap = @import("clap"); const net = @import("net"); usingnamespace @import("commands.zig"); const Command = enum { fetch, search, tags, add, remove, }; fn printUsage() noreturn { const stderr = std.io.getStdErr().writer(); _ = stderr.write( \\zkg <...
src/main.zig
const std = @import("std"); const fs = std.fs; const io = std.io; const info = std.log.info; const print = std.debug.print; const fmt = std.fmt; const ArrayList = std.ArrayList; const utils = @import("utils.zig"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; // Edit input1 to calc p1, by defualt this calculate...
day_19/src/main.zig
const std = @import("std"); const ray = @import("translate-c/raylib.zig"); const BroadPhase = @import("physic/BroadPhase.zig"); const basic_type = @import("physic/basic_type.zig"); const Vec2 = basic_type.Vec2; const Rect = basic_type.Rect; const Index = basic_type.Index; const Proxy = BroadPhase.Proxy; const QueryCall...
src/main.zig
const std = @import("std"); const Pkg = std.build.Pkg; const FileSource = std.build.FileSource; const LibExeObjStep = std.build.LibExeObjStep; fn concat(lhs: []const u8, rhs: []const u8) []const u8 { if (std.testing.allocator.alloc(u8, lhs.len + rhs.len)) |buf| { for (lhs) |c, i| { buf[...
pkgs/glfw/pkg.zig
const wchar_t = c_int; const __off_t = c_long; const __off64_t = c_long; const _IO_lock_t = anyopaque; const union_unnamed_5 = extern union { __wch: c_uint, __wchb: [4]u8, }; const __mbstate_t = extern struct { __count: c_int, __value: union_unnamed_5, }; const struct___va_list_tag = extern struct { ...
gamekit/deps/sdl/sdl.zig
// SPDX-License-Identifier: MIT // This file is part of the `termcon` project under the MIT license. pub const Style = struct { fg_color: Color, bg_color: Color, text_decorations: TextDecorations, const Self = @This(); pub fn equal(self: *const Self, other: Style) bool { return self.fg_c...
src/view/style.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const data = @embedFile("data/day12.txt"); const EntriesList = std.ArrayList(Record); const Record = struct { x: usize = 0, }; const north: u32 = 0; const east: u32 =...
src/day12.zig
pub const PspCtrlButtons = extern enum(c_uint) { Select = 1, Start = 8, Up = 16, Right = 32, Down = 64, Left = 128, LTrigger = 256, RTrigger = 512, Triangle = 4096, Circle = 8192, Cross = 16384, Square = 32768, Home = 65536, Hold = 131072, Note = 8388608, ...
src/psp/sdk/pspctrl.zig
const std = @import("std"); const testing = std.testing; const os = std.os; const io = std.io; const mem = std.mem; const net = std.net; const assert = std.debug.assert; const kisa = @import("kisa"); const rpc = @import("rpc.zig"); const state = @import("state.zig"); const Config = @import("config.zig").Config; const t...
src/main.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const mem = std.mem; 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"); pub const CRTFile = enum { crt...
src/musl.zig
const std = @import("std"); const string = []const u8; const gpa = std.heap.c_allocator; const inquirer = @import("inquirer"); const detectlicense = @import("detect-license"); const knownfolders = @import("known-folders"); const ini = @import("ini"); const u = @import("./../util/index.zig"); // // const s_in_y = std...
src/cmd/init.zig
const Archive = @This(); const std = @import("std"); const fmt = std.fmt; const fs = std.fs; const mem = std.mem; const log = std.log.scoped(.archive); const Allocator = std.mem.Allocator; file: fs.File, name: []const u8, // We need to differentiate between inferred and output archive type, as other ar // programs ...
src/archive/Archive.zig
const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; var x: i32 = 1; test "create a coroutine and cancel it" { var da = std.heap.DirectAllocator.init(); defer da.deinit(); const p = try async<&da.allocator> simpleAsyncFn(); comptime assert(@typeOf(p) == pro...
test/cases/coroutines.zig
const std = @import("std"); const types = @import("types.zig"); const URI = @import("uri.zig"); const analysis = @import("analysis.zig"); const DocumentStore = @This(); pub const Handle = struct { document: types.TextDocument, count: usize, import_uris: std.ArrayList([]const u8), pub fn uri(handle: H...
src/document_store.zig
const std = @import("std"); const Image = @import("image.zig").Image; const Allocator = std.mem.Allocator; pub const PngError = error { InvalidHeader, InvalidFilter, UnsupportedFormat }; const ChunkStream = std.io.FixedBufferStream([]u8); // PNG files are made of chunks which have this structure: const C...
didot-image/png.zig
const std = @import("std"); pub const pkgs = struct { pub const requestz = std.build.Pkg{ .name = "requestz", .path = .{ .path = ".gyro\\requestz-ducdetronquito-0.1.1-68845cbcc0c07d54a8cd287ad333ba84\\pkg\\src\\main.zig" }, .dependencies = &[_]std.build.Pkg{ std.build.Pkg{ ...
deps.zig
const hc256 = @import("hc256"); const Hc256 = hc256.Hc256; const std = @import("std"); const testing = std.testing; test "Vector 1" { const key = [32]u8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; const iv = [32]u8{ ...
tests/test-vectors.zig
const std = @import("std"); const log = std.log; const DFS = @import("utils.zig").DepthFirstIterator; const ast = @import("ast.zig"); const Node = ast.Node; const NodeKind = ast.NodeKind; pub const HTMLGenerator = struct { allocator: *std.mem.Allocator, start_node: *Node, label_node_map: std.StringHashMa...
src/html.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(...
2016/day14.zig
pub const DEDUP_CHUNKLIB_MAX_CHUNKS_ENUM = @as(u32, 1024); //-------------------------------------------------------------------------------- // Section: Types (24) //-------------------------------------------------------------------------------- const CLSID_DedupBackupSupport_Value = @import("../zig.zig").Guid.initS...
win32/storage/data_deduplication.zig
const kernel = @import("root").kernel; const Console = kernel.Console; const HexColor = Console.HexColor; const util = @import("util.zig"); const out8 = util.out8; const in8 = util.in8; const platform = @import("platform.zig"); const code_point_437 = @import("code_point_437.zig"); const Color = enum(u4) { Black ...
kernel/platform/cga_console.zig
const std = @import("std"); const c = @cImport({ @cInclude("stdlib.h"); }); const powtens = [_]f64{ 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22, }; fn is_digit(b: u8) bool { return (b >= '0' and b <= '9');...
src/parse-float.zig
const std = @import("std"); const mem = std.mem; const expect = std.testing.expect; // normal comment /// this is a documentation comment /// doc comment line 2 fn emptyFunctionWithComments() void {} test "empty function with comments" { emptyFunctionWithComments(); } test "truncate" { try expect(testTrunca...
test/behavior/basic.zig
// Because SPIR-V requires re-compilation anyway, and so hot swapping will not work // anyway, we simply generate all the code in flushModule. This keeps // things considerably simpler. const SpirV = @This(); const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const log ...
src/link/SpirV.zig
const std = @import("std"); const inputFile = @embedFile("./input/day02.txt"); const forwardLen: usize = "forward ".len; const upLen: usize = "up ".len; const downLen: usize = "down ".len; fn calcPosition(input: []const u8) !i32 { var start: usize = 0; var x: i32 = 0; var y: i32 = 0; while (std.mem.in...
src/day02.zig
const std = @import("std"); const c = @import("c.zig"); const objc = @import("objc.zig"); const object = objc.object; const Class = objc.Class; const id = objc.id; const SEL = objc.SEL; const sel_getUid = objc.sel_getUid; /// Sends a message to an id or Class and returns the return value of the called method pub fn...
modules/platform/vendored/zig-objcrt/src/message.zig
const std = @import("std"); const stdx = @import("stdx"); const string = stdx.string; const ds = stdx.ds; const t = stdx.testing; const graphics = @import("graphics.zig"); const Transform = graphics.transform.Transform; const Color = graphics.Color; const draw_cmd = @import("draw_cmd.zig"); const DrawCommandList = dra...
graphics/src/svg.zig
usingnamespace @import("../engine/engine.zig"); const std = @import("std"); const testing = std.testing; const mem = std.mem; pub fn ReentrantContext(comptime Payload: type, comptime Value: type) type { return *Parser(Payload, Value); } /// Wraps the `input.parser`, allowing it to be reentrant (such as in the ca...
src/combn/combinator/reentrant.zig
const std = @import("std"); const web = @import("zhp"); const Request = web.Request; const Response = web.Response; var gpa = std.heap.GeneralPurposeAllocator(.{}){}; pub const io_mode = .evented; pub const log_level = .debug; /// This handler demonstrates how to send a template resrponse using /// zig's built-in fo...
example/main.zig
const std = @import("std"); const mem = std.mem; const DefaultIgnorableCodePoint = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 173, hi: u21 = 921599, pub fn init(allocator: *mem.Allocator) !DefaultIgnorableCodePoint { var instance = DefaultIgnorableCodePoint{ .allocator = allocator, ...
src/components/autogen/DerivedCoreProperties/DefaultIgnorableCodePoint.zig
const std = @import("std"); const utils = @import("../utils.zig"); pub const CompressionMethod = enum(u16) { none = 0, shrunk, reduced1, reduced2, reduced3, reduced4, imploded, deflated = 8, enhanced_deflated, dcl_imploded, bzip2 = 12, lzma = 14, ibm_terse = 18, ...
src/formats/zip.zig
pub const GNSS_DRIVER_VERSION_1 = @as(u32, 1); pub const GNSS_DRIVER_VERSION_2 = @as(u32, 2); pub const GNSS_DRIVER_VERSION_3 = @as(u32, 3); pub const GNSS_DRIVER_VERSION_4 = @as(u32, 4); pub const GNSS_DRIVER_VERSION_5 = @as(u32, 5); pub const GNSS_DRIVER_VERSION_6 = @as(u32, 6); pub const IOCTL_GNSS_SEND_PLATFORM_CAP...
win32/devices/geolocation.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; //-------------------------------------------------------------------------------------------------- pub fn part1() anyerror!void { const file = std.fs.cwd().openFile("data/day08_input.txt", .{}) catch |err| label: {...
src/day08.zig
/// The function fiatSecp256k1AddcarryxU64 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^64 /// out2 = ⌊(arg1 + arg2 + arg3) / 2^64⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffffffffffff] /// arg3: [0x0 ~> 0xffffffffffffffff] /// Output Boun...
fiat-zig/src/secp256k1_64.zig
const std = @import("std"); const parseInt = std.fmt.parseInt; const indexOf = std.mem.indexOf; const SEP = " -> "; const Coord = struct { x: i32, y: i32 }; const Coords = std.AutoHashMap(Coord, u32); pub fn main() !void { const file = try std.fs.cwd().openFile("../inputs/05.txt", .{}); defer file.close(); ...
2021/zig/05.zig
const xcb = @import("../xcb.zig"); pub const id = xcb.Extension{ .name = "XFree86-VidModeExtension", .global_id = 0 }; pub const SYNCRANGE = u32; pub const DOTCLOCK = u32; pub const ModeFlag = extern enum(c_uint) { @"Positive_HSync" = 1, @"Negative_HSync" = 2, @"Positive_VSync" = 4, @"Negative_VSyn...
src/auto/xf86vidmode.zig
const std = @import("../std.zig"); const CpuFeature = std.Target.Cpu.Feature; const CpuModel = std.Target.Cpu.Model; pub const Feature = enum { @"64bit", a, c, d, e, f, m, relax, reserve_x1, reserve_x10, reserve_x11, reserve_x12, reserve_x13, reserve_x14, res...
lib/std/target/riscv.zig
const assert = @import("std").debug.assert; pub const rune_error: i32 = 0xfffd; pub const max_rune: i32 = 0x10ffff; pub const rune_self: i32 = 0x80; pub const utf_max: usize = 4; const surrogate_min: i32 = 0xD800; const surrogate_max: i32 = 0xDFFF; const t1: i32 = 0x00; // 0000 0000 const tx: i32 = 0x80; // 1000 000...
src/utf8.zig
const std = @import("std"); const Tag = std.zig.Token.Tag; var renames: std.StringHashMap([]const u8) = undefined; const max_source_size = 1024 * 1024; // 1MB ought to be enough for anyone pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const...
src/minifier.zig
pub const spdx = &[_][]const u8{ "0BSD", "AAL", "ADSL", "AFL-1.1", "AFL-1.2", "AFL-2.0", "AFL-2.1", "AFL-3.0", "AGPL-1.0", "AGPL-1.0-only", "AGPL-1.0-or-later", "AGPL-3.0", "AGPL-3.0-only", "AGPL-3.0-or-later", "AMDPLPA", "AML", "AMPAS", "ANTLR-PD...
src/lib.zig
const std = @import("std"); const gen1 = @import("../../gen1/data.zig"); const assert = std.debug.assert; const Effectiveness = gen1.Effectiveness; const S = Effectiveness.Super; const N = Effectiveness.Neutral; const R = Effectiveness.Resisted; const I = Effectiveness.Immune; pub const Type = enum(u8) { Norma...
src/lib/gen2/data/types.zig
const std = @import("std"); const g711 = @import("./g711.zig"); const io = std.io; pub const Header = struct { const Self = @This(); format: u16, num_channels: u16, sample_rate: u32, byte_rate: u32, block_align: u16, bits_per_sample: u16, extension_size: u16, valid_bits_per_sample:...
src/wav/wav.zig
const std = @import("std"); const Context = @import("connection.zig").Context; const Object = @import("connection.zig").Object; // wl_display pub const wl_display_interface = struct { // core global object @"error": ?fn (*Context, Object, Object, u32, []u8) anyerror!void, delete_id: ?fn (*Context, Object, ...
src/foxwhalectl/protocols.zig
const std = @import("std"); const debug = std.debug; const assert = debug.assert; const testing = std.testing; const log = std.log; const mem = std.mem; const Allocator = mem.Allocator; const maxInt = std.math.maxInt; const BufMap = std.BufMap; pub const DotEnv = struct { const Self = @This(); const Error = e...
src/dotenv.zig
const std = @import("std"); const c = @import("c.zig"); const File = std.fs.File; pub fn main() anyerror!void { std.debug.warn("starting zixel\n", .{}); if (c.glfwInit() == c.GLFW_FALSE) { std.debug.warn("failed to initialize glfw\n", .{}); return; } defer c.glfwTerminate(); c.glf...
src/main.zig
const std = @import("std"); const util = @import("util.zig"); const Board = struct { grid: [5][5]u64, marked: [5][5]bool, done: bool, const Self = @This(); fn init() Self { return .{ .grid = undefined, .marked = std.mem.zeroes([5][5]bool), .done = false }; } fn mark(self: *Self, ...
zig/src/day4.zig
const io = @import("io.zig"); const PortIO = io.PortIO; const Serial = io.Serial; const utils = @import("utils.zig"); const Paging = utils.Paging; const interrupts = @import("interrupts.zig"); const InterruptContext = interrupts.InterruptContext; const InterruptError = interrupts.InterruptError; const PIC = @import(...
src/isr.zig
const std = @import("std"); pub const os = @import("../os.zig"); const stivale = @import("stivale_common.zig"); const paging = os.memory.paging; const vmm = os.memory.vmm; const platform = os.platform; const kmain = os.kernel.kmain; const mmio_serial = os.drivers.mmio_serial; const vesa_log = os.drivers.ve...
src/boot/stivale2.zig
const std = @import("std"); const audiometa = @import("audiometa"); const AllMetadata = audiometa.metadata.AllMetadata; const MetadataEntry = audiometa.metadata.MetadataMap.Entry; const FullTextEntry = audiometa.id3v2_data.FullTextMap.Entry; const testing = std.testing; const fmtUtf8SliceEscapeUpper = audiometa.util.fm...
test/parse_tests.zig
// This code was generated by a tool. // IUP Metadata Code Generator // https://github.com/batiati/IUPMetadata // // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. const std = @import("std"); const interop = @import("../interop.zig"); const iup = @import(".....
src/IupMetadata/CodeGenerators/Zig/templates/element.zig
const std = @import("std"); const real_input = @embedFile("day-12_real-input"); const test_input_1 = @embedFile("day-12_test-input-1"); const test_input_2 = @embedFile("day-12_test-input-2"); const test_input_3 = @embedFile("day-12_test-input-3"); pub fn main() !void { std.debug.print("--- Day 12 ---\n", .{}); ...
day-12.zig
const std = @import("std"); const libxml2 = @import("libs/zig-libxml2/libxml2.zig"); const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; const Step = std.build.Step; const GeneratedFile = std.build.GeneratedFile; fn root() []const u8 { return (std.fs.path.dirname(@src().file) orelse ...
build.zig
const std = @import("std"); const stdx = @import("stdx"); const t = stdx.testing; const log = stdx.log.scoped(.color); pub const Color = struct { const Self = @This(); channels: struct { r: u8, g: u8, b: u8, a: u8, }, // Standard colors. pub const StdRed = init(255...
graphics/src/color.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const bindings = @import("bindings.zig"); const Sdl = bindings.Sdl; // TODO: make alternative that syncs video to audio instead of // trying to sync audio to video pub const Context = struct { device: bindings.c.SDL_AudioDeviceID, buffer: Sample...
src/sdl/audio.zig
const std = @import("std"); const net = std.net; const os = std.os; const linux = os.linux; const io_uring_sqe = linux.io_uring_sqe; const io_uring_cqe = linux.io_uring_cqe; const assert = std.debug.assert; const Conn = struct { // TODO std.x.os.Socket addr: os.sockaddr = undefined, addr_len: os.socklen_t ...
src/v1-epoll/main.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const math = std.math; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; // A single inclusive range (a, b) and a <= b pub fn Range(comptime T: type) type { return struct { min: T, max: T, pub fn...
src/range_set.zig
const builtin = @import("builtin"); const std = @import("std"); const Mutex = std.Thread.Mutex; const expect = std.testing.expect; extern fn cbtAlignedAllocSetCustomAligned( alloc: fn (size: usize, alignment: i32) callconv(.C) ?*anyopaque, free: fn (memblock: ?*anyopaque) callconv(.C) void, ) void; var gpa = ...
libs/zbullet/src/zbullet.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = true; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const Arg = union(enum) { reg: u2, imm: i32, }; pub fn match_insn(comptime pattern:...
2016/day23.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; const Allocator = std.mem.Allocator; const system = @import("../core/system.zig"); const entity = @import("../core/entity.zig"); usingnamespace @import("../main/util.zig"); const math3d = @import("math3d"); const SystemSetupConte...
code/systems/transform_system.zig
const std = @import("std"); const argsParser = @import("args"); const ihex = @import("ihex"); const spu = @import("spu-mk2"); const Instruction = spu.Instruction; const FileFormat = enum { ihex, binary }; pub fn main() !u8 { const cli_args = argsParser.parseForCurrentProcess(struct { help: bool = false,...
tools/assembler/main.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "XHCI", .filter = .info, }).write; const CapRegs = extern struct { capabilites_length: u8, _res_01: u8, version: u16, hcs_params_1: u32, hcs_params_2: u32, hcs_params_3: u32, hcc_params_1: u32, ...
subprojects/flork/src/drivers/usb/xhci.zig
pub usingnamespace @import("std").zig.c_builtins; pub const webview_t = ?*c_void; pub extern fn webview_create(debug: c_int, window: ?*c_void) webview_t; pub extern fn webview_destroy(w: webview_t) void; pub extern fn webview_run(w: webview_t) void; pub extern fn webview_terminate(w: webview_t) void; pub extern fn webv...
webview/webview.zig
const std = @import("std"); const spirv = @import("../spirv.zig"); pub const magic_number = 0x07230203; pub const version = (1 << 16) | (0 << 8); pub const instructions = struct { pub fn nop(self: *spirv.Builder) !void { var operands = std.ArrayList(spirv.Operand).init(self.allocator); errdefer op...
src/gen/core.zig
const LeafIterator = struct { child_it: Node.ChildIterator, prev_child_its: std.ArrayList(Node.ChildIterator), // pub fn next_(self: *LeafIterator) ?Leaf { // while (self.child_it.next()) |child| { // std.debug.print("LeafIterator.next child {}\n", .{child}); // switch (chi...
src/iterator_ideas.zig
const std = @import("std"); const platform = @import("brucelib.platform"); const graphics = @import("brucelib.graphics").usingBackendAPI(.default); const audio_on = false; pub fn main() anyerror!void { try platform.run(.{ .title = "000_funky_triangle", .window_size = .{ .width = 854, ...
examples/000_funky_triangle/main.zig
const std = @import("std"); const u = @import("../util.zig"); const Expr = @import("../Expr.zig"); fn UN(comptime N: u16) type { return std.meta.Int(.unsigned, N); } fn SN(comptime N: u16) type { return std.meta.Int(.signed, N); } fn IN(comptime N: u16) type { return SN(N + 1); } inline fn digit(c: u8, he...
src/Wat/parse.zig
const std = @import("std"); const backend = @import("backend.zig"); const Size = @import("data.zig").Size; const DataWrapper = @import("data.zig").DataWrapper; pub const DrawContext = backend.Canvas.DrawContext; pub const Canvas_Impl = struct { pub usingnamespace @import("internal.zig").All(Canvas_Impl); pee...
src/canvas.zig
const std = @import("std"); const znt = @import("znt"); const gl = @import("zgl"); pub fn ui(comptime Scene: type) type { return struct { const box_component = Scene.componentByType(Box); const rect_component = Scene.componentByType(Rect); /// The Box component specifies a tree of nested b...
znt-ui.zig
const std = @import("std"); const clap = @import("clap"); const zfetch = @import("zfetch"); usingnamespace @import("commands.zig"); //pub const io_mode = .evented; pub const zfetch_use_buffered_io = false; const Command = enum { init, add, package, fetch, update, build, }; fn printUsage() nor...
src/main.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 Blob = opaque { pub fn deinit(self: *Blob) void { log.debug("Blob.deinit called", .{}); c.git_blob_free(@...
src/blob.zig
const std = @import("std"); const debug = std.debug; const assert = debug.assert; const assertError = debug.assertError; const warn = debug.warn; const mem = std.mem; const math = std.math; const Allocator = mem.Allocator; const builtin = @import("builtin"); const TypeId = builtin.TypeId; const globals = @import("modu...
parsers.zig
const std = @import("std"); const math = std.math; const common = @import("common.zig"); const FloatInfo = @import("FloatInfo.zig"); const Number = common.Number; const floatFromU64 = common.floatFromU64; fn isFastPath(comptime T: type, n: Number(T)) bool { const info = FloatInfo.from(T); return info.min_exp...
lib/std/fmt/parse_float/convert_fast.zig
const std = @import("std.zig"); const builtin = @import("builtin"); const os = std.os; const fs = std.fs; const mem = std.mem; const math = std.math; const Allocator = mem.Allocator; const assert = std.debug.assert; const testing = std.testing; const child_process = @import("child_process.zig"); pub const abort = os.a...
lib/std/process.zig
const cam = @import("kira/math/camera.zig"); const mat4x4 = @import("kira/math/mat4x4.zig"); const math = @import("kira/math/common.zig"); const vec2 = @import("kira/math/vec2.zig"); const vec3 = @import("kira/math/vec3.zig"); const glfw = @import("kira/glfw.zig"); const renderer = @import("kira/renderer.zig"); const...
src/kiragine/sharedtypes.zig
const std = @import("std"); const utils = @import("../utils.zig"); const Atomic = std.atomic.Atomic; const Futex = utils.Futex; pub const Lock = extern struct { pub const name = "parking_lot"; const UNLOCKED = 0; const LOCKED = 1; const PARKED = 2; state: Atomic(u8) = Atomic(u8).init(UNLOCKED), ...
locks/parking_lot.zig
const std = @import("std"); const root = @import("main.zig"); const hzzp = root.hzzp; const libressl = root.libressl; pub const Method = enum { GET, POST, PUT, DELETE, HEAD, OPTIONS, CONNECT, PATCH, TRACE }; // TODO(haze): MultipartForm, pub const BodyKind = enum { JSON, Raw, URLEncodedForm }; const StringList = st...
src/request.zig
const std = @import("std"); const zalgebra = @import("zalgebra"); const objects = @import("didot-objects"); const c = @cImport({ @cDefine("dSINGLE", "1"); @cInclude("ode/ode.h"); }); const Allocator = std.mem.Allocator; const Component = objects.Component; const GameObject = objects.GameObject; const Transform...
didot-ode/physics.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; pub const AllowResize = union(enum) { /// The fields **dense_to_sparse** and **values** will grow on **add()** and **addValue()**. ResizeAllowed, /// Errors will be generated when adding more elements than **...
src/sparse_set.zig
const std = @import("std"); const assert = std.debug.assert; const zbs = std.build; const fs = std.fs; const mem = std.mem; const ScanProtocolsStep = @import("deps/zig-wayland/build.zig").ScanProtocolsStep; /// While a waylock release is in development, this string should contain the version in /// development with t...
build.zig
const std = @import("std"); const build_options = @import("build_options"); const debug = std.debug; const mem = std.mem; const testing = std.testing; const c = @cImport({ @cInclude("sqlite3.h"); }); usingnamespace @import("query.zig"); usingnamespace @import("error.zig"); const logger = std.log.scoped(.sqlite);...
sqlite.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const Vec3 = struct { x: i32, y: i32, z: i32 }; const zero3 = Vec3{ .x = 0, .y = 0, .z = 0 }; const Bot = struct { p: Vec3, r: u31 }; fn dist(a: Vec3, b: Vec3) u32 { return @intCast(u32, (std.math.absInt(a.x - b.x) catch u...
2018/day23.zig
const std = @import("std"); const assert = std.debug.assert; const print = std.debug.print; const tools = @import("tools"); const Property = enum { bludgeoning, radiation, cold, slashing, fire }; const Group = struct { unit_count: u16, unit_hp: u16, weak: []const Property, immune: []const Property, ...
2018/day24.zig
const std = @import("std"); const testing = std.testing; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const FixedSieve = struct { const Self = @This(); allocator: *Allocator, arr: []bool, fn init(allocator: *Allocator, size: u32) !FixedSieve { var arr = try allocator.a...
eratosthenes/src/main.zig
const std = @import("std"); pub const Mustache = struct { // TODO allow custom tags outside of {{}} const Self = @This(); pub const Error = error{ CouldNotFindFile, FileError, ArgsMustBeStruct, FileNotFound, MalformedFile, ExpectedOpenCurlyBrace, Expe...
src/mustache.zig
const std = @import("std"); const pike = @import("pike"); const clap = @import("clap"); const ray = @import("ray.zig"); const udev = @import("udev.zig"); const mt = @import("multitouch.zig"); const dim = @import("dimensions.zig"); const MAGENTA = ray.Color{ .r = 255, .g = 0, .b = 182, .a = 255 }; const TEAL = ray.Col...
src/main.zig
const std = @import("std"); const builtin = @import("builtin"); const stdx = @import("stdx.zig"); extern "stdx" fn jsWarn(ptr: [*]const u8, len: usize) void; extern "stdx" fn jsLog(ptr: [*]const u8, len: usize) void; extern "stdx" fn jsErr(ptr: [*]const u8, len: usize) void; pub fn scoped(comptime Scope: @Type(.EnumL...
stdx/log_wasm.zig
const builtin = @import("builtin"); const std = @import("../../std.zig"); const assert = std.debug.assert; const maxInt = std.math.maxInt; pub const ERROR = @import("error.zig"); pub const STATUS = @import("status.zig"); pub const LANG = @import("lang.zig"); pub const SUBLANG = @import("sublang.zig"); /// The standa...
lib/std/os/windows/bits.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; const StructWithNoFields = str...
test/behavior/struct.zig
const std = @import("../std.zig"); const testing = std.testing; const builtin = std.builtin; const fs = std.fs; const mem = std.mem; const File = std.fs.File; const tmpDir = testing.tmpDir; test "readAllAlloc" { var tmp_dir = tmpDir(.{}); defer tmp_dir.cleanup(); var file = try tmp_dir.dir.createFile("te...
lib/std/fs/test.zig
const std = @import("std"); const Type = @import("Type.zig"); const Tokenizer = @import("Tokenizer.zig"); const Compilation = @import("Compilation.zig"); const Source = @import("Source.zig"); const Attribute = @import("Attribute.zig"); const Tree = @This(); pub const Token = struct { id: Id, /// This location...
src/Tree.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const mem = std.mem; const math = std.math; const assert = std.debug.assert; const meta = std.meta; usingnamespace @import("http.zig"); pub const HandlerFn = fn handle(Request, Response, []const u8) callconv(.Async) anyerror!void; pub const ErrorHandler...
src/routez/router.zig
const builtin = @import("builtin"); const c = @import("c.zig"); const assert = @import("std").debug.assert; // we wrap the c module for 3 reasons: // 1. to avoid accidentally calling the non-thread-safe functions // 2. patch up some of the types to remove nullability // 3. some functions have been augmented by zig_llv...
src-self-hosted/llvm.zig