code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const ArrayList = std.ArrayList; const sdl = @import("./sdl.zig"); const textures = @import("./textures.zig"); const gui = @import("./gui.zig"); const core = @import("core"); const Coord = core.geometry.Coord; const makeCoord = core.geometry.makeCoord; const Rect = core.geometry.Rect; const ...
src/gui/gui_main.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const testing = std.testing; const builtin = @import("builtin"); const assert = std.debug.assert; const is_debug = builtin.mode == .Debug; /// An entity ID uniquely identifies an entity globally within an Entities set. pub const EntityI...
ecs/src/entities.zig
const std = @import("std"); const testing = std.testing; const assert = std.debug.assert; const clang = @import("clang.zig"); const ctok = std.c.tokenizer; const CToken = std.c.Token; const mem = std.mem; const math = std.math; const meta = std.meta; const ast = @import("translate_c/ast.zig"); const Node = ast.Node; c...
src/translate_c.zig
const std = @import("std.zig"); const builtin = std.builtin; const math = std.math; const mem = std.mem; const io = std.io; const os = std.os; const fs = std.fs; const process = std.process; const elf = std.elf; const DW = std.dwarf; const macho = std.macho; const coff = std.coff; const pdb = std.pdb; const ArrayList =...
lib/std/debug.zig
const std = @import("std"); const builtin = @import("builtin"); const expect = std.testing.expect; test "while loop" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; var i: i32 = 0; while (i < 4) { i += 1; } try expect(i == 4); try expect(whileLoop1() == 1); } fn...
test/behavior/while.zig
const builtin = @import("builtin"); const std = @import("std"); const Builder = std.build.Builder; const tests = @import("test/tests.zig"); const os = std.os; const BufMap = std.BufMap; const warn = std.debug.warn; const mem = std.mem; const ArrayList = std.ArrayList; const Buffer = std.Buffer; const io = std.io; pub ...
build.zig
const std = @import("std.zig"); const assert = std.debug.assert; const testing = std.testing; const mem = std.mem; // For mem.Compare const Color = enum(u1) { Black, Red, }; const Red = Color.Red; const Black = Color.Black; const ReplaceError = error{NotEqual}; /// Insert this into your struct that you want ...
std/rb.zig
const std = @import("std"); const mem = std.mem; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const expect = std.testing.expect; /// Type-generic map implemented as an AVL tree. pub fn Map(comptime Key: type, comptime Value: type, lessThan: fn (Key, Key) bool) type { return struct { ...
src/avl.zig
const std = @import("std"); const mem = std.mem; const assert = std.debug.assert; const ir = @import("ir.zig"); const Type = @import("type.zig").Type; const Value = @import("value.zig").Value; const TypedValue = @import("TypedValue.zig"); const link = @import("link.zig"); const Module = @import("Module.zig"); const Err...
src-self-hosted/codegen.zig
const std = @import("std"); const UdpPacket = @This(); pub const Port = u16; source_port: Port, destination_port: Port, checksum: u16, payload: []u8, // TODO: Handle Jumbograms properly pub fn getLength(packet: UdpPacket) u16 { return if (packet.payload.len + 8 > 65_535) 0 else 8 + @intCast(...
src/UdpPacket.zig
const std = @import("std"); const sdl = @import("sdl.zig"); pub const Audio = struct { device: ?sdl.AudioDevice, lastCallbackTime: u64, // We'll allow up to 16 sounds to be played simultaneously sounds: [16]?Sound, next_sound_index: u8, cursor: u64, // current play cursor in the "global" timeli...
src/audio.zig
const std = @import("std"); const debug = std.debug; pub fn main() void { debug.warn("02-2: "); common_chars(input_02); } fn common_chars(ids: [] const [] const u8) void { for (ids) |id, i| { outer: for (ids[i + 1..]) |id2, j| { if (i != j) { debug.assert(id.len == id2....
2018/day_02_2.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const AutoHashMap = std.AutoHashMap; const StringHashMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const util = @import("util.zig"); const gpa = util.gpa; // const data = @embedFile("...
src/day14.zig
const std = @import("std"); const testing = std.testing; const math = std.math; const fixXfYi = @import("fixXfYi.zig").fixXfYi; // Conversion from f32 const __fixsfsi = @import("fixXfYi.zig").__fixsfsi; const __fixunssfsi = @import("fixXfYi.zig").__fixunssfsi; const __fixsfdi = @import("fixXfYi.zig").__fixsfdi; const ...
lib/std/special/compiler_rt/fixXfYi_test.zig
const std = @import("std.zig"); const tokenizer = @import("zig/tokenizer.zig"); const fmt = @import("zig/fmt.zig"); const assert = std.debug.assert; pub const Token = tokenizer.Token; pub const Tokenizer = tokenizer.Tokenizer; pub const fmtId = fmt.fmtId; pub const fmtEscapes = fmt.fmtEscapes; pub const isValidId = fm...
lib/std/zig.zig
const uefi = @import("std").os.uefi; const Guid = uefi.Guid; pub const DevicePathProtocol = packed struct { type: DevicePathType, subtype: u8, length: u16, pub const guid align(8) = Guid{ .time_low = 0x09576e91, .time_mid = 0x6d3f, .time_high_and_version = 0x11d2, .cloc...
lib/std/os/uefi/protocols/device_path_protocol.zig
const std = @import("std"); const mem = std.mem; const net = std.net; const os = std.os; const IO = @import("tigerbeetle-io").IO; const ClientHandler = struct { io: *IO, sock: os.socket_t, recv_buf: []u8, allocator: mem.Allocator, completion: IO.Completion, fn init(allocator: mem.Allocator, io...
examples/tcp_echo_server.zig
const std = @import("std"); const mm = @import("root").mm; const x86 = @import("../x86.zig"); usingnamespace @import("root").lib; pub var logger = @TypeOf(x86.logger).childOf(@typeName(@This())){}; fn alignTo8(n: usize) usize { const mask = 0b111; return (n - 1 | mask) + 1; } pub const Arch = enum(u32) { ...
kernel/arch/x86/multiboot.zig
const std = @import("std"); const dtblib = @import("dtb"); pub const Error = dtblib.Error || error{UartNotFound}; pub const Uart = struct { base: u64, reg_shift: u4, kind: UartKind, }; pub const UartKind = enum { ArmPl011, // "arm,pl011" -- QEMU ARM SnpsDwApbUart, // "snps,dw-apb-uart...
common/ddtb.zig
const std = @import("std"); const stdx = @import("stdx"); const graphics = @import("graphics"); const Color = graphics.Color; const ui = @import("../ui.zig"); const ScrollView = ui.widgets.ScrollView; const NullId = std.math.maxInt(u32); const log = stdx.log.scoped(.list); pub const ScrollList = struct { props: ...
ui/src/widgets/list.zig
const std = @import("std.zig"); const builtin = @import("builtin"); const testing = std.testing; const ResetEvent = std.ResetEvent; /// Lock may be held only once. If the same thread /// tries to acquire the same mutex twice, it deadlocks. /// This type supports static initialization and is based off of Webkit's WTF L...
lib/std/mutex.zig
const std = @import("std"); const math = @import("../pkg/zlm.zig"); // @TODO: More settings to streamline spatial hash usage for other purposes. Maybe even // make it so you can provide your own coordinate type and functions? pub const SpatialHashSettings = struct { /// The height and width of each bucket inside t...
src/zt/spatialHash.zig
const std = @import("std"); const zm = @import("zmath"); const pow = std.math.pow; const PI = std.math.pi; const print = std.io.getStdOut().writer().print; const printErr = std.io.getStdErr().writer().print; const Vector = std.meta.Vector; const Random = std.rand.Random; const DefaultRandom = std.rand.DefaultPrng; cons...
src/main.zig
const std = @import("std"); const upaya = @import("upaya"); const math = upaya.math; const colors = upaya.colors; const fs = std.fs; usingnamespace upaya.imgui; const stb = @import("stb"); var atlas: ?upaya.TexturePacker.Atlas = null; var texture: ?upaya.Texture = null; pub fn main() !void { upaya.run(.{ ...
examples/texture_packer.zig
usingnamespace @import("std").builtin; /// Deprecated pub const arch = Target.current.cpu.arch; /// Deprecated pub const endian = Target.current.cpu.arch.endian(); /// Zig version. When writing code that supports multiple versions of Zig, prefer /// feature detection (i.e. with `@hasDecl` or `@hasField`) over version ...
src/math/zig-cache/o/8d7d9ae0f723e92a28b38e71154cbc0f/builtin.zig
const c = @import("../../c_global.zig").c_imp; const std = @import("std"); // dross-zig const OpenGlError = @import("renderer_opengl.zig").OpenGlError; const FileLoader = @import("../../utils/file_loader.zig"); // ----------------------------------------- // ----------------------------------------- // ...
src/renderer/backend/shader_opengl.zig
const std = @import("std"); const builtin = std.builtin; const build_root = "../build/"; const is_windows = std.Target.current.os.tag == .windows; const is_macos = std.Target.current.os.tag == .macos; pub fn build(b: *std.build.Builder) anyerror!void { const mode = b.standardReleaseOptions(); // Previously ...
src/build.zig
const image = @import("./image.zig"); const t = @import("../testing/index.zig"); const std = @import("std"); fn in(f: image.Rectangle, g: image.Rectangle) bool { if (!f.in(g)) { return false; } var y = f.min.y; while (y < f.max.y) { var x = f.min.x; while (x < f.max.x) { ...
src/image/image_test.zig
const std = @import("std"); const expectEqual = std.testing.expectEqual; const approxEq = std.math.approxEq; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const Buffer = std.Buffer; const fixedBufferStream = std.io.fixedBufferStream; pub const Pos = struct { x: usize, y: usize, con...
zig/10.zig
const sf = @import("../sfml.zig"); const Music = @This(); // Constructor/destructor /// Loads music from a file pub fn createFromFile(path: [:0]const u8) !Music { var music = sf.c.sfMusic_createFromFile(path); if (music == null) return sf.Error.resourceLoadingError; return Music{ ._ptr = music.?...
src/sfml/audio/Music.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ogg = @import("ogg.zig"); const Metadata = @import("metadata.zig").Metadata; pub const codec_id = "vorbis"; // bit flags for the header type (used in the first byte of a page's data) // from https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-620004...
src/vorbis.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/day14.zig
const std = @import("std"); const expectEqualStrings = std.testing.expectEqualStrings; pub fn fromPascalCase(allocator: std.mem.Allocator, name: []const u8) ![]u8 { const rc = try allocator.alloc(u8, name.len * 2); // This is overkill, but is > the maximum length possibly needed errdefer allocator.free(rc); ...
codegen/src/snake.zig
const Trie = @This(); const std = @import("std"); const mem = std.mem; const leb = std.leb; const log = std.log.scoped(.link); const testing = std.testing; const assert = std.debug.assert; const Allocator = mem.Allocator; pub const Symbol = struct { name: []const u8, vmaddr_offset: u64, export_flags: u64,...
src/link/MachO/Trie.zig
const haversine = @import("haversine.zig"); const std = @import("std"); const math = std.math; const testing = std.testing; const epsilon = 0.000001; test "Miami, FL to New York, NY" { const miami = haversine.LatLng{ .lat = 25.761681, .lng = -80.191788, }; const ny = haversine.LatLng{ ...
haversine_test.zig
const util = @import("../sdf_util.zig"); pub const info: util.SdfInfo = .{ .name = "Capped Cylinder", .data_size = @sizeOf(Data), .function_definition = function_definition, .enter_command_fn = util.surfaceEnterCommand(Data), .exit_command_fn = util.surfaceExitCommand(Data, exitCommand), .appe...
src/sdf/surfaces/capped_cylinder.zig
const std = @import("std"); const utils = @import("utils.zig"); const SparseSet = @import("sparse_set.zig").SparseSet; const Signal = @import("../signals/signal.zig").Signal; const Sink = @import("../signals/sink.zig").Sink; /// Stores an ArrayList of components along with a SparseSet of entities pub fn ComponentStor...
src/ecs/component_storage.zig
const std = @import("std"); const print = std.debug.print; pub fn main() anyerror!void { const allocator = std.heap.page_allocator; const input: []const u8 = "cqjxjnds"; var current: []u8 = try allocator.alloc(u8, 8); std.mem.copy(u8, current, input); var password_count: usize = 0; outer: ...
src/day11.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); } const Vec2 = struct { x: i32, y: i32, }; const Segment = struct { o: Vec2, ...
2019/day03.zig
const std = @import("std"); const fs = std.fs; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = &gpa.allocator; const input = try fs.cwd().readFileAlloc(allocator, "data/input_02_1.txt", std.math.maxInt(usize)); // Solution 1 { var lines = std.mem...
2020/src/day_02.zig
const wlr = @import("../wlroots.zig"); const std = @import("std"); const wayland = @import("wayland"); const wl = wayland.server.wl; const zwp = wayland.server.zwp; pub const PointerGesturesV1 = extern struct { global: *wl.Global, swipes: wl.list.Head(zwp.PointerGestureSwipeV1, null), pinches: wl.list.Hea...
src/types/pointer_gestures_v1.zig
const std = @import("std"); const glfw = @import("glfw"); const c = @cImport({ @cDefine("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", ""); // @cDefine("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"); @cInclude("cimgui.h"); @cInclude("./cimgui_impl.h"); // @cUndef("CIMGUI_DEFINE_ENUMS_AND_STRUCTS"); ...
src/main.zig
const std = @import("std"); const builtin = @import("builtin"); const build_options = @import("build_options"); pub const kernel = @import("kernel.zig"); const kernel_main = kernel.kernel_main; const utils = @import("utils"); // pub const sse_enabled: bool = blk: { // for (builtin.cpu.arch.allFeaturesList()) |fe...
kernel/kernel_start_x86_32.zig
const std = @import("std"); const ArrayList = std.ArrayList; pub const Value = union(enum) { Uint8: u8, Uint16: u16, Uint32: u32, Uint64: u64, Int8: i8, Int16: i16, Int32: i32, Int64: i64, Float32: f32, Float64: f64, Null, Bool: bool, String: []const u8, Arr...
src/msgpack.zig
const std = @import("std"); const builtin = @import("builtin"); pub const Parity = enum { /// No parity bit is used none, /// Parity bit is `0` when an even number of bits is set in the data. even, /// Parity bit is `0` when an odd number of bits is set in the data. odd, /// Parity bit is a...
serial.zig
const std = @import("../std.zig"); const CpuFeature = std.Target.Cpu.Feature; const CpuModel = std.Target.Cpu.Model; pub const Feature = enum { deprecated_v8, detectroundchange, fixallfdivsqrt, hard_quad_float, hasleoncasa, hasumacsmac, insertnopload, leon, leoncyclecounter, leo...
lib/std/target/sparc.zig
const config = @import("config.zig"); const std = @import("std"); const c = std.c; const debug = std.debug; const heap = std.heap; const math = std.math; const mem = std.mem; const os = std.os; const unicode = std.unicode; const allocator = heap.c_allocator; const ESC_BUF_SIZ = (128 * @sizeOf(Rune)); const ESC_ARG_S...
src/st.zig
const builtin = @import("builtin"); const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; /// Returns the natural logarithm of 1 + x with greater accuracy when x is near zero. /// /// Special Cases: /// - log1p(+inf) = +inf /// - log1p(+-0) = +-0 /// - log1p(-1) = -inf ...
lib/std/math/log1p.zig
const std = @import("std"); const table_bits: usize = 14; // Bits used in the table. const table_size: usize = 1 << table_bits; // Size of the table. const table_mask: usize = table_size - 1; // Mask for table indices. Redundant, but can eliminate bounds checks. const table_shift: usize = 32 - table_bits; // Right-shi...
src/fast.zig
const std = @import("std"); const copy = std.mem.copy; const Random = std.rand.Random; const W = 8; pub fn PrivateKey(comptime Hash: type) type { const n = Hash.digest_length; return struct { const Self = @This(); pub const digest_length = n; forward_hash_key: [n][n]u8 = undef...
src/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/day08-tst.tx...
src/day08.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; var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; pub const gpa = gpa_impl.allocator(); pub fn par...
src/util.zig
pub const deployment_environment = .development; /// The maximum log level in increasing order of verbosity (emergency=0, debug=7): pub const log_level = 6; /// The maximum number of replicas allowed in a cluster. pub const replicas_max = 15; /// The minimum number of nodes required to form quorums for leader electi...
src/config.zig
const std = @import("std"); const log = std.log; const builtin = @import("builtin"); const Parser = @import("parser.zig").Parser; const HTMLGenerator = @import("html.zig").HTMLGenerator; const CodeRunner = @import("code_chunks.zig").CodeRunner; const cite = @import("cite.zig"); const run_citeproc = cite.run_citeproc; ...
src/main.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const SkyMap = tools.Map(u8, 500, 500, true); const Vec2 = tools.Vec2; pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { const Star = struct { p: Vec2, v: Vec2 }; var stars = std.ArrayList(S...
2018/day10.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const assert = std.debug.assert; pub const main = tools.defaultMain("2021/day11.txt", run); const Vec2 = tools.Vec2; const M...
2021/day11.zig
const std = @import("std"); const lola = @import("lola"); //// // Multi-environment communication example: // In this example, we have three scripts: // server.lola: Exporting a simple key-value store // client-a.lola: Writes "Hello, World!" into the store in server // client-b.lola: Reads the message from the serve...
examples/host/multi-environment/main.zig
usingnamespace @import("../Zig-PSP/src/psp/include/pspgu.zig"); usingnamespace @import("../Zig-PSP/src/psp/include/pspdisplay.zig"); usingnamespace @import("../Zig-PSP/src/psp/include/pspctrl.zig"); usingnamespace @import("../Zig-PSP/src/psp/include/pspgum.zig"); const vram = @import("../Zig-PSP/src/psp/utils/vram.zig"...
src/gfx/renderer.zig
const std = @import("../../std.zig"); const net = @import("net.zig"); const os = std.os; const fmt = std.fmt; const mem = std.mem; const time = std.time; const meta = std.meta; const native_os = std.Target.current.os; const native_endian = std.Target.current.cpu.arch.endian(); const Buffer = std.x.os.Buffer; const a...
lib/std/x/os/socket.zig
const std = @import("std"); const lpc1768 = @import("lpc1768"); const ISRHandler = fn () callconv(.C) void; const start_of_ram = 0x10000000; const stack_size = 0x2000; const initial_sp = start_of_ram + stack_size; var mutable_vector_table: @TypeOf(fixed_vector_table) = undefined; extern var __bss__start: c_void; ex...
research-chamber/src/boot.zig
const x86_64 = @import("../index.zig"); const bitjuggle = @import("bitjuggle"); const std = @import("std"); /// Returns the current value of the code segment register. pub fn getCs() x86_64.structures.gdt.SegmentSelector { return .{ .value = asm ("mov %%cs, %[ret]" : [ret] "=r" (-> u16), ...
src/instructions/segmentation.zig
const builtin = @import("builtin"); const std = @import("std"); const math = std.math; const assert = std.debug.assert; const L = std.unicode.utf8ToUtf16LeStringLiteral; const zwin32 = @import("zwin32"); const w32 = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hr...
samples/bullet_physics_test/src/bullet_physics_test.zig
const std = @import("std"); const print = std.debug.print; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day09.txt"); pub fn main() !void { var timer = try std.time.Timer.start(); var arrayList = std.ArrayList(u8).init(gpa); defer { arrayList.deinit(); } var lines...
src/day09.zig
const builtin = @import("builtin"); const std = @import("std"); const opcodes = @import("opcodes.zig"); const Instruction = opcodes.Instruction; const object = @import("object.zig"); const Function = object.Function; const Constant = object.Constant; pub const signature = "\x1BLua"; pub const luac_version: u8 = 0x51; ...
src/dump.zig
pub const WSB_MAX_OB_STATUS_VALUE_TYPE_PAIR = @as(u32, 5); pub const WSB_MAX_OB_STATUS_ENTRY = @as(u32, 5); //-------------------------------------------------------------------------------- // Section: Types (8) //-------------------------------------------------------------------------------- // TODO: this type is l...
deps/zigwin32/win32/system/server_backup.zig
const DebugSymbols = @This(); const std = @import("std"); const build_options = @import("build_options"); const assert = std.debug.assert; const fs = std.fs; const link = @import("../../link.zig"); const log = std.log.scoped(.link); const macho = std.macho; const makeStaticString = MachO.makeStaticString; const math =...
src/link/MachO/DebugSymbols.zig
const std = @import("std"); const Execution = @import("execution.zig"); pub const Meta = struct { code: std.wasm.Opcode, func_name: []const u8, arg_kind: Arg.Kind, push: ?Stack.Change, pop: []const Stack.Change, pub fn name(self: Meta) []const u8 { return self.func_name[5..]; } ...
src/op.zig
const builtin = @import("builtin"); const std = @import("std.zig"); const os = std.os; const mem = std.mem; const base64 = std.base64; const crypto = std.crypto; const Allocator = std.mem.Allocator; const assert = std.debug.assert; pub const path = @import("fs/path.zig"); pub const File = @import("fs/file.zig").File; ...
std/fs.zig
extern fn pam_start( service_name: [*:0]const u8, user: ?[*:0]const u8, conversation: *const Conv, pamh: **Handle, ) Result; pub const start = pam_start; pub const Handle = opaque { extern fn pam_end( pamh: *Handle, /// Should be set to the result of the last pam library call. ...
src/pam.zig
const assert = @import("std").debug.assert; const math = @import("std").math; fn radians(deg: f32) f32 { return deg * (math.pi / 180.0); } pub const Vec2 = packed struct { x: f32, y: f32, pub fn zero() Vec2 { return Vec2 { .x = 0.0, .y = 0.0 }; } pub fn one() Vec2 { return Vec2 {...
src/math.zig
const warn = std.debug.warn; const std = @import("std"); /// The earliest year that can be stored in a Date pub const minYear: i32 = i32(std.math.minInt(i23)); /// The latest year that can be stored in a Date pub const maxYear: i32 = i32(std.math.maxInt(i23)); /// The earliest month that can be stored in a Date: ///...
src/gregorianDate.zig
const std = @import("std"); const Command = @import("Command.zig"); const flag = @import("flag.zig"); // const Arg = @import("Arg.zig"); const testing = std.testing; const allocator = std.heap.page_allocator; fn initAppArgs(alloc: std.mem.Allocator) !Command { var app = Command.new(alloc, "app"); // app <ARG...
src/main.zig
usingnamespace @import("core.zig"); const glfw = @import("glfw"); const vk = @import("vulkan"); usingnamespace @import("vulkan/instance.zig"); const Device = @import("vulkan/device.zig").Device; const Swapchain = @import("vulkan/swapchain.zig").Swapchain; const Mesh = @import("renderer/mesh.zig").Mesh; const Transfe...
src/renderer.zig
const std = @import("std"); const hash = std.crypto.hash; const mem = std.mem; const rand = std.rand; const testing = std.testing; const time = std.time; const log = std.log.scoped(.uuid); const Uuid = @This(); bytes: [16]u8, pub const nil = fromInt(0); /// Creates a new UUID from a 16-byte slice. Only validates t...
src/Uuid.zig
const xcb = @import("../xcb.zig"); pub const id = xcb.Extension{ .name = "DPMS", .global_id = 0 }; /// @brief GetVersioncookie pub const GetVersioncookie = struct { sequence: c_uint, }; /// @brief GetVersionRequest pub const GetVersionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 0, ...
src/auto/dpms.zig
const Self = @This(); const std = @import("std"); const mem = std.mem; const wlr = @import("wlroots"); const wayland = @import("wayland"); const wl = wayland.server.wl; const river = wayland.server.river; const server = &@import("main.zig").server; const util = @import("util.zig"); const Box = @import("Box.zig"); c...
source/river-0.1.0/river/Layout.zig
const std = @import("std"); const warn = std.debug.warn; const fmt = std.fmt; const Allocator = std.mem.Allocator; const pngShader = @import("pngShader.zig"); const SsaaShader = @import("ssaashader.zig").SsaaShader; pub const ShaderConfig = @import("shaderconfig.zig").ShaderConfig; const resolutions = @import("resol...
lib/renderer.zig
const std = @import("std"); const uefi = std.os.uefi; const elf = std.elf; const dcommon = @import("common/dcommon.zig"); pub fn halt() noreturn { asm volatile ( \\ csrci mstatus, 1 \\0: wfi \\ j 0b ); unreachable; } pub fn transfer(entry_data: *dcommon.EntryData, uart_base: u6...
dainboot/src/riscv64.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const assert = std.debug.assert; /// Asserts at compile time that `T` is an integer, returns `T` pub fn requireInt(comptime T: type) type { comptime assert(@typeInfo(T) == .Int); return T; } /// Assert...
bithacks.zig
const std = @import("std"); const display = @import("zbox"); const url = @import("./utils/url.zig"); allocator: std.mem.Allocator, nick: []const u8, last_message: ?*Message = null, last_link_message: ?*Message = null, bottom_message: ?*Message = null, disconnected: bool = false, const Self = @This(); pub const Mess...
src/Chat.zig
const std = @import("std"); const builtin = @import("builtin"); const Pkg = std.build.Pkg; const string = []const u8; pub const cache = ".zigmod/deps"; pub fn addAllTo(exe: *std.build.LibExeObjStep) void { checkMinZig(builtin.zig_version, exe); @setEvalBranchQuota(1_000_000); for (packages) |pkg| { ...
deps.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const L = std.unicode.utf8ToUtf16LeStringLiteral; const zwin32 = @import("zwin32"); const w32 = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hrPanicOnFail; const zd3d12 = @import(...
samples/simple_raytracer/src/simple_raytracer.zig
const builtin = @import("builtin"); const std = @import("std"); const assert = std.debug.assert; const Allocator = std.mem.Allocator; const WindowsPath = std.fs.path.WindowsPath; const native_os = builtin.target.os.tag; pub fn replaceExtension(allocator: Allocator, path: []const u8, new_ext: []const u8) ![]u8 { co...
limp/fs.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 Node = struct...
day_23/src/main.zig
const std = @import("std"); const mem = std.mem; const UnifiedIdeograph = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 13312, hi: u21 = 201546, pub fn init(allocator: *mem.Allocator) !UnifiedIdeograph { var instance = UnifiedIdeograph{ .allocator = allocator, .array = try allocat...
src/components/autogen/PropList/UnifiedIdeograph.zig
const std = @import("std"); const testing = std.testing; const allocator = std.heap.page_allocator; pub const Adapter = struct { top: usize, sorted: bool, ratings: std.ArrayList(usize), pub fn init() Adapter { var self = Adapter{ .ratings = std.ArrayList(usize).init(allocator), ...
2020/p10/adapter.zig
const std = @import("std"); const debug = std.debug; const heap = std.heap; const LinkedList = std.LinkedList; const mem = std.mem; const Node = LinkedList(u32).Node; const debug_logging: bool = false; pub fn main() void { var allocator = &std.heap.DirectAllocator.init().allocator; debug.warn("09-1: {}\n", co...
2018/day_09.zig
const url = @import("./url.zig"); const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const debug = std.debug; const EscapeTest = struct{ in: []const u8, out: []const u8, err: ?url.Error, }; fn unescapePassingTests() []const EscapeTest { const ts = []EscapeTest{ E...
src/net/url/url_test.zig
const types = @import("types.zig"); const jmap_error = struct { request_level: struct { const ProblemDetails = struct { /// A URI reference [RFC3986] that identifies the problem type. type: []const u8, /// A short, human-readable summary of the problem type. ...
error.zig
const common = @import("common.zig"); pub const InitializeParams = struct { pub const method = "initialize"; pub const kind = common.PacketKind.request; capabilities: ClientCapabilities, workspaceFolders: ?[]const common.WorkspaceFolder, }; pub const RegularExpressEngineVersion = union(enum) { n...
src/types/general.zig
const AstGen = @This(); const std = @import("std"); const ast = std.zig.ast; const mem = std.mem; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const ArrayListUnmanaged = std.ArrayListUnmanaged; const Value = @import("value.zig").Value; const Type = @import("type.zig").Type; const TypedValue ...
src/AstGen.zig
const Archive = @This(); const std = @import("std"); const fmt = std.fmt; const fs = std.fs; const mem = std.mem; const log = std.log.scoped(.archive); const Allocator = std.mem.Allocator; file: fs.File, name: []const u8, archive_type: ArchiveType, files: std.ArrayListUnmanaged(ArchivedFile), // Use it so we can e...
src/archive/Archive.zig
//! A thread-safe resource which supports blocking until signaled. //! This API is for kernel threads, not evented I/O. //! This API is statically initializable. It cannot fail to be initialized //! and it requires no deinitialization. The downside is that it may not //! integrate as cleanly into other synchronization...
lib/std/StaticResetEvent.zig
const ser = @import("../../../lib.zig").ser; /// Sequence serialization interface. /// /// Getty sequences are only partially serialized by `getty.Serializer` /// implementations due to the fact that there are many different ways to /// iterate over and access the elements of a sequence. As such, this interface /// is...
src/ser/interface/seq.zig
const std = @import("std"); const Pkg = std.build.Pkg; const FileSource = std.build.FileSource; pub const pkgs = struct { pub const zbox = Pkg{ .name = "zbox", .path = FileSource{ .path = "forks/zbox/src/box.zig", }, .dependencies = &[_]Pkg{ Pkg{ ...
deps.zig
const std = @import("std"); const builtin = @import("builtin"); const fs = std.fs; const os = std.os; const io = std.io; const mem = std.mem; const fmt = std.fmt; const system = if (builtin.link_libc) @cImport({ @cInclude("termios.h"); @cInclude("sys/ioctl.h"); }) else...
src/prim.zig
const w4 = @This(); const std = @import("std"); /// PLATFORM CONSTANTS pub const CANVAS_SIZE = 160; /// Helpers pub const Vec2 = @import("std").meta.Vector(2, i32); pub const x = 0; pub const y = 1; pub fn texLen(size: Vec2) usize { return @intCast(usize, std.math.divCeil(i32, size[x] * size[y] * 2, 8) catch unr...
src/wasm4.zig
const std = @import("std"); const debug = std.debug; const os = std.os; const mem = std.mem; const fs = std.fs; const File = fs.File; const Dir = fs.Dir; const fmt = std.fmt; const BUFFERSIZE = 8292 * 2; pub const ProcessInformation = struct { pid: i32 = 0, // 8k for buffer ? is it enought ? commandlinebu...
processlib.zig
const std = @import("std"); const assert = std.debug.assert; const meta = std.meta; const builtin = std.builtin; usingnamespace @cImport({ @cInclude("stdio.h"); @cInclude("string.h"); @cInclude("unistd.h"); @cInclude("time.h"); @cInclude("errno.h"); @cInclude("stdintfix.h"); // NB: Required as...
src/main.zig
//-------------------------------------------------------------------------------- // Section: Types (21) //-------------------------------------------------------------------------------- const CLSID_GameExplorer_Value = @import("zig.zig").Guid.initString("9a5ea990-3034-4d6f-9128-01f3c61022bc"); pub const CLSID_GameE...
win32/gaming.zig