code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const chrono = @import("chrono"); const TransactionTree = @import("./transaction_tree.zig").Tree; const ArrayDeque = @import("./array_deque.zig").ArrayDeque; pub const Context = struct { allocator: *std.mem.Allocator, payers: std.StringHashMap(Payer), pub fn init(allocator: *st...
src/context.zig
const builtin = @import("builtin"); const clap = @import("../clap.zig"); const std = @import("std"); const args = clap.args; const debug = std.debug; const heap = std.heap; const io = std.io; const mem = std.mem; const os = std.os; const testing = std.testing; /// The result returned from StreamingClap.next pub fn Ar...
clap/streaming.zig
const root = @import("@root"); const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; var argc_ptr: [*]usize = undefined; comptime { const strong_linkage = builtin.GlobalLinkage.Strong; if (builtin.link_libc) { @export("main", main, strong_linkage); } els...
std/special/bootstrap.zig
const std = @import("std"); const warn = std.debug.warn; const wgi = @import("WindowGraphicsInput/WindowGraphicsInput.zig"); const window = wgi.window; const input = wgi.input; const image = wgi.image; const c = wgi.c; const Constants = wgi.Constants; const vertexarray = wgi.vertexarray; const buffer = wgi.buffer; con...
src/Demo1.zig
const std = @import("std"); const os = std.os; const Flag = @import("Flag.zig"); uring: os.linux.IO_Uring, // For IO-bound tasks // TODO: thread waiting: bool = false, // Whether the last resumed wait task is still waiting wait_q: TaskQueue = .{}, // For task-bound tasks cpu_q: TaskQueue = .{}, // For CPU-bound tasks...
src/io/EventLoop.zig
const std = @import("std"); const zpm = @import(".zpm/pkgs.zig"); const packages = zpm.pkgs; const examples = [_][]const u8{ // "apps/hello-world/main", // "apps/ascii-printer/main", }; pub fn addTest(b: *std.build.Builder, global_step: *std.build.Step, comptime tool_name: []const u8, src: []const u8) *std.b...
build.zig
const std = @import("std"); const getElapsedTime = @import("kira/glfw.zig").getElapsedTime; const glfw = @import("kira/glfw.zig"); const renderer = @import("kira/renderer.zig"); const gl = @import("kira/gl.zig"); const input = @import("kira/input.zig"); const window = @import("kira/window.zig"); usingnamespace @impo...
src/kiragine/core.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const ArrayList = std.ArrayList; const camera = @import("camera.zig"); const Camera = camera.Camera; const Ray = camera.Ray; const HitRecord = camera.HitRecord; const vm = @import("vecmath_j.zig"); const math = std.math; const Vec3 = v...
src/main.zig
const clap = @import("zig-clap"); const std = @import("std"); const base64 = std.base64; const crypto = std.crypto; 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 os = std.os; const Clap = clap.ComptimeClap(c...
src/main.zig
const std = @import("std"); const A = std.heap.c_allocator; const c = @import("../headers/c.zig"); const call = @import("./safe.zig").call; pub const Env = struct { inner: c.napi_env, pub fn init(env: c.napi_env) Env { return Env { .inner = env }; } pub fn throw_error(self: Env, name: [:0]const u8) !void...
src/napi/c-napi/types.zig
const std = @import("std"); const stdx = @import("stdx"); const fatal = stdx.fatal; const vk = @import("vk"); const platform = @import("platform"); const graphics = @import("../../graphics.zig"); const gpu = graphics.gpu; pub const SwapChain = @import("swapchain.zig").SwapChain; pub usingnamespace @import("command.zig...
graphics/src/backend/vk/graphics.zig
const std = @import("std"); const builtin = @import("builtin"); const fs = std.fs; const mem = std.mem; const ascii = std.ascii; const Allocator = mem.Allocator; const testing = std.testing; // zig fmt: off pub const known_files = &[_][]const u8{ "/etc/mime.types", "/etc/httpd/mime.types", /...
src/mimetypes.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 assert = std.debug.assert; const utils = @import("utils.zig"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const Step = enum {...
day_24/src/main.zig
const clap = @import("clap"); const std = @import("std"); const ArgIterator = @import("arg_iterator.zig"); const stdout = std.io.getStdOut().writer(); const stdin = std.io.getStdIn().reader(); const Allocator = std.mem.Allocator; pub fn arch(allocator: *Allocator, it: *ArgIterator) !void { // TODO: remove Arch. f...
src/commands.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const customsDeclarations = @embedFile("input06.txt"); fn isSpace(line: []const u8) bool { for (line) |c| { if (!std.ascii.isSpace(c)) return false; } retur...
src/day06.zig
const std = @import("std"); const assert = std.debug.assert; const math = std.math; const L = std.unicode.utf8ToUtf16LeStringLiteral; const zwin32 = @import("zwin32"); const w = zwin32.base; const d3d = zwin32.d3d; const d3d12 = zwin32.d3d12; const wasapi = zwin32.wasapi; const hrPanic = zwin32.hrPanic; const hrPanicOn...
samples/bindless/src/bindless.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); pub fn run(input_text: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { _ = input_text; // part1 (buggué car fait tout les karts en un coup et donc ils pourraient se croiser sans crasher "effet tunnel" -> ma...
2018/day14.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const lib = @import("lib.zig"); usingnamespace lib; //; // typecheck after you get all the args u want // display is human readable // write is machine readable // slices generated can be interned from vectors // li...
src/builtins.zig
const std = @import("std"); const io = std.io; const kernel = @import("root"); const mm = kernel.mm; const x86 = @import("../x86.zig"); var vga_console: ?VGAConsole = null; pub fn getConsole() *VGAConsole { if (vga_console == null) { vga_console = VGAConsole.init(); } return &vga_console.?; } pub...
kernel/arch/x86/vga.zig
usingnamespace @import("../c.zig"); usingnamespace @import("../math/Math.zig"); const std = @import("std"); const ArrayList = std.ArrayList; const debug = @import("std").debug; const Mesh = @import("Mesh.zig").Mesh; const allocator = std.heap.page_allocator; const ImportError = error{ AIImportError, //assimp fai...
src/presentation/AssImpInterface.zig
const std = @import("std"); const vk = @import("../include/vk.zig"); const Context = @import("../backend/context.zig").Context; const Framebuffer = @import("../backend/framebuffer.zig").Framebuffer; pub const Step = @import("step.zig").Step; pub const renderpass = @import("renderpass.zig"); pub const pipeline = @imp...
render/src/program/program.zig
const std = @import("std"); comptime { @setFloatMode(.Optimized); } pub const Vec2 = std.meta.Vector(2, f64); /// Turn a scalar into a vector pub inline fn v(s: f64) Vec2 { return @splat(2, s); } /// Find the dot product of two vectors pub inline fn dot(a: Vec2, b: Vec2) f64 { return @reduce(.Add, a * b...
v.zig
const std = @import("std"); const json = std.json; const mem = std.mem; const testing = std.testing; pub const jsonrpc_version = "2.0"; const default_parse_options = json.ParseOptions{ .allocator = null, .duplicate_field_behavior = .Error, .ignore_unknown_fields = false, .allow_trailing_data = false, }...
src/jsonrpc.zig
const std = @import("std"); const Compilation = @import("Compilation.zig"); const Type = @import("Type.zig"); const Builtins = @This(); const Builtin = struct { spec: Type.Specifier, func_ty: Type.Func, attrs: Attributes, const Attributes = packed struct { printf_like: u8 = 0, vprintf...
src/Builtins.zig
const c = @cImport({ @cInclude("epoxy/gl.h"); }); const gl = @import("zgl.zig"); pub const VertexArray = enum(c.GLuint) { invalid = 0, _, pub const create = gl.createVertexArray; pub const delete = gl.deleteVertexArray; pub const gen = gl.genVertexArray; pub const bind = gl.bindVertexArra...
types.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const Allocator = std.mem.Allocator; const ShuntingYard = struct { const OperatorStack = std.ArrayList(u8); const OutputStack = std.ArrayList(usize); operator_stack: OperatorStack, output_stack: OutputStack, fn init(allocator: Allocat...
src/main/zig/2020/day18.zig
const std = @import("std"); const builtin = @import("builtin"); const Terminal = @import("tty.zig"); const SerialPort = @import("serial-port.zig"); const PIC = @import("pic.zig").PIC; const gdt = @import("gdt.zig"); const idt = @import("idt.zig"); const Keyboard = @import("./keyboard.zig"); // Exports comptime { @...
src/kernel/arch/x86/boot/main.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/day14.txt"); co...
src/day14.zig
//-------------------------------------------------------------------------------- // Section: Types (4) //-------------------------------------------------------------------------------- const IID_IHolographicCameraInterop_Value = Guid.initString("7cc1f9c5-6d02-41fa-9500-e1809eb48eec"); pub const IID_IHolographicCame...
win32/system/win_rt/holographic.zig
const std = @import("std"); const COMMON_MAGIC = .{ 0xc7b1dd30df4c8b88, 0x0a82e883a194f07b }; pub const Uuid = struct { a: u32, b: u16, c: u16, d: [8]u8, }; pub const File = struct { revision: u64, base: u64, length: u64, path: []const u8, cmdline: []const u8, partiton_index: ...
src/main.zig
const c = @import("../c_global.zig").c_imp; const std = @import("std"); // dross-zig const Texture = @import("texture.zig").Texture; const Vector2 = @import("../core/vector2.zig").Vector2; // ----------------------------------------- // - TextureRegion - // ----------------------------------------- ///...
src/renderer/texture_region.zig
const std = @import("std"); const assert = std.debug.assert; const expect = std.testing.expect; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const fixedBufferStream = std.io.fixedBufferStream; const Pixel = u8; const Layer = struct { pixels: []Pixel, const Self = @This(); pub fn...
zig/08.zig
const std = @import("std"); const expect = std.testing.expect; const expectError = std.testing.expectError; const expectEqual = std.testing.expectEqual; test "switch all prongs unreachable" { try testAllProngsUnreachable(); comptime try testAllProngsUnreachable(); } fn testAllProngsUnreachable() !void { t...
test/behavior/switch_stage1.zig
const std = @import("std"); pub const max_write_bytes: u16 = 1024 * 16; const CommandIntType = u8; pub const Command = enum(CommandIntType) { stat = 0, opendir, releasedir, readdir, access, open, close, read, write, create, unlink, truncate, mkdir, rmdir, r...
src/comms.zig
const uefi = @import("std").os.uefi; const fmt = @import("std").fmt; // https://github.com/ziglang/zig/blob/master/lib/std/os/uefi/protocols/simple_text_output_protocol.zig pub var out: *uefi.protocols.SimpleTextOutputProtocol = undefined; // EFI uses UCS-2 encoded null-terminated strings. UCS-2 encodes // code poin...
bootstrap/console.zig
const std = @import("std"); const Builder = std.build.Builder; const allocator = std.testing.allocator; const process = std.process; const path = std.fs.path; pub fn build(b: *Builder) !void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not...
build.zig
const std = @import("std"); const gameWorld = @import("GameWorld.zig"); const ent = @import("Entity.zig"); const componentData = @import("ComponentData.zig"); const GameWorld = gameWorld.GameWorld; const Entity = ent.Entity; const ArrayList = std.ArrayList; const mem = std.mem; const allocator = std.heap.page_allocat...
src/game/EntityManager.zig
pub const FADF_AUTO = @as(u32, 1); pub const FADF_STATIC = @as(u32, 2); pub const FADF_EMBEDDED = @as(u32, 4); pub const FADF_FIXEDSIZE = @as(u32, 16); pub const FADF_RECORD = @as(u32, 32); pub const FADF_HAVEIID = @as(u32, 64); pub const FADF_HAVEVARTYPE = @as(u32, 128); pub const FADF_BSTR = @as(u32, 256); pub const ...
deps/zigwin32/win32/system/ole_automation.zig
const print = @import("std").debug.print; const assert = @import("std").debug.assert; const CPU = @import("emu").CPU; const MREQ = CPU.MREQ; const IORQ = CPU.IORQ; const RD = CPU.RD; const WR = CPU.WR; const HALT = CPU.HALT; const INT = CPU.INT; const M1 = CPU.M1; const RETI = CPU.RETI; const B = CPU.B; const C ...
tests/z80test.zig
const std = @import("std"); pub const builtin = @import("builtin"); pub const SourceLocation = extern struct { ID: c_uint, pub const eq = ZigClangSourceLocation_eq; extern fn ZigClangSourceLocation_eq(a: SourceLocation, b: SourceLocation) bool; }; pub const QualType = extern struct { ptr: ?*c_void, ...
src/clang.zig
const std = @import("std"); const mem = std.mem; const Allocator = std.mem.Allocator; const Value = @import("value.zig").Value; const Type = @import("type.zig").Type; const TypedValue = @import("TypedValue.zig"); const assert = std.debug.assert; const ir = @import("ir.zig"); const zir = @import("zir.zig"); const Modul...
src-self-hosted/zir_sema.zig
const std = @import("std"); const builtin = @import("builtin"); const llvm = @import("llvm.zig"); const CInt = @import("c_int.zig").CInt; pub const FloatAbi = enum { Hard, Soft, SoftFp, }; pub const Target = union(enum) { Native, Cross: Cross, pub const Cross = struct { arch: builtin....
src-self-hosted/target.zig
const std = @import("std"); const panic = std.debug.panic; const Builder = std.build.Builder; pub fn build(b: *Builder) !void { b.setPreferredReleaseMode(.ReleaseFast); const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const exe = b.addExecutable("furious-fowls", "...
build.zig
const std = @import("std"); const sample_utils = @import("sample_utils.zig"); const c = @import("c.zig").c; const glfw = @import("glfw"); const gpu = @import("gpu"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var allocator = gpa.allocator(); const setup = try sample_utils.set...
gpu/examples/main.zig
const std = @import("std"); // Remember our old RPG Character struct? A struct is really just a // very convenient way to deal with memory. These fields (gold, // health, experience) are all values of a particular size. Add them // together and you have the size of the struct as a whole. const Character = struct { ...
exercises/051_values.zig
pub const DAV_AUTHN_SCHEME_BASIC = @as(u32, 1); pub const DAV_AUTHN_SCHEME_NTLM = @as(u32, 2); pub const DAV_AUTHN_SCHEME_PASSPORT = @as(u32, 4); pub const DAV_AUTHN_SCHEME_DIGEST = @as(u32, 8); pub const DAV_AUTHN_SCHEME_NEGOTIATE = @as(u32, 16); pub const DAV_AUTHN_SCHEME_CERT = @as(u32, 65536); pub const DAV_AUTHN_S...
win32/network_management/web_dav.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); fn PackedBoolsArray(comptime size: usize) type { return struct { words: [(size + 63) / 64]u64, fn setAll(self: *@This(), val: bool) void { @memset(@ptrCast([*]u8, &self.words), if (val) @as(u8, ...
2020/day15.zig
const std = @import("std"); const Answer = struct { @"0": u32, @"1": u32 }; const dirs = [4][2]i32{ [_]i32{ 0, 1 }, [_]i32{ 0, -1 }, [_]i32{ 1, 0 }, [_]i32{ -1, 0 } }; const Point = struct { x: usize, y: usize }; fn pointEquals(p: Point, q: Point) bool { return p.x == q.x and p.y == q.y; } fn run(filename: []con...
src/day09.zig
const std = @import("std"); const math = std.math; const expect = std.testing.expect; pub fn __ceilh(x: f16) callconv(.C) f16 { // TODO: more efficient implementation return @floatCast(f16, ceilf(x)); } pub fn ceilf(x: f32) callconv(.C) f32 { var u = @bitCast(u32, x); var e = @intCast(i32, (u >> 23) ...
lib/compiler_rt/ceil.zig
const std = @import("std"); const math = std.math; const mem = std.mem; const Parser = @This(); str: [:0]const u8, i: usize = 0, pub fn index(parser: *Parser, comptime T: type) !T { if (!parser.eatChar('[')) return error.InvalidIndex; const res = parser.intWithSign(usize, .pos, ']') catch return er...
src/Parser.zig
const std = @import("std"); const warn = std.debug.warn; const window = @import("window.zig"); const chip8 = @import("cpu.zig"); const c = @import("c.zig"); const Key = @import("keypad.zig").Keypad.Key; const Thread = @import("std").Thread; const audio = @import("audio.zig"); const test_rom = @embedFile("../assets/rom...
src/emulator.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/link.zig
const std = @import("std"); const print = std.debug.print; const warn = std.log.warn; const mem = std.mem; const Args = @This(); const Slot = struct { addr: u8, mod_name: ?[]const u8 = null, mod_path: ?[]const u8 = null, }; help: bool = false, slots: [2]Slot = [_]Slot{ .{ .addr = 0x08 }, .{ .addr = ...
src/host/Args.zig
const std = @import("std"); const p2z = @import("pcre2zig"); // Value NaN box. pub const Value = u64; // Bit masks // Quite NaN bits const mask_qnan: u64 = 0b0_1111111111111_00_0000000000000000_00000000000000000000000000000000; const mask_sign: u64 = 0b1_0000000000000_00_0000000000000000_0000000000000000000000000000...
src/value.zig
const std = @import("std"); const stdx = @import("stdx"); const ds = stdx.ds; const log = stdx.log.scoped(.tokenizer); const trace = stdx.debug.tracy.trace; const document = stdx.textbuf.document; const Document = document.Document; const LineChunk = document.LineChunk; const LineChunkId = document.LineChunkId; const...
parser/tokenizer.zig
const js = @import("js.zig"); const std = @import("std"); const zalgebra = @import("zalgebra"); const Thread = std.Thread; const Allocator = std.mem.Allocator; pub const ShaderError = error{ ShaderCompileError, InvalidContextError }; /// The type used for meshes's elements pub const MeshElementType = c.GLuint; pub c...
didot-webgl/graphics.zig
const std = @import("std"); const os = std.os; const io = std.io; const net = std.net; const fs = std.fs; pub const io_mode = .evented; const pulse = @cImport({ @cInclude("pulse/pulseaudio.h"); }); const CHUNK_SIZE: u32 = 1280; const CONNECTION_READ_TIMEOUT: i64 = 5000; // Time in ms pub fn main() !void { ...
src/main.zig
const std = @import("std"); const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; const stdout = std.io.getStdOut().outStream(); const print = stdout.print; const allocPrint0 = std.fmt.allocPrint0; const err = @import("error.zig"); const errorAt = err.errorAt; const errorAtToken = err.errorAtToken; cons...
src/parse.zig
const std = @import("std"); const ship = @import("./ship.zig"); const Hull = ship.Hull; const Pos = ship.Pos; const Computer = @import("./computer.zig").Computer; pub fn main() !void { const out = std.io.getStdOut().writer(); const inp = std.io.getStdIn().reader(); var buf: [20480]u8 = undefined; var c...
2019/p11/p11b.zig
const base = @import("../base.zig"); const gen = @import("../gen.zig"); const cal_gr = @import("gregorian.zig"); const COMMON = [_:null]?base.Segment{ .{ .offset = 28 * 0, .month = 1, .day_start = 1, .day_end = 28 }, .{ .offset = 28 * 1, .month = 2, .day_start = 1, .day_end = 28 }, .{ .offset = 28 * 2, .mo...
src/cal/cotsworth.zig
const std = @import("std"); const builtin = @import("builtin"); const dbg = std.debug.print; pub const GlobError = error{ ParseError, AbsolutePathRequired, }; const MatchType = enum { // We didn't match. Mismatch, // We didn't fully match the glob, but nothing in our input caused an explicit mis...
src/globby.zig
const std = @import("std"); /// rgb color tuple with 8 bit color values. pub const RGB = packed struct { r: u8, g: u8, b: u8, }; pub const Header = packed struct { id: u8 = 0x0A, version: u8, compression: u8, bpp: u8, xmin: u16, ymin: u16, xmax: u16, ymax: u16, horizont...
tools/bit-loader/pcx.zig
const std = @import("std"); const print = std.debug.print; const List = std.ArrayList; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day04.txt"); pub fn main() !void { var lines = try util.toStrSlice(data, "\n"); var numbers = try util.toIntSlice(u8, lines[0], ",");...
2021/src/day04.zig
const std = @import("std"); const memcpy = std.zig.c_builtins.__builtin_memcpy; const dlsym = std.c.dlsym; const coz_counter_t = extern struct { count: usize, backoff: usize, }; const coz_get_counter_t = ?fn (c_int, [*c]const u8) callconv(.C) [*c]coz_counter_t; fn _call_coz_get_counter(arg_type_1: c_int, arg_n...
bridge/coz.zig
// This implementation supports the page based devices. const std = @import("std"); const sys = @import("../sys.zig"); const Sha256 = std.crypto.hash.sha2.Sha256; // For now, the sizes are all hard coded. pub const page_size = @as(usize, sys.flash.page_size); pub const page_shift = std.math.log2_int(usize, page_size...
src/sim/swap-hash.zig
const std = @import("std"); const string = []const u8; const input = @embedFile("../input/day10.txt"); pub fn main() !void { // part 1 { var iter = std.mem.split(u8, input, "\n"); var sum: u32 = 0; while (iter.next()) |line| { if (line.len == 0) continue; Pa...
src/day10.zig
const std = @import("std"); const LinearFifo = std.fifo.LinearFifo; const Case = std.fmt.Case; const testing = std.testing; // https://www.oilshell.org/release/latest/doc/qsn.html const Decoder = struct { // This stores at most one UTF-8-encoded character which will be returned in the future. const Pending = ...
src/qsn.zig
const Serial = @import("../io.zig").Serial; const PortIO = @import("../io.zig").PortIO; pub const magic_req = "sL5DdSMmkekro\n"; pub const magic_ack = "z6IHG7cYDID6o\n"; pub const Commands = enum(u8) { abort = 0, load = 1, jump = 2, _, }; pub const ack_success = 'K'; pub const ack_crcerror = 'C'; pub...
src/utils/sfl.zig
const std = @import("std"); fn buildRaylib(b: *std.build.Builder) void { const cmake = b.addSystemCommand(&[_][]const u8{ "cmake", "-B", "ext/raylib/build", "-S", "ext/raylib", "-DCMAKE_BUILD_TYPE=Release", "-DOpenGL_GL_PREFERENCE=GLVND", "-DBUILD_EXA...
build.zig
pub const _FACDXGI = @as(u32, 2170); pub const DXGI_CPU_ACCESS_NONE = @as(u32, 0); pub const DXGI_CPU_ACCESS_DYNAMIC = @as(u32, 1); pub const DXGI_CPU_ACCESS_READ_WRITE = @as(u32, 2); pub const DXGI_CPU_ACCESS_SCRATCH = @as(u32, 3); pub const DXGI_CPU_ACCESS_FIELD = @as(u32, 15); pub const DXGI_FORMAT_DEFINED = @as(u32...
win32/graphics/dxgi/common.zig
const std = @import("std"); const fs = std.fs; const mem = std.mem; const Builder = std.build.Builder; const FileSource = std.build.FileSource; const Pkg = std.build.Pkg; const win32 = Pkg{ .name = "win32", .path = FileSource.relative("deps/zigwin32/win32.zig") }; const nfd = Pkg{ .name = "nfd", .path = FileSource.rel...
build.zig
const std = @import("std"); const helper = @import("helper.zig"); const Allocator = std.mem.Allocator; const Vec3 = @Vector(3, i32); const ArrayList = std.ArrayList; const HashMap = std.AutoHashMap; const input = @embedFile("../inputs/day19.txt"); pub fn run(alloc: Allocator, stdout_: anytype) !void { _ = stdout_...
src/day19.zig
const std = @import("std"); const c = @import("c.zig"); pub fn decode( pemData: []const u8, comptime UserDataType: type, userData: UserDataType, callback: fn(userData: UserDataType, data: []const u8) anyerror!void, allocator: std.mem.Allocator) !void { var state = PemState { .success =...
src/pem.zig
// TODO: Inline and fix cross once #3893 is fixed upstream const std = @import("std"); const sqrt = std.math.sqrt; const cos = std.math.cos; const sin = std.math.sin; const tan = std.math.tan; const max = std.math.max; const min = std.math.min; pub fn clamp(v: anytype, lo: anytype, hi: anytype) @TypeOf(v) { retur...
src/glm.zig
const std = @import("std.zig"); const builtin = @import("builtin"); pub const Ordering = std.builtin.AtomicOrder; pub const Stack = @import("atomic/stack.zig").Stack; pub const Queue = @import("atomic/queue.zig").Queue; pub const Atomic = @import("atomic/Atomic.zig").Atomic; test "std.atomic" { _ = @import("atom...
lib/std/atomic.zig
const libpoke = @import("../src/pokemon/index.zig"); const utils = @import("../src/utils/index.zig"); const fakes = @import("fake_roms.zig"); const std = @import("std"); const fun = @import("../lib/fun-with-zig/src/index.zig"); // TODO: Package stuff const heap = std.heap; const os = std.os; const debug = std.debug; c...
test/index.zig
const std = @import("std"); const warn = std.debug.warn; const builtin = @import("builtin"); const TypeId = builtin.TypeId; pub fn ArgParser(comptime T: type) type { return struct { values: T, available: std.StringHashMap(bool), const Self = @This(); const memberCt = @memberCount(T...
src/parser.zig
const windows = @import("windows.zig"); const IUnknown = windows.IUnknown; const HRESULT = windows.HRESULT; const WINAPI = windows.WINAPI; const GUID = windows.GUID; const UINT = windows.UINT; const BOOL = windows.BOOL; pub const GPU_BASED_VALIDATION_FLAGS = UINT; pub const GPU_BASED_VALIDATION_FLAG_NONE = 0; pub cons...
modules/platform/vendored/zwin32/src/d3d12sdklayers.zig
const std = @import("std"); const stdx = @import("stdx"); const Duration = stdx.time.Duration; const platform = @import("platform"); const KeyDownEvent = platform.KeyDownEvent; const graphics = @import("graphics"); const FontGroupId = graphics.FontGroupId; const Color = graphics.Color; const ui = @import("../ui.zig");...
ui/src/widgets/text_editor.zig
const std = @import("std"); const stdx = @import("stdx"); const ds = stdx.ds; const graphics = @import("../../graphics.zig"); const FontGroupId = graphics.FontGroupId; const FontId = graphics.FontId; const Font = graphics.Font; const VMetrics = graphics.VMetrics; const RenderFont = graphics.gpu.RenderFont; const FontG...
graphics/src/backend/gpu/font_cache.zig
const std = @import("std"); const Chunk = @import("./chunk.zig").Chunk; const OpCode = @import("./chunk.zig").OpCode; const Value = @import("./value.zig").Value; pub fn disassembleChunk(chunk: *Chunk, comptime name: []const u8) void { std.debug.print("=== {s} ===\n", .{name}); const code = chunk.code; ...
src/debug.zig
const std = @import("../std.zig"); const builtin = std.builtin; const math = std.math; const assert = std.debug.assert; const mem = std.mem; const testing = std.testing; pub fn Reader( comptime Context: type, comptime ReadError: type, /// Returns the number of bytes read. It may be less than buffer.len. ...
lib/std/io/reader.zig
const std = @import("../std.zig"); const assert = std.debug.assert; const testing = std.testing; const SegmentedList = std.SegmentedList; const mem = std.mem; const Token = std.zig.Token; pub const TokenIndex = usize; pub const Tree = struct { source: []const u8, tokens: TokenList, root_node: *Node.Root, ...
lib/std/zig/ast.zig
const std = @import("../std.zig"); const assert = std.debug.assert; ////////////////////////// //// IPC structures //// ////////////////////////// pub const Message = struct { sender: MailboxId, receiver: MailboxId, code: usize, args: [5]usize, payload: ?[]const u8, pub fn from(mailbox_id: ...
lib/std/os/zen.zig
const Wasm = @This(); const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const fs = std.fs; const leb = std.debug.leb; const Module = @import("../Module.zig"); const codegen = @import("../codegen/wasm.zig"); const link = @import("../link.zig"); /// Various magic numbers...
src-self-hosted/link/Wasm.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; test "compile time recursion" { try expect(some_data.len == 21); } var some_data: [@intCast(usize, fibonacci(7))]u8 = undefined; fn fibonacci(x: i32) i32 { if (x <= 1) return 1; return fibonacci(x - ...
test/behavior/eval.zig
const std = @import("std"); const Allocator = std.mem.Allocator; pub fn Permutator(comptime T: type) type { return struct { const Self = @This(); const Elements = std.ArrayList(T); elements: Elements, started: bool = undefined, completed: bool = undefined, c: [32]usize = undefined,...
src/main/zig/lib/permutator.zig
const std = @import("std"); const Builder = std.build.Builder; const examples = [_][]const u8{ "get", "post", "download", "evented" }; const packages = @import("deps.zig"); pub fn build(b: *Builder) void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); inline for ...
examples/build.zig
const clzsi2 = @import("clzsi2.zig"); const testing = @import("std").testing; fn test__clzsi2(a: u32, expected: i32) void { // XXX At high optimization levels this test may be horribly miscompiled if // one of the naked implementations is selected. var nakedClzsi2 = clzsi2.__clzsi2; var actualClzsi2 = ...
lib/std/special/compiler_rt/clzsi2_test.zig
const std = @import("std"); const ascii = std.ascii; const debug = std.debug; const fs = std.fs; const math = std.math; const mem = std.mem; const unicode = std.unicode; // This was ported from termbox https://github.com/nsf/termbox (not complete) pub const Key = struct { pub const Type = u64; pub const unk...
src/input.zig
const std = @import("std"); const vk = @import("vk"); const endian = std.builtin.endian; pub const CC = std.builtin.CallingConvention.C; pub const IntBool = c_int; pub const Point = struct { x: i32, y: i32 }; pub const FPoint = struct { x: f32, y: f32 }; pub const Rect = struct { x: i32, y: i32, w: i32, h: i32 }; ...
include/sdl.zig
const std = @import("std"); const zang = @import("zang"); const f = @import("zang-12tet"); const common = @import("common.zig"); const c = @import("common/c.zig"); const util = @import("common/util.zig"); pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb; pub const AUDIO_SAMPLE_RATE = 48000; pub const AUDIO_BUF...
examples/example_song.zig
const std = @import("std"); const fft = @import("common/fft.zig").fft; const example = @import(@import("build_options").example); const Recorder = @import("recorder.zig").Recorder; const fontdata = @embedFile("font.dat"); const fontchar_w = 8; const fontchar_h = 13; pub const Screen = struct { width: usize, h...
examples/visual.zig
const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const Allocator = std.mem.Allocator; const interface = @import("interface.zig"); //; const HunkSide = struct { const Self = @This(); const VTable = struct { alloc: fn (*Self, usize, u29) Allocator.Erro...
src/hunk.zig
const std = @import("std"); const mem = std.mem; const ascii = std.ascii; const fmt = std.fmt; const warn = std.debug.warn; const svd = @import("svd.zig"); var line_buffer: [1024 * 1024]u8 = undefined; pub fn main() anyerror!void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer aren...
src/main.zig
const std = @import("std"); const ArrayList = std.ArrayList; const md5 = std.crypto.hash.Md5; const VEC_SIZE = 8; const Vec = std.meta.Vector(VEC_SIZE, f64); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var global_allocator = gpa.allocator(); pub fn main() !void { const n = try get_n(); const size = (n...
bench/algorithm/mandelbrot/1.zig
const uefi = @import("std").os.uefi; const fmt = @import("std").fmt; const GraphicsOutputProtocol = uefi.protocols.GraphicsOutputProtocol; const GraphicsOutputBltPixel = uefi.protocols.GraphicsOutputBltPixel; const GraphicsOutputBltOperation = uefi.protocols.GraphicsOutputBltOperation; // Assigned in main(). var con_o...
boot/efi_x86_64/main.zig
const std = @import("std"); usingnamespace @import("util"); usingnamespace @import("source.zig"); usingnamespace @import("log.zig"); const Allocator = std.mem.Allocator; pub const Token = struct { class: Class, text: []const u8, line: Source.Line, pub const Class = enum { invalid, ...
src/compile/token.zig
const std = @import("std"); const Allocator = std.mem.Allocator; //; const lib = @import("lib.zig"); usingnamespace lib; const builtins = @import("builtins.zig"); pub fn readFile(allocator: *Allocator, filename: []const u8) ![]u8 { var file = try std.fs.cwd().openFile(filename, .{ .read = true }); defer file...
src/main.zig
const std = @import("std"); const audiometa = @import("audiometa"); const fmtUtf8SliceEscapeUpper = audiometa.util.fmtUtf8SliceEscapeUpper; const meta = audiometa.metadata; const AllMetadata = meta.AllMetadata; const MetadataMap = meta.MetadataMap; const Allocator = std.mem.Allocator; const start_testing_at_prefix = "...
test/test_against_ffprobe.zig