code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const common = @import("common.zig");
const FloatStream = @import("FloatStream.zig");
const isEightDigits = common.isEightDigits;
const Number = common.Number;
/// Parse 8 digits, loaded as bytes in little-endian order.
///
/// This uses the trick where every digit is in [0x030, 0x39],
/// ... | lib/std/fmt/parse_float/parse.zig |
const std = @import("std");
const ast = std.zig.ast;
const render = std.zig.render;
const io = std.io;
const mem = std.mem;
const os = std.os;
const cli = @import("flags");
const Command = cli.Command;
const Context = cli.Context;
const Flag = cli.Flag;
/// taken from https://github.com/Hejsil/zig-clap
const max_src... | src/cmd/fmt.zig |
pub const Keysym = extern enum(u32) {
NoSymbol = 0x000000,
VoidSymbol = 0xffffff,
BackSpace = 0xff08,
Tab = 0xff09,
Linefeed = 0xff0a,
Clear = 0xff0b,
Return = 0xff0d,
Pause = 0xff13,
Scroll_Lock = 0xff14,
Sys_Req = 0xff15,
Escape = 0xff1b,
Delete = 0xffff,
Multi_key... | source/river-0.1.0/deps/zig-xkbcommon/src/xkbcommon_keysyms.zig |
const Self = @This();
const std = @import("std");
const wlr = @import("wlroots");
const wl = @import("wayland").server.wl;
const xkb = @import("xkbcommon");
const server = &@import("main.zig").server;
const util = @import("util.zig");
const Seat = @import("Seat.zig");
const log = std.log.scoped(.keyboard);
seat: ... | source/river-0.1.0/river/Keyboard.zig |
const x86_64 = @import("../index.zig");
const bitjuggle = @import("bitjuggle");
const std = @import("std");
/// Used to obtain random numbers using x86_64's RDRAND opcode
pub const RdRand = struct {
/// Creates a RdRand if RDRAND is supported, null otherwise
pub fn init() ?RdRand {
// RDRAND support in... | src/instructions/random.zig |
const std = @import("std");
const log = std.log;
const math = std.math;
const assert = std.debug.assert;
const cuda = @import("cudaz");
const cu = cuda.cu;
const png = @import("png.zig");
const utils = @import("utils.zig");
const resources_dir = "resources/hw2_resources/";
const Rgb24 = png.Rgb24;
const Gray8 = png... | CS344/src/hw2.zig |
const std = @import("std");
const mem = std.mem;
const proto = @import("protocol.zig");
const Table = @import("table.zig").Table;
// TODO: Think about input sanitisation
pub const WireBuffer = struct {
// the current position in the buffer
mem: []u8 = undefined,
head: usize = 0, // current reading positio... | src/wire.zig |
const std = @import("std.zig");
const builtin = std.builtin;
const io = std.io;
const os = std.os;
const math = std.math;
const mem = std.mem;
const debug = std.debug;
const File = std.fs.File;
pub const AT_NULL = 0;
pub const AT_IGNORE = 1;
pub const AT_EXECFD = 2;
pub const AT_PHDR = 3;
pub const AT_PHENT = 4;
pub c... | lib/std/elf.zig |
const std = @import("./std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const testing = std.testing;
const mem = std.mem;
/// Returns how many bytes the UTF-8 representation would require
/// for the given codepoint.
pub fn utf8CodepointSequenceLength(c: u21) !u3 {
if (c < 0x80) retu... | lib/std/unicode.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = std.mem.Allocator;
const ArrayListUnmanaged = std.ArrayListUnmanaged;
const assert = std.debug.assert;
const log = std.log.scoped(.module);
const BigIntConst = std.math.big.int.Const;
const BigIntMutable = std.math.big.int.Mutable;
const Target = std.T... | src/Module.zig |
const std = @import("std");
const clap = @import("clap");
const mem = std.mem;
const io = std.io;
const json = std.json;
const path = std.os.path;
const Sha3_256 = std.crypto.Sha3_256;
const warn = std.debug.warn;
const Dir = std.os.Dir;
const Entry = std.os.Dir.Entry;
const base64 = std.base64.standard_encoder;
fn ha... | src/main.zig |
const std = @import("../std.zig");
const builtin = std.builtin;
const io = std.io;
const testing = std.testing;
const assert = std.debug.assert;
const trait = std.meta.trait;
const meta = std.meta;
const math = std.math;
/// Creates a stream which allows for writing bit fields to another stream
pub fn BitWriter(endian... | lib/std/io/bit_writer.zig |
const std = @import("std");
const leb = std.leb;
const macho = std.macho;
const mem = std.mem;
const assert = std.debug.assert;
const Allocator = mem.Allocator;
pub const ExternSymbol = struct {
/// Symbol name.
/// We own the memory, therefore we'll need to free it by calling `deinit`.
/// In self-hosted... | src/link/MachO/imports.zig |
const std = @import("index.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const AtomicRmwOp = builtin.AtomicRmwOp;
const AtomicOrder = builtin.AtomicOrder;
/// Thread-safe initialization of global data.
/// TODO use a mutex instead of a spinlock
pub fn lazyInit(comptime T: type) LazyInit(T... | std/lazy_init.zig |
const std = @import("std");
const fs = std.fs;
const io = std.io;
const info = std.log.info;
const print = std.debug.print;
const fmt = std.fmt;
const utils = @import("utils.zig");
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const Waypoint = struct {
y: isize,
x: isize,
pub fn swap(self: *Waypoint... | day_12/src/main.zig |
const std = @import("std");
const panic = std.debug.panic;
const c = @import("c.zig");
const window_width = 800;
const window_height = 600;
const window_title = "Furious Fowls";
// GLFW error callback.
fn errorCallback(err: c_int, description: [*c]const u8) callconv(.C) void {
panic("Error: {}\n", .{@as([*:0]con... | src/main.zig |
const std = @import("../std.zig");
const assert = std.debug.assert;
const mem = std.mem;
const meta = std.meta;
const ast = std.zig.ast;
const Token = std.zig.Token;
const indent_delta = 4;
const asm_indent_delta = 2;
pub const Error = error{
/// Ran out of memory allocating call stack frames to complete renderin... | lib/std/zig/render.zig |
const std = @import("std");
const multiboot = @import("multiboot.zig");
const image_info = @import("image_info.zig");
const Console = @import("Console.zig");
const descriptor = @import("descriptor.zig");
const err = std.log.err;
const warn = std.log.warn;
const dbg = std.log.debug;
const info = std.log.info;
const em... | kernel/main.zig |
const std = @import("std");
const builtin = @import("builtin");
pub fn suggestVectorSizeForCpu(comptime T: type, cpu: std.Target.Cpu) ?usize {
switch (cpu.arch) {
.x86_64 => {
// Note: This is mostly just guesswork. It'd be great if someone more qualified were to take a
// proper l... | lib/std/simd.zig |
// from Holding Hands
// by <NAME>
//
// Now that we have tails all figured out, can you implement trunks?
//
const std = @import("std");
const Elephant = struct {
letter: u8,
tail: ?*Elephant = null,
trunk: ?*Elephant = null,
visited: bool = false,
// Elephant tail methods!
pub fn ... | exercises/049_quiz6.zig |
const std = @import("std");
const input = @import("input.zig");
pub fn run(stdout: anytype) anyerror!void {
{
var input_ = try input.readFile("inputs/day5");
defer input_.deinit();
const result = try part1(&input_);
try stdout.print("5a: {}\n", .{ result });
std.debug.asse... | src/day5.zig |
const interface = @import("interface.zig");
const Interface = interface.Interface;
const SelfType = interface.SelfType;
const std = @import("std");
const mem = std.mem;
const expectEqual = std.testing.expectEqual;
const assert = std.debug.assert;
test "Simple NonOwning interface" {
const NonOwningTest = struct {
... | examples.zig |
const std = @import("std");
const os = std.os;
const wl = @import("wayland").server.wl;
const wlr = @import("wlroots");
const xkb = @import("xkbcommon");
const gpa = std.heap.c_allocator;
pub fn main() anyerror!void {
wlr.log.init(.debug);
var server: Server = undefined;
try server.init();
defer se... | tinywl/tinywl.zig |
const __builtin_va_list = extern struct {
padding: u32,
};
pub const va_list = __builtin_va_list;
pub const __gnuc_va_list = __builtin_va_list;
pub const ANDROID_LOG_UNKNOWN = @enumToInt(enum_android_LogPriority.ANDROID_LOG_UNKNOWN);
pub const ANDROID_LOG_DEFAULT = @enumToInt(enum_android_LogPriority.ANDROID_LOG_D... | src/android-bind.zig |
pub const NDF_ERROR_START = @as(u32, 63744);
pub const NDF_E_LENGTH_EXCEEDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146895616));
pub const NDF_E_NOHELPERCLASS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146895615));
pub const NDF_E_CANCELLED = @import("../zig.zig").typedConst(HRESULT, @as(i32... | win32/network_management/network_diagnostics_framework.zig |
const std = @import("std");
const Answer = struct { @"0": u32, @"1": u32 };
const Digit = std.bit_set.IntegerBitSet(7);
const ObservedDigits = [10]Digit;
const OutputDigits = [4]Digit;
const zero = Digit{ .mask = 0b1110111 };
const one = Digit{ .mask = 0b0100100 };
const two = Digit{ .mask = 0b1011101 };
const three ... | src/day08.zig |
const pow = @import("std/math").pow;
// https://drafts.csswg.org/css-syntax/#tokenization
// 4. Tokenization
pub const Tokenizer = struct{
data: []u8,
idx: usize,
curr: u8,
next: u8,
reconsumed: bool,
};
// https://infra.spec.whatwg.org/#surrogate
// A surrogate is a code point that is in the range U+D800 ... | parser/4_0_tokenization.zig |
const irq = @import("interrupts.zig");
const platform = @import("platform.zig");
const serial = @import("../../debug/serial.zig");
const scheduler = @import("../../scheduler.zig");
const IRQ_PIT = 0x00;
const CounterSelect = enum {
Counter0,
Counter1,
Counter2,
pub fn getRegister(c: CounterSelect) u16... | src/kernel/arch/x86/pit.zig |
const __floatuntisf = @import("floatuntisf.zig").__floatuntisf;
const testing = @import("std").testing;
fn test__floatuntisf(a: u128, expected: f32) void {
const x = __floatuntisf(a);
testing.expect(x == expected);
}
test "floatuntisf" {
test__floatuntisf(0, 0.0);
test__floatuntisf(1, 1.0);
test_... | lib/std/special/compiler_rt/floatuntisf_test.zig |
const lz = @import("./lz77.zig");
const hamlet = @embedFile("../fixtures/hamlet.txt");
const std = @import("std");
const assert = std.debug.assert;
const expect = std.testing.expect;
const math = std.math;
const mem = std.mem;
const UINT8_MAX = math.maxInt(u8);
test "hash4" {
try expect(lz.hash4(&[4]u8{ 0x00, 0... | src/lz77_test.zig |
const MMIO = @import("mmio.zig").MMIO;
// Register definititions:
// IO PORTS:
const PINB = MMIO(0x23, u8, packed struct {
PINB0: u1 = 0,
PINB1: u1 = 0,
PINB2: u1 = 0,
PINB3: u1 = 0,
PINB4: u1 = 0,
PINB5: u1 = 0,
PINB6: u1 = 0,
PINB7: u1 = 0,
});
const DDRB = MMIO(0x24, u8, packed st... | src/gpio.zig |
const std = @import("std");
const c = @import("c.zig");
const ext = @import("externs.zig");
const data = @import("data.zig");
const HashedArrayList = @import("libs/hashed_array_list.zig").HashedArrayList;
// Public includes
/// Utilities to make life easier
pub const util = @import("util.zig");
/// A set of default bi... | src/wren.zig |
const Allocator = std.mem.Allocator;
const Headers = @import("http").Headers;
const ParsingError = @import("errors.zig").ParsingError;
const std = @import("std");
pub fn parse(allocator: *Allocator, buffer: []const u8, max_headers: usize) ParsingError!Headers {
var remaining_bytes = buffer[0..];
var headers = ... | src/events/headers.zig |
const std = @import("std");
const assert = std.debug.assert;
const fmt = std.fmt;
const mem = std.mem;
const meta = std.meta;
const net = std.net;
const os = std.os;
const config = @import("config.zig");
const vsr = @import("vsr.zig");
const usage = fmt.comptimePrint(
\\Usage:
\\
\\ tigerbeetle [-h | --h... | src/cli.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const Compilation = @import("Compilation.zig");
const llvm = @import("llvm_bindings.zig");
const link = @import("link.zig");
const Module = @import("Module.zig");
const TypedValue = @import("TypedValue.zig");
const ir = @import("ir.zig");
const Inst = ir... | src/llvm_backend.zig |
const std = @import("std");
const default_block_size = 0x2000;
const Superblock = struct {
inode_count: u32,
block_count: u32,
superuser_reserved_block_count: u32,
unallocated_block_count: u32,
unallocated_inode_count: u32,
superblock_block_number: u32,
log2_block_size: u32,
log2_fragm... | src/common/ext2.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const glfw = @import("glfw");
const gpu = @import("gpu");
pub const VSyncMode = enum {
/// Potential screen tearing.
/// No synchronization with monitor, render frames as fast as possible.
none,
/// No tearing, synchronizes rendering wit... | src/Engine.zig |
const std = @import("std");
const string = []const u8;
const builtin = @import("builtin");
const zigmod = @import("../lib.zig");
const u = @import("index.zig");
const yaml = @import("./yaml.zig");
//
//
pub const Dep = struct {
const Self = @This();
alloc: std.mem.Allocator,
type: zigmod.DepType,
pa... | src/util/dep.zig |
const std = @import("std");
const testing = std.testing;
pub const Scanner = struct {
const SIZE: usize = 8; // TODO this is the number of elements in Field enum
validate: bool,
total_valid: usize,
count: [SIZE]usize,
pub fn init(validate: bool) Scanner {
var self = Scanner{
.... | 2020/p04/scanner.zig |
const std = @import("std");
const util = @import("util.zig");
pub const ZValue = union(enum) {
Object: std.StringArrayHashMap(ZValue),
Array: std.ArrayList(ZValue),
String: std.ArrayList(u8),
pub fn format(value: ZValue, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void... | src/data.zig |
const std = @import("std");
const mem = std.mem;
const math = std.math;
const assert = std.debug.assert;
const expectEqual = std.testing.expectEqual;
pub const XXHash32 = XXHash(XH32);
pub const XXHash64 = XXHash(XH64);
const XH32 = struct {
pub const block_length = 16;
pub const Int = u32;
const primes ... | src/xxhash.zig |
const std = @import("std");
const elf = std.elf;
const builtin = std.builtin;
const assert = std.debug.assert;
const R_AMD64_RELATIVE = 8;
const R_386_RELATIVE = 8;
const R_ARM_RELATIVE = 23;
const R_AARCH64_RELATIVE = 1027;
const R_RISCV_RELATIVE = 3;
const R_SPARC_RELATIVE = 22;
const R_RELATIVE = switch (builtin.c... | lib/std/os/linux/start_pie.zig |
const x86 = @import("machine.zig");
const std = @import("std");
const assert = std.debug.assert;
usingnamespace(@import("types.zig"));
const AvxOpcode = x86.avx.AvxOpcode;
const Mnemonic = x86.Mnemonic;
const Instruction = x86.Instruction;
const Machine = x86.Machine;
const Operand = x86.operand.Operand;
const Imme... | src/x86/database.zig |
const std = @import("std");
test "example" {
const input = @embedFile("11_example.txt");
const result = run(input);
try std.testing.expectEqual(@as(usize, 195), result);
}
pub fn main() void {
const input = @embedFile("11.txt");
const result = run(input);
std.debug.print("{}\n", .{result});
}
... | shritesh+zig/11b.zig |
const std = @import("std");
const t = std.testing;
pub const base62Characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".*;
pub const base = 62;
const zeroString = "000000000000000000000000000";
const offsetUppercase = 10;
const offsetLowercase = 36;
const stringEncodedLength = 27;
pub const E... | src/base62.zig |
const std = @import("std");
const pike = @import("pike.zig");
const Waker = @import("waker.zig").Waker;
const os = std.os;
const mem = std.mem;
pub const Event = struct {
const Self = @This();
handle: pike.Handle,
readers: Waker = .{},
writers: Waker = .{},
pub fn init() !Self {
return Se... | event_epoll.zig |
const std = @import("std");
const nvg = @import("nanovg");
const gui = @import("gui.zig");
usingnamespace @import("event.zig");
const Point = @import("geometry.zig").Point;
const Application = @This();
pub const SystemFunctions = struct {
// essential
createWindow: fn ([:0]const u8, u32, u32, gui.Window.Creat... | src/gui/Application.zig |
const c = @cImport({
@cInclude("cfl_enums.h");
});
pub const Color = struct {
pub const ForeGround = 0;
pub const BackGround2 = 7;
pub const Inactive = 8;
pub const Selection = 15;
pub const Gray0 = 32;
pub const Dark3 = 39;
pub const Dark2 = 45;
pub const Dark1 = 47;
pub const ... | src/enums.zig |
const std = @import("std");
const builtin = @import("builtin");
const mem = @import("gc.zig");
const target = @import("builtin").target;
const is_windows = target.os.tag == .windows;
const linenoise = @cImport({
if (!is_windows) {
@cInclude("stddef.h");
@cInclude("linenoise.h");
}
});
/// Line... | src/linereader.zig |
const std = @import("std");
const builtin = @import("builtin");
const sdl = @import("sdl");
const c = @cImport({
@cInclude("vulkan/vulkan.h");
});
const use_rt_funcs = builtin.os.tag == .macos or builtin.os.tag == .windows;
pub usingnamespace c;
pub inline fn createInstance(pCreateInfo: [*c]const c.VkInstanceCr... | lib/vk/vk.zig |
const zupnp = @import("../lib.zig");
const c = @import("../c.zig");
const ChunkedDeinitFn = fn(*anyopaque)void;
const ChunkedGetChunkFn = fn(*anyopaque, []u8, usize)usize;
/// HTTP response to send back to the client.
pub const ServerResponse = union(enum) {
pub const ContentsParameters = struct {
/// Extr... | src/web/server_response.zig |
const std = @import("std");
const expect = std.testing.expect;
const builtin = @import("builtin");
test "@byteSwap integers" {
const ByteSwapIntTest = struct {
fn run() void {
t(u0, 0, 0);
t(u8, 0x12, 0x12);
t(u16, 0x1234, 0x3412);
t(u24, 0x123456, 0x563412);... | test/stage1/behavior/byteswap.zig |
/// Package blake2b implements the BLAKE2b hash algorithm defined by RFC 7693.
///
/// BLAKE2b is able to produce hash values up to 64 bytes. If you aren't sure
/// which function you need, use the `blake2b` function. If you wish to gain
/// more control of how the algorithm works, use the `Context.init`,
/// `Context... | src/blake2b.zig |
const c = @import("c.zig");
const std = @import("std");
const Allocator = std.mem.Allocator;
const DeviceHandle = @import("device_handle.zig").DeviceHandle;
const err = @import("error.zig");
/// WIP
pub fn Transfer(comptime T: type) type {
return struct {
const Self = @This();
const libusb_transf... | src/transfer.zig |
const std = @import("std");
const tallocator = std.testing.allocator;
const warn = std.debug.warn;
const assertEqual = std.testing.expectEqual;
pub fn sweep(allocat: *std.mem.Allocator, bits: u128, r: u128) !*std.ArrayList(u128){
var i: u128 = 0;
var index: usize = 0;
var collect = std.ArrayList(u128).ini... | src/main.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = true;
const assert = std.debug.assert;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
const Component = [2]u32;
const Bridge = struct {
strength: u32,
length: u32,
};
fn ... | 2017/day24.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const expectEqualSlices = std.testing.expectEqualSlices;
const bssl = @import("bearssl");
const crt = bssl.crt;
const localhost = @import("localhost.zig");
const Params = struct {
pemData: []const u8,
... | test/test_crt.zig |
const memory = @import("memory.zig");
/// Map implemented using a simple binary tree.
///
/// TODO: Replace with Balancing Tree
///
/// For Reference See:
/// https://en.wikipedia.org/wiki/Binary_search_tree
pub fn Map(comptime KeyType: type, comptime ValueType: type,
comptime eql: fn(a: KeyType, b: KeyTyp... | kernel/map.zig |
const std = @import("std");
const assert = std.debug.assert;
const ExecError = error{InvalidOpcode};
fn exec(intcode: []i32) !void {
var pos: usize = 0;
while (true) {
switch (intcode[pos]) {
99 => break,
1 => {
const pos_x = @intCast(usize, intcode[pos + 1]);
... | zig/02.zig |
const std = @import("std");
const assert = std.debug.assert;
const ArgError = @import("main.zig").ArgError;
pub const ImageFormat = enum(u8) {
Pbm = 0,
Pgm = 1,
Ppm = 2,
pub fn parse(fmt_str_user: []const u8) ArgError!ImageFormat {
const fmts = [_][]const u8{ "pbm", "pgm", "ppm" };
var... | src/image.zig |
const std = @import("std");
const array = @import("array.zig");
const Array = array.Array;
const tensor = @import("tensor.zig");
const Tensor = tensor.Tensor;
const expr = tensor.expr;
pub fn relu(alc: *std.mem.Allocator, x: Tensor) !Tensor {
return try expr(alc, "max(0, x)", .{ .x = x });
}
pub fn log... | src/funcs.zig |
const std = @import("std");
const reg = @import("registry.zig");
const id_render = @import("../id_render.zig");
const cparse = @import("c_parse.zig");
const mem = std.mem;
const Allocator = mem.Allocator;
const CaseStyle = id_render.CaseStyle;
const IdRenderer = id_render.IdRenderer;
const preamble =
\\
\\// T... | generator/openxr/render.zig |
pub fn Register(comptime R: type) type {
return RegisterRW(R, R);
}
pub fn RegisterRW(comptime Read: type, comptime Write: type) type {
return struct {
raw_ptr: *volatile u32,
const Self = @This();
pub fn init(address: usize) Self {
return Self{ .raw_ptr = @intToPtr(*volat... | target/stm32f0x0.zig |
const std = @import("std");
/// Creates a new parser core that provides the core functions for a recursive descent
/// parser.
/// `TokenizerT` is the type of the tokenizer to use.
/// `ignore_list` is a array of token types that will be ignored by this parser core.
/// This is useful to filter out comments and non-si... | src/parser_core.zig |
const math = @import("std").math;
usingnamespace @import("MathUtil.zig");
const Quat = @import("Quat.zig").Quat;
pub const zero = Vec3{};
pub const one = Vec3{ .x = 1.0, .y = 1.0, .z = 1.0 };
pub const xAxis = Vec3{ .x = 1.0, .y = 0.0, .z = 0.0 };
pub const yAxis = Vec3{ .x = 0.0, .y = 1.0, .z = 0.0 };
pub const zAxi... | src/math/Vec3.zig |
usingnamespace @import("../c.zig");
const std = @import("std");
const Vec3 = @import("../math/Vec3.zig").Vec3;
const Vec2 = @import("../math/Vec2.zig").Vec2;
const mat4x4 = @import("../math/Mat4x4.zig");
const Mat4x4 = mat4x4.Mat4x4;
const Camera = @import("Camera.zig").Camera;
const ArrayList = std.ArrayList;
cons... | src/presentation/Mesh.zig |
const std = @import("std");
const builtin = @import("builtin");
pub fn build(b: *std.build.Builder) void {
const default_abi = if (builtin.os.tag == .windows) .gnu else null; // doesn't require vcruntime
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{
.default_tar... | build.zig |
const std = @import("std");
const assert = std.debug.assert;
pub const lualib = @cImport({
@cInclude("lua.h");
@cInclude("lauxlib.h");
@cInclude("lualib.h");
});
pub const Lua = struct {
const LuaUserData = struct {
allocator: std.mem.Allocator,
registeredTypes: std.StringArrayHashMap(... | src/lua.zig |
const std = @import("std");
const alka = @import("alka");
const m = alka.math;
usingnamespace alka.log;
pub const mlog = std.log.scoped(.app);
pub const log_level: std.log.Level = .info;
fn draw() !void {
const asset = alka.getAssetManager();
const staticfont = try asset.getTexture(1);
const font = try a... | examples/text_rendering.zig |
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
pub fn asin(x: var) @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
f32 => asin32(x),
f64 => asin64(x),
else => @compileError("asin not implemented for " ++ @typeName(T)),
};
}
fn r... | std/math/asin.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const BigIntConst = std.math.big.int.Const;
const BigIntMutable = std.math.big.int.Mutable;
const Type = @import("type.zig").Type;
const Value = @import("value.zig").Value;
const TypedValue = @import(... | src/zir.zig |
const std = @import("std");
const expect = std.testing.expect;
const str = []const u8;
const tools = @import("tools.zig");
const streql = tools.streql;
/// A "formatted struct" encapsulates a complex type like slice, array or struct
/// into a new struct that defines how it can be parsed.
/// If a struct has this enum... | src/fmt_structs.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const parseInt = @import("parseInt.zig").parse;
const inputRules =
\\light red bags contain 1 bright white bag, 2 muted yellow bags.
\\dark orange bags contain 3 bright white bags, 4... | src/day07.zig |
const std = @import("std");
const upaya = @import("upaya");
const ts = @import("../tilescript.zig");
usingnamespace @import("imgui");
const brushes_win = @import("brushes.zig");
var buffer: [25]u8 = undefined;
pub fn draw(state: *ts.AppState) void {
igPushStyleVarVec2(ImGuiStyleVar_WindowMinSize, ImVec2{ .x = 200... | tilescript/windows/animations.zig |
const std = @import("std");
const DW = std.dwarf;
// zig fmt: off
pub const Register = enum(u8) {
// 0 through 7, 32-bit registers. id is int value
eax, ecx, edx, ebx, esp, ebp, esi, edi,
// 8-15, 16-bit registers. id is int value - 8.
ax, cx, dx, bx, sp, bp, si, di,
// 16-23, 8-bit register... | src/codegen/x86.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const data = @embedFile("../inputs/day08.txt");
pub fn main() anyerror!void {
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa_impl.deinit();
const gpa = gpa_impl.allocator();
return m... | src/day08.zig |
const std = @import("std");
const ansi = @import("ansi");
const range = @import("range").range;
pub fn answer(out: anytype, comptime prompt: []const u8, comptime T: type, comptime valfmt: []const u8, value: T) !T {
try out.print(comptime ansi.color.Fg(.Green, "? "), .{});
try out.print(comptime ansi.color.Bold... | src/lib.zig |
const std = @import("std");
const ft = @import("freetype");
const zigimg = @import("zigimg");
const Atlas = @import("atlas.zig").Atlas;
const AtlasErr = @import("atlas.zig").Error;
const UVData = @import("atlas.zig").UVData;
const App = @import("main.zig").App;
const draw = @import("draw.zig");
pub const Label = @Thi... | examples/gkurve/label.zig |
const std = @import("std");
const utils = @import("./_utils.zig");
const common = @import("../_common_utils.zig");
const FV = common.FV;
pub const XADD = struct {
//! Command builder for XADD.
//!
//! Use `XADD.forStruct(T)` to create at `comptime` a specialized version of XADD
//! whose `.init` accept... | src/commands/streams/xadd.zig |
const std = @import("std");
const napi = @import("../napi.zig");
const serde = @import("../serde.zig");
pub fn bind(env: napi.env, comptime f: anytype, comptime name: [:0]const u8, comptime A: std.mem.Allocator) !napi.value {
const T = @TypeOf(f);
const I = @typeInfo(T);
switch (I) {
else => @compileError("... | src/bind/function.zig |
usingnamespace @import("bits.zig");
pub const __psp_max_fd = 1024;
pub const __psp_fdman_type = enum(u8) {
File,
Pipe,
Socket,
Tty,
};
pub const __psp_fdman_descriptor = struct {
filename: ?[]u8,
ftype: __psp_fdman_type,
sce_descriptor: c_int,
flags: u32,
ref_count: u32,
};
pub fn... | src/psp/os/fdman.zig |
const std = @import("std");
const expect = std.testing.expect;
const Mutex = std.Thread.Mutex;
pub const IndexType = u16;
pub const MeshHandle = *opaque {};
extern fn zmesh_set_allocator(
malloc: fn (size: usize) callconv(.C) ?*anyopaque,
calloc: fn (num: usize, size: usize) callconv(.C) ?*anyopaque,
rea... | modules/graphics/vendored/zmesh/src/zmesh.zig |
const std = @import("std");
const math = std.math;
const expect = std.testing.expect;
const kernel = @import("trig.zig");
const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;
pub fn __tanh(x: f16) callconv(.C) f16 {
// TODO: more efficient implementation
re... | lib/std/special/compiler_rt/tan.zig |
const std = @import("std");
const mem = std.mem;
// TODO See stdlib, this is a modified non vectorized implementation
pub const ChaCha20Stream = struct {
const math = std.math;
pub const BlockVec = [16]u32;
pub fn initContext(key: [8]u32, d: [4]u32) BlockVec {
const c = "expand 32-byte k";
... | src/crypto.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 Diagnostics = @This();
pub const Message = struct {
tag: Tag,
loc: Source.Location = .{},
extra: E... | src/Diagnostics.zig |
usingnamespace @import("core.zig");
const glfw = @import("glfw");
const vk = @import("vulkan");
usingnamespace @import("vulkan/device.zig");
usingnamespace @import("vulkan/buffer.zig");
usingnamespace @import("vulkan/image.zig");
const TransferQueue = @import("transfer_queue.zig").TransferQueue;
const Input = @import... | src/imgui.zig |
const std = @import("std");
const Fifo = std.fifo.LinearFifo(u8, .{ .Static = 512 });
const File = std.fs.File;
const Term = @import("term.zig").Term;
pub const Key = enum(u16) {
F1 = 0xFFFF - 0,
F2 = 0xFFFF - 1,
F3 = 0xFFFF - 2,
F4 = 0xFFFF - 3,
F5 = 0xFFFF - 4,
F6 = 0xFFFF - 5,
F7 = 0xFF... | src/input.zig |
const std = @import("std");
const testing = std.testing;
const log = std.log;
const numtheory = @import("numtheory");
const mul_mod = numtheory.mul_mod;
/// Represents p(x)=a*x+b
pub const Polynomial = struct {
const Self = @This();
a: i64,
b: i64,
// Computes f * g (mod m)
pub fn composeWith(f... | day22/src/polynomial.zig |
const std = @import("std");
const Builder = @import("std").build.Builder;
const Target = @import("std").Target;
const CrossTarget = @import("std").zig.CrossTarget;
const pkgs = @import("deps.zig").pkgs;
fn build_bios(b: *Builder) *std.build.RunStep {
const out_path = b.pathJoin(&.{ b.install_path, "/bin" });
... | build.zig |
const std = @import("std");
const file = std.os.File;
const assert = std.debug.assert;
const warn = std.debug.warn;
pub fn main() anyerror!void {
var direct_allocator = std.heap.DirectAllocator.init();
defer direct_allocator.deinit();
const allocator = &direct_allocator.allocator;
const input_file = try file.... | src/day3.zig |
const std = @import("std");
const print = std.debug.print;
const net = std.net;
const os = std.os;
const datetime = @import("./zig-datetime/datetime.zig");
const timezones = @import("./zig-datetime/timezones.zig");
pub fn main() !void {
print("Configuring local address...\n", .{});
const localhost = try net.Ad... | chap02/time_server_ipv6_lowlvl.zig |
const std = @import("std");
const AnimationData = @import("../ModelFiles/AnimationFiles.zig").AnimationData;
const ReferenceCounter = @import("../RefCount.zig").ReferenceCounter;
const Asset = @import("../Assets/Assets.zig").Asset;
const ShaderInstance = @import("Shader.zig").ShaderInstance;
const Mesh = @import("Mesh.... | src/RTRenderEngine/Animation.zig |
gconst std = @import("std");
const process = @import("../../process.zig");
const platform = @import("../../platform.zig");
const time = @import("../../time.zig");
const util = @import("../../util.zig");
const w3 = @import("../../wasm3.zig");
const syscall = @import("../../syscall.zig");
usingnamespace @import("wasi_de... | kernel/runtime/wasm/wasi.zig |
const std = @import("std");
const assert = std.debug.assert;
const zp = @import("zplay");
const dig = zp.deps.dig;
const alg = zp.deps.alg;
const bt = zp.deps.bt;
const Vec3 = alg.Vec3;
const Vec4 = alg.Vec4;
const Mat4 = alg.Mat4;
const VertexArray = zp.graphics.common.VertexArray;
const Texture2D = zp.graphics.textur... | examples/bullet_test.zig |
const std = @import("std");
const fs = std.fs;
const json = std.json;
const mem = std.mem;
const assert = std.debug.assert;
const Allocator = mem.Allocator;
pub const BlockPropertyVariantsType = union(enum) {
Enum,
Bool,
Number: struct {
start: usize,
max: usize,
},
pub fn from(sel... | scripts/generate_blocks.zig |
const c = @cImport({
@cInclude("cfl_widget.h");
@cInclude("cfl.h");
});
const enums = @import("enums.zig");
const group = @import("group.zig");
const image = @import("image.zig");
pub const WidgetPtr = ?*c.Fl_Widget;
fn shim(w: ?*c.Fl_Widget, data: ?*c_void) callconv(.C) void {
_ = w;
c.Fl_awake_msg(d... | src/widget.zig |
const fmath = @import("index.zig");
pub fn cos(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(cos32, x),
f64 => @inlineCall(cos64, x),
else => @compileError("cos not implemented for " ++ @typeName(T)),
}
}
// sin polynomial coefficients
const S0 = 1.... | src/cos.zig |
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const panic = std.debug.panic;
const info = std.log.info;
const crypto = std.crypto;
const sha256 = crypto.hash.sha2.Sha256;
const fmt = std.fmt;
const assert = std.debug.assert;
pub const Lmdb = @import("lmdb.zig").Lmdb;
pub const BLOCK_DB ... | src/blockchain.zig |
const std = @import("std");
// these might be in the standard library already but I don't know how to describe what they do well enough to ask.
// nice to have things
fn interpolateInt(a: anytype, b: @TypeOf(a), progress: f64) @TypeOf(a) {
const OO = @TypeOf(a);
const floa = @intToFloat(f64, a);
const fl... | src/helpers.zig |
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
//
// In jurisdictions... | src/zm.zig |