code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const c = @import("c.zig");
usingnamespace @import("entity.zig");
usingnamespace @import("3d_viewport.zig");
const State = struct {
pass_action: c.sg_pass_action,
main_pipeline: c.sg_pipeline,
main_bindings: c.sg_bindings,
};
// Global state (makes me think of GLUT from back i... | src/main.zig |
const std = @import("std");
const math = std.math;
const common = @import("common.zig");
const Number = common.Number;
const floatFromUnsigned = common.floatFromUnsigned;
// converts the form 0xMMM.NNNpEEE.
//
// MMM.NNN = mantissa
// EEE = exponent
//
// MMM.NNN is stored as an integer, the exponent is offset.
pub f... | lib/std/fmt/parse_float/convert_hex.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const Random = std.rand.Random;
pub fn lessThanComparison(comptime T: type) fn (a: T, b: T) bool {
return struct {
fn lessThan(a: T, b: T) bool {
return a < b;
}
}.lessThan;
}
pub fn greaterThanComparison(comptime T: ... | bench/utils.zig |
const std = @import("std");
const eql = std.mem.eql;
const indexOf = std.mem.indexOf;
const parseUnsigned = std.fmt.parseUnsigned;
const fields = [_][]const u8{ "byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid" };
const ecls = [_][]const u8{ "amb", "blu", "brn", "gry", "grn", "hzl", "oth" };
fn isValid(key: []const u8,... | 2020/zig/src/4.zig |
const std = @import("std");
const assert = std.debug.assert;
const glfw = @import("glfw");
const c = @cImport({
@cInclude("dawn/dawn_proc.h");
@cInclude("dawn_native_mach.h");
});
const objc = @cImport({
@cInclude("objc/message.h");
});
pub const cimgui = @cImport({
@cDefine("CIMGUI_DEFINE_ENUMS_AND_STR... | libs/zgpu/src/zgpu.zig |
const std = @import("std");
const math = std.math;
const trait = std.meta.trait;
const assert = std.debug.assert;
fn VecMixin(comptime Self: type, comptime T: type) type {
return struct {
/// Clones the vector
pub fn clone(self: *Self) Self {
var result = Self.Zero;
inline f... | math/src/vec.zig |
const ChunkedReader = @import("chunked_reader.zig").ChunkedReader;
const ContentLengthReader = @import("content_length_reader.zig").ContentLengthReader;
const Event = @import("../events/events.zig").Event;
const Headers = @import("http").Headers;
const Method = @import("http").Method;
const StatusCode = @import("http")... | src/readers/readers.zig |
const std = @import("std");
const testing = std.testing;
pub const ExpressionMatch = struct {
result: []const u8 = undefined,
};
/// Will scan the buf for pattern. Pattern can contain () to indicate narrow group to extract.
/// Currently no support for character classes and other patterns.
pub fn express... | src/parser_expressions.zig |
const std = @import("std");
const fundude = @import("fundude");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("<html>\n", .{});
try stdout.print("<style>td {{ white-space: nowrap; font-family: monospace }}</style>\n", .{});
try stdout.print("<html>\n<body>\n<table>\... | scripts/opcodes.zig |
const HeaderName = @import("name.zig").HeaderName;
const HeaderType = @import("name.zig").HeaderType;
const HeaderValue = @import("value.zig").HeaderValue;
pub const Header = struct {
name: HeaderName,
value: []const u8,
pub fn as_slice(comptime headers: anytype) []Header {
const typeof = @TypeOf(... | src/headers/header.zig |
const std = @import("std");
const mem = std.mem;
/// The only output of the tokenizer.
pub const ZNodeToken = struct {
const Self = @This();
/// 0 is root, 1 is top level children.
depth: usize,
/// The extent of the slice.
start: usize,
end: usize,
};
/// Parses text outputting ZNodeTokens. ... | src/main.zig |
const std = @import("std");
const parse = @import("parse.zig");
const LispTokenizer = parse.LispTokenizer;
const LispParser = parse.LispParser;
const LispCall = interpret.LispCall;
const LispClosure = interpret.LispClosure;
const LispExpr = interpret.LispExpr;
const LispInterpreter = interpret.LispInterpreter;
const ... | src/library.zig |
const device = @import("device.zig");
const dtb = @import("dtb.zig");
const log = @import("log.zig");
extern fn __delay(count: i32) void;
pub const Reg = enum(u32) {
GPFSEL0 = 0x00, // GPIO Function Select 0
GPFSEL1 = 0x04, // GPIO Function Select 1
GPFSEL2 = 0x08, // GPIO Function Select 2
GPFSEL3 = ... | gpio.zig |
const std = @import("std");
const gpa = std.heap.c_allocator;
const zfetch = @import("zfetch");
const zigmod = @import("../../lib.zig");
const u = @import("./../../util/index.zig");
const zpm = @import("./../zpm.zig");
//
//
pub fn execute(args: [][]u8) !void {
const url = try std.mem.join(gpa, "/", &.{ zpm.serv... | src/cmd/zpm/add.zig |
const std = @import("std");
const fmt = std.fmt;
const io = std.io;
const mem = std.mem;
const warn = std.debug.warn;
fn hex2int(hexChars: []u8) !u128 {
var hexSlice = hexChars[0..];
if (mem.eql(u8, hexSlice[0..2], "0x")) {
hexSlice = hexChars[2..];
}
// NOTE: If not for the fact that we need ... | zig/src/hex2dec.zig |
const std = @import("std");
const os = std.os;
const builtin = @import("builtin");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const page_size = std.mem.page_size;
/// Integer type for pointing to slots in a small allocation
const SlotIndex = @IntType(false, std.math.log2(page_size) + 1);
pu... | gpda.zig |
const std = @import("std");
const builtin = @import("builtin");
pub const ANDROID_PROJECT_PATH = "android-project";
pub const ZIG_LIBC_CONFIGS_DIR_PATH = "zig-libc-configs";
pub const AndroidEnv = struct {
jdk_path: []u8,
sdk_path: []u8,
platform_number: []u8,
build_tools_path: []u8,
ndk_path: []u... | build_android.zig |
const std = @import("std");
const Seat = @import("Seat.zig");
pub const Direction = enum {
next,
previous,
};
pub const PhysicalDirection = enum {
up,
down,
left,
right,
};
pub const Orientation = enum {
horizontal,
vertical,
};
// zig fmt: off
const command_impls = std.ComptimeStr... | source/river-0.1.0/river/command.zig |
// The length of the journey has to be borne with, for every moment
// is necessary.
const std = @import("std");
const Self = @This();
const Page = [4096]u8;
const PageId = u64;
const FreePages = std.SinglyLinkedList(PageId);
pages: std.ArrayList(Page) = undefined,
/// Holds ids of the free pages in the manager
//... | src/page_manager.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const Random = std.rand.DefaultPrng;
const base_log = std.log.scoped(.lesson5);
const cuda = @import("cudaz");
const cu = cuda.cu;
const RawKernels = @import("lesson5_kernel.zig");
pub fn main() !void {
try nosuspend amain();
}
const CudaEventLoop ... | CS344/src/lesson5.zig |
const std = @import("std");
const bio = @import("bio/bio.zig");
const Sequence = @import("sequence.zig").Sequence;
pub fn Database(comptime A: type, comptime KmerLength: comptime_int) type {
return struct {
const Self = @This();
pub const Alphabet = A;
pub const kmerInfo = bio.kmer.KmerInf... | src/database.zig |
const std = @import("std");
const stdx = @import("stdx");
const Point2 = stdx.math.Point2(u32);
const t = stdx.testing;
const log = stdx.log.scoped(.rect_bin_packer);
const SpanId = u32;
const NullId = std.math.maxInt(SpanId);
const ResizeCallback = fn (ctx: ?*anyopaque, width: u32, height: u32) void;
const ResizeCall... | graphics/src/rect_bin_packer.zig |
const std = @import("std");
const builtin = @import("builtin");
const debug = std.debug;
const testing = std.testing;
pub fn PackedIntIo(comptime Int: type, comptime endian: builtin.Endian) type {
//The general technique employed here is to cast bytes in the array to a container
// integer (having bits % 8 == ... | lib/std/packed_int_array.zig |
const std = @import("std");
const builtin = @import("builtin");
const DW = std.dwarf;
const assert = std.debug.assert;
const testing = std.testing;
// zig fmt: off
/// General purpose registers in the AArch64 instruction set
pub const Register = enum(u7) {
// 64-bit registers
x0, x1, x2, x3, x4, x5, x6, x7,
... | src/arch/aarch64/bits.zig |
const std = @import("../../std.zig");
const net = @import("net.zig");
const os = std.os;
const mem = std.mem;
const windows = std.os.windows;
const ws2_32 = windows.ws2_32;
pub fn Mixin(comptime Socket: type) type {
return struct {
/// Open a new socket.
pub fn init(domain: u32, socket_type: u32... | lib/std/x/os/socket_windows.zig |
const std = @import("std");
const tt = @import("root");
const Parser = @This();
const State = enum {
text,
spec,
};
const Token = enum {
text,
start_spec,
end_spec,
};
const TransitionCombinator = tt.util.enums.Combinator(State, Token);
const Transition = TransitionCombinator.Cross;
const transit... | src/web/weeb/Parser.zig |
const wlr = @import("../wlroots.zig");
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const InputMethodManagerV2 = extern struct {
global: *wl.Global,
input_methods: wl.list.Head(InputMethodV2, "link"),
server_destroy: wl.Listener(*wl.Server),
events: extern struct {
i... | src/types/input_method_v2.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const Verbatim = @import("./verbatim.zig").Verbatim;
const testing = std.testing;
pub const E = error.DynamicReplyError;
/// DynamicReply lets you parse Redis replies without having to to know
/// their shape beforehand. It also supports parsing Redis e... | src/types/reply.zig |
const c = @import("../../c_global.zig").c_imp;
const std = @import("std");
// dross-zig
const Application = @import("../../core/application.zig").Application;
const Matrix4 = @import("../../core/matrix4.zig").Matrix4;
const Vector3 = @import("../../core/vector3.zig").Vector3;
// How many cameras are instantiated in th... | src/renderer/cameras/camera_2d.zig |
const std = @import("std");
usingnamespace (@import("../machine.zig"));
usingnamespace (@import("../util.zig"));
test "80386" {
const m32 = Machine.init(.x86_32);
const m64 = Machine.init(.x64);
debugPrint(false);
{
const rm8 = Operand.memoryRm(.DefaultSeg, .BYTE, .EAX, 0);
const rm16... | src/x86/tests/80386.zig |
const std = @import("std");
const os = std.os;
const warn = std.debug.warn;
// How this should appear from a ptracing program:
// pid - syscall
// 0 - sigprocmask
// 0 - gettid
// 0 - fork
// 0 - kill | waitpid || 1 - gettid | rt_sigtimedwait
// 0 - gettid
pub fn main() anyerror!void {
// Ignore SIGUSR1 until we s... | tests/example-programs/child_signals.zig |
const std = @import("std");
const dos = @import("./DOtherSide.zig");
const QMetaType = @import("./QMetaType.zig").QMetaType;
pub const ParameterDefinition = struct {
name: [*c]const u8,
type_: QMetaType,
};
pub const SignalDefinition = struct {
name: [*c]const u8,
parameters: []const ParameterDefiniti... | src/QMetaObject.zig |
const macro = @import("pspmacros.zig");
comptime {
asm (macro.import_module_start("sceNet", "0x00090000", "8"));
asm (macro.import_function("sceNet", "0x39AF39A6", "sceNetInit"));
asm (macro.import_function("sceNet", "0x281928A9", "sceNetTerm"));
asm (macro.import_function("sceNet", "0x50647530", "sceN... | src/psp/nids/pspnet.zig |
const NvPtx = @This();
const std = @import("std");
const builtin = @import("builtin");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const log = std.log.scoped(.link);
const Module = @import("../Module.zig");
const Compilation = @import("../Compilation.zig");
const link = @import("../link.zi... | src/link/NvPtx.zig |
const std = @import("std");
const StringList = std.ArrayListUnmanaged([]const u8);
pub const Flag = void;
pub const PositionalData = struct {
items: [][]const u8,
separator_index: usize,
pub fn beforeSeparator(self: PositionalData) [][]const u8 {
return self.items[0..self.separator_index];
}
... | accord.zig |
const std = @import("std");
const liu = @import("src/liu/lib.zig");
const assets = @import("src/assets.zig");
const bld = std.build;
const Arch = std.Target.Cpu.Arch;
const Builder = bld.Builder;
const Mode = std.builtin.Mode;
var mode: Mode = undefined;
const ProgData = struct {
name: []const u8,
root: []co... | build.zig |
const std = @import("std");
const mem = std.mem;
const Fullwidth = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 12288,
hi: u21 = 65510,
pub fn init(allocator: *mem.Allocator) !Fullwidth {
var instance = Fullwidth{
.allocator = allocator,
.array = try allocator.alloc(bool, 53223),... | src/components/autogen/DerivedEastAsianWidth/Fullwidth.zig |
const std = @import("std");
const web = @import("zhp.zig");
const log = std.log;
pub const Opcode = enum(u4) {
Continue = 0x0,
Text = 0x1,
Binary = 0x2,
Res3 = 0x3,
Res4 = 0x4,
Res5 = 0x5,
Res6 = 0x6,
Res7 = 0x7,
Close = 0x8,
Ping = 0x9,
Pong = 0xA,
ResB = 0xB,
ResC ... | src/websocket.zig |
const std = @import("std");
const zwin32 = @import("../zwin32/build.zig");
const ztracy = @import("../ztracy/build.zig");
const zd3d12 = @import("../zd3d12/build.zig");
pub fn getPkg(b: *std.build.Builder, options_pkg: std.build.Pkg) std.build.Pkg {
const pkg = std.build.Pkg{
.name = "common",
.pat... | libs/common/build.zig |
const std = @import("std");
const testing = std.testing;
const meta = std.meta;
const trait = std.meta.trait;
const log = std.log.scoped(.wasmtime_zig);
pub const wasm = @import("wasm");
// Re-exports
pub const ByteVec = wasm.ByteVec;
pub const NameVec = wasm.NameVec;
pub const ValVec = wasm.ValVec;
pub const Value =... | src/main.zig |
const std = @import("std");
const fs = std.fs;
const Allocator = std.mem.Allocator;
const g = @import("spirv/grammar.zig");
const Version = struct {
major: u32,
minor: u32,
fn parse(str: []const u8) !Version {
var it = std.mem.split(str, ".");
const major = it.next() orelse return error.... | tools/update_spirv_features.zig |
const std = @import("std");
const Token = @import("Token.zig");
const Errors = @import("error.zig").Errors;
const Type = @import("Value.zig").Type;
//! All AST Nodes are defined here
//! The `Parser` parses all of the `Lexer`'s tokens into these nodes
/// Tree represents all parsed Nodes
pub const Tree = struct {
... | src/ast.zig |
pub const COMDB_MIN_PORTS_ARBITRATED = @as(u32, 256);
pub const COMDB_MAX_PORTS_ARBITRATED = @as(u32, 4096);
pub const CDB_REPORT_BITS = @as(u32, 0);
pub const CDB_REPORT_BYTES = @as(u32, 1);
//--------------------------------------------------------------------------------
// Section: Types (1)
//--------------------... | win32/devices/serial_communication.zig |
const std = @import("std");
const FarPtr = @import("../far_ptr.zig").FarPtr;
const Segment = @import("segment.zig").Segment;
/// DosMemBlock represents an allocated block of memory that resides below the
/// 1 MiB address in physical memory and is accessible to DOS.
pub const DosMemBlock = struct {
protected_mode_... | src/dos/dpmi/mem.zig |
const std = @import("std");
const Compilation = @import("Compilation.zig");
/// Used to implement the __has_feature macro.
pub fn hasFeature(comp: *Compilation, ext: []const u8) bool {
const list = .{
.assume_nonnull = true,
.attribute_analyzer_noreturn = true,
.attribute_availability = tru... | src/features.zig |
const testing = @import("std").testing;
const builtin = @import("builtin");
// Ported from llvm-project 13.0.0 d7b669b3a30345cfcdb2fde2af6f48aa4b94845d
//
// https://github.com/llvm/llvm-project/blob/llvmorg-13.0.0/compiler-rt/lib/builtins/os_version_check.c
// The compiler generates calls to __isPlatformVersionAtLea... | lib/std/special/compiler_rt/os_version_check.zig |
const std = @import("std");
const testing = std.testing;
const expect = testing.expect;
const mem = std.mem;
var s_array: [8]Sub = undefined;
const Sub = struct { b: u8 };
const Str = struct { a: []Sub };
test "set global var array via slice embedded in struct" {
var s = Str{ .a = s_array[0..] };
s.a[0].b = 1... | test/behavior/array_llvm.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
test "examples" {
const test1 = aoc.readLines(aoc.talloc, aoc.test1file);
defer aoc.talloc.free(test1);
const test2 = aoc.readLines(aoc.talloc, aoc.test2file);
defer aoc.talloc.free(test2);
const inp = aoc.readLines(aoc.talloc, aoc.inp... | 2020/07/aoc.zig |
// DO NOT MODIFY. This is not actually a source file; it is a textual representation of generated code.
// Use only for debugging purposes.
// Auto-generated constructor
// Access: public
Method <init> : V
(
// (no arguments)
) {
ALOAD 0
// Method descriptor: ()V
INVOKESPECIAL java/lang/Object#<init>... | localproxyservice/target/generated-sources/gizmo/io/quarkus/deployment/steps/RestClientProcessor$registerProviders18.zig |
const wlr = @import("wlroots.zig");
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const Backend = extern struct {
const Impl = opaque {};
impl: *const Impl,
events: extern struct {
destroy: wl.Signal(*Backend),
new_input: wl.Signal(*wlr.InputDevice),
new_ou... | src/backend.zig |
const std = @import("std");
const Sha1 = std.crypto.hash.Sha1;
const Allocator = std.mem.Allocator;
const Peer = @import("Peer.zig");
const Torrent = @import("Torrent.zig");
const Client = @import("net/Tcp_client.zig");
const Message = @import("net/message.zig").Message;
/// Max blocks we request at a time
const max_i... | src/worker.zig |
const std = @import("std");
const c = @import("internal/c.zig");
const internal = @import("internal/internal.zig");
const log = std.log.scoped(.git);
const git = @import("git.zig");
/// An action signature (e.g. for committers, taggers, etc)
pub const Signature = extern struct {
/// Use `name`
z_name: [*:0]co... | src/signature.zig |
const tup = @import("util.zig").tuplicate;
pub const DecoderError = error{IllegalOpcode};
pub const RType = struct {
rs2: u5,
rs1: u5,
rd: u5,
pub fn decode(raw: u32) RType {
return .{ .rs2 = @intCast(u5, (raw >> 20) & 0x1f), .rs1 = @intCast(u5, (raw >> 15) & 0x1f), .rd = @intCast(u5, (raw >>... | decoder.zig |
pub fn UserVisit(comptime Node: type, comptime Context: type, comptime IncludeEnter: bool) type {
if (IncludeEnter) {
return fn(Context, Node, enter: bool) void;
} else {
return fn(Context, Node) void;
}
}
fn VisitIface(comptime Node: type) type {
return struct {
visit_fn: fn(*... | stdx/algo/walk_recursive.zig |
const gl = @import("gl");
const graphics = @import("../../graphics.zig");
const gpu = graphics.gpu;
pub const SwapChain = @import("swapchain.zig").SwapChain;
pub const Shader = @import("shader.zig").Shader;
const shaders = @import("shaders.zig");
pub const TexShader = shaders.TexShader;
pub const GradientShader = shade... | graphics/src/backend/gl/graphics.zig |
const std = @import("std");
const os = std.os;
const tests = @import("tests.zig");
// zig fmt: off
pub fn addCases(cases: *tests.StackTracesContext) void {
const source_return =
\\const std = @import("std");
\\
\\pub fn main() !void {
\\ return error.TheSkyIsFalling;
\\}
... | test/stack_traces.zig |
const std = @import("std");
const DynamicArray = @import("./dynamic_array.zig").DynamicArray;
const Value = @import("./value.zig").Value;
const Allocator = std.mem.Allocator;
const expect = std.testing.expect;
pub const OpCode = enum(u8) {
const Self = @This();
op_constant,
op_negate,
op_add,
op... | src/chunk.zig |
const builtin = @import("builtin");
const std = @import("std");
const testing = std.testing;
const expect = testing.expect;
const expectEqual = testing.expectEqual;
test "passing an optional integer as a parameter" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend ... | test/behavior/optional.zig |
const std = @import("std");
const process = std.process;
const mem = std.mem;
const bog = @import("bog.zig");
const repl = bog.repl;
const is_debug = @import("builtin").mode == .Debug;
var state = std.heap.GeneralPurposeAllocator(.{}){};
pub fn main() !void {
const gpa = &state.allocator;
const args = try pr... | src/main.zig |
const std = @import("std");
const Engine = @import("Engine.zig");
const Dependency = @import("Dependency.zig");
const Project = @import("Project.zig");
const utils = @import("utils.zig");
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
pub const name = "local";
pub const Resolutio... | src/local.zig |
const zang = @import("zang");
const common = @import("common.zig");
const c = @import("common/c.zig");
const PhaseModOscillator = @import("modules.zig").PhaseModOscillator;
pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb;
pub const AUDIO_SAMPLE_RATE = 48000;
pub const AUDIO_BUFFER_SIZE = 1024;
pub const DESC... | examples/example_mouse.zig |
const std = @import("std");
const zlm = @import("zlm");
const log = std.log.scoped(.wavefront_obj);
const vec2 = zlm.vec2;
const vec3 = zlm.vec3;
const vec4 = zlm.vec4;
const Vec2 = zlm.Vec2;
const Vec3 = zlm.Vec3;
const Vec4 = zlm.Vec4;
test "" {
std.testing.refAllDecls(@This());
}
// this file parses OBJ wav... | wavefront-obj.zig |
const std = @import("std");
/// Determines the virtual machine memory size.
const memory_size = 32;
/// Represents the kind of the opcode.
const OpcodeKind = enum {
Loadi, // Loadi rx l1
Addi, // Addi rx ra l1
Compare, // Compare rx ra rb
Jump, // Jump l1
Branch, // Branch ra l1
Exit // Exit
}... | src/main.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const ArrayListUnmanaged = std.ArrayListUnmanaged;
const assert = std.debug.assert;
const expect = std.testing.expect;
pub fn PrefixTreeNode(comptime T: type, comptime cmpFn: fn (lhs: T, rhs: T) std.math.Order) type {
... | source/prefix_tree.zig |
const std = @import("std");
const Builder = std.build.Builder;
const builtin = std.builtin;
const assert = std.debug.assert;
const Arch = if (@hasField(builtin, "Arch")) builtin.Arch else std.Target.Cpu.Arch;
// var source_blob: *std.build.RunStep = undefined;
// var source_blob_path: []u8 = undefined;
// fn make_so... | build.zig |
const kern = @import("kern.zig");
// in BPF, all the helper calls
// TODO: when https://github.com/ziglang/zig/issues/1717 is here, make a nice
// function that uses the Helper enum
//
// Note, these function signatures were created from documentation found in
// '/usr/include/linux/bpf.h'
pub const map_lookup_elem = ... | lib/std/os/linux/bpf/helpers.zig |
const sf = struct {
pub usingnamespace @import("../sfml.zig");
pub usingnamespace sf.system;
pub usingnamespace sf.graphics;
};
const RectangleShape = @This();
// Constructor/destructor
/// Creates a rectangle shape with a size. The rectangle will be white
pub fn create(size: sf.Vector2f) !RectangleShap... | src/sfml/graphics/RectangleShape.zig |
const std = @import("std");
pub const clua = @cImport({
@cInclude("lua.h");
// @cInclude("lauxlib.h");
// @cInclude("lualib.h");
});
pub const Lua = struct {
L: *clua.lua_State,
allocator: *std.mem.Allocator,
pub fn init(allocator: std.mem.Allocator) !Lua {
// Even if the Lua struct i... | src/lua.zig |
const std = @import("std");
const ecs = @import("ecs");
const Registry = @import("ecs").Registry;
const Velocity = struct { x: f32, y: f32 };
const Position = struct { x: f32 = 0, y: f32 = 0 };
const Empty = struct {};
const BigOne = struct { pos: Position, vel: Velocity, accel: Velocity };
test "entity traits" {
... | tests/registry_test.zig |
const std = @import("std");
const stdx = @import("stdx");
const t = stdx.testing;
const log = stdx.log.scoped(.meta);
pub fn assertPointerType(comptime T: type) void {
if (@typeInfo(T) != .Pointer) {
@compileError("Expected Pointer type.");
}
}
pub fn assertFunctionType(comptime T: type) void {
if... | stdx/meta.zig |
const std = @import("std");
const ChildProcess = std.ChildProcess;
const builtin = std.builtin;
const builtins = @import("builtins.zig");
const Parser = @import("parser.zig").Parser();
pub var env_map: std.BufMap = undefined;
pub var lastexitcode: u32 = 0;
pub fn init(ally: *std.mem.Allocator) !void {
env_map =... | src/main.zig |
const std = @import("std");
const tuple = @import("tuple.zig");
const debug = std.debug;
const fmt = std.fmt;
const math = std.math;
const mem = std.mem;
const testing = std.testing;
pub const Tuple = tuple.Tuple;
/// The result of a successful parse
pub fn Result(comptime T: type) type {
return struct {
... | mecha.zig |
const std = @import("std");
const codes = @import("./codes.zig");
const color = @import("./Color.zig");
const Color = color.Color;
pub inline fn printResetGraphics(writer: anytype) !void {
try writer.print("{s}", .{codes.resetEscapeSequence()});
}
pub inline fn printResetForeground(writer: anytype) !void {
t... | src/io.zig |
const std = @import("std");
const mem = std.mem;
const TitleMap = @This();
allocator: *mem.Allocator,
map: std.AutoHashMap(u21, u21),
pub fn init(allocator: *mem.Allocator) !TitleMap {
var instance = TitleMap{
.allocator = allocator,
.map = std.AutoHashMap(u21, u21).init(allocator),
};
t... | src/components/autogen/UnicodeData/TitleMap.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = mem.Allocator;
const json = @import("json");
// fn parseHexFormatColorRgb(str: []const u8) ![3]u8 {
// const r = try std.fmt.parseInt(u8, str[0..2], 16);
// const g = try std.fmt.parseInt(u8, str[2..4], 16);
// const b = try std.fmt.parseI... | src/tiled.zig |
const builtin = @import("builtin");
const std = @import("std");
const input = @import("input.zig");
pub fn run(allocator: std.mem.Allocator, stdout: anytype) anyerror!void {
{
var input_ = try input.readFile("inputs/day22");
defer input_.deinit();
const result = try part1(allocator, &inpu... | src/day22.zig |
const std = @import("std");
const Allocator = mem.Allocator;
const ascii = std.ascii;
const build_options = @import("build_options");
const builtin = std.builtin;
const fs = std.fs;
const io = std.io;
const mem = std.mem;
const nkeys = @import("nkeys");
const process = std.process;
const testing = std.testing;
pub fn ... | tool/znk.zig |
const std = @import("std");
const panic = std.debug.panic;
const Allocator = std.mem.Allocator;
//Core types
usingnamespace @import("zalgebra");
usingnamespace @import("camera.zig");
usingnamespace @import("transform.zig");
usingnamespace @import("chunk/chunk.zig");
usingnamespace @import("world/world.zig");
usingnam... | src/main.zig |
const std = @import("std");
const word_string = @embedFile("5lw.txt");
const word_count = word_string.len / 6;
var buffer = [_]u8{0} ** 100;
const csi = "\x1b[";
const ansi_red = csi ++ "31;1m";
const ansi_green = csi ++ "32;1m";
const ansi_yellow = csi ++ "33;1m";
const ansi_reset = csi ++ "0m";
fn isWord(string: ... | src/main.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = false;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
const assert = std.debug.assert;
pub const main = tools.defaultMain("2021/day22.txt", run);
const Vec3 = @Vector(3, i32);
co... | 2021/day22.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);
}
pub fn main() anyerror!void {
const stdout = std.io.getStdOut().writer();
var arena... | 2016/day11.zig |
const wlr = @import("../wlroots.zig");
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const Renderer = extern struct {
const Impl = opaque {};
impl: *const Impl,
rendering: bool,
rendering_with_buffer: bool,
events: extern struct {
destroy: wl.Signal(*Renderer),
... | src/render/renderer.zig |
const std = @import("std");
const Answer = struct { @"0": u32, @"1": u32 };
const Range = struct { lo: i32, hi: i32 };
const Target = struct { x: Range, y: Range };
fn in_range(x: i32, range: Range) bool {
return range.lo <= x and x <= range.hi;
}
fn in_target(y: i32, x: i32, target: Target) bool {
return in... | src/day17.zig |
const std = @import("std");
const assert = std.debug.assert;
const math = std.math;
const epsilon: f32 = 0.00001;
pub fn modAngle(in_angle: f32) f32 {
const angle = in_angle + math.pi;
var temp: f32 = math.fabs(angle);
temp = temp - (2.0 * math.pi * @intToFloat(f32, @floatToInt(i32, temp / math.pi)));
... | libs/common/src/vectormath.zig |
const struct__iobuf = extern struct {
_ptr: [*c]u8,
_cnt: c_int,
_base: [*c]u8,
_flag: c_int,
_file: c_int,
_charbuf: c_int,
_bufsiz: c_int,
_tmpfname: [*c]u8,
};
const FILE = struct__iobuf;
pub const stbi_uc = u8;
pub const stbi_us = c_ushort;
pub const stbi_io_callbacks = extern struct... | src/pkg/stb_image.zig |
const std = @import("std");
const zua = @import("zua");
const parse = zua.parse;
// Prunes the input/output pairs used by fuzzed_parse to exclude inputs
// that cause a lexer error (as opposed to a parser error), since those
// pairs will just be overlap with the fuzzed_lex corpus.
//
// Expects @import("build_options... | test/fuzzed_parse_prune.zig |
const std = @import("std");
const utils = @import("utils.zig");
const dif = @import("dif.zig");
const ial = @import("indexedarraylist.zig");
const testing = std.testing;
const any = utils.any;
const DifNode = dif.DifNode;
const debug = std.debug.print;
const DifNodeMap = std.StringHashMap(ial.Entry(DifNode));
const S... | libdaya/src/sema.zig |
const zang = @import("zang");
const common = @import("common.zig");
const c = @import("common/c.zig");
const Instrument = @import("modules.zig").NiceInstrument;
pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb;
pub const AUDIO_SAMPLE_RATE = 48000;
pub const AUDIO_BUFFER_SIZE = 1024;
pub const DESCRIPTION =
... | examples/example_polyphony.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
pub const PageAlign = 4096;
pub const Page = struct {
pmem: *align(PageAlign) [4096]u8,
vaddr: u32,
flags: u32,
const Self = @This();
pub fn map(self: *const Self, allocator: *Allocator) !void {
var pt = try getPageTable(all... | src/utils/paging.zig |
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
const... | build.zig |
const clap = @import("clap");
const format = @import("format");
const it = @import("ziter");
const std = @import("std");
const ston = @import("ston");
const util = @import("util");
const ascii = std.ascii;
const debug = std.debug;
const fmt = std.fmt;
const fs = std.fs;
const heap = std.heap;
const io = std.io;
const ... | src/randomizers/tm35-rand-trainers.zig |
const std = @import("std");
pub fn enumFieldNames(comptime e: type) [@typeInfo(e).Enum.fields.len][]const u8 {
const len = @typeInfo(e).Enum.fields.len;
var names: [len][]const u8 = undefined;
inline for (@typeInfo(e).Enum.fields) |f, i| {
names[i] = f.name;
}
return names;
}
test "util.en... | src/util.zig |
const std = @import("std");
const c = @cImport({
@cInclude("uv.h");
});
const util = @import("util.zig");
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const alloc = &gpa.allocator;
var stdin_pipe: c.uv_pipe_t = undefined;
var stdout_pipe: c.uv_pipe_t = undefined;
var file_pipe: c.uv_pipe_t = undefined;
//... | src/uv_examples/uvtee.zig |
const std = @import("std");
const Version = std.builtin.Version;
const mem = std.mem;
const log = std.log;
const fs = std.fs;
const fmt = std.fmt;
const assert = std.debug.assert;
pub fn main() !void {
var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena_instance.deinit();
... | list_symbols.zig |
const std = @import("std");
pub const FFT = struct {
const Self = @This();
allocator: *std.mem.Allocator,
length: usize,
sin: []f32,
pub fn init(allocator: *std.mem.Allocator, max_length: usize) !Self {
const sin_table_size = max_length - (max_length / 4) + 1;
var sin = try alloca... | src/dsp/fft.zig |
const upaya = @import("upaya");
const Texture = upaya.Texture;
const std = @import("std");
const allocator = std.heap.page_allocator;
var path2tex = std.StringHashMap(*upaya.Texture).init(allocator);
// TODO: I am not sure anymore whether it is OK to have this cache alive across
// multiple load / save cycles
... | src/texturecache.zig |
const std = @import("std.zig");
const cstr = std.cstr;
const unicode = std.unicode;
const io = std.io;
const fs = std.fs;
const os = std.os;
const process = std.process;
const File = std.fs.File;
const windows = os.windows;
const mem = std.mem;
const debug = std.debug;
const BufMap = std.BufMap;
const Buffer = std.Buff... | lib/std/child_process.zig |
const root = @import("build.zig");
const std = @import("std");
const io = std.io;
const fmt = std.fmt;
const Builder = std.build.Builder;
const Pkg = std.build.Pkg;
const InstallArtifactStep = std.build.InstallArtifactStep;
const LibExeObjStep = std.build.LibExeObjStep;
const ArrayList = std.ArrayList;
///! This is a ... | src/special/build_runner.zig |
const std = @import("std.zig");
const builtin = std.builtin;
const root = @import("root");
//! std.log is a standardized interface for logging which allows for the logging
//! of programs and libraries using this interface to be formatted and filtered
//! by the implementer of the root.log function.
//!
//! Each log m... | lib/std/log.zig |
const std = @import("std");
const builtin = @import("builtin");
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 Ast = std.zig.Ast;
const Zir = @This();
const Type = @import("typ... | src/Zir.zig |