code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
pub const CRYTPDLG_FLAGS_MASK = @as(u32, 4278190080);
pub const CRYPTDLG_REVOCATION_DEFAULT = @as(u32, 0);
pub const CRYPTDLG_REVOCATION_ONLINE = @as(u32, 2147483648);
pub const CRYPTDLG_REVOCATION_CACHE = @as(u32, 1073741824);
pub const CRYPTDLG_REVOCATION_NONE = @as(u32, 536870912);
pub const CRYPTDLG_CACHE_ONLY_URL_... | win32/security/cryptography/ui.zig |
const std = @import("std");
const registry = @import("registry.zig");
const xml = @import("../xml.zig");
const cparse = @import("c_parse.zig");
const mem = std.mem;
const Allocator = mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const api_constants_name = "API Constants";
pub const ParseResult = stru... | generator/vulkan/parse.zig |
const std = @import("std");
const assert = std.debug.assert;
const math = std.math;
const L = std.unicode.utf8ToUtf16LeStringLiteral;
const zwin32 = @import("zwin32");
const w = zwin32.base;
const d3d12 = zwin32.d3d12;
const dml = zwin32.directml;
const hrPanic = zwin32.hrPanic;
const hrPanicOnFail = zwin32.hrPanicOnFa... | samples/mesh_shader_test/src/mesh_shader_test.zig |
const std = @import( "std" );
const inf = std.math.inf;
const min = std.math.min;
const Allocator = std.mem.Allocator;
usingnamespace @import( "../core/util.zig" );
usingnamespace @import( "../core/core.zig" );
usingnamespace @import( "../core/gtkz.zig" );
usingnamespace @import( "../core/support.zig" );
usingnamespace... | src/space/view.zig |
const std = @import("std");
const utils = @import("utils.zig");
pub const Error = utils.Error;
const Guid = @This();
pub const size = 16;
pub const string_size = 36;
data: [size]u8 = undefined,
pub fn is_null(self: *const Guid) bool {
for (self.data) |b| {
if (b != 0) {
return false;
... | libs/utils/guid.zig |
const std = @import("std");
const builtin = @import("builtin");
const Allocator = mem.Allocator;
const Decl = @import("decl.zig").Decl;
const Compilation = @import("compilation.zig").Compilation;
const mem = std.mem;
const ast = std.zig.ast;
const Value = @import("value.zig").Value;
const Type = @import("type.zig").Typ... | src-self-hosted/scope.zig |
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
const exe = b.addExecutable("async-lpc", "src/main.zig");
exe.addPackage(std.build.Pkg{
.name = "lpc1768",
.path = "libs/lpc1768/lpc1768.zig",
});
exe.setTarget(std.zig.CrossTarget{
.cpu_arch = .thumb,
... | research-chamber/build.zig |
const std = @import("std");
const math = std.math;
const testing = std.testing;
fn reflect(comptime UInt: type, data: UInt) UInt {
const bits = @typeInfo(UInt).Int.bits;
var res: UInt = 0;
var tmp = data;
var bit: usize = 0;
while (bit < bits) : (bit += 1) {
if (tmp & 1 != 0) {
... | crc.zig |
const std = @import("std");
const log = std.log;
const math = std.math;
const testing = std.testing;
const assert = std.debug.assert;
const cuda = @import("cudaz");
const cu = cuda.cu;
const png = @import("png.zig");
const utils = @import("utils.zig");
const resources_dir = "resources/hw3_resources/";
pub fn main()... | CS344/src/hw3.zig |
const std = @import("std");
const assert = std.debug.assert;
const glfw = @import("glfw");
const gpu = @import("gpu");
const c = @import("c.zig").c;
const objc = @cImport({
@cInclude("objc/message.h");
});
fn printUnhandledError(_: void, typ: gpu.ErrorType, message: [*:0]const u8) void {
switch (typ) {
... | gpu/examples/sample_utils.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const testing = std.testing;
const col = @import("color.zig");
const Color = col.Color;
const IndexedBitmap = @import("IndexedBitmap.zig");
width: u32,
height: u32,
pixels: []u8,
const ColorBitmap = @This();
pub fn init(allocator: Allocator, width: u3... | src/ColorBitmap.zig |
const std = @import("std");
const upaya = @import("upaya");
const data = @import("map.zig");
const Map = data.Map;
const Rule = data.Rule;
const RuleTile = data.RuleTile;
const AppState = @import("tilescript.zig").AppState;
/// runs the input map directly from Map through all the pre-processing rules and copies the d... | tilescript/rule_processor.zig |
const VTE = @import("vte");
const c = VTE.c;
const gtk = VTE.gtk;
const vte = VTE.vte;
const std = @import("std");
const allocator = std.heap.page_allocator;
const Closures = @import("gui.zig").Closures;
const k = @import("keys.zig");
const Accel = k.Accel;
const Keys = k.Keys;
pub const Menu = struct {
new_tab: g... | src/menus.zig |
const std = @import("std");
const assert = std.debug.assert;
const log = std.log.scoped(.reloc);
const macho = std.macho;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
const aarch64 = @import("reloc/aarch64.zig");
const x86_64 = @import("reloc/x86_64.zig");
const Allocator = mem.Allocator;
const ... | src/link/MachO/reloc.zig |
const std = @import("std");
const wlr = @cImport({
@cDefine("_POSIX_C_SOURCE", "200112L");
@cDefine("WLR_USE_UNSTABLE", {});
@cInclude("linux/input-event-codes.h");
@cInclude("unistd.h");
@cInclude("wayland-server-core.h");
@cInclude("wlr/backend.h");
@cInclude("wlr/backend/libinput.h");
... | src/main.zig |
const std = @import("std");
const kernel = @import("kernel.zig");
const page_size = kernel.arch.page_size;
const sector_size = kernel.arch.sector_size;
pub const kb = 1024;
pub const mb = kb * 1024;
pub const gb = mb * 1024;
pub const tb = gb * 1024;
const log = kernel.log.scoped(.data_manipulation);
pub inline fn st... | src/kernel/data_manipulation.zig |
const std = @import("std");
const util = @import("util.zig");
/// A game ROM, with memory mapping based on LoROM.
pub const ROM = struct {
bytes: []const u8,
/// Load the ROM from a file, allocating memory with a given allocator.
pub fn init(allocator: *std.mem.Allocator, filename: []const u8) !ROM {
... | src/rom.zig |
const std = @import("std");
const GL = @import("../util/opengl.zig");
const Ring = @import("../util/ring.zig");
const shared = @import("../shared.zig");
const zigimg = @import("zigimg");
const UI = @import("../util/ui.zig");
const GLRenderer = @import("../gl_renderer.zig");
const Editor = @import("../editor.zig");
usi... | src/windows/gl_wrapper.zig |
const std = @import("std");
const stdx = @import("stdx");
const ui = @import("../ui.zig");
const log = stdx.log.scoped(.containers);
/// Provides padding around a child widget.
pub const Padding = struct {
props: struct {
pad_top: ?f32 = null,
pad_right: ?f32 = null,
pad_bottom: ?f32 = null... | ui/src/widgets/containers.zig |
const std = @import("std");
const Record = @import("lsmtree").Record;
const RecordError = @import("lsmtree").RecordError;
const KeyLengthType = @import("lsmtree").KeyLengthType;
const RecordLengthType = @import("lsmtree").RecordLengthType;
const Op = @import("lsmtree").Op;
const lsmtree = @import("lsmtree");
const expe... | src/serialize/record.zig |
usingnamespace @import("core.zig");
const panic = std.debug.panic;
pub const GeneralPurposeAllocator: type = std.heap.GeneralPurposeAllocator(.{ .enable_memory_limit = true });
const glfw = @import("glfw");
const Input = @import("input.zig").Input;
const renderer = @import("renderer.zig");
pub fn main() !void {
... | src/main.zig |
const std = @import("std");
const root = @import("main.zig");
const math = std.math;
const testing = std.testing;
pub const vec2 = Vec2(f32);
pub const vec2_f64 = Vec2(f64);
pub const vec2_i32 = Vec2(i32);
/// A 2 dimensional vector.
pub fn Vec2(comptime T: type) type {
if (@typeInfo(T) != .Float and @typeInfo(T)... | src/vec2.zig |
const std = @import("std");
const assert = std.debug.assert;
const Computer = @import("./computer.zig").Computer;
pub const Bank = struct {
node: [5]Computer,
pub fn init(str: []const u8) Bank {
var self = Bank{
.node = undefined,
};
var j: usize = 0;
while (j < sel... | 2019/p07/bank.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
const Vec2 = tools.Vec2;
const Map = tools.Map(u8, 32, 32, false);
const Unit = struct {
const Type = enum { goblin, elf };
type: Type,
hit_points: u16 = 200,
attack: u16 = 3,
p: Vec2,
fn lessThan(_: ... | 2018/day15.zig |
const sf = @import("../sfml.zig");
pub const View = struct {
const Self = @This();
/// Creates a view from a rectangle
pub fn fromRect(rect: sf.FloatRect) Self {
var ret: Self = undefined;
ret.center = rect.getCorner();
ret.size = rect.getSize();
ret.center = ret.center.ad... | src/sfml/graphics/view.zig |
const std = @import("std");
const Buffer = std.Buffer;
const warn = std.debug.warn;
const assert = std.debug.assert;
const mem = std.mem;
const Allocator = mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const encoding = enum {
path,
pathSegment,
host,
zone,
userPassword,
queryCo... | src/net/url/url.zig |
const std = @import("std");
test "example" {
const input = @embedFile("5_example.txt");
const result = try run(input);
try std.testing.expectEqual(@as(u32, 5), result);
}
pub fn main() !void {
const input = @embedFile("5.txt");
const result = try run(input);
std.debug.print("{}\n", .{result});... | shritesh+zig/5a.zig |
const std = @import("std");
const stdx = @import("stdx");
const fatal = stdx.fatal;
const t = stdx.testing;
const ds = stdx.ds;
const Closure = stdx.Closure;
const ClosureIface = stdx.ClosureIface;
const Function = stdx.Function;
const Duration = stdx.time.Duration;
const string = stdx.string;
const graphics = @import(... | ui/src/module.zig |
const std = @import("std");
const Type = @import("types.zig").Type;
const Status = @import("status.zig").Status;
const Memory = @import("memory.zig").Memory;
const testing = std.testing;
const allocator = std.heap.page_allocator;
pub const CPU = struct {
const INITIAL_ADDRESS = 0xF000;
const STACK_BASE = 0x01... | src/cpu.zig |
gpa: *Allocator,
manifest_dir: fs.Dir,
hash: HashHelper = .{},
const Cache = @This();
const std = @import("std");
const crypto = std.crypto;
const fs = std.fs;
const assert = std.debug.assert;
const testing = std.testing;
const mem = std.mem;
const fmt = std.fmt;
const Allocator = std.mem.Allocator;
/// Be sure to ca... | src/Cache.zig |
const std = @import("../std.zig");
const assert = std.debug.assert;
const expect = std.testing.expect;
/// Creates a raw "1.0" mantissa for floating point type T. Used to dedupe f80 logic.
fn mantissaOne(comptime T: type) comptime_int {
return if (floatMantissaDigits(T) == 64) 1 << 63 else 0;
}
/// Creates floati... | lib/std/math/float.zig |
const std = @import("std");
usingnamespace @import("common.zig");
const ascii = std.ascii;
const math = std.math;
const fmt = std.fmt;
const mem = std.mem;
const Version = std.builtin.Version;
const assert = std.debug.assert;
pub const StatusEvent = struct {
version: Version,
code: u16,
reason: []const ... | src/parser/response.zig |
const std = @import("std");
const opt = @import("opt.zig");
const warn = std.debug.warn;
const Allocator = std.mem.Allocator;
const stdout = &std.io.getStdOut().writer();
const rand = std.rand.DefaultPrng; // fast unbiased random numbers
const time = std.time;
/// Returns shuffled arraylist of []u8's, caller owns memo... | src/shuf.zig |
const std = @import("std");
const builtin = @import("builtin");
const Pkg = std.build.Pkg;
const string = []const u8;
pub const cache = ".zigmod/deps";
pub fn addAllTo(exe: *std.build.LibExeObjStep) void {
checkMinZig(builtin.zig_version, exe);
@setEvalBranchQuota(1_000_000);
for (packages) |pkg| {
... | deps.zig |
const std = @import("std");
const os = std.os;
const warn = std.debug.warn;
const STDIN_NAME = "-";
const BUFFER_SIZE = 4096;
const Input = struct {
fd: i32,
pub fn init(name: []const u8) !Input {
var self = Input{
.fd = undefined,
};
if (std.mem.eql(u8, name, STDIN_NAME)... | src/main.zig |
const std = @import("std");
const VgaBuffer = struct {
buffer: [*]volatile VgaChar = @intToPtr([*]volatile VgaChar, 0xb8000),
color: FullColor = .{ .fg = .White, .bg = .Black },
row: usize = 0,
column: usize = 0,
const Self = @This();
/// Clear the screen to black. Preserves the current color... | src/vga.zig |
const std = @import("std");
const unistd = @cImport(@cInclude("unistd.h"));
const OpType = enum {
INC,
MOVE,
LOOP,
PRINT,
};
const Printer = struct {
stdout: std.fs.File.Writer,
sum1: i32 = 0,
sum2: i32 = 0,
quiet: bool,
fn init(args: anytype) Printer {
return Printer {
... | brainfuck/bf.zig |
const std = @import("std");
const io = std.io;
const File = std.os.File;
const assert = std.debug.assert;
/// Test if two slices are equal. If not print the contents of the
/// expected and actual strings to out_stream and return false.
pub fn testExpectedStream(comptime Error: type, out_stream: *io.OutStream(Error), ... | src/testexpected.zig |
const os = @import("root").os;
const std = @import("std");
const gdt = @import("gdt.zig");
const regs = @import("regs.zig");
const interrupts = @import("interrupts.zig");
const Tss = @import("tss.zig").Tss;
pub const sched_stack_size = 0x10000;
pub const int_stack_size = 0x10000;
pub const task_stack_size = 0x10000;
... | src/platform/x86_64/thread.zig |
const qnan128 = @bitCast(f128, @as(u128, 0x7fff800000000000) << 64);
const inf128 = @bitCast(f128, @as(u128, 0x7fff000000000000) << 64);
const __addtf3 = @import("addXf3.zig").__addtf3;
fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) void {
const x = __addtf3(a, b);
const rep = @bitCas... | lib/std/special/compiler_rt/addXf3_test.zig |
const builtin = @import("builtin");
const std = @import("std");
const c = @import("c.zig");
const math = std.math;
const comptimePrint = std.fmt.comptimePrint;
const window_name = "quaternion julia sets";
const real_time = true;
const fps = 24;
const window_width = if (real_time) 1280 else 1920;
const window_height = ... | src/julia.zig |
const std = @import("std");
pub const Uri = struct {
/// Scheme component of the URI. i.e gemini://
scheme: []const u8,
/// Host component, i.e. http://<host>
host: []const u8,
/// Optional port component, i.e. http://<host>:[port]
port: ?u16,
/// Path component of the URI, i.e. gemini://<... | src/uri.zig |
pub const EXT2_FT_UNKNOWN = 0;
pub const EXT2_FT_REG_FILE = 1;
pub const EXT2_FT_DIR = 2;
pub const EXT2_FT_CHRDEV = 3;
pub const EXT2_FT_BLKDEV = 4;
pub const EXT2_FT_FIFO = 5;
pub const EXT2_FT_SOCK = 6;
pub const EXT2_FT_SYMLINK = 7;
pub const Ext2_DirectoryEntry = extern struct {
inode: u32, // 0 == not used
... | libs/ext2/ext2.zig |
const builtin = @import("builtin");
const std = @import("std");
const assert = std.debug.assert;
comptime {
// These are implicitly defined when compiling tests.
if (!builtin.is_test) {
@export("memcpy", memcpy, builtin.GlobalLinkage.Strong);
@export("memmove", memmove, builtin.GlobalLinkage.S... | src/string.zig |
const std = @import("std");
const assert = std.debug.assert;
const panic = std.debug.panic;
const Texture = @import("Texture.zig");
const zp = @import("../../zplay.zig");
const gl = zp.deps.gl;
const Self = @This();
pub const FramebufferError = error{
InvalidTexture,
};
/// id of framebuffer
id: gl.GLuint = undef... | src/graphics/common/Framebuffer.zig |
const Builder = std.build.Builder;
const std = @import("std");
pub fn build(b: *Builder) void {
const native_opt = b.option(bool, "native", "if many cpu, turn this on");
const is_native = native_opt orelse true;
var target: std.zig.CrossTarget = undefined;
if (is_native) {
target = b.standardT... | build.zig |
const std = @import("std");
const qoi = @import("qoi.zig");
const total_rounds = 4096;
pub fn main() !void {
try perform(true);
try perform(false);
}
fn perform(comptime test_encoder: bool) !void {
const allocator = std.heap.c_allocator;
const source_data = @embedFile("../data/zero.qoi");
const ... | src/bench.zig |
pub const TBS_CONTEXT_VERSION_ONE = @as(u32, 1);
pub const TBS_SUCCESS = @as(u32, 0);
pub const TBS_OWNERAUTH_TYPE_FULL = @as(u32, 1);
pub const TBS_OWNERAUTH_TYPE_ADMIN = @as(u32, 2);
pub const TBS_OWNERAUTH_TYPE_USER = @as(u32, 3);
pub const TBS_OWNERAUTH_TYPE_ENDORSEMENT = @as(u32, 4);
pub const TBS_OWNERAUTH_TYPE_E... | deps/zigwin32/win32/system/tpm_base_services.zig |
const std = @import("std");
const ShaderModule = @This();
/// The type erased pointer to the ShaderModule implementation
/// Equal to c.WGPUShaderModule for NativeInstance.
ptr: *anyopaque,
vtable: *const VTable,
pub const VTable = struct {
reference: fn (ptr: *anyopaque) void,
release: fn (ptr: *anyopaque) v... | gpu/src/ShaderModule.zig |
const std = @import("std");
const builtin = std.builtin;
const io = std.io;
const meta = std.meta;
const trait = std.trait;
const DefaultPrng = std.rand.DefaultPrng;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const expectError = std.testing.expectError;
const mem = std.mem;
const fs... | lib/std/io/test.zig |
const tests = @import("tests.zig");
const builtin = @import("builtin");
// add_both - test for stage1 and stage2, in #include mode
// add - test stage1 only, in #include mode
// add_2 - test stage2 only
// addC_both - test for stage1 and stage2, in -c mode
// addC - test stage1 only, in -c mode
pub fn addCases(cases:... | test/translate_c.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const maru = @import("maru");
const events = maru.events;
const flat = maru.flat;
const gfx = maru.gfx;
const states = maru.states;
usingnamespace maru.math;
usingnamespace maru.c;
const nitori = @import("nitori");
cons... | src/main.zig |
const std = @import("std");
const c = @import("c.zig");
const utils = @import("utils.zig");
const intToError = @import("error.zig").intToError;
const Error = @import("error.zig").Error;
const Generic = @import("types.zig").Generic;
pub const Library = @import("Library.zig");
pub const Face = @import("Face.zig");
pub c... | freetype/src/freetype/freetype.zig |
// These match the SunOS error numbering scheme.
pub const EPERM = 1;
pub const ENOENT = 2;
pub const ESRCH = 3;
pub const EINTR = 4;
pub const EIO = 5;
pub const ENXIO = 6;
pub const E2BIG = 7;
pub const ENOEXEC = 8;
pub const EBADF = 9;
pub const ECHILD = 10;
pub const EAGAIN = 11;
pub const ENOMEM = 12;
pub const ... | lib/std/os/bits/linux/errno-sparc.zig |
const ArrayList = std.ArrayList;
const HeapAllocator = std.heap.HeapAllocator;
const Image = zigimg.Image;
const OctTreeQuantizer = zigimg.OctTreeQuantizer;
const assert = std.debug.assert;
const color = zigimg.color;
const std = @import("std");
const testing = std.testing;
const zigimg = @import("zigimg");
usingnamesp... | tests/octree_quantizer_test.zig |
const wchar_t = if (@import("builtin").os.tag == .windows) u16 else u32;
pub extern fn SDL_GetPlatform() [*c]const u8;
const struct_unnamed_1 = extern struct {
__clang_max_align_nonce1: c_longlong align(8),
__clang_max_align_nonce2: c_longdouble align(16),
};
pub const SDL_FALSE = @enumToInt(enum_unnamed_2.SDL_... | src/binding/sdl.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.zig |
const std = @import("std");
const testing = std.testing;
/// is a helper function for testing
pub fn expectString(expected: []const u8, actual: []const u8) !void {
testing.expect(std.mem.eql(u8, expected, actual)) catch |err| {
std.log.err("expected: \'{s}\', got: \'{s}\'", .{ expected, actual });
... | src/utils.zig |
const std = @import("std");
const upaya = @import("upaya");
const colors = upaya.colors;
usingnamespace upaya.imgui;
const stb = @import("stb");
var rects: []stb.stbrp_rect = undefined;
var rect_count: usize = 20;
var last_pack_result = true;
const heuristics = [_][]const u8{ "Skyline", "Skyline BF" };
var heuristic: ... | examples/texture_packer.zig |
const builtin = @import("builtin");
const fmath = @import("index.zig");
pub fn round(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(round32, x),
f64 => @inlineCall(round64, x),
else => @compileError("round not implemented for " ++ @typeName(T)),
}
}
f... | src/round.zig |
pub const CATID_WcsPlugin = Guid.initString("a0b402e0-8240-405f-8a16-8a5b4df2f0dd");
pub const MAX_COLOR_CHANNELS = @as(u32, 8);
pub const INTENT_PERCEPTUAL = @as(u32, 0);
pub const INTENT_RELATIVE_COLORIMETRIC = @as(u32, 1);
pub const INTENT_SATURATION = @as(u32, 2);
pub const INTENT_ABSOLUTE_COLORIMETRIC = @as(u32, 3... | win32/ui/color_system.zig |
const std = @import("std");
const assert = std.debug.assert;
const log = std.log.scoped(.clock);
const config = @import("../config.zig");
const clock_offset_tolerance_max: u64 = config.clock_offset_tolerance_max_ms * std.time.ns_per_ms;
const epoch_max: u64 = config.clock_epoch_max_ms * std.time.ns_per_ms;
const wind... | src/vr/clock.zig |
const std = @import("std");
const assert = std.debug.assert;
const print = std.debug.print;
const util = @import("util.zig");
const data = @embedFile("../data/day02.txt");
const Str = []const u8;
fn readLineNum(input: Str, idx: *usize) !u8 {
var start_idx: ?usize = null;
while (idx.* < input.len) : (idx.* +=... | src/day02.zig |
usingnamespace @import("bits.zig");
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const windows = @import("../windows.zig");
const unexpectedError = windows.unexpectedError;
const GetLastError = windows.kernel32.GetLastError;
const SetLastError = windows.kernel32.SetLa... | lib/std/os/windows/user32.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const c = @import("c.zig");
const Environment = @import("environment.zig").Environment;
const odbc = @import("types.zig");
const SqlReturn = odbc.SqlReturn;
const HandleType = odbc.HandleType;
const odbc_error = @import("error.zig");
const ReturnError... | src/connection.zig |
const inputFile = @embedFile("./input/day05.txt");
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const assert = std.debug.assert;
fn parseU16(buf: []const u8) std.fmt.ParseIntError!u16 {
return std.fmt.parseInt(u16, buf, 10);
}
const Point = struct {
// cons... | src/day05.zig |
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for rest... | build.zig |
const testing = @import("std").testing;
const mem = @import("std").mem;
const c = @import("c.zig").c;
/// Errors that GLFW can produce.
pub const Error = error{
/// GLFW has not been initialized.
///
/// This occurs if a GLFW function was called that must not be called unless the library is
/// initia... | glfw/src/errors.zig |
const std = @import("../index.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const mem = std.mem;
const math = std.math;
const ziggurat = @import("ziggurat.zig");
// When you need fast unbiased random numbers
pub const DefaultPrng = Xoroshiro128;
// When you need cryptographically secure... | std/rand/index.zig |
const std = @import("std");
const runtime_spec = @import("runtime_spec.zig");
const syscall = @import("syscall.zig");
const utils = @import("utils.zig");
const linux = std.os.linux;
const RootfsSetupError = error{ MountParentPrivateFailed, InvalidDeviceType, InvalidRootfsPropagation };
fn makeParentMountPrivate(allo... | src/rootfs.zig |
const std = @import("std");
const mem = std.mem;
const atomic = std.atomic;
const maxInt = std.math.maxInt;
const SpinFutex = struct {
// spin-lock
pub fn wait(ptr: *const atomic.Atomic(u32), expect: u32, comptime timeout: ?u64) error{TimedOut}!void {
if (timeout) |_| @compileError("Not implemented!");
... | src/nnet_trainer.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/day01.txt");
p... | src/day01.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const testing = std.testing;
const meta = std.meta;
const builtin = std.builtin;
const Comparable = @import("comparable.zig");
const option = @This();
/// some type that is a liite bit like rust's optional type
/// I do this just to get rid of if(somethin... | src/option.zig |
const std = @import("std");
const c = @cImport({
@cInclude("time.h");
});
/// get time in ms
pub fn getTime() u64 {
var time = std.time.milliTimestamp();
if(time < 0) time = 0; // if your system time is before the beginning of the universe, too bad.
return @intCast(u64, time);
}
/// get start of day i... | src/tenhourtime.zig |
const std = @import("std");
const version = @import("version");
const tar = @import("tar");
const zzz = @import("zzz");
const Dependency = @import("Dependency.zig");
const Package = @import("Package.zig");
const utils = @import("utils.zig");
const curl = @import("curl");
const Allocator = std.mem.Allocator;
const Fifo... | src/api.zig |
const std = @import("std");
var gCurrentCoroutine: ?*StacklessCoroutine(void) = undefined;
pub fn StacklessCoroutine(comptime T: type) type {
return struct {
const Self = @This();
pub const UserFunctionType = fn () callconv(.Async) void;
// members
allocator: *std.mem.Al... | src/stackless_coroutine.zig |
const std = @import("std");
const c = @import("c.zig");
const State = struct {
pass_action: c.sg_pass_action,
main_pipeline: c.sg_pipeline,
main_bindings: c.sg_bindings,
};
var state: State = undefined;
var last_time: u64 = 0;
var show_test_window: bool = false;
var show_another_window: bool = false;
var ... | src/example_imgui.zig |
const std = @import("std");
const stdout = std.io.getStdOut().writer();
const print = stdout.print;
const os = std.os;
const Allocator = std.mem.Allocator;
const funcs = @import("funcs.zig");
pub const Escapes = struct {
o: [:0]const u8 = undefined,
c: [:0]const u8 = undefined,
pub fn init(open: [:0]cons... | prompt.zig |
const std = @import("std");
const assert = std.debug.assert;
const mem = std.mem;
const CrossTarget = std.zig.CrossTarget;
const Target = std.Target;
const build_options = @import("build_options");
const stage2 = @import("main.zig");
const fatal = stage2.fatal;
const Compilation = @import("Compilation.zig");
const tr... | src/stage1.zig |
const builtin = @import("builtin");
const is_test = builtin.is_test;
const is_gnu = switch (builtin.abi) {
.gnu, .gnuabin32, .gnuabi64, .gnueabi, .gnueabihf, .gnux32 => true,
else => false,
};
const is_mingw = builtin.os == .windows and is_gnu;
comptime {
const linkage = if (is_test) builtin.GlobalLinkage... | lib/std/special/compiler_rt.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ines = @import("ines.zig");
const mapper = @import("mapper.zig");
const GenericMapper = mapper.GenericMapper;
const console_ = @import("console.zig");
const Config = console_.Config;
const Console = console_.Console;
pub fn Cart(comptime config: ... | src/cart.zig |
const builtin = @import("builtin");
const std = @import("../std.zig");
const mem = std.mem;
const assert = std.debug.assert;
const math = std.math;
const maxInt = std.math.maxInt;
const native_arch = builtin.cpu.arch;
test {
if (builtin.os.tag == .windows) {
_ = @import("windows/test.zig");
}
}
pub c... | lib/std/os/windows.zig |
usingnamespace std.os.linux;
const std = @import("../../std.zig");
const errno = getErrno;
const unexpectedErrno = std.os.unexpectedErrno;
const expectEqual = std.testing.expectEqual;
const expectError = std.testing.expectError;
const expect = std.testing.expect;
pub const btf = @import("bpf/btf.zig");
// instruction... | lib/std/os/linux/bpf.zig |
const std = @import("std");
const c = @cImport({
@cInclude("time.h");
@cInclude("sys/select.h");
@cInclude("poll.h");
});
pub var memory = [_]u16{0} ** 65536;
pub var reg = [_]u16{0} ** @enumToInt(Registers.COUNT);
pub const Registers = enum(u16) {
R0,
R1,
R2,
R3,
R4,
R5,
R6,
... | src/mem.zig |
const c = @import("c.zig");
const std = @import("std");
const panic = std.debug.panic;
const trait = std.meta.trait;
//TODO Replace with pipeline state object
pub fn init3dRendering() void {
c.glEnable(c.GL_DEPTH_TEST);
c.glDepthMask(c.GL_TRUE);
c.glDepthFunc(c.GL_LESS);
c.glFrontFace(c.GL_CCW);
... | src/opengl_renderer.zig |
/// The function fiatSecp256k1AddcarryxU32 is an addition with carry.
/// Postconditions:
/// out1 = (arg1 + arg2 + arg3) mod 2^32
/// out2 = ⌊(arg1 + arg2 + arg3) / 2^32⌋
///
/// Input Bounds:
/// arg1: [0x0 ~> 0x1]
/// arg2: [0x0 ~> 0xffffffff]
/// arg3: [0x0 ~> 0xffffffff]
/// Output Bounds:
/// out1: ... | fiat-zig/src/secp256k1_32.zig |
const std = @import("std");
const Instance = @import("Instance.zig");
const Context = @import("Context.zig");
fn drop_loop(ctx: Context, allocator: std.mem.Allocator) ?Instance {
while (true) {
const filename = ctx.wait_for_file() orelse return null;
if (Instance.init(ctx, filename, allocator)) |i... | src/main.zig |
const std = @import("std");
const mem = std.mem;
const trait = std.meta.trait;
const assert = std.debug.assert;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
pub const SelfType = opaque {};
fn makeSelfPtr(ptr: anytype) *SelfType {
if (comptime !trait.isSingleItemPtr(@TypeOf(ptr)... | interface.zig |
const std = @import("std");
const imgui = @import("imgui");
const sdl = @import("sdl");
const gk = @import("../gamekit.zig");
pub const Events = struct {
mouse_cursors: [imgui.ImGuiMouseCursor_COUNT]?*sdl.SDL_Cursor = undefined,
mouse_button_state: [4]bool = undefined,
global_time: u64 = 0,
var clipbo... | gamekit/imgui/events.zig |
pub const PR = enum(i32) {
SET_PDEATHSIG = 1,
GET_PDEATHSIG = 2,
GET_DUMPABLE = 3,
SET_DUMPABLE = 4,
GET_UNALIGN = 5,
SET_UNALIGN = 6,
GET_KEEPCAPS = 7,
SET_KEEPCAPS = 8,
GET_FPEMU = 9,
SET_FPEMU = 10,
GET_FPEXC = 11,
SET_FPEXC = 12,
GET_TIMING = 13,
SET_TI... | lib/std/os/bits/linux/prctl.zig |
pub const NotYetImplementedFn = extern fn(*@OpaqueType()) *@OpaqueType();
pub const Guid = extern struct {
pub fn guid(data1: u32, data2: u16, data3: u16, data4: [8]u8) Guid {
return Guid {
.data1 = data1,
.data2 = data2,
.data3 = data3,
.data4 = data4
... | src/uefi/uefi.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const List = std.ArrayList;
const Map = std.AutoHashMap;
const StrMap = std.StringHashMap;
const BitSet = std.DynamicBitSet;
const Str = []const u8;
const int = i64;
const util = @import("util.zig");
const gpa = util.gpa;
const data = @embedFile("../dat... | src/day20.zig |
const std = @import("std");
const string = []const u8;
const range = @import("range").range;
const extras = @import("extras");
const time = @This();
pub const DateTime = struct {
ms: u16,
seconds: u16,
minutes: u16,
hours: u16,
days: u16,
months: u16,
years: u16,
timezone: TimeZone,
... | time.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/tabs.zig |
const std = @import("std");
const assert = std.debug.assert;
const L = std.unicode.utf8ToUtf16LeStringLiteral;
const w = @import("windows.zig");
const BYTE = w.BYTE;
const HRESULT = w.HRESULT;
const WINAPI = w.WINAPI;
const UINT32 = w.UINT32;
const BOOL = w.BOOL;
const FALSE = w.FALSE;
const WCHAR = w.WCHAR;
const GUID... | modules/platform/vendored/zwin32/src/xapo.zig |
const std = @import("std");
const mem = std.mem;
const os = std.os;
const Token = std.zig.Token;
const ast = std.zig.ast;
const TokenIndex = std.zig.ast.TokenIndex;
pub const Color = enum {
Auto,
Off,
On,
};
pub const Msg = struct {
path: []const u8,
text: []u8,
first_token: TokenIndex,
la... | src-self-hosted/errmsg.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ines = @import("ines.zig");
const Cart = @import("cart.zig").Cart;
const Ppu = @import("ppu.zig").Ppu;
const Cpu = @import("cpu.zig").Cpu;
const Apu = @import("apu.zig").Apu;
const Controller = @import("controller.zig").Controller;
const video = @... | src/console.zig |
const std = @import("std");
const gpa = std.heap.c_allocator;
const zfetch = @import("zfetch");
const u = @import("./../../util/index.zig");
const zpm = @import("./../zpm.zig");
//
//
pub fn execute(args: [][]u8) !void {
const url = "https://zpm.random-projects.net/api/packages";
const req = try zfetch.Req... | src/cmd/zpm/add.zig |
const c = @import("glfw");
const gl = @import("gl");
pub const WindowError = error {
InitializationError
};
const std = @import("std");
const zalgebra = @import("zalgebra");
const Vec2 = zalgebra.Vec2;
var mainWindow: ?*Window = null;
// TODO: more inputs and a more efficient way to do them
pub const Input = s... | didot-glfw/window.zig |
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const unicode = std.unicode;
const ascii = @import("ascii.zig");
pub usingnamespace @import("components.zig");
const Self = @This();
pub fn isAlphabetic(cp: u21) bool {
return Self.DerivedCoreProperties.isAlphabetic(cp);
}
pub fn isA... | src/Ziglyph.zig |