code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); pub const Scanner = struct { const Self = @This(); source: []const u8, start: usize = 0, current: usize = 0, line: usize = 1, pub fn init(source: []const u8) Self { return Self{ .source = source }; } pub fn hasNextToken(self: *Self) bool { s...
src/scanner.zig
const std = @import("std"); const builtin = @import("builtin"); const os = std.os; const math = std.math; pub usingnamespace if (!@hasDecl(std.os, "SHUT_RD") and !@hasDecl(std.os, "SHUT_WR") and !@hasDecl(std.os, "SHUT_RDWR")) struct { pub const SHUT_RD = 0; pub const SHUT_WR = 1; pub cons...
os/posix.zig
const std = @import("std"); const Target = std.Target; const Version = std.builtin.Version; const mem = std.mem; const log = std.log; const fs = std.fs; const fmt = std.fmt; const assert = std.debug.assert; // Example abilist path: // ./sysdeps/unix/sysv/linux/aarch64/libc.abilist const AbiList = struct { targets:...
consolidate.zig
const builtin = @import("builtin"); const std = @import("std"); const math = std.math; const expect = std.testing.expect; /// Returns the sine of the radian value x. /// /// Special Cases: /// - sin(+-0) = +-0 /// - sin(+-inf) = nan /// - sin(nan) = nan pub fn sin(x: anytype) @TypeOf(x) { const T = @TypeOf...
src/psp/sdk/sin.zig
const allocator = @import("memory.zig").allocator; const contexts = @import("contexts.zig"); const enums = @import("enums.zig"); const hostcalls = @import("hostcalls.zig"); const std = @import("std"); pub var current_state: State = .{ .new_root_context = null, .root_contexts = std.AutoHashMap(u32, *contexts.Ro...
lib/state.zig
const std = @import("index.zig"); const debug = std.debug; const assert = debug.assert; const mem = std.mem; const os = std.os; const builtin = @import("builtin"); const Os = builtin.Os; const c = std.c; const Allocator = mem.Allocator; pub const c_allocator = &c_allocator_state; var c_allocator_state = Allocator{ ...
std/heap.zig
const std = @import("std"); pub const TokenType = enum { // Single char tokens OpenParen, CloseParen, OpenBrace, CloseBrace, OpenBracket, CloseBracket, Comma, Dot, Semicolon, // One or two char tokens Equal, EqualEqual, BangEqual, Less, LessEqual, G...
src/scanner.zig
const std = @import("std"); const c = @cImport({ @cInclude("SDL2/SDL.h"); }); /// the size of the view; pixels const size_view = [2]comptime_int { 640, 480, }; /// the title of the view window const window_title = "zig_ray"; /// how sensetive the mouse is; ratio between pixels and radians const mouse_sensitivi...
src/main.zig
const std = @import("std"); const assert = std.debug.assert; pub const Gonzo = struct { const allocator = std.heap.direct_allocator; pub const Data = struct { id: usize, map: std.AutoHashMap(usize, usize), pub fn init(id: usize) Data { std.debug.warn("Data init {}\n", id);...
2018/p04/gonzo.zig
const std = @import("std"); const testing = std.testing; pub const Map = struct { rows: usize, cols: usize, cells: std.AutoHashMap(Pos, Tile), pub const Tile = enum(u8) { Empty = 0, Tree = 1, }; pub const Pos = struct { x: usize, y: usize, pub fn init(...
2020/p03/map.zig
const std = @import("std"); const testing = std.testing; const f128math = @import("f128math"); const math = f128math; const inf_f32 = math.inf_f32; const nan_f32 = math.qnan_f32; const inf_f64 = math.inf_f64; const nan_f64 = math.qnan_f64; const inf_f128 = math.inf_f128; const nan_f128 = math.qnan_f128; const test_ut...
tests/exp2.zig
const Header = @This(); /// Magic number pub const magic: u32 = 0x55aa1234; /// Versions 1 and 2 are supported version: u32, /// Size of the directory tree in bytes /// /// Versions: 1, 2 tree_size: u32, /// Size of the section containing files saved internally in this VPK /// /// Versions: 2 file_data_section_size: ...
src/vpk/Header.zig
const std = @import("std"); pub const WindowFind = struct { distance: u16, // NOTE: Maximum length is 258. length: u16 }; pub fn windowInjectByteDefault(self: anytype, byte: u8) void { var tmp = [_]u8{ byte }; self.inject(tmp[0..1]); } // -- Implementations -- pub fn MemoryOptimizedWindow(compt...
src/window.zig
const std = @import("std"); const mem = std.mem; const fmt = std.fmt; const print = std.debug.print; const ArrayList = std.ArrayList; var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const data = @embedFile("../inputs/day_03"); const StuffToReach = enum { OxygenGenerator, CO2Scruber, }; pub fn main() !voi...
src/03.zig
const std = @import("std"); pub const c = @import("src/c.zig"); const builtin = std.builtin; const debug = std.debug; const math = std.math; const mem = std.mem; const meta = std.meta; const nk = @This(); pub const atlas = @import("src/atlas.zig"); pub const bar = @import("src/bar.zig"); pub const button = @import("...
nuklear.zig
const regs = @import("rp2040_ras"); pub const SIO_GPIO = enum { GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21, ...
src/hal/sio.zig
const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const mem = std.mem; const config = @import("config.zig"); const vsr = @import("vsr.zig"); const Header = vsr.Header; comptime { // message_size_max must be a multiple of sector_size for Direct I/O assert(config....
src/message_pool.zig
const std = @import("std"); const mem = std.mem; const reserved_chars = &[_]u8{ '!', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', ':', ';', '=', '?', '@', '[', ']', }; const reserved_escapes = blk: { var escapes: [reserved_chars.len][3]u8 = [_][3]u8{[_]u8{undefined} ** 3} ** reserved_chars.len; ...
src/uri.zig
const std = @import("std"); const DocumentStore = @import("./DocumentStore.zig"); const Ast = std.zig.Ast; const types = @import("./types.zig"); const offsets = @import("./offsets.zig"); const log = std.log.scoped(.analysis); const ast = @import("./ast.zig"); var using_trail: std.ArrayList([*]const u8) = undefined; va...
src/analysis.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const assert = std.debug.assert; const testing = std.testing; const leb = std.leb; const mem = std.mem; const wasm = std.wasm; const Module = @import("../Module.zig"); const Decl = Module.Decl; const Type = @import("../ty...
src/codegen/wasm.zig
const compiler_rt_armhf_target = false; // TODO const ConditionalOperator = enum { Eq, Lt, Le, Ge, Gt, }; pub nakedcc fn __aeabi_dcmpeq() noreturn { @setRuntimeSafety(false); @call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Eq}); unreachable; } pub nakedcc fn __aeabi_dcmplt() no...
lib/std/special/compiler_rt/arm/aeabi_dcmp.zig
const std = @import("std"); const zzz = @import("zzz"); const version = @import("version"); const Package = @import("Package.zig"); const Dependency = @import("Dependency.zig"); usingnamespace @import("common.zig"); const Self = @This(); allocator: *std.mem.Allocator, text: []const u8, packages: std.StringHashMap(Pa...
src/Project.zig
const PipelineLayout = @import("PipelineLayout.zig"); const VertexState = @import("structs.zig").VertexState; const PrimitiveState = @import("structs.zig").PrimitiveState; const DepthStencilState = @import("structs.zig").DepthStencilState; const MultisampleState = @import("structs.zig").MultisampleState; const Fragment...
gpu/src/RenderPipeline.zig
const builtin = @import("builtin"); const c = @import("../c.zig"); const ico = @import("../image/ico.zig"); const nyancore_options = @import("nyancore_options"); const rg = @import("../renderer/render_graph/render_graph.zig"); const std = @import("std"); const tracy = @import("../tracy.zig"); const Allocator = std.mem...
src/application/application.zig
pub const SI_TEMPORARY = @as(u32, 2147483648); pub const SUBSINFO_ALLFLAGS = @as(u32, 61311); pub const RS_READY = @as(u32, 1); pub const RS_SUSPENDED = @as(u32, 2); pub const RS_UPDATING = @as(u32, 4); pub const RS_SUSPENDONIDLE = @as(u32, 65536); pub const RS_MAYBOTHERUSER = @as(u32, 131072); pub const RS_COMPLETED =...
win32/system/search.zig
pub const RASNAP_ProbationTime = @as(u32, 1); pub const RASTUNNELENDPOINT_UNKNOWN = @as(u32, 0); pub const RASTUNNELENDPOINT_IPv4 = @as(u32, 1); pub const RASTUNNELENDPOINT_IPv6 = @as(u32, 2); pub const RAS_MaxDeviceType = @as(u32, 16); pub const RAS_MaxPhoneNumber = @as(u32, 128); pub const RAS_MaxIpAddress = @as(u32,...
win32/network_management/rras.zig
const std = @import("std"); const testing = std.testing; const StringTable = @import("./strtab.zig").StringTable; const allocator = std.heap.page_allocator; pub const Luggage = struct { const Bag = struct { code: usize, children: std.AutoHashMap(usize, usize), parents: std.AutoHashMap(usiz...
2020/p07/luggage.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; //-------------------------------------------------------------------------------------------------- pub fn part1() anyerror!void { const file = std.fs.cwd().openFile("data/day09_input.txt", .{}) catch |err| label: {...
src/day09.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const Crabs = ArrayList(u16); //-------------------------------------------------------------------------------------------------- pub fn sort(crabs: *Crabs) void { var i: usize = 1; while (i < crabs.items.len) :...
src/day07.zig
const wlr = @import("../wlroots.zig"); const wayland = @import("wayland"); const wl = wayland.server.wl; pub const OutputLayout = extern struct { pub const State = opaque {}; pub const Output = extern struct { output: *wlr.Output, x: c_int, y: c_int, /// OutputLayout.outputs ...
src/types/output_layout.zig
const std = @import("std"); const unistd = @cImport(@cInclude("unistd.h")); const UPPER_BOUND: i32 = 5_000_000; const PREFIX: i32 = 32_338; const Node = struct { children: std.AutoArrayHashMap(u8, *Node), terminal: bool = false, fn init(alloc: *std.mem.Allocator) Node { return Node{ ....
primes/primes.zig
const std = @import("std"); const testing = std.testing; const expect = testing.expect; const expectEqual = testing.expectEqual; const expectApproxEqRel = testing.expectApproxEqRel; const assert = std.debug.assert; const Vector4 = @import("vector4.zig").Vector4; const Vector3 = @import("vector3.zig").Vector3; usingna...
src/matrix4x4.zig
const std = @import("std"); const c = @import("c.zig").c; const Error = @import("errors.zig").Error; const getError = @import("errors.zig").getError; /// Returns the GLFW time. /// /// This function returns the current GLFW time, in seconds. Unless the time /// has been set using @ref glfwSetTime it measures time ela...
mach-glfw/src/time.zig
const std = @import("std"); const mem = std.mem; const assert = std.debug.assert; const Allocator = std.mem.Allocator; const fs = std.fs; const C = @This(); const Module = @import("../Module.zig"); const Compilation = @import("../Compilation.zig"); const codegen = @import("../codegen/c.zig"); const link = @import("../...
src/link/C.zig
const __floattisf = @import("floattisf.zig").__floattisf; const assert = @import("std").debug.assert; fn test__floattisf(a: i128, expected: f32) void { const x = __floattisf(a); assert(x == expected); } test "floattisf" { test__floattisf(0, 0.0); test__floattisf(1, 1.0); test__floattisf(2, 2.0); ...
std/special/compiler_rt/floattisf_test.zig
const std = @import("std"); const Peer = @import("Peer.zig"); const TorrentFile = @import("torrent_file.zig").TorrentFile; const Worker = @import("worker.zig").Worker; const Work = @import("worker.zig").Work; const Client = @import("net/Tcp_client.zig"); const Torrent = @This(); /// peers is a list of seeders we can...
src/Torrent.zig
const std = @import("std"); const ig = @import("imgui"); const engine = @import("engine.zig"); const autogui = @import("autogui.zig"); const math = std.math; const Allocator = std.mem.Allocator; const warn = std.debug.warn; const assert = std.debug.assert; const heap_allocator = std.heap.c_allocator; var sim_speed:...
src/nettest.zig
const __fixsfsi = @import("fixsfsi.zig").__fixsfsi; const std = @import("std"); const math = std.math; const testing = std.testing; const warn = std.debug.warn; fn test__fixsfsi(a: f32, expected: i32) void { const x = __fixsfsi(a); //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", .{a, @bitCast(u32, ...
lib/std/special/compiler_rt/fixsfsi_test.zig
const xcb = @import("../xcb.zig"); pub const id = xcb.Extension{ .name = "RECORD", .global_id = 0 }; pub const CONTEXT = u32; /// @brief Range8 pub const Range8 = struct { @"first": u8, @"last": u8, }; /// @brief Range16 pub const Range16 = struct { @"first": u16, @"last": u16, }; /// @brief ExtRa...
src/auto/record.zig
pub const tables = @import("tables.zig"); const warn = @import("std").debug.warn; pub fn is16(ranges: []const tables.Range16, r: u16) bool { if (ranges.len <= tables.linear_max or r <= tables.linear_max) { for (ranges) |*range| { if (r < range.lo) { return false; } ...
src/unicode/unicode.zig
const std = @import("std"); const imgui = @import("imgui"); const glfw = @import("glfw"); const GLFW_HAS_WINDOW_TOPMOST = (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200); // 3.2+ GLFW_FLOATING const GLFW_HAS_WINDOW_HOVERED = (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300); // 3.3+ GLFW_HO...
src/imgui_impl_glfw.zig
const std = @import("std"); const fun = @import("fun"); const debug = std.debug; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; const scan = fun.scan.scan; pub fn main() !void { const stdin = &(try io.getStdIn()).inStream().stream; const stdout = &(tr...
src/day8.zig
const std = @import("std"); const os = std.os; const warn = std.debug.warn; const syspect = @import("syspect"); pub fn main() !void { const allocator = std.heap.c_allocator; const ignore_list = &[_]os.SYS{ .write, .mprotect, .mmap, .munmap, .brk, .access, }...
examples/print_some_syscalls.zig
usingnamespace @import("c.zig"); usingnamespace @import("main.zig"); const st = @import("st.zig"); const sendbreak = st.sendbreak; const toggleprinter = st.toggleprinter; const printscreen = st.printscreen; const printsel = st.printsel; pub const font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; pub ...
src/config.zig
pub const struct_NVGcontext = opaque {}; pub const NVGcontext = struct_NVGcontext; pub const struct_NVGcolor = extern struct { r: f32, g: f32, b: f32, a: f32, }; pub const NVGcolor = struct_NVGcolor; pub const struct_NVGpaint = extern struct { xform: [6]f32, extent: [2]f32, radius: f32, ...
src/deps/nanovg/c.zig
const std = @import("std"); const Builder = std.build.Builder; const Pkg = std.build.Pkg; pub fn pkg(b: *Builder, build_options: Pkg) Pkg { const dirname = comptime std.fs.path.dirname(@src().file) orelse "."; const source = .{ .path = dirname ++ "/src/lib/pkmn.zig" }; const package = if (@hasField(Pkg, "...
build.zig
const c = @import("c"); const intToError = @import("error.zig").intToError; const Error = @import("error.zig").Error; const Glyph = @import("Glyph.zig"); const Library = @import("freetype.zig").Library; const Face = @import("freetype.zig").Face; const RenderMode = @import("freetype.zig").RenderMode; const Matrix = @imp...
freetype/src/freetype/GlyphSlot.zig
const std = @import("std"); const testing = std.testing; pub const nil: ?id = null; const objc = @import("objc.zig"); pub const object = objc.object; pub const Class = objc.Class; pub const id = objc.id; pub const SEL = objc.SEL; pub const IMP = objc.IMP; pub const sel_registerName = objc.sel_registerName; pub const...
modules/platform/vendored/zig-objcrt/src/main.zig
const std = @import("std"); const ThreadPool = @This(); lock: std.Mutex = .{}, is_running: bool = true, allocator: *std.mem.Allocator, running: usize = 0, threads: []*std.Thread, run_queue: RunQueue = .{}, idle_queue: IdleQueue = .{}, const IdleQueue = std.SinglyLinkedList(std.AutoResetEvent); const RunQueue = std.Si...
src/ThreadPool.zig
const std = @import("std"); const glfw = @import("glfw"); const zt = @import("../zt.zig"); const gl = @import("gl"); const ig = @import("imgui"); // OpenGL Data var g_GlVersion: gl.GLuint = 0; // Extracted at runtime using gl.GL_MAJOR_VERSION, gl.GL_MINOR_VERSION queries. var g_GlslVersionStringMem: [32]u8 = undefined...
src/zt/imguiImplementation.zig
const std = @import("std"); const expect = std.testing.expect; const expectError = std.testing.expectError; const expectEqual = std.testing.expectEqual; test "switch prong with variable" { try switchProngWithVarFn(SwitchProngWithVarEnum{ .One = 13 }); try switchProngWithVarFn(SwitchProngWithVarEnum{ .Two = 13....
test/behavior/switch_stage1.zig
const std = @import("std"); const builtin = @import("builtin"); const zwl = @import("zwl.zig"); const Allocator = std.mem.Allocator; const log = std.log.scoped(.zwl); pub fn Platform(comptime Parent: anytype) type { return struct { const c = @cImport({ @cInclude("X11/X.h"); @cInclud...
didot-zwl/zwl/src/xlib.zig
const std = @import("std"); const fs = std.fs; const mem = std.mem; const hm = std.hash_map; const print = std.debug.print; const assert = std.debug.assert; const BlackTileMap = hm.HashMap(Pos, bool, hashPos, eqlPos, 80); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocato...
2020/src/day_24.zig
const std = @import("std"); const mem = std.mem; const ArrayList = std.ArrayList; const node = @import("node.zig"); const Document = node.Document; const Element = node.Element; const Token = @import("token.zig").Token; const Tokenizer = @import("tokenizer.zig").Tokenizer; const ParseError = @import("parse_error.zig"...
src/parser.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day11.txt"); pub const OctapusGrid = struct { const Self = @This(); values: []u8, width: u32, allocator: *util.Allocator, pub fn initFromSerializedData(allocator: *util.Allocator, serialized_data: []co...
src/day11.zig
// The bud disappears when the blossom breaks through, and we might say // that the former is refuted by the latter; in the same way when the // fruit comes, the blossom may be explained to be a false form of the // plant’s existence, for the fruit appears as its true nature in place // of the blossom. The ceaseless a...
src/main.zig
const std = @import("std"); const builtin = @import("builtin"); const zp = @import("../../zplay.zig"); const event = zp.event; const sdl = zp.deps.sdl; const c = @import("c.zig"); const string_c = @cImport({ @cInclude("string.h"); }); extern fn SDL_free(mem: ?*anyopaque) void; var performance_frequency: u64 = unde...
src/deps/imgui/sdl_impl.zig
const std = @import("std"); const net = std.net; const Reader = std.io.Reader; const meta = std.meta; const Allocator = std.mem.Allocator; const Thread = std.Thread; const log = std.log; const time = std.time; const event = std.event; const atomic = std.atomic; const math = std.math; const Uuid = @import("uuid6"); co...
src/main.zig
const std = @import("std"); const slideszig = @import("slides.zig"); // for ImVec4 and stuff const upaya = @import("upaya"); // NOTE: // why we have context.current_context: // @pop some_shit // # now current_context is loaded with the pushed values, like the color etc // // @box x= y= // # parsing context is loaded w...
src/parser.zig
//-------------------------------------------------------------------------------- // Section: Types (9) //-------------------------------------------------------------------------------- const IID_ICompositionDrawingSurfaceInterop_Value = Guid.initString("fd04e6e3-fe0c-4c3c-ab19-a07601a576ee"); pub const IID_IComposi...
win32/system/win_rt/composition.zig
const std = @import("std"); //-------------------------------------------------------------------------------------------------- pub fn part1() anyerror!void { const file = std.fs.cwd().openFile("data/day03_input.txt", .{}) catch |err| label: { std.debug.print("unable to open file: {e}\n", .{err}); ...
src/day03.zig
const std = @import("std"); const print = std.debug.print; pub fn main() anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); var allocator = &gpa.allocator; var file = try std.fs.cwd().openFile( "./inputs/day17.txt", .{ .read = true, ...
src/day17.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const zwin32 = @import("zwin32"); const w32 = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hrPanicOnFail; const zd3d12 = @import("zd3d12"); const common = @import("common"); const...
samples/intro/src/intro6.zig
const std = @import("std"); const heap = std.heap; const io = std.io; const mem = std.mem; const testing = std.testing; /// A scanner reads tokens from a stream. Tokens are byte slices delimited by a set of possible bytes. /// The BufferSize must be big enough to hold a single token /// /// For example, here's how to ...
scanner.zig
const std = @import("std"); const Answer = struct { @"0": u32, @"1": u32 }; const BingoBoard = struct { const Self = @This(); numbers: []u32, marks: []bool, dim: usize, allocator: *std.mem.Allocator, pub fn init(n: usize, allocator: *std.mem.Allocator) !Self { const numbers = try allo...
src/day04.zig
const std = @import("std"); const upaya = @import("upaya"); const zlm = @import("zlm"); const objects = @import("didot-objects"); const graphics = @import("didot-graphics"); usingnamespace @import("scene.zig"); usingnamespace upaya.imgui; usingnamespace @cImport({ @cDefine("GL_GLEXT_PROTOTYPES", "1"); @cInclud...
src/main.zig
const std = @import("std"); const constants = @import("../constants.zig"); const logger = std.log.scoped(.dx_point_data); const DXHeader = @import("dx_header.zig").DXHeader; const DXRecordHeader = @import("dx_record_header.zig").DXRecordHeader; const DXS1 = @import("dx_s1.zig").DXS1; const DXADD1 = @import("dx_add1.zig...
zig-dxread/src/models/dx_point_data.zig
const sabaton = @import("root").sabaton; const std = @import("std"); var data: []u8 = undefined; const BE = sabaton.util.BigEndian; const Header = packed struct { magic: BE(u32), totalsize: BE(u32), off_dt_struct: BE(u32), off_dt_strings: BE(u32), off_mem_rsvmap: BE(u32), version: BE(u32), ...
src/lib/dtb.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_for.zig
const cmp = @import("cmp.zig"); const testing = @import("std").testing; fn test__cmpdi2(a: i64, b: i64, expected: i64) !void { var result = cmp.__cmpdi2(a, b); try testing.expectEqual(expected, result); } test "cmpdi2" { // minInt == -9223372036854775808 // maxInt == 9223372036854775807 // minInt/...
lib/std/special/compiler_rt/cmpdi2_test.zig
const std = @import("../../../std.zig"); const linux = std.os.linux; const socklen_t = linux.socklen_t; const iovec = linux.iovec; const iovec_const = linux.iovec_const; const uid_t = linux.uid_t; const gid_t = linux.gid_t; const pid_t = linux.pid_t; const stack_t = linux.stack_t; const sigset_t = linux.sigset_t; pub...
lib/std/os/bits/linux/i386.zig
const std = @import("std"); const print = std.debug.print; usingnamespace @import("value.zig"); usingnamespace @import("chunk.zig"); usingnamespace @import("compiler.zig"); pub var sacnner: Scanner = undefined; pub const TokenType = enum(u8) { // Single-character tokens. TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN, TOKE...
zvm/src/scanner.zig
const std = @import("std"); const c = @import("c.zig").c; const Error = @import("errors.zig").Error; const getError = @import("errors.zig").getError; const Window = @import("Window.zig"); const internal_debug = @import("internal_debug.zig"); /// Returns whether the Vulkan loader and an ICD have been found. /// /// T...
glfw/src/vulkan.zig
// Copyright (c) 2020 <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, merge, publish, distrib...
net_demo/io_uring/net_blocking_network.zig
pub const WCN_E_PEER_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147206143)); pub const WCN_E_AUTHENTICATION_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147206142)); pub const WCN_E_CONNECTION_REJECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147206141)); pub const W...
win32/network_management/windows_connect_now.zig
const std = @import("std"); const math = std.math; const solar_mass = 4.0 * math.pi * math.pi; const year = 365.24; const vec3 = std.meta.Vector(3, f64); fn dot(a: vec3, b: vec3) f64 { return @reduce(.Add, a * b); } fn scale(v: vec3, f: f64) vec3 { return v * @splat(3, f); } fn length_sq(v: vec3) f64 { r...
bench/algorithm/nbody/2.zig
const std = @import("std"); const math = std.math; const expect = std.testing.expect; pub fn __exph(a: f16) callconv(.C) f16 { // TODO: more efficient implementation return @floatCast(f16, expf(a)); } pub fn expf(x_: f32) callconv(.C) f32 { const half = [_]f32{ 0.5, -0.5 }; const ln2hi = 6.9314575195...
lib/compiler_rt/exp.zig
const std = @import("std"); const assert = std.debug.assert; pub fn RangeTo(n: usize) type { return struct { idx: usize, pub fn new() RangeTo(n) { return .{ .idx = 0 }; } pub fn next(self: *RangeTo(n)) ?usize { if (self.idx >= n) { return null...
net.zig
const std = @import("std"); const cpp_options = &[_][]const u8{ "-std=c++17", "-fno-sanitize=undefined", }; const c_options = &[_][]const u8{ "-fno-sanitize=undefined", }; pub fn build(b: *std.build.Builder) !void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions...
build.zig
pub const D3D_COMPILER_VERSION = @as(u32, 47); pub const D3DCOMPILE_DEBUG = @as(u32, 1); pub const D3DCOMPILE_SKIP_VALIDATION = @as(u32, 2); pub const D3DCOMPILE_SKIP_OPTIMIZATION = @as(u32, 4); pub const D3DCOMPILE_PACK_MATRIX_ROW_MAJOR = @as(u32, 8); pub const D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR = @as(u32, 16); pub c...
win32/graphics/direct3d/fxc.zig
const ImageReader = zigimg.ImageReader; const ImageSeekStream = zigimg.ImageSeekStream; const PixelFormat = zigimg.PixelFormat; const assert = std.debug.assert; const tga = zigimg.tga; const color = zigimg.color; const errors = zigimg.errors; const std = @import("std"); const testing = std.testing; const zigimg = @impo...
tests/formats/tga_test.zig
const std = @import("std"); const string = @import("String.zig"); const Allocator = std.mem.Allocator; const tags = @import("Tags.zig"); const ANSIEscCode = @import("ANSITerminal.zig").ANSIEscCode; pub fn parseHTML(allocator: Allocator, html_: []const u8, output_ansi_codes: bool) ![]u8 { var html = html_; // ...
src/main.zig
const vmem = @import("vmem.zig"); const x86 = @import("x86.zig"); // Description of an ELF executable. const ELFHeader = packed struct { e_ident: [16]u8, e_type: u16, e_machine: u16, e_version: u32, e_entry: u32, e_phoff: u32, e_shoff: u32, e_flags: u32, ...
kernel/elf.zig
const std = @import("std"); const clap = @import("clap"); usingnamespace @import("common.zig"); usingnamespace @import("lexer.zig"); usingnamespace @import("parser.zig"); usingnamespace @import("error_handler.zig"); usingnamespace @import("code_formatter.zig"); usingnamespace @import("dot_printer.zig"); usi...
src/main.zig
usingnamespace @import("c.zig"); // Types pub const Bool32 = VkBool32; pub const DebugUtilsMessageTypeFlags = VkDebugUtilsMessageTypeFlagsEXT; pub const PipelineStageFlags = VkPipelineStageFlags; // Constants pub const debug_utils_extension_name = VK_EXT_DEBUG_UTILS_EXTENSION_NAME; pub const layer_khronos_validation ...
src/vulkan.zig
const std = @import("std"); usingnamespace @import("kiragine").kira.log; const engine = @import("kiragine"); const windowWidth = 1024; const windowHeight = 768; const title = "Pong"; const targetfps = 60; const aabb = engine.kira.math.aabb; var input: *engine.Input = undefined; var ballpos = engine.Vec2f{ .x = ...
examples/pong.zig
const std = @import("std"); const warn = std.debug.warn; pub fn Message(comptime BodyType: type) type { return packed struct { const Self = @This(); pub header: MessageHeader, pub body: BodyType, pub fn init(cmd: u64) Self { var self: Self = undefined; sel...
message/message.zig
const std = @import("std"); const Barr = std.BoundedArray; const fmt = std.fmt; const log = std.log; const mem = std.mem; const os = std.os; const process = std.process; const stdout = std.io.getStdOut(); const usage: []const u8 = \\ path ; fn fatal(comptime format: []const u8, args: anytype) noreturn { log.e...
src/perffolder_gen.zig
pub const IOCTL_SCSI_BASE = @as(u32, 4); pub const ScsiRawInterfaceGuid = Guid.initString("53f56309-b6bf-11d0-94f2-00a0c91efb8b"); pub const WmiScsiAddressGuid = Guid.initString("53f5630f-b6bf-11d0-94f2-00a0c91efb8b"); pub const FILE_DEVICE_SCSI = @as(u32, 27); pub const IOCTL_SCSI_PASS_THROUGH = @as(u32, 315396); pub ...
deps/zigwin32/win32/storage/iscsi_disc.zig
const std = @import("std"); pub const Hitbox = struct { top: i32 = 0, left: i32 = 0, bottom: i32 = 0, right: i32 = 0, }; pub const HitboxGroup = struct { StartFrame: i32 = 0, Duration: i32 = 1, Hitboxes: std.ArrayList(Hitbox), pub fn init(allocator: std.mem.Allocator) !HitboxGro...
src/CharacterData.zig
const std = @import("std"); const version = @import("version"); const zfetch = @import("zfetch"); const http = @import("hzzp"); const tar = @import("tar"); const zzz = @import("zzz"); const uri = @import("uri"); const Dependency = @import("Dependency.zig"); usingnamespace @import("common.zig"); const Allocator = std.m...
src/api.zig
const std = @import("std"); const formatIntBuf = std.fmt.formatIntBuf; const FormatOptions = std.fmt.FormatOptions; // ---------------------------------------------------------------------------- const arm_cmse = @import("../drivers/arm_cmse.zig"); // --------------------------------------------------------------------...
src/monitor/profiler.zig
const std = @import("std"); const TailQueue = std.TailQueue; const print = std.debug.print; const expect = std.testing.expect; threadlocal var qsbr_local = Qsbr.QsbrNode{.data=1}; fn getState(self: *Qsbr) *Qsbr.QsbrNode { return &qsbr_local; } pub const Qsbr = struct { pub const Queue = TailQ...
Qsbr.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const Vec2 = tools.Vec2; const Map = tools.Map(u16, 1000, 1000, true); fn tileToChar(t: u16) u8 { if (t < 10) return '0' + @intCast(u8, t); if (t < 36) return @intCast(u8, t - 10) + 'A'; if (t == 65535) return '.'...
2018/day20.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const String = std.ArrayList(u8); const nearby = fn (a: []u8, b: isize, c: isize, d: usize, e: usize) usize; fn index(i: isize, j: isize, y: usize, x: usize) ?usize { if (i >= 0 and j >= 0 and i < y and j < x) { return @intCast(usize, i) * x ...
2020/zig/src/11.zig
const std = @import("std"); /// A span of time that is started but might not have an end yet. pub const TimeSpan = struct { /// The instant at which the span started. start: u128, /// The instant at which the span stopped, if any. stop: ?u128 = null, pub fn elapsed(self: *const @This()) u64 { ...
src/stopwatch.zig
const std = @import("std"); const fmt = std.fmt; const platform = @import("arch/x86/platform.zig"); const graphics = @import("graphics.zig"); const psf2 = @import("fonts/psf2.zig"); const Dimensions = graphics.Dimensions; const Position = graphics.Position; const Color = @import("color.zig"); const serial = @import("de...
src/kernel/tty.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day12.txt"); /// Errors for our recursive depth-first-search function. pub const DFSError = error{ InvalidInput, OutOfMemory }; /// Takes in a graph, and conducts a variation of depth-first-search on it that is consistent ...
src/day12.zig
const std = @import("std"); const ConstantPool = @import("ConstantPool.zig"); const logger = std.log.scoped(.cf_attributes); // TODO: Implement all attribute types pub const AttributeInfo = union(enum) { code: CodeAttribute, line_number_table: LineNumberTableAttribute, source_file: SourceFileAttribute, ...
src/attributes.zig
const std = @import("std"); const assert = std.debug.assert; // 8 bits in reverse order. pub inline fn reverse8(x: u8) u8 { var i: u3 = 0; var res: u8 = 0; while (i <= 7) : (i += 1) { // Check whether the i-th least significant bit is set. if (x & (@as(u8, 1) << i) > 0) { // S...
src/bits.zig