code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const windows = std.os.windows; const WORD = windows.WORD; const DWORD = windows.DWORD; const HANDLE = windows.HANDLE; const LONG = windows.LONG; const LPARAM = windows.LPARAM; const WPARAM = windows.WPARAM; const HRESULT = windows.HRESULT; const GUID = windows.GUID; const ULONG = windows.UL...
modules/platform/vendored/zwin32/src/misc.zig
const std = @import("std"); const log = std.debug.warn; const stdout = &std.io.getStdOut().outStream(); const assert = @import("std").debug.assert; const fmt = @import("std").fmt; const c = @import("c.zig"); const gw = c.gw; const gmp = c.gmp; const glue = @import("glue.zig"); const u_zero = @import("u_zero.zig"); co...
llr.zig
const std = @import("std"); const math = std.math; const Allocator = std.mem.Allocator; const G = @import("global_config.zig"); const print = std.debug.print; const panic = std.debug.panic; const expect = std.testing.expect; const expectError = std.testing.expectError; const buf_size: u32 = G.buf_size; const zero_buf ...
src/instruments.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const print = std.debug.print; const Allocator = std.mem.Allocator; pub const util = @import("util.zig"); pub const vector_math = @import("vector_math.zig"); const Color = vector_math.Color; const Vertex = vector_math.Vertex; const Ve...
src/pixel_draw_module.zig
const wlr = @import("../wlroots.zig"); const wl = @import("wayland").server.wl; pub const TabletTool = extern struct { pub const Type = enum(c_int) { pen = 1, eraser, brush, pencil, airbrush, mouse, lens, totem, }; type: Type, hardware_s...
src/types/tablet_tool.zig
const std = @import("std"); const kernel = @import("kernel.zig"); const print = @import("print.zig"); const threading = @import("threading.zig"); const List = @import("list.zig").List; const memory = @import("memory.zig"); pub const Error = memory.MemoryError; pub const Lock = struct { locked: bool = false, ...
kernel/sync.zig
const builtin = @import("builtin"); const std = @import("std"); const time = std.time; const Timer = time.Timer; const crypto = std.crypto; const KiB = 1024; const MiB = 1024 * KiB; var prng = std.rand.DefaultPrng.init(0); const Crypto = struct { ty: type, name: []const u8, }; const hashes = [_]Crypto{ ...
lib/std/crypto/benchmark.zig
const builtin = @import("builtin"); const is_test = builtin.is_test; const is_gnu = switch (builtin.abi) { .gnu, .gnuabin32, .gnuabi64, .gnueabi, .gnueabihf, .gnux32 => true, else => false, }; const is_mingw = builtin.os == .windows and is_gnu; comptime { const linkage = if (is_test) builtin.GlobalLinkage...
lib/std/special/compiler_rt.zig
const std = @import("../std.zig"); const net = std.net; const mem = std.mem; const testing = std.testing; test "parse and render IPv6 addresses" { var buffer: [100]u8 = undefined; const ips = [_][]const u8{ "fc00:e968:6179::de52:7100", "fc00:db20:35b:7399::5", "::1", "::", ...
lib/std/net/test.zig
const Mir = @This(); const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const bits = @import("bits.zig"); const Air = @import("../../Air.zig"); const CodeGen = @import("CodeGen.zig"); const Register = bits.Register; instructions: std.MultiArrayList(Inst).Slice, /// The m...
src/arch/x86_64/Mir.zig
const kernel = @import("../../kernel.zig"); const virtio = @import("virtio.zig"); const MMIO = virtio.MMIO; const SplitQueue = virtio.SplitQueue; const Descriptor = virtio.Descriptor; const Graphics = kernel.graphics; const log = kernel.log.scoped(.VirtioGPU); const TODO = kernel.TODO; const GenericDriver = kernel.dr...
src/kernel/arch/riscv64/virtio_gpu.zig
const std = @import("std"); const lex = @import("zua").lex; // this import relies on addPackagePath in ../build.zig const Timer = std.time.Timer; const hash_map = std.hash_map; // Benchmarking for the Zua lexer // Expects @import("build_options").fuzz_lex_inputs_dir to be a path to // a directory containing a corpus o...
test/bench_lex.zig
const std = @import("std"); const IOPort = @import("../IOPort.zig"); const SerialPortConsole = @This(); pub const ForegroundColor = enum(u32) { default = 39, black = 30, red = 31, green = 32, yellow = 33, blue = 34, magenta = 35, cyan = 36, light_gray = 37, gray = 90, ligh...
kernel/console/SerialPortConsole.zig
const std = @import("std"); const c = @import("common/c.zig"); // records and plays back keypresses. press the button once to start recording, // press again to stop recording and play back in a loop what was recorded, // press a third time to turn it off. // one problem is that if you're playing along to the playbac...
examples/recorder.zig
const std = @import("std"); const builtin = @import("builtin"); const os = @import("os.zig"); const utils = @import("utils.zig"); const Elf = utils.Elf; const Paging = utils.Paging; const io = @import("io.zig"); const Serial = io.Serial; const mm = @import("mm.zig"); const isr = @import("isr.zig"); const display =...
src/main.zig
//-------------------------------------------------------------------------------- // Section: Types (15) //-------------------------------------------------------------------------------- pub const SystemInterruptTime = extern struct { value: u64, }; pub const PresentationTransform = extern struct { M11: f32...
win32/graphics/composition_swapchain.zig
// @imports imports a package or a Zig file into a namespace: const std = @import("std"); // @c_import imports C source/header files (included with @c_include) into a // namespace: const c = @c_import( @c_include("time.h"), @c_include("errno.h") ); pub fn main(args: [][]u8) -> %void { // Builtins are fun...
src/builtins.zig
const __floattidf = @import("floattidf.zig").__floattidf; const assert = @import("std").debug.assert; fn test__floattidf(a: i128, expected: f64) void { const x = __floattidf(a); assert(x == expected); } test "floattidf" { test__floattidf(0, 0.0); test__floattidf(1, 1.0); test__floattidf(2, 2.0); ...
std/special/compiler_rt/floattidf_test.zig
const std = @import("std"); const mem = std.mem; const json = std.json; const testing = std.testing; const assert = std.debug.assert; const testUtil = @import("util.zig"); const log = @import("../src/md/log.zig"); const Token = @import("../src/md/token.zig").Token; const TokenId = @import("../src/md/token.zig").Token...
test/section_atx_headings.zig
const std = @import("std"); const builtin = @import("builtin"); const warn = std.debug.warn; pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn { std.os.exit(0xF); } fn pow(base: usize, exp: usize) usize { var x: usize = base; var i: usize = 1; while (i < exp) : (i += 1)...
zig/src/zig.zig
const __floatuntidf = @import("floatuntidf.zig").__floatuntidf; const testing = @import("std").testing; fn test__floatuntidf(a: u128, expected: f64) !void { const x = __floatuntidf(a); try testing.expect(x == expected); } test "floatuntidf" { try test__floatuntidf(0, 0.0); try test__floatuntidf(1, 1....
lib/std/special/compiler_rt/floatuntidf_test.zig
const std = @import("std"); const proto_pkg = std.build.Pkg{ .name = "proto", .path = .{ .path = "src/proto/proto.zig" }, .dependencies = &[_]std.build.Pkg{}, }; const gdb_pkg = std.build.Pkg{ .name = "gdb", .path = .{ .path = "src/lib/gdb.zig" }, .dependencies = &[_]std.build.Pkg{}, }; const...
build.zig
const std = @import("std"); const log = @import("log.zig"); fn findModule(comptime module_name: []const u8) ?[]const u8 { var mem: ?[]const u8 = null; switch (@import("builtin").os.tag) { .linux => std.os.dl_iterate_phdr(&mem, error{}, struct { fn cb(info: *std.os.dl_phdr_info, size: usize...
src/version.zig
pub const base = @import("windows.zig"); pub const dwrite = @import("dwrite.zig"); pub const dxgi = @import("dxgi.zig"); pub const d3d11 = @import("d3d11.zig"); pub const d3d11d = @import("d3d11sdklayers.zig"); pub const d3d12 = @import("d3d12.zig"); pub const d3d12d = @import("d3d12sdklayers.zig"); pub const d3d = @im...
modules/platform/vendored/zwin32/src/zwin32.zig
const std = @import("std"); const fmt = std.fmt; const io = std.io; const path = std.fs.path; const Allocator = std.mem.Allocator; const Datablock = @import("datablock.zig").Datablock; const DatasetAttributes = @import("dataset_attributes.zig").DatasetAttributes; const DataType = @import("dataset_attributes.zig").DataT...
src/Fs.zig
const std = @import("std"); const core = @import("core.zig"); const terminal = @import("terminal.zig"); const vt100 = @import("vt100.zig"); const debug = std.debug; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const testing = std.testing;...
src/draw.zig
const std = @import("std"); const io = @import("io.zig"); const Terminal = @import("tty.zig"); fn outportb(port: u16, val: u8) void { io.out(u8, port, val); } fn inportb(port: u16) u8 { return io.in(u8, port); } pub const VgaMode = enum { mode320x200, mode640x480, }; // pub const mode = if (@hasDecl...
src/kernel/arch/x86/boot/vga.zig
const util = @import("../sdf_util.zig"); pub const info: util.SdfInfo = .{ .name = "Dodecahedron Edges", .data_size = @sizeOf(Data), .function_definition = function_definition, .enter_command_fn = util.surfaceEnterCommand(Data), .exit_command_fn = util.surfaceExitCommand(Data, exitCommand), .a...
src/sdf/surfaces/dodecahedron_edges.zig
pub const WEBAUTHN_API_VERSION_1 = @as(u32, 1); pub const WEBAUTHN_API_VERSION_2 = @as(u32, 2); pub const WEBAUTHN_API_VERSION_3 = @as(u32, 3); pub const WEBAUTHN_API_CURRENT_VERSION = @as(u32, 3); pub const WEBAUTHN_RP_ENTITY_INFORMATION_CURRENT_VERSION = @as(u32, 1); pub const WEBAUTHN_MAX_USER_ID_LENGTH = @as(u32, 6...
win32/networking/windows_web_services.zig
pub const PSAPI_VERSION = @as(u32, 2); //-------------------------------------------------------------------------------- // Section: Types (14) //-------------------------------------------------------------------------------- pub const ENUM_PROCESS_MODULES_EX_FLAGS = enum(u32) { ALL = 3, DEFAULT = 0, @"3...
win32/system/process_status.zig
const std = @import("std"); const utils = @import("utils.zig"); /// stores a single object of type T for each T added pub const TypeStore = struct { map: std.AutoHashMap(u32, []u8), allocator: std.mem.Allocator, pub fn init(allocator: std.mem.Allocator) TypeStore { return TypeStore{ .m...
src/ecs/type_store.zig
const std = @import("std"); const builtin = @import("builtin"); const LibExeObjStep = std.build.LibExeObjStep; const Builder = std.build.Builder; const CrossTarget = std.zig.CrossTarget; const Pkg = std.build.Pkg; const renderkit_build = @import("renderkit/build.zig"); const ShaderCompileStep = renderkit_build.Shader...
build.zig
const std = @import( "std" ); const Mutex = std.Thread.Mutex; const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; usingnamespace @import( "../core/core.zig" ); usingnamespace @import( "../core/glz.zig" ); usingnamespace @import( "../sim.zig" ); pub fn CurvePaintable( comptime N: usize, comptime P: us...
src/time/curve.zig
usingnamespace @import( "../core/core.zig" ); usingnamespace @import( "../core/glz.zig" ); pub fn StaticPaintable( comptime vCapacity: usize ) type { return struct { const Self = @This(); axes: [2]*const Axis, mode: GLenum, rgba: [4]GLfloat, vCoords: [2*vCapacity]GLfloat, ...
src/space/staticPaintable.zig
const std = @import("std"); const expect = std.testing.expect; const io = std.io; const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; pub fn main() anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); var allocator = &gpa.allocator; var list = tr...
day05/src/main.zig
const std = @import("std"); const net = std.net; const okredis = @import("./src/okredis.zig"); const Client = okredis.Client; pub fn main() !void { // Connect const addr = try net.Address.parseIp4("1192.168.3.11", 6379); var connection = try net.tcpConnectToAddress(addr); var client: Client = undefine...
example.zig
const std = @import("std"); const assert = std.debug.assert; const Camera = @import("Camera.zig"); const Material = @import("Material.zig"); const Mesh = @import("Mesh.zig"); const Renderer = @import("Renderer.zig"); const zp = @import("../../zplay.zig"); const drawcall = zp.graphics.common.drawcall; const ShaderProgra...
src/graphics/3d/EnvMappingRenderer.zig
const std = @import("std"); const heap = std.heap; const io = std.io; const mem = std.mem; const c = @cImport({ @cInclude("curl/curl.h"); }); pub const Response = struct { allocator: mem.Allocator, response_code: usize, data: []const u8, pub fn deinit(self: *Response) void { self.allocat...
src/curl.zig
const assert = @import("std").debug.assert; const buf_size = 8; const KeyState = struct { pressed_time: u64 = 0, key_code: u8 = 0, released: bool = false, }; const KeyBuffer = @This(); // time in microseconds that pressed keys will at least remain pressed sticky_duration: u64, // current time in microsec...
src/emu/KeyBuffer.zig
const std = @import("std"); const testing = std.testing; const mem = std.mem; const ParserPath = @import("parser_path.zig").ParserPath; const ParserPosKey = @import("parser.zig").ParserPosKey; const deinitOptional = @import("parser.zig").deinitOptional; /// A ResultStream iterator. pub fn Iterator(comptime T: type) ty...
src/combn/engine/result_stream.zig
const std = @import("std"); const io = std.io; const File = std.fs.File; const Reader = File.Reader; const Allocator = std.mem.Allocator; const expect = std.testing.expect; const math = std.math; const alloc = std.heap.c_allocator; const Record = struct { const Self = @This(); min: usize, max: usize, ...
day2/src/main.zig
// SPDX-License-Identifier: MIT // This file is part of the Termelot project under the MIT license. const std = @import("std"); const termelot_import = @import("../termelot.zig"); const Termelot = termelot_import.Termelot; const Config = termelot_import.Config; const SupportedFeatures = termelot_import.SupportedFeat...
src/backend/unimplemented.zig
pub const NTDDI_WIN2K = @as(u32, 83886080); pub const NTDDI_WINXP = @as(u32, 83951616); pub const NTDDI_WINXPSP2 = @as(u32, 83952128); pub const NTDDI_WS03SP1 = @as(u32, 84017408); pub const NTDDI_VISTA = @as(u32, 100663296); pub const NTDDI_VISTASP1 = @as(u32, 100663552); pub const NTDDI_WIN7 = @as(u32, 100728832); pu...
win32/system/system_information.zig
const builtin = @import("builtin"); const std = @import("std"); const fmt = std.fmt; const testing = std.testing; const InStream = std.io.InStream; const Allocator = std.mem.Allocator; const BigNumParser = @import("./parser/t_bignum.zig").BigNumParser; const VoidParser = @import("./parser/void.zig").VoidParser; const ...
src/parser.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const AutoHashMap = std.AutoHashMap; const StringHashMap = std.StringHashMap; // Useful stdlib functions const tokenize = std.mem.tokenize; const split = std.mem.split; const trim = std.mem.trim; const parseInt = std.fmt....
src/day21.zig
const IOCTL = @import("ioctl.zig"); // Modes for the prctl(2) form `prctl(PR_SET_SECCOMP, mode)` pub const MODE = struct { /// Seccomp not in use. pub const DISABLED = 0; /// Uses a hard-coded filter. pub const STRICT = 1; /// Uses a user-supplied filter. pub const FILTER = 2; }; // Operations...
lib/std/os/linux/seccomp.zig
const std = @import("std"); const c = @cImport({@cInclude("X11/Xlib.h");}); const print = std.debug.warn; pub fn main() anyerror!void { var args = std.process.ArgIteratorPosix.init(); _ = args.skip(); var arg_one = args.next() orelse return usage(); if (arg_one.len <=1 or arg_one[0] != '-') return usa...
src/client.zig
const std = @import("std"); const bedrock = @import("bedrock.zig"); export fn searchInit( world_seed: i64, gen_type: BedrockGenType, x0: i32, y0: i32, z0: i32, x1: i32, y1: i32, z1: i32, ) ?*AsyncSearcher { const gen = switch (gen_type) { .overworld_floor => bedrock.Gradient...
src/web.zig
const std = @import("std"); const assert = std.debug.assert; const zp = @import("../../zplay.zig"); const gl = zp.deps.gl; const alg = zp.deps.alg; const Vec2 = alg.Vec2; const Vec3 = alg.Vec3; const Vec4 = alg.Vec4; const Mat4 = alg.Mat4; const Self = @This(); const allocator = std.heap.raw_c_allocator; /// id of sha...
src/graphics/common/ShaderProgram.zig
const std = @import("std"); const shared = @import("../shared.zig"); const lib = @import("../../main.zig"); const c = @cImport({ @cDefine("GLFW_INCLUDE_ES3", {}); @cInclude("GLFW/glfw3.h"); }); const gl = c; const lasting_allocator = lib.internal.lasting_allocator; const EventType = shared.BackendEventType; v...
src/backends/gles/backend.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; pub fn version_from_build(build: []const u8) !std.builtin.Version { // build format: // 19E287 (example) // xxyzzz // // major = 10 // minor = x - 4 = 19 - 4 = 15 // patch = ascii(y) - 'A' = 'E' - 'A' = 69...
lib/std/zig/system/macos.zig
const std = @import("index.zig"); const debug = std.debug; const assert = debug.assert; const math = std.math; const mem = std.mem; const Allocator = mem.Allocator; const builtin = @import("builtin"); const want_modification_safety = builtin.mode != builtin.Mode.ReleaseFast; const debug_u32 = if (want_modification_saf...
std/hash_map.zig
const Mir = @This(); const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const bits = @import("bits.zig"); const Register = bits.Register; instructions: std.MultiArrayList(Inst).Slice, /// The meaning of this data is determined by `Inst.Tag` value. extra: []const u32, pu...
src/arch/aarch64/Mir.zig
const std = @import("../../std.zig"); const debug = std.debug; const math = std.math; const mem = std.mem; const testing = std.testing; const Allocator = mem.Allocator; const bn = @import("int.zig"); const Limb = bn.Limb; const DoubleLimb = bn.DoubleLimb; const Int = bn.Int; /// An arbitrary-precision rational number...
lib/std/math/big/rational.zig
const std = @import("std"); const mem = std.mem; const simd = @import("simd.zig"); const testing = std.testing; const Section = struct { pub const Type = enum { Template, Variable, Content, Yield, }; content: []const u8, type: Type, start: usize, end: usize, ...
src/template.zig
const std = @import("std.zig"); const mem = std.mem; const builtin = std.builtin; /// TODO Nearly all the functions in this namespace would be /// better off if https://github.com/ziglang/zig/issues/425 /// was solved. pub const Target = union(enum) { Native: void, Cross: Cross, pub const Os = enum { ...
lib/std/target.zig
const std = @import("std.zig"); const builtin = @import("builtin"); pub const Transition = struct { ts: i64, timetype: *Timetype, }; pub const Timetype = struct { offset: i32, flags: u8, name_data: [6:0]u8, pub fn name(self: Timetype) [:0]const u8 { return std.mem.sliceTo(self.name_da...
lib/std/tz.zig
const std = @import("std"); /// Exports the C interface for SDL pub const c = @import("sdl-native"); // pub const image = @import("image.zig"); pub const gl = @import("gl.zig"); pub const Error = error{SdlError}; const log = std.log.scoped(.sdl2); pub fn makeError() error{SdlError} { if (c.SDL_GetError()) |ptr...
src/wrapper/sdl.zig
const std = @import("std"); const gk = @import("gamekit"); const gfx = gk.gfx; const imgui = @import("imgui"); pub const enable_imgui = true; var clear_color = gk.math.Color.aya; var camera: gk.utils.Camera = undefined; var tex: gfx.Texture = undefined; pub fn main() !void { try gk.run(.{ .init = init, ...
examples/clear_imgui.zig
pub const LIBID_WUApiLib = Guid.initString("b596cc9f-56e5-419e-a622-e01bb457431e"); pub const UPDATE_LOCKDOWN_WEBSITE_ACCESS = @as(u32, 1); pub const WU_S_SERVICE_STOP = @import("../zig.zig").typedConst(HRESULT, @as(i32, 2359297)); pub const WU_S_SELFUPDATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 2359298))...
win32/system/update_agent.zig
const std = @import("std"); const warn = std.debug.warn; const assert = std.debug.assert; const trace = @import("tracy.zig").trace; const Vector = std.meta.Vector; // ============================================ // Computation // ============================================ pub const Fixed = u16; const range_Fixed =...
src/mandelbrot.zig
const builtin = @import("builtin"); const kernel = @import("root").kernel; const kutil = kernel.util; const print = kernel.print; const kthreading = kernel.threading; const putil = @import("util.zig"); // TODO: Zig Bug? unable to evaluate constant expression // const segments = @import("segments.zig"); // const kern...
kernel/platform/interrupts.zig
const georgios = @import("georgios"); const kb = georgios.keyboard; pub const Entry = struct { key: ?kb.Key, shifted_key: ?kb.Key, kind: ?kb.Kind, }; pub const one_byte = [256]Entry { Entry{.key = null, .shifted_key = null, .kind = null}, Entry{.key = .Key_Escape, .shifted_key = null, .kind = .Pr...
kernel/platform/ps2_scan_codes.zig
const std = @import("std.zig"); const StringHashMap = std.StringHashMap; const mem = @import("mem.zig"); const Allocator = mem.Allocator; const testing = std.testing; /// A BufSet is a set of strings. The BufSet duplicates /// strings internally, and never takes ownership of strings /// which are passed to it. pub co...
lib/std/buf_set.zig
const std = @import("std"); const eql = std.mem.eql; const Allocator = std.mem.Allocator; const OpCode = enum { nop, acc, jmp }; const Op = union(OpCode) { nop: isize, acc: isize, jmp: isize }; const Program = std.ArrayList(Op); const HashMap = std.AutoHashMap(isize, u8); fn parse(line: []u8, program: *Program) !void ...
2020/zig/src/8.zig
const std = @import("std"); const os = @import("root").os; const kepler = os.kepler; const tries = 1_000_000; fn server_task(allocator: *std.mem.Allocator, server_noteq: *kepler.ipc.NoteQueue) !void { // Server note queue should get the .Request note server_noteq.wait(); const connect_note = server_noteq....
src/kepler/tests.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; // Input values const p1_init =...
src/day21.zig
usingnamespace @cImport({ @cInclude("sys/ptrace.h"); }); const arch = @import("std").builtin.arch; // Regular register type pub const regT = switch (arch) { .x86_64 => c_ulonglong, .i386 => c_long, else => @compileError("Unsupported CPU architecture"), }; // Signed register type pub const sregT = swi...
src/c.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const Sha224 = std.crypto.hash.sha2.Sha224; const Sha384 = std.crypto.hash.sha2.Sha384; const Sha512 = std.crypto.hash.sha2.Sha512; const Sha256 = std.crypto.hash.sha2.Sha256; const x509 = @import("x509.zig"); const SignatureAlgorithm = ...
src/pcks1-1_5.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_foreign_import.zig
const std = @import("std"); const interop = @import("../interop.zig"); const iup = @import("../iup.zig"); const Impl = @import("../impl.zig").Impl; const CallbackHandler = @import("../callback_handler.zig").CallbackHandler; const debug = std.debug; const trait = std.meta.trait; const Element = iup.Element; const H...
src/elements/grid_box.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; usingnamespace @import("c.zig"); const Shader = @import("shader.zig").Shader; const glm = @import("glm.zig"); const Mat4 = glm.Mat4; const...
src/1_6_coordinate_systems.zig
const std = @import("std"); const mem = std.mem; const testing = std.testing; const unicode = std.unicode; const cats = @import("ziglyph.zig").derived_general_category; const eaw = @import("ziglyph.zig").derived_east_asian_width; const emoji = @import("ziglyph.zig").emoji_data; const gbp = @import("ziglyph.zig").grap...
.gyro/ziglyph-jecolon-github.com-c37d93b6/pkg/src/display_width.zig
const stdx = @import("../stdx.zig"); const t = stdx.testing; const math = @import("math.zig"); const log = stdx.log.scoped(.matrix); const Vec4 = [4]f32; // Row-major order. pub const Mat4 = [16]f32; // Because we're using row major order, we prefer to do mat * vec where vec is on the right side. // In theory it sho...
stdx/math/matrix.zig
const module = @import("module.zig"); pub const Module = module.Module; pub const Layout = module.Layout; pub const TextMeasureId = module.TextMeasureId; pub const BuildContext = module.BuildContext; pub const RenderContext = module.RenderContext; pub const LayoutContext = module.LayoutContext; pub const EventContext =...
ui/src/ui.zig
const std = @import("std"); ////////////////////////////////////////////////////////////////////////////// // Transforms /// Transform is a 2D affine transformation matrix. /// It is the low level interface for positioning, scaling and rotating things. pub const Transform = extern struct { m: [3][2]f32, /// iden...
src/zargo.zig
const std = @import("std"); const cstr = std.cstr; pub const Flag = struct { name: [*:0]const u8, kind: enum { boolean, arg }, }; pub fn ParseResult(comptime flags: []const Flag) type { return struct { const Self = @This(); const FlagData = struct { name: [*:0]const u8, ...
src/flags.zig
const std = @import("std"); const io = @import("io.zig"); const Terminal = @import("tty.zig"); pub const InterruptHandler = fn (*CpuState) *CpuState; var irqHandlers = [_]?InterruptHandler{null} ** 32; pub fn setIRQHandler(irq: u4, handler: ?InterruptHandler) void { irqHandlers[irq] = handler; } export fn handl...
src/kernel/arch/x86/boot/idt.zig
const std = @import("std"); const Span = @import("basics.zig").Span; const ConstantOrBuffer = @import("trigger.zig").ConstantOrBuffer; const fc32bit: f32 = 1 << 32; inline fn sqr(v: f32) f32 { return v * v; } inline fn clamp01(v: f32) f32 { return if (v < 0.0) 0.0 else if (v > 1.0) 1.0 else v; } // 32-bit ...
src/zang/mod_trisawosc.zig
const wlr = @import("../wlroots.zig"); const pixman = @import("pixman"); const std = @import("std"); const wayland = @import("wayland"); const wl = wayland.server.wl; const zwp = wayland.server.zwp; pub const PointerConstraintV1 = extern struct { pub const State = extern struct { pub const Field = packed...
src/types/pointer_constraints_v1.zig
const std = @import("std"); // dross-zig const Vector3 = @import("vector3.zig").Vector3; // ----------------------------------------- // - Color - // ----------------------------------------- /// Color in rgba pub const Color = struct { r: f32 = 0.0, g: f32 = 0.0, b: f32 = 0.0, a: f32 = 1.0, ...
src/core/color.zig
const std = @import("std"); const panic = std.debug.panic; const print = std.debug.print; const fmt = std.fmt; const ascii = std.ascii; const math = std.math; const alloc = std.heap.page_allocator; const ArrayList = std.ArrayList; const HashMap = std.AutoHashMap; var orders = ArrayList(i32).init(alloc); var device_jo...
src/10.zig
pub const CLFS_FLAG_REENTRANT_FILE_SYSTEM = @as(u32, 8); pub const CLFS_FLAG_NON_REENTRANT_FILTER = @as(u32, 16); pub const CLFS_FLAG_REENTRANT_FILTER = @as(u32, 32); pub const CLFS_FLAG_IGNORE_SHARE_ACCESS = @as(u32, 64); pub const CLFS_FLAG_READ_IN_PROGRESS = @as(u32, 128); pub const CLFS_FLAG_MINIFILTER_LEVEL = @as(...
win32/storage/file_system.zig
// TODO: // - If subtle-encoding[1] creates a constant-time implemention, copy that. // - Make en/decoders for segwit addresses? // - The decoder should tell you where in source the error occured. // Though I'd rather wait until https://github.com/ziglang/zig/issues/2647 // is implemented (if it ever is). // // [1...
bech32.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const data = @embedFile("data/day20.txt"); const EntriesList = std.ArrayList(Record); const dim = 10; const pitch = 11; const Record = struct { id: u32, data: *const [dim][pitch]u...
src/day20.zig
const std = @import("std"); const zp = @import("zplay"); const dig = zp.deps.dig; const fontawesome = dig.fontawesome; var regular_font: *dig.Font = undefined; var solid_font: *dig.Font = undefined; const codepoints = [_][:0]const u8{ fontawesome.ICON_FA_AD, fontawesome.ICON_FA_ADDRESS_BOOK, fontawesome.IC...
examples/imgui_fontawesome.zig
const std = @import("std"); pub const PoolError = error{ PoolIsFull, HandleIsUnacquired, HandleIsOutOfBounds, HandleIsReleased, }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /// Returns a struct that maintains a pool of data. Handles returned by /// `Pool.add()`...
libs/zpool/src/pool.zig
const std = @import("std"); pub fn GenericCoord(comptime Self: type) type { return struct { pub fn init(coord: anytype) Self { var self: Self = undefined; inline for (@typeInfo(Self).Struct.fields) |field, i| { @field(self, field.name) = coord[i]; } ...
src/main/zig/lib/coord.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; 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 aren...
2016/day10.zig
const std = @import("std"); const Cell = struct { row: u8, col: u8, marked: bool }; const Cells = std.AutoHashMap(u32, Cell); const Board = struct { cells: Cells, row_sums: [5]u32, col_sums: [5]u32, won: bool, fn justWon(self: Board, row: u8, col: u8) bool { return !self.won and (self.row...
2021/zig/04.zig
const std = @import("std"); const TestData = struct { year_a: u64, year_b: u64, expected_result: u64 }; /// Helper function to populate the array as Zig doesn't seem to support assigning directly in array /// fn createTestData(a: u64, b: u64, expected_result: u64) TestData { return TestData{ .year_a = a, .yea...
376_RevisedJulianCalendar/main.zig
const xcb = @import("../xcb.zig"); pub const id = xcb.Extension{ .name = "X-Resource", .global_id = 0 }; /// @brief Client pub const Client = struct { @"resource_base": u32, @"resource_mask": u32, }; /// @brief Type pub const Type = struct { @"resource_type": xcb.ATOM, @"count": u32, }; pub const C...
src/auto/res.zig
const std = @import("std"); const mem = std.mem; const testing = std.testing; /// Create a new trie with the given key and value types. pub fn Trieton(comptime K: type, comptime V: type) type { return struct { const NodeMap = std.AutoHashMap(K, Node); const Node = struct { value: ?V, ...
src/trieton.zig
const builtin = @import("builtin"); const warn = @import("std").debug.warn; const druzhba = @import("../druzhba.zig"); const intToStr = @import("../comptimeutils.zig").intToStr; // Please do not run `zig fmt` on this source... It makes chained fn calls ugly. const traceInPortName = "port"; const traceOutPortName = "...
druzhba/components/trace.zig
const builtin = @import("builtin"); const std = @import("../std.zig"); const maxInt = std.math.maxInt; usingnamespace std.c; pub const _errno = switch (builtin.abi) { .android => struct { extern "c" var __errno: c_int; fn getErrno() *c_int { return &__errno; } }.getErrno, ...
lib/std/c/linux.zig
// MIT License // // Copyright (c) 2016 <NAME> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, mer...
lib/std/fmt/parse_float.zig
const std = @import("std"); const cast = std.meta.cast; const mode = std.builtin.mode; // Checked arithmetic is disabled in non-debug modes to avoid side channels pub const Limbs = [4]u64; /// The function addcarryxU64 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^64 /// ou...
lib/std/crypto/pcurves/p256/p256_64.zig
const std = @import("std"); const testing = std.testing; const glfw = @import("glfw"); const gpu = @import("gpu"); const util = @import("util.zig"); const c = @import("c.zig").c; /// For now, this contains nothing. In the future, this will include application configuration that /// can only be specified at compile-ti...
src/main.zig
const std = @import("std"); const mem = std.mem; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const BigIntConst = std.math.big.int.Const; const BigIntMutable = std.math.big.int.Mutable; const ast = std.zig.ast; const Type = @import("type.zig").Type; const Value = @import("value.zig").Value; c...
src/zir.zig
const std = @import("std"); const lex = @import("zua").lex; // Tests for comparing the tokens of Zua's lexer with Lua's. // Expects @import("build_options").fuzzed_lex_inputs_dir to be a path to // a directory containing a corpus of inputs to test and // @import("build_options").fuzzed_lex_outputs_dir to be a path to ...
test/fuzzed_lex.zig