code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
usingnamespace @import("root").preamble;
const log = lib.output.log.scoped(.{
.prefix = "VirtioNet",
.filter = .info,
}).write;
const virtio_pci = os.drivers.misc.virtio_pci;
const DevConfig = packed struct {
mac: [6]u8,
};
/// virtio-net driver instance
const Driver = struct {
transport: virtio_pci... | subprojects/flork/src/drivers/net/virtio.zig |
const std = @import("std");
usingnamespace @import("kiragine").kira.log;
const engine = @import("kiragine");
const maxparticle = 1500;
const ParticleSystem = engine.ParticleSystemGeneric(maxparticle);
const windowWidth = 1024;
const windowHeight = 768;
const title = "Particle system";
const targetfps = 60;
var rand:... | examples/particlesystem.zig |
const std = @import("std");
const Builder = @import("std").build.Builder;
const Build = @import("std").build;
const Builtin = @import("std").builtin;
const Zig = @import("std").zig;
const globalflags = [_][]const u8{"-std=c99"};
pub var strip = false;
fn setup(exe: *Build.LibExeObjStep, target: Zig.CrossTarget) voi... | libbuild.zig |
const std = @import("std");
const math = std.math;
const mem = std.mem;
const Allocator = mem.Allocator;
const assert = std.debug.assert;
const trait = std.meta.trait;
const builtin = @import("builtin");
/// ECS Schema with the IdType and all component types
pub fn Schema(comptime IdType: type, comptime CompTypes... | core/src/lib.zig |
const std = @import("std");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const Vm = @import("./vm.zig").Vm;
// Zig's allocators operate on slices, the wrapped C library just passes a
// length-less pointer into memory. The code in this file prepends a small
// metadata block before each alloc... | src/zapata/allocator_wrapper.zig |
const std = @import("std");
const slf = @import("slf.zig");
const args_parser = @import("args");
pub fn printUsage(stream: anytype) !void {
try stream.writeAll(
\\slf-objdump [-h] [-i] [-e] [-s] [-r] [-d] [-x] [--raw] <file>
\\
\\Prints information about a SLF file. If no option is given, t... | src/objdump.zig |
use @import("multiboot.zig");
const tty = @import("tty.zig");
const x86 = @import("x86.zig");
const assert = @import("std").debug.assert;
const Color = tty.Color;
var stack: [*]usize = undefined; // Stack of free physical page.
var stack_index: usize = 0; // Index into the stack.
// Boundaries of the frame sta... | kernel/pmem.zig |
const std = @import("std");
const Wasm = @import("Wasm.zig");
const mem = std.mem;
const io = std.io;
var gpa_allocator = std.heap.GeneralPurposeAllocator(.{}){};
const gpa = gpa_allocator.allocator();
pub fn log(
comptime level: std.log.Level,
comptime scope: @TypeOf(.EnumLiteral),
comptime format: []co... | src/main.zig |
const std = @import("std");
const builtin = @import("builtin");
const stdx = @import("stdx");
const t = stdx.testing;
const log = stdx.log.scoped(.platform);
const sdl = @import("sdl");
const input_sdl = @import("input_sdl.zig");
pub const initSdlKeyDownEvent = input_sdl.initKeyDownEvent;
pub const initSdlKeyUpEvent =... | platform/platform.zig |
const std = @import("std");
const builtin = @import("builtin");
const IsWasm = builtin.target.isWasm();
const stdx = @import("stdx");
const platform = @import("platform");
const MouseUpEvent = platform.MouseUpEvent;
const graphics = @import("graphics");
const Color = graphics.Color;
const ui = @import("ui");
const Row ... | ui/examples/crud.zig |
const root = @import("root");
const BIOS = @import("bios.zig").BIOS;
pub const GBA = struct {
pub const VRAM = @intToPtr([*]align(2) volatile u16, 0x06000000);
pub const SPRITE_VRAM = @intToPtr([*]align(2) volatile u16, 0x06010000);
pub const BG_PALETTE_RAM = @intToPtr([*]align(2) volatile u16, 0x05000000)... | GBA/core.zig |
const std = @import("std");
const Context = @import("context.zig").Context;
const SourceLocation = @import("context.zig").SourceLocation;
const SourceRange = @import("context.zig").SourceRange;
const fail = @import("fail.zig").fail;
pub const TokenType = union(enum) {
illegal,
end_of_file,
name,
number... | src/zangscript/tokenize.zig |
const std = @import("std");
const OpCode = @import("chunk.zig").OpCode;
const Chunk = @import("chunk.zig").Chunk;
const Stack = @import("stack.zig").Stack;
const value = @import("value.zig");
pub const trace_execution = true;
pub const print_code = true;
fn simpleInstruction(writer: anytype, offset: usize, name: []c... | src/debug.zig |
const std = @import("std");
const builtin = @import("builtin");
// Using io_mode = .evented already creates its own event loop and you can get that instance using std.event.Loop.instance.?.*
pub const io_mode = .evented;
var testRunDetachedData: usize = 0;
pub fn main() !void {
var loop: std.event.Loop = std.even... | Mutlithreading/multiple_tasks_ with_event_loop.zig |
const std = @import("std");
usingnamespace @import("chunk_alloc.zig");
const page_alloc = @import("page_alloc.zig");
const assert = std.debug.assert;
const mem = std.mem;
const math = std.math;
const Allocator = mem.Allocator;
const DirectAllocation = struct {
next: ?*DirectAllocation,
mem: []u8,
};
const Ar... | arena.zig |
const std = @import("std");
pub fn bit(comptime field_type: type, comptime shamt: usize) type {
return bit_t(field_type, u1, shamt);
}
test "bit" {
const S = extern union {
low: bit(u32, 0),
high: bit(u32, 1),
val: u32,
};
std.testing.expect(@sizeOf(S) == 4);
std.testing.e... | src/lib/bitfields.zig |
const std = @import("std");
const compare = @import("../src/generic");
const debug = std.debug;
const mem = std.mem;
const math = std.math;
const testing = std.testing;
/// Determin the max runtime size requirement to a union of N types.
fn runtimeSize(comptime fields: var) comptime_int {
var res = 0;
for (fie... | src/union.zig |
const std = @import("std");
const util = @import("util.zig");
const data = @embedFile("../data/day06.txt");
/// Simulates lanternfish according to specified algorithm. Returns number of lanternfish after
/// simulation completes.
pub fn simulateLanternfish2(allocator: *util.Allocator, initial_lanternfish: []const u8... | src/day06.zig |
const inputFile = @embedFile("./input/day10.txt");
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const Str = []const u8;
const BitSet = std.DynamicBitSet;
const assert = std.debug.assert;
const tokenize = std.mem.tokenize;
const print = std.debug.print;
fn sort(compt... | src/day10.zig |
const Video = @This();
const SDL = @import("sdl2");
const std = @import("std");
const ROM = @import("ROM.zig");
const Sprite = struct {
id: u6 = 0,
x_flip: bool = false,
y_flip: bool = false,
color: u8 = 0,
x_pos: u8 = 0,
y_pos: u8 = 0,
pub fn readAttrs(self: Sprite) u8 {
return ... | src/Video.zig |
const std = @import("std");
const expect = std.testing.expect;
const luhnmod10 = @import("luhnmod10.zig");
test "benchmark" {
const count: i64 = 14_000;
var timer = try std.time.Timer.start();
var i: i64 = 0;
while (i < count) : (i += 1) {
const number = "4242424242424242";
_ = luhnmod... | luhnmod10_tests.zig |
usingnamespace @import("root").preamble;
const CoreID = os.platform.CoreID;
/// Maximum number of supported CPUs
const max_cpus = comptime config.kernel.max_cpus;
/// CPUs data
var core_datas: [max_cpus]CoreData = [1]CoreData{undefined} ** max_cpus;
/// Count of CPUs that have not finished booting.
/// Assigned in ... | subprojects/flork/src/platform/smp.zig |
const std = @import("std");
const tres = @import("tres.zig");
test "tres.parse bool" {
var tree_parser = std.json.Parser.init(std.testing.allocator, false);
defer tree_parser.deinit();
{
const tree = try tree_parser.parse("true");
const parsed = try tres.parse(bool, tree.root, null);
... | tests.zig |
const mon13 = @import("mon13");
const std = @import("std");
const expect = std.testing.expect;
const mem = std.mem;
test "convert year 0" {
const c0 = &mon13.tranquility_year_zero;
const mjd = try mon13.mjdFromYmd(c0, -1639577, 7, 2);
const c1 = &mon13.tranquility;
var year: i32 = 0;
var month: u... | test/unit.zig |
// Here's how I solved it by hand:
// list1 = [14,13,15,13,-2,10,13,-15,11,-9,-9,-7,-4,-6]
// list2 = [00,12,14,00,03,15,11, 12,01,12,03,10,14,12]
// i = 0 1 2 3 4 5 6 7 8 9 10 11 12 13
// for i in range(14):
// x = peek() + list1[i]
// if list1[i] < 0:
// pop()
// if x != n[i]:
//... | src/day24.zig |
const std = @import("std");
const mem = std.mem;
const print = std.debug.print;
const assert = std.debug.assert;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = &gpa.allocator;
{ // Solution 1
var input = [9]u8{3, 2, 6, 5, 1, 9, 4, 7, 8};
var cu... | 2020/src/day_23.zig |
const TexturePack = @import("main.zig").TexturePack;
const t = 0x00000000;
const W = 0xffffffff;
const B = 0x11000000;
const _actorsprites = [_][32*32]const u32 {
{
t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,
t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,
... | src/sprites.zig |
const std = @import("std");
usingnamespace @import("kira").log;
const utils = @import("kira").utils;
const glfw = @import("kira").glfw;
const gl = @import("kira").gl;
const renderer = @import("kira").renderer;
const window = @import("kira").window;
const input = @import("kira").input;
const math = @import("... | examples/primitive-simpleshooter.zig |
const std = @import("std");
const assert = std.debug.assert;
const warn = std.debug.warn;
const Allocator = std.mem.Allocator;
const math = std.math;
const geo = @import("index.zig");
const V2f32 = geo.V2f32;
const V3f32 = geo.V3f32;
const M44f32 = geo.M44f32;
const DBG = false;
const DBG1 = false;
pub const Face = ... | mesh.zig |
pub const Planet = enum(u4) {
mercury,
venus,
earth,
mars,
jupiter,
saturn,
uranus,
neptune,
};
pub const SpaceAge = struct {
seconds: f64,
const EARTH_YEAR_IN_SECONDS = 31557600;
pub fn init(seconds: isize) SpaceAge {
return SpaceAge {
.seconds = @intT... | exercises/practice/space-age/.meta/example.zig |
const Id = @import("zig_grammar.tokens.zig").Id;
pub fn idToString(id: Id) []const u8 {
switch (id) {
.Builtin => return "@builtin",
.Ampersand => return "&",
.AmpersandAmpersand => return "&&",
.AmpersandEqual => return "&=",
.Asterisk => return "*",
.AsteriskAsteri... | zig/zig_grammar.debug.zig |
const std = @import("std");
const zap = @import("zap");
const hyperia = @import("hyperia.zig");
const Socket = @import("socket.zig").Socket;
const Reactor = @import("reactor.zig").Reactor;
const io = std.io;
const os = std.os;
const net = std.net;
const mpsc = hyperia.mpsc;
const testing = std.testing;
pub const Asyn... | async_socket.zig |
const std = @import("std");
const debuginator_c = @import("c.zig");
pub export fn draw_rect(position: [*c]debuginator_c.DebuginatorVector2, size: [*c]debuginator_c.DebuginatorVector2, color: [*c]debuginator_c.DebuginatorColor, userdata: ?*c_void) void {}
pub export fn draw_text(text: [*c]const u8, position: [*c]debugi... | tests/zig-minimal/src/main.zig |
usingnamespace @import("root").preamble;
const log = lib.output.log.scoped(.{
.prefix = "gpu/virtio",
.filter = .info,
}).write;
const virtio_pci = os.drivers.misc.virtio_pci;
/// virtio-gpu driver instance
const Driver = struct {
transport: virtio_pci.Driver,
inflight: u32 = 0,
display_region: l... | subprojects/flork/src/drivers/gpu/virtio_gpu.zig |
const std = @import("std");
const interop = @import("interop.zig");
const iup = @import("iup.zig");
const debug = std.debug;
const trait = std.meta.trait;
const Element = iup.Element;
const Dialog = iup.Dialog;
const Handle = iup.Handle;
const VBox = iup.VBox;
const Menu = iup.Menu;
const SubMenu = iup.SubMenu;
const... | src/impl.zig |
const std = @import("std");
pub const Color = [4]u8;
pub const BlendMode = enum(u1) {
alpha,
replace,
};
pub const ColorLayer = enum(u1) {
foreground,
background,
};
pub const black = Color{ 0, 0, 0, 0xff };
pub fn eql(a: Color, b: Color) bool {
return a[0] == b[0] and a[1] == b[1] and a[2] == ... | src/color.zig |
const u = @import("util.zig");
const std = @import("std");
const Expr = @import("Expr.zig");
const IR = @import("IR.zig");
const p = @import("Wat/parse.zig");
const Codegen = @import("Wat/Codegen.zig");
pub const emit = @import("Wat/Emit.zig").emit;
const TopDefinition = enum { type, import, func, data, @"export", mem... | src/Wat.zig |
const std = @import("std");
const expect = std.testing.expect;
const mem = 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 += arra... | test/stage1/behavior/array.zig |
const std = @import("std");
const fs = std.fs;
const assert = std.debug.assert;
const json = std.json;
const KnownOpt = struct {
name: []const u8,
/// Corresponds to stage.zig ClangArgIterator.Kind
ident: []const u8,
};
const known_options = [_]KnownOpt{
.{
.name = "target",
.ident =... | tools/update_clang_options.zig |
const std = @import("../std.zig");
const assert = std.debug.assert;
const maxInt = std.math.maxInt;
const State = enum {
Complete,
Value,
ArrayStart,
Array,
ObjectStart,
Object,
};
/// Writes JSON ([RFC8259](https://tools.ietf.org/html/rfc8259)) formatted data
/// to a stream. `max_depth` is a... | lib/std/json/write_stream.zig |
const std = @import("../std.zig");
const math = std.math;
const Random = std.rand.Random;
pub fn next_f64(random: *Random, comptime tables: ZigTable) f64 {
while (true) {
// We manually construct a float from parts as we can avoid an extra random lookup here by
// using the unused exponent for the... | lib/std/rand/ziggurat.zig |
const std = @import("std");
const ArenaAllocator = std.heap.ArenaAllocator;
const xml = @import("lib.zig");
const Parser = @This();
const logger = std.log.scoped(.@"zupnp.xml.Parser");
usingnamespace @import("traverser.zig").StructTraverser(Parser);
pub fn DecodeResult(comptime T: type) type {
return struct {
... | src/parser.zig |
const std = @import("std");
const Ed25519 = std.crypto.sign.Ed25519;
const SHA512 = std.crypto.hash.sha2.Sha512;
const b64decoder = std.base64.standard.Decoder;
const b64encoder = std.base64.standard.Encoder;
const endian = @import("builtin").target.cpu.arch.endian();
const zero = std.crypto.utils.secureZero;
const bcr... | signify-format.zig |
const std = @import("std");
const Elephant = struct {
letter: u8,
tail: ?*Elephant = null,
visited: bool = false,
// New Elephant methods!
pub fn getTail(self: *Elephant) *Elephant {
return self.tail.?; // Remember, this means "orelse unreachable"
}
pub fn hasTail(self: *Elephant)... | exercises/048_methods2.zig |
const std = @import("std");
const upaya = @import("../upaya.zig");
usingnamespace @import("imgui");
const Color = upaya.math.Color;
pub const Tileset = struct {
tile_size: usize,
spacing: usize,
tex: upaya.Texture = undefined,
tiles_per_row: usize = 0,
selected: u8 = 0,
pub fn init(tile_size: ... | src/tilemaps/tileset.zig |
const std = @import("std");
const builtin = @import("builtin");
const zwl = @import("zwl.zig");
const log = std.log.scoped(.zwl);
const Allocator = std.mem.Allocator;
const gl = @import("opengl.zig");
pub const windows = struct {
pub const kernel32 = @import("windows/kernel32.zig");
pub const user32 = @import... | didot-zwl/zwl/src/windows.zig |
const std = @import("std");
const windows = @import("../windows.zig");
const ws2_32 = windows.ws2_32;
pub usingnamespace ws2_32;
const IOC_VOID = 0x80000000;
const IOC_OUT = 0x40000000;
const IOC_IN = 0x80000000;
const IOC_WS2 = 0x08000000;
pub const SIO_BSP_HANDLE = IOC_OUT | IOC_WS2 | 27;
pub const SIO_BSP_HANDLE... | os/windows/ws2_32.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const handlers = @import("handlers.zig").handlers;
// Interrupt Descriptor Table
pub var idt: []IdtEntry = undefined;
pub fn init(allocator: *Allocator) void {
// place IDT to Extended memory
idt = allocator.allocWithOptions(IdtEntry, 256, 4096... | src/interrupts/idt.zig |
const std = @import("std");
const testing = std.testing;
const StringTable = @import("./strtab.zig").StringTable;
const allocator = std.heap.page_allocator;
pub const Validator = struct {
const Rule = struct {
parts: std.ArrayList(usize),
pub fn init() *Rule {
var self = allocator.cre... | 2020/p19/validator.zig |
const std = @import("std");
const imgui = @import("imgui");
const glfw = @import("glfw");
const engine = @import("engine.zig");
// TODO: No vulkan allowed at this layer!!
const vk = @import("vk");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
// ----------------------- Render submodules ----... | src/render.zig |
const std = @import("std");
const heap = std.heap;
const log = std.log;
const mem = std.mem;
const net = std.net;
const big = std.math.big;
const cql = @import("lib.zig");
const casstest = @import("casstest.zig");
/// Runs a single SELECT reading all data from the age_to_ids table.
///
/// This function demonstrates ... | src/example.zig |
const std = @import("std");
const builtin = @import("builtin");
const log_ = @import("Log.zig");
const errLog_ = log_.errLog;
const dbgLog_ = log_.dbgLog;
const c_allocator = std.heap.c_allocator;
const TCPServer = @import("TCPServer.zig");
const HTTPSState = @import("HTTPSState.zig").HTTPSState;
const HTTPState = @imp... | src/HTTP.zig |
/// `isFcx` returns true if `cp` has Full Composition Exclusion.
pub fn isFcx(cp: u21) bool {
return switch(cp) {
0x340...0x341 => true,
0x343...0x344 => true,
0x374 => true,
0x37E => true,
0x387 => true,
0x958...0x95F => true,
0x9DC...0x9DD => true,
... | .gyro/ziglyph-jecolon-github.com-c37d93b6/pkg/src/autogen/derived_normalization_props.zig |
const std = @import("std");
const print = std.debug.print;
const aro = @import("aro");
const Codegen = aro.Codegen;
const Tree = aro.Tree;
const Token = Tree.Token;
const NodeIndex = Tree.NodeIndex;
const AllocatorError = std.mem.Allocator.Error;
var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};... | test/runner.zig |
const std = @import("std");
const PixelBuffer = @import("../video.zig").PixelBuffer;
const console_ = @import("../console.zig");
const Config = console_.Config;
const Console = console_.Console;
const Cart = @import("../cart.zig").Cart;
const Cpu = @import("../cpu.zig").Cpu;
const common = @import("common.zig");
con... | src/ppu/accurate.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 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 {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit(... | 2015/day8.zig |
const std = @import("std");
const c = @import("../../c_global.zig").c_imp;
// dross-zig
const Vector2 = @import("../../core/vector2.zig").Vector2;
const Renderer = @import("../renderer.zig").Renderer;
const PackingMode = @import("../renderer.zig").PackingMode;
const ByteAlignment = @import("../renderer.zig").Byte... | src/renderer/font/font.zig |
pub const FD_EVENTID_PRIVATE = @as(u32, 100);
pub const FD_EVENTID = @as(u32, 1000);
pub const FD_EVENTID_SEARCHCOMPLETE = @as(u32, 1000);
pub const FD_EVENTID_ASYNCTHREADEXIT = @as(u32, 1001);
pub const FD_EVENTID_SEARCHSTART = @as(u32, 1002);
pub const FD_EVENTID_IPADDRESSCHANGE = @as(u32, 1003);
pub const FD_EVENTID... | win32/devices/function_discovery.zig |
// Ported from the ISAAC64 C Source written by <NAME>, 1996, Public Domain
// https://burtleburtle.net/bob/c/isaac64.h
// https://burtleburtle.net/bob/c/standard.h
// https://burtleburtle.net/bob/c/isaac64.c
//
// USAGE:
//
// var isaac = Isaac64 {};
// isaac.seed(c"CHAR_DATA_UP_TO_RANDSIZ_TIMES_8_BYTES", 37);
// isa... | isaac64.zig |
const Response = @This();
const std = @import("std");
const net = std.net;
const MimeType = @import("MimeType.zig");
/// The status representing this response.
/// By default set to "20 - SUCCESS"
status: Status = .success,
/// Buffered writer for writing to the client.
/// By buffering we limit the amount of syscall... | src/Response.zig |
const mmio = @import("io/mmio.zig");
const mbox = @import("io/mbox.zig");
const gpio = @import("io/gpio.zig");
const uart = @import("io/uart.zig");
const regs = @import("types/regs.zig");
const Register = regs.Register;
// Embedded version number
pub const Version = "0.1.1";
/// Hang the system with an infinite whil... | kernel/src/arch/aarch64/util.zig |
const inputFile = @embedFile("./input/day06.txt");
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const assert = std.debug.assert;
// Returns a list of ages
// The input is a comma separated list of ages
fn parseInput(input: []const u8, allocator: Allocator) !ArrayLi... | src/day06.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const StringHashMap = std.StringHashMap;
const StrMap = std.StringHashMap;
const Token = @import("./token.zig").Token;
const hash = std.hash;
const Kind = Token.Kind;
const Lexer = @import("./lexer.zig").Lexer;
const LexerError = @import("./lexer.zig").LexerE... | src/lang/ast.zig |
const std = @import("std");
const trait = std.meta.trait;
const ctregex = @import("ctregex");
/// A collection of utilities that are likely to be used on a fairly common
/// basis and would therefore cause repetitive, avoidable boilerplate.
pub const Utils = struct {
arena: *std.mem.Allocator,
gpa: *std.mem.Al... | util.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const mem = std.mem;
const fmt = std.fmt;
pub const rdata = @import("dns/rdata.zig");
pub const RData = rdata.DNSRData;
pub const QuestionList = std.ArrayList(Question);
pub const ResourceList = std.ArrayList(Resource);
pub const FixedStream = std.io.F... | src/pkg/dns.zig |
const midi = @import("midi");
const std = @import("std");
pub fn main() !void {
const stdin = std.io.getStdIn().reader();
const header = try midi.decode.fileHeader(stdin);
std.debug.warn("file_header:\n", .{});
std.debug.warn(" chunk_type: {s}\n", .{header.chunk.kind});
std.debug.warn(" chunk_le... | example/midi_file_to_text_stream.zig |
const std = @import("std");
const testing = std.testing;
const utils = @import("utils.zig");
const config = @import("config.zig");
const initBoundedArray = utils.initBoundedArray;
/// The main definition of a test to perform
pub const Entry = struct {
name: std.BoundedArray(u8, 1024) = initBoundedArray(u8, 1024),
... | src/types.zig |
const std = @import("std");
const bytecode = @import("bytecode.zig");
const compiler = @import("compiler.zig");
const debug = @import("debug.zig");
const gc = @import("gc.zig");
const Value = @import("value.zig").Value;
const Heap = gc.Heap;
const DEBUG_TRACE_EXECUTION = true;
pub const InterpreterError = error{
... | src/vm.zig |
const std = @import("std");
const input = @import("input.zig");
pub fn run(stdout: anytype) anyerror!void {
{
var input_ = try input.readFile("inputs/day10");
defer input_.deinit();
const result = try part1(&input_);
try stdout.print("10a: {}\n", .{ result });
std.debug.as... | src/day10.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const print = std.debug.print;
const panic = std.debug.panic;
const TailQueue = std.TailQueue;
const graph = @import("graph.zig");
const Allocator = std.mem.Allocator;
const AutoHashMap = std.AutoHashMap;
const LinearFifo = std.fifo.LinearFifo;
pub fn bfs(
... | src/uninformed.zig |
const std = @import("std");
const zfetch = @import("zfetch");
const tar = @import("tar");
const uri = @import("uri");
const Options = @import("main.zig").Options;
const Hasher = std.crypto.hash.blake2.Blake2b128;
pub fn gz(
allocator: *std.mem.Allocator,
cache_root: []const u8,
url: []const u8,
opts: ... | src/tar.zig |
const std = @import("std");
/// Modulated lapped transform window function
pub fn window(comptime T: type, index: T, len: T) T {
return @sin((std.math.pi / len) * (index + 0.5));
}
// TODO: Naive; factor, vectorize
/// Modified discrete cosine transform
/// Returns useful data from 0 <= index < data.len/2
pub fn ... | src/mdct.zig |
usingnamespace @import("c.zig");
const Texture = @import("texture.zig").Texture;
/// Options for the display such as width, height and title
pub const Options = struct {
/// Sets the initial window width
width: c_int,
/// Sets the initial window height
height: c_int,
/// Sets the title of the windo... | src/window.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/day25.zig |
const std = @import("std");
const zt = @import("zt");
const main = @import("../main.zig");
const ig = @import("imgui");
const zg = zt.custom_components;
const Hash = zt.game.SpatialHash.Generate(usize, .{ .bucketSize = 80 });
var rng: std.rand.Random = undefined;
const blip = struct {
aabb: zt.math.Rect = .{},
... | example/src/scenes/spatialhash_squares.zig |
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const ast = std.zig.ast;
const Token = std.zig.Token;
usingnamespace @import("clang.zig");
pub const Mode = enum {
import,
translate,
};
// TODO merge with Type.Fn.CallingConvention
const CallingConvention = buil... | src-self-hosted/translate_c.zig |
const std = @import("std");
const print = std.debug.print;
usingnamespace @import("common.zig");
usingnamespace @import("value.zig");
usingnamespace @import("chunk.zig");
usingnamespace @import("scanner.zig");
usingnamespace @import("compiler.zig");
usingnamespace @import("vm.zig");
const Precedence = enum {
PREC... | vm/src/parser.zig |
const std = @import("std");
const mem = std.mem;
const Target = std.Target;
const Compilation = @import("compilation.zig").Compilation;
const introspect = @import("introspect.zig");
const testing = std.testing;
const errmsg = @import("errmsg.zig");
const ZigCompiler = @import("compilation.zig").ZigCompiler;
var ctx: T... | src-self-hosted/test.zig |
const kernel = @import("kernel.zig");
const log = kernel.log.scoped(.RNUFS);
const Filesystem = @import("filesystem.zig");
const RNUFS = @import("../common/fs.zig");
const GenericDriver = kernel.driver;
const Driver = @This();
fs: Filesystem,
pub const Initialization = struct {
pub const Context = *kernel.Disk;
... | src/kernel/rnu_fs.zig |
const std = @import("std");
const mem = std.mem;
const fmt = std.fmt;
const hash_map = std.hash_map;
const math = std.math;
const meta = std.meta;
// *****************************************************************************
pub fn splitToInts(comptime T: type, allocator: *mem.Allocator,
buffer... | src/utils.zig |
const std = @import("std");
const Granularity = enum(u1) {
byte = 0,
page = 1,
};
const SegmentSize = enum(u1) {
bits16 = 0,
bits32 = 1,
};
const Descriptor = packed struct {
pub const Access = packed struct {
accessed: bool = false,
writeable: bool,
direction: bool,
... | src/kernel/arch/x86/boot/gdt.zig |
const std = @import("std");
const utils = @import("utils.zig");
const Registry = @import("registry.zig").Registry;
const Storage = @import("registry.zig").Storage;
const SparseSet = @import("sparse_set.zig").SparseSet;
const Entity = @import("registry.zig").Entity;
/// BasicGroups do not own any components. Internall... | src/ecs/groups.zig |
const std = @import("std");
const allocPrint0 = std.fmt.allocPrint0;
const stdout = std.io.getStdOut().outStream();
const print = stdout.print;
const ps = @import("parse.zig");
const Node = ps.Node;
const Member = ps.Member;
const newCast = ps.newCast;
const tk = @import("tokenize.zig");
const Token = tk.Token;
const a... | src/type.zig |
const std = @import("../../std.zig");
const io = std.io;
const os = std.os;
const ip = std.x.net.ip;
const fmt = std.fmt;
const mem = std.mem;
const builtin = std.builtin;
const testing = std.testing;
const IPv4 = std.x.os.IPv4;
const IPv6 = std.x.os.IPv6;
const Socket = std.x.os.Socket;
/// A generic TCP socket a... | lib/std/x/net/tcp.zig |
// Modular crypt(3) format for scrypt
// https://en.wikipedia.org/wiki/Crypt_(C)
// https://gitlab.com/jas/scrypt-unix-crypt/blob/master/unix-scrypt.txt
const std = @import("std");
const io = std.io;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
pub const Error = std.crypto.errors.Error || error... | src/crypt_encoding_scrypt.zig |
const builtin = @import("builtin");
const std = @import("std");
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
fn linkWasmtime(step: *LibExeObjStep, search_path: ?[]const u8) void {
if (builtin.os.tag == .windows) {
// On Windows, link dynamic library as otherwise lld wil... | build.zig |
const std = @import("std");
const mem = std.mem;
const file = @embedFile("../input.txt");
// \\mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X
// \\mem[8] = 11
// \\mem[7] = 101
// \\mem[8] = 0
// ;
const Mask = struct {
and_mask: u64,
or_mask: u64,
};
const Memory = struct {
address: u64,
... | 2020/day14/zig/day14.zig |
const cpu = @import("../cpu/index.zig");
/// commands to send to the vga device cursor
pub const Command = enum(u8) {
High = 0xE,
Low = 0xF,
};
/// ports for talking to the vga device cursor
pub const Port = enum(u16) {
Command = 0x3D4,
Data = 0x3D5,
};
/// colors for outputting text to the vga devi... | osmium/driver/vga.zig |
const std = @import("std");
const assert = std.debug.assert;
const x86 = @import("../x86.zig");
pub const TSS = packed struct {
_reserved1: u32,
rsp: [3]u64,
_reserved2: u32,
_reserved3: u32,
ist: [8]u64,
_reserved4: u16,
io_map_addr: u16,
};
comptime {
assert(@sizeOf(TSS) == 104);
}
... | kernel/arch/x86/gdt.zig |
const regs = @import("rp2040_ras");
pub const IODir = enum {
Input,
Output,
};
pub const Function = enum {
F0,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
NULL,
};
pub const GPIO = enum {
P0,
P1,
P2,
P3,
P4,
P5,
P6,
P7,
P8,
P9,
P... | src/hal/gpio.zig |
//--------------------------------------------------------------------------------
// Section: Types (1)
//--------------------------------------------------------------------------------
pub const OOBE_COMPLETED_CALLBACK = fn(
CallbackContext: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void;
//--... | win32/system/setup_and_migration.zig |
const std = @import("std");
const input = @embedFile("data/input11");
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 part1 = try f... | src/day11.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const input = @embedFile("../input/day14.txt");
fn part1(allocator: *Allocator) !void {
var and_mask: u36 = 0;
var or_mask: u36 = 0;
var mem = try allocator.alloc(u36, 1 << 16);
... | src/day14.zig |
const types = @import("protocol/types.zig");
pub const Server = struct {
pub fn DidChangeWorkspaceFolders(self: *Server, param: *DidChangeWorkspaceFoldersParams) !void {}
pub fn Initialized(self: *Server, param: *InitializedParams) !void {}
pub fn Exit(self: *Server) !void {}
pub fn DidChangeConfigurat... | src/lsp/server/server.zig |
const std = @import("std");
const wasmtime = @import("wasmtime");
const builtin = std.builtin;
const fs = std.fs;
const ga = std.heap.c_allocator;
const Allocator = std.mem.Allocator;
pub fn main() !void {
const wasm_path = if (builtin.os.tag == .windows) "examples\\linking1.wat" else "examples/linking1.wat";
... | examples/linking.zig |
const std = @import("std");
usingnamespace @import("utils.zig");
const app = @import("app.zig");
const log = std.log;
pub const log_level = if (std.builtin.mode == .Debug)
.debug else .info;
const Allocator = std.mem.Allocator;
pub const PipelineShaderInfo = struct {
filename: []const u8,
spirv: bool,
... | src/main.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
pub fn RingBuffer(comptime T: type) type {
return struct {
const Self = @This();
const Iterator = struct {
target: *Self,
direction: enum { forward, backward },
index: usize,
pub fn ne... | src/lib.zig |
const std = @import("std");
/// Bell Sound
pub const BELL = "\x07";
/// Backspace
pub const BS = "\x08";
/// Tab
pub const HT = "\x09";
/// Line Feed
pub const LF = "\x0A";
/// From Feed
pub const FF = "\x0C";
/// Carriage Return
pub const CR = "\x0D";
/// ANSI Escape Code
pub const ESC = "\x1B";
/// Single Shift Two
... | conc.zig |
// SPDX-License-Identifier: MIT
// This file is part of the Termelot project under the MIT license.
const std = @import("std");
const termelot = @import("termelot");
usingnamespace termelot.style;
const Rune = termelot.Rune;
const Position = termelot.Position;
const Cell = termelot.Cell;
var running: bool = true;
... | examples/castle.zig |