code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const mem = std.mem;
const OpenPunctuation = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 40,
hi: u21 = 65378,
pub fn init(allocator: *mem.Allocator) !OpenPunctuation {
var instance = OpenPunctuation{
.allocator = allocator,
.array = try allocator.allo... | src/components/autogen/DerivedGeneralCategory/OpenPunctuation.zig |
const std = @import("std");
const mem = std.mem;
const OtherMath = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 94,
hi: u21 = 126651,
pub fn init(allocator: *mem.Allocator) !OtherMath {
var instance = OtherMath{
.allocator = allocator,
.array = try allocator.alloc(bool, 126558),
... | src/components/autogen/PropList/OtherMath.zig |
const std = @import("std");
const pkgs = @import("deps.zig").pkgs;
const mem = std.mem;
fn detectWasmerLibDir(b: *std.build.Builder) ?[]const u8 {
const argv = &[_][]const u8{ "wasmer", "config", "--libdir" };
const result = std.ChildProcess.exec(.{
.allocator = b.allocator,
.argv = argv,
}... | build.zig |
const xcb = @import("../xcb.zig");
pub const id = xcb.Extension{ .name = "DRI2", .global_id = 0 };
pub const Attachment = extern enum(c_uint) {
@"BufferFrontLeft" = 0,
@"BufferBackLeft" = 1,
@"BufferFrontRight" = 2,
@"BufferBackRight" = 3,
@"BufferDepth" = 4,
@"BufferStencil" = 5,
@"Buffe... | src/auto/dri2.zig |
const std = @import("std");
const builtin = @import("builtin");
const version = @import("version");
const uri = @import("uri");
const assert = std.debug.assert;
pub const Size = struct {
rows: usize,
cols: usize,
};
pub const Source = union(enum) {
const Git = struct {
url: []const u8,
co... | src/Display.zig |
const uefi = @import("std").os.uefi;
const elf = @import("std").elf;
const console = @import("./console.zig");
const bootstrap = @import("./uefi_bootstrap.zig");
// Docs: https://github.com/ziglang/zig/blob/master/lib/std/elf.zig
// https://github.com/ziglang/zig/blob/master/lib/std/os/uefi/protocols/file_protocol.zig... | bootstrap/loader.zig |
const std = @import("std");
const fs = std.fs;
const Builder = std.build.Builder;
pub const Example = struct {
description: ?[]const u8,
output: []const u8,
input: []const u8,
pub fn new(output: []const u8, input: []const u8, desc: ?[]const u8) Example {
return Example{
.descriptio... | build.zig |
//--------------------------------------------------------------------------------
// Section: Types (0)
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// Section: Functions (23)
//------------------... | deps/zigwin32/win32/system/environment.zig |
const c = @import("c.zig");
const nk = @import("../nuklear.zig");
const std = @import("std");
const testing = std.testing;
pub fn line(b: *nk.CommandBuffer, x0: f32, y0: f32, x1: f32, y1: f32, line_thickness: f32, col: nk.Color) void {
return c.nk_stroke_line(b, x0, y0, x1, y1, line_thickness, col);
}
pub fn cur... | src/stroke.zig |
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const Decomp = @import("DecompFile.zig").Decomp;
const Self = @This();
const Node = struct {
value: ?Decomp = null,
children: [256]?*Node = [_]?*Node{null} ** 256,
fn deinit(self: *Node, allocator: mem.Allocator) void {
... | src/normalizer/Trieton.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;
const vertex_shader =
\\#version 330 core
\\layout (location = 0) in vec2 aPos;
\\layout (location = 1) in vec2 aTexCo... | examples/custombatch.zig |
pub const struct_ZigClangAPValue = @OpaqueType();
pub const struct_ZigClangAPSInt = @OpaqueType();
pub const struct_ZigClangASTContext = @OpaqueType();
pub const struct_ZigClangASTUnit = @OpaqueType();
pub const struct_ZigClangArraySubscriptExpr = @OpaqueType();
pub const struct_ZigClangArrayType = @OpaqueType();
pub c... | src-self-hosted/clang.zig |
pub const SUCCESS = 0x00000000;
pub const WAIT_0 = 0x00000000;
pub const WAIT_1 = 0x00000001;
pub const WAIT_2 = 0x00000002;
pub const WAIT_3 = 0x00000003;
pub const WAIT_63 = 0x0000003F;
pub const ABANDONED = 0x00000080;
pub const ABANDONED_WAIT_0 = 0x00000080;
pub const ABANDONED_WAIT_63 = 0x000000BF;
pub const USER... | lib/std/os/windows/status.zig |
const aoc = @import("../aoc.zig");
const std = @import("std");
const LightMap = struct {
const Conway = aoc.Conway(aoc.Coord);
const bounds = aoc.CoordRange.initWithBounds(aoc.Coord.init(.{0, 0}), aoc.Coord.init(.{99, 99}));
conway: Conway,
fn init(allocator: std.mem.Allocator) LightMap {
ret... | src/main/zig/2015/day18.zig |
//
// AUTO GENERATED! DO NOT EDIT!
//
const std = @import("std");
pub const ViewId = u16;
pub const StateFlags = u64;
/// Enable R write.
pub const StateFlags_WriteR: StateFlags = 0x0000000000000001;
/// Enable G write.
pub const StateFlags_WriteG: StateFlags = 0x0000000000000002;... | bindings/zig/bgfx.zig |
const std = @import("std");
const assert = std.debug.assert;
const print = std.debug.print;
const tools = @import("tools");
const Vec4 = [4]i8;
fn dist(a: Vec4, b: Vec4) u32 {
var d: u32 = 0;
for (a) |_, i| {
d += @intCast(u32, std.math.absInt(@as(i31, a[i]) - b[i]) catch unreachable);
}
return... | 2018/day25.zig |
const std = @import("std");
pub const Client = struct {
file: ?std.fs.File = null,
allocator: *std.mem.Allocator,
host: []u8,
pub fn init(allocator: *std.mem.Allocator, host: []const u8, port: u16) !Client {
const result = Client{
.file = try std.net.tcpConnectToHost(allocator, hos... | src/http_client.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... | src/registers.zig |
/// mandelbrot.zig
/// Module to calculate Mandelbrot sets in Zig
///
const std = @import("std");
const C32 = std.math.complex.Complex(f32);
const image = @import("./image.zig");
/// maximum pixel value
const n_max = 255;
/// RGB values for a single pixel
const RGB24 = image.RGB(u8);
const ImageRGB24 = image.Image(i... | Zig/benchmark/src/mandelbrot.zig |
const builtin = @import("builtin");
const TypeInfo = builtin.TypeInfo;
const TypeId = builtin.TypeId;
const ErrorSet = builtin.TypeId.ErrorSet;
const AtomicOrder = builtin.AtomicOrder;
const AtomicRmwOp = builtin.AtomicRmwOp;
const std = @import("std");
const Allocator = mem.Allocator;
const ArrayList = std.ArrayList... | benchmark.zig |
const std = @import("std");
const assert = std.debug.assert;
const mem = std.mem;
const ArrayList = std.ArrayList;
const json = std.json;
const utf8 = @import("../unicode/unicode.zig");
const log = @import("log.zig");
const Token = @import("token.zig").Token;
const TokenRule = @import("token.zig").TokenRule;
const Tok... | src/md/lexer.zig |
const builtin = @import("builtin");
const std = @import("std");
const os = @import("windows.zig");
const HRESULT = os.HRESULT;
pub const FACTORY_TYPE = extern enum {
SHARED = 0,
ISOLATED = 1,
};
pub const FONT_WEIGHT = extern enum {
THIN = 100,
EXTRA_LIGHT = 200,
LIGHT = 300,
SEMI_LIGHT = 350,... | src/windows/dwrite.zig |
const imgui = @import("../../c.zig");
pub const struct_ImNodesEditorContext = opaque {};
pub const ImNodesEditorContext = struct_ImNodesEditorContext;
pub const struct_ImNodesContext = opaque {};
pub const ImNodesContext = struct_ImNodesContext;
pub const ImNodesStyleFlags = c_int;
pub const struct_ImNodesStyle = exter... | src/deps/imgui/ext/imnodes/c.zig |
const std = @import("std");
const testing = std.testing;
const c_allocator = std.heap.c_allocator;
const parse = @import("Parse.zig");
const Files = @import("Files.zig");
const atoi = @import("Atoi.zig").atoi;
const ArrayList = std.ArrayList;
pub const Config = struct {
threads: u32 = 0, // 0 = auto
enable_sta... | src/Config.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 std = @import("std");
const Compiler = @import("Compiler.zig");
const Context = @import("Context.zig");
const Lexer = @import("Lexer.zig");
const Node = @import("Node.zig");
const Parser = @import("Parser.zig");
const Scope = @import("Scope.zig");
const ScopeStack = @import("ScopeStack.zig");
const value = @impo... | src/main.zig |
const std = @import("std");
const builtin = @import("builtin");
pub const pkg = std.build.Pkg{
.name = "uv",
.source = .{ .path = srcPath() ++ "/uv.zig" },
};
pub const Options = struct {
lib_path: ?[]const u8 = null,
};
pub fn addPackage(step: *std.build.LibExeObjStep) void {
step.addPackage(pkg);
... | lib/uv/lib.zig |
const std = @import("std");
const Container_Impl = @import("containers.zig").Container_Impl;
const lasting_allocator = @import("internal.zig").lasting_allocator;
const milliTimestamp = @import("internal.zig").milliTimestamp;
/// Linear interpolation between a and b with factor t.
fn lerp(a: anytype, b: @TypeOf(a), t: ... | src/data.zig |
const builtin = @import("builtin");
const std = @import("std.zig");
const io = std.io;
const mem = std.mem;
const os = std.os;
const File = std.fs.File;
const ArrayList = std.ArrayList;
// CoffHeader.machine values
// see https://msdn.microsoft.com/en-us/library/windows/desktop/ms680313(v=vs.85).aspx
const IMAGE_FILE... | lib/std/coff.zig |
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
const default_seed: u32 = 0xc70f6907;
pub const Murmur2_32 = struct {
const Self = @This();
pub fn hash(str: []const u8) u32 {
return @call(.{ .modifier = .always_inline }, Self.hashWithSeed, .{ str, default_... | lib/std/hash/murmur.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const fmt = std.fmt;
const util = @import("utils.zig");
const input = @embedFile("../in/day02.txt");
fn part1() void {
var eligible_passwords: usize = 0;
var it = In... | src/day02.zig |
const std = @import("std");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
/// Returns the optimal static bit set type for the specified number
/// of elements. The returned type will perform no allocations,
/// can be copied by value, and does not require deinitialization.
/// Both possible i... | lib/std/bit_set.zig |
const std = @import("std");
const c = @import("c.zig");
const intToError = @import("error.zig").intToError;
const Error = @import("error.zig").Error;
const Stroker = @import("Stroker.zig");
const Library = @import("freetype.zig").Library;
const RenderMode = @import("freetype.zig").RenderMode;
const SizeMetrics = @impor... | freetype/src/freetype/Glyph.zig |
const std = @import("std");
const SDL = @import("sdl2");
const target_os = @import("builtin").os;
pub fn main() !void {
try SDL.init(.{
.video = true,
.events = true,
.audio = true,
});
defer SDL.quit();
var window = try SDL.createWindow(
"SDL.zig Basic Demo",
.... | examples/wrapper.zig |
const std = @import("std");
const ELF = @import("../elf.zig");
const phdr = @import("../data-structures/phdr.zig");
const shdr = @import("../data-structures/shdr.zig");
const ehdr = @import("../data-structures/ehdr.zig");
const sym_n_rela = @import("../data-structures/sym-n-rela.zig");
pub fn getSyms(
a: ELF.ELF,
... | src/functions/sym-n-rela.zig |
usingnamespace @import("raylib");
pub fn main() anyerror!void
{
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
const screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - models loa... | examples/models/models_loading.zig |
const std = @import("std");
pub fn ComptimeTable(comptime K: type, comptime V: type, comptime eq: fn (K, K) bool) type {
return struct {
pub fn set(comptime self: *@This(), comptime key: K, comptime value: V) void {
if (self.lookupNode(key)) |node| {
node.value = value;
... | comptime_table.zig |
const utils = @import("utils");
const kernel = @import("root").kernel;
const print = kernel.print;
const pmemory = @import("memory.zig");
const util = @import("util.zig");
const interrupts = @import("interrupts.zig");
const segments = @import("segments.zig");
const timing = @import("timing.zig");
const pci = @import... | kernel/platform/acpi.zig |
const std = @import("std");
const objects = @import("objects.zig");
const Environment = @import("Environment.zig");
pub const TypeId = enum(u8) {
void = 0,
number = 1,
object = 2,
boolean = 3,
string = 4,
array = 5,
enumerator = 6,
};
/// A struct that represents any possible LoLa value.
... | src/library/runtime/value.zig |
const std = @import("std");
pub const Tag = enum {
add_with_overflow,
align_cast,
align_of,
as,
async_call,
atomic_load,
atomic_rmw,
atomic_store,
bit_cast,
bit_offset_of,
bool_to_int,
bit_size_of,
breakpoint,
mul_add,
byte_swap,
bit_reverse,
offset_o... | src/BuiltinFn.zig |
const std = @import("std");
const ZqlError = error {
StatementNotFound,
StatementIncorrectSyntax,
CommandError,
TableFull,
StatementParamTooLong,
StatementErrorNegativeValue,
};
const COLUMN_USERNAME_SIZE = 32;
const COLUMN_EMAIL_SIZE = 255;
const StatementType = enum {
INSERT,
SELECT... | src/main.zig |
const __fixdfsi = @import("fixdfsi.zig").__fixdfsi;
const std = @import("std");
const math = std.math;
const testing = std.testing;
const warn = std.debug.warn;
fn test__fixdfsi(a: f64, expected: i32) void {
const x = __fixdfsi(a);
//warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", .{a, @bitCast(u64, ... | lib/std/special/compiler_rt/fixdfsi_test.zig |
const __mulodi4 = @import("mulodi4.zig").__mulodi4;
const testing = @import("std").testing;
fn test__mulodi4(a: i64, b: i64, expected: i64, expected_overflow: c_int) !void {
var overflow: c_int = undefined;
const x = __mulodi4(a, b, &overflow);
try testing.expect(overflow == expected_overflow and (expected... | lib/std/special/compiler_rt/mulodi4_test.zig |
const std = @import("std");
const service_list = @import("models/service_manifest.zig");
const expectEqualStrings = std.testing.expectEqualStrings;
pub fn Services(service_imports: anytype) type {
if (service_imports.len == 0) return services;
// From here, the fields of our structure can be generated at compt... | src/servicemodel.zig |
const builtin = @import("builtin");
const std = @import("std");
const Arch = std.Target.Cpu.Arch;
const CrossTarget = std.zig.CrossTarget;
const CpuFeature = std.Target.Cpu.Feature;
pub fn build(kernel: *std.build.LibExeObjStep) void {
const builder = kernel.builder;
var kernel_tls = builder.step("kernel", "Bu... | kernel/arch/x86/build.zig |
const std = @import("std");
const Inon = @import("main.zig");
const Data = @import("Data.zig");
const Lib = struct {
fn add(inon: *Inon, params: []Data) !Data {
_ = inon;
const data1 = params[0];
const data2 = params[1];
return Data{ .value = .{ .num = data1.get(.num) + data2.get(.n... | src/Stdlib.zig |
const std = @import("std");
const print = std.debug.print;
const data = @embedFile("../data/day01.txt");
fn is_int(c : u8) bool {
return switch (c) {
'0' => true,
'1' => true,
'2' => true,
'3' => true,
'4' => true,
'5' => true,
'6' => true,
'7' => true,
'8' => t... | src/day01.zig |
const std = @import("std");
const math = std.math;
const testing = std.testing;
const print = std.debug.print;
const root = @import("main.zig");
const vec4 = @import("vec4.zig");
const vec3 = @import("vec3.zig");
const quat = @import("quaternion.zig");
const Vec3 = vec3.Vec3;
const Vector3 = vec3.Vector3;
const Vector... | zalgebra/src/mat4.zig |
const std = @import("std");
const mem = std.mem;
const math = std.math;
const ArrayList = std.ArrayList;
const Module = @import("module.zig").Module;
const ValueType = @import("module.zig").ValueType;
const Instance = @import("instance.zig").Instance;
const WasmError = @import("function.zig").WasmError;
const instructi... | src/interpreter.zig |
const std = @import("std");
const builtin = @import("builtin");
const liu = @import("liu");
const assets = @import("assets").kilordle;
const Spec = assets.Spec;
const wasm = liu.wasm;
pub const WasmCommand = void;
pub usingnamespace wasm;
const ArrayList = std.ArrayList;
const ext = struct {
extern fn setPuzzle... | src/routes/kilordle/kilordle.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
const Menu = struct {
const Result = struct { all: []const u8, ing: []const u8 };
allergens: std.StringHashMap(std.AutoHashMap(usize, bool)),
ingredients: std.StringHashMap(std.AutoHashMap(usize, bool)),
possible: std.StringHashMap(std.St... | 2020/21/aoc.zig |
const zang = @import("zang");
const note_frequencies = @import("zang-12tet");
const common = @import("common.zig");
const c = @import("common/c.zig");
pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb;
pub const AUDIO_SAMPLE_RATE = 48000;
pub const AUDIO_BUFFER_SIZE = 1024;
pub const DESCRIPTION =
\\exampl... | examples/example_vibrato.zig |
const std = @import("std");
const testing = std.testing;
const stdout = std.io.getStdOut().writer();
const stderr = std.io.getStdErr().writer();
const C = @cImport({
@cInclude("vbyte.h");
});
/// vbyte compress u32 or u64 data. if sorted, use `initial_value` for delta
/// compression. `inital_value` is only used ... | src/main.zig |
const std = @import("std");
const testing = std.testing;
const allocator = std.testing.allocator;
pub const Report = struct {
const Line = struct {
const MAX_SIZE = 16;
bits: [MAX_SIZE]usize,
alive: bool,
pub fn init() Line {
var self = Line{
.bits = [... | 2021/p03/report.zig |
const wlr = @import("../wlroots.zig");
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const Presentation = extern struct {
global: *wl.Global,
// TODO: use std.os.clockid_t when available.
clock: c_int,
events: extern struct {
destroy: wl.Signal(*wlr.Presentation),
... | src/types/presentation_time.zig |
const std = @import("std");
extern "kernel32" fn LoadLibraryA(name: [*c]const u8) callconv(.Stdcall) ?*c_void;
extern "kernel32" fn GetProcAddress(mod: ?*c_void, nax: [*c]const u8) callconv(.Stdcall) ?*c_void;
extern "kernel32" fn GetModuleFileNameA(mod: ?*c_void, name: [*c]u8, len: c_int) callconv(.Stdcall) c_int;
ex... | src/moonboot_dll.zig |
usingnamespace @import("root").preamble;
const log = lib.output.log.scoped(.{
.prefix = "VirtioGpu",
.filter = .info,
}).write;
const virtio_pci = os.drivers.misc.virtio_pci;
fn physalloc(comptime T: type) struct { ptr: *T, phys: usize } {
const phys = os.memory.pmm.allocPhys(@sizeOf(T)) catch unreachabl... | subprojects/flork/src/drivers/gpu/virtio.zig |
const builtin = @import("builtin");
const std = @import("std");
const mem = std.mem;
const sort = std.sort.sort;
const comptimeutils = @import("comptimeutils.zig");
const setField = comptimeutils.setField;
const append = comptimeutils.append;
const empty = comptimeutils.empty;
const map = comptimeutils.map;
const ma... | druzhba/druzhba.zig |
pub const struct_WrenVM = opaque {};
pub const WrenVM = struct_WrenVM;
pub const struct_WrenHandle = opaque {};
pub const WrenHandle = struct_WrenHandle;
pub const WrenReallocateFn = ?fn (?*c_void, usize, ?*c_void) callconv(.C) ?*c_void;
pub const WrenForeignMethodFn = ?fn (?*WrenVM) callconv(.C) void;
pub const WrenFi... | src/c.zig |
const std = @import("std");
const Context = @import("client.zig").Context;
const Object = @import("client.zig").Object;
// wl_display
pub const wl_display_interface = struct {
// core global object
sync: ?fn (*Context, Object, u32) anyerror!void,
get_registry: ?fn (*Context, Object, u32) anyerror!void,
};
... | src/protocols.zig |
const aoc = @import("../aoc.zig");
const std = @import("std");
const ArenaAllocator = std.heap.ArenaAllocator;
const RawRules = struct {
const Rule = union(enum) {
Literal: []const u8,
Goto: [][][]const u8,
};
const RuleMap = std.StringHashMap(Rule);
arena: ArenaAllocator = undefined,... | src/main/zig/2020/day19.zig |
const std = @import("std");
const math = std.math;
const assert = std.debug.assert;
const warn = std.debug.warn;
const Allocator = std.mem.Allocator;
const io = std.io;
const mem = std.mem;
pub const max_num_lit = 286;
pub const max_bits_limit = 16;
const max_i32 = math.maxInt(i32);
const log_window_size: usize = 15... | src/flate.zig |
nodes: std.MultiArrayList(Node).Slice,
// @TODO: Would it be reasonable to change the alignment of elements?
elements: []const Element,
const std = @import("std");
const Allocator = std.mem.Allocator;
const super = @import("!mod.zig");
const Cst = @This();
pub fn deinit(self: *Cst, allocator: Allocator) void {
... | fexc/src/parse/Cst.zig |
const xcb_connection_t = opaque {};
const xcb_window_t = opaque {};
const xcb_colormap_t = opaque {};
const xcb_visualid_t = opaque {};
pub const Defines = struct {
pub const CopyFromParent = 0;
pub const Atom = enum(u32) {
String = 31,
WmName = 39,
};
pub const Config = enum(u32) {
... | src/xcb/bindings.zig |
const std = @import("std");
const string = []const u8;
const range = @import("range").range;
const input = @embedFile("../input/day14.txt");
const Rule = struct {
left: string,
right: u8,
};
const CountMap = std.AutoHashMap(u8, u64);
const MemoMap = std.AutoHashMap([2]u8, []?CountMap);
pub fn main() !void ... | src/day14.zig |
// https://news.ycombinator.com/item?id=12334270
const std = @import("std");
const print = std.debug.print;
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
var allocator = &arena.allocator;
// Tree construction ===========================================================
const NodeTag = enum {
... | src/main.zig |
const std = @import("std");
const debug = std.debug;
const mem = std.mem;
const fmt = std.fmt;
const log = std.log;
const testing = std.testing;
const Allocator = mem.Allocator;
const StringHashMap = std.StringHashMap;
const ArrayList = std.ArrayList;
const ComptimeStringMap = std.ComptimeStringMap;
const intcode = @i... | day25/src/solve.zig |
const std = @import("std");
const testing = std.testing;
const mem = std.mem;
const Allocator = mem.Allocator;
pub const Semver = struct {
major: u64,
minor: u64,
patch: u64,
pub fn parse(str: []const u8) !Semver {
var it = std.mem.tokenize(u8, str, ".");
const semver = Semver{
... | .gyro/version-mattnite-github.com-19baf08f/pkg/src/main.zig |
const std = @import("std");
const mem = std.mem;
const server = &@import("../main.zig").server;
const util = @import("../util.zig");
const c = @import("../c.zig");
const Error = @import("../command.zig").Error;
const Seat = @import("../Seat.zig");
const InputConfig = @import("../InputConfig.zig");
const InputManager... | source/river-0.1.0/river/command/input.zig |
const x86_64 = @import("../../../index.zig");
const bitjuggle = @import("bitjuggle");
const std = @import("std");
const paging = x86_64.structures.paging;
const mapping = paging.mapping;
const Mapper = mapping.Mapper;
const physToVirt = struct {
pub fn physToVirt(offset: x86_64.VirtAddr, phys_frame: paging.PhysFr... | src/structures/paging/mapping/mapped_page_table.zig |
const std = @import("std");
usingnamespace @import("zalgebra");
usingnamespace @import("utils.zig");
usingnamespace @import("shader.zig");
usingnamespace @import("../glfw_gl3.zig");
const stb = @import("c.zig").stb;
usingnamespace @import("c.zig").gl;
const mem = std.mem;
const Allocator = mem.Allocator;
const json ... | demo/common/font.zig |
const std = @import("std");
const Fundude = @import("main.zig");
const Savestate = @This();
data: [size]u8,
pub fn dumpFrom(self: *Savestate, fd: Fundude) void {
var stream = std.io.fixedBufferStream(&self.data);
dump(fd, stream.writer()) catch unreachable;
}
pub fn restoreInto(self: Savestate, fd: *Fundud... | src/Savestate.zig |
const std = @import("std");
const rl = @import("raylib");
const math = @import("utils/math.zig");
const GameSimulation = @import("GameSimulation.zig");
pub fn GameLoop() void
{
// The ArenaAllocator lets use free all the persistent store memory at once.
var ArenaAllocator = std.heap.ArenaAllocator.init(std.hea... | src/Game.zig |
const std = @import("std");
const fs = std.fs;
const prot = @import("protocols.zig");
const epoll = @import("epoll");
const connections = @import("connection.zig");
const Connection = @import("connection.zig").Connection;
const Context = @import("connection.zig").Context;
const Object = @import("connection.zig").Object... | src/foxwhalectl/main.zig |
const std = @import("std");
const bpf = @import("bpf");
const mem = std.mem;
usingnamespace @import("common.zig");
const os = std.os;
const assert = std.debug.assert;
const c = @cImport({
@cInclude("net/if.h");
});
// tell the compiler to include the multithreaded event loop
pub const io_mode = .evented;
// em... | src/main.zig |
const std = @import("std");
const alka = @import("alka");
usingnamespace alka.math;
usingnamespace alka.log;
const mlog = std.log.scoped(.app);
const ecs = alka.ecs;
const game = @import("game.zig");
const maxent = 1024;
pub const PlayerController = struct {
left: *const alka.input.State = undefined,
righ... | examples/example_shooter_game/src/ecs.zig |
// /*! @brief
// *
// * @sa @ref init_allocator
// * @sa @ref glfwInitAllocator
// *
// * @since Added in version 3.4.
// *
// * @ingroup init
// */
// typedef struct GLFWallocator
// {
// GLFWallocatefun allocate;
// GLFWreallocatefun reallocate;
// GLFWdeallocatefun deallocate;
// void* u... | glfw/src/allocator.zig |
const std = @import("index.zig");
const io = std.io;
const DefaultPrng = std.rand.DefaultPrng;
const assert = std.debug.assert;
const mem = std.mem;
const os = std.os;
const builtin = @import("builtin");
test "write a file, read it, then delete it" {
var raw_bytes: [200 * 1024]u8 = undefined;
var allocator = &... | std/io_test.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const expect = std.testing.expect;
/// Many producer, many consumer, non-allocating, thread-safe.
/// Uses a mutex to protect access.
pub fn Queue(comptime T: type) type {
return struct {
head: ?*Node,
... | lib/std/atomic/queue.zig |
const zig_std = @import("std");
const Allocator = zig_std.mem.Allocator;
const tokenizer = @import("tokenizer.zig");
pub const Token = tokenizer.Token;
pub const Tokenizer = tokenizer.Tokenizer;
pub const tokenize = tokenizer.tokenize;
const parser = @import("parser.zig");
pub const Parser = parser.Parser;
pub const ... | src/bog.zig |
const std = @import("std");
const gpa = std.heap.c_allocator;
const u = @import("./util/index.zig");
//
//
pub const CollectOptions = struct {
log: bool,
update: bool,
};
pub fn collect_deps_deep(dir: []const u8, mpath: []const u8, options: CollectOptions) !u.Module {
const m = try u.ModFile.init(gpa, m... | src/common.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const odbc = @import("odbc");
const db_connection = @import("connection.zig");
const DBConnection = db_connection.DBConnection;
const ConnectionInfo = db_connection.ConnectionInfo;
const Row = @import("result_set.zig").Row;
const OdbcTestType = struct... | src/main.zig |
const std = @import("std");
const assert = std.debug.assert;
const mem = std.mem;
const builtin = @import("builtin");
pub fn foo() error!i32 {
const x = try bar();
return x + 1;
}
pub fn bar() error!i32 {
return 13;
}
pub fn baz() error!i32 {
const y = foo() catch 1234;
return y + 1;
}
test "err... | test/cases/error.zig |
const std = @import("std");
const log = @import("log.zig");
pub const Header = packed struct {
magic: u32,
totalsize: u32,
off_dt_struct: u32,
off_dt_strings: u32,
off_mem_rsvmap: u32,
version: u32,
last_comp_version: u32,
boot_cpuid_phys: u32,
size_dt_strings: u32,
size_dt_stru... | dtb.zig |
const std = @import("std");
const assert = std.debug.assert;
// TODO
// Cannot use testing allocator because I was too lazy to write the deinit()
// method for Node (our graph).
//
// const allocator = std.testing.allocator;
const allocator = std.heap.page_allocator;
const MAX_DEPTH = 500;
pub const Map = struct {
... | 2019/p20/map.zig |
const std = @import("std");
const allocator = std.heap.page_allocator;
const INT_MAX = 4294967295;
fn charToDigit(c: u8) u32 {
return switch (c) {
'0'...'9' => c - '0',
'A'...'Z' => c - 'A' + 10,
'a'...'z' => c - 'a' + 10,
else => 0,
};
}
fn readFile() anyerror!std.ArrayList(s... | day15/main.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const List = std.ArrayList;
const Map = std.AutoHashMap;
const StrMap = std.StringHashMap;
const BitSet = std.DynamicBitSet;
const Str = []const u8;
const util = @import("util.zig");
const gpa = util.gpa;
const data = @embedFile("../data/day01.txt");
p... | src/day01.zig |
pub const TIMERR_NOERROR = @as(u32, 0);
pub const TIMERR_NOCANDO = @as(u32, 97);
pub const TIMERR_STRUCT = @as(u32, 129);
pub const MAXPNAMELEN = @as(u32, 32);
pub const MAXERRORLENGTH = @as(u32, 256);
pub const MM_MICROSOFT = @as(u32, 1);
pub const MM_MIDI_MAPPER = @as(u32, 1);
pub const MM_WAVE_MAPPER = @as(u32, 2);
... | win32/media.zig |
const std = @import("std");
const expect = std.testing.expect;
test "@byteSwap" {
comptime testByteSwap();
testByteSwap();
}
test "@byteSwap on vectors" {
comptime testVectorByteSwap();
testVectorByteSwap();
}
fn testByteSwap() void {
expect(@byteSwap(u0, 0) == 0);
expect(@byteSwap(u8, 0x12) ... | test/stage1/behavior/byteswap.zig |
//! Similar to `StaticResetEvent` but on `set()` it also (atomically) does `reset()`.
//! Unlike StaticResetEvent, `wait()` can only be called by one thread (MPSC-like).
//!
//! AutoResetEvent has 3 possible states:
//! - UNSET: the AutoResetEvent is currently unset
//! - SET: the AutoResetEvent was notified before a ... | lib/std/Thread/AutoResetEvent.zig |
const std = @import("../std.zig");
const assert = std.debug.assert;
pub const ParseError = error{
OutOfMemory,
InvalidStringLiteral,
};
pub const Result = union(enum) {
success,
/// Found an invalid character at this index.
invalid_character: usize,
/// Expected hex digits at this index.
e... | lib/std/zig/string_literal.zig |
const std = @import("std");
const builtin = @import("builtin");
const system = std.os.system;
const linux = std.os.linux;
const libc = @cImport({
@cInclude("stdio.h");
@cInclude("string.h");
});
const Tty = @This();
pub const COLOR_BLACK = 0;
pub const COLOR_RED = 1;
pub const COLOR_GREEN = 2;
pub const COLO... | src/Tty.zig |
const std = @import("std");
usingnamespace (@import("../machine.zig"));
usingnamespace (@import("../util.zig"));
const imm = Operand.immediate;
const memory = Operand.memory;
const reg = Operand.register;
const regRm = Operand.registerRm;
test "simple 8086 opcodes" {
const m16 = Machine.init(.x86_16);
const m... | src/x86/tests/simple_8086.zig |
const sf = @import("../sfml.zig");
const Font = @This();
// Constructor/destructor
/// Loads a font from a file
pub fn createFromFile(path: [:0]const u8) !Font {
var font = sf.c.sfFont_createFromFile(path);
if (font) |f| {
return Font{ ._ptr = f };
} else return sf.Error.resourceLoadingError;
}
... | src/sfml/graphics/Font.zig |
const SFR = @import("../std/sfr.zig").SFR;
const mcu = @import("../atmega328p.zig");
const UDR = SFR(0xc6, u8, packed union {
RXB: u8,
TXB: u8,
});
const UCSRA = SFR(0xc0, u8, packed struct {
MPCM: u1 = 0, // D0
U2X: u1 = 0, // D1
PE: u1 = 0, // D2
DOR: u1 = 0, // D3
FE: u1 = 0, // D4
... | src/serial/uart.zig |
pub const VSS_ASSOC_NO_MAX_SPACE = @as(i32, -1);
pub const VSS_ASSOC_REMOVE = @as(u32, 0);
//--------------------------------------------------------------------------------
// Section: Types (70)
//--------------------------------------------------------------------------------
pub const IVssExamineWriterMetadata = e... | deps/zigwin32/win32/storage/vss.zig |
pub const SCEX2_ALT_NETBIOS_NAME = @as(u32, 1);
//--------------------------------------------------------------------------------
// Section: Types (21)
//--------------------------------------------------------------------------------
pub const VER_FLAGS = enum(u32) {
MINORVERSION = 1,
MAJORVERSION = 2,
... | deps/zigwin32/win32/system/system_information.zig |
const zt = @import("zt");
const main = @import("../main.zig");
const ig = @import("imgui");
const zg = zt.custom_components;
var rotation: f32 = 0.0;
var scale: f32 = 1.0;
var verts = [_]zt.math.Vec2{ zt.math.vec2(-70, 0), zt.math.vec2(0, -50), zt.math.vec2(-20, 0), zt.math.vec2(0, 50) };
var rect: zt.game.Physics.S... | example/src/scenes/colliders.zig |
const u = @import("util.zig");
const std = @import("std");
pub const Linking = @import("IR/Linking.zig");
const iters = @import("IR/iters.zig");
pub const ulen = u32;
pub const Module = struct {
arena: std.heap.ArenaAllocator,
funcs: []const Func = &[_]Func{},
tables: []const Table = &[_]Table{},
mem... | src/IR.zig |
const __floattisf = @import("floatXisf.zig").__floattisf;
const testing = @import("std").testing;
fn test__floattisf(a: i128, expected: f32) !void {
const x = __floattisf(a);
try testing.expect(x == expected);
}
test "floattisf" {
try test__floattisf(0, 0.0);
try test__floattisf(1, 1.0);
try test... | lib/std/special/compiler_rt/floattisf_test.zig |