code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const tvg = @import("tvg");
const c = @cImport({
@cInclude("tinyvg.h");
});
fn renderSvg(data: []const u8, stream: CWriter) !void {
var temp_mem = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer temp_mem.deinit();
try tvg.svg.renderBinary(temp_mem.allocator(),... | src/binding/binding.zig |
const std = @import("../std.zig");
const mem = std.mem;
const endian = std.endian;
const assert = std.debug.assert;
const testing = std.testing;
const builtin = @import("builtin");
const maxInt = std.math.maxInt;
const QuarterRound = struct {
a: usize,
b: usize,
c: usize,
d: usize,
};
fn Rp(a: usize,... | lib/std/crypto/chacha20.zig |
/// Hash functions.
pub const hash = struct {
pub const Md5 = @import("crypto/md5.zig").Md5;
pub const Sha1 = @import("crypto/sha1.zig").Sha1;
pub const sha2 = @import("crypto/sha2.zig");
pub const sha3 = @import("crypto/sha3.zig");
pub const blake2 = @import("crypto/blake2.zig");
pub const Bla... | lib/std/crypto.zig |
const std = @import("std");
const assert = std.debug.assert;
const Entry = struct {
policy: struct {
least: u16,
most: u16,
letter: u8,
} = undefined,
password: []u8 = undefined,
};
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{ .safety = true, .enable_memo... | src/day02.zig |
const std = @import("std");
const upaya = @import("upaya");
const ts = @import("../tilescript.zig");
usingnamespace @import("imgui");
pub fn draw(state: *ts.AppState) void {
igPushStyleVarVec2(ImGuiStyleVar_WindowMinSize, .{ .x = 220, .y = 100 });
defer igPopStyleVar(1);
if (state.prefs.windows.tags) {
... | tilescript/windows/tags.zig |
pub const FILE_CACHE_MAX_HARD_ENABLE = @as(u32, 1);
pub const FILE_CACHE_MAX_HARD_DISABLE = @as(u32, 2);
pub const FILE_CACHE_MIN_HARD_ENABLE = @as(u32, 4);
pub const FILE_CACHE_MIN_HARD_DISABLE = @as(u32, 8);
pub const MEHC_PATROL_SCRUBBER_PRESENT = @as(u32, 1);
//-----------------------------------------------------... | win32/system/memory.zig |
const std = @import("std");
/// Exports the C interface for SDL
pub const c = @import("binding/sdl.zig");
pub const image = @import("image.zig");
pub const gl = @import("gl.zig");
pub const Error = error{SdlError};
const log = std.log.scoped(.sdl2);
pub fn makeError() error{SdlError} {
if (c.SDL_GetError()) |p... | src/lib.zig |
const std = @import("std");
const debug = std.debug;
const mem = std.mem;
const ArrayList = std.ArrayList;
const Row = struct {
pub const Cell = struct {
column: *Column,
data: []const u8,
};
id: ?usize,
cells: ArrayList(Cell),
pub fn init(allocator: mem.Allocator, id: ?usize) Row... | src/datatable.zig |
const std = @import("std");
const mem = @import("mem.zig");
const scheduler = @import("scheduler.zig");
const thread = @import("thread.zig");
const Array = std.ArrayList;
const IntrusiveList = std.IntrusiveLinkedList;
const List = std.LinkedList;
const MailboxId = std.os.zen.MailboxId;
const Message = std.os.zen.Messag... | kernel/ipc.zig |
// Rough implementation of msgpack, based on the standard online at
// https://github.com/msgpack/msgpack/blob/master/spec.md
const std = @import("std");
const Tag = std.meta.Tag;
const MsgPackError = error{
InvalidKeyType,
NoExtensionsAllowed,
NotAMap,
NoSuchKey,
InvalidValueType,
IntOverflow... | src/fileformats/msgpack.zig |
pub const Win32Error = extern enum(u16) {
/// The operation completed successfully.
SUCCESS = 0,
/// Incorrect function.
INVALID_FUNCTION = 1,
/// The system cannot find the file specified.
FILE_NOT_FOUND = 2,
/// The system cannot find the path specified.
PATH_NOT_FOUND = 3,
///... | lib/std/os/windows/win32error.zig |
const std = @import("std");
const builtin = @import("builtin");
const opcode = @import("opcode.zig");
pub const Registers = struct {
af: u16,
bc: u16,
de: u16,
hl: u16,
sp: u16,
pc: u16,
pub fn a(self: *const Registers) u8 {
return @truncate(u8, self.af >> 8);
}
pub fn se... | src/cpu.zig |
const std = @import("std");
const warn = std.debug.warn;
const idToString = @import("json_grammar.debug.zig").idToString;
const Lexer = @import("json_lexer.zig").Lexer;
const Types = @import("json_grammar.types.zig");
const Tokens = @import("json_grammar.tokens.zig");
const Actions = @import("json_grammar.actions.zig"... | json/json.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 Pathspec = opaque {
/// Free a pathspec
pub fn deinit(self: *Pathspec) void {
log.debug("Pathspec.deinit calle... | src/pathspec.zig |
const std = @import("std");
const TypeId = @import("builtin").TypeId;
const whereIt = @import("where.zig").iterator;
const selectIt = @import("select.zig").iterator;
const castIt = @import("cast.zig").iterator;
const orderIt = @import("order.zig").iterator;
const skipIt = @import("skip.zig").iterator;
const skipWhileIt... | src/iterator.zig |
const std = @import("std");
const builtin = std.builtin;
const TypeInfo = builtin.TypeInfo;
const alignForward = std.mem.alignForward;
const pi = std.math.pi;
const testing = std.testing;
pub const Math = struct {
pub fn FixedPoint(comptime isSigned: bool, comptime integral: comptime_int, comptime fractional: comp... | GBA/math.zig |
const std = @import("std");
//--------------------------------------------------------------------------------------------------
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const Range = struct { first: u16, last: u16, value: u16 };
const Ranges = ArrayList(Range);
const MapType = [1000][1000... | src/day05.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
const Registers = [6]u48;
const Opcode = enum { addi, addr, muli, mulr, bani, banr, bori, borr, setr, seti, gtir, gtri, gtrr, eqir, eqri, eqrr };
const Insn = struct { op: Opcode, par: [3]u32 };
const State = struct {
reg:... | 2018/day21_comptime.zig |
const std = @import("std");
const builtin = @import("builtin");
const native_endian = builtin.target.cpu.arch.endian();
//@TODO: Allow for other clock rates
pub const clock_rate = 6_250_000; //6.25Mhz
//@TODO: Include a transalted version of the C VM for speed comparison and testing
//@TODO: Discuss with ... | gigatron.zig |
const std = @import("std");
const debug = std.debug;
const io = std.io;
const mem = std.mem;
const meta = std.meta;
const testing = std.testing;
pub fn encode(writer: anytype, value: anytype) !void {
const T = @TypeOf(value);
switch (@typeInfo(T)) {
.Int => try writer.writeIntNative(T, value),
... | src/reflect.zig |
const uefi = @import("std").os.uefi;
// const L = @import("std").unicode.utf8ToUtf16LeStringLiteral;
const platform = @import("arch/x86/platform.zig");
const fmt = @import("std").fmt;
const psf2 = @import("fonts/psf2.zig");
const Color = @import("color.zig");
const uefiConsole = @import("uefi/console.zig");
var graphi... | src/kernel/graphics.zig |
const std = @import("std");
pub const BOOTBOOT_MAGIC = "BOOT";
/// memory mapped IO virtual address
pub const BOOTBOOT_MMIO: u64 = 0xfffffffff8000000;
/// frame buffer virtual address
pub const BOOTBOOT_FB: u64 = 0xfffffffffc000000;
/// bootboot struct virtual address
pub const BOOTBOOT_INFO: u64 = 0xffffffffffe000... | src/bootboot.zig |
const cpu = @import("mk20dx256.zig");
const Bank = enum {
A, B, C, D, E
};
const IO = struct {
bank: Bank,
shift: u5,
};
const IoMap = [_]IO{
IO{ .bank = Bank.B, .shift = 16 }, // GPIO 0
IO{ .bank = Bank.B, .shift = 17 }, // GPIO 1
IO{ .bank = Bank.D, .shift = 0 }, // GPIO 2
IO{ .bank = B... | src/teensy3_2/gpio.zig |
const std = @import("std");
const stdx = @import("stdx");
const stbi = @import("stbi");
const Point2 = stdx.math.Point2;
const graphics = @import("../../graphics.zig");
const gpu = graphics.gpu;
const RectBinPacker = graphics.RectBinPacker;
const log = stdx.log.scoped(.font_atlas);
/// Holds a buffer of font glyphs i... | graphics/src/backend/gpu/font_atlas.zig |
const std = @import("std");
const math = std.math;
pub const colorspace = @import("color/colorspace.zig");
/// This implements [CIE XYZ](https://en.wikipedia.org/wiki/CIE_1931_color_space)
/// color types. These color spaces represent the simplest expression of the
/// full-spectrum of human visible color. No attempt... | src/color.zig |
const std = @import("std");
const input = @import("input.zig");
pub fn run(stdout: anytype) anyerror!void {
{
var input_ = try input.readFile("inputs/day25");
defer input_.deinit();
const result = try part1(137, 139, &input_);
try stdout.print("25a: {}\n", .{ result });
st... | src/day25.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;
pub fn main() !void {
var file = try std.fs.... | src/day02.zig |
const std = @import("std");
const c = @cImport({
@cInclude("sqlite3.h");
});
pub const SQLiteExtendedIOError = error{
SQLiteIOErrRead,
SQLiteIOErrShortRead,
SQLiteIOErrWrite,
SQLiteIOErrFsync,
SQLiteIOErrDirFsync,
SQLiteIOErrTruncate,
SQLiteIOErrFstat,
SQLiteIOErrUnlock,
SQLite... | error.zig |
const std = @import("std");
const input = @embedFile("data/input10");
usingnamespace @import("util.zig");
pub fn main() !void {
var allocator_state = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer allocator_state.deinit();
const allocator = &allocator_state.allocator;
const values = try ... | src/day10.zig |
const std = @import("std");
const assert = std.debug.assert;
const allocator = std.testing.allocator;
pub const FFT = struct {
const base_pattern = [_]i8{ 0, 1, 0, -1 };
signal: []u8,
times: usize,
pub fn init() FFT {
var self = FFT{
.signal = undefined,
.times = 0,
... | 2019/p16/fft.zig |
const std = @import("std");
const testing = std.testing;
pub const StringTable = struct {
allocator: *std.mem.Allocator,
p2s: std.ArrayList([]const u8),
s2p: std.StringHashMap(usize),
pub fn init(allocator: *std.mem.Allocator) StringTable {
var self = StringTable{
.allocator = allo... | 2021/util/strtab.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>... | target/generated-sources/gizmo/io/quarkus/deployment/steps/NarayanaJtaProcessor$build2.zig |
const std = @import("std");
const c = @import("c.zig");
const glsl = @cImport({
@cInclude("sokol/sokol_gfx.h");
@cInclude("shaders/cube.glsl.h");
});
pub const ViewportState = struct {
pipeline: c.sg_pipeline = std.mem.zeroes(c.sg_pipeline),
bindings: c.sg_bindings = std.mem.zeroes(c.sg_bi... | src/3d_viewport.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const StringHashMap = std.StringHashMap;
const ArrayList = std.ArrayList;
const TailQueue = std.TailQueue;
pub fn DepsGraph(comptime T: type) type {
return struct {
allocator: *Allocator,
// All the pointers to symbols inside this str... | src/deps_graph.zig |
const std = @import("std");
const testing = std.testing;
const input_file = "input02.txt";
const PasswordPolicy = struct {
min: u32,
max: u32,
char: u8,
};
fn parsePasswordPolicy(policy: []const u8) !PasswordPolicy {
var iter = std.mem.split(policy, " ");
const min_max = iter.next() orelse return... | src/02.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const walkdir = @import("walkdir");
const Entry = walkdir.Entry;
const regex = @import("regex");
const Regex = regex.Regex;
pub const TypeFilter = struct {
file: bool = false,
directory: bool = false,
symlink: bool = false,
executable: bool... | src/filter.zig |
const types = @import("types.zig");
usingnamespace @import("method.zig");
const email = struct {
const Record = struct {
// meta
id: types.Id,
blob_id: types.Id,
thread_id: types.Id,
mailbox_ids: JsonStringMap(bool),
keywords: JsonStringMap(bool),
size: types... | mail/email.zig |
const std = @import("std");
const builtin = @import("builtin");
/// This is the TinyVG magic number which recognizes the icon format.
/// Magic numbers might seem unnecessary, but they will be the first
/// guard in line against bad input and prevent unnecessary cycles
/// to detect those.
pub const magic_number = [2]... | src/lib/tinyvg.zig |
const std = @import("std");
const aws = @import("aws.zig");
const json = @import("json.zig");
var verbose = false;
pub fn log(
comptime level: std.log.Level,
comptime scope: @TypeOf(.EnumLiteral),
comptime format: []const u8,
args: anytype,
) void {
// Ignore awshttp messages
if (!verbose and ... | src/main.zig |
const c = @import("c.zig");
const std = @import("std");
const panic = std.debug.panic;
const debug_gl = @import("debug_gl.zig");
const glfw_impl = @import("glfw_impl.zig");
const gl3_impl = @import("gl3_impl.zig");
export fn errorCallback(err: c_int, description: [*c]const u8) void {
panic("Error: {}\n", .{descript... | examples/imgui-dice-roller/src/main.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const maxInt = std.math.maxInt;
const elf = std.elf;
const vdso = @import("linux/vdso.zig");
const dl = @import("../dynamic_library.zig");
pub usingnamespace switch (builtin.arch) {
.i386 => @import("linux/i386.... | lib/std/os/linux.zig |
const std = @import("std.zig");
const builtin = @import("builtin");
const time = std.time;
const testing = std.testing;
const assert = std.debug.assert;
const SpinLock = std.SpinLock;
const linux = std.os.linux;
const windows = std.os.windows;
pub const ThreadParker = switch (builtin.os) {
.linux => if (builtin.li... | lib/std/parker.zig |
//! A thread-safe resource which supports blocking until signaled.
//! This API is for kernel threads, not evented I/O.
//! This API requires being initialized at runtime, and initialization
//! can fail. Once initialized, the core operations cannot fail.
//! If you need an abstraction that cannot fail to be initializ... | lib/std/ResetEvent.zig |
const std = @import("std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const testing = std.testing;
const os = std.os;
const math = std.math;
pub const epoch = @import("time/epoch.zig");
/// Spurious wakeups are possible and no precision of timing is guaranteed.
pub fn sleep(nanoseconds:... | lib/std/time.zig |
const Seat = @This();
const std = @import("std");
const log = std.log;
const os = std.os;
const wayland = @import("wayland");
const wl = wayland.client.wl;
const ext = wayland.client.ext;
const xkb = @import("xkbcommon");
const Lock = @import("Lock.zig");
const gpa = std.heap.c_allocator;
lock: *Lock,
name: u32,
... | src/Seat.zig |
const std = @import("../std.zig");
const utils = std.crypto.utils;
const mem = std.mem;
pub const Poly1305 = struct {
pub const block_length: usize = 16;
pub const mac_length = 16;
pub const key_length = 32;
// constant multiplier (from the secret key)
r: [3]u64,
// accumulated hash
h: [3]... | lib/std/crypto/poly1305.zig |
const std = @import("std");
const mem = std.mem;
const ascii = @import("../../ascii.zig");
const Context = @import("../../Context.zig");
const Self = @This();
context: *Context,
pub fn new(ctx: *Context) Self {
return Self{ .context = ctx };
}
// isDecimal detects all Unicode digits.
pub fn isDecimal(self: Sel... | src/components/aggregate/Number.zig |
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const utils = @import("utils.zig");
const Handles = @import("handles.zig").Handles;
const SparseSet = @import("sparse_set.zig").SparseSet;
const ComponentStorage = @import("component_storage.zig").ComponentStorage;
const S... | src/ecs/registry.zig |
const builtin = @import("builtin");
const std = @import("std");
const Builder = std.build.Builder;
const Pkg = std.build.Pkg;
const sokol_build = @import("deps/sokol/build.zig");
const stb_build = @import("deps/stb/build.zig");
const imgui_build = @import("deps/imgui/build.zig");
const filebrowser_build = @import("dep... | src/build.zig |
//--------------------------------------------------------------------------------
// Section: Types (2)
//--------------------------------------------------------------------------------
pub const CONDITION_TYPE = enum(i32) {
AND_CONDITION = 0,
OR_CONDITION = 1,
NOT_CONDITION = 2,
LEAF_CONDITION = 3,
... | win32/system/search/common.zig |
const std = @import("std");
const assert = std.debug.assert;
const StringTable = @import("./strtab.zig").StringTable;
const allocator = std.testing.allocator;
pub const Map = struct {
bodies: StringTable,
parent: [4096]?usize,
pub fn init() Map {
var self = Map{
.bodies = StringTable.... | 2019/p06/map.zig |
const std = @import("std");
const hasEnv = std.process.hasEnvVarConstant;
pub const CI = enum {
gerrit,
azure_pipelines,
bitrise,
buddy,
buildkite,
cirrus,
gitlab,
appveyor,
circle_ci,
semaphore,
drone,
dsari,
github_actions,
tddium,
strider,
taskcluster,... | src/lib.zig |
/// A set of (micro-) benchmarks for the zig programming language
const std = @import("std");
//const format = std.fmt.format;
//const warn = std.debug.warn;
const print = std.debug.print;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const fib = @import("fib.zig");
const perfect = @import("perfect.zig");
const ... | Zig/benchmark/src/main.zig |
const std = @import("std");
const zs = @import("zstack.zig");
const Coord = zs.Coord;
const Piece = zs.Piece;
const Engine = zs.Engine;
/// Represents a relative rotation that can be applied to a piece.
pub const Rotation = enum(i8) {
Clockwise = 1,
AntiClockwise = -1,
Half = 2,
};
const Wallkick = Coord... | src/rotation.zig |
const std = @import("std");
const warn = std.debug.warn;
const assert = std.debug.assert;
const types = @import("types.zig");
/// Instructions in byte-code as described in
/// https://docs.oracle.com/javase/specs/jvms/se14/html/jvms-6.html#jvms-6.5
const Inst = enum(u8) {
iload_0 = 26,
iload_1 = 27,
iadd =... | src/vm.zig |
const std = @import("std");
const sdl = @cImport({
@cDefine("SDL_MAIN_HANDLED", "");
@cInclude("SDL.h");
});
const SCREEN_WIDTH = 480;
const SCREEN_HEIGHT = 640;
pub fn main() anyerror!void {
std.log.info("starting app\n", .{});
if (sdl.SDL_Init(sdl.SDL_INIT_VIDEO | sdl.SDL_INIT_AUDIO | sdl.SDL_INIT_... | src/main.zig |
const std = @import("std");
const CrossTarget = std.zig.CrossTarget;
const TestContext = @import("../src/test.zig").TestContext;
const linux_x86_64 = CrossTarget{
.cpu_arch = .x86_64,
.os_tag = .linux,
.abi = .musl,
};
const macos_x86_64 = CrossTarget{
.cpu_arch = .x86_64,
.os_tag = .macos,
.ab... | test/test.zig |
const std = @import("std");
const interop = @import("../interop.zig");
const iup = @import("../iup.zig");
const Impl = @import("../impl.zig").Impl;
const CallbackHandler = @import("../callback_handler.zig").CallbackHandler;
const debug = std.debug;
const trait = std.meta.trait;
const Element = iup.Element;
const H... | src/elements/drop_button.zig |
const std = @import("std");
const chipz = @import("chipz");
const Key = chipz.Key;
const c = @cImport({
@cInclude("SDL.h");
});
const DISPLAY_EVENT : u32 = 0;
fn manage_timer_callback(interval : u32, params : ?*c_void) callconv(.C) u32 {
if(params) |ptr| {
var timer = @ptrCast(*u8, ptr);
if... | src/main.zig |
const std = @import("std");
const zigimg = @import("zigimg");
const helpers = @import("../helpers.zig");
const jpeg = zigimg.jpeg;
const errors = zigimg.errors;
const color = zigimg.color;
const testing = std.testing;
test "Should error on non JPEG images" {
const file = try helpers.testOpenFile(helpers.zigimg_te... | tests/formats/jpeg_test.zig |
const uefi = @import("std").os.uefi;
const fmt = @import("std").fmt;
const Writer = @import("std").io.Writer;
pub var con_out: *uefi.protocols.SimpleTextOutputProtocol = undefined;
pub const ConsoleColors = enum(u8) {
Black = uefi.protocols.SimpleTextOutputProtocol.black,
Blue = uefi.protocols.SimpleTextOutpu... | stage1/uefi/console.zig |
const clap = @import("clap");
const std = @import("std");
const util = @import("util.zig");
const debug = std.debug;
const fmt = std.fmt;
const heap = std.heap;
const io = std.io;
const math = std.math;
const mem = std.mem;
const testing = std.testing;
pub const test_case = @embedFile("test_file.tm35");
pub const Te... | src/common/testing.zig |
const std = @import("std");
const warn = std.debug.warn;
const Allocator = std.mem.Allocator;
const TreeNode = struct {
l: ?*TreeNode,
r: ?*TreeNode,
pub fn new(a: *Allocator, l: ?*TreeNode, r: ?*TreeNode) !*TreeNode {
var node = try a.create(TreeNode);
node.l = l;
node.r = r;
... | test/binary_trees.zig |
const std = @import("std");
const util = @import("util.zig");
const File = @This();
id: Id,
ref_count: u16,
var all: std.AutoHashMap(Id, File) = undefined;
var incr: util.AutoIncr(Id, 3) = .{};
pub fn open(path: []const u8, flags: Flags, perm: Mode) !*File {
const fid = incr.next(all);
if (true) {
u... | src/File.zig |
extern fn glBlendColor(_: f32, _: f32, _: f32, _: f32) void;
extern fn glBlendEquation(_: c_uint) void;
extern fn glBlendEquationSeparate(_: c_uint, _: c_uint) void;
extern fn glBlendFunc(_: c_uint, _: c_uint) void;
extern fn glBlendFuncSeparate(_: c_uint, _: c_uint, _: c_uint, _: c_uint) void;
extern fn glDepthFunc(_:... | src/webgl.zig |
const std = @import("std");
pub const Key = struct {
const Self = @This();
index: u32,
version: u32,
pub fn equals(lhs: Self, rhs: Self) bool {
return lhs.index == rhs.index and lhs.version == rhs.version;
}
};
fn Slot(comptime T: type) type {
return struct {
const Self = @Th... | src/lib/slotmap.zig |
const std = @import("std");
const Date = @import("date.zig");
const Arguments = @import("args.zig");
const util = @import("util.zig");
const config = @import("config.zig");
const testing = std.testing;
args: *Arguments,
next_token: ?Token = null,
const Self = @This();
const Token = union(enum) {
month_name: Dat... | src/lexer.zig |
const x86_64 = @import("../index.zig");
const bitjuggle = @import("bitjuggle");
const std = @import("std");
const formatWithoutFields = @import("../common.zig").formatWithoutFields;
/// Extended feature enable mask register
pub const XCr0 = packed struct {
/// Enables x87 FPU
x87: bool,
/// Enables 128-bi... | src/registers/xcontrol.zig |
// SPDX-License-Identifier: MIT
// This file is part of the Termelot project under the MIT license.
const c = @cImport({
@cInclude("sys/ioctl.h");
@cInclude("sys/time.h");
@cInclude("termios.h");
});
const builtin = @import("builtin");
const std = @import("std");
const Allocator = std.mem.Allocator;
const... | src/backend/termios.zig |
const std = @import("std");
const crypto = std.crypto;
const debug = std.debug;
const fmt = std.fmt;
const mem = std.mem;
const c = @import("c.zig");
const global = @import("global.zig");
// Big thank-you to Electronic Frontier Foundation (EFF) for the improved
// wordlist.
//
// https://www.eff.org/deeplinks/2016/... | src/algorithm.zig |
impl: Impl = .{},
const std = @import("../std.zig");
const builtin = @import("builtin");
const Condition = @This();
const windows = std.os.windows;
const linux = std.os.linux;
const Mutex = std.Thread.Mutex;
const assert = std.debug.assert;
const testing = std.testing;
pub fn wait(cond: *Condition, mutex: *Mutex) vo... | lib/std/Thread/Condition.zig |
const std = @import("std");
const File = std.fs.File;
pub const ESC = "\x1b";
pub const CSI = ESC ++ "[";
pub var stdout: File = undefined;
pub var stdout_buffer: std.io.BufferedWriter(2048, File.Writer) = undefined;
pub var stderr: File = undefined;
pub fn init() void {
stdout = std.io.getStdOut();
stdout_b... | fexc/src/term.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const parseInt = @import("parseInt.zig").parse;
const passports = @embedFile("input04.txt");
fn isSpace(string: []const u8) bool {
for (string) |c| {
if (!std.ascii.isSpace(c))
... | src/day04.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const fs = std.fs;
const math = std.math;
const draw = @import("pixel_draw.zig");
const Texture = draw.Texture;
usingnamespace draw.vector_math;
pub const Block = struct {
id: u16 = 0,
texture: draw.Texture,
};
... | src/voxel.zig |
pub const CONSOLE_TEXTMODE_BUFFER = @as(u32, 1);
pub const ATTACH_PARENT_PROCESS = @as(u32, 4294967295);
pub const CTRL_C_EVENT = @as(u32, 0);
pub const CTRL_BREAK_EVENT = @as(u32, 1);
pub const CTRL_CLOSE_EVENT = @as(u32, 2);
pub const CTRL_LOGOFF_EVENT = @as(u32, 5);
pub const CTRL_SHUTDOWN_EVENT = @as(u32, 6);
pub c... | win32/system/console.zig |
const std = @import("std");
const gui = @import("./gui/ui.zig");
const cli = @import("./cli/ui.zig");
const args = @import("./args.zig");
const patternMatch = @import("./patterns.zig").patternMatch;
// const layout = @import("./gui/layout.zig");
//
// comptime {
// std.testing.refAllDecls(layout);
// }
pub cons... | 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/day09.txt", run);
const Vec2 = tools.Vec2;
const M... | 2021/day09.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 {
var pots = [_]u1{0} ** 1000;
const pot_offset = pots.len / 2;
var pot_min: usize = 1000;
var pot_max: usize = 0;
var rules = [_]u... | 2018/day12.zig |
const std = @import("std");
const Atomic = std.atomic.Atomic;
const utils = @import("../utils.zig");
pub const Lock =
if (utils.is_windows)
WindowsLock
else if (utils.is_darwin)
DarwinLock
else if (utils.is_linux)
LinuxLock
else
void;
const DarwinLock = extern struct ... | locks/os_raw_lock.zig |
const std = @import("std");
const builtin = @import("builtin");
const minInt = std.math.minInt;
const maxInt = std.math.maxInt;
const expect = std.testing.expect;
test "wrapping add" {
const S = struct {
fn doTheTest() !void {
try testWrapAdd(i8, -3, 10, 7);
try testWrapAdd(i8, -128... | test/behavior/wrapping_arithmetic.zig |
pub usingnamespace @import("prompt.zig");
usingnamespace if (@import("root") == @This())
struct {
const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
const ascii = std.ascii;
const Allocator = mem.Allocator;
const Stream = std.fs.F... | src/zomp.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const data = @embedFile("../inputs/day13.txt");
pub fn main() anyerror!void {
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa_impl.deinit();
const gpa = gpa_impl.allocator();
return m... | src/day13.zig |
const std = @import("std");
const Parser = @import("main.zig").Parser;
pub fn main() void {
const json =
\\{
\\ "type": "FeatureCollection",
\\ "features": [{
\\ "type": "Feature",
\\ "geometry": {
\\ "type": "Point",
\\ "c... | src/example.zig |
const std = @import("std");
const token = @import("../token.zig");
const ast = @import("../ast.zig");
const fieldNames = std.meta.fieldNames;
const eq = std.mem.eql;
const TokenError = token.TokenError;
const Token = token.Token;
const Kind = Token.Kind;
const Op = Token.Kind.Op;
const Tty = @import("./type.zig").@"Typ... | src/lang/token/kw.zig |
const std = @import("std");
const print = std.debug.print;
const input_file = @embedFile("input.txt");
const BagRule = struct {
count: u32, color: []const u8
};
fn parseInput(allocator: *std.mem.Allocator) !std.StringHashMap([]BagRule) {
var bag_map = std.StringHashMap([]BagRule).init(allocator);
errdefe... | 2020/07/main.zig |
const mecha = @import("mecha");
const std = @import("std");
const event = std.event;
const fs = std.fs;
const heap = std.heap;
const log = std.log;
const Message = @import("../message.zig").Message;
pub fn mem(channel: *event.Channel(Message)) void {
const loop = event.Loop.instance.?;
const cwd = fs.cwd();
... | src/producer/mem.zig |
const std = @import("std");
const args_parser = @import("args");
const zigimg = @import("img");
const qoi = @import("qoi.zig");
const total_rounds = 8;
pub fn main() !u8 {
const allocator = std.heap.c_allocator; // for perf
var cli = args_parser.parseForCurrentProcess(struct {}, allocator, .print) catch retu... | src/bench-files.zig |
const std = @import("std");
const mem = std.mem;
const math = std.math;
const common = @import("common.zig");
const instruction = @import("instruction.zig");
const opcode = @import("opcode.zig");
const Function = @import("function.zig").Function;
const Module = @import("module.zig").Module;
const Store = @import("store... | src/instance.zig |
const std = @import("std");
const upaya = @import("../upaya.zig");
pub const Tilemap = struct {
w: usize,
h: usize,
layers: []Layer,
current_layer: usize = 0,
pub const Layer = struct {
name: []const u8,
data: []u8,
pub fn init(name: []const u8, size: usize) Layer {
... | src/tilemaps/tilemap.zig |
const build_options = @import("build_options");
const std = @import("std");
const fs = std.fs;
const log = std.log;
const mem = std.mem;
const DotEnv = @import("dotenv.zig").DotEnv;
const utils = @import("utils.zig");
const fatal = utils.fatal;
pub const Release = struct {
boot_script: []const u8,
boot_script... | src/release.zig |
const builtin = @import("builtin");
const std = @import("index.zig");
const io = std.io;
const mem = std.mem;
const MH_MAGIC_64 = 0xFEEDFACF;
const MH_PIE = 0x200000;
const LC_SYMTAB = 2;
const MachHeader64 = packed struct {
magic: u32,
cputype: u32,
cpusubtype: u32,
filetype: u32,
ncmds: u32,
... | std/macho.zig |
const flags_ = @import("../flags.zig");
const CreateFlags = flags_.CreateFlags;
const FieldFlagsDef = flags_.FieldFlagsDef;
// https://wiki.nesdev.com/w/index.php?title=PPU_registers
// slightly diverges from nesdev, the last char of flags 0 and 1 are made lowercase
pub fn RegisterMasks(comptime T: type) type {
re... | src/ppu/common.zig |
const builtin = @import("builtin");
const Os = builtin.Os;
const os = @import("index.zig");
const io = @import("../io.zig");
pub const UserInfo = struct.{
uid: u32,
gid: u32,
};
/// POSIX function which gets a uid from username.
pub fn getUserInfo(name: []const u8) !UserInfo {
return switch (builtin.os) {... | std/os/get_user_id.zig |
const std = @import("std");
const elf = std.elf;
const arch = @import("./arch.zig");
const table = @import("../table-helper/table-helper.zig");
const SectionHeader = @import("./SectionHeader.zig");
//usingnamespace @import("./arch.zig");
const elfErrors = error{
CannotTellIfBinaryIs32or64bit,
};
pub const ELF = st... | src/elf.zig |
const std = @import("std");
const testing = std.testing;
const Allocator = std.mem.Allocator;
/// QueryParameters is an alias for a String HashMap
pub const QueryParameters = std.StringHashMap([]const u8);
/// Possible errors when parsing query parameters
const QueryError = error{ MalformedUrl, OutOfMemory, InvalidCh... | src/url.zig |
const std = @import("std");
const assert = std.debug.assert;
const allocator = std.heap.page_allocator;
const Computer = @import("./computer.zig").Computer;
pub const Pos = struct {
const OFFSET: usize = 10000;
x: usize,
y: usize,
pub fn init(x: usize, y: usize) Pos {
return Pos{
... | 2019/p17/map.zig |
const std = @import("std");
const glfw = @import("zglfw");
const gl = @import("zgl");
pub fn main() anyerror!void {
var gpa_state = std.heap.GeneralPurposeAllocator(.{}){};
const gpa = &gpa_state.allocator;
{
var maj: i32 = undefined;
var min: i32 = undefined;
var rev: i32 = undefi... | src/main.zig |
const std = @import("std");
const zlm = @import("zlm");
pub const c = @cImport(@cInclude("GLES3/gl3.h"));
// add to this as needed, there's a lot and i'd rather not list them all
pub const Feature = enum(c.GLenum) {
depth_test = c.GL_DEPTH_TEST,
cull_face = c.GL_CULL_FACE,
};
pub fn enable(feature: Feature)... | src/render/gl.zig |
use @import("./4_0_tokenization.zig");
fn ParseAnPlusB(p: Parser) -> %AnPlusB {
var ab = AnPlusB{};
ab.parse(p, false);
ab;
}
const AnPlusB = struct {
a: i32,
b: i32,
pub fn string(self: &const AnPlusB) -> string {
a.string() + (if (b >= 0) "n+" else "n") + b.string()
}
fn parse(self: &AnPlusB,... | parser/6_0_an_b_microsyntax.zig |
const Self = @This();
const utils = @import("utils");
const Ansi = utils.AnsiEscProcessor;
pub const HexColor = Ansi.HexColor;
pub const Layer = Ansi.Layer;
row: u32 = undefined,
column: u32 = undefined,
width: u32 = undefined,
height: u32 = undefined,
ansi: Ansi = undefined,
utf32_buffer: [128]u32 = undefined,
utf8... | kernel/Console.zig |