code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const ascii = std.ascii; const math = std.math; const mem = std.mem; const os = std.os; const sort = std.sort; const wordlist = @import("words.zig").wordlist; const max_word_length = @import("words.zig").max_word_length; pub const Error = error{ // Expected even sized slice, got an odd...
src/niceware.zig
const std = @import("std"); const assert = std.debug.assert; const allocator = std.testing.allocator; pub const Board = struct { const SIZE: usize = 5; const Pos = struct { l: isize, x: usize, y: usize, pub fn init(l: isize, x: usize, y: usize) Pos { var self = Pos...
2019/p24/board.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const Vec2 = tools.Vec2; pub fn run(input_text: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { const param: struct { stride: usize, width: usize, height: usize, map: []const u8,...
2020/day11.zig
const std = @import("std"); const tools_v1 = @import("tools.zig"); const assert = std.debug.assert; const print = std.debug.print; pub const tracy = @import("tracy.zig"); pub const RunError = tools_v1.RunError; pub const defaultMain = tools_v1.defaultMain; pub const BestFirstSearch = tools_v1.BestFirstSearch; pub con...
common/tools_v2.zig
pub const _FACDXCORE = @as(u32, 2176); pub const DXCORE_ADAPTER_ATTRIBUTE_D3D11_GRAPHICS = Guid.initString("8c47866b-7583-450d-f0f0-6bada895af4b"); pub const DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS = Guid.initString("0c9ece4d-2f6e-4f01-8c96-e89e331b47b1"); pub const DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE = Guid.in...
win32/graphics/dxcore.zig
const std = @import("std"); const builtin = @import("builtin"); const uri = @import("uri"); const api = @import("api.zig"); const cache = @import("cache.zig"); const Engine = @import("Engine.zig"); const Dependency = @import("Dependency.zig"); const Project = @import("Project.zig"); const utils = @import("utils.zig"); ...
src/git.zig
pub fn main() void { comptime var ret = compileBrainfuck("default.bf", 16); const print = @import("std").debug.print; print("Output: {}\nCycles done: {}\nTape: ", .{ ret.value.buffer, ret.value.runtime, }); inline for (ret.value.tape) |te| print("{} ", .{te}); print("\n", .{...
src/main.zig
const std = @import("std"); const ssl = @import("ssl"); const SSLConnection = ssl.SSLConnection; const Address = std.net.Address; const Allocator = std.mem.Allocator; const Url = @import("../url.zig").Url; pub const GeminiResponse = struct { original: []const u8, content: []const u8, statusCode: u8, m...
zervo/protocols/gemini.zig
usingnamespace @import("ncurses").ncurses; const width: c_int = 30; const height: c_int = 10; var startx: c_int = 0; var starty: c_int = 0; const choices = [_][]const u8{ "Choice 1", "Choice 2", "Choice 3", "Choice 4", "Exit", }; pub fn main() anyerror!void { var highlight: isize = 1; var...
examples/mouse.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const print = std.debug.print; const data = @embedFile("../inputs/day20.txt"); pub fn main() anyerror!void { var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa_impl.deinit(); const gpa = gpa_impl.allocator(); return m...
src/day20.zig
const inputFile = @embedFile("./input/day14.txt"); const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Str = []const u8; const BitSet = std.DynamicBitSet; const StrMap = std.StringHashMap; const HashMap = std.HashMap; const Map = std.AutoHashMap; const assert = std.debug....
src/day14.zig
const std = @import("std"); const max_usize = @as(usize, 0) -% 1; // MAXusize test "example" { const input = @embedFile("15_example.txt"); var grid = Cave(input).init(); try std.testing.expectEqual(@as(usize, 315), grid.run()); } pub fn main() void { const input = @embedFile("15.txt"); var grid = ...
shritesh+zig/15b.zig
const std = @import("std"); const iup = @import("iup.zig"); const interop = @import("interop.zig"); const Element = iup.Element; const Handle = iup.Handle; /// /// Translates the C-API IUP's signature to zig function pub fn CallbackHandler(comptime T: type, comptime TCallback: type, comptime action: [:0]const u8) typ...
src/callback_handler.zig
const std = @import("std"); const Allocator = std.mem.Allocator; pub const NDError = error{ BufferTooSmall, InvalidPick, MissingAllocator, OutOfBounds, Unsupported, }; pub const Order = enum { Stride, Major, Minor, }; pub const IterOpts = struct { order: Order = .Major, }; pub fn...
src/nd.zig
const c = @import("c.zig").c; // must be in sync with GLFW C constants in hat state group, search for "@defgroup hat_state Joystick hat states" /// A bitmask of all Joystick hat states /// /// See glfw.Joystick.getHats for how these are used. pub const Hat = packed struct { up: bool = false, right: bool = fals...
glfw/src/hat.zig
const root = @import("root"); pub const ENABLE_PROFILER: bool = if (@hasDecl(root, "TC_ENABLE_PROFILER")) root.TC_ENABLE_PROFILER else false; /// Controls whether the shadow stack return routine checks the integrity of a /// return address (and aborts on failure) or just discards a non-trustworthy /// return ...
src/monitor/options.zig
const sf = @import("../sfml.zig"); const std = @import("std"); const VertexArray = @This(); // Constructors/destructors /// Creates a vertex array from a slice of vertices pub fn createFromSlice(vertex: []const sf.graphics.Vertex, primitive: sf.graphics.PrimitiveType) !VertexArray { var va = sf.c.sfVertexArray_...
src/sfml/graphics/VertexArray.zig
pub const P = [18]u32{ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b, }; pub const S = [4][256]u32{ [_]u32{ 0xd1310ba6, 0x98df...
src/sboxes.zig
const builtin = @import("builtin"); const TypeId = builtin.TypeId; const std = @import("std"); const math = std.math; const inf_f16 = std.math.inf_f16; const inf_f32 = std.math.inf_f32; const inf_f64 = std.math.inf_f64; const f16_max = std.math.f16_max; const f32_max = std.math.f32_max; const f64_max = std.math.f64_ma...
src/maxmin_value.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const os = std.os; const config = @import("config.zig"); const log = std.log.scoped(.message_bus); const vr = @import("vr.zig"); const Header = vr.Header; const Journal = vr.Journal; const Replica = vr.Replica; const Client = @import("c...
src/message_bus.zig
const std = @import("std"); const utils = @import("utils.zig"); const is_space_or_tab = utils.is_space_or_tab; const is_num = utils.is_num; const is_end_of_line = utils. is_end_of_line; pub const TAB_TO_SPACES = 4; pub const SPACES_PER_INDENT = 4; pub const TokenKind = enum { Invalid, Hash, Asterisk, ...
src/tokenizer.zig
const std = @import("std"); const encode = @import("encode.zig"); const value = @import("value.zig"); const testing = std.testing; const Format = @import("format.zig").Format; const EncodeError = encode.EncodeError; pub fn encodeValue(allocator: *std.mem.Allocator, v: value.Value) EncodeError![]u8 { return switch...
src/encode_value.zig
const std = @import("std"); // Dross-zig const Dross = @import("dross_zig.zig"); usingnamespace Dross; const Player = @import("sandbox/player.zig").Player; // ------------------------------------------- // Allocator // Application Infomation const APP_TITLE = "Dross-Zig Application"; const APP_WINDOW_WIDTH = 1280; co...
src/main.zig
const std = @import("std"); const example_input = @embedFile("./example_input.txt"); const puzzle_input = @embedFile("./puzzle_input.txt"); pub fn main() void { std.debug.print("--- Part One ---\n", .{}); std.debug.print("Result: {d}\n", .{part1(puzzle_input)}); std.debug.print("--- Part Two ---\n", .{});...
src/day02/day02.zig
//! This struct represents a kernel thread, and acts as a namespace for concurrency //! primitives that operate on kernel threads. For concurrency primitives that support //! both evented I/O and async I/O, see the respective names in the top level std namespace. const std = @import("std.zig"); const os = std.os; con...
lib/std/Thread.zig
const std = @import("std"); const wgi = @import("../WindowGraphicsInput/WindowGraphicsInput.zig"); const FrameBuffer = wgi.FrameBuffer; const ImageType = wgi.ImageType; const ShaderObject = wgi.ShaderObject; const ShaderType = wgi.ShaderType; const ShaderProgram = wgi.ShaderProgram; const window = wgi.window; const Buf...
src/RTRenderEngine/PostProcess.zig
extern "document" fn query_selector(selector_ptr: [*]const u8, selector_len: usize) usize; extern "document" fn create_element(tag_name_ptr: [*]const u8, tag_name_len: usize) usize; extern "document" fn create_text_node(data_ptr: [*]const u8, data_len: usize) usize; extern "element" fn set_attribute(element_id: usize,...
src/zigdom.zig
const assert = @import("std").testing.expectEqual; const MMIO = @import("../../common/mmio.zig").MMIO; const name = "STM32F411"; pub const ADC_Common = extern struct { pub const Address: u32 = 0x40012300; pub const CSR = MMIO(Address + 0x00000000, u32, packed struct { // byte offset: 0 ADC Common status registe...
src/targets/stm32/stm32f411/mmio.zig
const c = @import("c.zig"); const std = @import("std"); usingnamespace @import("log.zig"); /// Error set pub const Error = error{GLFWFailedToInitialize}; fn errorCallback(err: i32, desc: [*c]const u8) callconv(.C) void { std.log.emerg("GLFW -> {}:{*}", .{ err, desc }); } /// Initializes glfw pub fn init() Err...
src/kiragine/kira/glfw.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const c = @cImport(@cInclude("puff.h")); pub export fn main() void { zigMain() catch unreachable; } fn puffAlloc(allocator: Allocator, input: []const u8) ![]u8 { // call once to get the uncompressed length var decoded_len: c_ulong = undefine...
fuzzers/deflate-puff.zig
pub const CBT_COLLISION_FILTER_DEFAULT = @as(c_int, 1); pub const CBT_COLLISION_FILTER_STATIC = @as(c_int, 2); pub const CBT_COLLISION_FILTER_KINEMATIC = @as(c_int, 4); pub const CBT_COLLISION_FILTER_DEBRIS = @as(c_int, 8); pub const CBT_COLLISION_FILTER_SENSOR_TRIGGER = @as(c_int, 16); pub const CBT_COLLISION_FILTER_C...
src/deps/bullet/c.zig
const std = @import("std"); const mem = std.mem; const math = std.math; const ArrayList = std.ArrayList; const Function = @import("function.zig").Function; const Memory = @import("memory.zig").Memory; const Table = @import("table.zig").Table; const Global = @import("global.zig").Global; const Import = @import("common.z...
src/store.zig
const std = @import("std"); const Mat4 = @import("matrix.zig").Mat4; const Vec4 = @import("vector.zig").Vec4; const initPoint = @import("vector.zig").initPoint; const initVector = @import("vector.zig").initVector; const Color = @import("color.zig").Color; const Shape = @import("shape.zig").Shape; const Ray = @import...
world.zig
const std = @import("std"); const Compilation = @import("Compilation.zig"); const Tree = @import("Tree.zig"); const NodeIndex = Tree.NodeIndex; const Object = @import("Object.zig"); const x86_64 = @import("codegen/x86_64.zig"); const Codegen = @This(); comp: *Compilation, tree: Tree, obj: *Object, node_tag: []const T...
src/Codegen.zig
const std = @import("../std.zig"); const CpuFeature = std.Target.Cpu.Feature; const CpuModel = std.Target.Cpu.Model; pub const Feature = enum { @"3dnow", @"3dnowa", @"64bit", adx, aes, amx_bf16, amx_int8, amx_tile, avx, avx2, avx512bf16, avx512bitalg, avx512bw, a...
lib/std/target/x86.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const Target = std.Target; const log = std.log.scoped(.codegen); const spec = @import("spirv/spec.zig"); const Opcode = spec.Opcode; const Module = @import("../Module.zig"); const Decl = Module.Decl; const Type = @import("../type.zig").Type; const Value...
src/codegen/spirv.zig
const Builtin = struct { name: []const u8, signature: []const u8, snippet: []const u8, documentation: []const u8, arguments: []const []const u8, }; pub const builtins = [_]Builtin{ .{ .name = "@addWithOverflow", .signature = "@addWithOverflow(comptime T: type, a: T, b: T, result...
src/data/master.zig
const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; const maxInt = std.math.maxInt; /// Returns the absolute value of x. /// /// Special Cases: /// - fabs(+-inf) = +inf /// - fabs(nan) = nan pub fn fabs(x: var) @typeOf(x) { const T = @typeOf(x); return switch (T) {...
lib/std/math/fabs.zig
const std = @import("../std.zig"); const assert = std.debug.assert; const math = std.math; const mem = std.mem; /// GHASH is a universal hash function that features multiplication /// by a fixed parameter within a Galois field. /// /// It is not a general purpose hash function - The key must be secret, unpredictable ...
lib/std/crypto/ghash.zig
const std = @import("std"); const builtin = @import("builtin"); pub const gpu = @import("gpu/build.zig"); const gpu_dawn = @import("gpu-dawn/build.zig"); pub const glfw = @import("glfw/build.zig"); const freetype = @import("freetype/build.zig"); const Pkg = std.build.Pkg; pub fn build(b: *std.build.Builder) void { ...
build.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const net = std.net; const fs = std.fs; const os = std.os; const fmt = std.fmt; pub const io_mode = .evented; pub fn main() anyerror!void { var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = &general_purpo...
src/main.zig
const std = @import("std"); const mem = std.mem; const ExtendedPictographic = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 169, hi: u21 = 131069, pub fn init(allocator: *mem.Allocator) !ExtendedPictographic { var instance = ExtendedPictographic{ .allocator = allocator, .array = t...
src/components/autogen/emoji-data/ExtendedPictographic.zig
const std = @import("std"); const testing = std.testing; // Import structs. const Ziglyph = @import("../Ziglyph.zig"); const Collator = Ziglyph.Collator; const Grapheme = Ziglyph.Grapheme; const GraphemeIterator = Grapheme.GraphemeIterator; const ComptimeGraphemeIterator = Grapheme.ComptimeGraphemeIterator; const Lett...
src/tests/readme_tests.zig
const std = @import("std"); const input = @import("input.zig"); pub fn run(stdout: anytype) anyerror!void { { var input_ = try input.readFile("inputs/day7"); defer input_.deinit(); const result = try part1(&input_); try stdout.print("7a: {}\n", .{ result }); std.debug.asse...
src/day7.zig
usingnamespace @import("raylib-zig.zig"); pub extern fn Clamp(value: f32, min: f32, max: f32) f32; pub extern fn Lerp(start: f32, end: f32, amount: f32) f32; pub extern fn Normalize(value: f32, start: f32, end: f32) f32; pub extern fn Remap(value: f32, inputStart: f32, inputEnd: f32, outputStart: f32, outputEnd: f32) ...
lib/raylib-zig-math.zig
const std = @import("std"); // libs pub const sokol = @import("sokol"); pub const stb = @import("stb"); pub const imgui = @import("imgui"); pub const filebrowser = @import("filebrowser"); // types pub const Texture = @import("texture.zig").Texture; pub const RenderTexture = @import("render_texture.zig").RenderTexture...
src/upaya.zig
const std = @import("std"); const firm = @import("firmly-zig").low_level; const mainLocalVars = 1; // main function has 1 local variable const dataSize = 30000; // A 30000 byte of storage for brainfuck const variablePointer = 0; // The pointer to the current position in the data var typeBu: ?*firm.ir_type = null; var p...
example/bf_example.zig
const std = @import("std"); const expect = std.testing.expect; const Ram = @import("ram.zig").Ram; test "should initialize correct size of memory locations" { const ram = Ram.init(); expect(ram.memory.len == 0xFFFF); } test "should initialize memory locations to correct values" { const ram = Ram.init(); ...
src/test_ram.zig
const std = @import("std"); const testing = std.testing; const Allocator = std.mem.Allocator; const data = @import("data.zig").table; /// Caller must free returned memory. pub fn unidecodeAlloc(allocator: Allocator, utf8: []const u8) ![]u8 { var buf = try std.ArrayList(u8).initCapacity(allocator, utf8.len); e...
src/unidecode.zig
const std = @import("std"); const time = std.time; const testing = std.testing; const Progress = @This(); fn Typed(comptime Writer: type) type { return struct { width: u32 = 20, total: u32 = 100, left_end: ?u8 = '[', right_end: ?u8 = ']', progress: u32 = 0, filled:...
src/main.zig
const builtin = @import("builtin"); const clap = @import("clap"); const std = @import("std"); const util = @import("util"); const c = @import("c.zig"); const nk = @import("nuklear.zig"); const Executables = @import("Executables.zig"); const debug = std.debug; const fmt = std.fmt; const fs = std.fs; const heap = std....
src/gui/tm35-randomizer.zig
const std = @import("std"); const testing = std.testing; pub fn BinaryTree(comptime T: type) type { return struct { root: usize = 1, items: []?Node, count: usize = 0, capacity: usize = 0, allocator: *std.mem.Allocator, const Self = @This(); pub const Search...
src/binary_tree.zig
const std = @import("../std.zig"); const valgrind = std.valgrind; pub const CallgrindClientRequest = extern enum { DumpStats = valgrind.ToolBase("CT"), ZeroStats, ToggleCollect, DumpStatsAt, StartInstrumentation, StopInstrumentation, }; fn doCallgrindClientRequestExpr(default: usize, request: ...
lib/std/valgrind/callgrind.zig
const std = @import("std"); const format = @import("format.zig"); const request = @import("request.zig"); pub const DiscordLogger = struct { // Token format: "Bot <token>" discord_auth: []const u8, allocator: *std.mem.Allocator, pub fn init(discord_auth: []const u8, allocator: *std.mem.Allocator) Disc...
src/discord_logger/discord_logger.zig
const std = @import("std"); const dbgLog = @import("Log.zig").dbgLog; const c_allocator = std.heap.c_allocator; const tls_ = @import("TLS.zig"); const TLSConnection = tls_.TLSConnection; const HTTPRequestHandler = @import("HTTPRequestHandler.zig"); const ObjectPool = @import("ObjectPool.zig").ObjectPool; const MAX_HEA...
src/HTTPSState.zig
const std = @import("std"); const webgpu = @import("../../webgpu.zig"); const dummy = @import("./dummy.zig"); pub const Buffer = struct { const vtable = webgpu.Buffer.VTable{ .destroy_fn = destroy, .get_const_mapped_range_fn = getConstMappedRange, .get_mapped_range_fn = getMappedRange, ...
src/backends/dummy/resource.zig
const std = @import("std"); const Sector = @import("sector.zig").Sector; pub const Slot = packed struct { // A save slot is comprised of 14 sectors, each 4 KiB, meaning the slot itself is 56 KiB. comptime { std.debug.assert(@sizeOf(Slot) == 0xE000); } sectors: [14]Sector, /// The game see...
src/save/slot.zig
const std = @import("std"); const http = @import("http_server.zig"); const httpc = @import("http_client.zig"); pub fn main() !void { errdefer std.log.err("Fehler!", .{}); defer std.log.debug("main korrekt beendet.", .{}); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); co...
src/main.zig
const std = @import("std"); const assert = std.debug.assert; pub fn main() !void { var input_file = try std.fs.cwd().openFile("input/11.txt", .{}); defer input_file.close(); var buffered_reader = std.io.bufferedReader(input_file.reader()); const count = try simulate(buffered_reader.reader()); std...
src/11_2.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day11.txt"); const Input = struct { energy: [10][10]u8 = undefined, pub fn init(input_text: []const u8, allocator: std.mem.Allocator) !@This() { _ = allocator; var input = Input{}; errdefer ...
src/day11.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day03.txt"); c...
src/day03.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/dialog.zig
const std = @import("std"); const testing = std.testing; const fs = std.fs; const main = @import("main.zig"); const utils = @import("utils.zig"); const config = @import("config.zig"); const kvstore = @import("kvstore.zig"); const Console = @import("console.zig").Console; pub const FilePathEntry = std.BoundedArray(u8, ...
src/argparse.zig
const gllparser = @import("../gllparser/gllparser.zig"); const Error = gllparser.Error; const Parser = gllparser.Parser; const ParserContext = gllparser.Context; const Result = gllparser.Result; const NodeName = gllparser.NodeName; const Literal = @import("../parser/literal.zig").Literal; const LiteralValue = @import(...
src/combn/combinator/optional.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const StringHashMap = std.StringHashMap; const BufMap = std.BufMap; const Buffer = std.Buffer; const fixedBufferStream = std.io.fixedBufferStream; const assert = std.debug.assert; const OrbitMapParseError = error{FormatEr...
zig/06_2.zig
const std = @import("std"); const c = @import("c.zig"); const msgpack = @import("msgpack.zig"); const blocking_queue = @import("blocking_queue.zig"); const RPCQueue = blocking_queue.BlockingQueue(msgpack.Value); const RPC_TYPE_REQUEST: u32 = 0; const RPC_TYPE_RESPONSE: u32 = 1; const RPC_TYPE_NOTIFICATION: u32 = 2; ...
src/rpc.zig
const std = @import("std"); const c = @import("gtk_c.zig"); const g = @import("gtk_lib.zig"); const io = @import("io_native.zig"); const RPC = @import("RPC.zig"); const mem = std.mem; const ArrayList = std.ArrayList; const mpack = @import("./mpack.zig"); const dbg = std.debug.print; const Self = @This(); const io_m...
src/gtk_main.zig
const process = @import("proc.zig"); const std = @import("std"); const Allocator = std.mem.Allocator; pub const CPUFrame = packed struct { tf_sp: u64, //0 tf_lr: u64, //8 tf_elr: u64, //16 tf_spsr: u32, //24 tf_esr: u32, //28 tf_x: [30]u64, //32 }; pub const Thread = struct { next: ?*Thre...
kernel/src/thread.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day22.txt"); const Region3 = struct { on: bool, x0: i64, x1: i64, y0: i64, y1: i64, z0: i64, z1: i64, }; const Input = struct { regions: std.ArrayList(Region3), pub fn init(input_text: [...
src/day22.zig
const std = @import("std"); const alka = @import("alka"); const gui = alka.gui; const m = alka.math; usingnamespace alka.log; pub const mlog = std.log.scoped(.app); pub const log_level: std.log.Level = .info; const virtualwidth: i32 = 1024; const virtualheight: i32 = 768; var vel: f32 = 0; var dir: f32 = 1; fn up...
examples/gui.zig
const std = @import("std"); const ui = @import("ui.zig"); // Deprecated. No longer used due to move away from comptime Config. /// Comptime config passed into ui.Module. /// Contains type information about all the widgets that will be used in the module. pub const Config = struct { const Self = @This(); Imp...
ui/src/config.zig
const std = @import("std"); const assert = std.debug.assert; const Compilation = @import("Compilation.zig"); const Source = @import("Source.zig"); const LangOpts = @import("LangOpts.zig"); const Tokenizer = @This(); pub const Token = struct { id: Id, source: Source.Id, start: u32, end: u32, pub c...
src/Tokenizer.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const boardingPasses = @embedFile("input05.txt"); const BoardingPass = struct { row: u32, column: u32 }; fn getRow(pass: []const u8) u32 { var final: u32 = 0; for (pass) |c| { ...
src/day05.zig
const std = @import("std"); const pkgs = @import("deps.zig").pkgs; pub fn build(b: *std.build.Builder) void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is...
build.zig
pub const UI_ANIMATION_SECONDS_EVENTUALLY = @as(i32, -1); pub const UI_ANIMATION_REPEAT_INDEFINITELY = @as(i32, -1); pub const UI_ANIMATION_REPEAT_INDEFINITELY_CONCLUDE_AT_END = @as(i32, -1); pub const UI_ANIMATION_REPEAT_INDEFINITELY_CONCLUDE_AT_START = @as(i32, -2); pub const UI_ANIMATION_SECONDS_INFINITE = @as(i32, ...
win32/ui/animation.zig
const assert = @import("std").debug.assert; const cgp_gv: *u64 = &gv; var gv: u64 = 123; test "change const cgp_gv, correct compiler error" { var lv: u64 = 47; //lcgp_gv = &lv; // compiler correctly generated "error: cannot assign to constant" } test "change const clp_lv, correct compiler error" { var lv...
const_ptr.zig
const std = @import("std"); const builtin = @import("builtin"); const Allocator = std.mem.Allocator; const HashMap = std.HashMap; const AutoContext = std.hash_map.AutoContext; var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var global_allocator = gpa.allocator(); pub fn main() !void { const stdout = std.io.get...
bench/algorithm/lru/1.zig
const std = @import("std"); const uart = @import("./uart.zig"); const heap = @import("./heap.zig"); pub const Timer = @import("./rupt/timer.zig"); pub const PLIC = @import("./rupt/plic.zig"); const debug = @import("build_options").log_rupt; /// Initialize all necessary values. Must be called as early as possible //...
src/rupt.zig
const std = @import("std"); const mem = std.mem; const fs = std.fs; const Compilation = @import("Compilation.zig"); /// Returns the sub_path that worked, or `null` if none did. /// The path of the returned Directory is relative to `base`. /// The handle of the returned Directory is open. fn testZigInstallPrefix(base_d...
src/introspect.zig
const std = @import("std"); const c = @import("c.zig"); //==================================================================== // Types //==================================================================== pub const chtype = if (c._LP64 == 1) c_uint else u32; pub const mmask_t = if (c._LP64 == 1) c_uint else u32; pu...
src/ncurses.zig
const std = @import("std"); const info = std.log.info; const warn = std.log.warn; const math = std.math; const cop0 = @import("cop0.zig"); const FPUCtrlReg = enum(u32) { FCR31 = 31, }; pub const Cond = enum(u4) { F = 0x0, UN = 0x1, EQ = 0x2, UEQ = 0x3, OLT = 0x4, ULT = 0x5, ...
src/core/cop1.zig
const std = @import("../std.zig"); const assert = std.debug.assert; const utf8Decode = std.unicode.utf8Decode; const utf8Encode = std.unicode.utf8Encode; pub const ParseError = error{ OutOfMemory, InvalidLiteral, }; pub const ParsedCharLiteral = union(enum) { success: u21, failure: Error, }; pub cons...
lib/std/zig/string_literal.zig
const std = @import("std"); const interop = @import("interop.zig"); const iup = @import("iup.zig"); const CallbackHandler = @import("callback_handler.zig").CallbackHandler; /// /// Global handler for unhandled errors thrown inside callback functions pub const ErrorHandlerFn = fn (?Element, anyerror) anyerror!void; /...
src/MainLoop.zig
const std = @import("std"); const Component = @import("../Component.zig"); const Input = @import("../Input.zig"); // Identifies common character states. pub const CombatStateID = enum(u32) { Standing, Crouching, WalkingForward, WalkingBackwards, Jump, _ }; // A context is passed into the comba...
src/ActionStates/StateMachine.zig
const std = @import("std"); const zzz = @import("zzz"); const Import = @import("import.zig").Import; const Allocator = std.mem.Allocator; allocator: *Allocator, file: std.fs.File, deps: std.ArrayList(Import), text: []const u8, const Self = @This(); const ZTree = zzz.ZTree(1, 1000); const ChildIterator = struct { ...
src/manifest.zig
const std = @import("std"); const testing = std.testing; pub fn readULEB128(comptime T: type, in_stream: var) !T { const ShiftT = std.meta.IntType(false, std.math.log2(T.bit_count)); var result: T = 0; var shift: usize = 0; while (true) { const byte = try in_stream.readByte(); if (sh...
lib/std/debug/leb128.zig
const std = @import("std"); const FrameProcessorBase = @import("frame-processor.zig").FrameProcessor; const mc = @import("mc.zig"); const audio = @import("audio-extractor.zig"); usingnamespace @cImport({ @cInclude("jni.h"); @cInclude("win32/jni_md.h"); }); const MinecraftFrameProcessor = FrameProcessorBase(*m...
nativemap/src/jni-lib.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const expectEqualSlices = std.testing.expectEqualSlices; const Context = @import("Context.zig"); const Zigstr = @import("zigstr/Zigstr.zig"); test "REA...
src/zigstr_readme_tests.zig
const Emit = @This(); const std = @import("std"); const assert = std.debug.assert; const bits = @import("bits.zig"); const leb128 = std.leb; const link = @import("../../link.zig"); const log = std.log.scoped(.codegen); const math = std.math; const mem = std.mem; const Air = @import("../../Air.zig"); const DebugInfoO...
src/arch/x86_64/Emit.zig
const std = @import("std"); const Context = @import("context.zig").Context; const SourceRange = @import("context.zig").SourceRange; const BuiltinEnumValue = @import("builtins.zig").BuiltinEnumValue; fn printSourceRange(out: std.io.StreamSource.OutStream, contents: []const u8, source_range: SourceRange) !void { try...
src/zangscript/fail.zig
const std = @import("std"); const assert = std.debug.assert; pub const IntBuf = struct { data: [4096]i32, pw: usize, pr: usize, pub fn init() IntBuf { var self = IntBuf{ .data = undefined, .pw = 0, .pr = 0, }; return self; } pub fn e...
2019/p07/computer.zig
const std = @import("std"); const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; const Checksum = @import("./checksum.zig").Checksum; /// A checksum implementation - using the CRC-32 algorithm. pub fn Crc32() type { return struct { const Self = @This(); const ChecksumType = u32; ...
src/crc-32.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day03.txt"); c...
src/day03.zig
const std = @import("std"); const builtin = @import("builtin"); const Gigatron = @import("gigatron.zig"); const win32 = @import("win32.zig"); const gl = @import("win32_gl.zig"); pub fn hrErr(hresult: win32.foundation.HRESULT) !void { if(hresult >= 0) return; std.log.err("HRESULT error: 0x{X:0>8}\n", .{@bitCas...
zge-windows.zig
const builtin = @import("builtin"); const utils = @import("utils"); const kernel = @import("root").kernel; const print = kernel.print; const fprint = kernel.fprint; const io = kernel.io; const memory = kernel.memory; const putil = @import("util.zig"); const ata = @import("ata.zig"); const ps2 = @import("ps2.zig"); ...
kernel/platform/pci.zig
pub const SysTick = struct { base: usize, const Self = @This(); /// Construct a `SysTick` object using the specified MMIO base address. pub fn withBase(base: usize) Self { return Self{ .base = base }; } /// SysTick Control and Status Register pub fn regCsr(self: Self) *volatile u3...
src/drivers/arm_m.zig
const os = @import("root").os; const std = @import("std"); const builtin = @import("builtin"); const log = os.log; const pci = os.platform.pci; const paging = os.memory.paging; const pmm = os.memory.pmm; const scheduler = os.thread.scheduler; const page_size = os.platform.paging.page_sizes[0]; const abar_size = 0x1...
src/drivers/disk/ahci.zig
pub const grammar = \\Root <- skip ContainerMembers eof \\ \\# *** Top level *** \\ContainerMembers \\ <- TestDecl ContainerMembers \\ / TopLevelComptime ContainerMembers \\ / KEYWORD_pub? TopLevelDecl ContainerMembers \\ / ContainerField COMMA ContainerMembers \\ ...
src/example_data.zig
const builtin = @import("builtin"); const std = @import("std"); const c = @import("c.zig"); const shaderc = @import("shaderc.zig"); const ft = @import("ft.zig"); const Blit = @import("blit.zig").Blit; const Preview = @import("preview.zig").Preview; const Shader = @import("shaderc.zig").Shader; pub const Renderer = s...
src/renderer.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day13.txt"); pub const FoldAxis = union(enum) { horizontal: i32, vertical: i32, }; /// Structure used to store which cells have dots on the paper grid. Because the input we were given /// is _sparse_ (eg. the numb...
src/day13.zig