code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const fs = std.fs; const math = std.math; const draw = @import("pixel_draw.zig"); usingnamespace draw.vector_math; const Texture = draw.Texture; const voxel = @import("voxel.zig"); // ========== Global Variables =======...
src/main.zig
const c = @import("c.zig"); const std = @import("std"); const zigimg = @import("zigimg"); const Allocator = std.mem.Allocator; pub fn sdlTextureFromImage(renderer: * c.SDL_Renderer, image : zigimg.image.Image) ! *c.SDL_Texture { const pxinfo = try PixelInfo.from(image); // if I don't do the trick with bre...
src/utils.zig
pub const Os = enum { freestanding, ananas, cloudabi, darwin, dragonfly, freebsd, fuchsia, ios, kfreebsd, linux, lv2, macosx, netbsd, openbsd, solaris, windows, haiku, minix, rtems, nacl, cnk, bitrig, aix, cuda, nvcl, ...
parser/zig-cache/builtin.zig
const Module = @This(); const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const ZigDecl = @import("../../Module.zig").Decl; const spec = @import("spec.zig"); const Word = spec.Word; const IdRef = spec.IdRef; const IdResult = spec.IdResult; const IdResultType = spec.IdR...
src/codegen/spirv/Module.zig
const windows = @import("std").os.windows; pub const WAVE_FORMAT_PCM = 0x01; pub const WHDR_INQUEUE = 0x10; pub const WAVE_MAPPER = 0xffffffff; pub const CALLBACK_NULL = 0x0; pub const UINT_PTR = usize; pub const MMError = error { Error, BadDeviceID, Allocated, InvalidHandle, NoDriver, NoMem...
src/windows/winnm.zig
const std = @import("std"); const testing = std.testing; /// All subfunctions have to be run as `comptime` or in `comptime` blocks. pub fn ComptimeArrayList(comptime T: type) type { return struct { const Self = @This(); items: []T, pub fn init() Self { comptime var initial = [...
src/comptime_array_list.zig
const is_linux = comptime std.Target.current.os.tag == .linux; pub const io_mode = .evented; var server: network.Socket = undefined; pub fn main() !void { print("http server...\n", .{}); // var aa = std.heap.ArenaAllocator.init(std.heap.page_allocator); // defer aa.deinit(); // var allocator = &aa.al...
98_http_server/example.zig
const std = @import("std"); pub const Quality = enum { fast, beautiful, }; const Point = struct { x: i32, y: i32, }; const Rectangle = struct { /// inclusive left bound left: i32, /// inclusive upper bound top: i32, /// exlusive right bound right: i32, /// exlusive lowe...
src/rasterizer.zig
const std = @import("std"); const builtin = @import("builtin"); const Atomic = @import("atomic.zig").Atomic; const SegmentedList = std.SegmentedList; const Allocator = std.mem.Allocator; pub fn Deque(comptime T: type, comptime P: usize) type { return struct { const Self = @This(); const List = Se...
src/deque.zig
const std = @import("std"); const testing = std.testing; pub const ParseError = error{ Overflow, EndOfStream, OutOfMemory, }; pub const Uint64Coder = struct { pub const primitive = u64; pub fn encodeSize(data: u64) usize { const bits = u64.bit_count - @clz(u64, data); return std.m...
src/coder.zig
const zfltk = @import("zfltk"); const app = zfltk.app; const widget = zfltk.widget; const window = zfltk.window; const menu = zfltk.menu; const enums = zfltk.enums; const text = zfltk.text; const dialog = zfltk.dialog; // To avoid exiting when hitting escape. // Also logic can be added to prompt the user to save their...
examples/editor.zig
const std = @import("../std.zig"); const assert = std.debug.assert; const builtin = @import("builtin"); const macho = std.macho; usingnamespace @import("../os/bits.zig"); extern "c" fn __error() *c_int; pub extern "c" fn NSVersionOfRunTimeLibrary(library_name: [*:0]const u8) u32; pub extern "c" fn _NSGetExecutablePat...
lib/std/c/darwin.zig
const std = @import("std"); const fs = std.fs; const fmt = std.fmt; const assert = std.debug.assert; // Example abilist path: // ./sysdeps/unix/sysv/linux/aarch64/libc.abilist const AbiList = struct { targets: []const ZigTarget, path: []const u8, }; const ZigTarget = struct { arch: std.Target.Cpu.Arch, ...
tools/update_glibc.zig
files: []const []const u8, verbose: VerboseTargets, const std = @import("std"); const Allocator = std.mem.Allocator; const clap = @import("clap"); const term = @import("term.zig"); pub const version: std.SemanticVersion = .{ .major = 0, .minor = 1, .patch = 0 }; pub const VerboseTargets = packed struct { token...
fexc/src/Options.zig
const std = @import("std"); const gpa = std.heap.c_allocator; const fs = std.fs; const known_folders = @import("known-folders"); const u = @import("./../util/index.zig"); const common = @import("./../common.zig"); // // pub fn execute(args: [][]u8) !void { // const dir = try fs.path.join(gpa, &.{".zigmod", "...
src/cmd/fetch.zig
const std = @import("std"); const clap = @import("clap"); const container = @import("container.zig"); const stdout = std.io.getStdOut().writer(); const stderr = std.io.getStdErr().writer(); pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); cons...
src/main.zig
const std = @import("std"); const zlm = @import("zlm"); const block_length = @import("../render/texture_atlas.zig").block_length; const gl = @import("gl.zig"); const TextureAtlas = @import("texture_atlas.zig").TextureAtlas; const TextureSpec = @import("../track/piece_renderer.zig").TextureSpec; const Vertex = @import...
src/render/renderer.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 pcx = zigimg.pcx; const std = @import("std"); const testing = std.testing; const zigimg = @impo...
tests/formats/pcx_test.zig
pub fn Set(comptime T: type) type { return struct { const Self = @This(); const Storage = @IntType(false, @memberCount(T)); data: Storage, pub fn empty() Self { return Self { .data = Storage(0), }; } pub fn universal() Self ...
src/index.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const testing = std.testing; // TODO: If we get functions with capture one day, then "comptime nextFn fn (&Context) ?Result" wont work, because then those // can't be used. We could store the function in the iterator. The iterator will the...
fun/iterators.zig
const std = @import("std"); const builtin = std.builtin; const debug = std.debug; const heap = std.heap; const mem = std.mem; const process = std.process; /// An example of what methods should be implemented on an arg iterator. pub const ExampleArgIterator = struct { const Error = error{}; pub fn next(iter: ...
clap/args.zig
const std = @import("std"); const builtin = @import("std").builtin; const kprint = @import("kprint.zig"); const kernel_elf = @import("kernel_elf.zig"); var kernel_panic_allocator_bytes: [5 * 1024 * 1024]u8 = undefined; var kernel_panic_allocator_state = std.heap.FixedBufferAllocator.init(kernel_panic_allocator_bytes[...
kernel/src/panic.zig
const std = @import("std"); const zdf = @import("./src/zdf/src/main.zig"); const templatesPath = "./gitignore/templates"; const filenameWithoutExtension = zdf.utils.filenameWithoutExtension; fn countFiles(path: []const u8) !usize { var dir = try std.fs.cwd().openDir(path, .{ .iterate = true }); defer dir.clos...
build.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 State = struct { hall...
src/day23.zig
const std = @import("std"); const assert = std.debug.assert; const util = @import("util.zig"); const testing = std.testing; pub usingnamespace(@import("types.zig")); pub const avx = @import("avx.zig"); pub const database = @import("database.zig"); pub const operand = @import("operand.zig"); pub const register = @impo...
src/x86/machine.zig
const std = @import("std"); const TCCErrorFunc = fn (user: ?*c_void, message: [*:0]const u8) callconv(.C) void; const TCCErrorCode = extern enum { success = 0, failed = -1, }; pub const OutputType = extern enum { memory = 1, exe = 2, dll = 3, obj = 4, preprocessor = 5, }; const TCCReloca...
src/tcc.zig
const config = @import("config.zig"); const c = @import("c.zig"); const X = @import("x.zig"); const std = @import("std"); const wm = @import("wm.zig"); const colors = @import("colors.zig"); const commands = @import("commands.zig"); const xdraw = @import("xdraw.zig"); const layouter = @import("layouter.zig"); const warn...
src/main.zig
const std = @import("std"); const debug = std.debug; const io = std.io; pub fn print(value: anytype) void { debug.getStderrMutex().lock(); defer debug.getStderrMutex().unlock(); const stderr = io.getStdErr().writer(); nosuspend { stderr.writeAll("\x1b[41m") catch return; switch (@type...
src/lib/common/debug.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/expander.zig
const std = @import("std"); const Lua = @import("lua.zig").Lua; const assert = std.debug.assert; test "set/get scalar" { var lua = try Lua.init(std.testing.allocator); defer lua.destroy(); const int16In: i16 = 1; const int32In: i32 = 2; const int64In: i64 = 3; const f16In: f16 = 3.1415; co...
src/tests.zig
pub usingnamespace @import("common.zig"); const p = @import("common.zig"); pub const vec2 = @import("vec2.zig"); pub const vec3 = @import("vec3.zig"); pub const mat4x4 = @import("mat4x4.zig"); pub const Mat4x4f = mat4x4.Generic(f32); pub const Vec2f = vec2.Generic(f32); pub const Vec3f = vec3.Generic(f32); /// Helpe...
src/core/math/math.zig
// Implemented features: // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. // Missing features: // [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914 // You can copy and use unmodified imgui_impl_* f...
examples/imgui_impl_vulkan.zig
const std = @import("std"); const mem = std.mem; const SentenceTerminal = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 33, hi: u21 = 121480, pub fn init(allocator: *mem.Allocator) !SentenceTerminal { var instance = SentenceTerminal{ .allocator = allocator, .array = try allocator....
src/components/autogen/PropList/SentenceTerminal.zig
const std = @import("std"); const string = []const u8; const u = @import("index.zig"); // // pub const b = 1; pub const kb = b * 1024; pub const mb = kb * 1024; pub const gb = mb * 1024; pub fn print(comptime fmt: string, args: anytype) void { std.debug.print(fmt ++ "\n", args); } const ansi_red = "\x1B[31m"; ...
src/util/funcs.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"); //...
src/day05.zig
//-------------------------------------------------------------------------------- // Section: Types (1) //-------------------------------------------------------------------------------- const IID_IChannelCredentials_Value = Guid.initString("181b448c-c17c-4b17-ac6d-06699b93198f"); pub const IID_IChannelCredentials = ...
win32/system/com/channel_credentials.zig
pub const FILE_DEVICE_SMARTCARD = @as(u32, 49); pub const GUID_DEVINTERFACE_SMARTCARD_READER = Guid.initString("50dd5230-ba8a-11d1-bf5d-0000f805f530"); pub const SCARD_ATR_LENGTH = @as(u32, 33); pub const SCARD_PROTOCOL_UNDEFINED = @as(u32, 0); pub const SCARD_PROTOCOL_T0 = @as(u32, 1); pub const SCARD_PROTOCOL_T1 = @a...
win32/security/credentials.zig
const std = @import("std"); pub const SRANDMEMBER = struct { key: []const u8, count: Count, pub const Count = union(enum) { One, Count: usize, pub const RedisArguments = struct { pub fn count(self: Count) usize { return switch (self) { ...
src/commands/sets/srandmember.zig
const std = @import("std"); const DebugAllocator = @This(); fn toMB(value: var) f64 { return switch (@TypeOf(value)) { f64 => value / (1024 * 1024), else => @intToFloat(f64, value) / (1024 * 1024), }; } const Stats = struct { mean: f64 = 0, mean_of_squares: f64 = 0, total: usize ...
src/debug_allocator.zig
const std = @import("std"); const warn = std.debug.warn; const CanonicalHuffmanTree = @import("./huffman.zig").CanonicalHuffmanTree; pub fn BlockTree(comptime InputBitStream: type) type { return struct { const Self = @This(); lit_tree: CanonicalHuffmanTree(u4, u9, 31 + 257), dist_tree: Ca...
src/block_tree.zig
const std = @import("std"); const os = @import("root").os; var debug_allocator_bytes: [1024 * 1024]u8 = undefined; var debug_allocator_state = std.heap.FixedBufferAllocator.init(debug_allocator_bytes[0..]); pub const debug_allocator = &debug_allocator_state.allocator; extern var __debug_info_start: u8; extern var __...
src/lib/debug.zig
const std = @import("std"); const lib = @import("lib.zig"); const mem = std.mem; const fmt = std.fmt; const meta = std.meta; const testing = std.testing; const Allocator = std.mem.Allocator; const Reactor = std.x.os.Reactor; const Session = lib.Session; const XAuth = lib.XAuth; const request = lib.request; const Cli...
src/main.zig
const std = @import("std"); pub fn main() anyerror!void { //std.debug.warn("All your base are belong to us.\n"); // If this program is run without stdin or stdout attached, exit with an error. const stdin_file = std.io.getStdIn(); const out = std.io.getStdOut().outStream(); var buffer: [1000]u8 =...
003-hq9+/src/main.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const data = @embedFile("data/day11.txt"); pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); const ally = &arena.allocator; var width = s...
src/day11.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const Metadata = @import("metadata.zig").Metadata; const latin1ToUtf8 = @import("latin1.zig").latin1ToUtf8; pub const id3v1_identifier = "TAG"; pub const tag_size = 128; /// Assumes the stream cursor is at the end of the ID3v1 tag pub fn read(allocator:...
src/id3v1.zig
usingnamespace @import("bits.zig"); const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const windows = @import("../windows.zig").windows; const unexpectedError = std.os.windows.unexpectedError; const GetLastError = windows.kernel32.GetLastError; const SetLastError = windows...
didot-zwl/zwl/src/windows/user32.zig
const std = @import("std"); const zort = @import("main.zig"); pub fn tailSort( comptime T: type, allocator: std.mem.Allocator, arr: []T, cmp: zort.CompareFn(T), ) !void { if (arr.len < 2) return; try tailMerge(T, allocator, arr, cmp, 1); } /// Bottom up merge sort. It copies the right block ...
src/tail.zig
const std = @import("std"); const warn = std.debug.print; const Allocator = std.mem.Allocator; const c = @cImport({ @cInclude("unistd.h"); @cInclude("errno.h"); @cInclude("sys/epoll.h"); }); pub const SocketType = c_int; pub const Client = packed struct { readEvent: *c.epoll_event, readSocket: Soc...
src/ipc/epoll.zig
pub fn noise(x: f64, y: f64, z: f64) f64 { const cube_x = @floatToInt(u32, x) & 255; const cube_y = @floatToInt(u32, y) & 255; const cube_z = @floatToInt(u32, z) & 255; const local_x = x - @intToFloat(f64, cube_x); const local_y = y - @intToFloat(f64, cube_y); const local_z = z - @intToFloat(f...
modules/algo/src/perlin.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const testing = std.testing; usingnamespace @import("sparse_set.zig"); const Entity = u32; const DenseT = u8; const Vec3 = struct { x: f32 = 0, y: f32 = 0, z: f32 = 0, }; const DefaultTestSparseSet = SparseSet(.{ .SparseT = Entity, ...
src/test.zig
const std = @import("std"); const aoc = @import("aoc-lib.zig"); const Mess = struct { const Field = struct { min1: i64, max1: i64, min2: i64, max2: i64, pub fn inRange(self: *Field, v: i64) bool { return (v >= self.min1 and v <= self.max1) or (v >...
2020/16/aoc.zig
const std = @import("std"); usingnamespace @import("parse_helpers.zig"); usingnamespace @import("../winmd.zig"); const win32: []const u8 = @embedFile("../default/Windows.Win32.winmd"); const winRT: []const u8 = @embedFile("../default/Windows.WinRT.winmd"); const Allocator = std.mem.Allocator; /// TypeRow contains th...
src/winmd/type_reader.zig
const Allocator = std.mem.Allocator; const std = @import("std"); const BufMap = std.BufMap; const Entry = std.StringHashMap([]const u8).Entry; const printError = @import("print_error.zig").printError; pub const Config = struct { allocator: Allocator, appname: []const u8, config_file: []const u8, map: ...
src/application/config.zig
const std = @import("std"); const fs = std.fs; const print = std.debug.print; const Allocator = std.heap.c_allocator; const sdl = @cImport({ @cInclude("SDL2/SDL.h"); }); const time = @cImport({ @cInclude("sys/time.h"); }); const c = @cImport({ @cInclude("png.h"); @cInclude("setjmp.h"); }); fn sdl_check...
src/main.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/09.txt", .{}); defer input_file.close(); var buffe...
src/09_2.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const testing = std.testing; const input_file = "input07.txt"; const Child = struct { color: []const u8, amount: u32, }; const Rules = std.StringHashMap([]const Child); fn parseRules(allocator: *Allocator, reader: anytype) !Rules { var res...
src/07_2.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; const zero_struct = @import("util.zig").zero_struct; pub const sokol = @cImport({ @cDefine("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", ""); @cInclude("sokol/sokol_app.h"); @cInclude("sokol/sokol_gfx.h"); @cInclude("sokol/s...
code/main/main_sokol.zig
const std = @import("std"); const mem = std.mem; const testing = std.testing; const EditorMode = @import("state.zig").EditorMode; const zzz = @import("zzz"); const kisa = @import("kisa"); // TODO: display errors from config parsing. pub const allowed_keypress_commands = [_]kisa.CommandKind{ .nop, .insert_char...
src/config.zig
const std = @import("std"); pub fn build(b: *std.build.Builder) void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const exe = b.addExecutable("kisa", "src/main.zig"); exe.addPackagePath("zzz", "libs/zzz/src/main.zig"); exe.addPackagePath("known-folders", ...
build.zig
const std = @import("../index.zig"); const builtin = @import("builtin"); const Os = builtin.Os; const debug = std.debug; const assert = debug.assert; const mem = std.mem; const fmt = std.fmt; const Allocator = mem.Allocator; const os = std.os; const math = std.math; const posix = os.posix; const windows = os.windows; c...
std/os/path.zig
const std = @import("std"); const builtin = @import("builtin"); pub extern fn __divsf3(a: f32, b: f32) f32 { @setRuntimeSafety(builtin.is_test); const Z = @IntType(false, f32.bit_count); const typeWidth = f32.bit_count; const significandBits = std.math.floatMantissaBits(f32); const exponentBits =...
lib/std/special/compiler_rt/divsf3.zig
const std = @import("std"); const allocators = @import("allocators.zig"); const fs = @import("fs.zig"); const lua = @import("lua.zig"); const c = lua.c; const L = ?*c.lua_State; pub export fn registerFsLib(l: L) c_int { c.luaL_requiref(l, "fs", openFs, 1); return 0; } fn openFs(l: L) callconv(.C) c_int { ...
limp/lua-fs.zig
const std = @import("std"); const expect = std.testing.expect; const mem = std.mem; const maxInt = std.math.maxInt; test "int to ptr cast" { const x = @as(usize, 13); const y = @intToPtr(*u8, x); const z = @ptrToInt(y); try expect(z == 13); } test "integer literal to pointer cast" { const vga_mem ...
test/behavior/cast.zig
const std = @import("std"); const mem = std.mem; const testing = std.testing; const pdump = @import("../pdump.zig").pdump; // TODO: These shouldn't be hard coded. pub const page_size = 512; pub const max_pages = 1024; // A simulated flash device. We only simulate parts of flash that // have consisten sized sectors...
src/flash/sim.zig
const print = @import("std").debug.print; pub fn main() void { // The approximate weight of the Space Shuttle upon liftoff // (including boosters and fuel tank) was 2,200 tons. // // We'll convert this weight from tons to kilograms at a // conversion of 907.18kg to the ton. var shuttle_weight:...
exercises/060_floats.zig
const sf = struct { pub usingnamespace @import("../sfml.zig"); pub usingnamespace sf.system; pub usingnamespace sf.graphics; }; const std = @import("std"); const assert = std.debug.assert; const Image = @This(); // Constructor/destructor /// Creates a new image pub fn create(size: sf.Vector2u, color: s...
src/sfml/graphics/Image.zig
const Request = @This(); const root = @import("root"); const std = @import("std"); const url = @import("url.zig"); const Url = url.Url; const Allocator = std.mem.Allocator; const mem = std.mem; const Stream = std.net.Stream; const max_buffer_size = blk: { const given = if (@hasDecl(root, "buffer_size")) root.buff...
src/Request.zig
const std = @import("std"); const mem = std.mem; const process = std.process; const fs = std.fs; const path = fs.path; pub fn main() anyerror!void { var context = std.StringHashMap([]u8).init(std.heap.c_allocator); var arg_it = process.args(); _ = arg_it.skip(); const name = try (arg_it.next(std.heap...
src/main.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const Vec2 = tools.Vec2; const Map = tools.Map(u8, 1000, 2000, false); pub fn run(input_text: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { var arena = std.heap.ArenaAllocator.init(allocator); defer arena...
2018/day17.zig
// DO NOT MODIFY. This is not actually a source file; it is a textual representation of generated code. // Use only for debugging purposes. // Auto-generated constructor // Access: public Method <init> : V ( // (no arguments) ) { ALOAD 0 // Method descriptor: ()V INVOKESPECIAL io/quarkus/runtime/Appl...
localproxyservice/target/generated-sources/gizmo/io/quarkus/runner/ApplicationImpl1.zig
pub const FXEQ_MIN_FRAMERATE = @as(u32, 22000); pub const FXEQ_MAX_FRAMERATE = @as(u32, 48000); pub const FXEQ_MIN_FREQUENCY_CENTER = @as(f32, 20); pub const FXEQ_MAX_FREQUENCY_CENTER = @as(f32, 20000); pub const FXEQ_DEFAULT_FREQUENCY_CENTER_0 = @as(f32, 100); pub const FXEQ_DEFAULT_FREQUENCY_CENTER_1 = @as(f32, 800);...
win32/media/audio/xaudio2.zig
const std = @import("std"); const daemon = @import("daemon.zig"); const ServiceLogger = @import("service_logger.zig").ServiceLogger; const DaemonState = daemon.DaemonState; const ServiceDecl = daemon.ServiceDecl; const Service = daemon.Service; const ServiceStateType = daemon.ServiceStateType; const RcClient = daemon...
src/thread_commands.zig
const std = @import("std"); const testing = std.testing; const lex = @import("lex.zig"); const assert_one_match = true; const LexResult = struct { kind: lex.TokenKind, end: [*]const u8, }; fn scan(text: [*]const u8, limit: [*]const u8) !LexResult { std.debug.assert(@ptrToInt(text) < @ptrToInt(limit)); ...
src/parse.zig
const std = @import("std"); const sdk = @import("sdk"); const tier0 = @import("tier0.zig"); const interface = @import("interface.zig"); const mods = @import("mods.zig"); const log = @import("log.zig"); const surface = @import("surface.zig"); const font_manager = @import("font_manager.zig"); const thud = @import("thud.z...
src/main.zig
const SFR = @import("sfr.zig").SFR; const DDRB = SFR(0x24, u8, packed struct { DDB0: u1 = 0, DDB1: u1 = 0, DDB2: u1 = 0, DDB3: u1 = 0, DDB4: u1 = 0, DDB5: u1 = 0, DDB6: u1 = 0, DDB7: u1 = 0, }); const PORTB = SFR(0x25, u8, packed struct { PORTB0: u1 = 0, PORTB1: u1 = 0, POR...
src/std/io.zig
const std = @import("std"); const x509 = @import("iguanaTLS").x509; const tls = @import("iguanaTLS"); const TypeOfRequest = enum { GET, POST, PUT, DELETE }; pub fn makeGetRequestAlloc(allocator: std.mem.Allocator, host: []const u8, path: []const u8) ![]const u8 { return makeRequestAlloc(allocator, host, path, "",...
src/request.zig
const std = @import("std"); pub const TokenType = enum { // Single-character tokens. LeftParen, RightParen, LeftBrace, RightBrace, Comma, Dot, Minus, Plus, Semicolon, Slash, Star, // One or two character tokens. Bang, BangEqual, Equal, EqualEqual, ...
src/scanner.zig
const std = @import("std"); const math = std.math; const mem = std.mem; const assert = std.debug.assert; const config = @import("../config.zig"); const vsr = @import("../vsr.zig"); const MessagePool = @import("../message_pool.zig").MessagePool; const Message = MessagePool.Message; const MessageBus = @import("message...
src/test/network.zig
const std = @import("std"); const zua = @import("zua"); const lex = zua.lex; const parseString = zua.parse_literal.parseString; // Tests for comparing parsed strings between Zua and Lua. // Expects @import("build_options").fuzzed_strings_inputs_dir to be a path to // a directory containing a corpus of inputs to test a...
test/fuzzed_strings.zig
const std = @import("std"); const testing = std.testing; const math = @import("std").math; const Vec2 = @import("vec2.zig").Vec2; const f_eq = @import("utils.zig").f_eq; /// A Mat2 identity matrix pub const mat2_identity = Mat2{ .data = .{ .{ 1.0, 0.0 }, .{ 0.0, 1.0 }, }, }; /// Creates a new ...
src/mat2.zig
const std = @import("std"); const ArrayList = std.ArrayList; const LinkedList = std.SinglyLinkedList; const HashMap = std.StringHashMap; const Allocator = std.mem.Allocator; const ImmutableAssignments = false; const MaxDepth = 300; // === Assignment Parameters === // In order to be as flexible as possible and allow ...
base.zig
const std = @import("std"); const gl = @import("../deps/zgl/zgl.zig"); const gltf = @import("gltf.zig"); const util = @import("util.zig"); const zm = @import("zm.zig"); pub fn Renderer(comptime Context: type, comptime activate: fn (Context) void) type { return struct { allocator: *std.mem.Allocator, ...
src/render.zig
const build_options = @import("build_options"); const std = @import("std"); const mem = std.mem; const os = std.os; const wlr = @import("wlroots"); const wl = @import("wayland").server.wl; const pixman = @import("pixman"); const server = &@import("main.zig").server; const util = @import("util.zig"); const Box = @imp...
source/river-0.1.0/river/render.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const mem = std.mem; const data = @embedFile("data/day09.txt"); const EntriesList = std.ArrayList(u64); const Record = struct { x: usize = 0, }; pub fn main() !void { var arena = ...
src/day09.zig
const std = @import("std"); pub const PatternFinder = struct { gen: GradientGenerator, // Layers along Y, rows along Z, columns along X pattern: []const []const []const ?Block, pub fn search( self: PatternFinder, a: Point, b: Point, context: anytype, comptime re...
src/bedrock.zig
const std = @import("std"); const zap = @import("zap"); const hyperia = @import("hyperia.zig"); const os = std.os; const mem = std.mem; const math = std.math; const time = std.time; const testing = std.testing; const assert = std.debug.assert; const Reactor = hyperia.Reactor; const Timer = @This(); pub const Handl...
Timer2.zig
const std = @import("std"); const lib = @import("lib.zig"); const testing = std.testing; const assert = std.debug.assert; const Parser = lib.Parser; const Instruction = lib.Instruction; const ArrayList = std.ArrayListUnmanaged; const Allocator = std.mem.Allocator; const StringMap = std.StringArrayHashMapUnmanaged; con...
lib/Linker.zig
const std = @import("std"); const proto = @import("protocol.zig"); const Connector = @import("connector.zig").Connector; const Connection = @import("connection.zig").Connection; const Queue = @import("queue.zig").Queue; const Basic = @import("basic.zig").Basic; const Table = @import("table.zig").Table; pub const Chann...
src/channel.zig
const std = @import("std"); const Symbol = @import("Symbol.zig"); const Object = @import("Object.zig"); const types = @import("types.zig"); const Wasm = @import("Wasm.zig"); const Allocator = std.mem.Allocator; const log = std.log.scoped(.zwld); /// Accepts a slice with mutable elements and sets the field `field_name...
src/sections.zig
const std = @import("std"); const assert = std.debug.assert; const config = @import("../config.zig"); const MessagePool = @import("../message_pool.zig").MessagePool; const Message = MessagePool.Message; const Header = @import("../vsr.zig").Header; const Network = @import("network.zig").Network; const log = std.log....
src/test/message_bus.zig
const std = @import("std"); const zang = @import("zang"); const common = @import("common.zig"); const c = @import("common/c.zig"); pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb; pub const AUDIO_SAMPLE_RATE = 48000; pub const AUDIO_BUFFER_SIZE = 1024; pub const DESCRIPTION = \\example_laser \\ \...
examples/example_laser.zig
const std = @import("std"); const ArenaAllocator = std.heap.ArenaAllocator; const mem = std.mem; const fmt = std.fmt; const ascii = std.ascii; const Uri = @import("zuri").Uri; const gzip = std.compress.gzip; const log = std.log; const dateStrToTimeStamp = @import("parse.zig").Rss.pubDateToTimestamp; const zfetch = @imp...
src/http.zig
const std = @import("std"); const input = @embedFile("data/input06"); usingnamespace @import("util.zig"); pub fn main() !void { print("[Part1] Count: {}", .{countAnyone(input)}); print("[Part2] Count: {}", .{countEveryone(input)}); } fn countAnyone(inputStr: []const u8) usize { var count: usize = 0; ...
src/day06.zig
// https://tools.ietf.org/html/rfc7914 // https://github.com/golang/crypto/blob/master/scrypt/scrypt.go const std = @import("std"); const crypto = std.crypto; const fmt = std.fmt; const math = std.math; const mem = std.mem; const phc_format = @import("phc_encoding.zig"); const crypt_format = @import("crypt_encoding_...
src/scrypt.zig
const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const meta = std.meta; const c = @cImport({ @cInclude("stdio.h"); @cInclude("string.h"); @cInclude("unistd.h"); @cInclude("time.h"); @cInclude("errno.h"); @cInclude("stdintfix.h"); // NB: Required ...
src/main.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; const with_dissassemble = false; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const Computer = tools.IntCode_Computer; const Vec2 = tool...
2019/day13.zig
pub const Opcode = enum(u8) { NOP = 0x00, LD_B_n = 0x06, LD_C_n = 0x0E, LD_D_n = 0x16, LD_E_n = 0x1E, LD_H_n = 0x26, LD_L_n = 0x2E, LD_A_A = 0x7F, LD_A_B = 0x78, LD_A_C = 0x79, LD_A_D = 0x7A, LD_A_E = 0x7B, LD_A_H = 0x7C, LD_A_L = 0x7D, LD_A_HL = 0x7E, LD_...
src/opcode.zig
const std = @import("std"); const mem = std.mem; const meta = std.meta; const net = std.net; usingnamespace @import("../frame.zig"); usingnamespace @import("../primitive_types.zig"); usingnamespace @import("../query_parameters.zig"); const testing = @import("../testing.zig"); /// EXECUTE is sent to execute a prepared...
src/frames/execute.zig
const std = @import("std"); const builtin = @import("builtin"); const CallingConvention = @import("std").builtin.CallingConvention; pub const is_nvptx = builtin.cpu.arch == .nvptx64; pub const Kernel = if (is_nvptx) CallingConvention.PtxKernel else CallingConvention.Unspecified; pub fn threadIdX() usize { if (!is_...
CS344/src/kernel_utils.zig
const std = @import("std"); const pike = @import("pike.zig"); const posix = @import("os/posix.zig"); const os = std.os; const net = std.net; const mem = std.mem; const time = std.time; pub inline fn init() !void {} pub inline fn deinit() void {} pub const Handle = struct { inner: os.fd_t, wake_fn: fn (self: ...
notifier_kqueue.zig