code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const mem = std.mem;
const c = @import("./c.zig");
const glfw = @import("./main.zig");
/// Opaque window object.
pub const Window = struct {
const Self = @This();
handle: *c.GLFWwindow,
pub const ClientApi = enum(i32) {
OpenGLApi = c.GLFW_OPENGL_API,
OpenGLESA... | src/window.zig |
const std = @import("std");
const graphics = @import("didot-graphics");
const Allocator = std.mem.Allocator;
const runtime_safety = @import("builtin").mode == .Debug or @import("builtin").mode == .ReleaseSafe;
pub const AssetType = enum(u8) {
Mesh,
Texture,
Shader
};
pub const AssetStream = struct {
... | didot-objects/assets.zig |
const std = @import("std");
const expect = std.testing.expect;
const assert = std.debug.assert;
const print = std.debug.print;
///A singly linked list
pub fn SinglyList(comptime T: type) type {
return struct {
const Self = @This();
const Node = struct {
data: T,
next: ?*Node... | src/linked_list.zig |
const std = @import( "std" );
const Mutex = std.Thread.Mutex;
const ArrayList = std.ArrayList;
const Allocator = std.mem.Allocator;
usingnamespace @import( "../core/core.zig" );
usingnamespace @import( "../core/glz.zig" );
usingnamespace @import( "../time/cursor.zig" );
usingnamespace @import( "../sim.zig" );
pub fn D... | src/space/dots.zig |
const std = @import("std");
const panic = std.debug.panic;
const utils = @import("lib/utils.zig");
const print = utils.print;
const puts = utils.puts;
const print_e = utils.print_e;
const puts_e = utils.puts_e;
const putskv_e = utils.putskv_e;
const puts_fn = utils.puts_fn;
const strEq = utils.strEq;
const allocator... | vgparser.zig |
const std = @import("std");
const daemon = @import("daemon.zig");
const fs = std.fs;
const os = std.os;
const mem = std.mem;
const Logger = @import("logger.zig").Logger;
const helpers = @import("helpers.zig");
const ProcessStats = @import("process_stats.zig").ProcessStats;
const util = @import("util.zig");
const pr... | src/main.zig |
const std = @import("std");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const synchsafe = @import("synchsafe.zig");
const latin1 = @import("latin1.zig");
const fmtUtf8SliceEscapeUpper = @import("util.zig").fmtUtf8SliceEscapeUpper;
const unsynch = @import("unsynch.zig");
const _metadata = @impo... | src/id3v2.zig |
const std = @import("std");
const c = @import("internal/c.zig");
const internal = @import("internal/internal.zig");
const log = std.log.scoped(.git);
const git = @import("git.zig");
pub const PackBuilder = opaque {
pub fn deinit(self: *PackBuilder) void {
log.debug("PackBuilder.deinit called", .{});
... | src/pack.zig |
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const mem = std.mem;
const Allocator = mem.Allocator;
const StringHashMap = std.StringHashMap;
const Chunk = @import("./chunk.zig").Chunk;
const VM = @import("./vm.zig").VM;
const Compiler = @import("./compiler.zig").Compil... | src/obj.zig |
const std = @import("../std.zig");
const builtin = std.builtin;
const mem = std.mem;
const debug = std.debug;
/// Counter mode.
///
/// This mode creates a key stream by encrypting an incrementing counter using a block cipher, and adding it to the source material.
///
/// Important: the counter mode doesn't provide a... | lib/std/crypto/modes.zig |
const std = @import("std");
const gpa = std.heap.c_allocator;
const builtin = std.builtin;
const u = @import("index.zig");
const yaml = @import("./yaml.zig");
//
//
pub const Module = struct {
is_sys_lib: bool,
id: []const u8,
name: []const u8,
main: []const u8,
c_include_dirs: [][]const u8,
... | src/util/module.zig |
const std = @import("std");
const lex = @import("zua").lex;
// Code for generating a potentially huge collection of
// files containing the source of every string literal token
// in the corpus provided in @import("build_options").fuzzed_lex_inputs_dir
// and outputting them to @import("build_options").fuzzed_strings_... | test/fuzzed_strings_gen.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = std.mem.Allocator;
const ArrayListUnmanaged = std.ArrayListUnmanaged;
const Value = @import("value.zig").Value;
const Type = @import("type.zig").Type;
const TypedValue = @import("TypedValue.zig");
const assert = std.debug.assert;
const BigIntConst = std... | src-self-hosted/Module.zig |
const std = @import("std");
const libcurl = @import("lib/zig-libcurl/libcurl.zig");
const libssh2 = @import("lib/zig-libssh2/libssh2.zig");
const zlib = @import("lib/zig-zlib/zlib.zig");
const mbedtls = @import("lib/zig-mbedtls/mbedtls.zig");
pub fn build(b: *std.build.Builder) !void {
// Standard target options a... | build.zig |
const std = @import("../index.zig");
const math = std.math;
const assert = std.debug.assert;
pub fn atan(x: var) @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
f32 => atan32(x),
f64 => atan64(x),
else => @compileError("atan not implemented for " ++ @typeName(T)),
};
}
fn a... | std/math/atan.zig |
const std = @import("std");
const c = @cImport({
@cInclude("yaml.h");
});
const u = @import("./index.zig");
//
//
const Array = [][]const u8;
pub const Document = struct {
mapping: Mapping,
};
pub const Item = union(enum) {
event: c.yaml_event_t,
kv: Key,
mapping: Mapping,
sequence: []Item,... | src/util/yaml.zig |
pub const WER_FAULT_REPORTING_NO_UI = @as(u32, 32);
pub const WER_FAULT_REPORTING_FLAG_NO_HEAP_ON_QUEUE = @as(u32, 64);
pub const WER_FAULT_REPORTING_DISABLE_SNAPSHOT_CRASH = @as(u32, 128);
pub const WER_FAULT_REPORTING_DISABLE_SNAPSHOT_HANG = @as(u32, 256);
pub const WER_FAULT_REPORTING_CRITICAL = @as(u32, 512);
pub c... | win32/system/error_reporting.zig |
const std = @import("std");
const fmt = std.fmt;
/// It's a fixed length buffer, useful for parsing strings
/// without requiring an allocator.
pub fn FixBuf(comptime size: usize) type {
return struct {
buf: [size]u8,
len: usize,
const Self = @This();
/// Returns a slice pointing ... | src/types/fixbuf.zig |
const std = @import("std");
const Answer = struct { @"0": u32, @"1": u32 };
const Point = struct { x: usize, y: usize };
const Neighbors = struct { items: [8]Point, len: usize };
fn displace(i: usize, ii: i32) i32 {
return @intCast(i32, i) + ii;
}
const Grid = struct {
const Self = @This();
items: []u32... | src/day11.zig |
const std = @import("std");
const builtin = @import("builtin");
const build_options = @import("build_options");
pub const enable = if (builtin.is_test) false else build_options.enable_tracy;
pub const enable_allocation = enable and build_options.enable_tracy_allocation;
pub const enable_callstack = enable and build_op... | src/tracy.zig |
const std = @import("std");
const assert = std.debug.assert;
const c = @import("c.zig");
const translate = @import("translate.zig");
const tb = @import("tigerbeetle/src/tigerbeetle.zig");
const Account = tb.Account;
const AccountFlags = tb.AccountFlags;
const Transfer = tb.Transfer;
const TransferFlags = tb.TransferF... | src/node.zig |
const std = @import("std");
const assert = std.debug.assert;
const Camera = @import("Camera.zig");
const Renderer = @import("Renderer.zig");
const Mesh = @import("Mesh.zig");
const Material = @import("Material.zig");
const zp = @import("../../zplay.zig");
const Texture2D = zp.graphics.texture.Texture2D;
const gltf = zp... | src/graphics/3d/Model.zig |
const std = @import("std");
const zzz = @import("zzz");
const version = @import("version");
const Package = @import("Package.zig");
const Dependency = @import("Dependency.zig");
const utils = @import("utils.zig");
const ThreadSafeArenaAllocator = @import("ThreadSafeArenaAllocator.zig");
const Allocator = std.mem.Alloc... | src/Project.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
test "basic invocations" {
const foo = struct {
fn foo() i32 {
return 1234;
}
}.foo;
try expect(@call(.{}, foo, .{}) == 1234);
comptime {
// modifiers that all... | test/behavior/call_stage1.zig |
const mem = @import("../mem.zig");
const math = @import("../math/index.zig");
const endian = @import("../endian.zig");
const debug = @import("../debug/index.zig");
const builtin = @import("builtin");
const htest = @import("test.zig");
pub const Sha3_224 = Keccak(224, 0x06);
pub const Sha3_256 = Keccak(256, 0x06);
pub ... | std/crypto/sha3.zig |
const std = @import("std");
const print = std.debug.print;
usingnamespace @import("value.zig");
usingnamespace @import("chunk.zig");
usingnamespace @import("scanner.zig");
usingnamespace @import("parser.zig");
usingnamespace @import("heap.zig");
pub const ArrayListOfLocal = std.ArrayList(Local);
pub const Local = st... | zvm/src/compiler.zig |
const std = @import("std.zig");
const builtin = std.builtin;
const root = @import("root");
//! std.log is standardized interface for logging which allows for the logging
//! of programs and libraries using this interface to be formatted and filtered
//! by the implementer of the root.log function.
//!
//! The scope pa... | lib/std/log.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = 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/puzzle/day... | src/day10.zig |
const std = @import("std");
const panic = std.debug.panic;
// Vulkan, GLFW
usingnamespace @import("c.zig");
// Errors
const ApplicationError = error {
GlfwInitError,
VkCreateInstanceError,
};
// Constants
const width = 800;
const height = 600;
// Variables
var window: ?*GLFWwindow = null;
var instance: VkIn... | src/01_instance_creation.zig |
const std = @import("std");
// A blocking SPSC queue, used so that threads can sleep while waiting
// for another thread to pass them data.
pub fn BlockingQueue(comptime T: type) type {
return struct {
inner: std.atomic.Queue(T),
event: std.Thread.ResetEvent,
alloc: *std.mem.Allocator,
... | src/blocking_queue.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");
const testing = @import("../testing.zig");
/// PREPARE is sent to prepare a CQL query for later execution (through EXECUTE).
///
/// De... | src/frames/prepare.zig |
const zort = @import("zort");
const std = @import("std");
const testing = std.testing;
const Str = []const u8;
const INPUT_ITEMS = 10_000_000;
const RUNS = 10;
const BenchResult = struct {
command: Str,
mean: u64,
times: [RUNS]u64,
};
pub fn main() !void {
const args = try std.process.argsAlloc(test... | benchmark/run_bench.zig |
const std = @import("std");
const prot = @import("../protocols.zig");
const out = @import("../output.zig");
const Context = @import("../client.zig").Context;
const Object = @import("../client.zig").Object;
const dmabuf = @import("../dmabuf_params.zig");
fn bind(context: *Context, wl_registry: Object, name: u32, name_s... | src/implementations/wl_registry.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const bog = @import("bog.zig");
const Token = bog.Token;
const TokenIndex = Token.Index;
pub const Tree = struct {
tokens: []const Token,
nodes: []const *Node,
/// not owned by the tree
source: []const u8,
arena: std.heap.ArenaAllo... | src/ast.zig |
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
const kernel = @import("__trig.zig");
const __rem_pio2 = @import("__rem_pio2.zig").__rem_pio2;
const __rem_pio2f = @import("__rem_pio2f.zig").__rem_pio2f;
/// Returns the tangent of the radian value x.
///
/// Special Cases:... | lib/std/math/tan.zig |
const std = @import("std");
const stdout = std.io.getStdOut().writer();
const print = stdout.print;
const dp = std.debug.print;
const os = std.os;
const Allocator = std.mem.Allocator;
const funcs = @import("funcs.zig");
const proc = std.ChildProcess;
const eql = std.mem.eql;
const len = std.mem.len;
const assert = std.... | repo_status.zig |
const std = @import("std");
const expect = std.testing.expect;
const test_allocator = std.testing.allocator;
const Allocator = std.mem.Allocator;
const Direction = enum { forward, up, down };
const Step = struct {
dir: Direction,
distance: u64,
pub fn parse(str: []const u8) !Step {
var iter = std... | day02/src/main.zig |
//--------------------------------------------------------------------------------
// Section: Types (16)
//--------------------------------------------------------------------------------
pub const GESTURECONFIG_ID = enum(u32) {
BEGIN = 1,
END = 2,
ZOOM = 3,
PAN = 4,
ROTATE = 5,
TWOFINGERTAP =... | win32/ui/input/touch.zig |
const std = @import("std");
const print = std.debug.print;
pub fn main() anyerror!void {
const allocator = std.heap.page_allocator;
var file = try std.fs.cwd().openFile(
"./inputs/day12.txt",
.{
.read = true,
},
);
var reader = std.io.bufferedReader(file.reader()).... | src/day12.zig |
const std = @import("std");
const debug = std.debug;
const fmt = std.fmt;
const mem = std.mem;
pub fn main() !void {
var guard = try most_slepful_boy();
var minute = try most_slepful_minute(guard);
var result = guard * minute;
debug.assert(result == 87681);
debug.warn("04-1 {}\n", result);
}
fn mo... | 2018/day_04_1.zig |
const c = @import("../../c_global.zig").c_imp;
const std = @import("std");
// dross-zig
const tx = @import("../renderer/texture.zig");
const Texture = tx.Texture;
const fnt = @import("../renderer/font/font.zig");
const Font = fnt.Font;
const fs = @import("../utils/file_loader.zig");
// ---------------------------------... | src/core/resource_handler.zig |
const std = @import("std");
const assert = std.debug.assert;
const c = @import("c.zig").c;
const window = &@import("Window.zig").window;
var key_callback: ?fn (i32, i32, i32, i32) void = null;
fn key_callback_f(w: ?*c.GLFWwindow, key: c_int, scancode: c_int, action: c_int, mods: c_int) callconv(.C) void {
if (ke... | src/WindowGraphicsInput/Input.zig |
const std = @import("std");
const io = @import("io.zig");
allocator: *std.mem.Allocator,
loop: *io.EventLoop,
sigf: io.SignalFile,
listener: io.Listener,
quit: io.Flag,
group: io.WaitGroup,
const Server = @This();
pub fn init(allocator: *std.mem.Allocator, loop: *io.EventLoop) !Server {
const sigf = try loop.sig... | src/Server.zig |
const std = @import("std");
const opcode = @import("opcode.zig");
pub const Disassembler = struct {
const InStream = std.io.InStream(std.os.File.ReadError);
const OutStream = std.io.OutStream(std.os.File.WriteError);
input: *InStream,
output: *OutStream,
buffer: ?u8,
pub fn init(input: *InSt... | src/disassembler.zig |
const std = @import("std");
const mem = std.mem;
const math = std.math;
const Allocator = mem.Allocator;
const ArrayList = std.ArrayList;
const vm = @import("vecmath_j.zig");
const Vec3 = vm.Vec3;
const camera = @import("camera.zig");
const Camera = camera.Camera;
const Ray = camera.Ray;
const HitRecord = camera.HitR... | src/material.zig |
const std = @import("std");
const mem = std.mem;
const meta = std.meta;
const net = std.net;
const ArrayList = std.ArrayList;
usingnamespace @import("../frame.zig");
usingnamespace @import("../primitive_types.zig");
const sm = @import("../string_map.zig");
const testing = @import("../testing.zig");
/// Structure of... | src/frames/batch.zig |
const std = @import("std");
const debug = std.debug;
const Dir = std.fs.Dir;
const Allocator = std.mem.Allocator;
usingnamespace @import("../c.zig");
var allocator = std.heap.page_allocator;
const ShaderCompileErr = error{SeeLog};
fn ShaderTypeStr(comptime shaderType: GLenum) []const u8 {
return switch (shaderT... | src/presentation/Shader.zig |
const std = @import("std");
// Reference for implementation:
// https://danielmangum.com/posts/non-local-jumps-riscv/
const c = @cImport({
@cInclude("setjmp.h");
});
export fn setjmp(env: *c.jmp_buf) c_int {
// Note:
// - This implementation is 32-bit only: sw stores 32 bits and offset
// between fie... | src/libc/setjmp.zig |
const std = @import("std");
//^^^ storage.modifier.zig
// ^ keyword.operator.assignment.zig
// ^^^^^^^ keyword.control.import.zig
// ^ punctuation.section.parens.begin.zig
// ^^^^^ string.quoted.double.zig
// ^ punctuation.section.parens.end.zig
//... | Syntaxes/syntax_test.zig |
const std = @import("std");
const io = std.io;
const fmt = std.fmt;
const dns = @import("../dns.zig");
const InError = io.SliceInStream.Error;
const OutError = io.SliceOutStream.Error;
const Type = dns.Type;
pub const SOAData = struct {
mname: dns.Name,
rname: dns.Name,
serial: u32,
refresh: u32,
... | src/pkg/dns/rdata.zig |
const std = @import("std");
const webgpu = @import("./webgpu.zig");
pub const CommandBuffer = struct {
pub const VTable = struct {
destroy_fn: fn(*CommandBuffer) void,
};
__vtable: *const VTable,
device: *webgpu.Device,
pub inline fn destroy(command_buffer: *CommandBuffer) void {
... | src/command.zig |
const std = @import("std");
const Builder = std.build.Builder;
const CrossTarget = std.build.CrossTarget;
const LibExeObjStep = std.build.LibExeObjStep;
const Pkg = std.build.Pkg;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
const ... | build.zig |
const std = @import("std");
const build = std.build;
const Builder = build.Builder;
const FileSource = build.FileSource;
const GeneratedFile = build.GeneratedFile;
const InstallDir = build.InstallDir;
const Step = build.Step;
const fs = std.fs;
const File = fs.File;
const Self = @This();
pub const base_id = .custom... | src/build/FileRecipeStep.zig |
const std = @import("std");
const c = @cImport({
@cInclude("xkbcommon/xkbcommon.h");
@cInclude("stdlib.h");
});
pub const Xkb = struct {
context: *c.xkb_context,
keymap: ?*c.xkb_keymap,
state: ?*c.xkb_state,
const Self = @This();
pub const FdSize = struct {
fd: i32,
size: ... | src/xkb.zig |
const std = @import("std");
const builtin = @import("builtin");
pub extern fn __divdf3(a: f64, b: f64) f64 {
@setRuntimeSafety(builtin.is_test);
const Z = @IntType(false, f64.bit_count);
const SignedZ = @IntType(true, f64.bit_count);
const typeWidth = f64.bit_count;
const significandBits = std.ma... | lib/std/special/compiler_rt/divdf3.zig |
const mem = @import("../mem.zig");
const math = @import("../math.zig");
const endian = @import("../endian.zig");
const debug = @import("../debug.zig");
const builtin = @import("builtin");
const htest = @import("test.zig");
/////////////////////
// Sha224 + Sha256
const RoundParam256 = struct {
a: usize,
b: us... | lib/std/crypto/sha2.zig |
const std = @import("../std.zig");
const Allocator = std.mem.Allocator;
/// This allocator is used in front of another allocator and logs to the provided stream
/// on every call to the allocator. Stream errors are ignored.
/// If https://github.com/ziglang/zig/issues/2586 is implemented, this API can be improved.
pub... | lib/std/heap/logging_allocator.zig |
const std = @import("std");
const Builder = std.build.Builder;
const ft_root = thisDir() ++ "/upstream/freetype";
const ft_include_path = ft_root ++ "/include";
pub fn build(b: *std.build.Builder) !void {
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
const dedicate... | freetype/build.zig |
const std = @import("../../../std.zig");
const pid_t = linux.pid_t;
const uid_t = linux.uid_t;
const clock_t = linux.clock_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const linux = std.os.linux;
const sockaddr = linux.sockaddr;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const ... | lib/std/os/bits/linux/x86_64.zig |
const std = @import("index.zig");
const debug = std.debug;
const assert = debug.assert;
const mem = std.mem;
const Allocator = mem.Allocator;
/// Generic doubly linked list.
pub fn LinkedList(comptime T: type) type {
return struct {
const Self = @This();
/// Node inside the linked list wrapping th... | std/linked_list.zig |
const io = @import("io.zig");
const idt = @import("idt.zig");
const Terminal = @import("tty.zig");
fn sendCommand(cmd: u8) void {
// Wait until the keyboard is ready and the command buffer is empty
while ((io.in(u8, 0x64) & 0x2) != 0) {}
io.out(u8, 0x60, cmd);
}
pub fn init() void {
// Register IRQ h... | src/kernel/arch/x86/boot/keyboard.zig |
const std = @import("std");
usingnamespace @import("imgui");
const colors = @import("../colors.zig");
const history = @import("../history.zig");
const ts = @import("../tilescript.zig");
// helper to maintain state during a drag selection
var shift_dragged = false;
var dragged = false;
var prev_mouse_pos: ImVec2 = unde... | tilescript/windows/maps.zig |
pub const L2_REASON_CODE_DOT11_AC_BASE = @as(u32, 131072);
pub const L2_REASON_CODE_DOT11_MSM_BASE = @as(u32, 196608);
pub const L2_REASON_CODE_DOT11_SECURITY_BASE = @as(u32, 262144);
pub const L2_REASON_CODE_ONEX_BASE = @as(u32, 327680);
pub const L2_REASON_CODE_DOT3_AC_BASE = @as(u32, 393216);
pub const L2_REASON_COD... | win32/network_management/wi_fi.zig |
const std = @import("std");
const clap = @import("clap");
const csv = @import("csv");
const Converter = @import("./converter.zig").Converter;
// Print flag usage to stdout.
pub fn printHelp(comptime params: []const clap.Param(clap.Help)) !void {
std.debug.print("Convert CSV to JSON files.\n", .{});
try clap.he... | src/main.zig |
const wlr = @import("../wlroots.zig");
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const AxisSource = enum(c_int) {
wheel,
finger,
continuous,
wheel_tilt,
};
pub const AxisOrientation = enum(c_int) {
vertical,
horizontal,
};
pub const Pointer = extern struct {
p... | src/types/pointer.zig |
const std = @import("std");
const BoundedArray = std.BoundedArray;
const EnumMap = std.EnumMap;
const hasFn = std.meta.trait.hasFn;
const builtin = @import("builtin");
pub const Schema = struct {
tables: []const type,
indexes: []const TableColumn,
foreign_keys: []const ForeignKey,
};
pub const TableColum... | Game Database.zig |
const std = @import("std");
const max_n = 12;
const Vec = std.meta.Vector(max_n, u8);
fn runInParallel(tasks: []std.Thread, len: usize, comptime f: anytype, args: anytype) !void {
const len_per_task = @divTrunc(len, tasks.len + 1);
for (tasks) |*task, i| {
const first = len_per_task*i;
const l... | bench/algorithm/fannkuch-redux/2-m.zig |
const std = @import("std");
const mem = std.mem;
const json = std.json;
const Lexer = @import("lexer.zig").Lexer;
const log = @import("log.zig");
usingnamespace @import("parse_atx_heading.zig");
usingnamespace @import("parse_codeblock.zig");
/// Function prototype for a State Transition in the Parser
pub const StateT... | src/md/parse.zig |
const std = @import("std");
const ig = @import("imgui");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const Child = std.meta.Child;
const NULL_TERM = [_]u8{0};
fn nullTerm(comptime str: []const u8) [:0]const u8 {
const fullStr = str ++ NULL_TERM;
return fullStr[0..str.len :0];
}
fn a... | src/autogui.zig |
const std = @import("std");
const mem = std.mem;
const fmt = std.fmt;
/// X25519 DH function.
pub const X25519 = struct {
/// The underlying elliptic curve.
pub const Curve = @import("curve25519.zig").Curve25519;
/// Length (in bytes) of a secret key.
pub const secret_length = 32;
/// Length (in by... | lib/std/crypto/25519/x25519.zig |
const __fixtfdi = @import("fixtfdi.zig").__fixtfdi;
const std = @import("std");
const math = std.math;
const testing = std.testing;
const warn = std.debug.warn;
fn test__fixtfdi(a: f128, expected: i64) void {
const x = __fixtfdi(a);
//warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", .{a, @bitCast(u128... | lib/std/special/compiler_rt/fixtfdi_test.zig |
pub const SUCCESS = 0;
/// Incorrect function.
pub const INVALID_FUNCTION = 1;
/// The system cannot find the file specified.
pub const FILE_NOT_FOUND = 2;
/// The system cannot find the path specified.
pub const PATH_NOT_FOUND = 3;
/// The system cannot open the file.
pub const TOO_MANY_OPEN_FILES = 4;
/// Access... | lib/std/os/windows/error.zig |
const std = @import("std");
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var allocator = &gpa.allocator;
fn get_input() !std.ArrayList(i32) {
const f = try std.fs.cwd().openFile("inputs/day10.txt", .{ .read = true });
var file_contents = try f.reader().readAllAlloc(
allocator,
// file w... | src/day10.zig |
const sf = struct {
pub usingnamespace @import("../sfml.zig");
pub usingnamespace sf.system;
pub usingnamespace sf.graphics;
};
const Sprite = @This();
// Constructor/destructor
/// Inits a sprite with no texture
pub fn create() !Sprite {
var sprite = sf.c.sfSprite_create();
if (sprite == null)
... | src/sfml/graphics/Sprite.zig |
const sf = struct {
pub usingnamespace @import("../sfml.zig");
pub usingnamespace sf.system;
pub usingnamespace sf.graphics;
};
const Text = @This();
// Constructor/destructor
/// Inits an empty text
pub fn create() !Text {
var text = sf.c.sfText_create();
if (text == null)
return sf.Err... | src/sfml/graphics/Text.zig |
const std = @import("std");
const root = @import("main.zig");
const math = std.math;
const panic = std.debug.panic;
const testing = std.testing;
pub const Vec4 = Vector4(f32);
pub const Vec4_f64 = Vector4(f64);
pub const Vec4_i32 = Vector4(i32);
/// A 4 dimensional vector.
pub fn Vector4(comptime T: type) type {
... | src/vec4.zig |
const std = @import("std");
const sqlite = @import("sqlite");
const string = []const u8;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var allocator = &gpa.allocator;
const Employee = struct {
id: [128:0]u8,
name: [128:0]u8,
age: usize,
salary: usize,
};
pub fn main() anyerror!void {
std.os.u... | src/main.zig |
usingnamespace @import("root").preamble;
const log = lib.output.log.scoped(.{
.prefix = "Platform",
.filter = .info,
}).write;
// Submodules
pub const acpi = @import("acpi.zig");
pub const pci = @import("pci.zig");
pub const devicetree = @import("devicetree.zig");
pub const smp = @import("smp.zig");
// Anyth... | subprojects/flork/src/platform/platform.zig |
const std = @import("std");
const testing = std.testing;
const fs = std.fs;
const File = fs.File;
const expect = std.testing.expect;
const print = std.debug.print;
const parseInt = std.fmt.parseInt;
var arena: std.heap.ArenaAllocator = undefined;
var allocator: *std.mem.Allocator = undefined;
var fb0: File = undefined... | libs/core/pagez.zig |
const std = @import("std");
const types = @import("types.zig");
const json = @import("json.zig");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const Value = std.json.Value;
const js = json.json_serializer;
const jd = json.json_deserializer;
pub fn Method(comptime RequestType: type, comptime R... | core.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const odbc = @import("odbc");
const EraseComptime = @import("util.zig").EraseComptime;
/// This struct contains the information necessary to communicate with the ODBC driver
/// about the type of a value. `sql_type` is often used to tell the driver how ... | src/parameter.zig |
const std = @import("std");
const audiometa = @import("audiometa");
const id3 = audiometa.id3v2;
const fmtUtf8SliceEscapeUpper = audiometa.util.fmtUtf8SliceEscapeUpper;
const meta = audiometa.metadata;
const MetadataMap = meta.MetadataMap;
const Metadata = meta.Metadata;
const TypedMetadata = meta.TypedMetadata;
const ... | test/test_against_taglib.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const data = @embedFile("../inputs/day09.txt");
pub fn main() anyerror!void {
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa_impl.deinit();
const gpa = gpa_impl.allocator();
return m... | src/day09.zig |
const std = @import("std");
const subcommands = @import("../subcommands.zig");
const shared = @import("../shared.zig");
const zsw = @import("zsw");
const log = std.log.scoped(.basename);
pub const name = "basename";
pub const usage =
\\Usage: {0s} NAME [SUFFIX]
\\ or: {0s} OPTION... NAME...
\\
\\Pr... | src/subcommands/basename.zig |
const std = @import("std");
const assert = std.debug.assert;
const expectEqual = std.testing.expectEqual;
pub const Player = enum(u1) {
P1,
P2,
pub inline fn foe(self: Player) Player {
return @intToEnum(Player, ~@enumToInt(self));
}
pub inline fn ident(self: Player, id: u3) ID {
... | src/lib/common/data.zig |
const std = @import("std");
const stdx = @import("stdx.zig");
const t = stdx.testing;
const assert = std.debug.assert;
const mem = std.mem;
const log = stdx.log.scoped(.unicode);
// Adapted from std.unicode.utf16lToUtf8Alloc
pub fn utf16beToUtf8Alloc(alloc: mem.Allocator, utf16be: []const u16) ![]u8 {
var result =... | stdx/unicode.zig |
const std = @import("std");
const builtin = @import("builtin");
const net = @import("net");
const ssl = @import("ssl");
const http = @import("http");
const Uri = @import("uri").Uri;
const tar = @import("tar.zig");
const zzz = @import("zzz");
const Allocator = std.mem.Allocator;
const gzipStream = std.compress.gzip.gzi... | src/import.zig |
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const native_endian = builtin.cpu.arch.endian();
test "correct size of packed structs" {
const T1 = packed struct { one: u8, three: [3]u8 ... | test/behavior/packed-struct.zig |
const std = @import("std");
const math = @import("std").math;
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const assert = std.debug.assert;
const print = std.debug.print;
const testing = std.testing;
const input = @embedFile("./input.txt");
pub fn main() anyerror!void {
print("Day 3: Bin... | src/day03/day03.zig |
const std = @import("std");
const io = std.io;
const Allocator = std.mem.Allocator;
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 = undefined;
var stream = io.bufferedReader... | day4/src/main.zig |
const std = @import("std");
const semitone = std.math.pow(f32, 2.0, 1.0 / 12.0);
fn calcNoteFreq(note: i32) f32 {
return std.math.pow(f32, semitone, @intToFloat(f32, note));
}
// note: these are relative frequencies, so you'll have to multiply the value
// by the value you want as a4 (such as 440.0)
pub const c0... | src/zang-12tet.zig |
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const Blob = @import("sqlite.zig").Blob;
/// Text is used to represent a SQLite TEXT value when binding a parameter or reading a column.
pub const Text = struct { data: []const u8 };
const BindMarker = struct {
/// Contains the expecte... | query.zig |
const std = @import("std");
usingnamespace std.os.windows;
const DynLib = std.DynLib;
const zeroes = std.mem.zeroes;
const c = @cImport({
@cInclude("dsound.h");
});
pub const DSBPLAY_LOOPING = 0x00000001;
pub const DirectSoundCreate = fn (pcGuidDevice: ?*c.GUID, ppDS: **IDirectSound, pUnkOuter: ?*c.IUnknown) HRESU... | src/dsound.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const Condition = @This();
const Mutex = std.Thread.Mutex;
const os = std.os;
const assert = std.debug.assert;
const testing = std.testing;
const Atomic = std.atomic.Atomic;
const Futex = std.Thread.Futex;
impl: Impl = .{},
/// Atomically releas... | lib/std/Thread/Condition.zig |
const string = @import("string.zig");
const std = @import("std");
const @"struct" = @import("../struct.zig");
const @"union" = @import("../union.zig");
const StructField = @"struct".Field;
const Struct = @"struct".Struct;
const UnionField = @"union".Field;
const Union = @"union".Union;
const debug = std.debug;
const... | src/parser/common.zig |
const std = @import("std");
const zgt = @import("zgt");
const bottom = @import("bottom");
pub usingnamespace zgt.cross_platform;
pub fn encode(button: *zgt.Button_Impl) !void {
// If we received the event, this means we're parented, so it's safe to assert
const root = button.getRoot().?;
// Get 'encode-t... | src/main.zig |
const bs = @import("./bitstream.zig");
const bu = @import("./bits.zig"); // bits utilities
const deflate = @import("./deflate.zig");
const hm = @import("./huffman.zig");
const lz = @import("./lz77.zig");
const std = @import("std");
const assert = std.debug.assert;
const expect = std.testing.expect;
const mem = std.me... | src/deflate_test.zig |
const builtin = @import("builtin");
const std = @import("std");
const meta = std.meta;
pub fn VecFns(comptime Self: type) type {
comptime var N = @typeInfo(Self).Struct.fields.len;
comptime var T = @typeInfo(Self).Struct.fields[0].field_type;
comptime {
if (@typeInfo(T) == .Array) {
if ... | vec_fns.zig |
const std = @import("std");
const fs = std.fs;
const io = std.io;
const mem = std.mem;
const process = std.process;
const Archive = @import("archive/Archive.zig");
const overview =
\\Zig Archiver
\\
\\Usage: zar [options] [-]<operation>[modifiers] [relpos] [count] <archive> [files]
\\
\\Options:
... | src/main.zig |
const std = @import("std");
const assert = std.debug.assert;
const koino = @import("koino");
const MenuItem = struct {
input_file_name: []const u8,
output_file_name: []const u8,
header: []const u8,
};
const menu_items = [_]MenuItem{
MenuItem{
.input_file_name = "documentation/README.md",
... | src/tools/render-md-page.zig |