code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const Core = @This();
const std = @import("std");
const xcb = @import("bindings.zig");
pub const Window = @import("Window.zig");
connection: *xcb.Connection,
setup: *xcb.Setup,
screen: *xcb.Screen,
window: *Window,
wm_protocols: *xcb.InternAtomReply,
wm_delete_window: *xcb.InternAtomReply,
allocator: std.mem.Allocator... | src/xcb/Core.zig |
const std = @import("std");
const utils = @import("utils.zig");
usingnamespace @import("header.zig");
usingnamespace @import("frames.zig");
pub const ID3 = struct {
header: Header,
extended_header: ?ExtendedHeader,
frame_headers: FrameHeaderList,
file: std.fs.File,
allocator: *std.mem.Allocator,
... | src/zid3.zig |
const std = @import("std");
pub fn main() anyerror!void {
const find = "\n\n"; // The \r are already stripped out
const n = 275;
const buf = @embedFile("./bigger.txt");
//const buf = @embedFile("./http-requests.txt");
//const n = 55;
//const find = "\r\n\r\n"; // The \r are already stripped out... | tests/search.zig |
pub const NERR_BASE = @as(u32, 2100);
pub const NERR_PasswordExpired = @as(u32, 2242);
pub const CNLEN = @as(u32, 15);
pub const LM20_CNLEN = @as(u32, 15);
pub const DNLEN = @as(u32, 15);
pub const LM20_DNLEN = @as(u32, 15);
pub const UNCLEN = @as(u32, 17);
pub const LM20_UNCLEN = @as(u32, 17);
pub const LM20_NNLEN = @... | win32/network_management/net_management.zig |
const ArrayList = std.ArrayList;
const Builder = std.build.Builder;
const CrossTarget = std.zig.CrossTarget;
const FixedBufferAllocator = std.heap.FixedBufferAllocator;
const ImageConverter = @import("assetconverter/image_converter.zig").ImageConverter;
const LibExeObjStep = std.build.LibExeObjStep;
const Step = std.bu... | GBA/builder.zig |
const root = @import("root");
const isUpper = @import("std").ascii.isUpper;
const isDigit = @import("std").ascii.isDigit;
pub const N64 = struct {
pub const Header = packed struct {
piBsbDom1LatReg: u8,
piBsbDom1PgsReg: u8,
piBsbDom1PwdReg: u8,
piBsbDom1PgsReg2: u8,
initialC... | src/n64.zig |
const std = @import("std");
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 native. Other options
// for rest... | build.zig |
const std = @import("std");
const mem = std.mem;
const os = std.os;
const assert = std.debug.assert;
const v = @import("vector_types.zig");
const llvm = @import("llvm_intrinsics.zig");
const c = @import("c_intrinsics.zig");
const string_parsing = @import("string_parsing.zig");
const number_parsing = @import("number_pa... | src/dom.zig |
const std = @import("std");
const ComputePassEncoder = @import("ComputePassEncoder.zig");
const RenderPassEncoder = @import("RenderPassEncoder.zig");
const CommandBuffer = @import("CommandBuffer.zig");
const QuerySet = @import("QuerySet.zig");
const Buffer = @import("Buffer.zig");
const ImageCopyBuffer = @import("stru... | gpu/src/CommandEncoder.zig |
const std = @import("std");
pub const LispCall = struct {
params: std.ArrayList(LispExpr),
body: std.ArrayList(LispExpr),
};
pub const LispClosure = struct {
call: LispCall,
interpreter: LispInterpreter,
};
pub const LispNativeCall = fn (*LispInterpreter, []LispExpr) anyerror!LispExpr;
pub const Lis... | src/interpret.zig |
usingnamespace @import("raylib");
pub fn main() anyerror!void
{
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
const screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - mouse in... | examples/core/input_mouse.zig |
const std = @import("std");
const fs = std.fs;
const sort = std.sort;
const asc_u32 = sort.asc(u32);
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = &gpa.allocator;
const input = try fs.cwd().readFileAlloc(allocator, "data/input_10_1.txt", std.math.maxInt(usize)... | 2020/src/day_10.zig |
const std = @import("std");
// Configure these (required):
const human_readable_app_name = "Ziggy";
const app_name = "ziggy";
const package_name = "net.random_projects." ++ app_name;
const android_fullscreen = false;
const permissions = [_][]const u8{
"android.permission.SET_RELEASE_APP",
"android.permission... | build.zig |
const std = @import("std");
// Parse flags from an ArgIterator according to the provided Flags struct.
pub fn parse(comptime Flags: type, args: *std.process.ArgIterator) !Flags {
std.debug.assert(args.skip());
return parseIter(Flags, args, argPeek, argNext);
}
fn argPeek(args: *std.process.ArgIterator) ?[]cons... | src/lib/flag.zig |
const std = @import("std");
const glfw = @import("glfw");
const zt = @import("../zt.zig");
const gl = @import("gl");
usingnamespace gl;
usingnamespace @import("imgui");
// OpenGL Data
var g_GlVersion: GLuint = 0; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries.
var g_GlslVersionStringMem: [32]... | src/zt/imguiImplementation.zig |
const std = @import("std");
const constants = @import("../constants.zig");
const logger = std.log.scoped(.dx_pixel);
const DXPoint = @import("dx_point.zig").DXPoint;
const DXPointData = @import("dx_point_data.zig").DXPointData;
const DXHeader = @import("dx_header.zig").DXHeader;
const DXRecordHeader = @import("dx_recor... | zig-dxread/src/models/dx_pixel.zig |
// tested on zig 0.8.1 by klardotsh. requires libcurl dev headers and, of
// course, linkable objects.
// in a more "production-ready" world,
// https://github.com/ducdetronquito/requestz is probably the more
// zig-ergonomic answer for HTTP(s) stuff, and
// https://github.com/MasterQ32/zig-network for raw TCP/UDP st... | src/main.zig |
const std = @import("std");
const os = std.os;
const panic = std.debug.panic;
const assert = std.debug.assert;
const GLenum = c_uint;
const GLuint = c_uint;
const GLint = c_int;
const GLsizei = c_int;
const GLfloat = f32;
const GLdouble = f64;
const GLchar = u8;
const GLboolean = u8;
const GLbitfield = c_uint;
const G... | src/opengl.zig |
const std = @import("std");
const zort = @import("main.zig");
const testing = std.testing;
pub const items_t = i32;
pub const items = [_]i32{ -9, 1, -4, 12, 3, 4 };
pub const expectedASC = [_]i32{ -9, -4, 1, 3, 4, 12 };
pub const expectedDESC = [_]i32{ 12, 4, 3, 1, -4, -9 };
fn asc(a: i32, b: i32) bool {
return a... | src/test.zig |
pub const address_book = @import("system/address_book.zig");
pub const antimalware = @import("system/antimalware.zig");
pub const application_installation_and_servicing = @import("system/application_installation_and_servicing.zig");
pub const application_verifier = @import("system/application_verifier.zig");
pub const ... | deps/zigwin32/win32/system.zig |
const c = @import("c.zig");
const std = @import("std");
const debug = std.debug;
const fmt = std.fmt;
const math = std.math;
const mem = std.mem;
const sort = std.sort;
export fn zigNuklearAssert(ok: c_int) callconv(.C) void {
debug.assert(ok != 0);
}
export fn zigNuklearSqrt(x: f32) callconv(.C) f32 {
retur... | src/export.zig |
const std = @import("std");
const GitRepoStep = @This();
pub const ShaCheck = enum {
none,
warn,
err,
pub fn reportFail(self: ShaCheck, comptime fmt: []const u8, args: anytype) void {
switch (self) {
.none => unreachable,
.warn => std.log.warn(fmt, args),
.e... | GitRepoStep.zig |
const std = @import("std");
const str = []const u8;
const event = std.event;
const Thread = std.Thread;
const Blake3 = std.crypto.hash.Blake3;
const atomic = std.atomic;
var Allocator = std.mem.Allocator;
const Arena = std.heap.ArenaAllocator;
/// A graph with directed edges and weighted vertices and edges
pub fn Grap... | src/data/graph.zig |
const std = @import("std");
const root = @import("root");
const liu = @import("./lib.zig");
const builtin = @import("builtin");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const wasm = @This();
pub const Obj = enum(u32) {
// These are kept up to date with src/wasm.ts
jsundefined,
... | src/liu/wasm.zig |
const std = @import("std");
const vkgen = @import("generator/index.zig");
const Step = std.build.Step;
const Builder = std.build.Builder;
const path = std.fs.path;
pub const ResourceGenStep = struct {
step: Step,
shader_step: *vkgen.ShaderCompileStep,
builder: *Builder,
full_out_path: []const u8,
r... | build.zig |
const std = @import("std");
const print = std.debug.print;
const util = @import("util.zig");
const gpa = util.gpa;
const data = @embedFile("../data/day23.txt");
pub fn main() !void {
var timer = try std.time.Timer.start();
{
var burrow = Burrow.init(data, false);
print("🎁 Num moves: {}\n", .{try burro... | src/day23.zig |
const std = @import("std");
const warn = std.debug.warn;
const testing = std.testing;
usingnamespace @import("zetacore");
const HealthComponent = struct {
health: usize,
};
const EnergyComponent = struct {
energy: usize,
};
const PositionComponent = struct {
x: f32,
y: f32,
z: f32,
};
const Veloc... | core/test/test.zig |
const std = @import("std");
const ArenaAllocator = std.heap.ArenaAllocator;
const assert = std.debug.assert;
const eql = std.mem.eql;
const zig_string = @import("./zig-string.zig");
const String = zig_string.String;
test "Basic Usage" {
// Use your favorite allocator
var arena = ArenaAllocator.init(std.heap.p... | zig-string-tests.zig |
const std = @import("std");
const builtin = @import("builtin");
const event = std.event;
const os = std.os;
const io = std.io;
const fs = std.fs;
const mem = std.mem;
const process = std.process;
const Allocator = mem.Allocator;
const ArrayList = std.ArrayList;
const c = @import("c.zig");
const introspect = @import("... | src-self-hosted/main.zig |
const std = @import("std.zig");
const builtin = @import("builtin");
const testing = std.testing;
const SpinLock = std.SpinLock;
const ThreadParker = std.ThreadParker;
/// Lock may be held only once. If the same thread
/// tries to acquire the same mutex twice, it deadlocks.
/// This type supports static initialization... | lib/std/mutex.zig |
const std = @import("std");
const lola = @import("lola");
const zee_alloc = @import("zee_alloc");
// This is our global object pool that is back-referenced
// by the runtime library.
pub const ObjectPool = lola.runtime.ObjectPool([_]type{
lola.libs.runtime.LoLaList,
lola.libs.runtime.LoLaDictionary,
});
var a... | src/wasm-compiler/main.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
const Map = struct {
const MAX: usize = 22;
const OFF: i8 = MAX / 2;
cur: [MAX * MAX * MAX * MAX]bool,
new: [MAX * MAX * MAX * MAX]bool,
w: i8,
w2: i8,
alloc: std.mem.Allocator,
debug: bool,
const NB = [_]i8{ -1, 0, 1... | 2020/17/aoc.zig |
const std = @import("std");
const math = std.math;
const expect = std.testing.expect;
pub fn __floorh(x: f16) callconv(.C) f16 {
var u = @bitCast(u16, x);
const e = @intCast(i16, (u >> 10) & 31) - 15;
var m: u16 = undefined;
// TODO: Shouldn't need this explicit check.
if (x == 0.0) {
ret... | lib/std/special/compiler_rt/floor.zig |
const std = @import("std");
const math = std.math;
const expect = std.testing.expect;
const trig = @import("trig.zig");
const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;
pub fn __cosh(a: f16) callconv(.C) f16 {
// TODO: more efficient implementation
retur... | lib/std/special/compiler_rt/cos.zig |
const std = @import("std");
const mem = std.mem;
const math = std.math;
const os = std.os;
const windows = os.windows;
const ws2_32 = windows.ws2_32;
pub const FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 0x1;
pub const FILE_SKIP_SET_EVENT_ON_HANDLE = 0x2;
pub const CTRL_C_EVENT: windows.DWORD = 0;
pub const CTRL_BREAK_E... | os/windows.zig |
const std = @import("std");
const wasm3 = @import("wasm3");
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var a = &gpa.allocator;
var args = try std.process.argsAlloc(a);
defer std.process.argsFree(a, args);
if (args.len < 2) {
std.l... | example/test.zig |
const std = @import("std");
const vk = @import("vulkan");
const c = @import("c.zig");
const Allocator = std.mem.Allocator;
const required_device_extensions = [_][*:0]const u8{vk.extension_info.khr_swapchain.name};
const BaseDispatch = vk.BaseWrapper(.{
.createInstance = true,
});
const InstanceDispatch = vk.Inst... | examples/graphics_context.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const assert = std.debug.assert;
const print = std.debug.print;
const input = @embedFile("../input/day10.txt");
fn loadNumbers(allocator: *Allocator, string: []const u8) !ArrayList(u64) {
var numbers = ArrayList(u64).... | src/day10.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const List = std.ArrayList;
const Map = std.AutoHashMap;
const StrMap = std.StringHashMap;
const BitSet = std.DynamicBitSet;
const Str = []const u8;
const util = @import("util.zig");
const gpa = util.gpa;
const data = @embedFile("../data/puzzle/day24.tx... | src/day24.zig |
const std = @import("std");
const parse = @import("parse.zig");
const convertFast = @import("convert_fast.zig").convertFast;
const convertEiselLemire = @import("convert_eisel_lemire.zig").convertEiselLemire;
const convertSlow = @import("convert_slow.zig").convertSlow;
const convertHex = @import("convert_hex.zig").conve... | lib/std/fmt/parse_float/parse_float.zig |
const std = @import("std");
pub fn RaxNode(comptime V: type) type {
return struct {
key: ?V,
layout: union(enum) {
Compressed: struct {
chars: []u8,
next: *Self,
},
Branching: []Branch,
},
const Self = @This();
... | src/simple/node.zig |
const std = @import("std");
// Shameless based on the Zig tokenizer:
// https://github.com/ziglang/zig/blob/ec63411905ca66dc4dd874b4cde257b0043442e6/lib/std/zig/tokenizer.zig
pub const TokenType = enum {
const Self = @This();
integer_literal,
plus,
minus,
asterisk,
slash,
eof,
inval... | src/tokenizer.zig |
const sf = @import("../sfml.zig");
const glsl = sf.graphics.glsl;
const Shader = @This();
// Constructor/destructor
/// Creates a shader object from shader files, you can omit some shader types by passing null
pub fn createFromFile(
vertex_shader_path: ?[:0]const u8,
geometry_shader_path: ?[:0]const u8,
... | src/sfml/graphics/Shader.zig |
const std = @import("std");
const builtin = @import("builtin");
const is_test = builtin.is_test;
const comparesf2 = @import("comparesf2.zig");
const TestVector = struct {
a: f32,
b: f32,
eqReference: c_int,
geReference: c_int,
gtReference: c_int,
leReference: c_int,
ltReference: c_int,
... | lib/std/special/compiler_rt/comparesf2_test.zig |
const std = @import("std");
const uefi = std.os.uefi;
const uefi_platform = @import("../uefi.zig");
const vfs = @import("../../vfs.zig");
const Node = vfs.Node;
var console_scratch: [8192]u8 = undefined;
var console_fifo = std.fifo.LinearFifo(u8, .Slice).init(console_scratch[0..]);
var keyboard_scratch: [8192]u8 = u... | kernel/platform/uefi/console.zig |
const std = @import("std");
const sling = @import("sling.zig");
/// Configure handle skinning and functionality through here!
pub const config = struct {
/// If you want to change which key is used to drag handles, this is
/// your way in.
pub var lockKey: sling.input.Key = .lmb;
pub var normalColor: s... | src/handle.zig |
const std = @import("std");
const gl = @import("opengl.zig");
const math = std.math;
const default_allocator = std.heap.page_allocator;
usingnamespace @import("util.zig");
pub const window_name = "genexp002";
pub const window_width = 1920;
pub const window_height = 1080;
const num_objects = 256;
const max_vel = 5.0;
... | src/genexp002.zig |
usingnamespace @import("pspge.zig");
usingnamespace @import("pspgutypes.zig");
usingnamespace @import("psptypes.zig");
usingnamespace @import("pspdisplay.zig");
test "" {
@import("std").meta.refAllDecls(@This());
}
//Internals
pub const GuCallback = ?fn (c_int) callconv(.C) void;
const GuSettings = struct {
... | src/psp/sdk/pspguimpl.zig |
const std = @import("std");
const zang = @import("zang");
const common = @import("common.zig");
const c = @import("common/c.zig");
const StereoEchoes = @import("modules.zig").StereoEchoes(15000);
pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb;
pub const AUDIO_SAMPLE_RATE = 48000;
pub const AUDIO_BUFFER_SIZE ... | examples/example_detuned.zig |
const notes = @import("zang/notes.zig");
pub const IdGenerator = notes.IdGenerator;
pub const Impulse = notes.Impulse;
pub const Notes = notes.Notes;
const trigger = @import("zang/trigger.zig");
pub const ConstantOrBuffer = trigger.ConstantOrBuffer;
pub const constant = trigger.constant;
pub const buffer = trigger.buf... | src/zang.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const stdout = std.io.getStdOut().writer();
const stdin = std.io.getStdIn().reader();
const dprint = std.debug.print;
pub const Brain = struct {
allocator: *Allocator,
mem: []u8,
dp: usize = 0, // data_pointer
// code: []const u8,
i... | src/brain.zig |
const Uri = @This();
/// Scheme component of an URI, such as 'https'
scheme: ?[]const u8,
/// The username of the userinfo component within an URI
username: ?[]const u8,
/// The password of the userinfo component.
/// NOTE: This subcomponent is deprecated and will not be shown
/// in the formatter, consider omitting t... | src/Uri.zig |
const std = @import("std");
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const alloc = &gpa.allocator;
const column_size = 31;
pub fn main() !void {
defer _ = gpa.deinit();
const inputData = try std.fs.cwd().readFileAlloc(alloc, "input", std.math.maxInt(u64));
defer alloc.free(inputData);
var... | Day11/day11.zig |
const std = @import("std");
const os = std.os;
const mem = std.mem;
const hashmap_type = std.hash_map.AutoHashMap(i32, []u8);
comptime {
if (!os.linux.is_the_target) {
@compileError("Unsupported OS");
}
}
const std_inotify_event = extern struct {
wd: i32,
mask: u32,
cookie: u32,
len:... | inotify_bridge.zig |
pub const Timestamp = struct {
unix_ms: i64 = 0,
year: u16 = 0,
month: u8 = 0,
day: u8 = 0,
hours: u8 = 0,
minutes: u8 = 0,
seconds: u8 = 0,
month_name: []const u8 = undefined,
day_name: []const u8 = undefined,
month_name_array: []const []const u8 = &[_][]const u8{ "Jan", "Feb", ... | 98_http_server/timestamp.zig |
const std = @import("std");
const generate = @import("generator.zig").generate;
const path = std.fs.path;
const Builder = std.build.Builder;
const Step = std.build.Step;
/// build.zig integration for OpenXR binding generation. This step can be used to generate
/// OpenXR bindings at compiletime from xr.xml, by providi... | generator/openxr/build_integration.zig |
const std = @import("std");
const zben = @import("zben");
const uri = @import("uri");
const c = @import("c.zig");
const util = @import("util.zig");
const msg = @import("messages.zig");
const log = std.log.scoped(.torrent);
const Allocator = std.mem.Allocator;
const ConnectionList = std.ArrayList(*PeerConnection);
co... | src/torrent.zig |
const std = @import("std");
const options = @import("./options.zig");
const assert = std.debug.assert;
const expectEqual = std.testing.expectEqual;
const showdown = options.showdown;
pub fn PRNG(comptime gen: comptime_int) type {
if (showdown) return PSRNG;
const Source = switch (gen) {
1, 2 => Gen... | src/lib/common/rng.zig |
const clz = @import("count0bits.zig");
const testing = @import("std").testing;
fn test__clzti2(a: u128, expected: i64) !void {
// XXX At high optimization levels this test may be horribly miscompiled if
// one of the naked implementations is selected.
var nakedClzti2 = clz.__clzti2;
var actualClzti2 = ... | lib/std/special/compiler_rt/clzti2_test.zig |
const std = @import("std");
const meta = std.meta;
const trait = meta.trait;
const Allocator = std.mem.Allocator;
const testing = std.testing;
const assert = std.debug.assert;
const mustache = @import("../mustache.zig");
const RenderOptions = mustache.options.RenderOptions;
/// Partials map from a comptime known typ... | src/rendering/partials_map.zig |
const std = @import("std");
const serialize = @import("main.zig").serialize;
const expect = std.testing.expect;
const eql = std.mem.eql;
const readIntSliceBig = std.mem.readIntSliceBig;
const ArrayList = std.ArrayList;
const hasFn = std.meta.trait.hasFn;
const implementsDecodeRLP = hasFn("decodeRLP");
const rlpByteLi... | src/deserialize.zig |
const zang = @import("zang");
const note_frequencies = @import("zang-12tet");
const common = @import("common.zig");
const c = @import("common/c.zig");
pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb;
pub const AUDIO_SAMPLE_RATE = 48000;
pub const AUDIO_BUFFER_SIZE = 1024;
pub const DESCRIPTION =
\\examp... | examples/example_subsong.zig |
const std = @import("std");
const Header = @import("lsmtree").Header;
const headerSize = @import("lsmtree").headerSize;
const expectEqual = std.testing.expectEqual;
const Error = error{ InputArrayTooSmall, OutputArrayTooSmall, NoLastKeyOffsetFound };
pub fn toBytes(h: *Header, buf: []u8) !usize {
if (buf.len < h... | src/serialize/header.zig |
const fmath = @import("index.zig");
pub fn acosh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(acoshf, x),
f64 => @inlineCall(acoshd, x),
else => @compileError("acosh not implemented for " ++ @typeName(T)),
}
}
// acosh(x) = log(x + sqrt(x * x - 1))
... | src/acosh.zig |
const std = @import("std");
const assert = std.debug.assert;
pub fn main() !void {
var input_file = try std.fs.cwd().openFile("input/08.txt", .{});
defer input_file.close();
var buffered_reader = std.io.bufferedReader(input_file.reader());
const count = try deduceNumbers(buffered_reader.reader());
... | src/08_2.zig |
const std = @import("std");
const assert = std.debug.assert;
const big = std.math.big;
const mem = std.mem;
const testing = @import("testing.zig");
const limb_bits = @typeInfo(big.Limb).Int.bits;
const limb_bytes = limb_bits / 8;
/// fromRawBytes decodes a big.int from the data provided.
///
/// Based on https://git... | src/bigint.zig |
const std = @import("std");
const fs = std.fs;
const fmt = std.fmt;
const mem = std.mem;
const math = std.math;
const process = std.process;
const json = std.json;
const foxwren = @import("foxwren");
const ValueType = foxwren.ValueType;
const Module = foxwren.Module;
const Instance = foxwren.Instance;
const Store = fox... | test/src/testrunner.zig |
const std = @import("../std.zig");
const assert = std.debug.assert;
const testing = std.testing;
const builtin = @import("builtin");
const Lock = std.event.Lock;
const Loop = std.event.Loop;
/// This is a value that starts out unavailable, until resolve() is called
/// While it is unavailable, functions suspend when t... | std/event/future.zig |
const std = @import("index.zig");
const builtin = @import("builtin");
const Os = builtin.Os;
const c = std.c;
const math = std.math;
const debug = std.debug;
const assert = debug.assert;
const os = std.os;
const mem = std.mem;
const Buffer = std.Buffer;
const fmt = std.fmt;
const File = std.os.File;
const is_posix = ... | std/io.zig |
const std = @import("std");
const builtin = @import("builtin");
const clap = @import("clap");
const version = @import("version");
const zzz = @import("zzz");
const known_folders = @import("known-folders");
const build_options = @import("build_options");
const api = @import("api.zig");
const Project = @import("Project.z... | src/commands.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const testing = std.testing;
const Loop = std.event.Loop;
/// Many producer, many consumer, thread-safe, runtime configurable buffer size.
/// When buffer is empty, consumers suspend and are resumed by producers.
//... | lib/std/event/channel.zig |
const Dylib = @This();
const std = @import("std");
const assert = std.debug.assert;
const fs = std.fs;
const fmt = std.fmt;
const log = std.log.scoped(.dylib);
const macho = std.macho;
const math = std.math;
const mem = std.mem;
const fat = @import("fat.zig");
const commands = @import("commands.zig");
const Allocator... | src/link/MachO/Dylib.zig |
const builtin = @import("builtin");
const TypeInfo = builtin.TypeInfo;
const std = @import("std");
const testing = std.testing;
fn testTypes(comptime types: []const type) !void {
inline for (types) |testType| {
try testing.expect(testType == @Type(@typeInfo(testType)));
}
}
test "Type.MetaType" {
... | test/stage1/behavior/type.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
pub fn parts(alloc: std.mem.Allocator, inp: []const u8) ![2]usize {
var i: usize = 0;
while (inp[i] != '\n') : (i += 1) {}
var init = inp[0..i];
i += 2;
var middleFor = [_]u5{0} ** 676;
while (i < inp.len) : (i += 8) {
midd... | 2021/14/aoc.zig |
const std = @import("../index.zig");
const math = std.math;
const mem = std.mem;
const io = std.io;
const os = std.os;
const elf = std.elf;
const DW = std.dwarf;
const macho = std.macho;
const ArrayList = std.ArrayList;
const builtin = @import("builtin");
pub const FailingAllocator = @import("failing_allocator.zig").F... | std/debug/index.zig |
const std = @import("std");
const print = std.debug.print;
const panic = std.debug.panic;
const expect = std.testing.expect;
fn freq(t: f32, f: f32, v: f32) f32 {
return f / (t + 0.001 * v);
}
/// Transform a function of n arguments into a function of type FuncReturnT with
/// a single argument, fixing all other ... | src/partial_functions.zig |
const build_options = @import("build_options");
usingnamespace if (build_options.vulkan) @import("vulkan.zig") else struct {};
usingnamespace @import("sdl_image.zig");
pub const SDL_INIT_TIMER: u32 = 0x00000001;
pub const SDL_INIT_AUDIO: u32 = 0x00000010;
pub const SDL_INIT_VIDEO: u32 = 0x00000020;
pub const SDL_INI... | src/binding/sdl.zig |
const std = @import("std");
const cc = @import("c.zig").c;
const Error = @import("errors.zig").Error;
const getError = @import("errors.zig").getError;
const internal_debug = @import("internal_debug.zig");
/// enum containing all glfw keys
pub const Key = enum(c_int) {
/// The unknown key
unknown = cc.GLFW_K... | glfw/src/key.zig |
const std = @import("std");
const mem = std.mem;
const Halfwidth = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 8361,
hi: u21 = 65518,
pub fn init(allocator: *mem.Allocator) !Halfwidth {
var instance = Halfwidth{
.allocator = allocator,
.array = try allocator.alloc(bool, 57158),
... | src/components/autogen/DerivedEastAsianWidth/Halfwidth.zig |
const std = @import("std");
const builtin = @import("builtin");
const File = std.fs.File;
const tcflag_t = std.os.tcflag_t;
const unsupported_term = [_][]const u8{ "dumb", "cons25", "emacs" };
pub fn isUnsupportedTerm() bool {
const env_var = std.os.getenv("TERM") orelse return false;
return for (unsupporte... | src/term.zig |
const std = @import("std");
const mem = std.mem;
const os = std.os;
const fs = std.fs;
const net = std.net;
const fd_t = os.fd_t;
const assert = std.debug.assert;
const wl = @import("wl.zig");
const WireConnection = @import("common/WireConnection.zig");
const Buffer = @import("common/Buffer.zig");
const Message = @imp... | src/client.zig |
const std = @import("std");
const builtin = @import("builtin");
pub fn build(b: *std.build.Builder) !void {
b.setPreferredReleaseMode(.ReleaseFast);
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
// Main build step
const fastfec_cli = b.addExecutable("fastfec... | build.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
const Vec2 = tools.Vec2;
const Map = tools.Map(u8, 250, 250, false);
const DEAD = 100;
const Kart = struct {
p: Vec2,
d: Vec2,
seq: u32 = 0,
fn lessThan(_: void, lhs: Kart, rhs: Kart) bool {
return Ve... | 2018/day13.zig |
const std = @import("std");
const renderkit = @import("renderkit");
pub const Mesh = struct {
bindings: renderkit.BufferBindings,
element_count: c_int,
pub fn init(comptime IndexT: type, indices: []IndexT, comptime VertT: type, verts: []VertT) Mesh {
var ibuffer = renderkit.createBuffer(IndexT, .{... | gamekit/graphics/mesh.zig |
const std = @import("std");
const math = std.math;
const Log2Int = math.Log2Int;
const is_test = @import("builtin").is_test;
pub inline fn fixXfYi(comptime I: type, a: anytype) I {
@setRuntimeSafety(is_test);
const F = @TypeOf(a);
const float_bits = @typeInfo(F).Float.bits;
const int_bits = @typeInfo(... | lib/std/special/compiler_rt/fixXfYi.zig |
const std = @import("std");
const Async = @import("async.zig");
const SIZE = 10_000_000;
pub fn main() void {
return Async.run(asyncMain, .{});
}
fn asyncMain() void {
const arr = Async.allocator.alloc(i32, SIZE) catch @panic("failed to allocate array");
defer Async.allocator.free(arr);
std.debug.pr... | benchmarks/zig/qsort.zig |
const std = @import("std");
const assert = std.debug.assert;
const render = @import("../RTRenderEngine/RTRenderEngine.zig");
const loadFile = @import("../Files.zig").loadFile;
const Matrix = @import("../Mathematics/Mathematics.zig").Matrix;
const assets = @import("../Assets/Assets.zig");
const Asset = assets.Asset;
con... | src/Scene/Scene.zig |
const __floatundidf = @import("floatundidf.zig").__floatundidf;
const testing = @import("std").testing;
fn test__floatundidf(a: u64, expected: f64) !void {
const r = __floatundidf(a);
try testing.expect(r == expected);
}
test "floatundidf" {
try test__floatundidf(0, 0.0);
try test__floatundidf(1, 1.0)... | lib/std/special/compiler_rt/floatundidf_test.zig |
const std = @import("std");
const testing = std.testing;
const lexer = @import("zig_lexer.zig");
const Token = lexer.Token;
const Lexer = lexer.Lexer;
const Id = lexer.Id;
test "\\n" {
testToken("\n", .Newline);
}
test "&" {
testToken("&", .Ampersand);
}
test "&=" {
testToken("&=", .AmpersandEqual);
}
tes... | zig/zig_lexer.test.zig |
const std = @import("std");
const opt = @import("opt.zig");
const Allocator = std.mem.Allocator;
const stdout = &std.io.getStdOut().outStream();
const warn = std.debug.warn;
pub fn basename(path: []const u8, terminator: []const u8, suffix: ?[]u8, allocator: *Allocator) ![]u8 {
if (path.len == 1 and path[0] == '/')... | src/basename.zig |
const std = @import("std");
const Mat4 = @This();
pub const identity = Mat4{ .data = [_]f32{
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
} };
data: [16]f32,
pub fn fromValues(values: [16]f32) Mat4 {
return Mat4{ .data = values };
}
pub fn multiply(a: Mat4, b: Mat4) Mat4 {
var out: Mat4 =... | src/util/matrix.zig |
const std = @import("std");
const print = std.debug.print;
const util = @import("util.zig");
const gpa = util.gpa;
const data = @embedFile("../data/day18.txt");
pub fn main() !void {
var timer = try std.time.Timer.start();
print("🎁 Magnitude: {}\n", .{try part01(data)});
print("Day 18 - part 01 took {:15}ns\n... | src/day18.zig |
const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
const Vector = std.meta.Vector;
const Xoodoo = struct {
const rcs = [12]u32{ 0x058, 0x038, 0x3c0, 0x0d0, 0x120, 0x014, 0x060, 0x02c, 0x380, 0x0f0, 0x1a0, 0x012 };
const Lane = Vector(4, u32);
state: [3]Lane,
inline fn... | src/main.zig |
const std = @import("std");
const builtin = @import("builtin");
// clz - count leading zeroes
// - clzXi2 for unoptimized little and big endian
// - __clzsi2_thumb1: assume a != 0
// - __clzsi2_arm32: assume a != 0
// ctz - count trailing zeroes
// - ctzXi2 for unoptimized little and big endian
// ffs - find first s... | lib/std/special/compiler_rt/count0bits.zig |
const neg = @import("negXi2.zig");
const testing = @import("std").testing;
fn test__negti2(a: i128, expected: i128) !void {
var result = neg.__negti2(a);
try testing.expectEqual(expected, result);
}
test "negdi2" {
// TODO ensuring that math.minInt(i128); returns error
try test__negti2(-3, 3);
tr... | lib/std/special/compiler_rt/negti2_test.zig |
test "comptime slice-sentinel in bounds (unterminated)" {
// array
comptime {
var target = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10;
const slice = target[0..3 :'d'];
_ = slice;
}
// ptr_array
comptime {
var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{unde... | test/behavior/slice_sentinel_comptime.zig |
pub const mach_header = extern struct {
magic: u32,
cputype: cpu_type_t,
cpusubtype: cpu_subtype_t,
filetype: u32,
ncmds: u32,
sizeofcmds: u32,
flags: u32,
};
pub const mach_header_64 = extern struct {
magic: u32,
cputype: cpu_type_t,
cpusubtype: cpu_subtype_t,
filetype: u32... | lib/std/macho.zig |
const std = @import("std");
const runtime_spec = @import("runtime_spec.zig");
const syscall = @import("syscall.zig");
pub fn realpathAllocZ(alloc: *std.mem.Allocator, pathname: []const u8) ![:0]u8 {
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
return alloc.dupeZ(u8, try std.fs.cwd().realpath(pathname, buf[0... | src/utils.zig |
const std = @import("std");
const c = @import("c.zig");
const shaderc = @import("shaderc.zig");
const Scene = @import("scene.zig").Scene;
// This struct runs a raytracing kernel which uses an encoded scene and
// tape to evaluate generic scenes. This is slower than compiling a
// scene-specific kernel, but is much ... | src/preview.zig |
const std = @import("std");
const zfetch = @import("zfetch");
const json = @import("json");
const string = []const u8;
const Config = struct {
token: string,
user: string,
repo: string,
commit: string,
title: string,
body: string,
tag: string,
path: string,
draft: bool,
prerelea... | src/main.zig |