code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const fs = std.fs; const assert = std.debug.assert; pub fn main() !void { const gpa = std.heap.page_allocator; var arena_state = std.heap.ArenaAllocator.init(gpa); defer arena_state.deinit(); const arena = arena_state.allocator(); const args = try std.process.argsAlloc(...
backfill.zig
const std = @import("std"); const sample_utils = @import("sample_utils.zig"); const c = @import("c.zig").c; const glfw = @import("glfw"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var allocator = gpa.allocator(); const setup = try sample_utils.setup(allocator); const que...
gpu-dawn/src/dawn/hello_triangle.zig
const std = @import("std"); const stdx = @import("stdx.zig"); const ds = stdx.ds; const builtin = @import("builtin"); const log = stdx.log.scoped(.wasm); /// A global buffer for wasm that can be used for: /// Writing to js: In some cases in order to share the same abstraction as desktop code, a growing buffer is usef...
stdx/wasm.zig
const Mir = @This(); const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const bits = @import("bits.zig"); const Air = @import("../../Air.zig"); const Register = bits.Register; instructions: std.MultiArrayList(Inst).Slice, /// The meaning of this data is determined by `In...
src/arch/arm/Mir.zig
const std = @import("std"); const builtin = @import("builtin"); const is_test = builtin.is_test; pub extern fn __extendsfdf2(a: f32) f64 { return @inlineCall(extendXfYf2, f64, f32, @bitCast(u32, a)); } pub extern fn __extenddftf2(a: f64) f128 { return @inlineCall(extendXfYf2, f128, f64, @bitCast(u64, a)); } ...
lib/std/special/compiler_rt/extendXfYf2.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const Allocator = std.mem.Allocator; // Never freed until exit pub var global_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); // Reset before each matching input file is processed pub var temp_arena = TempAllocator.init(s...
limp/allocators.zig
const std = @import("std"); const build_options = @import("build_options"); const Config = @import("config.zig"); const DocumentStore = @import("document_store.zig"); const DebugAllocator = @import("debug_allocator.zig"); const readRequestHeader = @import("header.zig").readRequestHeader; const data = @import("data/" +...
src/main.zig
const std = @import("std"); const mem = std.mem; const GraphemeBase = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 32, hi: u21 = 201546, pub fn init(allocator: *mem.Allocator) !GraphemeBase { var instance = GraphemeBase{ .allocator = allocator, .array = try allocator.alloc(bool, ...
src/components/autogen/DerivedCoreProperties/GraphemeBase.zig
const std = @import("std"); const assert = std.debug.assert; pub const ActivationFunction = enum { ReLU, Identity, }; pub fn Layer(comptime InputType_: type, comptime inputs_size_: usize, comptime OutputType_: type, comptime outputs_size_: usize, comptime activation_function: ActivationFunction) type { re...
src/nnue/nn.zig
const std = @import("std"); usingnamespace @import("imgui.zig"); pub const icons = @import("font_awesome.zig"); extern fn _ogImage(user_texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2) void; extern fn _ogImageButton(user_texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2, frame_padding: c_...
src/deps/imgui/wrapper.zig
const std = @import("std"); const mach = @import("mach"); const gpu = @import("gpu"); const glfw = @import("glfw"); const zm = @import("zmath"); const Vertex = @import("cube_mesh.zig").Vertex; const vertices = @import("cube_mesh.zig").vertices; const App = mach.App(*FrameParams, .{}); const UniformBufferObject = str...
examples/fractal-cube/main.zig
//-------------------------------------------------------------------------------- // Section: Types (14) //-------------------------------------------------------------------------------- pub const CALLFRAMEINFO = extern struct { iMethod: u32, fHasInValues: BOOL, fHasInOutValues: BOOL, fHasOutValues: ...
win32/system/com/call_obj.zig
const std = @import("std"); const fixedBufferStream = std.io.fixedBufferStream; const testing = std.testing; const style = @import("style.zig"); const Style = style.Style; const FontStyle = style.FontStyle; const Color = style.Color; pub const Esc = "\x1B"; pub const Csi = Esc ++ "["; pub const Reset = Csi ++ "0m"; ...
src/format.zig
const clap = @import("clap"); const format = @import("format"); const it = @import("ziter"); const std = @import("std"); const ston = @import("ston"); const util = @import("util"); const debug = std.debug; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const log = std.log; const math...
src/randomizers/tm35-rand-static.zig
const AtomicOrder = @import("builtin").AtomicOrder; const Vector = @import("vector.zig").Vector(f32); const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const warn = std.debug.warn; const allocator = std.heap.page_allocator; const Math = std.math; const json = std.json;...
zigray/lib.zig
const std = @import("std"); const builtin = @import("builtin"); const io = std.io; const os = std.os; const fs = std.fs; const time = @import("../Zig-PSP/src/psp/os/time.zig"); pub const Level = enum { const Self = @This(); Trace, Debug, Info, Warn, Error, Fatal, fn toString(self: Se...
src/Utils/logger.zig
const std = @import("std"); const mem = std.mem; const ArrayList = std.ArrayList; const warn = std.debug.warn; pub const replacement_rune: i32 = 0xfffd; pub const max_rune: i32 = 0x10ffff; // 0xd800-0xdc00 encodes the high 10 bits of a pair. // 0xdc00-0xe000 encodes the low 10 bits of a pair. // the value is those 20...
src/unicode/utf16/index.zig
const zt = @import("zt"); const main = @import("../main.zig"); usingnamespace @import("imgui"); usingnamespace zt.custom_components; var rotation: f32 = 0.0; var scale: f32 = 1.0; var lineStart: zt.math.Vec2 = .{ .x = -200, .y = 200 }; var lineEnd: zt.math.Vec2 = .{ .x = 200, .y = 200 }; var startColor: zt.math.Vec4 ...
example/src/scenes/renderer.zig
const Self = @This(); const build_options = @import("build_options"); const std = @import("std"); const wlr = @import("wlroots"); const wl = @import("wayland").server.wl; const pixman = @import("pixman"); const log = @import("log.zig"); const server = &@import("main.zig").server; const util = @import("util.zig"); c...
source/river-0.1.0/river/PointerConstraint.zig
pub const Pos = packed struct { line: usize, col: usize, index: usize, }; pub const Token = struct { pos: Pos, tkn_type: TokenType, value: []const u8, }; pub const TokenType = enum(u8) { Identifier, // id Equal, // = Let, // 'let' Integer, // refers to ints IntKeyword, // '...
src/lexer/tokens.zig
const Print = @This(); const std = @import("std"); const assert = std.debug.assert; const bits = @import("bits.zig"); const leb128 = std.leb; const link = @import("../../link.zig"); const log = std.log.scoped(.codegen); const math = std.math; const mem = std.mem; const Air = @import("../../Air.zig"); const DebugInfo...
src/arch/x86_64/PrintMir.zig
const std = @import("std"); const c = @import("internal/c.zig"); const internal = @import("internal/internal.zig"); const log = std.log.scoped(.git); const git = @import("git.zig"); pub const Remote = opaque { /// Free the memory associated with a remote. pub fn deinit(self: *Remote) !void { log.debug...
src/remote.zig
const std = @import("std"); const hasher = std.hash.Fnv1a_64; const cuckoo = @import("./src/cuckoofilter.zig"); fn fingerprint8(x: []const u8) u8 { return x[0]; } fn fingerprint32(x: []const u8) u32 { // Just a sample strategy, not suitable for all types // of input. Imagine if you were adding images to ...
example.zig
const std = @import("std"); const Builder = std.build.Builder; pub fn build(b: *Builder) void { const mode = b.standardReleaseOptions(); const target = b.standardTargetOptions(.{}); var main_tests = b.addTest("src/main.zig"); main_tests.setBuildMode(mode); main_tests.setTarget(target); link(b,...
glfw/build.zig
const std = @import("std"); const input = @import("input.zig"); pub fn run(allocator: std.mem.Allocator, stdout: anytype) anyerror!void { const side_length = 100; { var input_ = try input.readFile("inputs/day15"); defer input_.deinit(); const result = try part1(side_length, allocator...
src/day15.zig
const std = @import("std"); const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; const parseInt = std.fmt.parseInt; pub fn main() !void { var gpalloc = std.heap.GeneralPurposeAllocator(.{}){}; var allocator = &gpalloc.allocator; defer std.debug.assert(!gpalloc.deinit()); const file = t...
2021/zig/03.zig
extern "wapc" fn __guest_request(operation_ptr: [*]u8, payload_ptr: [*]u8) void; extern "wapc" fn __guest_response(ptr: [*]u8, len: usize) void; extern "wapc" fn __guest_error(ptr: [*]u8, len: usize) void; extern "wapc" fn __host_call(binding_ptr: [*]const u8, binding_len: usize, namespace_ptr: [*]const u8, namespace_...
wapc.zig
const std = @import("std"); const common = @import("common.zig"); const Line = common.Line; const Point = common.Point; const expect = std.testing.expect; const Allocator = std.mem.Allocator; const test_allocator = std.testing.allocator; const ArrayList = std.ArrayList; const AutoArrayHashMap = std.AutoArrayHashMap; ...
day5/src/solution.zig
pub const GUID_STRING_SIZE = @as(u32, 40); pub const DATA_NOT_AVAILABLE = @as(u32, 4294967295); pub const MTXDM_E_ENLISTRESOURCEFAILED = @as(u32, 2147803392); pub const CRR_NO_REASON_SUPPLIED = @as(u32, 0); pub const CRR_LIFETIME_LIMIT = @as(u32, 4294967295); pub const CRR_ACTIVATION_LIMIT = @as(u32, 4294967294); pub c...
win32/system/component_services.zig
const idt = @import("idt.zig"); // Interrupt Service Routines defined externally in assembly. extern fn isr0() void; extern fn isr1() void; extern fn isr2() void; extern fn isr3() void; extern fn isr4() void; extern fn isr5() void; extern fn isr6() void; extern fn isr7() void; extern fn isr8() void; extern fn isr9() v...
src/kernel/arch/x86/isr.zig
const std = @import("std"); const lsp = @import("lsp"); pub fn main() !void { comptime @setEvalBranchQuota(10_000); const allocator = std.heap.page_allocator; var server = try lsp.Server.init(allocator); while (true) { var message = try server.readMessage(); defer server.flushArena()...
example/main.zig
const c = @import("c.zig"); usingnamespace @import("wren.zig"); // Common pub extern fn wrenGetVersionNumber(...) c_int; pub extern fn wrenInitConfiguration(configuration: [*c]Configuration) void; pub extern fn wrenNewVM(configuration: [*c]Configuration) ?*VM; pub extern fn wrenFreeVM(vm: ?*VM) void; pub extern fn wre...
src/externs.zig
pub const addr = 0x03; pub const deref = 0x06; pub const const1u = 0x08; pub const const1s = 0x09; pub const const2u = 0x0a; pub const const2s = 0x0b; pub const const4u = 0x0c; pub const const4s = 0x0d; pub const const8u = 0x0e; pub const const8s = 0x0f; pub const constu = 0x10; pub const consts = 0x11; pub const dup =...
lib/std/dwarf/OP.zig
const enums = @import("enums.zig"); pub const RootContext = struct { const Self = @This(); // Implementations used by interfaces. // Note that these are optional so we can have the "default" (nop) implementation. /// onVmStart is called after the VM is created and _initialize is called. /// During...
lib/contexts.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const BlackTiles = std.AutoHashMap(aoc.Coord, void); const HexCoord = struct { const NW = aoc.Coord.init(.{-1, -1}); const NE = aoc.Coord.init(.{-1, 1}); const SW = aoc.Coord.init(.{1, -1}); const SE = aoc.Coord.init(.{1, 1}); const W ...
src/main/zig/2020/day24.zig
const std = @import("std"); const ptk = @import("parser-toolkit"); const matchers = ptk.matchers; const Allocator = std.mem.Allocator; pub const Parser = struct { core: ParserCore, source: []const u8, allocator: Allocator, const TokenType = enum { number, identifier, whitespac...
src/parser.zig
const std = @import("std"); const Context = @import("context.zig").Context; const Source = @import("context.zig").Source; const SourceLocation = @import("context.zig").SourceLocation; const SourceRange = @import("context.zig").SourceRange; const Token = @import("tokenize.zig").Token; const TokenType = @import("tokenize...
src/zangscript/parse.zig
const std = @import("std"); const c = @cImport({ @cInclude("epoxy/gl.h"); // Include statically if possible @cInclude("GLFW/glfw3.h"); // Redo build script so it is in zig and cross-platform @cInclude("fontstash.h"); @cInclude("gl3corefontstash.h"); }); const zs = @import("zstack.zig"); const Piece =...
src/window_gl.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const regex = @import("regex"); const clap = @import("clap"); const walkdir = @import("walkdir"); const filters = @import("filter.zig"); const Filter = filters.Filter; const TypeFilter = filters.TypeFilter; const actions ...
src/cli.zig
const builtin = @import("builtin"); comptime { switch (builtin.arch) { builtin.Arch.i386 => _ = @import("c/i386.zig"), builtin.Arch.x86_64 => _ = @import("c/x86_64.zig"), else => {}, } } export fn @"error"() void {} export fn _Exit() void {} export fn _IO_2_1_stderr_() void {} export ...
libc/dummy/c.zig
const std = @import("std"); const Mat4 = @import("./util/matrix.zig"); const Ring = @import("./util/ring.zig"); const UI = @import("./util/ui.zig"); const GL = @import("./util/opengl.zig"); const Editor = @import("./editor.zig"); const Self = @This(); gl: *GL, cpu_ring: *Ring, gpu_ring: GPURing, vaos: AutoGenerated(...
src/gl_renderer.zig
const std = @import("std"); const assert = std.debug.assert; const zp = @import("../../zplay.zig"); const gl = zp.deps.gl; const Self = @This(); /// max number of vbo const MAX_VBO_NUM = 8; /// buffer data's binding target const BufferTarget = enum(c_uint) { array_buffer = gl.GL_ARRAY_BUFFER, copy_read_buffer...
src/graphics/common/VertexArray.zig
const std = @import("std"); const c = @import("c.zig"); const panic = std.debug.panic; pub const Xlib = struct { display: *c.Display = undefined, screen: i32 = 0, root: c.Window = undefined, font: *c.XftFont = undefined, cursor: u64 = undefined, const Self = *Xlib; fn init(self: Self, font...
src/x.zig
const builtin = @import("builtin"); const std = @import("../index.zig"); const TypeId = builtin.TypeId; const assert = std.debug.assert; pub const e = 2.71828182845904523536028747135266249775724709369995; pub const pi = 3.14159265358979323846264338327950288419716939937510; // From a small c++ [program using boost flo...
std/math/index.zig
const std = @import("std"); const Type = @import("../../type.zig").Type; const Target = std.Target; const assert = std.debug.assert; pub const Class = enum { integer, sse, sseup, x87, x87up, complex_x87, memory, none }; pub fn classifyWindows(ty: Type, target: Target) Class { // https://docs.microsoft.com/en-gb/c...
src/arch/x86_64/abi.zig
//! These are MIPS ABI compatible. pub const E = enum(i32) { /// No error occurred. SUCCESS = 0, PERM = 1, NOENT = 2, SRCH = 3, INTR = 4, IO = 5, NXIO = 6, @"2BIG" = 7, NOEXEC = 8, BADF = 9, CHILD = 10, /// Also used for WOULDBLOCK. AGAIN = 11, NOMEM = 12, ...
lib/std/os/bits/linux/errno/mips.zig
const std = @import("std"); const backend = @import("backend.zig"); const Size = @import("data.zig").Size; const DataWrapper = @import("data.zig").DataWrapper; const Widget = @import("widget.zig").Widget; pub const Tabs_Impl = struct { pub usingnamespace @import("internal.zig").All(Tabs_Impl); peer: ?backend....
src/tabs.zig
const std = @import("std"); const debug = std.debug; const heap = std.heap; const math = std.math; const mem = std.mem; const testing = std.testing; const CustomList = @import("list.zig").CustomList; const List = @import("list.zig").List; test "List.foreach" { var buf: [1024 * 1024 * 5]u8 = undefined; const ...
src/core/list_tests.zig
const std = @import("std"); const testing = std.testing; const allocator = std.heap.page_allocator; pub const Evaluator = struct { pub const Precedence = enum { None, MulBeforeAdd, AddBeforeMul, }; precedence: Precedence, nums: [128]usize, oprs: [128]u8, pn: usize, ...
2020/p18/evaluator.zig
const std = @import("std"); const log = std.log; const utils = @import("utils.zig"); const ast = @import("ast.zig"); const NodeKind = ast.NodeKind; const Node = ast.Node; const TokenKind = @import("tokenizer.zig").TokenKind; const csl = @import("csl_json.zig"); const CitationItem = csl.CitationItem; const bib_to_csl_j...
src/cite.zig
const os = @import("root").os; const platform = os.platform; const log = os.log; const libalign = os.lib.libalign; const range = os.lib.range.range; const range_reverse = os.lib.range.range_reverse; const pmm = os.memory.pmm; const Context = *platform.paging.PagingContext; pub var kernel_context: os.p...
src/memory/paging.zig
const assert = @import("std").debug.assert; const client = @import("wayland.zig").client; const common = @import("common.zig"); pub const Object = common.Object; pub const Message = common.Message; pub const Interface = common.Interface; pub const Array = common.Array; pub const Fixed = common.Fixed; pub const Argument...
src/wayland_client_core.zig
const std = @import("std"); const kernel = @import("root"); const x86 = @import("../x86.zig"); const elf = std.elf; var logger = @TypeOf(x86.logger).childOf(@typeName(@This())){}; const trampoline_elf = @embedFile("../../../build/x86_64/trampolines.o"); pub fn getTrampolineELF() []const u8 { return trampoline_el...
kernel/arch/x86/trampoline.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const math = std.math; const log = @import("./log.zig").log; const math_utils = @import("./math_utils.zig"); const Point = math_utils.Point; const Line = math_utils.Line; const star_math = @import("./star_math.zig"); const SkyCoord = star_math.SkyCoord;...
night-math/src/render.zig
const std = @import("std"); const snow = @import("snow.zig"); const sync = @import("sync.zig"); const pike = @import("pike"); const net = std.net; const mem = std.mem; const testing = std.testing; test "client / server" { const Protocol = struct { const Self = @This(); event: sync.Event = .{}, ...
test.zig
const std = @import("std"); const warn = std.debug.warn; const math = std.math; const gl = @import("opengl.zig"); usingnamespace @import("util.zig"); pub const window_name = "genexp004"; pub const window_width = 2 * 1024; pub const window_height = 2 * 1024; const bounds: f64 = 3.0; pub const GenerativeExperimentStat...
src/genexp004.zig
usingnamespace @import("psptypes.zig"); pub const RegKeyTypes = extern enum(c_int) { REG_TYPE_DIR = 1, REG_TYPE_INT = 2, REG_TYPE_STR = 3, REG_TYPE_BIN = 4, _, }; pub const RegHandle = c_uint; pub const RegParam = extern struct { regtype: c_uint, name: [256]u8, namelen: c_uint, unk2...
src/psp/sdk/pspreg.zig
pub const RADIUS_EXTENSION_VERSION = @as(u32, 1); //-------------------------------------------------------------------------------- // Section: Types (66) //-------------------------------------------------------------------------------- const CLSID_SdoMachine_Value = @import("../zig.zig").Guid.initString("e9218ae7-9...
deps/zigwin32/win32/network_management/network_policy_server.zig
const std = @import("std"); const mem = std.mem; const WireBuffer = @import("wire.zig").WireBuffer; pub const Table = struct { // a slice of our rx_buffer (with its own head and end) buf: WireBuffer = undefined, len: usize = 0, const Self = @This(); pub fn init(buffer: []u8) Table { var t...
src/table.zig
const std = @import("std"); const assert = std.debug.assert; const fmt = std.fmt; const mem = std.mem; const os = std.os; const log = std.log; const config = @import("config.zig"); pub const log_level: std.log.Level = @intToEnum(std.log.Level, config.log_level); const cli = @import("cli.zig"); const IO = @import("io...
src/main.zig
const MachO = @This(); const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const fs = std.fs; const log = std.log.scoped(.link); const macho = std.macho; const codegen = @import("../codegen.zig"); const math = std.math; const mem = std.mem; const trace = @import("../tracy....
src-self-hosted/link/MachO.zig
const std = @import("std"); const testing = std.testing; pub const Crypto = struct { const Credentials = struct { public_key: usize, private_key: usize, loop_size: usize, pub fn init(public_key: usize) Credentials { var self = Credentials{ .public_key = ...
2020/p25/crypto.zig
/// The function fiat25519AddcarryxU51 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^51 /// out2 = ⌊(arg1 + arg2 + arg3) / 2^51⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0x7ffffffffffff] /// arg3: [0x0 ~> 0x7ffffffffffff] /// Output Bounds: /// ...
fiat-zig/src/curve25519_64.zig
const c = @import("c.zig"); const std = @import("std"); const Renderer = @import("gfx/renderer.zig").Renderer; const Logger = @import("logger.zig").Logger; const Game = @import("game/game.zig").Game; const MovementDirection = @import("game/player.zig").MovementDirection; const Scene = @import("gfx/view/scene.zig").Sc...
src/app.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const Policy = struct { letter: u8, min: u8, max: u8 }; fn check_password1(pol: Policy, password: []const u8) bool { var count: u8 = 0; for (password) |it| { if (it == pol.letter) count += 1; } return c...
2020/day02.zig
const is_test = @import("builtin").is_test; const std = @import("std"); const math = std.math; const testing = std.testing; const fixint = @import("fixint.zig").fixint; fn test__fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t, expected: fixint_t) !void { const x = fixint(fp_t, fixint_t, a); try t...
lib/std/special/compiler_rt/fixint_test.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const heap = std.heap; const json = std.json; const testing = std.testing; const meta = std.meta; pub fn MaybeDefined(comptime T: type) type { return union(enum) { NotDefined, Defined: T, const __maybe_defined = voi...
src/json_serialize.zig
const std = @import("std"); const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; fn join(builder: *Builder, a: []const u8, b: []const u8) []const u8 { return std.fs.path.join(builder.allocator, &[_][]const u8{ a, b }) catch unreachable; } pub fn build(b: *Builder) void { const tar...
build.zig
const std = @import("std"); const assert = std.debug.assert; const zp = @import("../../zplay.zig"); const drawcall = zp.graphics.common.drawcall; const alg = zp.deps.alg; const Vec2 = alg.Vec2; const Vec3 = alg.Vec3; const Vec4 = alg.Vec4; pub const c = @import("c.zig"); pub const Data = c.cgltf_data; pub const Scene ...
src/deps/gltf/gltf.zig
const std = @import("std"); const koino = @import("koino"); const libpcre = @import("libpcre"); const StringList = std.ArrayList(u8); const BuildFile = @import("build_file.zig").BuildFile; const PageBuildStatus = enum { Unbuilt, Built, Error, }; const Page = struct { filesystem_path: []const u8, ...
src/main.zig
const std = @import("std"); pub const descriptors = @import("descriptors.zig"); pub const Reflector = @import("Reflector.zig"); pub usingnamespace @import("types.zig"); pub fn exportAs(comptime name: []const u8, function: anytype) void { var z: [name.len]u8 = undefined; for (name) |v, i| z[i] = switch (v) { ...
src/jui.zig
const std = @import("std"); const lola = @import("lola"); const argsParser = @import("args"); const build_options = @import("build_options"); var gpa_state = std.heap.GeneralPurposeAllocator(.{}){}; const gpa = &gpa_state.allocator; // This is our global object pool that is back-referenced // by the runtime library. ...
src/frontend/main.zig
const std = @import("std"); const mem = std.mem; const meta = std.meta; const testing = std.testing; const builtin = std.builtin; const debug = std.debug; const math = std.math; const sort = std.sort.sort; const TypeInfo = builtin.TypeInfo; const ComptimeStringMap = std.ComptimeStringMap; const RecursiveField = @im...
src/main.zig
usingnamespace @import("opcode.zig"); const std = @import("std"); const Register = u8; pub const Emulator = struct { const ProgramStartLocation = 0x200; const FontsetStartLocation = 0x050; memory: [4096]u8, registers: [16]Register, index_register: u16, program_counter: u16, g...
src/emulator.zig
const std = @import("std"); // Generic arg parser pub fn ArgParser(comptime T: type) type { return struct { pub fn parse(allocator: std.mem.Allocator, values: *T) !void { const args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); inl...
src/arg_parser.zig
const std = @import("std"); const generator = @import("./generator.zig"); // pending resolution of https://github.com/ziglang/zig/issues/10442, // this has to be a function separate from `Join` fn joinedGenerator(comptime g: type, comptime T: type, comptime allocating: bool) type { return struct { generato...
src/join.zig
const std = @import("std"); const os = std.os; const tests = @import("tests.zig"); pub fn addCases(cases: *tests.StackTracesContext) void { cases.addCase(.{ .name = "return", .source = \\pub fn main() !void { \\ return error.TheSkyIsFalling; \\} , .Debug ...
test/stack_traces.zig
const std = @import("../std.zig"); const builtin = std.builtin; usingnamespace std.c; extern "c" fn __errno() *c_int; pub const _errno = __errno; pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callba...
lib/std/c/netbsd.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const mem = std.mem; const path = std.fs.path; const assert = std.debug.assert; const log = std.log.scoped(.mingw); const target_util = @import("target.zig"); const Compilation = @import("Compilation.zig"); const build_options = @import("build_options");...
src/mingw.zig
const std = @import("../std.zig"); const builtin = @import("builtin"); const os = std.os; const io = std.io; const mem = std.mem; const math = std.math; const assert = std.debug.assert; const posix = os.posix; const windows = os.windows; const Os = builtin.Os; const windows_util = @import("windows/util.zig"); const max...
std/os/file.zig
const std = @import("../std.zig"); const testing = std.testing; const target = std.Target.current; const Ordering = std.atomic.Ordering; pub fn Atomic(comptime T: type) type { return extern struct { value: T, const Self = @This(); pub fn init(value: T) Self { return .{ .valu...
lib/std/atomic/Atomic.zig
const std = @import("std"); const math = std.math; pub fn __sqrth(x: f16) callconv(.C) f16 { // TODO: more efficient implementation return @floatCast(f16, sqrtf(x)); } pub fn sqrtf(x: f32) callconv(.C) f32 { const tiny: f32 = 1.0e-30; const sign: i32 = @bitCast(i32, @as(u32, 0x80000000)); var ix: ...
lib/std/special/compiler_rt/sqrt.zig
const Address = std.net.Address; const Allocator = std.mem.Allocator; const LinearFifo = std.fifo.LinearFifo; const network = @import("network"); const std = @import("std"); const Uri = @import("http").Uri; pub const Socket = struct { target: network.Socket, pub fn connect(allocator: *Allocator, uri: Uri) !S...
src/socket.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const mem = std.mem; const log = std.log; const fs = std.fs; const path = fs.path; const assert = std.debug.assert; const Version = std.builtin.Version; const target_util = @import("target.zig"); const Compilation = @import("Compilation.zig"); const buil...
src/glibc.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const panic = std.debug.panic; const vk = @import("vulkan"); usingnamespace @import("instance.zig"); usingnamespace @import("device.zig"); pub const SwapchainInfo = struct { image_count: u32, format: vk.SurfaceFormatKHR, extent: vk.Extent2D,...
src/vulkan/swapchain.zig
const std = @import("std"); const builtin = @import("builtin"); // bswap - byteswap // - bswapXi2_generic for unoptimized big and little endian // ie for u32 // DE AD BE EF <- little|big endian // FE BE AD DE <- big|little endian // ie for u32 // ff 00 00 00 >> 3*8 (leftmost byte) // 00 ff 00 00 >> 1*8 (2nd left ...
lib/std/special/compiler_rt/bswap.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const log = std.log.scoped(.vr); const config = @import("../config.zig"); const Time = @import("../time.zig").Time; const MessageBus = @import("../message_bus.zig").MessageBusReplica; const Message = @import("../message_...
src/vr/replica.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 LoggingAllocator = std.heap.LoggingAllocator; const util = @import("util.zig");...
src/day12.zig
const std = @import("std"); const mem = std.mem; const debug = std.debug; const log = std.log; //const cmqtt = @import("mqtt_paho.zig"); const cmqtt = @cImport({ @cInclude("MQTTClient.h"); }); const c = @cImport({ @cInclude("stdio.h"); @cInclude("unistd.h"); @cInclude("string.h"); @cInclude("time.h...
mqttlib.zig
const high_bit = 1 << @typeInfo(usize).Int.bits - 1; pub const Status = extern enum(usize) { /// The operation completed successfully. Success = 0, /// The image failed to load. LoadError = high_bit | 1, /// A parameter was incorrect. InvalidParameter = high_bit | 2, /// The operation is...
lib/std/os/uefi/status.zig
const std = @import("std"); const mem = std.mem; const debug = std.debug; const math = std.math; const threshold = 2; const default_mask = 0x80; // TODO: Tests // TODO: This file could use some love in the form of a refactor. So far, it is mostly // a direct translation of blz.c, but with some minor refactors...
src/blz.zig
const USE_MKL = @import("build_options").USE_MKL; const std = @import("std"); const reference_counter = @import("reference_counter.zig"); const ReferenceCounter = reference_counter.ReferenceCounter; const mkl = @import("mkl"); // CUDNN_DIM_MAX is apparently 8 const maxNumDim = 8; const defaultIntDType = ...
src/array.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const Arch = std.Target.Cpu.Arch; const meta = std.meta; pub const ZpackError = error{ InvalidArgument, UnsupportedType, StringTooLong, OutOfMemory, }; pub const Timestamp32 = struct { seconds: u32, }; pub const Timestamp64 = packed...
src/main.zig
const std = @import("std"); const druzhba = @import("druzhba"); // Please do not run `zig fmt` on this source... It makes chained fn calls ugly. /// Signature `Count` — Provides a method to decrement a counter value. const Count = druzhba.defineSig(struct { fn ___(comptime Self: type) type { return struct...
examples/basic.zig
const std = @import("std"); const Dir = std.fs.Dir; const FnMeta = std.builtin.TypeInfo.Fn; const FnDecl = std.builtin.TypeInfo.Declaration.Data.FnDecl; const StructMeta = std.builtin.TypeInfo.Struct; const EnumMeta = std.builtin.TypeInfo.Enum; const UnionMeta = std.builtin.TypeInfo.Union; const warn = std.debug.warn; ...
generators/c.zig
const std = @import("std"); const gen2 = @import("../../gen2/data.zig"); const assert = std.debug.assert; const Stats = gen2.Stats; const Types = gen2.Types; pub const Species = enum(u8) { None, Bulbasaur, Ivysaur, Venusaur, Charmander, Charmeleon, Charizard, Squirtle, Wartortle...
src/lib/gen2/data/species.zig
const std = @import("std"); const webgpu = @import("../../webgpu.zig"); const dummy = @import("./dummy.zig"); pub const ComputePipeline = struct { const vtable = webgpu.ComputePipeline.VTable{ .destroy_fn = destroy, .get_bind_group_layout_fn = getBindGroupLayout, .set_label_fn = setLabel, ...
src/backends/dummy/pipeline.zig
const std = @import("std"); const debug = std.debug.print; const Mutex = std.Thread.Mutex; const testing = std.testing; /// Functionality to run a thread pool of n Threads with a list of tasks to be executed stored as function + workload. /// Solution will then spin up n threads, each thread checks for next availa...
src/threadpool.zig
const std = @import("std"); const Fundude = @import("main.zig"); pub const Op = @import("Cpu/Op.zig"); const util = @import("util.zig"); const Cpu = @This(); mode: Mode, interrupt_master: bool, duration: u8, remaining: u8, next: [3]u8, reg: packed union { _16: util.EnumArray(Reg16, u16), _8: util.EnumArray...
src/Cpu.zig
pub const BG_NOTIFY_JOB_TRANSFERRED = @as(u32, 1); pub const BG_NOTIFY_JOB_ERROR = @as(u32, 2); pub const BG_NOTIFY_DISABLE = @as(u32, 4); pub const BG_NOTIFY_JOB_MODIFICATION = @as(u32, 8); pub const BG_NOTIFY_FILE_TRANSFERRED = @as(u32, 16); pub const BG_NOTIFY_FILE_RANGES_TRANSFERRED = @as(u32, 32); pub const BG_JOB...
deps/zigwin32/win32/networking/background_intelligent_transfer_service.zig