code
stringlengths
38
801k
repo_path
stringlengths
6
263
const print = @import("std").debug.print; // Let's define three structs: Duck, RubberDuck, and Duct. Notice // that Duck and RubberDuck both contain waddle() and quack() // methods declared in their namespace (also known as "decls"). const Duck = struct { eggs: u8, loudness: u8, location_x: i32 = 0, l...
exercises/070_comptime5.zig
pub const DIRECTMANIPULATION_KEYBOARDFOCUS = @as(u32, 4294967294); pub const DIRECTMANIPULATION_MOUSEFOCUS = @as(u32, 4294967293); pub const CLSID_VerticalIndicatorContent = Guid.initString("a10b5f17-afe0-4aa2-91e9-3e7001d2e6b4"); pub const CLSID_HorizontalIndicatorContent = Guid.initString("e7d18cf5-3ec7-44d5-a76b-377...
win32/graphics/direct_manipulation.zig
const base = @import("../base.zig"); const gen = @import("../gen.zig"); const COMMON = [_:null]?base.Segment{ .{ .offset = 30 * 0, .month = 1, .day_start = 1, .day_end = 30 }, .{ .offset = 30 * 1, .month = 2, .day_start = 1, .day_end = 30 }, .{ .offset = 30 * 2, .month = 3, .day_start = 1, .day_end = 30 },...
src/cal/french_revolutionary.zig
const expect = std.testing.expect; const expectFmt = std.testing.expectFmt; const std = @import("std"); test "if statement" { const a = true; var x: u16 = 0; if (a) { x += 1; } else { x += 2; } try expect(x == 1); } test "if statement expression" { const a = true; var x...
zig/learn/basics_test.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 Vec2 = tools.Vec2; const Computer = tools.IntCode_Co...
2019/day19.zig
const builtin = @import("builtin"); const TypeId = builtin.TypeId; const std = @import("std"); const math = std.math; const meta = std.meta; const assert = std.debug.assert; const warn = std.debug.warn; const bufPrint = std.fmt.bufPrint; const testExpected = @import("testexpected.zig").testExpected; const ae = @impo...
src/matrix.zig
const std = @import("std"); const test_allocator = std.testing.allocator; const tokenize = std.mem.tokenize; const split = std.mem.split; const data = @embedFile("input.txt"); fn main_1(input: []const u8) anyerror!void { var lines = tokenize(u8, input, "\r\n"); var counts = [1]isize{0} ** 12; while(line...
src/day03/main.zig
const std = @import("std"); const bytesAsSlice = std.mem.bytesAsSlice; const utils = @import("utils"); const Guid = utils.Guid; const io = @import("io.zig"); const constant_guids = @import("constant_guids.zig"); pub const Error = error { InvalidMbr, InvalidGptHeader, } || Guid.Error || io.BlockError; pub co...
kernel/gpt.zig
const std = @import("std"); const builtin = @import("builtin"); const clap = @import("clap"); const curl = @import("curl"); const Dependency = @import("Dependency.zig"); const cmds = @import("commands.zig"); const loadSystemCerts = @import("certs.zig").loadSystemCerts; const Display = @import("Display.zig"); const uti...
src/main.zig
const std = @import("std"); const types = @import("types"); const Allocator = std.mem.Allocator; const Value = std.json.Value; const Array = std.json.Array; const ObjectMap = std.json.ObjectMap; const assert = std.debug.assert; fn toSnakeCase(str: []const u8, buf: []u8) []const u8 { var i: usize = 0; var off:...
json.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/day19.zig
const std = @import("std"); fn isArrayList(comptime T: type) bool { // TODO: Improve this ArrayList check, specifically by actually checking the functions we use // TODO: Consider unmanaged ArrayLists if (!@hasField(T, "items")) return false; if (!@hasField(T, "capacity")) return false; return tru...
tres.zig
const std = @import("std"); pub const Reader = struct { const Self = @This(); pub const ReadError = error{EOF}; buf: []u8, remain: []u8, allocator: std.mem.Allocator, pub fn init(buf: []u8, allocator: std.mem.Allocator) Reader { return Reader{ .buf = buf, .rema...
js/peechy.zig
const std = @import("std"); const sqlite = @import("sqlite"); const manage_main = @import("main.zig"); const libpcre = @import("libpcre"); const Context = manage_main.Context; const log = std.log.scoped(.awtfdb_janitor); const VERSION = "0.0.1"; const HELPTEXT = \\ awtfdb-janitor: investigate the semantic consist...
src/janitor_main.zig
pub const DWM_BB_ENABLE = @as(u32, 1); pub const DWM_BB_BLURREGION = @as(u32, 2); pub const DWM_BB_TRANSITIONONMAXIMIZED = @as(u32, 4); pub const DWM_CLOAKED_APP = @as(u32, 1); pub const DWM_CLOAKED_SHELL = @as(u32, 2); pub const DWM_CLOAKED_INHERITED = @as(u32, 4); pub const DWM_TNP_RECTDESTINATION = @as(u32, 1); pub ...
deps/zigwin32/win32/graphics/dwm.zig
pub const PSS_PERF_RESOLUTION = @as(u32, 1000000); //-------------------------------------------------------------------------------- // Section: Types (23) //-------------------------------------------------------------------------------- pub const HPSS = *opaque{}; pub const HPSSWALK = *opaque{}; pub const PSS_HAN...
deps/zigwin32/win32/system/diagnostics/process_snapshotting.zig
const gfx = @import("gfx.zig"); pub const Quad = struct { pos_uv: [4]f32, }; pub const quad_vertices: []const Quad = &.{ .{ .pos_uv = [_]f32{ -0.5, -0.5, 0.0, 1.0 } }, .{ .pos_uv = [_]f32{ 0.5, -0.5, 1.0, 1.0 } }, .{ .pos_uv = [_]f32{ -0.5, 0.5, 0.0, 0.0 } }, .{ .pos_uv = [_]f32{ 0.5, 0.5, 1.0, 0....
src/ui_gfx.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const gui = @import("gui"); const nvg = @import("nanovg"); const Document = @import("Document.zig"); const Rect = @import("gui/geometry.zig").Rect; const Point = @import("gui/geometry.zig").Point; const PreviewWidget = @This(); widget: gui.Widget, allo...
src/PreviewWidget.zig
const std = @import("std"); const debug = std.debug; const math = std.math; const mem = std.mem; const testing = std.testing; const default_mask = 0x80; const threshold = 2; pub fn decode(allocator: mem.Allocator, data: []const u8) ![]u8 { const Lengths = struct { enc: u32, dec: u32, pak:...
src/core/rom/nds/blz.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/05.txt", .{}); defer input_file.close(); var buffe...
src/05.zig
const vk = @import("vulkan.zig"); pub const GLenum = c_uint; pub const GLboolean = u8; pub const GLbitfield = c_uint; pub const GLvoid = c_void; pub const GLbyte = i8; pub const GLshort = c_short; pub const GLint = c_int; pub const GLubyte = u8; pub const GLushort = c_ushort; pub const GLuint = c_uint; pub const GLsize...
src/lib/glfw3.zig
pub usingnamespace @cImport({ @cDefine("GLFW_INCLUDE_GLEXT", ""); @cInclude("GLFW/glfw3.h"); @cInclude("fmod.h"); @cInclude("stb_image.h"); @cInclude("stb_perlin.h"); }); pub var glCreateTextures: @typeInfo(PFNGLCREATETEXTURESPROC).Optional.child = undefined; pub var glTextureStorage2D: @typeInfo(P...
src/c.zig
const std = @import("std"); const panic = std.debug.panic; const builtin = @import("builtin"); const warn = std.debug.warn; const join = std.fs.path.join; const pi = std.math.pi; const sin = std.math.sin; const cos = std.math.cos; usingnamespace @import("c.zig"); const Camera = @import("camera.zig").Camera; const Sha...
src/6_2_2_ibl_specular.zig
const builtin = @import("builtin"); const std = @import("std"); const alsa = @import("zig-alsa"); pub const AlsaPlaybackInterface = @This(); stream: *alsa.snd_pcm_t, num_channels: u32, sample_rate: u32, bits_per_sample: u32, buffer_frames: alsa.snd_pcm_uframes_t, write_cursor: usize = 0, read_cursor: usize = 0, pub...
modules/platform/src/linux/AlsaPlaybackInterface.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day04.txt"); c...
src/day04.zig
const std = @import("std"); const json = std.json; const debug = std.debug; const log = std.log; const assert = debug.assert; const mem = std.mem; const os = std.os; const io = std.io; const version = @import("version.zig"); // used for sleep, and other, it may be removed // to relax libC needs const c = @cImport({ ...
iotmonitor.zig
const std = @import("std"); pub const Allocator = std.mem.Allocator; pub const List = std.ArrayList; pub const Map = std.AutoHashMap; pub const StrMap = std.StringHashMap; pub const BitSet = std.DynamicBitSet; pub const Str = []const u8; pub var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; pub const gpa = &gpa_...
src/util.zig
const std = @import("std"); const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; const Arena = std.heap.ArenaAllocator; const testing = std.testing; const Lexer = @import("Lexer.zig"); const Token = @import("Token.zig"); const ast = @import("ast.zig"); const Node = ast.Node; const Tree = ast.Tree; cons...
src/parser.zig
pub const WM_CAP_START = @as(u32, 1024); pub const MODM_USER = @as(u32, 16384); pub const MIDM_USER = @as(u32, 16384); pub const MODM_MAPPER = @as(u32, 8192); pub const MIDM_MAPPER = @as(u32, 8192); pub const MODM_INIT = @as(u32, 100); pub const MIDM_INIT = @as(u32, 100); pub const MODM_INIT_EX = @as(u32, 104); pub con...
deps/zigwin32/win32/media/multimedia.zig
const std = @import("std"); const alka = @import("alka"); const m = alka.math; usingnamespace alka.log; pub const mlog = std.log.scoped(.app); pub const log_level: std.log.Level = .info; fn draw() !void { const r = m.Rectangle{ .position = m.Vec2f{ .x = 100.0, .y = 200.0 }, .size = m.Vec2f{ .x = 50.0, .y = 50.0 ...
examples/shape_drawing.zig
const std = @import("std"); const glfw = @import("libs/mach-glfw/build.zig"); const gpu_dawn = @import("libs/mach-gpu-dawn/build.zig"); pub const BuildOptions = struct { use_imgui: bool = true, use_stb_image: bool = true, glfw: glfw.Options = .{}, dawn: gpu_dawn.Options = .{}, }; pub const BuildOptio...
libs/zgpu/build.zig
const std = @import("std"); const backend = @import("backend.zig"); const dataStructures = @import("data.zig"); const Size = dataStructures.Size; const StringDataWrapper = dataStructures.StringDataWrapper; pub const TextArea_Impl = struct { pub usingnamespace @import("internal.zig").All(TextArea_Impl); peer: ...
src/text.zig
const builtin = @import("builtin"); const is_test = builtin.is_test; comptime { const linkage = if (is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Weak; const strong_linkage = if (is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Strong; @export("__letf2", @import("com...
std/special/compiler_rt/index.zig
const std = @import("std"); const Allocator = std.mem.Allocator; pub const Problem = struct { allocator: Allocator, input: [:0]const u8 = undefined, tokenizer: ?std.mem.TokenIterator(u8) = null, splitter: ?std.mem.SplitIterator(u8) = null, pub fn init(year: u16, day: u16, allocator: Allocator) !Pr...
src/main/zig/aoc.zig
const std = @import("std"); const mem = std.mem; pub const list = @import("clang_options_data.zig").data; pub const CliArg = struct { name: []const u8, syntax: Syntax, /// TODO we're going to want to change this when we start shipping self-hosted because this causes /// all the functions in stage2.zi...
src-self-hosted/clang_options.zig
const std = @import("../../std.zig"); const maxInt = std.math.maxInt; const linux = std.os.linux; const SYS = linux.SYS; const socklen_t = linux.socklen_t; const iovec = std.os.iovec; const iovec_const = std.os.iovec_const; const uid_t = linux.uid_t; const gid_t = linux.gid_t; const pid_t = linux.pid_t; const stack_t =...
lib/std/os/linux/powerpc64.zig
const util = @import("../sdf_util.zig"); pub const info: util.SdfInfo = .{ .name = "Triangle", .data_size = @sizeOf(Data), .function_definition = function_definition, .enter_command_fn = util.surfaceEnterCommand(Data), .exit_command_fn = util.surfaceExitCommand(Data, exitCommand), .append_mat_...
src/sdf/surfaces/triangle.zig
pub const OFN_SHAREFALLTHROUGH = @as(u32, 2); pub const OFN_SHARENOWARN = @as(u32, 1); pub const OFN_SHAREWARN = @as(u32, 0); pub const CDM_FIRST = @as(u32, 1124); pub const CDM_LAST = @as(u32, 1224); pub const CDM_GETSPEC = @as(u32, 1124); pub const CDM_GETFILEPATH = @as(u32, 1125); pub const CDM_GETFOLDERPATH = @as(u...
win32/ui/controls/dialogs.zig
const std = @import("std"); const fs = std.fs; const Answer = struct { depth: u32, length: u32, }; fn get_answer_from_file(filename: []const u8, aimed: bool) !Answer { var file = try fs.cwd().openFile(filename, .{ .read = true }); defer file.close(); var reader = std.io.bufferedReader(file.reade...
day2/main.zig
const std = @import("std"); const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; // Public // TODO: Parse a series of price entries! // TODO: Refactoring / simplifying! // TODO: Set up some unit tests for good and bad Price strings! // TODO: Need a return type! pub fn scanTokens(allocator: *Allocat...
src/scanner.zig
const std = @import("std"); const sdl_libraries = @import("sdl"); const sdl = sdl_libraries.sdl; const sdl_img = sdl_libraries.sdl_img; const Allocator = std.mem.Allocator; const grey_boarder = sdl.Color{ .r = 66, .g = 65, .b = 65, .a = 210, }; const selected_color = sdl.Color{ .r = 233, .g =...
src/main.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "VMWARE", .filter = .info, }).write; const ps2 = @import("ps2.zig"); const ports = @import("ports.zig"); const eoi = @import("apic.zig").eoi; fn do_op(self: *const Command, port: u16, comptime str: []const u8) CommandResu...
subprojects/flork/src/platform/x86_64/vmware.zig
const std = @import("std"); const kernel = @import("root"); const mm = kernel.mm; const x86 = kernel.arch.x86; const lib = kernel.lib; const PhysicalAddress = mm.PhysicalAddress; const VirtualAddress = mm.VirtualAddress; const paging = @import("paging.zig"); const PML4 = paging.PML4; const PDPT = paging.PDPT; const ...
kernel/arch/x86/mm.zig
const std = @import("std"); const opt = @import("opt.zig"); const comparator = @import("ls.zig").compare_words; const warn = std.debug.warn; const Allocator = std.mem.Allocator; const stdout = &std.io.getStdOut().outStream(); /// memory belongs to caller pub fn sort(allocator: *Allocator, file: std.fs.File, options: P...
src/sort.zig
const std = @import("std"); const build_options = @import("build_options"); const fb = @import("console/fb.zig"); const printf = fb.printf; const arch = @import("arch.zig"); const hw = @import("hw.zig"); pub const Shell = struct { pub fn run() void { var sh = Shell{}; sh.exec(); } fn exec(...
dainkrnl/src/shell.zig
const std = @import("std"); usingnamespace @import("wren.zig"); const data = @import("data.zig"); /// Should be bound to config.bindForeignMethodFn pub fn foreignMethodFn( vm:?*VM, module:CString, className:CString, isStatic:bool, signature:CString ) callconv(.C) ForeignMethodFnC { if(util.matc...
src/bindings.zig
usingnamespace @import("psptypes.zig"); pub const struct_SceKernelSysClock = extern struct { low: SceUInt32, hi: SceUInt32, }; pub const SceKernelSysClock = struct_SceKernelSysClock; pub const enum_PspThreadAttributes = extern enum(u32) { PSP_THREAD_ATTR_VFPU = 16384, PSP_THREAD_ATTR_USER = 2147483648...
src/psp/sdk/pspthreadman.zig
const std = @import("std"); const stdx = @import("stdx"); const fatal = stdx.fatal; const vk = @import("vk"); pub fn updateDescriptorSet(device: vk.VkDevice, desc_set: vk.VkDescriptorSet, image_infos: []vk.VkDescriptorImageInfo) void { const write = vk.VkWriteDescriptorSet{ .sType = vk.VK_STRUCTURE_TYPE_WR...
graphics/src/backend/vk/descriptor.zig
const std = @import("std"); const c = @import("c.zig"); const BitmapGlyph = @import("BitmapGlyph.zig"); const Stroker = @import("Stroker.zig"); const types = @import("types.zig"); const Error = @import("error.zig").Error; const intToError = @import("error.zig").intToError; const Glyph = @This(); pub const BBoxMode = ...
freetype/src/Glyph.zig
allocator: Allocator, tokens: []const TokenKind, src: []const u8, panicking: bool = false, cursor: usize = 0, errors: std.ArrayListUnmanaged(ParseError) = .{}, const std = @import("std"); const Allocator = std.mem.Allocator; const Tokens = std.MultiArrayList(Token).Slice; const super = @import("!mod.zig"); const T...
fexc/src/parse/Parser.zig
const std = @import("../index.zig"); const math = std.math; const debug = std.debug; const assert = debug.assert; const mem = std.mem; const builtin = @import("builtin"); const errol3 = @import("errol/index.zig").errol3; const max_int_digits = 65; /// Renders fmt string with args, calling output with slices of bytes....
std/fmt/index.zig
const regs = @import("registers.zig"); const gpio = @import("gpio.zig"); pub fn main() void { systemInit(); // Enable GPIOD port regs.RCC.AHB1ENR.modify(.{ .GPIODEN = 1 }); // Set PD12/13/14/15 mode to general purpose output gpio.port.d.set_mode(12, .{ .output = .{} }); gpio.port.d.set_mode(1...
src/main.zig
const std = @import("std"); const Builder = @import("std").build.Builder; fn addWebviewDeps(exe: *std.build.LibExeObjStep, webviewObjStep: *std.build.Step) void { exe.step.dependOn(webviewObjStep); exe.addIncludeDir("src/webview"); exe.addLibPath("/usr/lib"); exe.addObjectFile("src/webview/webview.o");...
build.zig
const std = @import("std"); pub const Action = enum { Allow, Deny, }; pub const Flow = enum { In, Out, Any, }; pub const Protocol = enum { TCP, UDP, Any, }; pub const Port = union(enum) { All: void, Numeric: u16, Range: struct { from: u16, to: u16 }, }; // TODO CIDR? pub...
src/rules.zig
const fmt = @import("std").fmt; const uefiConsole = @import("../uefi/console.zig"); const serial = @import("../debug/serial.zig"); const PSF_FONT_MAGIC: u32 = 0x864ab572; const Font = packed struct { magic: u32, version: u32, // Zero headerSize: u32, // Offset of bitmaps in file, 32 flags: u32, // 0 if...
src/kernel/fonts/psf2.zig
const std = @import("std"); const time = std.time; const math = @import("./math.zig"); const vec3 = math.vec3; const Ray = struct { normalized_direction: vec3, position: vec3, }; const Sphere = struct { position: vec3, radius: f32, }; const Plane = struct { normalized_direction: vec3, distance:...
src/raytrace.zig
const std = @import("std"); const print = std.debug.print; const testing = std.testing; const ArrayList = std.ArrayList; const AutoArrayHashMap = std.AutoArrayHashMap; const mem = std.mem; const alloc = std.testing.allocator; pub const GraphError = error{ NodeAlreadyExists, EdgeAlreadyExists, NodesDoNotExist, EdgesDoN...
src/graph.zig
const std = @import("std"); const fmt = std.fmt; const mem = std.mem; const unicode = std.unicode; /// Improved Utf8View which also keeps track of the length in codepoints pub const Utf8View = struct { bytes: []const u8, len: usize, pub fn init(str: []const u8) !Utf8View { return Utf8View{ ...
src/common/unicode.zig
const std = @import("std"); const common = @import("../common/data.zig"); const options = @import("../common/options.zig"); const protocol = @import("../common/protocol.zig"); const rng = @import("../common/rng.zig"); const data = @import("data.zig"); const assert = std.debug.assert; const expectEqual = std.testing...
src/lib/gen1/helpers.zig
const std = @import("std"); const reg = @import("registry.zig"); const util = @import("util.zig"); const cparse = @import("c-parse.zig"); const mem = std.mem; const Allocator = mem.Allocator; const preamble = \\ \\// This file is generated from the Khronos Vulkan XML API Registry \\ \\const std = @impo...
generator/vulkan/render.zig
pub const Keys = enum(c_int) { unknown = 0, a = 4, b = 5, c = 6, d = 7, e = 8, f = 9, g = 10, h = 11, i = 12, j = 13, k = 14, l = 15, m = 16, n = 17, o = 18, p = 19, q = 20, r = 21, s = 22, t = 23, u = 24, v = 25, w = 26, ...
gamekit/input_types.zig
const std = @import("std"); const stdx = @import("stdx"); const ds = stdx.ds; const platform = @import("platform"); const cgltf = @import("cgltf"); const stbi = @import("stbi"); const math = stdx.math; const Vec2 = math.Vec2; const vec2 = math.Vec2.init; const Mat4 = math.Mat4; const geom = math.geom; const gl = @impor...
graphics/src/backend/gpu/graphics.zig
const std = @import("std"); const build_options = @import("build_options"); const Backend = build_options.GraphicsBackend; const stdx = @import("stdx"); const Vec2 = stdx.math.Vec2; const Vec3 = stdx.math.Vec3; const Vec4 = stdx.math.Vec4; const t = stdx.testing; const platform = @import("platform"); const graphics = @...
graphics/src/camera.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const Options = @import("Options.zig"); const term = @import("term.zig"); const util = @import("util.zig"); const debug = @import("debug.zig"); const CodeLens = @import("CodeLens.zig"); const parse = @import("parse/!mod.zig"); pub fn main() anyerror!v...
fexc/src/main.zig
const c = @cImport({ @cInclude("X11/Xlib.h"); @cDefine("XUTIL_DEFINE_FUNCTIONS", ""); // replace macros with functions @cInclude("X11/Xutil.h"); // @cInclude("X11/Xatom.h"); }); const std = @import("std"); const draw = @import("pixel_draw.zig"); var main_allocator: *std.mem.Allocator = undefined; // ...
src/xlib_plataform.zig
//-------------------------------------------------------------------------------- // Section: Types (1) //-------------------------------------------------------------------------------- pub const LicenseProtectionStatus = enum(i32) { Success = 0, LicenseKeyNotFound = 1, LicenseKeyUnprotected = 2, Lic...
win32/security/license_protection.zig
const std = @import("std"); const testing = std.testing; const allocator = std.testing.allocator; pub const Computer = struct { const Op = enum(u8) { ADD = 0, MUL = 1, MIN = 2, MAX = 3, LIT = 4, CGT = 5, CLT = 6, CEQ = 7, }; bits: std.ArrayLi...
2021/p16/computer.zig
const memory = @import("memory.zig"); const Allocator = memory.Allocator; const MemoryError = memory.MemoryError; const AllocError = memory.AllocError; const FreeError = memory.FreeError; const util = @import("utils"); const print = @import("print.zig"); const BlockStatus = enum(u2) { Invalid = 0, Split, ...
kernel/buddy_allocator.zig
const std = @import("std"); const Url = @import("url.zig").Url; const net = std.net; const Allocator = std.mem.Allocator; /// Sends a GET request to the given url. /// Returns a `Response` that contains the statuscode, headers and body. pub fn get(gpa: *Allocator, url: []const u8) !Response { const endpoint = try ...
src/net/http.zig
const std = @import("std"); const redis = @import("okredis"); const version = @import("version"); const zzz = @import("zzz"); const tar = @import("tar"); usingnamespace @import("common.zig"); const GET = redis.commands.strings.GET; const SET = redis.commands.strings.SET; const FV = redis.commands.hashes.utils.FV; cons...
src/publish.zig
const builtin = @import("builtin"); const std = @import("std"); const assert = std.debug.assert; const os = @import("windows/windows.zig"); const dxgi = @import("windows/dxgi.zig"); const dcommon = @import("windows/dcommon.zig"); const d3d12 = @import("windows/d3d12.zig"); const d3d11 = @import("windows/d3d11.zig"); co...
src/graphics.zig
const std = @import("std"); const Pkg = std.build.Pkg; const Builder = std.build.Builder; pub const pkgs = struct { pub const zap = Pkg{ .name = "zap", .path = "zap/src/zap.zig", }; pub const clap = Pkg{ .name = "clap", .path = "clap/clap.zig", }; pub const hyperia...
build.zig
const std = @import("std"); const fmt = std.fmt; const utils = @import("main.zig").utils; /// 256 colors pub const Color = enum(u8) { black = 0, red, green, yellow, blue, magenta, cyan, white, default, }; pub const print = struct { /// Returns a string to change text foregrou...
src/color.zig
const std = @import("std"); const common = @import("common.zig"); const VertexBufferHandle = common.VertexBufferHandle; pub fn withBackend(comptime backend: anytype) type { return struct { pub fn VertexBuffer(comptime vertex_type: type) type { return struct { pub const VertexTy...
modules/graphics/src/buffers.zig
const std = @import("index.zig"); const builtin = @import("builtin"); const assert = std.debug.assert; const event = this; const mem = std.mem; const posix = std.os.posix; pub const TcpServer = struct { handleRequestFn: async<*mem.Allocator> fn (*TcpServer, *const std.net.Address, *const std.os.File) void, lo...
std/event.zig
const std = @import("std"); const builtin = @import("builtin"); const testing = std.testing; const expect = testing.expect; const expectEqual = testing.expectEqual; test "params" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZig...
test/behavior/fn.zig
const std = @import("std.zig"); const builtin = @import("builtin"); const Os = builtin.Os; const c = std.c; const math = std.math; const debug = std.debug; const assert = debug.assert; const os = std.os; const mem = std.mem; const meta = std.meta; const trait = meta.trait; const Buffer = std.Buffer; const fmt = std.fm...
std/io.zig
const std = @import("../std.zig"); const builtin = std.builtin; const build = std.build; const Step = build.Step; const Builder = build.Builder; const LibExeObjStep = build.LibExeObjStep; const WriteFileStep = build.WriteFileStep; const fs = std.fs; const mem = std.mem; const process = std.process; const ArrayList = st...
lib/std/build/run.zig
const std = @import("std"); const ArrayList = std.ArrayList; const testing = std.testing; /// Candidates are the strings read from stdin /// if the filepath matching algorithm is used, then name will be /// used to store the filename of the path in str. pub const Candidate = struct { str: []const u8, name: ?[]...
src/filter.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(.{}){}; const State = enum { active, inactive, }; c...
day_17/src/main.zig
const std = @import("std"); const ansi = @import("ansi_esc.zig"); const Self = @This(); pub const buff_size = 512; pub const log_level: std.log.Level = switch (std.builtin.mode) { .Debug => .debug, .ReleaseSafe => .info, .ReleaseFast => .info, .ReleaseSmall => .info, }; pub var log_ctx: Self = undefine...
src/log.zig
const std = @import("std"); const input = @import("input.zig"); pub fn run(allocator: std.mem.Allocator, stdout: anytype) anyerror!void { var input_ = try input.readFile("inputs/day4"); defer input_.deinit(); var input_parsed = try Input.init(allocator, &input_); defer input_parsed.deinit(); { ...
src/day4.zig
pub const RTL_CORRELATION_VECTOR_STRING_LENGTH = @as(u32, 129); pub const RTL_CORRELATION_VECTOR_V1_PREFIX_LENGTH = @as(u32, 16); pub const RTL_CORRELATION_VECTOR_V1_LENGTH = @as(u32, 64); pub const RTL_CORRELATION_VECTOR_V2_PREFIX_LENGTH = @as(u32, 22); pub const RTL_CORRELATION_VECTOR_V2_LENGTH = @as(u32, 128); //--...
win32/system/correlation_vector.zig
const std = @import("std"); const debug = @import("debug.zig"); const utility = @import("utility.zig"); const enums = @import("enums.zig"); const structs = @import("structs.zig"); const ws = std.os.windows.ws2_32; const bigInt = std.math.big.int.Managed; const rand = std.crypto.random; /// Will be returning proper TL...
src/tls.zig
const std = @import("std"); const bytesToValue = std.mem.bytesToValue; const toBytes = std.mem.toBytes; const TagType = std.meta.TagType; const odbc = @import("c.zig"); const util = @import("util.zig"); const Bitmask = util.Bitmask; const unionInitEnum = util.unionInitEnum; const sliceToValue = util.sliceTo...
src/types.zig
const std = @import("std"); const Header = @import("Header.zig"); const Iterator = @import("iterator.zig").Iterator; const DirectoryEntryMetadata = @import("DirectoryEntryMetadata.zig"); const PathComponents = @import("PathComponents.zig"); const File = @This(); path: []const u8, file: std.fs.File, header: Header, p...
src/vpk/File.zig
pub const VK_LBUTTON = 0x01; pub const VK_RBUTTON = 0x02; pub const VK_CANCEL = 0x03; pub const VK_MBUTTON = 0x04; pub const VK_XBUTTON1 = 0x05; pub const VK_XBUTTON2 = 0x06; pub const VK_BACK = 0x08; pub const VK_TAB = 0x09; pub const VK_CLEAR = 0x0C; pub const VK_RETURN = 0x0D; pub const VK_SHIFT = 0x10; pub const VK...
src/vk_codes.zig
//-------------------------------------------------------------------------------- // Section: Types (7) //-------------------------------------------------------------------------------- const CLSID_WindowsMediaLibrarySharingServices_Value = @import("../zig.zig").Guid.initString("ad581b00-7b64-4e59-a38d-d2c5bf51ddb3"...
win32/media/library_sharing_services.zig
const std = @import("std"); const mem = std.mem; const log = @import("log.zig"); const State = @import("ast.zig").State; const Parser = @import("parse.zig").Parser; const Node = @import("parse.zig").Node; const Lexer = @import("lexer.zig").Lexer; const TokenId = @import("token.zig").TokenId; pub fn stateCodeBlock(p: *...
src/md/parse_codeblock.zig
const std = @import("std"); const Sdk = @import("Sdk.zig"); pub fn build(b: *std.build.Builder) !void { // Default-initialize SDK const sdk = Sdk.init(b, null, .{}); const mode = b.standardReleaseOptions(); // Provide some KeyStore structure so we can sign our app. // Recommendation: Don't hardco...
build.zig
const xcb = @import("../xcb.zig"); pub const id = xcb.Extension{ .name = "XFree86-DRI", .global_id = 0 }; /// @brief DrmClipRect pub const DrmClipRect = struct { @"x1": i16, @"y1": i16, @"x2": i16, @"x3": i16, }; /// @brief QueryVersioncookie pub const QueryVersioncookie = struct { sequence: c_u...
src/auto/xf86dri.zig
const std = @import("std"); usingnamespace @import("ast.zig"); usingnamespace @import("common.zig"); usingnamespace @import("compiler.zig"); usingnamespace @import("job.zig"); usingnamespace @import("location.zig"); usingnamespace @import("native_function.zig"); usingnamespace @import("types.zig"); pub cons...
src/symbol.zig
const std = @import("std"); const TokenType = @import("token.zig").TokenType; const testing = std.testing; const util = @import("util.zig"); const StackWidth = u128; const StackElemWidth = u4; // TODO: we have an extra bit here so it's easier to debug - change this to u3 later? const STACK_SHIFT = @bitSizeOf(StackElem...
src/state_machine.zig
const std = @import("std"); const print = std.debug.print; const Cell = struct { value: i32, marked: bool, pub fn mark(self: *Cell) void { self.marked = true; } }; const Winner = struct { number: i32, board: *Board }; pub const Board = struct { // Board is guaranteed to be 25 cel...
Day4/src/game.zig
const builtin = @import("builtin"); const std = @import("std"); const fs = std.fs; const log = std.log; const mem = std.mem; const os = std.os; const gzip = std.compress.gzip; const MAGIC = "FOILZ"; const MAX_READ_SIZE = 1000000000; pub fn pack_directory(path: []const u8, archive_path: []const u8) anyerror!void { ...
src/archiver.zig
const std = @import("std"); const builtin = @import("builtin"); const layers = @import("layers.zig"); const indented = @import("util.zig").rightAlign; const getlogo = @import("logos.zig").getlogo; const res = @import("resources.zig"); const mem = std.mem; const fs = std.fs; const os = std.os; const stdout = std.io.getS...
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 Repository = opaque { pub fn deinit(self: *Repository) void { log.debug("Repository.deinit called", .{}); ...
src/repository.zig
const gpio = @import("gpio.zig"); const Self = @This(); //Brightness levels const brightness_levels = [8]u8{ 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, 0x01 }; const hex_digits = [16]u8{ 0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71 }; const letters = [26]u8{ 0x77, 0x7...
src/led_keypad.zig
const std = @import("std"); const Arena = std.heap.ArenaAllocator; const assert = std.debug.assert; const panic = std.debug.panic; const initCodebase = @import("init_codebase.zig").initCodebase; const ecs = @import("ecs.zig"); const Entity = ecs.Entity; const ECS = ecs.ECS; const List = @import("list.zig").List; const...
src/tokenizer.zig
const Allocator = std.mem.Allocator; const Headers = @import("http").Headers; const parseHeaders = @import("headers.zig").parse; const Method = @import("http").Method; const ParsingError = @import("errors.zig").ParsingError; const readUri = @import("utils.zig").readUri; const std = @import("std"); const Version = @impo...
src/events/request.zig