code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const epsilonEq = @import("utils.zig").epsilonEq; pub const Color = struct { const Self = @This(); red: f64, green: f64, blue: f64, pub const Black = Self.init(0, 0, 0); pub const White = Self.init(1, 1, 1); pub fn init(red: f64, green: f64, blue: f64) Self { ...
color.zig
const std = @import("std"); const renderkit = @import("renderkit"); const gk = @import("gamekit"); const gfx = gk.gfx; const math = gk.math; const shaders = @import("assets/shaders.zig"); pub const renderer: gk.renderkit.Renderer = .opengl; const Texture = gk.gfx.Texture; const Color = gk.math.Color; const Block = s...
examples/mode7.zig
const std = @import("std"); const stdx = @import("stdx"); const fatal = stdx.fatal; const platform = @import("platform"); const vk = @import("vk"); const graphics = @import("../../graphics.zig"); const gpu = graphics.gpu; const gvk = graphics.vk; const log = stdx.log.scoped(.swapchain); pub const SwapChain = struct {...
graphics/src/backend/vk/swapchain.zig
const std = @import("std"); const builtin = @import("builtin"); const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const mem = std.mem; pub fn build(b: *std.build.Builder) !void { var target = b.standardTargetOptions(.{}); var mode = b.standardReleaseOptions(); const libsodium = b.addStaticLib...
deps/libsodium/build.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 { @setEvalBranchQuota(1_000_000); for (packages) |pkg| { exe.addPackage(pkg.pkg.?); } var...
deps.zig
const std = @import("std"); const tvg = @import("tvg.zig"); pub const Header = struct { version: u8, scale: tvg.Scale, custom_color_space: bool, width: f32, height: f32, }; const Point = tvg.Point; const Rectangle = tvg.Rectangle; const Line = tvg.Line; pub const DrawCommand = union(enum) { f...
src/lib/parsing.zig
pub const CLSID_XMLGraphBuilder = Guid.initString("1bb05961-5fbf-11d2-a521-44df07c10000"); //-------------------------------------------------------------------------------- // Section: Types (1) //-------------------------------------------------------------------------------- // TODO: this type is limited to platfor...
win32/media/direct_show/xml.zig
const std = @import("std"); const builtin = @import("builtin"); const Builder = std.build.Builder; pub fn build(b: *Builder) void { const build_mode = b.standardReleaseOptions(); const target = b.standardTargetOptions(.{}); const compile_image_commands = [_]*std.build.RunStep{ b.addSystemCommand(&...
build.zig
const std = @import("std"); const iup = @import("iup.zig"); const MainLoop = iup.MainLoop; const Dialog = iup.Dialog; const Button = iup.Button; const MessageDlg = iup.MessageDlg; const Multiline = iup.Multiline; const Label = iup.Label; const Text = iup.Text; const VBox = iup.VBox; const HBox = iup.HBox; const Menu =...
src/gauge_example.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const RGBColor = struct { b: u8, g: u8, r: u8, a: u8, }; const WORD = u16; const DWORD = u32; const LONG = i32; const BITMAPINFOHEADER = struct { biSize: DWORD, biWidth: LONG, biHeight: LONG, biPlanes: WORD, biBitCou...
zig/src/RayTracer.zig
const std = @import("std"); /// fixed size array wrapper that provides ArrayList-like semantics. Appending more items than fit in the /// list ignores the item and logs a warning. Use the FixedList.len field to get the actual number of items present. pub fn FixedList(comptime T: type, comptime len: usize) type { r...
src/utils/fixed_list.zig
const u = @import("util.zig"); const std = @import("std"); const SParser = @import("SParser.zig"); const SweetParser = @import("SweetParser.zig"); const Expr = SParser.Expr; const TextIterator = SParser.TextIterator; pub const Type = enum { wasm, text }; pub const Any = union(Type) { wasm: Wasm, text: Text, ...
src/File.zig
const std = @import("std"); const json = std.json; pub const json_rpc_version = "2.0"; const default_message_size: usize = 8192; const Allocator = std.mem.Allocator; pub const ErrorCode = enum(i64) { // UnknownError should be used for all non coded errors. UnknownError = -32001, // ParseError is used whe...
src/jsonrpc2.zig
//-------------------------------------------------------------------------------- // Section: Types (3) //-------------------------------------------------------------------------------- pub const OVERLAPPED = extern struct { Internal: usize, InternalHigh: usize, Anonymous: extern union { Anonymou...
win32/system/io.zig
const std = @import("std"); pub const RegionHeader = struct { name: []const u8, ip: []const u8, server_count: u8 }; pub const ServerInfo = struct { name: []const u8, ip: []const u8, port: u16 }; fn ipTou32(ip: []const u8) !u32 { var components: [4]u8 = undefined; var split = std.mem.s...
src/region.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const input = @embedFile("../input/day16.txt"); const Rule = struct { name: []const u8, min1: u32, max1: u32, min2: u32, max2: u32, pos: ?usize = null, pub fn in...
src/day16.zig
const std = @import("std"); const parser = @import("common.zig"); const debug = std.debug; const math = std.math; const mem = std.mem; const fmt = std.fmt; const testing = std.testing; const ParseResult = parser.ParseResult; pub const Input = struct { str: []const u8, pub fn init(str: []const u8) Input { ...
src/parser/string.zig
const Self = @This(); const std = @import("std"); const math = std.math; const wlr = @import("wlroots"); const wl = @import("wayland").server.wl; const server = &@import("main.zig").server; const Box = @import("Box.zig"); const View = @import("View.zig"); const ViewStack = @import("view_stack.zig").ViewStack; const...
source/river-0.1.0/river/XwaylandView.zig
const std = @import("std"); const Arena = std.heap.ArenaAllocator; const panic = std.debug.panic; const assert = std.debug.assert; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const expectEqualSlices = std.testing.expectEqualS...
src/ecs.zig
const std = @import("std"); const log = std.log.scoped(.@"brucelib.audio.wav"); const SoundBuffer = @import("common.zig").SoundBuffer; const Format = enum { unsigned8, signed16, signed24, signed32, }; /// Caller is responsible for freeing memory allocated for returned samples buffer pub fn readFromB...
modules/audio/src/wav.zig
const std = @import("std"); const stdx = @import("stdx"); const stbtt = @import("stbtt"); const gl = @import("gl"); const graphics = @import("../../graphics.zig"); const gpu = graphics.gpu; const TextMetrics = graphics.TextMetrics; const FontGroupId = graphics.FontGroupId; const FontGroup = graphics.FontGroup; const F...
graphics/src/backend/gpu/text_renderer.zig
const std = @import("std"); const stdx = @import("../stdx.zig"); const string = stdx.string; const t = stdx.testing; const compact = @import("compact.zig"); pub const CompactSinglyLinkedListNode = compact.CompactSinglyLinkedListNode; pub const CompactNull = compact.CompactNull; pub const CompactSinglyLinkedListBuffer ...
stdx/ds/ds.zig
const std = @import("std"); const v8 = @import("v8"); const runtime = @import("runtime.zig"); // TODO: Move other types here from runtime.zig // ------ // Types used to import into native code. // ------ /// Contains the v8.Object of the js function's this. pub const This = struct { obj: v8.Object, }; /// Cont...
runtime/adapter.zig
const std = @import("std"); const stdx = @import("stdx"); const t = stdx.testing; const Vec2 = stdx.math.Vec2; const vec2 = Vec2.init; const math = std.math; const trace = stdx.debug.tracy.trace; const traceN = stdx.debug.tracy.traceN; const log = stdx.log.scoped(.curve); pub const QuadBez = struct { const Self =...
graphics/src/curve.zig
const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const mem = std.mem; const log = std.log.scoped(.c); const link = @import("../link.zig"); const Module = @import("../Module.zig"); const Compilation = @import("../Compilation.zig"); const Value = @import("../value.zig").Va...
src/codegen/c.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqualSlices = std.testing.expectEqualSlices; const expectEqual = std.testing.expectEqual; const mem = std.mem; // comptime array passed as slice argument comptime { const S = struct { fn indexOfScalarPos(comptime T: type, slice: []c...
test/behavior/slice.zig
const macho = @import("../macho.zig"); extern "c" fn __error() *c_int; pub extern "c" fn _NSGetExecutablePath(buf: [*]u8, bufsize: *u32) c_int; pub extern "c" fn _dyld_get_image_header(image_index: u32) ?*mach_header; pub extern "c" fn __getdirentries64(fd: c_int, buf_ptr: [*]u8, buf_len: usize, basep: *i64) usize; ...
std/c/darwin.zig
const builtin = std.builtin; const std = @import("std"); const io = std.io; const meta = std.meta; pub fn toMagicNumberNative(magic: []const u8) u32 { var result: u32 = 0; for (magic) |character, index| { result |= (@as(u32, character) << @intCast(u5, (index * 8))); } return result; } pub fn t...
src/utils.zig
const std = @import("std"); const deps = @import("./deps.zig"); pub fn build(b: *std.build.Builder) void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is n...
build.zig
const std = @import("std"); const mem = std.mem; const unicode = std.unicode; const ascii = @import("../ascii.zig"); const Context = @import("../Context.zig"); const Letter = @import("../ziglyph.zig").Letter; pub const CodePointIterator = @import("CodePointIterator.zig"); pub const GraphemeIterator = @import("Graphem...
src/zigstr/Zigstr.zig
const w4 = @import("wasm4.zig"); const std = @import("std"); const Snake = @import("snake.zig").Snake; var snake = Snake.init(); var prev_state1: u8 = 0; pub const Vec2 = @import("std").meta.Vector(2, i32); const sin = std.math.sin; fn sinI(n: anytype, amplitude: f32, wavetime: f32) i32 { // switch(@TypeOf(n)) ...
src/main.zig
// Some of this is ported from cpython's datetime module const std = @import("std"); const time = std.time; const math = std.math; const ascii = std.ascii; const Allocator = std.mem.Allocator; const Order = std.math.Order; pub const timezones = @import("timezones.zig"); const testing = std.testing; const assert = st...
src/datetime.zig
const std = @import("std"); const helper = @import("helper.zig"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const input = @embedFile("../inputs/day10.txt"); pub fn run(alloc: Allocator, stdout_: anytype) !void { var lines = tokenize(u8, input, "\r\n"); var corrupted_sum: i64 = 0; ...
src/day10.zig
const std = @import("std"); const math = std.math; const testing = std.testing; const utils = @import("utils.zig"); const Vec3 = @import("vec3.zig").Vec3; /// A Mat4 identity matrix pub const mat4_identity = Mat4{ .data = .{ .{ 1, 0, 0, 0 }, .{ 0, 1, 0, 0 }, .{ 0, 0, 1, 0 }, .{ 0, 0...
src/mat4.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const Imgui = @import("imgui.zig"); const warn = std.debug.warn; const fmt = std.fmt; const assert = std.debug.assert; usingnamespace @cImport({ @cInclude("vulkan/vulkan.h"); }); const DVULKAN_DEBUG_REPORT = (std.bu...
src/viewport.zig
const std = @import("std"); const term = @import("ansi-term"); usingnamespace @import("ast.zig"); usingnamespace @import("code_formatter.zig"); usingnamespace @import("common.zig"); usingnamespace @import("compiler.zig"); usingnamespace @import("dot_printer.zig"); usingnamespace @import("error_handler.zig"); ...
src/code_runner.zig
const builtin = @import("builtin"); const std = @import("std"); const debug = std.debug; const testing = std.testing; const TypeInfo = builtin.TypeInfo; const TypeId = builtin.TypeId; pub fn Reify(comptime info: TypeInfo) type { switch (info) { .Type => return type, .Void => return void, ...
fun/reify.zig
const mem = @import("std").mem; const copy = mem.copy; const Allocator = mem.Allocator; const Stack = @import("std").atomic.Stack; var alloc = @import("std").heap.wasm_allocator; const fmt = @import("std").fmt; const olin = @import("./olin/olin.zig"); const Resource = olin.resource.Resource; const words = @embedFile("...
god/god.zig
const std = @import("std"); const System = @import("../interface/System.zig"); const Dir = @import("../interface/Dir.zig"); const File = @import("../interface/File.zig"); const Config = @import("../config/Config.zig"); const FileSystemDescription = @import("../config/FileSystemDescription.zig"); const LinuxUserGroupD...
src/backend/Backend.zig
const std = @import("std"); pub const ascii = enum(u8) { NUL, SOH, STX, ETX, EOT, ENQ, ACK, BEL, BS, TAB, LF, VT, FF, CR, SO, SI, DLE, DC1, DC2, DC3, DC4, NAK, SYN, ETB, CAN, EM, SUB, ESC, FS, GS, ...
src/lib.zig
const std = @import("std"); const testing = std.testing; const c = @import("c.zig"); /// Map an M3Result to the matching Error value. fn mapError(result: c.M3Result) Error!void { @setEvalBranchQuota(50000); const match_list = comptime get_results: { const Declaration = std.builtin.TypeInfo.Declaration...
src/main.zig
const std = @import("std"); const StateMachine = @import("StateMachine.zig"); // Standing state pub const Standing = struct { pub fn OnStart(context: *StateMachine.CombatStateContext) void { _ = context; std.debug.print("Standing.OnStart()\n", .{}); } pub fn OnUpdate(context: *StateMa...
src/ActionStates/CommonStates.zig
const combn = @import("../combn/combn.zig"); const Result = combn.gllparser.Result; const Parser = combn.gllparser.Parser; const Error = combn.gllparser.Error; const Context = combn.gllparser.Context; const PosKey = combn.gllparser.PosKey; const ParserPath = combn.gllparser.ParserPath; const MapTo = combn.combinator.Ma...
src/dsl/pattern_grammar.zig
const std = @import("std"); const root = @import("root"); const builtin = @import("builtin"); const liu = @import("./lib.zig"); const SchemaParseError = std.fmt.ParseIntError || std.fmt.ParseFloatError || std.mem.Allocator.Error || error{ MissingField, ExpectedStruct, ExpectedPrimitive, ...
src/liu/gon.zig
const std = @import("std"); const aoc = @import("aoc-lib.zig"); const X1: usize = 0; const Y1: usize = 1; const X2: usize = 2; const Y2: usize = 3; pub fn parts(inp: anytype) ![2]usize { var b = try std.BoundedArray(u16, 2048).init(0); var lines = try aoc.BoundedInts(u16, &b, inp); var m1: [1048576]u2 = u...
2021/05/aoc.zig
pub const E = enum { @"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12", @"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23", @"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34", @"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45", @"46",@"47",@"48",@"49",@"50"...
test/compile_errors/stage1/obj/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig
pub const GUID_DEVINTERFACE_ENHANCED_STORAGE_SILO = Guid.initString("3897f6a4-fd35-4bc8-a0b7-5dbba36adafa"); pub const WPD_CATEGORY_ENHANCED_STORAGE = Guid.initString("91248166-b832-4ad4-baa4-7ca0b6b2798c"); pub const ENHANCED_STORAGE_AUTHN_STATE_UNKNOWN = @as(u32, 0); pub const ENHANCED_STORAGE_AUTHN_STATE_NO_AUTHENTI...
win32/storage/enhanced_storage.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"); /// A refspec specifies the mapping between remote and local reference names when fetch or pushing. pub const Refspec = opaque { ///...
src/types.zig
const c = @import("../../c_global.zig").c_imp; const std = @import("std"); // dross-zig const Vertex = @import("../vertex.zig").Vertex; // ------------------------------------------------- /// Describes how the data is used over its lifetime. pub const BufferUsageGl = enum(c_uint) { /// The data is set o...
src/renderer/backend/vertex_buffer_opengl.zig
const std = @import("std"); const stdout = std.io.getStdOut().writer(); const Tty = @import("Tty.zig"); const Choices = @import("Choices.zig"); const Options = @import("Options.zig"); const match = @import("match.zig"); const config = @cImport({ @cDefine("COLOR_BLACK", std.fmt.comptimePrint("{d}", .{Tty.COLOR_BL...
src/TtyInterface.zig
const std = @import("std"); usingnamespace @import("kira").log; const kira_utils = @import("kira").utils; const kira_glfw = @import("kira").glfw; const kira_gl = @import("kira").gl; const kira_window = @import("kira").window; const kira_input = @import("kira").input; var window_running = false; var targetfps: f64 = 1...
examples/primitive-window.zig
const macro = @import("pspmacros.zig"); comptime { asm (macro.import_module_start("sceUtility", "0x40010000", "56")); asm (macro.import_function("sceUtility", "0xC492F751", "sceUtilityGameSharingInitStart")); asm (macro.import_function("sceUtility", "0xEFC6F80F", "sceUtilityGameSharingShutdownStart")); ...
src/psp/nids/psputility.zig
const std = @import("std"); const nvg = @import("nanovg"); pub const geometry = @import("geometry.zig"); const Rect = geometry.Rect; const Point = geometry.Point; usingnamespace @import("event.zig"); pub const Timer = @import("Timer.zig"); pub const Application = @import("Application.zig"); pub const Window = @import(...
src/gui/gui.zig
const prot = @import("protocols.zig"); const Window = @import("window.zig").Window; const XdgConfiguration = @import("window.zig").XdgConfiguration; const edge = prot.xdg_toplevel_resize_edge; pub const Resize = struct { window: *Window, window_x: i32, window_y: i32, pointer_x: f64, pointer_y: f64,...
src/resize.zig
const std = @import("std"); const os = std.os; const linux = std.os.linux; // const file = std.file; const AutoHashMap = std.AutoHashMap; const c = @cImport({ @cInclude("sys/types.h"); @cInclude("sys/stat.h"); @cInclude("fcntl.h"); @cInclude("stdlib.h"); @cInclude("unistd.h"); @cInclude("system...
src/backend/drm/systemd.zig
const String = @import("String.zig"); const std = @import("std"); const mem = std.mem; const Node = @This(); name: String, value: ?String, refs: usize, children: ?[]*Node, pub const Error = error{OutOfMemory}; pub fn init(allocator: mem.Allocator, name: String, value: ?String) !*Node { var self = try allocato...
src/dsl/Node.zig
const std = @import("std"); const stdx = @import("stdx"); const t = stdx.testing; const stbtt = @import("stbtt"); const ttf = @import("ttf.zig"); const log = stdx.log.scoped(.ttf_test); test "NotoColorEmoji.ttf" { const file = std.fs.cwd().openFile("./deps/fonts/NotoColorEmoji.ttf", .{}) catch unreachable; de...
graphics/src/ttf.test.zig
const std = @import("std"); const builtin = @import("builtin"); const atoi = @import("parse.zig"); const io = std.io; const File = std.os.File; const Buffer = std.Buffer; const mem = std.mem; const warn = std.debug.warn; const Value = struct { question: []const u8, value: f32 }; const QUESTIONS: []const Valu...
zig/week1/euro.zig
const util = @import("../sdf_util.zig"); pub const info: util.SdfInfo = .{ .name = "Symmetry", .data_size = @sizeOf(Data), .function_definition = "", .enter_command_fn = enterCommand, .exit_command_fn = exitCommand, .sphere_bound_fn = sphereBound, }; pub const Data = struct { axis: i32, }...
src/sdf/modifiers/symmetry.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); // inutilement complexe, mais avec un peu de chance servira pour des instructions plus riches... const Insn = union(enum) { nop: struct { arg: i32 }, acc: struct { arg: i32 }, jmp: struct { arg: i32 }, }; fn runPr...
2020/day08.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const Queue = std.atomic.Queue; /// Message with a header and body. Header /// has information common to all Messages /// and body is a comptime type with information /// unique to each Message. /// /// Using packed struct guarantees fi...
message.zig
const std = @import("std"); const os = std.os; 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 = common.Argument; /// This is wayland-s...
wayland_server_core.zig
const c = @import("../../c_global.zig").c_imp; const std = @import("std"); // dross-zig const vbgl = @import("vertex_buffer_opengl.zig"); const VertexBufferGl = vbgl.VertexBufferGl; const BufferUsageGl = vbgl.BufferUsageGl; // -------------------------------------------------- // ----------------------------...
src/renderer/backend/index_buffer_opengl.zig
const std = @import("std"); const fsnode = @import("fsnode.zig"); const cache = @import("cache.zig"); const FSTreeConfig = struct { InodeRefType: type, MutexType: type, CredentialsType: type, separator: []const u8 = "/", parent_link: []const u8 = "..", current_link: []const u8 = ".", root: ...
fstree.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
const std = @import("std"); pub const uint = u32; pub const sizei = i32; pub const int = i32; pub const Enum = c_uint; pub const char = u8; pub const boolean = u8; pub const float = f32; pub const byte = i8; pub const FALSE = 0x0; pub const TRUE = 0x1; pub const COLOR_BUFFER_BIT = 0x00004000; pub const DEPTH_BUFFER_B...
src/util/opengl.zig
const std = @import("std"); const float = @import("float.zig"); const type_fields = std.meta.fields; pub const LinearAlgebraConfig = struct { /// should functions expect angles to be given in degrees? use_degrees: bool = false, // TODO: split into separate functions instead? /// how should integers be divi...
src/linear_algebra.zig
const std = @import("std"); const testing = std.testing; const io = @import("io.zig"); const utils = @import("utils.zig"); pub const MAX_KV_KEY_LEN = 128; pub const MAX_KV_VALUE_LEN = 8 * 1024; /// TODO: Can make more generic, especially with regards to capacity and entry-lengths /// pub fn KvStore(comptime KeyType:...
src/kvstore.zig
const std = @import("std"); const getty = @import("../../../lib.zig"); pub fn Visitor(comptime Slice: type) type { return struct { allocator: std.mem.Allocator, const Self = @This(); const impl = @"impl Visitor"(Slice); pub usingnamespace getty.de.Visitor( Self, ...
src/de/impl/visitor/slice.zig
const builtin = @import("builtin"); const std = @import("std"); const testing = std.testing; const alsa = @import("main.zig"); test "pcm playback" { var device: ?*alsa.snd_pcm_t = null; _ = try alsa.checkError(alsa.snd_pcm_open( &device, "default", alsa.snd_pcm_stream_t.PLAYBACK, ...
modules/platform/vendored/zig-alsa/src/test.zig
const std = @import("std"); const stderr = std.debug.warn; const stdout = &std.io.getStdOut().outStream(); const assert = @import("std").debug.assert; const c = @import("c.zig"); const c_stdlib = c.c_stdlib; const gw = c.gw; const gmp = c.gmp; const glue = @import("glue.zig"); const u_zero = @import("u_zero.zig"); co...
rpt.zig
const std = @import("../../std.zig"); const os = std.os; const fmt = std.fmt; const mem = std.mem; const math = std.math; const builtin = std.builtin; const testing = std.testing; /// Resolves a network interface name into a scope/zone ID. It returns /// an error if either resolution fails, or if the interface name ...
lib/std/x/os/net.zig
const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; const maxInt = std.math.maxInt; /// Returns the hyperbolic arc-tangent of x. /// /// Special Cases: /// - atanh(+-1) = +-inf with signal /// - atanh(x) = nan if |x| > 1 with signal /// - atanh(nan) = nan pub fn atanh(x: ...
lib/std/math/atanh.zig
const std = @import("std"); const allocators = @import("allocators.zig"); pub const LangTokens = struct { opener: []const u8, closer: []const u8, line_prefix: []const u8, fn init(opener: []const u8, closer: []const u8, line_prefix: []const u8) LangTokens { return LangTokens{ .opene...
limp/languages.zig
const std = @import("../std.zig"); const io = std.io; const testing = std.testing; /// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as /// well as files. /// For memory sources, if the supplied byte buffer is const, then `io.OutStream` is not available. /// The error set of the stre...
lib/std/io/stream_source.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const AutoComptimeLookup = @import("comptime_lookup.zig").AutoComptimeLookup; const zua = @import("zua.zig"); // Notes: // // In Lua's lexer, all single char tokens use their own ASCII value as their ID, and // every other multi-character token uses ID >...
src/lex.zig
const c = @cImport({ @cInclude("soundio/soundio.h"); }); const std = @import("std"); const print = std.debug.print; const panic = std.debug.panic; const Allocator = std.mem.Allocator; const sio_err = @import("sio_errors.zig").sio_err; const I = @import("instruments.zig"); const Instrument = I.Instrument; const Sign...
src/server.zig
const std = @import("std"); const Arch = std.Target.Cpu.Arch; const Abi = std.Target.Abi; const assert = std.debug.assert; const Blake3 = std.crypto.hash.Blake3; const LibCTarget = struct { name: []const u8, arch: MultiArch, }; const MultiArch = union(enum) { arm, arm64, mips, powerpc, ri...
tools/update-linux-headers.zig
const std = @import("std"); const lines_lib = @import("lines.zig"); const Lines = lines_lib.Lines; const Allocator = std.mem.Allocator; pub fn hack_url_decode(allocator : Allocator, input : []const u8) ![]const u8 { return std.mem.replaceOwned(u8, allocator, input, "%3A", ":"); } pub fn parse_path(allocator : All...
src/dan/runner.zig
const std = @import("std"); const math = std.math; const util = @import("util.zig"); const Map = struct { data: std.AutoHashMap(Point, i32), const Self = @This(); const Point = struct { x: i32, y: i32 }; fn init() Self { return .{ .data = std.AutoHashMap(Point, i32).init(std.heap...
zig/src/day5.zig
const std = @import("std"); const cast = std.meta.cast; const mode = std.builtin.mode; // Checked arithmetic is disabled in non-debug modes to avoid side channels // The type MontgomeryDomainFieldElement is a field element in the Montgomery domain. // Bounds: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xfffff...
fiat-zig/src/secp256k1_32.zig
const std = @import("std"); const testing = std.testing; const allocator = std.testing.allocator; pub const Map = struct { const SIZE = 150; width: usize, height: usize, pixel: [3][SIZE][SIZE]u8, cur: usize, pub fn init() Map { var self = Map{ .width = 0, .heig...
2021/p25/map.zig
const c = @import("../c.zig"); const std = @import("std"); const vertex = @import("../vertex.zig"); const opengl = @import("../opengl_renderer.zig"); usingnamespace @import("zalgebra"); usingnamespace @import("block.zig"); pub const vec3i = Vec3(i64); pub const vec3u = Vec3(u64); pub const TestChunk = struct { c...
src/chunk/chunk.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 SimilarityMetric = extern struct { file_signature: fn (out: *?*anyopaque, file: *const git.DiffFile, full_path: [*:0]const...
src/merge.zig
pub const CA_DISP_INCOMPLETE = @as(u32, 0); pub const CA_DISP_ERROR = @as(u32, 1); pub const CA_DISP_REVOKED = @as(u32, 2); pub const CA_DISP_VALID = @as(u32, 3); pub const CA_DISP_INVALID = @as(u32, 4); pub const CA_DISP_UNDER_SUBMISSION = @as(u32, 5); pub const KRA_DISP_EXPIRED = @as(u32, 0); pub const KRA_DISP_NOTFO...
win32/security/cryptography/certificates.zig
const std = @import("std"); const c = @import("c.zig"); // Type Aliases pub const Window = c.SDL_Window; pub const Renderer = c.SDL_Renderer; pub const Surface = c.SDL_Surface; pub const Texture = c.SDL_Texture; pub const Rect = c.SDL_Rect; pub const Event = c.SDL_Event; pub const RendererFlip = c.SDL_RendererFlip; pu...
deps/sdl/src/sdl.zig
pub const EPERM = 1; /// No such file or directory pub const ENOENT = 2; /// No such process pub const ESRCH = 3; /// Interrupted system call pub const EINTR = 4; /// I/O error pub const EIO = 5; /// No such device or address pub const ENXIO = 6; /// Arg list too long pub const E2BIG = 7; /// Exec format error p...
lib/std/os/bits/linux/errno-generic.zig
const sg = @import("sokol").gfx; // // #version:1# (machine generated, don't edit!) // // Generated by sokol-shdc (https://github.com/floooh/sokol-tools) // // Cmdline: sokol-shdc -i texcube.glsl -o texcube.glsl.zig -l glsl330:metal_macos:hlsl4 -f sokol_zig // // Overview: // // Shader program 'texcube': // ...
src/shaders/mainshader.zig
const blz = @import("blz.zig"); const common = @import("common.zig"); const fun = @import("fun"); const overlay = @import("overlay.zig"); const std = @import("std"); const debug = std.debug; const generic = fun.generic; const heap = std.heap; const io = std.io; const mem = std.mem; const os = std.os; const lu16 = fun...
src/index.zig
const std = @import("std"); const debug = std.debug; const assert = debug.assert; const uefi = std.os.uefi; const Allocator = std.mem.Allocator; const ThisAllocator = @This(); // Pre-boot allocator in UEFI environment var systemAllocatorState = Allocator{ .allocFn = alloc, .resizeFn = resize, }; pub const sy...
src/kernel/uefi/allocator.zig
const std = @import("std"); const testing = std.testing; const Allocator = std.mem.Allocator; // Use Edwards25519 at the moment, since bandersnatch is currently // unavailable, and Edwards is the only curve available in zig, that // both supports addition and serializes to 32 bytes. const curve = std.crypto.ecc.Edwards...
src/main.zig
const std = @import("std"); const os = std.os; const ptrace = @import("ptrace.zig"); pub const WaitResult = struct { pid: os.pid_t, status: Status, }; pub const Status = union(enum) { exit: u32, kill: u32, stop: Signal, ptrace: PtraceSignal, }; // Signal delivered on syscalls. // Would other...
src/waitpid.zig
const std = @import("std"); const t = std.testing; const BitArrayList = @import("bit_array_list.zig").BitArrayList; const log = std.log.scoped(.compact); /// Useful for keeping elements closer together in memory when you're using a bunch of insert/delete, /// while keeping realloc to a minimum and preserving the eleme...
examples/gkurve/data_structures/compact.zig
const std = @import("std"); const c = @import("c"); pub const Direction = enum(u3) { invalid = c.HB_DIRECTION_INVALID, ltr = c.HB_DIRECTION_LTR, rtl = c.HB_DIRECTION_RTL, ttb = c.HB_DIRECTION_TTB, bit = c.HB_DIRECTION_BTT, pub fn fromString(str: []const u8) Direction { return @intToEnu...
freetype/src/harfbuzz/common.zig
const std = @import("std"); const Arena = std.heap.ArenaAllocator; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const yeti = @import("yeti"); const Component = yeti.ecs.Component; const ECS = yeti.ecs.ECS; const IteratorCompo...
src/tests/test_ecs.zig
const std = @import("std"); const mem = std.mem; const common = @import("common.zig"); const Ondemand = @import("ondemand.zig"); const println = common.println; const print = common.print; const llvm = @import("llvm_intrinsics.zig"); depth: u8 = 0, const Logger = @This(); pub const MAX_DEPTH = 30; const LOG_EVENT_LE...
src/Logger.zig
const std = @import("std"); const string = []const u8; const gpa = std.heap.c_allocator; const zfetch = @import("zfetch"); const json = @import("json"); const u = @import("./../util/index.zig"); // // pub const commands = struct { pub const add = @import("./zpm/add.zig"); pub const showjson = @import("./zpm/...
src/cmd/zpm.zig
const std = @import("std"); const input = @import("input.zig"); pub fn run(stdout: anytype) anyerror!void { { var input_ = try input.readFile("inputs/day8"); defer input_.deinit(); const result = try part1(&input_); try stdout.print("8a: {}\n", .{ result }); std.debug.asse...
src/day8.zig
const std = @import("std"); const ArrayList = std.ArrayList; const stdout = std.io.getStdOut().outStream(); const allocPrint0 = std.fmt.allocPrint0; const parse = @import("parse.zig"); const NodeKind = parse.NodeKind; const Node = parse.Node; const Obj = parse.Obj; const assert = @import("std").debug.assert; const err ...
src/codegen.zig
export fn zig_entry() align(16) callconv(.Naked) void { asm volatile ( \\push 12(%%ecx) \\push 8(%%ecx) \\push 4(%%ecx) \\push 0(%%ecx) \\push %%esi \\push %%edi \\push %%ebp ::: "memory" ); asm volatile ( \\push %%esp # al...
src/interrupts/handlers.zig