code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const big = std.math.big;
const mem = std.mem;
usingnamespace @import("primitive_types.zig");
usingnamespace @import("iterator.zig");
usingnamespace @import("connection.zig");
usingnamespace @import("client.zig");
const testing = @import("testing.zig");
// This files provides helpers to t... | src/casstest.zig |
const std = @import("std");
const assert = std.debug.assert;
const math = @import("utils/math.zig");
const CharacterData = @import("CharacterData.zig");
// Get all active vulnerable hitboxes translated by the character's position.
fn GetVulnerableBoxes(
hitboxPool: []CharacterData.Hitbox, // out parameter
acti... | src/common.zig |
const std = @import("std");
const Instance = @import("instance.zig");
const Op = @import("op.zig");
pub const PostProcess = @import("module/post_process.zig");
const log = std.log.scoped(.wazm);
const magic_number = std.mem.readIntLittle(u32, "\x00asm");
const Module = @This();
arena: std.heap.ArenaAllocator,
/// C... | src/module.zig |
const std = @import("std");
const mem = std.mem;
const Tree = @import("Tree.zig");
const NodeIndex = Tree.NodeIndex;
const TokenIndex = Tree.TokenIndex;
const Attribute = @This();
name: TokenIndex,
params: NodeIndex = .none,
pub const ParseContext = enum {
any,
@"enum",
function,
label,
record,
... | src/Attribute.zig |
const builtin = @import("builtin");
const std = @import("../../std.zig");
const testing = std.testing;
const math = std.math;
const cmath = math.complex;
const Complex = cmath.Complex;
const ldexp_cexp = @import("ldexp.zig").ldexp_cexp;
/// Returns e raised to the power of z (e^z).
pub fn exp(z: anytype) @TypeOf(z) ... | lib/std/math/complex/exp.zig |
const builtin = @import("builtin");
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
const expo2 = @import("expo2.zig").expo2;
const maxInt = std.math.maxInt;
pub fn sinh(x: var) @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
f32 => sinh32(x),
... | std/math/sinh.zig |
const std = @import("std");
const Tree = @import("Tree.zig");
const TokenIndex = Tree.TokenIndex;
const NodeIndex = Tree.NodeIndex;
const Parser = @import("Parser.zig");
const Compilation = @import("Compilation.zig");
const Attribute = @import("Attribute.zig");
const Type = @This();
pub const Qualifiers = packed stru... | src/Type.zig |
const std = @import("std.zig");
const builtin = @import("builtin");
const assert = debug.assert;
const autoHash = std.hash.autoHash;
const debug = std.debug;
const warn = debug.warn;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
const trait = meta.trait;
const Allocator = mem.Allocator;
const Wyhas... | lib/std/hash_map.zig |
const std = @import("std");
const ascii = std.ascii;
const fmt = std.fmt;
const math = std.math;
const testing = std.testing;
const assert = std.debug.assert;
pub fn parseHexFloat(comptime T: type, s: []const u8) !T {
assert(@typeInfo(T) == .Float);
const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.b... | lib/std/fmt/parse_hex_float.zig |
const std = @import("std.zig");
const assert = std.debug.assert;
const meta = std.meta;
const mem = std.mem;
const Allocator = mem.Allocator;
const testing = std.testing;
pub fn MultiArrayList(comptime S: type) type {
return struct {
bytes: [*]align(@alignOf(S)) u8 = undefined,
len: usize = 0,
... | lib/std/multi_array_list.zig |
allocator: Allocator,
src: []const u8,
iter: std.unicode.Utf8Iterator,
span: SpanData = .{ .start = 0, .end = 0 },
whitespace_len: u16 = 0,
tokens: std.MultiArrayList(Token) = .{},
spans: std.ArrayListUnmanaged(SpanData) = .{},
// errors: std.ArrayListUnmanaged()
const std = @import("std");
const Allocator = std.mem.... | fexc/src/parse/Lexer.zig |
const std = @import("std");
const fmt = std.fmt;
inline fn gen_semaphore_var_name(comptime provider:[]const u8, comptime name: []const u8)
*const [provider.len + name.len + 15:0]u8{
return "sdt_semaphore_" ++ provider ++ "_" ++ name;
}
pub inline fn SDT_DEFINE_SEMAPHORE(comptime provider:[]const u8, com... | tracing.zig |
const std = @import("std");
const Url = @import("url.zig").Url;
const pike = @import("pike");
/// Represents a request made by a client
pub const Request = struct {
/// HTTP methods as specified in RFC 7231
pub const Method = enum {
get,
head,
post,
put,
delete,
... | src/request.zig |
const std = @import("std");
const assert = std.debug.assert;
const math = std.math;
const mem = std.mem;
const config = @import("../config.zig");
const vsr = @import("../vsr.zig");
const log = std.log.scoped(.storage);
// TODOs:
// less than a majority of replicas may have corruption
// have an option to enable/disa... | src/test/storage.zig |
const std = @import("std");
const c = @import("c.zig");
const android = @import("android-bind.zig");
const build_options = @import("build_options");
pub const egl = @import("egl.zig");
pub const JNI = @import("jni.zig").JNI;
const app_log = std.log.scoped(.app_glue);
// Export the flat functions for now
// pub con... | src/android-support.zig |
const std = @import("std");
const math = std.math;
const assert = std.debug.assert;
const expect = std.testing.expect;
/// Returns x * 2^n.
pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {
var base = x;
var shift = n;
const T = @TypeOf(base);
const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits... | lib/std/math/ldexp.zig |
const std = @import("../index.zig");
const math = std.math;
const assert = std.debug.assert;
const maxInt = std.math.maxInt;
pub fn trunc(x: var) @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
f32 => trunc32(x),
f64 => trunc64(x),
else => @compileError("trunc not implemented fo... | std/math/trunc.zig |
const builtin = @import("builtin");
const std = @import("std");
const fmt = std.fmt;
const mem = std.mem;
const testing = std.testing;
/// Parses RedisSimpleString values
pub const SimpleStringParser = struct {
pub fn isSupported(comptime T: type) bool {
return switch (@typeInfo(T)) {
.Int, .Fl... | src/parser/t_string_simple.zig |
const std = @import("std");
fn root() []const u8 {
return std.fs.path.dirname(@src().file) orelse unreachable;
}
const root_path = root() ++ "/";
const srcs = &.{
root_path ++ "libssh2/src/channel.c",
root_path ++ "libssh2/src/comp.c",
root_path ++ "libssh2/src/crypt.c",
root_path ++ "libssh2/src/... | .gyro/zig-libssh2-mattnite-github.com-b5472a81/pkg/libssh2.zig |
const std = @import("../std.zig");
const InStream = std.io.InStream;
pub fn SeekableStream(comptime SeekErrorType: type, comptime GetSeekPosErrorType: type) type {
return struct {
const Self = @This();
pub const SeekError = SeekErrorType;
pub const GetSeekPosError = GetSeekPosErrorType;
... | lib/std/io/seekable_stream.zig |
const std = @import("std");
const unicode = @import("../unicode.zig");
const utf8 = @import("index.zig");
const t = std.testing;
test "init" {
t.expectEqual(utf8.max_rune, unicode.tables.max_rune);
t.expectEqual(utf8.rune_error, unicode.tables.replacement_char);
}
const Utf8Map = struct {
r: i32,
str... | src/unicode/utf8/index_test.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const json = std.json;
const gl = @import("webgl.zig");
/// A gltf buffer
pub const BufferView = struct {
vbo: usize,
stride: usize,
/// Creates a buffer view given a gltf json buffer view, also uploads the data as a vbo.
pub fn fromJso... | src/gltf.zig |
const std = @import("../std.zig");
const Allocator = std.mem.Allocator;
/// This allocator is used in front of another allocator and logs to `std.log`
/// on every call to the allocator.
/// For logging to a `std.io.Writer` see `std.heap.LogToWriterAllocator`
pub fn LoggingAllocator(
comptime success_log_level: st... | lib/std/heap/logging_allocator.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const data = @embedFile("data/day18.txt");
pub fn main() !void {
var lines = std.mem.tokenize(data, "\r\n");
var result1: usize = 0;
var result2: usize = 0;
while (lines.n... | src/day18.zig |
const std = @import("std");
const warn = std.debug.warn;
const stack_trace_enabled = false;
fn stack_trace_none(fmt: []const u8, va_args: ...) void {}
const stack_trace = comptime if (stack_trace_enabled) std.debug.warn else stack_trace_none;
const idToString = @import("zig_grammar.debug.zig").idToString;
const Lexe... | zig/zig_parser.zig |
const std = @import("std");
const opt = @import("opt.zig");
const File = std.fs.File;
const stdout = &std.io.getStdOut().outStream();
const warn = std.debug.warn;
const BUFSIZ: u16 = 4096;
pub fn tail(n: u32, file: std.fs.File, is_bytes: bool) !void {
// check if user inputs illegal line number
if (n <= 0) {
... | src/tail.zig |
const std = @import("std");
/// Zig version. When writing code that supports multiple versions of Zig, prefer
/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
pub const zig_version = std.SemanticVersion.parse("0.9.0") catch unreachable;
/// Temporary until self-hosted is feature complete... | zig-cache/o/ee67e79fdc1324c042df3d56fd7921a7/builtin.zig |
const std = @import("std");
const pkgs = struct {
// TinyVG package
const tvg = std.build.Pkg{
.name = "tvg",
.path = .{ .path = "src/lib/tinyvg.zig" },
.dependencies = &.{ptk},
};
const ptk = std.build.Pkg{
.name = "ptk",
.path = .{ .path = "vendor/parser-toolki... | build.zig |
const std = @import("std");
const testing = std.testing;
const mem = std.mem;
const c = @import("c.zig").c;
const glfw = @import("main.zig");
const Error = @import("errors.zig").Error;
const getError = @import("errors.zig").getError;
const Image = @import("Image.zig");
const Monitor = @import("Monitor.zig");
const Cu... | glfw/src/Window.zig |
const std = @import("std");
const lola = @import("../main.zig");
usingnamespace @import("value.zig");
usingnamespace @import("../common/ir.zig");
usingnamespace @import("../common/compile-unit.zig");
usingnamespace @import("../common/decoder.zig");
usingnamespace @import("environment.zig");
usingnamespace @import("obje... | src/library/runtime/vm.zig |
const std = @import("std");
const curl = @import("curl.zig");
const pacman = @import("pacman.zig");
const Host = "https://aur.archlinux.org/rpc/?v=5";
pub const Snapshot = "https://aur.archlinux.org/cgit/aur.git/snapshot";
pub const RPCRespV5 = struct {
version: usize,
type: []const u8,
resultcount: usi... | src/aur.zig |
const utils = @import("utils");
const kernel = @import("root").kernel;
const print = kernel.print;
const io = kernel.io;
const memory = kernel.memory;
const MemoryError = memory.MemoryError;
const Allocator = memory.Allocator;
const devices = kernel.devices;
const pci = @import("pci.zig");
const putil = @import("uti... | kernel/platform/ata.zig |
const pi = @import("std").math.pi;
/// An angle.
///
/// See: https://dogma.dev/Angle
pub const Angle = extern struct {
/// The angle in radians.
_radians: f64,
const Self = @This();
/// Constructs an angle from radians.
pub fn init(radians: f64) Self {
return Self{ ._radians = radians }... | src/angle.zig |
const std = @import("std");
const testing = std.testing;
const stringtime = @import("stringtime");
const StringTime = stringtime.StringTime;
test "Parse basic template" {
const Template = "Hi {{name}}!";
var template = try StringTime.init(testing.allocator, Template);
defer template.deinit();
testing... | tests/template_tests.zig |
const std = @import("std");
usingnamespace (@import("../machine.zig"));
usingnamespace (@import("../util.zig"));
const reg = Operand.register;
const memRm = Operand.memoryRmDef;
test "80286" {
const m32 = Machine.init(.x86_32);
const m64 = Machine.init(.x64);
debugPrint(false);
{
testOp0(m32... | src/x86/tests/80286.zig |
const std = @import("std");
fn ishex(c: u8) bool {
if ('0' <= c and c <= '9') {
return true;
}
if ('a' <= c and c <= 'f') {
return true;
}
if ('A' <= c and c <= 'F') {
return true;
}
return false;
}
fn unhex(c: u8) u8 {
if ('0' <= c and c <= '9') {
retu... | src/url.zig |
const c = @import("c.zig");
const std = @import("std");
const panic = std.debug.panic;
const debug_gl = @import("debug_gl.zig");
const glfw_impl = @import("glfw_impl.zig");
const gl3_impl = @import("gl3_impl.zig");
export fn errorCallback(err: c_int, description: [*c]const u8) void {
panic("Error: {}\n", .{descrip... | examples/imgui-dice-roller/src/main_original.zig |
const math3d = @import("math3d.zig");
const Mat4x4 = math3d.Mat4x4;
const Vec3 = math3d.Vec3;
const Vec4 = math3d.Vec4;
const Tetris = @import("tetris.zig").Tetris;
const std = @import("std");
const assert = std.debug.assert;
const bufPrint = std.fmt.bufPrint;
const c = @import("c.zig");
const debug_gl = @import("deb... | benchmarks/tetris/tetris/src/main.zig |
const vec = @import("vec-simd.zig");
const Vec2 = vec.Vec2;
const Vec3 = vec.Vec3;
const Vec4 = vec.Vec4;
const IVec3 = vec.IVec3;
const IVec4 = vec.IVec4;
const UVec4 = vec.UVec4;
const BVec3 = vec.BVec3;
const BVec4 = vec.BVec4;
export fn addN2(a: *Vec2.T, n: f32) *Vec2.T {
a.* = Vec2.addN(a.*, n);
retur... | src/exports.zig |
const testing = @import("std").testing;
const math = @import("std").math;
pub const v4 = struct {
x: f32,
y: f32,
z: f32,
w: f32,
/// initializes a v4 with x, y, z and w
pub fn init(x: f32, y: f32, z: f32, w: f32) v4 {
return v4 {
.x = x,
.y = y,
.z ... | src/vector4.zig |
const std = @import("std");
const json = std.json;
const magic = "i3-ipc";
pub const I3ipc = struct {
const Self = @This();
conn: std.net.Stream,
sock_path: ?[]const u8,
allocator: std.mem.Allocator,
pub fn init(sock_path: ?[]const u8, allocator: std.mem.Allocator) !I3ipc {
var path: []con... | src/i3-ipc.zig |
const std = @import("std");
const ComptimeStringHashMap = @import("comptime_hash_map/comptime_hash_map.zig").ComptimeStringHashMap;
const testing = std.testing;
/// Reverse compression codebook, used for decompression
const smaz_rcb = [_][]const u8{
" ", "the", "e", "t", "a", "of", "o", "and"... | src/main.zig |
const std = @import("std");
const print = std.debug.print;
const data = @embedFile("../inputs/day17.txt");
pub fn main() anyerror!void {
const target_area = try parse(data);
print("Part 1: {d}\n", .{part1(target_area)});
print("Part 2: {d}\n", .{part2(target_area)});
}
const V = struct {
x: isize,
... | src/day17.zig |
const Builder = @import("std").build.Builder;
const z = @import("std").zig;
const std = @import("std");
const builtin = std.builtin;
pub const PSPBuildInfo = struct{
//SDK Path
path_to_sdk: []const u8,
src_file: []const u8,
//Title
title: []const u8,
//Optional customizations
icon0: []const... | build-psp.zig |
const std = @import("std");
pub const FlagType = enum {
short,
long,
};
pub const Flag = struct {
name: []const u8,
kind: FlagType,
pub fn is(self: Flag, other: []const u8) bool {
return std.mem.eql(u8, self.name, other);
}
pub fn isLong(self: Flag, other: []const u8) bool {
... | src/parser.zig |
const std = @import("std");
const warn = std.debug.warn;
const maxInt = std.math.maxInt;
const Allocator = std.mem.Allocator;
const Scanner = @import("./scanner.zig").Scanner;
const Token = @import("./scanner.zig").Token;
const TokenType = @import("./scanner.zig").TokenType;
const VM = @import("./vm.zig").VM;
const Chu... | src/compiler.zig |
const std = @import("std");
const Coff = @import("Coff.zig");
const mem = std.mem;
const io = std.io;
var gpa_allocator = std.heap.GeneralPurposeAllocator(.{}){};
const gpa = gpa_allocator.allocator();
pub fn log(
comptime level: std.log.Level,
comptime scope: @TypeOf(.EnumLiteral),
comptime format: []co... | src/main.zig |
const std = @import("std");
const builtin = @import("builtin");
const Scope = @import("scope.zig").Scope;
const Compilation = @import("compilation.zig").Compilation;
const ObjectFile = @import("codegen.zig").ObjectFile;
const llvm = @import("llvm.zig");
const Buffer = std.Buffer;
const assert = std.debug.assert;
/// V... | src-self-hosted/value.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 = @This();
const UniformBufferObject = struct {
mat: zm.Ma... | examples/fractal-cube/main.zig |
const builtin = @import("builtin");
const std = @import("std");
const time = std.time;
const testing = std.testing;
const Allocator = std.mem.Allocator;
const heap = std.heap;
const Hash = @import("hash.zig").H;
const o = @import("ops.zig");
const Op = o.Op;
const OpTag = o.OpTag;
const U = @import("util.zig");
const M... | src/benchmark.zig |
const std = @import("std");
const fs = std.fs;
const io = std.io;
const mem = std.mem;
const Allocator = mem.Allocator;
const Target = std.Target;
const target = @import("target.zig");
const assert = std.debug.assert;
const glibc = @import("glibc.zig");
const introspect = @import("introspect.zig");
const fatal = @impor... | src/print_targets.zig |
//--------------------------------------------------------------------------------
// Section: Types (14)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows6.1'
const IID_IAudioEndpointFormatControl_Value = Guid.initString("784cfd40-9f8... | win32/media/audio/endpoints.zig |
const std = @import("std");
const mem = std.mem;
const print = std.debug.print;
const fs = std.fs;
const ChildProcess = std.ChildProcess;
const process = std.process;
const render_utils = @import("render_utils.zig");
pub const RunCommand = struct {
expected_outcome: union(enum) { Success, Failure: []const u8 } = ... | src/doctest/run.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = mem.Allocator;
const ArrayList = std.ArrayList;
const wasm = @import("wasm.zig");
const errors = @import("errors.zig");
const fastly = errors.fastly;
const FastlyError = errors.FastlyError;
const Uri = @import("zuri/zuri.zig").Uri;
const RequestHeader... | src/zigly/http.zig |
const std = @import("std");
const http = @import("apple_pie");
const fs = http.FileServer;
const router = http.router;
pub const io_mode = .evented;
const Context = struct {
last_route: ?[]const u8,
};
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
co... | examples/router.zig |
const std = @import("std");
const builtin = @import("builtin");
const deps = @import("deps.zig");
const libgit2 = deps.build_pkgs.libgit2;
const mbedtls = deps.build_pkgs.mbedtls;
const libssh2 = deps.build_pkgs.libssh2;
const zlib = deps.build_pkgs.zlib;
const libcurl = deps.build_pkgs.libcurl;
const Builder = std.b... | build.zig |
const std = @import("std");
const mem = std.mem;
const Writer = std.fs.File.Writer;
const Reader = std.fs.File.Reader;
const Allocator = mem.Allocator;
const Model = @import("model.zig");
const SerialModel = Model.SerialModel;
const ChildRefs = Model.ChildRefs;
const MaterialInfo = Model.MaterialInfo;
const magic = "... | src/load_adf.zig |
const std = @import("std");
pub const c = @import("./c.zig").c;
pub usingnamespace @import("./units.zig");
pub usingnamespace @import("./audio.zig");
const WIN_MARGIN = 200;
const SDL_Error = error{
SDL_Init,
SDL_CreateWindow,
SDL_CreateRenderer,
SDL_CreateRGBSurfaceFrom,
SDL_CreateTextureFromSurf... | src/sdlb.zig |
const utils = @import("./_utils.zig");
/// XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] ID [id ...]
pub const XREAD = struct {
count: Count = .NoCount,
block: Block = .NoBlock,
streams: []const []const u8,
ids: []const []const u8,
/// Instantiates a new XREAD command.
pub fn ... | src/commands/streams/xread.zig |
pub const RPC_C_BINDING_INFINITE_TIMEOUT = @as(u32, 10);
pub const RPC_C_BINDING_MIN_TIMEOUT = @as(u32, 0);
pub const RPC_C_BINDING_DEFAULT_TIMEOUT = @as(u32, 5);
pub const RPC_C_BINDING_MAX_TIMEOUT = @as(u32, 9);
pub const RPC_C_CANCEL_INFINITE_TIMEOUT = @as(i32, -1);
pub const RPC_C_LISTEN_MAX_CALLS_DEFAULT = @as(u32... | deps/zigwin32/win32/system/rpc.zig |
const tty = @import("tty.zig");
const cstr = @import("std").cstr;
const Process = @import("process.zig").Process;
// This should be in EAX.
pub const MULTIBOOT_BOOTLOADER_MAGIC = 0x2BADB002;
// Is there basic lower/upper memory information?
pub const MULTIBOOT_INFO_MEMORY = 0x00000001;
// Is there a full memory ... | kernel/multiboot.zig |
const std = @import("std");
const getty = @import("../../../lib.zig");
pub fn Visitor(comptime Tuple: type) type {
return struct {
allocator: ?std.mem.Allocator = null,
const Self = @This();
const impl = @"impl Visitor"(Tuple);
pub usingnamespace getty.de.Visitor(
Self... | src/de/impl/visitor/tuple.zig |
const std = @import("std");
const Context = @import("Context.zig");
const Lexer = @import("Lexer.zig");
const Location = @import("Location.zig");
const Node = @import("Node.zig");
const Token = @import("Token.zig");
allocator: std.mem.Allocator,
can_break: bool = false, // Parsing a loop?
ctx: Context,
range_id: u8 =... | src/Parser.zig |
const std = @import("std");
pub const Pattern = struct {
start: usize,
states: []const State,
const State = union(enum) {
accept: void, // Accept the string and finish the match
split: [2]usize, // Split off to two different nodes
lit: struct { // Consume one literal byte
... | rez.zig |
const kernel = @import("../kernel/kernel.zig");
const log = kernel.log.scoped(.NVMe);
const TODO = kernel.TODO;
const PCI = @import("pci.zig");
const x86_64 = @import("../kernel/arch/x86_64.zig");
const NVMe = @This();
pub var controller: NVMe = undefined;
device: *PCI.Device,
capabilities: CAP,
version: u32,
doorbe... | src/drivers/nvme.zig |
const std = @import("std");
const Str = []const u8;
const Bytecode = std.ArrayList(u8);
const Locations = std.ArrayList(Loc);
const Value = @import("value.zig").Value;
const Constants = std.ArrayList(Value);
pub const Op = enum {
Return,
Constant,
True,
False,
Nil,
Add,
Sub,
Mul,
... | src/bytecode.zig |
const std = @import("std");
const mem = std.mem;
const LV = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 44032,
hi: u21 = 55176,
pub fn init(allocator: *mem.Allocator) !LV {
var instance = LV{
.allocator = allocator,
.array = try allocator.alloc(bool, 11145),
};
mem.set(... | src/components/autogen/GraphemeBreakProperty/LV.zig |
const std = @import("std");
const Builder = std.build.Builder;
const glfw = @import("libs/mach-glfw/build.zig");
const system_sdk = @import("libs/mach-glfw/system_sdk.zig");
pub const LinuxWindowManager = enum {
X11,
Wayland,
};
pub const Options = struct {
/// Defaults to X11 on Linux.
linux_window_m... | gpu/build_dawn.zig |
const fmath = @import("index.zig");
pub fn ilogb(x: var) -> i32 {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(ilogb32, x),
f64 => @inlineCall(ilogb64, x),
else => @compileError("ilogb not implemented for " ++ @typeName(T)),
}
}
// NOTE: Should these be exposed publically?... | src/ilogb.zig |
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const Allocator = mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const ArrayList = std.ArrayList;
pub const Attribute = struct {
name: []const u8,
value: []const u8,
};
pub const Content = union(enum) {
CharData:... | generator/xml.zig |
const WasGo = @cImport({
@cInclude("errno.h");
@cInclude("stdio.h");
@cInclude("stdlib.h");
@cInclude("wasgo/wasgo.h");
@cInclude("Spatial.h");
@cInclude("Transform.h");
@cInclude("InputEventKey.h");
});
const print = @import("std").debug.print;
var velocity: f32 = 0;
var frame_counter: i3... | demo/thrust-zig/thrust.zig |
const std = @import("std");
const mkl_path = "C:\\Program Files (x86)\\Intel\\oneAPI\\mkl\\latest\\";
const tbb_path = "C:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\latest\\";
fn linkMKL(exe : *std.build.LibExeObjStep) void {
exe.addIncludeDir(mkl_path ++ "include");
exe.addLibPath(mkl_path ++ "lib\\intel64")... | build.zig |
const std = @import("std");
const mem = std.mem;
const net = std.net;
const os = std.os;
const IO = @import("tigerbeetle-io").IO;
const http = @import("http");
fn IoOpContext(comptime ResultType: type) type {
return struct {
frame: anyframe = undefined,
result: ResultType = undefined,
};
}
con... | examples/async_tcp_echo_client.zig |
const std = @import("std");
const fs = std.fs;
const io = std.io;
const mem = std.mem;
const process = std.process;
const assert = std.debug.assert;
const tmpDir = std.testing.tmpDir;
const Allocator = mem.Allocator;
const Blake3 = std.crypto.hash.Blake3;
const OsTag = std.Target.Os.Tag;
const Arch = enum {
any,
... | src/main.zig |
pub fn Formatter(
comptime Context: type,
comptime Writer: type,
comptime nullFn: fn (Context, Writer) Writer.Error!void,
comptime boolFn: fn (Context, Writer, bool) Writer.Error!void,
comptime intFn: fn (Context, Writer, anytype) Writer.Error!void,
comptime floatFn: fn (Context, Writer, anytype... | src/ser/interface/formatter.zig |
const builtin = @import("builtin");
const std = @import("std");
const os = std.os;
const b64 = std.base64.standard.Encoder;
// const zfetch = @import("zfetch");
const hzzp = @import("hzzp");
const tls = @import("iguanaTLS");
const Emote = @import("../Chat.zig").Message.Emote;
const EmoteHashMap = std.StringHashMap(str... | src/network/EmoteCache.zig |
const std = @import("std");
const stdx = @import("../stdx.zig");
const ds = stdx.ds;
const t = stdx.testing;
const log = stdx.log.scoped(.document);
const MaxLineChunkSize = 50;
// When line chunk becomes full, the size is reduced to target threshold.
const LineChunkTargetThreshold = 40;
pub const LineChunkId = u32... | stdx/textbuf/document.zig |
const std = @import("std");
const ast = std.zig.ast;
const Token = std.zig.Token;
use @import("clang.zig");
pub const Mode = enum {
import,
translate,
};
pub const ClangErrMsg = Stage2ErrorMsg;
pub fn translate(
backing_allocator: *std.mem.Allocator,
args_begin: [*]?[*]const u8,
args_end: [*]?[*... | src-self-hosted/translate_c.zig |
const std = @import("std");
const print = std.debug.print;
usingnamespace @import("value.zig");
usingnamespace @import("chunk.zig");
usingnamespace @import("compiler.zig");
usingnamespace @import("heap.zig");
usingnamespace @import("vm.zig");
pub const GCLOG = std.log.scoped(.GC);
pub fn collectGarbage() !void {
... | zvm/src/gc.zig |
const std = @import("std");
const string = []const u8;
const range = @import("range").range;
const input = @embedFile("../input/day11.txt");
// const input =
// \\5483143223
// \\2745854711
// \\5264556173
// \\6141336146
// \\6357385478
// \\4167524645
// \\2176841721
// \\6882881134
/... | src/day11.zig |
const testing = @import("std").testing;
const math = @import("std").math;
pub const v3 = struct {
x: f32,
y: f32,
z: f32,
/// initializes a v3 with x, y and z
pub fn init(x: f32, y: f32, z: f32) v3 {
return v3 {
.x = x,
.y = y,
.z = z,
};
}
... | src/vector3.zig |
const base = @import("base.zig");
const std = @import("std");
pub fn monthMax(segments: []const ?base.Segment) u8 {
//Assumes same months for leap and non-leap years.
var month_max: u8 = 1;
for (segments) |raw_s| {
const s = raw_s orelse unreachable;
if (s.month > month_max) {
m... | src/gen.zig |
const std = @import("std");
const expect = std.testing.expect;
const warn = std.debug.warn;
const Cpu = @import("cpu.zig").Cpu;
const Opcode = @import("opcode.zig").Opcode;
const OpcodeEnum = @import("enum.zig").OpcodeEnum;
const AddressingModeEnum = @import("enum.zig").AddressingModeEnum;
test "should initialize corr... | src/test_cpu.zig |
const std = @import("std");
pub fn main() anyerror!void {
std.log.info("All your codebase are belong to us.", .{});
}
// Declare a struct.
// Zig gives no guarantees about the order of fields and the size of
// the struct but the fields are guaranteed to be ABI-aligned.
const Point = struct {
x: f32,
y: f3... | structs/src/main.zig |
const diff = @import("diff.zig");
const std = @import("std");
const testing = std.testing;
const warn = std.debug.warn;
const TestCase = struct {
a: []const u8,
b: []const u8,
ops: []const diff.Op,
};
test "split lines" {
var a = std.debug.global_allocator;
var src = "A\nB\nC\n";
const line... | src/lsp/diff/diff_test.zig |
const std = @import("std");
usingnamespace @import("common.zig");
usingnamespace @import("string.zig");
const debug = std.debug;
const math = std.math;
const mem = std.mem;
const fmt = std.fmt;
fn valueRef() type {
return value;
}
const value = options([]type{
object,
array,
jstring,
number,
... | src/parser/json.zig |
const mat4x4 = @import("mat4x4.zig");
/// Generic Vector3 Type
pub fn Generic(comptime T: type) type {
switch (T) {
i16, i32, i64, i128, f16, f32, f64, f128 => {
return struct {
const Self = @This();
/// X value
x: T = 0,
/// Y ... | src/kiragine/kira/math/vec3.zig |
const std = @import("std");
const util = @import("util.zig");
const data = @embedFile("../data/day17.txt");
pub const Rectangle = struct {
top_left: util.Point(i32),
bot_right: util.Point(i32),
};
pub const VelocityTimePair = struct {
velocity: util.Point(i32),
time: i32,
};
// Given the target area... | src/day17.zig |
const std = @import("std");
usingnamespace (@import("../machine.zig"));
usingnamespace (@import("../util.zig"));
const imm = Operand.immediate;
const mem = Operand.memory;
const memRm = Operand.memoryRm;
const reg = Operand.register;
test "cpuid features" {
debugPrint(false);
{
const cpu_features = [... | src/x86/tests/cpuid.zig |
const std = @import("std");
const testing = std.testing;
/// Read a single unsigned LEB128 value from the given reader as type T,
/// or error.Overflow if the value cannot fit.
pub fn readULEB128(comptime T: type, reader: anytype) !T {
const U = if (@typeInfo(T).Int.bits < 8) u8 else T;
const ShiftT = std.math... | lib/std/leb128.zig |
const MachO = @This();
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const fmt = std.fmt;
const fs = std.fs;
const log = std.log.scoped(.link);
const macho = std.macho;
const codegen = @import("../codegen.zig");
const aarch64 = @import("../codegen/aarch64.zig");
cons... | src/link/MachO.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = mem.Allocator;
const Source = @import("Source.zig");
const Compilation = @import("Compilation.zig");
const Tree = @import("Tree.zig");
const util = @import("util.zig");
const is_windows = @import("builtin").os.tag == .windows;
const Diagnostics = @This... | src/Diagnostics.zig |
const std = @import("std");
usingnamespace @import("mecha");
const builtin = std.builtin;
const testing = std.testing;
const json = combine(.{ ws, element });
const value = oneOf(.{
object,
array,
jstring,
number,
jtrue,
jfalse,
jnull,
});
const members = combine(.{
member,
disca... | example/json.zig |
const std = @import("std");
const builtin = @import("builtin");
const event = std.event;
const Target = @import("target.zig").Target;
const c = @import("c.zig");
/// See the render function implementation for documentation of the fields.
pub const LibCInstallation = struct {
include_dir: []const u8,
lib_dir: ?... | src-self-hosted/libc_installation.zig |
const std = @import("std");
const print = std.debug.print;
usingnamespace @import("common.zig");
usingnamespace @import("value.zig");
usingnamespace @import("chunk.zig");
pub const Token = struct {
tokenType: TokenType,
literal: []const u8,
line: usize,
};
pub const TokenType = enum {
// Single-character... | vm/src/scanner.zig |
const std = @import("std");
const builtin = @import("builtin");
const kernel = @This();
pub const arch = @import("arch.zig");
pub const log = std.log;
pub const build_mode = builtin.mode;
pub const Physical = @import("physical.zig");
pub const Virtual = @import("virtual.zig");
pub usingnamespace @import("assertion.zi... | src/kernel/kernel.zig |
const std = @import("std");
const unit = @import("unit.zig");
const CompileInfo = unit.CompileInfo;
pub fn usage() void {
std.debug.print("usage text\n", .{});
}
pub fn help() void {
std.debug.print("help text\n", .{});
}
const ArgType = enum {
file_name,
show_help,
show_usage,
opt_level,
... | src/args.zig |
const std = @import("std");
const PrintHelper = @import("print_helper.zig").PrintHelper;
const CodegenState = @import("codegen.zig").CodegenState;
const CodegenModuleState = @import("codegen.zig").CodegenModuleState;
const ExpressionResult = @import("codegen.zig").ExpressionResult;
const BufferDest = @import("codegen.z... | src/zangscript/codegen_print.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
//;
/// SPSC, lock-free push and pop
/// allocation free, data is fixed size
pub fn Queue(comptime T: type) type {
return struct {
const Self = @This();
pub const Error = error{
OutOfSpa... | src/communication.zig |
const fmath = @import("index.zig");
pub fn asinh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(asinhf, x),
f64 => @inlineCall(asinhd, x),
else => @compileError("asinh not implemented for " ++ @typeName(T)),
}
}
// asinh(x) = sign(x) * log(|x| + sqrt(... | src/asinh.zig |