code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const wlr = @import("../wlroots.zig");
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const DataDeviceManager = extern struct {
global: *wl.Global,
data_sources: wl.list.Head(wl.DataSource, null),
server_destroy: wl.Listener(*wl.Server),
events: extern struct {
destroy... | src/types/data_device.zig |
const std = @import("std");
const assert = std.debug.assert;
usingnamespace @import("tigerbeetle.zig");
pub const Header = @import("vr.zig").Header;
pub const Operation = @import("state_machine.zig").Operation;
pub fn connect(port: u16) !std.os.fd_t {
var addr = try std.net.Address.parseIp4("127.0.0.1", port);
... | src/demo.zig |
//TODO:
// Add list of files to specifically ignore,
// even if found inside a watched directory.
// Allow globbing for above blacklist.
// Should we have a separate thread just for
// reading inotify events, to ensure fewer get skipped?
// Add vim flag
// requires new files to be written to once before their events... | follow.zig |
const std = @import("std");
const expect = std.testing.expect;
const Allocator = std.mem.Allocator;
const Error = Allocator.Error;
const RED: bool = true;
const BLACK: bool = false;
fn Node(comptime T: type) type {
return struct {
value: T,
parent: ?*Node(T) = null,
left: ?*Node(T) = null,... | search_trees/llrb.zig |
const std = @import("std");
const Self = @This();
const MyError = error {
ElfTooSmall,
CompressedInstruction,
InvalidInstruction
};
// imports are structs, so this whole file is a struct
// integer registers
iregs: [32]u64,
// program counter
pc: u64,
// memory is a flat blob
mem: std.ArrayList(u8),
// in... | src/Cpu.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");
pub const GitError = error{
/// Generic error
GenericError,
/// Requested object could not be found
NotFound,
/// Ob... | src/errors.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const parseFloat = std.fmt.parseFloat;
const log = @import("./log.zig").log;
const render = @import("./render.zig");
const Canvas = render.Canvas;
const Pixel = render.Pixel;
const math_utils = @import("./math_utils.zig");
const Point = math_utils.Point;
... | night-math/src/wasm_interface.zig |
const std = @import("std");
const Wwise = @import("wwise.zig").Wwise;
const ImGui = @import("imgui.zig").ImGui;
const zigwin32 = @import("zigwin32");
const win32 = zigwin32.everything;
const d3d = zigwin32.graphics.direct3d;
const d3d11 = zigwin32.graphics.direct3d11;
const dxgi = zigwin32.graphics.dxgi;
const NullD... | src/main.zig |
const std = @import("std");
const Type = @import("Value.zig").Type;
const Allocator = std.mem.Allocator;
//! This file contains Luf's typed intermediate representation
//! This pass is used by codegen to construct other output such as WASM,
//! Luf bytecode, ASM or other possible future outputs.
/// General instructi... | src/ir.zig |
const std = @import("std");
const mach = @import("mach");
const gpu = @import("gpu");
const App = @This();
pipeline: gpu.RenderPipeline,
queue: gpu.Queue,
pub fn init(app: *App, engine: *mach.Engine) !void {
const vs_module = engine.device.createShaderModule(&.{
.label = "my vertex shader",
.code... | examples/triangle/main.zig |
pub const ptrdiff_t = c_long;
pub const wchar_t = c_int;
pub const max_align_t = extern struct {
__clang_max_align_nonce1: c_longlong,
__clang_max_align_nonce2: c_longdouble,
};
pub const __u_char = u8;
pub const __u_short = c_ushort;
pub const __u_int = c_uint;
pub const __u_long = c_ulong;
pub const __int8_t ... | src/vulkan.zig |
pub const HKEY_CLASSES_ROOT = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483648));
pub const HKEY_CURRENT_USER = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483647));
pub const HKEY_LOCAL_MACHINE = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483646));
pub const HKEY_USERS = @import("../zig.z... | deps/zigwin32/win32/system/registry.zig |
const c = @import("c.zig");
const nk = @import("../nuklear.zig");
const std = @import("std");
const testing = std.testing;
pub const Type = enum(u8) {
lines = c.NK_CHART_LINES,
column = c.NK_CHART_COLUMN,
pub fn toNuklear(_type: Type) c.enum_nk_chart_type {
return @intToEnum(c.enum_nk_chart_type,... | src/chart.zig |
const assert = @import("std").debug.assert;
const mem = @import("std").mem;
test "arrays" {
var array : [5]u32 = undefined;
var i : u32 = 0;
while (i < 5) {
array[i] = i + 1;
i = array[i];
}
i = 0;
var accumulator = u32(0);
while (i < 5) {
accumulator += array[i];
... | test/cases/array.zig |
pub const SERVICE_ALL_ACCESS = @as(u32, 983551);
pub const SC_MANAGER_ALL_ACCESS = @as(u32, 983103);
pub const SERVICE_NO_CHANGE = @as(u32, 4294967295);
pub const SERVICE_CONTROL_STOP = @as(u32, 1);
pub const SERVICE_CONTROL_PAUSE = @as(u32, 2);
pub const SERVICE_CONTROL_CONTINUE = @as(u32, 3);
pub const SERVICE_CONTRO... | win32/system/services.zig |
const std = @import("std");
//--------------------------------------------------------------------------------------------------
pub fn part1() anyerror!void {
const file = std.fs.cwd().openFile("data/day02_input.txt", .{}) catch |err| label: {
std.debug.print("unable to open file: {e}\n", .{err});
... | src/day02.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 = @import("builtin");
const TypeId = builtin.TypeId;
const std = @import("std");
const time = std.os.time;
const mem = std.mem;
const math = std.math;
const Allocator = mem.Allocator;
const assert = std.debug.assert;
const warn = std.debug.warn;
const gl = @import("modules/zig-sdl2/src/index.zig");
cons... | src/test-window.zig |
const std = @import("std");
const io = std.io;
const fs = std.fs;
const testing = std.testing;
const mem = std.mem;
const deflate = std.compress.deflate;
// Flags for the FLG field in the header
const FTEXT = 1 << 0;
const FHCRC = 1 << 1;
const FEXTRA = 1 << 2;
const FNAME = 1 << 3;
const FCOMMENT = 1 << 4;
pub fn G... | lib/std/compress/gzip.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/day04.txt");
c... | src/day04.zig |
const bu = @import("./bits.zig"); // bits utilities
const std = @import("std");
const assert = std.debug.assert;
const builtin = @import("builtin");
const math = std.math;
const UINT8_MAX = math.maxInt(u8);
const UINT16_MAX = math.maxInt(u16);
pub const MAX_HUFFMAN_SYMBOLS = 288; // Deflate uses max 288 symbols.
pu... | src/huffman.zig |
const assert = @import("std").debug.assert;
const imgui = @import("../../c.zig");
pub const c = @import("c.zig");
pub const ImPlotContext = c.ImPlotContext;
pub const IMPLOT_AUTO = -1;
pub const IMPLOT_AUTO_COL = imgui.ImVec4{ .x = 0, .y = 0, .z = 0, .w = -1 };
pub const Point = struct {
pub fn init() *c.ImPlotPoin... | src/deps/imgui/ext/implot/implot.zig |
const std = @import("std");
const print = std.debug.print;
const data = @embedFile("../data/day16.txt");
pub fn main() !void {
var timer = try std.time.Timer.start();
print("🎁 Total versions: {}\n", .{totalVersionInPacket(data)});
print("Day 16 - part 01 took {:15}ns\n", .{timer.lap()});
timer.reset();
pr... | src/day16.zig |
const std = @import("std");
pub const SSCAN = struct {
key: []const u8,
cursor: []const u8,
pattern: Pattern,
count: Count,
pub const Pattern = union(enum) {
NoPattern,
Pattern: []const u8,
pub const RedisArguments = struct {
pub fn count(self: Pattern) usize {... | src/commands/sets/sscan.zig |
const std = @import("std");
const GameSimulation = @import("GameSimulation.zig");
const CharacterData = @import("CharacterData.zig");
const Component = @import("Component.zig");
const math = @import("utils/math.zig");
// Create a new hitbox translated by the offset provided.
fn TranslateHitbox(hitbox: CharacterData.H... | src/CollisionSystem.zig |
const std = @import("std");
const DocumentStore = @import("document_store.zig");
const ast = std.zig.ast;
const types = @import("types.zig");
/// Get a declaration's doc comment node
fn getDocCommentNode(tree: *ast.Tree, node: *ast.Node) ?*ast.Node.DocComment {
if (node.cast(ast.Node.FnProto)) |func| {
ret... | src/analysis.zig |
const fmath = @import("index.zig");
pub fn fma(comptime T: type, x: T, y: T, z: T) -> T {
switch (T) {
f32 => @inlineCall(fma32, x, y, z),
f64 => @inlineCall(fma64, x, y ,z),
else => @compileError("fma not implemented for " ++ @typeName(T)),
}
}
fn fma32(x: f32, y: f32, z: f32) -> f32 ... | src/fma.zig |
const std = @import("std");
const helper = @import("helper.zig");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const input = @embedFile("../inputs/day18.txt");
pub fn run(alloc: Allocator, stdout_: anytype) !void {
var arena = std.heap.ArenaAllocator.init(alloc);
const arena_alloc = a... | src/day18.zig |
const std = @import("std");
const builtin = @import("builtin");
pub const utils = @import("utils");
pub const system_calls = @import("system_calls.zig");
pub const start = @import("start.zig");
pub const keyboard = @import("keyboard.zig");
pub const io = @import("io.zig");
pub const memory = @import("memory.zig");
p... | libs/georgios/georgios.zig |
const std = @import("std");
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var allocator = &gpa.allocator;
const Players = struct { p1: std.ArrayList(usize), p2: std.ArrayList(usize) };
const Player = enum { p1, p2 };
fn get_input() !Players {
const f = try std.fs.cwd().openFile("inputs/day22.txt", .{ .read... | src/day22.zig |
const StringReplacer = @import("strings").StringReplacer;
const builtin = @import("builtin");
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const Buffer = std.Buffer;
const Value = json.Value;
const json = std.json;
const testing = std.testing;
const w... | src/json/json.zig |
pub usingnamespace @import("std").c.builtins;
const enum_unnamed_1 = extern enum(c_int) {
ROARING_VERSION_MAJOR = 0,
ROARING_VERSION_MINOR = 3,
ROARING_VERSION_REVISION = 1,
_,
};
pub const ROARING_VERSION_MAJOR = @enumToInt(enum_unnamed_1.ROARING_VERSION_MAJOR);
pub const ROARING_VERSION_MINOR = @enumT... | src/zig-cache/o/f4687eedd2a239469f6160be2c4a4703/cimport.zig |
const std = @import("std");
const zwl = @import("zwl");
const Platform = zwl.Platform(.{
.single_window = true,
.backends_enabled = .{
.software = true,
.opengl = false,
.vulkan = false,
},
.remote = true,
.platforms_enabled = .{
.wayland = (std.builtin.os.tag != .wi... | didot-zwl/zwl/examples/softlogo.zig |
const std = @import("std");
const testing = std.testing;
const meta = std.meta;
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
pub const ReadVarNumError = error{
TooManyBytes,
};
// https://wiki.vg/Protocol#VarInt_and_VarLong
pub fn readVarNum(comptime T: type, reader: anytype, read_length:... | src/varnum.zig |
const c = @import("c.zig");
const nk = @import("../nuklear.zig");
const std = @import("std");
const builtin = std.builtin;
const debug = std.debug;
const heap = std.heap;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
const testing = std.testing;
pub const Format = c.nk_layout_format;
pub fn rese... | src/layout.zig |
const std = @import("std");
const stb_image = @import("vendored/stb_image/build.zig");
const zmesh = @import("vendored/zmesh/build.zig");
pub const pkg = std.build.Pkg{
.name = "brucelib.graphics",
.path = .{ .path = thisDir() ++ "/src/main.zig" },
.dependencies = &.{
std.build.Pkg{
.n... | modules/graphics/build.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/customshaders.zig |
const std = @import("std");
const json = std.json;
// JSON Types
pub const String = []const u8;
pub const Integer = i64;
pub const Float = f64;
pub const Bool = bool;
pub const Array = json.Array;
pub const Object = json.ObjectMap;
// pub const Any = @TypeOf(var);
// Basic structures
pub const DocumentUri = String... | src/types.zig |
const std = @import("std");
const crypto = std.crypto;
const aes = crypto.core.aes;
const assert = std.debug.assert;
const math = std.math;
const mem = std.mem;
const AuthenticationError = crypto.errors.AuthenticationError;
pub const Aes128Ocb = AesOcb(aes.Aes128);
pub const Aes256Ocb = AesOcb(aes.Aes256);
const Blo... | lib/std/crypto/aes_ocb.zig |
const std = @import("std");
const graphics = @import("didot-graphics");
const Allocator = std.mem.Allocator;
pub const AssetType = enum(u8) {
Mesh,
Texture,
Shader
};
pub const Asset = struct {
/// Pointer to object
objectPtr: usize = 0,
objectAllocator: ?*Allocator = null,
/// If the func... | didot-objects/assets.zig |
pub const NETCON_MAX_NAME_LEN = @as(u32, 256);
pub const S_OBJECT_NO_LONGER_VALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, 2));
pub const NETISO_GEID_FOR_WDAG = @as(u32, 1);
pub const NETISO_GEID_FOR_NEUTRAL_AWARE = @as(u32, 2);
//----------------------------------------------------------------------------... | win32/network_management/windows_firewall.zig |
const std = @import("std");
const input = @embedFile("data/input13");
usingnamespace @import("util.zig");
pub fn main() !void {
const data = parse(input);
const part1 = findEarliestBus(data);
const part2 = findEarliestTimestamp(data);
print("[Part1] Earliest bus: {}", .{part1});
print("[Part2... | src/day13.zig |
const std = @import("std");
const unicode = std.unicode;
const sdl = @import("sdl.zig");
const Audio = @import("audio.zig").Audio;
const DumbFont16 = @import("dumbfont.zig").DumbFont16;
const PF2Font = @import("pf2.zig").PF2Font;
const bounce_bytes = @embedFile("../assets/bounce.wav");
const main_font_bytes = @embedFil... | 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);
}
pub fn main() anyerror!void {
const stdout = std.io.getStdOut().writer();
var arena ... | 2017/day22.zig |
const std = @import("std");
const io = std.io;
const mem = std.mem;
const macho = std.macho;
const Allocator = mem.Allocator;
const FormatOptions = std.fmt.FormatOptions;
pub const LoadCommand = union(enum) {
Segment: SegmentCommand,
DyldInfoOnly: macho.dyld_info_command,
Symtab: macho.symtab_command,
... | src/ZachO/commands.zig |
pub const OFFLINEFILES_SYNC_STATE_LOCAL_KNOWN = @as(u32, 1);
pub const OFFLINEFILES_SYNC_STATE_REMOTE_KNOWN = @as(u32, 2);
pub const OFFLINEFILES_CHANGES_NONE = @as(u32, 0);
pub const OFFLINEFILES_CHANGES_LOCAL_SIZE = @as(u32, 1);
pub const OFFLINEFILES_CHANGES_LOCAL_ATTRIBUTES = @as(u32, 2);
pub const OFFLINEFILES_CHA... | win32/storage/offline_files.zig |
const std = @import("std");
const print = @import("std").debug.print;
const led_driver = @import("led_driver.zig");
const gnss = @import("gnss.zig");
const web = @import("zhp");
pub const GnssContext = struct {
gnss: *gnss.GNSS,
led: led_driver.LP50xx,
timeout: u16 = 1000,
};
pub const AppContext = stru... | src/threads.zig |
const std = @import("std");
const zelda = @import("zelda");
const clowdword = @import("cloudword_gen.zig");
const CloudGenerator = clowdword.CloudGenerator;
const WordFrequency = clowdword.WordFreq;
const programUseCache: bool = false;
var progress = std.Progress{};
// The stopwordURL can be changed here, remember the ... | src/main.zig |
const std = @import("std");
// So before we continue, some specific notes about the format.
// + The world in which DEFLATE operates in is a bitstream.
// The lowest bit of each byte is the first bit in the stream, going forwards.
// Note however that DEFLATE can forcibly align the stream to an 8-bit boundary in... | src/compressor.zig |
usingnamespace @import("raylib");
usingnamespace @import("rlights.zig");
usingnamespace @import("raylib-math");
const resourceDir = "raylib/examples/shaders/resources/";
pub fn main() !void {
// Initialization
//--------------------------------------------------------------------------------------
const s... | examples/shaders/shaders_basic_lighting.zig |
const std = @import("std");
const zs = @import("zstack.zig");
const Engine = zs.Engine;
const Options = zs.Options;
const Window = zs.window.Window;
const Flag = zstack.input.Flag;
const Action = zstack.input.Action;
const ActionFlag = zstack.input.ActionFlag;
const ActionFlags = zstack.input.ActionFlags;
const Time... | src/main.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const testing = std.testing;
const input_file = "input07.txt";
const Rules = std.StringHashMap([]const []const u8);
fn parseRules(allocator: *Allocator, reader: anytype) !Rules {
var result = Rules.init(allocator);
var buf: [4 * 1024]u8 = unde... | src/07.zig |
const std = @import("std");
const assert = std.debug.assert;
const math = std.math;
const mem = std.mem;
const sort = std.sort;
const bits_utils = @import("./bits.zig");
const bs = @import("./bitstream.zig");
const lz = @import("./lz77.zig");
const UINT8_MAX = math.maxInt(u8);
pub const expand_stat_t = enum {
H... | src/reduce.zig |
const std = @import("std");
const napi = @import("./napi.zig");
pub usingnamespace struct {
env: napi.env,
const serde = @This();
pub fn init(env: napi.env) serde {
return serde { .env = env };
}
pub fn serialize(self: serde, v: anytype) !napi.value {
const T = @TypeOf(v);
const I = @typeInfo(T... | src/serde.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const nvg = @import("nanovg");
const gui = @import("../gui.zig");
const Rect = @import("../geometry.zig").Rect;
pub fn Slider(comptime T: type) type {
comptime std.debug.assert(T == f32);
return struct {
widget: gui.Widget,
allo... | src/gui/widgets/Slider.zig |
const std = @import("std");
const CrossTarget = std.zig.CrossTarget;
const ReleaseMode = std.builtin.Mode;
const Builder = std.build.Builder;
const Step = std.build.Step;
pub fn build(b: *Builder) void {
b.top_level_steps.shrinkRetainingCapacity(0);
const mode_config = [_]?bool{
b.option(bool, "debug",... | build.zig |
const MachO = @This();
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const fs = std.fs;
const Module = @import("../Module.zig");
const link = @import("../link.zig");
const File = link.File;
pub const base_tag: Tag = File.Tag.macho;
base: File,
error_flags: File.E... | src-self-hosted/link/MachO.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
pub const State = struct {
const Memory = std.AutoHashMap(TapeIndex, TapeElement);
const Inputs = std.ArrayList(TapeElement);
memory: Memory,
inputs: Inputs,
idx: TapeIndex = 0,
inputs_idx: usize = 0,
relative_base_offset: Ta... | src/main/zig/2019/intcode.zig |
const std = @import("std");
const Options = struct {
mode: std.builtin.Mode,
target: std.zig.CrossTarget,
fn apply(self: Options, lib: *std.build.LibExeObjStep) void {
lib.setBuildMode(self.mode);
lib.setTarget(self.target);
}
};
pub fn build(b: *std.build.Builder) void {
const op... | build.zig |
const Arg = @This();
const std = @import("std");
const Settings = struct {
takes_value: bool,
allow_empty_value: bool,
pub fn initDefault() Settings {
return Settings{
.takes_value = false,
.allow_empty_value = false,
};
}
};
name: []const u8,
short_name: ?u8,
... | src/Arg.zig |
pub const CLSID_AudioFrameNativeFactory = Guid.initString("16a0a3b9-9f65-4102-9367-2cda3a4f372a");
pub const CLSID_VideoFrameNativeFactory = Guid.initString("d194386a-04e3-4814-8100-b2b0ae6d78c7");
//--------------------------------------------------------------------------------
// Section: Types (4)
//--------------... | win32/system/win_rt/media.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
//--------------------------------------------------------------------------------------------------
pub fn illegal_char_points(char: u8) u32 {
return switch (char) {
')' => 3,
']' => 57,
'}' ... | src/day10.zig |
const builtin = @import("builtin");
const std = @import("std");
const math = std.math;
const assert = std.debug.assert;
const L = std.unicode.utf8ToUtf16LeStringLiteral;
const zwin32 = @import("zwin32");
const w = zwin32.base;
const d3d12 = zwin32.d3d12;
const dml = zwin32.directml;
const hrPanic = zwin32.hrPanic;
cons... | samples/directml_convolution_test/src/directml_convolution_test.zig |
const std = @import("std");
/// default EntityTraitsDefinition with reasonable sizes suitable for most situations
pub const EntityTraits = EntityTraitsType(.medium);
pub const EntityTraitsSize = enum { small, medium, large };
pub fn EntityTraitsType(comptime size: EntityTraitsSize) type {
return switch (size) {
... | src/ecs/ecs/entity.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
pub const main = tools.defaultMain("2021/day02.txt", run);
pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 {
const Vec2 = @Vector(2, i32);
const ans1 = ans: {
var pos = Vec2{ 0, 0 }... | 2021/day02.zig |
const std = @import("std");
const math = std.math;
const common = @import("common.zig");
const BiasedFp = common.BiasedFp;
const Decimal = @import("decimal.zig").Decimal;
const mantissaType = common.mantissaType;
const max_shift = 60;
const num_powers = 19;
const powers = [_]u8{ 0, 3, 6, 9, 13, 16, 19, 23, 26, 29, 33,... | lib/std/fmt/parse_float/convert_slow.zig |
const std = @import("std");
var a: *std.mem.Allocator = undefined;
const stdout = std.io.getStdOut().writer(); //prepare stdout to write in
// byr (Birth Year)
// iyr (Issue Year)
// eyr (Expiration Year)
// hgt (Height)
// hcl (Hair Color)
// ecl (Eye Color)
// pid (Passport ID)
// cid (Country ID) (Optional)
test ... | day-04/part-1/lelithium.zig |
const std = @import("std");
const os = std.os;
const Logger = @import("logger.zig").Logger;
const helpers = @import("helpers.zig");
const util = @import("util.zig");
const supervisors = @import("supervisor.zig");
const thread_commands = @import("thread_commands.zig");
const superviseProcess = supervisors.supervisePr... | src/daemon.zig |
const std = @import("std");
const print = std.debug.print;
const util = @import("util.zig");
const gpa = util.gpa;
const data = @embedFile("../data/day03.txt");
fn calc(nums: []u1) usize {
var total: usize = 0;
for (nums) |n, i| {
total += std.math.pow(usize, 2, nums.len - i - 1) * n;
}
retur... | 2021/src/day03.zig |
const std = @import("std");
const testing = std.testing;
const print = std.debug.print;
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const input = @embedFile("./input.txt");
const num_numbers = 100;
const num_boards = 100;
const board_size = 5;
pub fn main() anyerror!void {
print("--- Pa... | src/day04/day04.zig |
const std = @import("std");
const utils = @import("../utils.zig");
const Atomic = std.atomic.Atomic;
const Futex = std.Thread.Futex;
const NtKeyedEvent = @import("keyed_event_lock.zig").NtKeyedEvent;
pub const Lock = struct {
pub const name = "count_lock";
state: Atomic(u64) = Atomic(u64).init(0),
const... | locks/count_lock.zig |
const debug = @import("std").debug;
const Vec3 = @import("Vec3.zig").Vec3;
//TODO is there some sort of better swap?
fn swap(lhs: *f32, rhs: *f32) void {
const temp = lhs;
lhs = rhs;
rhs = temp;
}
pub const identity = Mat4x4{};
pub const zero = Mat4x4{
.m = [4][4]f32{
[4]f32{ 0.0, 0.0, 0.0, 0.... | src/math/Mat4x4.zig |
usingnamespace @import("root").preamble;
const ImageRegion = lib.graphics.image_region.ImageRegion;
const Color = lib.graphics.color.Color;
pub const ScrollingRegion = struct {
used_height: usize = 0,
used_width: usize = 0,
pub fn putBottom(self: *@This(), region: ImageRegion, into: ImageRegion, used_wid... | lib/graphics/scrolling_region.zig |
//--------------------------------------------------------------------------------
// Section: Types (2)
//--------------------------------------------------------------------------------
pub const NOTIFICATION_USER_INPUT_DATA = extern struct {
Key: ?[*:0]const u16,
Value: ?[*:0]const u16,
};
// TODO: this ty... | win32/ui/notifications.zig |
const std = @import("std");
const mem = std.mem;
const utils = @import("utils.zig");
const expect = std.testing.expect;
const log = std.log;
pub const Item = struct {
// required: type, id; no additional properties
@"type": ItemType, // string -> enum
id: OrdinaryVar,
optionals: PropertyMap,
pub ... | src/csl_json.zig |
const std = @import("std");
const build_options = @import("build_options");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const fmt = std.fmt;
const fs = std.fs;
const io = std.io;
const mem = std.mem;
const process = std.process;
const c = @cImport({
@cInclude("systemd/sd-bus.h");
});
con... | src/main.zig |
const std = @import("std");
const mem = std.mem;
const wl = @import("wayland").server.wl;
const util = @import("../util.zig");
const server = &@import("../main.zig").server;
const Error = @import("../command.zig").Error;
const Seat = @import("../Seat.zig");
pub fn outputLayout(
allocator: *std.mem.Allocator,
... | source/river-0.1.0/river/command/layout.zig |
const std = @import("std");
const util = @import("util.zig");
const data = @embedFile("../data/day07.txt");
// Type of fuel calculation to use for finding alignment positions.
const FuelCalculation = enum {
// Fuel cost is the equal to the distance moved
Linear,
// Fuel cost is the geometric summation of ... | src/day07.zig |
const std = @import("std");
const mem = std.mem;
const meta = std.meta;
usingnamespace @import("../frame.zig");
usingnamespace @import("../primitive_types.zig");
const testing = @import("../testing.zig");
/// STARTUP is sent to a node to initialize a connection.
///
/// Described in the protocol spec at §4.1.1.
pub c... | src/frames/startup.zig |
const pc_keyboard = @import("../../pc_keyboard.zig");
const us104 = @import("us104.zig");
pub fn mapKeycode(keycode: pc_keyboard.KeyCode, modifiers: pc_keyboard.Modifiers, handle_ctrl: pc_keyboard.HandleControl) pc_keyboard.DecodedKey {
switch (keycode) {
.BackTick => {
if (modifiers.isShifte... | src/keycode/layouts/jis109.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const compiler = @import("./compiler.zig");
const _value = @import("./value.zig");
const _vm = @import("./vm.zig");
const VM = _vm.VM;
const Value = _value.Value;
pub const OpCode = enum(u8) {
OP_CONSTANT,
OP_NULL,
OP_VOID,
OP_TRUE,
O... | src/chunk.zig |
const std = @import("../../std.zig");
const builtin = @import("builtin");
const windows = std.os.windows;
const mem = std.mem;
const testing = std.testing;
const expect = testing.expect;
fn testRemoveDotDirs(str: []const u8, expected: []const u8) !void {
const mutable = try testing.allocator.dupe(u8, str);
def... | lib/std/os/windows/test.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const builtin = @import("builtin");
const AtomicRmwOp = builtin.AtomicRmwOp;
const AtomicOrder = builtin.AtomicOrder;
test "cmpxchg" {
var x: i32 = 1234;
if (@cmpxchgWeak(i32, &x, 99, 5678, AtomicOrder.S... | test/stage1/behavior/atomics.zig |
//! This API non-allocating, non-fallible, and thread-safe.
//! The tradeoff is that users of this API must provide the storage
//! for each `Progress.Node`.
//!
//! Initialize the struct directly, overriding these fields as desired:
//! * `refresh_rate_ms`
//! * `initial_delay_ms`
const std = @import("std");
const w... | lib/std/Progress.zig |
const std = @import("std");
const assert = std.debug.assert;
const stivale = @import("header.zig");
const log = std.log.scoped(.stivale2);
const kernel = @import("../../../../kernel.zig");
const x86_64 = @import("../../../x86_64.zig");
pub const Struct = stivale.Struct;
pub const Error = error{
memory_map,
hig... | src/kernel/arch/x86_64/limine/stivale2/stivale2.zig |
usingnamespace @import("common.zig");
pub const Camera = struct {
transform: Transform,
aspect: f32,
fov: f32,
near: f32,
far: f32,
pub fn viewProjection(self: Camera) Float4x4 {
const model_matrix = self.transform.toMatrix();
const forward = f4tof3(model_matrix.rows[2]);
... | src/camera.zig |
const std = @import("std");
const c = @cImport(@cInclude("rocksdb/c.h"));
const testing = std.testing;
const o = @import("ops.zig");
pub const root_key = ".root";
pub const node_key_prefix = "@1:";
const default_db_dir = "./db";
pub const RocksDataBbase = DB(RocksDB);
pub fn DB(comptime T: type) type {
return st... | src/db.zig |
const std = @import("std");
const yaml = @import("yaml");
const c = @cImport({
@cInclude("yaml.h");
});
const u = @import("./index.zig");
//
//
const Array = []const []const u8;
pub const Stream = struct {
docs: []const Document,
};
pub const Document = struct {
mapping: Mapping,
};
pub const Item = u... | src/util/yaml.zig |
const std = @import("std");
const vkgen = @import("generator/index.zig");
const Step = std.build.Step;
const Builder = std.build.Builder;
pub const ResourceGenStep = struct {
step: Step,
shader_step: *vkgen.ShaderCompileStep,
builder: *Builder,
package: std.build.Pkg,
output_file: std.build.Generat... | build.zig |
const uefi = @import("std").os.uefi;
const Event = uefi.Event;
const Guid = uefi.Guid;
/// Character input devices, e.g. Keyboard
pub const SimpleTextInputExProtocol = extern struct {
_reset: extern fn (*const SimpleTextInputExProtocol, bool) usize,
_read_key_stroke_ex: extern fn (*const SimpleTextInputExProto... | lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig |
const std = @import("std");
const heap = @import("../heap.zig");
const uart = @import("../uart.zig");
const interpreter = @import("../interpreter.zig");
const example_tasks = @import("./example_tasks.zig");
const Frame = @import("./Frame.zig");
const debug = @import("build_options").log_vm;
pub fn step(frame: *Fram... | src/interpreter/vm.zig |
const std = @import("std");
const zs = @import("zstack.zig");
const Piece = zs.Piece;
const Block = zs.Block;
const BitSet = zs.BitSet;
const VirtualKey = zs.input.VirtualKey;
const Actions = zs.input.Actions;
const FixedQueue = zs.FixedQueue;
pub const Engine = struct {
pub const State = enum {
/// When ... | src/engine.zig |
const __lshrdi3 = @import("shift.zig").__lshrdi3;
const testing = @import("std").testing;
fn test__lshrdi3(a: i64, b: i32, expected: u64) void {
const x = __lshrdi3(a, b);
testing.expectEqual(@bitCast(i64, expected), x);
}
test "lshrdi3" {
test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 0, 0x12... | lib/std/special/compiler_rt/lshrdi3_test.zig |
const std = @import("std");
const util = @import("util.zig");
const Tokenizer = @import("token.zig").Tokenizer;
const Token = @import("token.zig").Token;
const StateMachine = @import("state_machine.zig").StateMachine;
const ZValue = @import("data.zig").ZValue;
const ZExpr = @import("data.zig").ZExpr;
const ZExprArg ... | src/parse.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const data = @embedFile("../inputs/day12.txt");
pub fn main() anyerror!void {
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa_impl.deinit();
const gpa = gpa_impl.allocator();
return m... | src/day12.zig |
const std = @import("std");
const Mutex = std.Mutex;
const Keypad = @import("keypad.zig").Keypad;
/// The starting address in memory space,
/// anything before this is storage and reserved memory
const start_address = 0x200;
/// Starting address of where the fonts are located in the memory
const font_start_address = ... | src/cpu.zig |
const std = @import("std");
const mem = std.mem;
const debug = std.debug;
const assert = debug.assert;
usingnamespace @import("../include/psptypes.zig");
usingnamespace @import("../include/pspsysmem.zig");
usingnamespace @import("../include/psploadexec.zig");
const Allocator = mem.Allocator;
// This Allocator is a v... | src/psp/utils/allocator.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const testing = std.testing;
const input = @embedFile("./input.txt");
pub fn main() anyerror!void {
print("Day 2: Dive!\n", .{});
print("Part 1: {d}\n", .{part1()});
print("Part 2: {d}\n", .{part2()});
}
cons... | src/day02/day02.zig |
const std = @import("std");
const ziget = @import("ziget");
const stories_url = "https://hacker-news.firebaseio.com/v0/topstories.json";
const item_base_url = "https://hacker-news.firebaseio.com/v0/item";
const stories_limit = 500;
const Story = struct {
// by: []u8 = "",
// descendants: u32 = 0,
id: u32 ... | zig_fhn_ziget_iguana/src/main.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const App = @import("app");
const glfw = @import("glfw");
const gpu = @import("gpu");
const util = @import("util.zig");
const c = @import("c.zig").c;
const Engine = @import("Engine.zig");
const Options = Engine.Options;
/// Default GLFW error handling ... | src/entry_native.zig |