code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const ErasedPtr = @import("../ecs/utils.zig").ErasedPtr;
/// Simple cache for resources of a given type. If any resource has a deinit method it will be called when clear
/// or remove is called. Implementing a "loader" which is passed to "load" is a struct with one method:
/// - load(self: ... | src/resources/cache.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const crypto = std.crypto;
const debug = std.debug;
const fmt = std.fmt;
const mem = std.mem;
const unicode = std.unicode;
const c = @cImport({
@cInclude("argon2.h");
});
const id = "com.alamlintang.lappland";
pub const Error = error{OutOfMemory};
pub... | src/algorithm.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;
const ListView = @This();
widget: gui.Widget,
allocator: *Allocator,
vertical_scrollbar: *gui.Scrollbar,
horizontal_scrollbar: *gui.Scrollb... | src/gui/widgets/ListView.zig |
const std = @import("std");
const debug = std.debug;
const log = std.log;
const mem = std.mem;
const math = std.math;
const Allocator = mem.Allocator;
const TailQueue = std.TailQueue;
const ArrayList = std.ArrayList;
const Instruction = @import("instruction.zig").Instruction;
const Orientation = enum(u1) {
left_t... | day22/src/deck.zig |
const std = @import("std");
const print = std.debug.print;
const fmt = std.fmt;
const testing = std.testing;
const mem = std.mem;
fn getChar(i: u8) u8 {
return if (i < 33 or i == 127) ' ' else i;
}
fn tableRows() [32][4]u8 {
var rows: [32][4]u8 = undefined;
var i: u8 = 0;
while (i <= 31) : (i += 1) {
... | src/main.zig |
const std = @import("std");
const page_alloc = @import("page_alloc.zig");
// modules
const builtin = std.builtin;
const debug = std.debug;
const math = std.math;
const mem = std.mem;
const os = std.os;
const testing = std.testing;
// functions
const assert = debug.assert;
// types
const Mutex = std.Mutex;
// consta... | chunk_alloc.zig |
const cpu = @import("cpu.zig");
// commands to send to serial devices
const Command = enum(u8) {
LineEnableDLab = 0x80,
};
/// ports for talking to serial devices
pub const Port = enum(u16) {
const Self = @This();
Com1 = 0x3F8,
Com2 = 0x2F8,
Com3 = 0x3E8,
Com4 = 0x2E8,
fn data(self: Sel... | osmium/driver/serial.zig |
pub const LoadedImageProtocol = @import("protocols/loaded_image_protocol.zig").LoadedImageProtocol;
pub const loaded_image_device_path_protocol_guid = @import("protocols/loaded_image_protocol.zig").loaded_image_device_path_protocol_guid;
pub const AcpiDevicePath = @import("protocols/device_path_protocol.zig").AcpiDevi... | lib/std/os/uefi/protocols.zig |
const std = @import("std");
const c = @import("./c.zig").c;
const SAMPLE_RATE = 48000;
const CHANNELS = 2;
const BIT_DEPTH = 16;
const DEVICE_SAMPLES = 1024; // high enough not to crackle, low enough to not have much delay
pub const OpusFile = struct {
pub const Error = error{
OpenMemoryFailed,
Re... | src/audio.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = std.mem.Allocator;
const Value = @import("value.zig").Value;
const Type = @import("type.zig").Type;
const TypedValue = @import("TypedValue.zig");
const assert = std.debug.assert;
const ir = @import("ir.zig");
const zir = @import("zir.zig");
const Modul... | tests/samples/count/zir_sema.zig/zir_sema.zig |
const wlr = @import("../wlroots.zig");
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const XdgDecorationManagerV1 = extern struct {
global: *wl.Global,
decorations: wl.list.Head(XdgToplevelDecorationV1, "link"),
server_destroy: wl.Listener(*wl.Server),
events: extern struct {... | src/types/xdg_decoration_v1.zig |
const std = @import("std");
const fmt = std.fmt;
/// A parser that consumes one full reply and discards it. It's written as a
/// dedicated parser because it doesn't require recursion to consume the right
/// amount of input and, given the fact that the type doesn't "peel away",
/// recursion would look unbounded to t... | src/parser/void.zig |
const c = @cImport({
@cInclude("cfl_button.h");
});
const widget = @import("widget.zig");
const enums = @import("enums.zig");
pub const Button = struct {
inner: ?*c.Fl_Button,
pub fn new(x: i32, y: i32, w: i32, h: i32, title: [*c]const u8) Button {
const ptr = c.Fl_Button_new(x, y, w, h, title);
... | src/button.zig |
const std = @import("std");
const assert = std.debug.assert;
const builtin = @import("builtin");
const net = std.net;
const os = std.os;
const IO_Uring = os.linux.IO_Uring;
const io_uring_cqe = os.linux.io_uring_cqe;
const Event = packed struct {
fd: i32,
op: Op,
};
const Op = enum(u32) {
Accept,
Recv... | demos/io_uring/net_io_uring.zig |
const DaisyChain = @import("DaisyChain.zig");
const CTC = @This();
channels: [NumChannels]Channel = [_]Channel{.{}} ** NumChannels,
// reset the CTC chip
pub fn reset(self: *CTC) void {
for (self.channels) |*chn| {
chn.control = Ctrl.RESET;
chn.constant = 0;
chn.down_counter = 0;
... | src/emu/CTC.zig |
const std = @import("std");
const Memory = @This();
pages: std.ArrayListUnmanaged(*[65536]u8),
allocator: *std.mem.Allocator,
context: ?*c_void,
const page_size = 65536;
pub fn init(allocator: *std.mem.Allocator, context: ?*c_void, initial_pages: u16) !Memory {
var result = Memory{ .allocator = allocator, .page... | src/Memory.zig |
const std = @import("std");
const alka = @import("alka.zig");
const m = alka.math;
const utils = @import("core/utils.zig");
const UniqueList = utils.UniqueList;
const alog = std.log.scoped(.alka_gui);
/// Error Set
pub const Error = error{ GUIisAlreadyInitialized, GUIisNotInitialized, InvalidCanvasID } || alka.Error... | src/gui.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const assert = std.debug.assert;
const testing = std.testing;
const mustache = @import("../mustache.zig");
const TemplateOptions = mustache.options.TemplateOptions;
const ref_counter = @import("ref_counte... | src/parsing/file_reader.zig |
const std = @import("std");
const builtin = @import("builtin");
const allocators = @import("allocators.zig");
const temp_alloc = allocators.temp_arena.allocator();
const languages = @import("languages.zig");
const lua = @import("lua.zig");
//[[!! quiet() fs.put_file_contents('limp.bc.lua', string.dump(load_file('limp.... | limp/processor.zig |
const std = @import("std");
const utils = @import("utils.zig");
const ID3 = @import("zid3.zig").ID3;
const FrameTypes = union {
text: TextFrame,
link: UrlLinkFrame,
comment: CommentFrame,
};
pub const FrameHeader = struct {
id: [4]u8,
size: [4]u8,
flags: [2]u8,
content: []u8,
const Sel... | src/frames.zig |
const std = @import("std");
const expect = std.testing.expect;
pub const DynamicInput = struct {
time: f32,
value: f32,
};
pub const SimInputs = struct {
time_slice_length: f32,
starting_temp: f32,
set_point_temp: f32,
cold_water_temp: f32,
solar_irradiance: []DynamicInput,
stc_panel_a... | src/simulator.zig |
pub const WNODE_FLAG_ALL_DATA = @as(u32, 1);
pub const WNODE_FLAG_SINGLE_INSTANCE = @as(u32, 2);
pub const WNODE_FLAG_SINGLE_ITEM = @as(u32, 4);
pub const WNODE_FLAG_EVENT_ITEM = @as(u32, 8);
pub const WNODE_FLAG_FIXED_INSTANCE_SIZE = @as(u32, 16);
pub const WNODE_FLAG_TOO_SMALL = @as(u32, 32);
pub const WNODE_FLAG_INS... | win32/system/diagnostics/etw.zig |
const std = @import("std");
const testing = std.testing;
const input_file = "input02.txt";
const PasswordPolicy = struct {
pos_1: u32,
pos_2: u32,
char: u8,
};
fn parsePasswordPolicy(policy: []const u8) !PasswordPolicy {
var iter = std.mem.split(policy, " ");
const pos_1_pos_2 = iter.next() orels... | src/02_2.zig |
const AtomicOrder = @import("builtin").AtomicOrder;
const Vector = @import("vector.zig").Vector(f32);
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const warn = std.debug.warn;
const allocator = std.heap.page_allocator;
const Math= std.math;
const json = std.json;
... | zig/lib.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
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 g... | src/day21.zig |
pub const WINBIO_MAX_STRING_LEN = @as(u32, 256);
pub const WINBIO_SCP_VERSION_1 = @as(u32, 1);
pub const WINBIO_SCP_RANDOM_SIZE_V1 = @as(u32, 32);
pub const WINBIO_SCP_DIGEST_SIZE_V1 = @as(u32, 32);
pub const WINBIO_SCP_CURVE_FIELD_SIZE_V1 = @as(u32, 32);
pub const WINBIO_SCP_PUBLIC_KEY_SIZE_V1 = @as(u32, 65);
pub cons... | deps/zigwin32/win32/devices/biometric_framework.zig |
const std = @import("std");
const Sequence = @import("../sequence.zig").Sequence;
const utils = @import("../utils.zig");
pub fn FastaReader(comptime A: type) type {
return struct {
const Self = @This();
allocator: std.mem.Allocator,
source: *std.io.StreamSource,
reader: std.io.B... | src/io/fasta_reader.zig |
const std = @import("std");
const Module = @import("module.zig");
const Op = @import("op.zig");
const Execution = @import("execution.zig");
const Memory = @import("Memory.zig");
const Instance = @This();
module: *const Module,
allocator: *std.mem.Allocator,
memory: Memory,
exports: std.StringHashMap(Export),
funcs: ... | src/instance.zig |
/// Generic Matrix4x4 Type, right handed column major
pub fn Generic(comptime T: type) type {
switch (T) {
f16, f32, f64, f128, i16, i32, i64, i128 => {
return struct {
const Self = @This();
m0: T = 0,
m4: T = 0,
m8: T = 0,
... | src/core/math/mat4x4.zig |
const std = @import("std");
const io = std.io;
const Allocator = std.mem.Allocator;
pub fn main() anyerror!void {
var buf: [4000]u8 = undefined;
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const alloc = &arena.allocator;
var code = try Code.init(alloc... | day8/src/main.zig |
const std = @import("std");
const mem = std.mem;
const unicode = std.unicode;
const Context = @import("../../Context.zig");
const Ziglyph = @import("../../ziglyph.zig").Ziglyph;
const GraphemeIterator = @import("../../zigstr/GraphemeIterator.zig");
const Self = @This();
allocator: *mem.Allocator,
context: *Context,
... | src/components/aggregate/Width.zig |
const std = @import("std");
const Board = @import("types/Board.zig");
const Move = @import("types/Move.zig");
const MoveList = @import("types/MoveList.zig");
//const console = @import("utils/console.zig");
pub fn perft(board: *Board, depth: usize, root: bool) u64 {
var leaf_count: u64 = 0;
var move_list = M... | src/perft.zig |
pub const INCLUDED_FCI = @as(u32, 1);
pub const _A_NAME_IS_UTF = @as(u32, 128);
pub const _A_EXEC = @as(u32, 64);
pub const INCLUDED_TYPES_FCI_FDI = @as(u32, 1);
pub const CB_MAX_DISK = @as(i32, 2147483647);
pub const CB_MAX_FILENAME = @as(u32, 256);
pub const CB_MAX_CABINET_NAME = @as(u32, 256);
pub const CB_MAX_CAB_P... | win32/storage/cabinets.zig |
const std = @import("std");
const Token = union(enum) {
Identifier: []const u8,
Bool: bool,
String: []const u8,
Integer: i64,
OpenBracket: void,
CloseBracket: void,
Equals_Sign: void,
EOF: void,
};
const Tokenizer = struct {
data: []const u8,
col: u64 = 0,
line: u64 = 1,
... | src/toml.zig |
const std = @import("std");
const testing = std.testing;
const meta = std.meta;
const Allocator = std.mem.Allocator;
pub fn List(comptime T: type) type {
return struct {
const Node = struct {
prev: ?*this,
next: ?*this,
data: *T,
const this = @This();
... | src/main.zig |
const std = @import("std");
const json = std.json;
const zomb = @import("zomb");
pub fn main() anyerror!void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var input_file_contents = std.ArrayList(u8).init(gpa.allocator());
defer input_file_contents.deinit();
{
const args = try std.pro... | example/zomb2json.zig |
const std = @import("std");
const tvg = @import("tinyvg.zig");
pub const Header = struct {
version: u8,
scale: tvg.Scale,
color_encoding: tvg.ColorEncoding,
coordinate_range: tvg.Range,
width: u32,
height: u32,
};
const Point = tvg.Point;
const Rectangle = tvg.Rectangle;
const Line = tvg.Line... | src/lib/parsing.zig |
const std = @import("std");
const debug = std.debug;
const math = std.math;
const mem = std.mem;
pub const Patch = struct {
offset: usize,
replacement: []const u8,
};
pub fn patch(memory: []u8, patchs: []const Patch) void {
for (patchs) |p|
mem.copy(u8, memory[p.offset..], p.replacement);
}
pub ... | src/core/common.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const Node = @import("./node.zig").Node;
pub fn PriorityQueue(comptime T: type, comptime cmp: fn (T, T) std.math.Order) type {
return struct {
capacity: usize,
tail: usize,
items: []T,
allocator: Allocator,
co... | src/zig/src/pq.zig |
const std = @import("std");
const Logind = @import("systemd.zig").Logind;
const backend = @import("../backend.zig");
const epoll = @import("../../epoll.zig");
const Dispatchable = @import("../../epoll.zig").Dispatchable;
const c = @cImport({
@cInclude("libudev.h");
@cInclude("dirent.h");
@cInclude("libinpu... | src/backend/drm/input.zig |
const c = @import("c.zig");
const m = @import("math/math.zig");
const std = @import("std");
const alogg = std.log.scoped(.nil_core_gl);
/// Error set
pub const Error = std.mem.Allocator.Error;
// DEF
/// Buffer bits
pub const BufferBit = enum { depth, stencil, colour };
/// Buffer types
pub const BufferType = enu... | src/core/gl.zig |
const std = @import("index.zig");
const debug = std.debug;
const mem = std.mem;
const Allocator = mem.Allocator;
const assert = debug.assert;
const ArrayList = std.ArrayList;
const fmt = std.fmt;
/// A buffer that allocates memory and maintains a null byte at the end.
pub const Buffer = struct {
list: ArrayList(u... | std/buffer.zig |
const std = @import("std");
const os = std.os;
const io = std.io;
const mem = std.mem;
const Buffer = std.Buffer;
const llvm = @import("llvm.zig");
const c = @import("c.zig");
const builtin = @import("builtin");
const Target = @import("target.zig").Target;
const warn = std.debug.warn;
const Token = std.zig.Token;
const... | src-self-hosted/module.zig |
const std = @import("std");
const DocumentStore = @import("document_store.zig");
const ast = std.zig.ast;
const types = @import("types.zig");
const offsets = @import("offsets.zig");
const log = std.log.scoped(.analysis);
/// Get a declaration's doc comment node
pub fn getDocCommentNode(tree: *ast.Tree, node: *ast.Node... | src/analysis.zig |
const std = @import("std");
const link = @import("../link.zig");
const Module = @import("../Module.zig");
const Inst = @import("../ir.zig").Inst;
const Value = @import("../value.zig").Value;
const Type = @import("../type.zig").Type;
const C = link.File.C;
const Decl = Module.Decl;
const mem = std.mem;
/// Maps a na... | src-self-hosted/codegen/c.zig |
const kernel = @import("kernel.zig");
const TODO = kernel.TODO;
const log = kernel.log.scoped(.Scheduler);
const Virtual = kernel.Virtual;
pub const Context = kernel.arch.Context;
pub fn new_fn() noreturn {
while (true) {
log.debug("new process", .{});
}
}
pub var lock: kernel.arch.Spinlock = undefi... | src/kernel/scheduler.zig |
const std = @import("../index.zig");
const builtin = @import("builtin");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const mem = std.mem;
pub fn InStream(comptime ReadError: type) type {
return struct.{
const Self = @This();
pub const Error = ReadError;
/// Return... | std/event/io.zig |
const std = @import("std");
const list_tests = @import("list_tests.zig");
const heap = std.heap;
const mem = std.mem;
const CustomList = @import("list.zig").CustomList;
const testList = list_tests.testList;
// How to fuzz 101:
// You have made changes to the list and want to fuzz it? Firstm run the
// fuzzer in re... | src/core/list_fuzz.zig |
const std = @import("std");
const gpa = std.heap.c_allocator;
const zuri = @import("zuri");
const iguanatls = @import("iguanatls");
const u = @import("./../util/index.zig");
//
//
pub const Zpm = struct {
pub const Package = struct {
author: []const u8,
name: []const u8,
tags: [][]const u... | src/cmd/zpm_add.zig |
const qnan128 = @bitCast(f128, @as(u128, 0x7fff800000000000) << 64);
const inf128 = @bitCast(f128, @as(u128, 0x7fff000000000000) << 64);
const __multf3 = @import("mulXf3.zig").__multf3;
// return true if equal
// use two 64-bit integers intead of one 128-bit integer
// because 128-bit integer constant can't be assig... | lib/std/special/compiler_rt/mulXf3_test.zig |
const std = @import("std");
const string = []const u8;
const builtin = @import("builtin");
const zigmod = @import("../lib.zig");
const u = @import("index.zig");
const yaml = @import("./yaml.zig");
const common = @import("./../common.zig");
//
//
pub const Module = struct {
alloc: std.mem.Allocator,
is_sys_li... | src/util/module.zig |
const std = @import("std");
/// Processes are run by the Scheduler. They use a similar pattern to Allocators in that they are created and
/// added as fields in a parent struct, your actual process that will be run.
pub const Process = struct {
const State = enum(u8) { uninitialized, running, paused, succeeded, fa... | src/process/process.zig |
const std = @import("std");
const assert = std.debug.assert;
const Computer = @import("./computer.zig").Computer;
pub const Network = struct {
const SIZE: usize = 50;
pub const NAT = struct {
xcur: i64,
ycur: i64,
xprv: i64,
yprv: i64,
count: usize,
pub fn init... | 2019/p23/network.zig |
const std = @import("std");
const auto_detect = @import("build/auto-detect.zig");
fn sdkRoot() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
}
/// This file encodes a instance of an Android SDK interface.
const Sdk = @This();
/// The builder instance associated with this object.
b: *Builder,... | Sdk.zig |
const std = @import("std");
const opt = @import("opt.zig");
const stdout = &std.io.getStdOut().outStream();
const stdin = &std.io.getStdIn().inStream();
const VERSION = "0.0.1";
const BUFSIZE: usize = 4096;
const MAXLEN: usize = 39;
const ZIGUANA =
\\ . \ . .
\\ . \ _.... | src/zigsay.zig |
pub const DIRECTSOUND_VERSION = @as(u32, 1792);
pub const _FACDS = @as(u32, 2168);
pub const CLSID_DirectSound = Guid.initString("47d4d946-62e8-11cf-93bc-444553540000");
pub const CLSID_DirectSound8 = Guid.initString("3901cc3f-84b5-4fa4-ba35-aa8172b8a09b");
pub const CLSID_DirectSoundCapture = Guid.initString("b0210780... | win32/media/audio/direct_sound.zig |
const std = @import("std");
const builtin = @import("builtin");
const unicode = @import("unicode.zig");
pub const Utf8ToUtf32 = unicode.Utf8ToUtf32;
pub const UnicodeError = unicode.Error;
pub const AnsiEscProcessor = @import("AnsiEscProcessor.zig");
pub const Guid = @import("guid.zig");
pub const ToString = @impor... | libs/utils/utils.zig |
pub const Color = struct{
rgb: Value,
};
/// Value is the alpha-premultiplied red, green, blue and alpha values
/// for the color. Each value ranges within [0, 0xffff], but is represented
/// by a uint32 so that multiplying by a blend factor up to 0xffff will not
/// overflow.
///
/// An alpha-premultiplied color ... | src/image/color/index.zig |
usingnamespace @cImport({
@cInclude("roaring.h");
});
const std = @import("std");
///
pub const RoaringError = error {
///
allocation_failed,
///
frozen_view_failed,
///
deserialize_failed,
};
// Ensure 1:1 equivalence of roaring_bitmap_t and Bitmap
comptime {
if (@sizeOf(Bitmap) != @... | src/roaring.zig |
const std = @import("std");
const assert = std.debug.assert;
const main = @import("main.zig");
const c = main.c;
const renderer = @import("renderer.zig");
pub var ctx: *c.mu_Context = undefined;
pub fn init(allocator: *std.mem.Allocator) !void {
ctx = try allocator.create(c.mu_Context);
c.mu_init(ctx);
c... | src/gui.zig |
const std = @import("std");
fn sign(v: anytype) @TypeOf(v) {
if (v < 0) return -1;
if (v > 0) return 1;
return 0;
}
pub const Point = struct {
x: isize,
y: isize,
};
pub fn Canvas(
comptime Framebuffer: type,
comptime Pixel: type,
comptime setPixelImpl: fn (Framebuffer, x: isize, y: i... | painterz.zig |
const std = @import("std");
const expect = std.testing.expect;
const builtin = @import("builtin");
const native_arch = builtin.target.cpu.arch;
fn derp() align(@sizeOf(usize) * 2) i32 {
return 1234;
}
fn noop1() align(1) void {}
fn noop4() align(4) void {}
test "function alignment" {
// function alignment is ... | test/behavior/align_stage1.zig |
const builtin = @import("builtin");
const std = @import("std");
const expect = std.testing.expect;
const mem = std.mem;
const maxInt = std.math.maxInt;
const native_endian = builtin.target.cpu.arch.endian();
test "pointer reinterpret const float to int" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigT... | test/behavior/cast_llvm.zig |
const expect = @import("std").testing.expect;
const pi = @import("std").math.pi;
const e = @import("std").math.e;
test "@sqrt" {
comptime testSqrt();
testSqrt();
}
fn testSqrt() void {
{
var a: f16 = 4;
expect(@sqrt(f16, a) == 2);
}
{
var a: f32 = 9;
expect(@sqrt(f3... | test/stage1/behavior/floatop.zig |
const clap = @import("clap");
const std = @import("std");
const ston = @import("ston");
const util = @import("util");
const common = @import("common.zig");
const format = @import("format.zig");
const gen3 = @import("gen3.zig");
const gen4 = @import("gen4.zig");
const gen5 = @import("gen5.zig");
const rom = @import("ro... | src/core/tm35-apply.zig |
const std = @import("std");
pub const Fixbuf = @compileError("Please use std.BoundedArray instead");
pub fn errSetContains(comptime ErrorSet: type, err: anyerror) bool {
inline for (comptime std.meta.fields(ErrorSet)) |e| {
if (err == @field(ErrorSet, e.name)) {
return true;
}
}
... | src/util.zig |
const std = @import("std");
const assert = std.debug.assert;
// Indexing
pub inline fn generateVertexRemap(
destination: []u32,
indices: ?[]const u32,
comptime T: type,
vertices: []const T,
) usize {
return meshopt_generateVertexRemap(
destination.ptr,
if (indices) |ind| ind.ptr el... | libs/zmesh/src/meshoptimizer.zig |
const std = @import("std");
const builtin = @import("builtin");
const examples = .{
"events",
"window",
"input",
"wasm",
};
const web_install_dir = std.build.InstallDir{ .custom = "www" };
fn getRoot() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
}
pub fn createApplication(b:... | build.zig |
const std = @import("std");
// Implements URI parsing roughly adhere to https://tools.ietf.org/html/rfc3986
// Does not do perfect grammar and character class checking, but should be robust against
// "wild" URIs
/// Stores separate parts of a URI.
pub const UriComponents = struct {
scheme: ?[]const u8,
user:... | uri.zig |
const std = @import("std");
const Source = @import("context.zig").Source;
const PrintHelper = @import("print_helper.zig").PrintHelper;
const Module = @import("parse.zig").Module;
const Expression = @import("parse.zig").Expression;
const Statement = @import("parse.zig").Statement;
const Local = @import("parse.zig").Loca... | src/zangscript/parse_print.zig |
const std = @import("std");
const ansi = @import("ansi-term");
const os = std.os;
const fs = std.fs;
const ControlCode = union(enum) {
newline,
backspace,
end_of_file,
escape,
left,
right,
up,
down,
character: u8,
fn fromReader(reader: anytype) !ControlCode {
const byte... | src/lib.zig |
const std = @import("std");
/// The version information for this library. This is hardcoded for now but
/// in the future we will parse this from configure.ac.
pub const Version = struct {
pub const major = "2";
pub const minor = "9";
pub const micro = "12";
pub fn number() []const u8 {
compti... | libxml2.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = false;
const with_dissassemble = false;
const assert = std.debug.assert;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
const Computer = tools.IntCode_Computer;
pub fn run(input... | 2019/day09.zig |
const std = @import("std");
const vectorized = @import("algorithms.zig");
const Vector = std.meta.Vector;
const print = std.debug.print;
const assert = std.debug.assert;
pub fn main() !void {
const T = u8;
const num_items = 1_000_000;
var items: [num_items]T align(32) = undefined;
var default_prng = s... | src/main.zig |
const std = @import("std");
const zblz = @import("blz.zig");
const cblz = @cImport(@cInclude("blz.h"));
const heap = std.heap;
const debug = std.debug;
const mem = std.mem;
const io = std.io;
const os = std.os;
pub fn main() !void {
var direct_allocator = heap.DirectAllocator.init();
defer direct_allocator.de... | lib/blz/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 int = i64;
const util = @import("util.zig");
const gpa = util.gpa;
const data = @embedFile("../dat... | src/day05.zig |
const std = @import("std");
const pike = @import("pike");
const mem = std.mem;
pub const Counter = struct {
const Self = @This();
state: isize = 0,
event: Event = .{},
pub fn add(self: *Self, delta: isize) void {
var state = @atomicLoad(isize, &self.state, .Monotonic);
var new_state:... | sync.zig |
const std = @import("std");
const testing = std.testing;
// Convenience-function to initiate a bounded-array without inital size of 0, removing the error-case brough by .init(size)
pub fn initBoundedArray(comptime T: type, comptime capacity: usize) std.BoundedArray(T, capacity) {
return std.BoundedArray(T, capacit... | src/utils.zig |
const macro = @import("pspmacros.zig");
comptime {
asm (macro.import_module_start("sceAtrac3plus", "0x00090000", "25"));
asm (macro.import_function("sceAtrac3plus", "0xD1F59FDB", "sceAtracStartEntry"));
asm (macro.import_function("sceAtrac3plus", "0xD5C28CC0", "sceAtracEndEntry"));
asm (macro.import_fu... | src/psp/nids/pspatrac3.zig |
const std = @import("std");
const stdx = @import("stdx");
const uv = @import("uv");
const gl = @import("gl");
const ma = @import("miniaudio");
const GLint = gl.GLint;
const GLsizei = gl.GLsizei;
const GLclampf = gl.GLclampf;
const GLenum = gl.GLenum;
const log = stdx.log.scoped(.lib_mock);
extern fn unitTraceC(fn_nam... | test/lib_mock.zig |
const std = @import("std");
const stdx = @import("stdx");
const t = stdx.testing;
const log = stdx.log.scoped(.parser_simple_test);
const _parser = @import("parser.zig");
const Parser = _parser.Parser;
const DebugInfo = _parser.DebugInfo;
const ParseConfig = _parser.ParseConfig;
const _grammar = @import("grammar.zig")... | parser/parser_simple.test.zig |
const std = @import("index.zig");
const HashMap = std.HashMap;
const mem = std.mem;
const Allocator = mem.Allocator;
const assert = std.debug.assert;
/// BufMap copies keys and values before they go into the map, and
/// frees them when they get removed.
pub const BufMap = struct.{
hash_map: BufMapHashMap,
co... | std/buf_map.zig |
const std = @import("std");
const assert = std.debug.assert;
const log = std.log;
const os = std.os;
const pam = @import("pam.zig");
pub const Connection = struct {
read_fd: os.fd_t,
write_fd: os.fd_t,
pub fn reader(conn: Connection) std.fs.File.Reader {
const file = std.fs.File{ .handle = conn.r... | src/auth.zig |
const builtin = @import("builtin");
pub use @import("errno.zig");
const std = @import("../../index.zig");
const c = std.c;
const assert = std.debug.assert;
const maxInt = std.math.maxInt;
pub const Kevent = c.Kevent;
pub const CTL_KERN = 1;
pub const CTL_DEBUG = 5;
pub const KERN_PROC_ARGS = 48; // struct: process... | std/os/netbsd/index.zig |
const std = @import("std");
const Impulse = @import("notes.zig").Impulse;
const Notes = @import("notes.zig").Notes;
const MyNoteParams = struct {
note_on: bool,
};
test "PolyphonyDispatcher: 5 note-ons with 3 slots" {
const iap = Notes(MyNoteParams).ImpulsesAndParamses {
.impulses = &[_]Impulse {
... | src/zang/notes_test.zig |
const std = @import("std");
pub fn Parser(comptime num_columns: usize) type {
return struct {
pub const Note = union(enum) {
idle: void,
freq: f32,
off: void,
};
pub const Token = union(enum) {
word: []const u8,
number: f32,
... | examples/common/songparse1.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const input = @embedFile("../input/day12.txt");
const Facing = enum(u2) {
East,
South,
West,
North,
};
pub fn main() !void {
var east: isize = 0;
var north: isize = ... | src/day12.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const assert = std.debug.assert;
const print = std.debug.print;
const input = @embedFile("../input/day09.txt");
const input_preamble_len = 25;
fn loadNumbers(allocator: *Allocator, string: []const u8) !ArrayList(u64) {
... | src/day09.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const StringHashMap = std.StringHashMap;
const BufSet = std.BufSet;
const Buffer = std.Buffer;
const fixedBufferStream = std.io.fixedBufferStream;
const assert = std.debug.assert;
const OrbitMapParseError = error{FormatError};
const OrbitMap = struct {
... | zig/06.zig |
const std = @import("std");
const assert = std.debug.assert;
const koino = @import("koino");
const MenuItem = struct {
input_file_name: []const u8,
output_file_name: []const u8,
header: []const u8,
};
const menu_items = [_]MenuItem{
MenuItem{
.input_file_name = "documentation/README.md",
... | src/tools/render-md-page.zig |
const std = @import("std");
pub const KeyboardError = error{
BadStartBit,
BadStopBit,
ParityError,
UnknownKeyCode,
};
pub const KeyboardLayout = enum {
Uk105Key,
Us104Key,
Jis109Key,
AzertyKey,
Dvorak104Key,
};
const Uk105KeyImpl = @import("keycode/layouts/uk105.zig");
const Us104K... | src/pc_keyboard.zig |
pub const Rect = struct {
x: i32,
y: i32,
width: i32,
height: i32,
};
pub const Coord = struct {
x: i32,
y: i32,
pub fn plus(a: Coord, b: Coord) Coord {
return Coord{
.x = a.x + b.x,
.y = a.y + b.y,
};
}
pub fn minus(a: Coord, b: Coord) Coord... | src/core/geometry.zig |
const std = @import("std");
const gemini = @import("gemtext.zig");
const Fragment = gemini.Fragment;
const FragmentType = gemini.FragmentType;
const Parser = gemini.Parser;
const TextLines = gemini.TextLines;
const Preformatted = gemini.Preformatted;
const Link = gemini.Link;
const Heading = gemini.Heading;
const Docum... | src/tests.zig |
const std = @import("std");
const VM = @import("./vm.zig").VM;
const _obj = @import("./obj.zig");
const _value = @import("./value.zig");
const utils = @import("./utils.zig");
const memory = @import("./memory.zig");
const _compiler = @import("./compiler.zig");
const Value = _value.Value;
const valueToString = _value.va... | src/buzz_api.zig |
const stdx = @import("stdx");
const vk = @import("vk");
const gvk = @import("graphics.zig");
const log = stdx.log.scoped(.buffer);
pub fn createVertexBuffer(physical: vk.VkPhysicalDevice, device: vk.VkDevice, size: vk.VkDeviceSize, buf: *vk.VkBuffer, buf_mem: *vk.VkDeviceMemory) void {
createBuffer(physical, devi... | graphics/src/backend/vk/buffer.zig |
usingnamespace @import("../bits/linux.zig");
pub fn syscall0(number: SYS) usize {
return asm volatile ("svc #0"
: [ret] "={x0}" (-> usize),
: [number] "{x8}" (@enumToInt(number)),
: "memory", "cc"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile ("svc #0"
... | lib/std/os/linux/arm64.zig |
const root = @import("root");
const std = @import("std.zig");
const builtin = std.builtin;
const assert = std.debug.assert;
const uefi = std.os.uefi;
var argc_argv_ptr: [*]usize = undefined;
const start_sym_name = if (builtin.arch.isMIPS()) "__start" else "_start";
comptime {
if (builtin.output_mode == .Lib and... | lib/std/start.zig |
const std = @import("std");
pub const Token = @This();
pub const Op = @import("./token/op.zig").Op;
pub const Kwd = @import("./token/kw.zig").Kwd;
pub const Symbol = @import("./token/sym.zig");
pub const Tag = Symbol.Tag;
pub const Val = Symbol.Val;
const Ast = @import("./Ast.zig");
const Parser = @import("./Parser.zi... | lib/idla/src/Token.zig |
const std = @import("../../std.zig");
const math = std.math;
const Limb = std.math.big.Limb;
const limb_bits = @typeInfo(Limb).Int.bits;
const DoubleLimb = std.math.big.DoubleLimb;
const SignedDoubleLimb = std.math.big.SignedDoubleLimb;
const Log2Limb = std.math.big.Log2Limb;
const Allocator = std.mem.Allocator;
const ... | lib/std/math/big/int.zig |
const std = @import("index.zig");
const debug = std.debug;
const mem = std.mem;
const u1 = @IntType(false, 1);
const u256 = @IntType(false, 256);
// A single token slice into the parent string.
//
// Use `token.slice()` on the input at the current position to get the current slice.
pub const Token = struct {
id:... | std/json.zig |