code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); pub const MESSIBLE = @import("./fomu/messible.zig").MESSIBLE; pub const REBOOT = @import("./fomu/reboot.zig").REBOOT; pub const RGB = @import("./fomu/rgb.zig").RGB; pub const TIMER0 = @import("./fomu/timer0.zig").TIMER0; pub const TOUCH = @import("./fomu/touch.zig").TOUCH; pub const SYSTEM...
riscv-zig-blink/src/fomu.zig
const std = @import("std"); const math = std.math; const mem = std.mem; const Allocator = std.mem.Allocator; const deflate_const = @import("deflate_const.zig"); const deflate = @import("compressor.zig"); const token = @import("token.zig"); const base_match_length = deflate_const.base_match_length; const base_match_...
lib/std/compress/deflate/deflate_fast.zig
const ImageInStream = zigimg.ImageInStream; const ImageSeekStream = zigimg.ImageSeekStream; const PixelFormat = zigimg.PixelFormat; const assert = std.debug.assert; const color = zigimg.color; const errors = zigimg.errors; const std = @import("std"); const testing = std.testing; const netpbm = zigimg.netpbm; const zigi...
tests/netpbm_test.zig
const std = @import("std"); pub const ParamDescription = struct { name: []const u8, label: []const u8, automatable: bool = true, display: fn (f32, []u8) []const u8 = displayDefault, initial: f32 = 0, }; pub fn Parameters(comptime descriptions: []const ParamDescription) type { var initial_value...
src/util/parameters.zig
const ParsingError = @import("errors.zig").ParsingError; // ASCII codes accepted for an URI // Cf: Borrowed from Seamonstar's httparse library. // https://github.com/seanmonstar/httparse/blob/01e68542605d8a24a707536561c27a336d4090dc/src/lib.rs#L63 const URI_MAP = [_]bool{ false, false, false, false, false, false, ...
src/events/utils.zig
pub const ulaw_to_i16 = [256]i16{ -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956, -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764, -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412, -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316, -7932, -7...
src/wav/g711.zig
const std = @import("std"); const datetime = @import("datetime"); const Chat = @import("../Chat.zig"); const ParseResult = union(enum) { ping, clear: ?[]const u8, message: Chat.Message, }; pub fn parseMessage(data: []u8, alloc: std.mem.Allocator, tz: datetime.Timezone) !ParseResult { std.log.debug("da...
src/network/parser.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/day05.txt"); c...
src/day05.zig
usingnamespace @import("../engine/engine.zig"); const std = @import("std"); const testing = std.testing; const mem = std.mem; pub const LiteralContext = []const u8; pub const LiteralValue = struct { /// The `input` string itself. value: []const u8, pub fn deinit(self: *const @This(), allocator: *mem.All...
src/combn/parser/literal.zig
const getty = @import("lib.zig"); const std = @import("std"); /// Deserializer interface. pub usingnamespace @import("de/interface/deserializer.zig"); /// Namespace for deserialization-specific types and functions. pub const de = struct { /// Generic error set for `getty.de.Visitor` implementations. pub cons...
src/de.zig
const ROM_DRIVER_TABLE_PTR_ADDR = 0x1FFF1FF8; const USART0_BASE_ADDR = 0x40064000; const USART1_BASE_ADDR = 0x40068000; const USART2_BASE_ADDR = 0x4006C000; const SYSAHBCLKCTRL_ADDR = 0x40048080; const PINASSIGN0_ADDR = 0x4000C000; pub const UartPort = enum { USART0, USART1, USART2, }; const UartConfig ...
src/hal/uart.zig
const std = @import("std"); const util = @import("util.zig"); const time = std.time; const testing = std.testing; // Default would be read as 1970-01-01T00:00:00Z days: i64 = 0, hours: i64 = 0, minutes: i64 = 0, seconds: i64 = 0, const Self = @This(); const leap_year_months = [_]i64{31, 29, 31, 30, 31, 30, 31, 31, 30...
src/date.zig
const std = @import("std"); const c = @cImport(@cInclude("blake3.h")); const fmt = std.fmt; const mem = std.mem; const testing = std.testing; pub fn addTo(step: *std.build.LibExeObjStep, comptime dir: []const u8) void { step.linkLibC(); step.addIncludeDir(dir ++ "/lib/c"); var defines: std.ArrayListUnma...
blake3/blake3.zig
const Allocator = std.mem.Allocator; const FormatInterface = @import("../format_interface.zig").FormatInterface; const ImageFormat = image.ImageFormat; const ImageReader = image.ImageReader; const ImageInfo = image.ImageInfo; const ImageSeekStream = image.ImageSeekStream; const PixelFormat = @import("../pixel_format.zi...
src/formats/qoi.zig
pub const mach_header = extern struct { magic: u32, cputype: cpu_type_t, cpusubtype: cpu_subtype_t, filetype: u32, ncmds: u32, sizeofcmds: u32, flags: u32, }; pub const mach_header_64 = extern struct { magic: u32, cputype: cpu_type_t, cpusubtype: cpu_subtype_t, filetype: u32...
lib/std/macho.zig
const std = @import("../index.zig"); const c = std.c; const assert = std.debug.assert; pub use @import("darwin_errno.zig"); pub const PATH_MAX = 1024; pub const STDIN_FILENO = 0; pub const STDOUT_FILENO = 1; pub const STDERR_FILENO = 2; /// [MC2] no permissions pub const PROT_NONE = 0x00; /// [MC2] pages can be re...
std/os/darwin.zig
const std = @import("std"); const os = std.os; const mem = std.mem; const Allocator = mem.Allocator; usingnamespace std.os.wasi; /// Type-tag of WASI preopen. /// /// WASI currently offers only `Dir` as a valid preopen resource. pub const PreopenTypeTag = enum { Dir, }; /// Type of WASI preopen. /// /// WASI cur...
lib/std/fs/wasi.zig
const Emit = @This(); const std = @import("std"); const math = std.math; const Mir = @import("Mir.zig"); const bits = @import("bits.zig"); const link = @import("../../link.zig"); const Module = @import("../../Module.zig"); const ErrorMsg = Module.ErrorMsg; const assert = std.debug.assert; const DW = std.dwarf; const l...
src/arch/riscv64/Emit.zig
const std = @import("std"); const input = @import("input.zig"); pub fn run(stdout: anytype) anyerror!void { { var input_ = try input.readFile("inputs/day9"); defer input_.deinit(); const result = try part1(&input_); try stdout.print("9a: {}\n", .{ result }); std.debug.asse...
src/day9.zig
const ImageInStream = zigimg.ImageInStream; const ImageSeekStream = zigimg.ImageSeekStream; const PixelFormat = zigimg.PixelFormat; const assert = std.debug.assert; const bmp = zigimg.bmp; const color = zigimg.color; const errors = zigimg.errors; const std = @import("std"); const testing = std.testing; const zigimg = @...
tests/bmp_test.zig
const std = @import("std"); const util = @import("util"); const Cell = struct { height: u8, basin: bool, }; const Map = struct { data: std.ArrayList(std.ArrayList(Cell)), const Self = @This(); fn init(alloc: *std.mem.Allocator) Self { return .{ .data = std.ArrayList(std.Array...
zig/src/day9.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/day14.txt"); //...
src/day14.zig
pub const IOCTL_STORAGE_BASE = @as(u32, 45); pub const IOCTL_SCMBUS_BASE = @as(u32, 89); pub const IOCTL_DISK_BASE = @as(u32, 7); pub const IOCTL_CHANGER_BASE = @as(u32, 48); pub const FILE_SPECIAL_ACCESS = @as(u32, 0); pub const FILE_DEVICE_UNKNOWN = @as(u32, 34); pub const GUID_DEVINTERFACE_DISK = Guid.initString("53...
win32/system/ioctl.zig
pub const DSSI_READ_ONLY = @as(u32, 1); pub const DSSI_NO_ACCESS_CHECK = @as(u32, 2); pub const DSSI_NO_EDIT_SACL = @as(u32, 4); pub const DSSI_NO_EDIT_OWNER = @as(u32, 8); pub const DSSI_IS_ROOT = @as(u32, 16); pub const DSSI_NO_FILTER = @as(u32, 32); pub const DSSI_NO_READONLY_MESSAGE = @as(u32, 64); //-------------...
win32/security/directory_services.zig
const ImageReader = zigimg.ImageReader; const ImageSeekStream = zigimg.ImageSeekStream; const PixelFormat = zigimg.PixelFormat; const assert = std.debug.assert; const color = zigimg.color; const errors = zigimg.errors; const png = zigimg.png; const std = @import("std"); const testing = std.testing; const zigimg = @impo...
tests/formats/png_misc_test.zig
const std = @import("std"); const pq = @cImport({ @cInclude("libpq-fe.h"); }); pub const version = "0.0.1"; pub const string = []const u8; pub const c_string = [*:0]const u8; pub const ConnectionParams = struct { hostname: string = "localhost", username: string = "postgres", dbname: string = "", ...
postgres.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"); /// Filters are applied in one of two directions: smudging - which is exporting a file from the Git object database to the working /// d...
src/filter.zig
const std = @import("std"); const expect = std.testing.expect; const print = std.debug.print; const fmt = std.fmt; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const GeneralPurposeAllocator = std.heap.GeneralPurposeAllocator; const Input = @import("input.zig"); pub fn main() !void { var gp...
2021/zig/src/day3/main.zig
const std = @import("std"); const math = std.math; const fmt = std.fmt; const HashMap = std.hash_map.HashMap; const mem = std.mem; const hashes = @import("./hashes.zig"); const assertOrPanic = std.debug.assertOrPanic; const debugAllocator = std.debug.global_allocator; pub const Resp3Type = packed enum(u8) { pub ...
src/main.zig
const std = @import("std"); usingnamespace @import("coro.zig"); pub fn StackfullCoroutine(comptime T: type) type { return struct { const Self = @This(); pub const UserFunctionType = fn () void; // members coro: *mco_coro, // functions pub fn init(func...
src/stackfull_coroutine.zig
const __fixdfti = @import("fixdfti.zig").__fixdfti; const std = @import("std"); const math = std.math; const testing = std.testing; const warn = std.debug.warn; fn test__fixdfti(a: f64, expected: i128) void { const x = __fixdfti(a); //warn("a={}:{x} x={}:{x} expected={}:{x}:u64({x})\n", a, @bitCast(u64, a), x,...
lib/std/special/compiler_rt/fixdfti_test.zig
const page_allocator = std.heap.page_allocator; const test_allocator = std.testing.allocator; const std = @import("std"); const CFO = @import("./CFO.zig"); const parse = @import("./parse.zig"); const FLIR = @import("./Old_FLIR.zig"); const builtin = @import("builtin"); const s2 = builtin.zig_backend != .stage1; pub ...
src/stage2_main.zig
const std = @import("std"); const Location = @This(); const VirtualFile = @import("virtual_file.zig"); line_number: i32, column_number: i32, filename: ?Filename, pub const Filename = union(enum) { string: []const u8, virtual_file: *VirtualFile, pub fn format(self: Filename, comptime _: []const u8, _: s...
location.zig
const std = @import("std"); const c = @import("c.zig"); pub const Atlas = struct { const Self = @This(); alloc: *std.mem.Allocator, // Font atlas texture tex: []u32, tex_size: u32, // Position within the atlas texture x: u32, y: u32, max_row_height: u32, glyph_index: u32, ...
src/ft.zig
const std = @import("std"); const assert = std.debug.assert; const log = std.log.scoped(.zig_snapshots); const mem = std.mem; const Allocator = mem.Allocator; const Svg = @import("Svg.zig"); var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; const gpa = general_purpose_allocator.allocator(); va...
src/main.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const L = std.unicode.utf8ToUtf16LeStringLiteral; const zwin32 = @import("zwin32"); const w32 = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hrPanicOnFail; const zd3d12 = @import...
samples/intro/src/intro2.zig
const std = @import("std"); pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); try stdout.print("Hello, {}!\n", .{"world"}); } const expect = std.testing.expect; test "comments" { // comments start with "//" until newline // foo bar baz const x = true; // another comment ...
tests/syntax-tests/source/Zig/example.zig
const std = @import("std"); const aoc = @import("aoc-lib.zig"); const Signal = struct { patterns: [][]const u8, output: [][]const u8, map: [7]u8, alloc: std.mem.Allocator, pub fn init(alloc: std.mem.Allocator, line: []const u8) !*Signal { var sig = try alloc.create(Signal); sig.all...
2021/08/aoc.zig
const c = @cImport({ @cInclude("coremark.h"); @cInclude("core_portme.h"); }); const warn = @import("../nonsecure-common/debug.zig").warn; const timer = @import("../ports/" ++ @import("build_options").BOARD ++ "/timer.zig").timer0; const port_ns = @import("../ports/" ++ @import("build_options").BOARD ++ "/nonse...
examples/nonsecure-bench-coremark/core_portme.zig
pub const std = @import("std"); pub const zzz = @import("zzz"); fn node_functions() !void { var tree = zzz.ZStaticTree(8){}; try zzz.appendText(&tree, null, "foo:bar;biz:baz,boom"); var iter: ?*zzz.ZNode = null; // Iterate nodes in the tree starting from some node. iter = &tree.root; while (i...
examples/api.zig
const std = @import("std"); const testing = std.testing; const http = @import("net/http.zig"); const Peer = @import("Peer.zig"); const Allocator = std.mem.Allocator; const Sha1 = std.crypto.hash.Sha1; const bencode = @import("bencode.zig"); const Torrent = @import("Torrent.zig"); /// Our port we will seed from when w...
src/torrent_file.zig
export fn @"__x86.get_pc_thunk.bx"() void {} export fn _IO_stderr_() void {} export fn _IO_stdin_() void {} export fn _IO_stdout_() void {} export fn _Unwind_Find_FDE() void {} export fn ___brk_addr() void {} export fn __deregister_frame() void {} export fn __deregister_frame_info() void {} export fn __deregister_frame...
libc/dummy/c/i386.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day16.txt"); const Input = struct { bits: std.DynamicBitSet = undefined, pub fn init(input_text: []const u8, allocator: std.mem.Allocator) !@This() { _ = allocator; var input = Input{}; errd...
src/day16.zig
const std = @import("std"); const Builder = @import("std").build.Builder; const Target = @import("std").Target; const CrossTarget = @import("std").zig.CrossTarget; const builtin = @import("builtin"); pub fn build(b: *Builder) void { const wasiTarget = CrossTarget{ .cpu_arch = Target.Cpu.Arch.wasm32, ...
build.zig
const std = @import("std"); const ascii = std.ascii; const debug = std.debug; const fmt = std.fmt; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; const testing = std.testing; pub const default_escapes = blk: { @setEvalBranchQuota(1000000); var res: []const Escape = &[_]Escap...
src/common/escape.zig
const std = @import("std"); const print = std.debug.print; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day24.txt"); const Type = enum { // First the real instructions. inp, add, mul, div, mod, eql, // Then we encode a different instruction for the variant...
src/day24.zig
const std = @import("std"); const os = std.os; const net = std.net; const testing = std.testing; const assert = std.debug.assert; const known_folders = @import("known-folders"); pub const known_folders_config = .{ .xdg_on_mac = true, }; pub const TransportKind = enum { un_socket, }; pub const max_packet_size...
src/transport.zig
const std = @import("std"); const mem = std.mem; pub const Kind = enum { L, T, V, LV, LVT, }; allocator: *mem.Allocator, map: std.AutoHashMap(u21, Kind), const HangulMap = @This(); pub fn init(allocator: *mem.Allocator) !HangulMap { var instance = HangulMap{ .allocator = allocator, ...
src/components/autogen/HangulSyllableType/HangulMap.zig
const std = @import("std"); /// Modes' escape codes. pub const Mode = struct { pub const r = "\x1b[0m"; pub const b = "\x1b[1m"; pub const d = "\x1b[2m"; pub const n = "\x1b[3m"; pub const u = "\x1b[4m"; // Aliases pub const reset = r; pub const underline = u; pub const negate = n;...
src/palettes.zig
const std = @import("std"); const Wal = @import("wal.zig").Wal; const Record = @import("record.zig").Record; const Op = @import("ops.zig").Op; const File = std.fs.File; const ArrayList = std.ArrayList; const lsmtree = @import("main.zig"); const MakeDirError = std.os.MakeDirError; const OpenFileError = std.is.OpenFileEr...
src/disk_manager.zig
const std = @import("std"); const input = @embedFile("day03.txt"); pub fn main() !void { { // Part 1 var lines = std.mem.split(u8, input, "\n"); var bit_counts = [_]u32{0} ** 12; var line_count: usize = 0; while (lines.next()) |bit_pattern| : (line_count += 1) { ...
2021/day03.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); } const Attribs = enum { children, cats, samoyeds, pomeranians, akitas, vizslas, goldfish, tre...
2015/day16.zig
const std = @import("std"); const warn = std.debug.warn; const wgi = @import("WindowGraphicsInput/WindowGraphicsInput.zig"); const window = wgi.window; const input = wgi.input; const c = wgi.c; const Constants = wgi.Constants; const vertexarray = wgi.vertexarray; const buffer = wgi.buffer; const render = @import("RTRe...
src/Demo2.zig
const std = @import("std"); const testing = std.testing; const c = @import("c/c.zig"); const utils = @import("utils.zig"); pub usingnamespace @import("types.zig"); pub usingnamespace @import("events.zig"); pub const ConsoleApp = struct { const Self = @This(); stdin_handle: c.HANDLE, stdout_handle: c.HAND...
src/main.zig
const std = @import("std"); const json = std.json; const Tuple = std.meta.Tuple; pub fn IntBackedEnumStringify(comptime T: type) type { return struct { pub fn jsonStringify(value: T, options: json.StringifyOptions, out_stream: anytype) !void { try json.stringify(@enumToInt(value), options, out_...
src/base.zig
const std = @import("std"); const MoveType = enum { ship, waypoint, }; const Ferry = struct { x: i64, y: i64, waypoint_x: i64, waypoint_y: i64, fn move(self: *Ferry, dx: i64, dy: i64, steps: i64, navigation_type: MoveType) void { var x_ptr = if (navigation_type == .ship) &self.x e...
src/day-12/main.zig
const std = @import("std"); const Builder = @import("std").build.Builder; //var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var buffer = [_]u8{0} ** 4194304; var fba = std.heap.FixedBufferAllocator.init(buffer[0..]); const alloc = &fba.allocator; fn build_http_parser(b: *Builder) *std.build.RunStep { const ensu...
build.zig
const std = @import("std"); const StringList = std.ArrayList([]const u8); pub const ConfigDirectives = struct { strict_links: bool = true, index: ?[]const u8 = null, webroot: []const u8 = "", project_footer: bool = false, }; fn parseBool(string: []const u8) bool { if (std.mem.eql(u8, "yes", strin...
src/build_file.zig
const std = @import("std"); const testing = std.testing; //! Contains what Luf sees as tokens //! This file solely contains the definitions of all tokens //! the parsing of the tokens can be found in the `Lexer`. /// Type Luf uses to define a token in the language const Token = @This(); token_type: TokenType, start:...
src/Token.zig
const std = @import("std"); const builtin = @import("builtin"); const trace = @import("tracy.zig").trace; const fs = std.fs; const io = std.io; const mem = std.mem; const logger = std.log.scoped(.archive_main); const process = std.process; const Archive = @import("archive/Archive.zig"); const overview = \\Zig Arc...
src/main.zig
const std = @import("std"); const builtin = @import("builtin"); const stdx = @import("stdx"); const platform = @import("platform"); const Window = platform.Window; const graphics = @import("graphics"); const Color = graphics.Color; const ui = @import("ui"); const EventDispatcher = platform.EventDispatcher; const log = ...
ui/examples/helper.zig
const std = @import("std"); const builtin = @import("builtin"); const is_test = builtin.is_test; const os_tag = builtin.os.tag; const arch = builtin.cpu.arch; const abi = builtin.abi; const is_gnu = abi.isGnu(); const is_mingw = os_tag == .windows and is_gnu; const is_darwin = std.Target.Os.Tag.isDarwin(os_tag); cons...
lib/std/special/compiler_rt.zig
const std = @import("std.zig"); const debug = std.debug; const mem = std.mem; const Allocator = mem.Allocator; const assert = debug.assert; const testing = std.testing; const ArrayList = std.ArrayList; /// A buffer that allocates memory and maintains a null byte at the end. pub const Buffer = struct { list: ArrayL...
lib/std/buffer.zig
const std = @import("std"); const builtin = @import("builtin"); fn offsetPtr(ptr: [*]const u8, offset: usize) callconv(.Inline) [*]const u8 { // ptr + offset doesn't work at comptime so we need this instead. return @ptrCast([*]const u8, &ptr[offset]); } fn fetch32(ptr: [*]const u8, offset: usize) u32 { re...
lib/std/hash/cityhash.zig
const TestContext = @import("../../src-self-hosted/test.zig").TestContext; pub fn addCases(ctx: *TestContext) void { ctx.addZIRTransform("elemptr, add, cmp, condbr, return, breakpoint", \\@void = primitive(void) \\@usize = primitive(usize) \\@fnty = fntype([], @void, cc=C) \\@0 = in...
test/stage2/zir.zig
const std = @import("std"); const builtin = @import("builtin"); const testing = std.testing; const math = std.math; const root = @import("root"); const io = std.io; const os = std.os; const fs = std.fs; // TODO: check windows support const windows = os.windows; const posix = os.posix; const Mutex = std.Mutex; // TO...
src/index.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); pub const main = tools.defaultMain("2021/day04.txt", run); pub fn run(input: []const u8, gpa: std.mem.Allocator) tools.RunError![2][]const u8 { var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); ...
2021/day04.zig
const Allocator = @import("std").mem.Allocator; const ArenaAllocator = @import("std").heap.ArenaAllocator; const ArrayList = @import("std").ArrayList; const IntegerColor8 = @import("color.zig").IntegerColor8; const MaxDepth = 8; pub const OctTreeQuantizer = struct { rootNode: OctTreeQuantizerNode, levels: [Ma...
src/octree_quantizer.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const AutoHashMap = 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/pu...
src/day13.zig
const std = @import("std"); const assert = std.debug.assert; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); var input_file = try std.fs.cwd().openFile("input/13.txt", .{}); defer input_file.close(); var buffe...
src/13_2.zig
const std = @import("std"); const math = std.math; const Allocator = std.mem.Allocator; const PixelFormat = @import("pixel_format.zig").PixelFormat; const TypeInfo = std.builtin.TypeInfo; pub inline fn toColorInt(comptime T: type, value: f32) T { return math.max(math.minInt(T), math.min(math.maxInt(T), @floatToInt...
src/color.zig
const std = @import("std"); const assert = std.debug.assert; const img = @import("Image.zig"); const ImageType = img.ImageType; const CubeMap = @import("CubeMap.zig").CubeMap; const FrameBuffer = @import("FrameBuffer.zig").FrameBuffer; const window = @import("Window.zig"); const c = @import("c.zig").c; const ReferenceC...
src/WindowGraphicsInput/CubeFrameBuffer.zig
const std = @import("std.zig"); const mem = std.mem; /// Like ComptimeStringHashMap but optimized for small sets of disparate string keys. /// Works by separating the keys by length at comptime and only checking strings of /// equal length at runtime. /// /// `kvs` expects a list literal containing list literals or an...
lib/std/comptime_string_map.zig
const std = @import("std"); const ansi = @import("ansi"); const zwc = @import("zwc"); pub fn main() !void { var con = try zwc.ConsoleApp.init(); var stdout = std.io.getStdOut().writer(); var before_cp = con.getCodepage(); var before_input_mode = try con.getInputMode(); var before_output_...
examples/events.zig
const std = @import("std"); const config = @cImport(@cInclude("config.h")); pub const Score = f64; pub const SCORE_MIN = -std.math.f64_max; pub const SCORE_MAX = std.math.f64_max; pub const MAX_LEN = 1024; const BONUS_INDEX = init: { comptime var table: [256]usize = undefined; std.mem.set(usize, &table, 0)...
src/match.zig
const Self = @This(); const build_options = @import("build_options"); const std = @import("std"); const mem = std.mem; const assert = std.debug.assert; const wlr = @import("wlroots"); const wl = @import("wayland").server.wl; const server = &@import("main.zig").server; const util = @import("util.zig"); const Output ...
source/river-0.1.0/river/Root.zig
const std = @import("std"); // utility for checking if a value is a string. follows optionals and pointers. if string then returns the string value pub fn isString(value: var) ?[]const u8 { const Info = @typeInfo(@TypeOf(value)); switch (Info) { .Pointer => |p| { if (p.size == .Slice and p....
src/utility.zig
const fun = @import("fun"); const std = @import("std"); const debug = std.debug; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; const scan = fun.scan.scan; pub fn main() !void { const stdin = &(try io.getStdIn()).inStream().stream; const stdout = &(tr...
src/day2.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const AutoHashMap = std.AutoHashMap; const test_allocator = std.testing.allocator; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const ArrayList = std.ArrayList; usingnam...
src/ui.zig
pub const bmp = @import("bmp.zig"); pub const png = @import("png.zig"); const std = @import("std"); const Allocator = std.mem.Allocator; pub const ColorChannel = enum { Red, Green, Blue, Alpha }; //// A pixel format. Note that it only represents the sRGB color space. pub const ImageFormat = struct { ...
didot-image/image.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const vk = @import("../include/vk.zig"); const glfw = @import("../include/glfw.zig"); const windowing = @import("../windowing.zig"); const BackendError = @import("backend.zig").BackendError; const Context = @import("context.zig").Context; pub const Sw...
render/src/backend/swapchain.zig
const std = @import("std"); const builtin = @import("builtin"); const VM = @import("./vm.zig").VM; const _value = @import("./value.zig"); const _obj = @import("./obj.zig"); const dumpStack = @import("./disassembler.zig").dumpStack; const Config = @import("./config.zig").Config; const Value = _value.Value; const valueT...
src/memory.zig
//Zglfw //Mit License // //Copyright (C) 2020 Iridescence Technologies // //Permission Is Hereby Granted, Free Of Charge, To Any Person Obtaining A Copy //Of This Software And Associated Documentation Files (The "Software"), To Deal //In The Software Without Restriction, Including Without Limitation The Rights //To Us...
src/core/glfw.zig
const std = @import("std"); const stdx = @import("../stdx.zig"); const ds = stdx.ds; const t = stdx.testing; const log = stdx.log.scoped(.walk); // Iterative walking. Let's us reuse the same walkers for dfs/bfs walking. // Also makes it easier to add features at comptime like abort during a visit. // Depends on a buff...
stdx/algo/walk.zig
const std = @import("std"); const cli = @import("cli.zig"); const utils = @import("utils.zig"); const templator = @import("templator.zig"); var a: std.mem.Allocator = undefined; const io = std.io; const help = \\USAGE: \\$ colorstorm [-o outdir] [-g generator] input \\ \\-o|--outdir: The directory to ...
src/main.zig
const std = @import("std"); const sqlite = @import("sqlite"); const manage_main = @import("main.zig"); const Context = manage_main.Context; const tunez = @import("tunez"); const libpcre = @import("libpcre"); const log = std.log.scoped(.ainclude); const VERSION = "0.0.1"; const HELPTEXT = \\ ainclude: include a f...
src/include_main.zig
const std = @import("std"); const DiagnosticTag = @import("Diagnostics.zig").Tag; const LangOpts = @This(); const Standard = enum { /// ISO C 1990 c89, /// ISO C 1990 with amendment 1 iso9899, /// ISO C 1990 with GNU extensions gnu89, /// ISO C 1999 c99, /// ISO C 1999 with GNU ext...
src/LangOpts.zig
const std = @import("std"); const learn = @import("learnBPE.zig"); const Allocator = std.mem.Allocator; const File = std.fs.File; const assert = std.debug.assert; const warn = std.debug.warn; const debug = std.debug.warn; const OutOfMemory = std.mem.Allocator.Error; pub fn applybpe(input: File, codes: File, vocab_path...
fastBPE/applyBPE.zig
const std = @import("std"); const log = std.log.scoped(.zben); const testing = std.testing; // Parser section pub const BencodeTypes = enum { String, Integer, List, Dictionary, }; const Dictionary = std.StringHashMap(Value); const List = std.ArrayList(Value); pub const Value = union(enum) { Empty...
src/main.zig
const std = @import("std"); const upaya = @import("upaya"); usingnamespace upaya.imgui; usingnamespace upaya.sokol; const Mat4 = upaya.math.Mat4; const Vec3 = upaya.math.Vec3; var state = struct { render_texture: upaya.RenderTexture = undefined, offscreen_pass: sg_pass = undefined, pass_action: sg_pass_act...
examples/offscreen_rendering.zig
const std = @import("std"); const unistd = @cImport(@cInclude("unistd.h")); fn notify(msg: []const u8) void { const addr = std.net.Address.parseIp("127.0.0.1", 9001) catch unreachable; if (std.net.tcpConnectToAddress(addr)) |stream| { defer stream.close(); _ = stream.write(msg) catch unreachabl...
base64/test.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/day11.txt"); fn loadLines(allocator: *Allocator, string: []const u8) !ArrayList([]const u8) { var lines = ArrayList([]...
src/day11.zig
const std = @import("std"); const build_map = @import("build_map.zig"); const Node = std.zig.ast.Node; const Tree = std.zig.ast.Tree; const StateMap = std.StringHashMap([]u8); /// Serialize a string into the given serializer. Uses a simple u29 length /// prefix + the string itself. fn serializeStr(serializer: var, st...
src/state.zig
const inputFile = @embedFile("./input/day09.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(compti...
src/day09.zig
const std = @import("std"); const chunks = @import("./chunks.zig"); const values = @import("./value.zig"); const Chunk = chunks.Chunk; const OpCode = chunks.OpCode; pub fn dissasembleChunk(chunk: *Chunk, comptime name: []const u8) void { std.debug.print("=== {s} ===\n", .{name}); const code = chunk.code; v...
src/debug.zig
pub const BufferMapCallback = fn ( status: BufferMapAsyncStatus, userdata: *c_void, ) callconv(.C) void; pub const CreateComputePipelineAsyncCallback = fn ( status: CreatePipelineAsyncStatus, pipeline: ComputePipeline, message: [*:0]const u8, userdata: *c_void, ) callconv(.C) void; pub const C...
zgpu.zig
const std = @import("std"); const protobuf = @import("protobuf.zig"); usingnamespace protobuf; usingnamespace std; const eql = mem.eql; const Demo1 = struct { a: ?u32, pub const _desc_table = .{ .a = fd(1, FieldType{ .Varint = .Simple }) }; pub fn encode(self: Demo1, allocator: *mem.Allocator) ![]u8 { ...
src/tests.zig
const std = @import("std"); const io = std.io; const Allocator = std.mem.Allocator; const File = std.fs.File; const ascI64 = std.sort.asc(i64); fn closeFile(f: *File) void { f.close(); } fn closeNop(f: *File) void {} pub fn main() anyerror!void { const stdout = io.getStdOut().writer(); var arena = std....
day10/src/main.zig
const std = @import("std"); const io = std.io; const Allocator = std.mem.Allocator; const BitSet = @import("nil").bits.BitSet; pub fn main() anyerror!void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const alloc = &arena.allocator; var buf: [4000]u8 = und...
day5/src/main.zig
pub const __builtin_bswap16 = @import("std").zig.c_builtins.__builtin_bswap16; pub const __builtin_bswap32 = @import("std").zig.c_builtins.__builtin_bswap32; pub const __builtin_bswap64 = @import("std").zig.c_builtins.__builtin_bswap64; pub const __builtin_signbit = @import("std").zig.c_builtins.__builtin_signbit; ...
src/translate-c/raylib_all.zig