code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
test "@sizeOf and @TypeOf" {
const y: @TypeOf(x) = 120;
try expect(@sizeOf(@TypeOf(y)) == 2);
}
const x: u16 = 13;
const z: @TypeOf(x) = 19;
test "@sizeOf on compile-time types" {
try expect(@sizeOf... | test/behavior/sizeof_and_typeof.zig |
const std = @import("std");
const stdx = @import("stdx");
const string = stdx.string;
const algo = stdx.algo;
const ds = stdx.ds;
const t = stdx.testing;
const builtin = @import("builtin");
const tracy = stdx.debug.tracy;
const document = stdx.textbuf.document;
const Document = document.Document;
const LineChunkId = d... | parser/parser.zig |
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
const expect = testing.expect;
const expectEqual = testing.expectEqual;
test "void parameters" {
try voidFun(1, void{}, 2, {});
}
fn voidFun(a: i32, b: void, c: i32, d: void) !void {
_ = d;
const v = b;
const v... | test/behavior/fn_stage1.zig |
const std = @import("../std.zig");
usingnamespace std.c;
extern "c" fn __error() *c_int;
pub const _errno = __error;
pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: u... | lib/std/c/freebsd.zig |
usingnamespace @import("clang_options.zig");
pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{
flagpd1("C"),
flagpd1("CC"),
.{
.name = "E",
.syntax = .flag,
.zig_equivalent = .preprocess_only,
.pd1 = true,
.pd2 = false,
.psl = false,
},
flagpd1("EB"),
flagpd1("EL"),
flagp... | src/clang_options_data.zig |
const std = @import("std");
const builtin = @import("builtin");
const c = @This();
const page_size = std.mem.page_size;
const iovec = std.os.iovec;
const iovec_const = std.os.iovec_const;
test {
_ = tokenizer;
}
pub const tokenizer = @import("c/tokenizer.zig");
pub const Token = tokenizer.Token;
pub const Tokeniz... | lib/std/c.zig |
const std = @import("std");
const scanner = @import("scanner.zig");
const vm = @import("vm.zig");
const debug = @import("debug.zig");
const vl = @import("value.zig");
const Allocator = std.mem.Allocator;
const Stack = @import("stack.zig").Stack;
const Chunk = @import("chunk.zig").Chunk;
const OpCode = @import("chunk.... | src/compiler.zig |
const std = @import("std");
const builtin = @import("builtin");
const build_options = @import("build_options");
const debug = std.debug;
const heap = std.heap;
const io = std.io;
const mem = std.mem;
const testing = std.testing;
pub const c = @cImport({
@cInclude("sqlite3.h");
});
pub const Text = @import("query.... | sqlite.zig |
const std = @import("std");
const testing = std.testing;
const Allocator = std.mem.Allocator;
const heap = std.heap;
const Tree = @import("tree.zig").Tree;
const o = @import("ops.zig");
const Op = o.Op;
const OpTag = o.OpTag;
const DB = @import("db.zig").RocksDataBbase;
const root_key = @import("db.zig").root_key;
cons... | src/merk.zig |
const std = @import("std");
const arg_matches = @import("arg_matches.zig");
const Command = @import("Command.zig");
const Arg = @import("Arg.zig");
const ArgvIterator = @import("ArgvIterator.zig");
const MatchedArg = @import("MatchedArg.zig");
const mem = std.mem;
const Allocator = std.mem.Allocator;
const ArgMatches ... | src/parser.zig |
const fmath = @import("index.zig");
fn frexp_result(comptime T: type) -> type {
struct {
significand: T,
exponent: i32,
}
}
pub const frexp32_result = frexp_result(f32);
pub const frexp64_result = frexp_result(f64);
pub fn frexp(x: var) -> frexp_result(@typeOf(x)) {
const T = @typeOf(x);
... | src/frexp.zig |
pub const AVRF_MAX_TRACES = @as(u32, 32);
//--------------------------------------------------------------------------------
// Section: Types (12)
//--------------------------------------------------------------------------------
pub const VERIFIER_ENUM_RESOURCE_FLAGS = enum(u32) {
DONT_RESOLVE_TRACES = 2,
SU... | win32/system/application_verifier.zig |
const std = @import("std");
const testing = std.testing;
const allocator = std.testing.allocator;
pub const ALU = struct {
const NUM_VARS = 4;
const NUM_STAGES = 14;
const NUM_INSTR = 10;
const INSTR_PER_STAGE = 18;
pub const OP = enum {
INP,
ADD,
MUL,
DIV,
... | 2021/p24/alu.zig |
const std = @import("std");
/// There are n choose k ways to choose k elements from a set of n elements.
/// This iterator produces a binary representation of which k elements are chosen
/// calling `next()` on `NChooseK(u8).init(3,2)` will produce {0b011, 0b101, 0b110, null}
pub fn NChooseK(comptime T: type) type {
... | src/misc.zig |
const std = @import("std");
usingnamespace @import("../machine.zig");
usingnamespace @import("../util.zig");
const imm = Operand.immediate;
const mem = Operand.memory;
const memRm = Operand.memoryRm;
const reg = Operand.register;
const prefix = EncodingControl.prefix;
const prefix2 = EncodingControl.prefix2;
const hi... | src/x86/tests/prefixes.zig |
const keyboard = @import("keyboard.zig");
const keys = @import("keyboard_keys.zig");
const Location = keys.Location;
const Input = keys.Input;
pub const KeyboardLayout = enum {
en_US_QWERTY,
sv_SE_QWERTY,
};
// Keys that are common between keyboard layouts
fn default_key_lookup(key: Location) error{unknownKey}!I... | src/drivers/hid/keyboard_layouts.zig |
const std = @import("std");
const builtin = @import("builtin");
const is_test = builtin.is_test;
const comparedf2 = @import("compareXf2.zig");
const TestVector = struct {
a: f64,
b: f64,
eqReference: c_int,
geReference: c_int,
gtReference: c_int,
leReference: c_int,
ltReference: c_int,
... | lib/std/special/compiler_rt/comparedf2_test.zig |
const std = @import("std");
const parseInt = std.fmt.parseInt;
const print = std.debug.print;
const tokenize = std.mem.tokenize;
const testing = std.testing;
const input = @embedFile("./input.txt");
const size = 10;
const DELTAS = .{
.{ 1, 0 },
.{ 0, 1 },
.{ -1, 0 },
.{ 0, -1 },
.{ 1, 1 },
.{ ... | src/day11/day11.zig |
const std = @import("std");
const log = std.log.scoped(.hw5);
const math = std.math;
const testing = std.testing;
const Allocator = std.mem.Allocator;
const Random = std.rand.Random;
const cuda = @import("cudaz");
const cu = cuda.cu;
const utils = @import("utils.zig");
const RawKernels = @import("hw5_kernel.zig");
pu... | CS344/src/hw5.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
data: []u8,
width: usize,
height: usize,
num_bytes: usize,
allocator: Allocator,
const Self = @This();
pub fn Rgb(comptime T: type) type {
return struct {
r: T,
g: T,
b: T,
};
}
pub const Rgb8 = Rgb(u8);
pub const RgbFl... | src/image.zig |
const macro = @import("pspmacros.zig");
comptime {
asm (macro.import_module_start("sceAudio", "0x40010000", "27"));
asm (macro.import_function("sceAudio", "0x8C1009B2", "sceAudioOutput"));
asm (macro.import_function("sceAudio", "0x136CAF51", "sceAudioOutputBlocking"));
asm (macro.import_function("sceAu... | src/psp/nids/pspaudio.zig |
const std = @import("std");
const deps = @import("deps.zig");
const Options = struct {
mode: std.builtin.Mode,
target: std.zig.CrossTarget,
fn apply(self: Options, lib: *std.build.LibExeObjStep) void {
lib.setBuildMode(self.mode);
lib.setTarget(self.target);
}
};
pub fn build(b: *std.... | build.zig |
usingnamespace @import("../windows/bits.zig");
const ws2_32 = @import("../windows/ws2_32.zig");
pub const fd_t = HANDLE;
pub const ino_t = LARGE_INTEGER;
pub const pid_t = HANDLE;
pub const mode_t = u0;
pub const PATH_MAX = 260;
pub const time_t = c_longlong;
pub const timespec = extern struct {
tv_sec: time_t... | lib/std/os/bits/windows.zig |
const std = @import("std");
const math = std.math;
const builtin = @import("builtin");
const compiler_rt = @import("../compiler_rt.zig");
pub fn __multf3(a: f128, b: f128) callconv(.C) f128 {
return mulXf3(f128, a, b);
}
pub fn __mulxf3(a: f80, b: f80) callconv(.C) f80 {
return mulXf3(f80, a, b);
}
pub fn __m... | lib/std/special/compiler_rt/mulXf3.zig |
const std = @import("std");
const ResourceTracker = struct {
const Self = @This();
var instance: ?*@This() = null;
resources: std.AutoHashMap(usize, usize),
resources_trace: std.AutoHashMap(usize, std.builtin.StackTrace),
resource_count: usize = 0,
alloc: *std.mem.Allocator,
pub fn get() ... | r.zig |
const std = @import("../index.zig");
const assert = std.debug.assert;
const ArrayList = std.ArrayList;
const Token = std.zig.Token;
const mem = std.mem;
pub const Node = struct {
id: Id,
pub const Id = enum {
// Top level
Root,
Use,
TestDecl,
// Statements
VarD... | std/zig/ast.zig |
const std = @import("std");
const json = std.json;
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
const Step = std.build.Step;
const print = std.debug.print;
const builtin = @import("builtin");
const Pkg = std.build.Pkg;
pub fn build(b: *Builder) !void {
// Options.
//const b... | build.zig |
const std = @import("std");
usingnamespace std.os.windows;
const GetLastError = kernel32.GetLastError;
pub const GDI_ERROR = 0xFFFFFFFF;
pub const DIB_RGB_COLORS = 0;
pub const SRCCOPY = 0x00CC0020;
pub const BI_RGB = 0;
pub const HGDIOBJ = ?*c_void;
pub const PAINTSTRUCT = extern struct {
hdc: ?HDC,
fErase: ... | src/windows.zig |
const std = @import("std");
const ston = @import("../ston.zig");
const debug = std.debug;
const fmt = std.fmt;
const io = std.io;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
const testing = std.testing;
/// Given a type `T`, figure out wether or not it is an `Index(G, K)`.
pub fn isIndex(compti... | src/meta.zig |
const upaya = @import("upaya.zig");
const imgui = @import("imgui");
pub fn setTintColor(color: imgui.ImVec4) void {
var colors = &imgui.igGetStyle().Colors;
colors[imgui.ImGuiCol_FrameBg] = hsvShiftColor(color, 0, 0, -0.2);
colors[imgui.ImGuiCol_Border] = hsvShiftColor(color, 0, 0, -0.2);
const header... | src/colors.zig |
const std = @import("std");
const info = std.log.info;
const warn = std.log.warn;
const bus = @import("bus.zig");
const pif = @import("pif.zig");
const mi = @import("mi.zig");
const InterruptSource = mi.InterruptSource;
const SIReg = enum(u64) {
SIDRAMAddr = 0x00,
SIPIFAddrRD64 = 0x04,
SIPIFAddrWR4... | src/core/si.zig |
const Object = @This();
const std = @import("std");
const coff = std.coff;
const mem = std.mem;
const fs = std.fs;
const assert = std.debug.assert;
const log = std.log.scoped(.coff);
const Allocator = mem.Allocator;
file: fs.File,
name: []const u8,
header: CoffHeader = undefined,
symtab: std.ArrayListUnmanaged(Sym... | src/Coff/Object.zig |
const std = @import("std");
const stdx = @import("stdx");
const build_options = @import("build_options");
const Backend = build_options.GraphicsBackend;
const gl = @import("gl");
pub const GLTextureId = gl.GLuint;
const vk = @import("vk");
const stbi = @import("stbi");
const graphics = @import("../../graphics.zig");
c... | graphics/src/backend/gpu/image.zig |
const std = @import("std");
const fs = std.fs;
const io = std.io;
const info = std.log.info;
const print = std.debug.print;
const fmt = std.fmt;
const utils = @import("utils.zig");
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const PartParams = struct {
view_distance: ?usize,
crowded: usize,
};
const ... | day_11/src/main.zig |
// ┌───────────────────────────────────────────────────────────────────────────┐
// │ │
// │ Platform Constants │
// │ ... | cli/assets/templates/zig/src/wasm4.zig |
const std = @import("std");
const testing = std.testing;
const allocator = std.heap.page_allocator;
pub const Timetable = struct {
departure: usize,
buses: std.AutoHashMap(usize, usize),
pub fn init() Timetable {
var self = Timetable{
.departure = 0,
.buses = std.AutoHashM... | 2020/p13/timetable.zig |
const std = @import("std");
const build_options = @import("build_options");
const utils = @import("utils");
const Point = utils.Point;
const multiboot = @import("multiboot.zig");
const pmemory = @import("memory.zig");
const putil = @import("util.zig");
const bios_int = @import("bios_int.zig");
const vbe_console = @i... | kernel/platform/vbe.zig |
const std = @import("std");
const sf = struct {
pub usingnamespace @import("../sfml.zig");
pub usingnamespace sf.network;
};
const TcpSocket = @This();
// Constructor/destructor
/// Creates a new udp socket
pub fn create() !TcpSocket {
var sock = sf.c.sfTcpSocket_create();
if (sock) |s| {
re... | src/sfml/network/TcpSocket.zig |
const std = @import("std");
const assert = std.debug.assert;
pub const Protein = struct {
pub const Unit = "aa";
pub const SupportsStrands = false;
pub fn complement(letter: u8) u8 {
return letter;
}
const BitMapping = [_]?u4{
0b0000, // 'A'
null, // 'B' ambiguous/invalid
... | src/bio/alphabet/protein.zig |
const std = @import("../std.zig");
const assert = std.debug.assert;
const mem = std.mem;
const Allocator = std.mem.Allocator;
const meta = std.meta;
const ast = std.zig.ast;
const Token = std.zig.Token;
const indent_delta = 4;
const asm_indent_delta = 2;
pub const Error = ast.Tree.RenderError;
const Ais = AutoIndent... | lib/std/zig/render.zig |
const std = @import("std");
const testing = std.testing;
const process = std.process;
const fs = std.fs;
const ChildProcess = std.ChildProcess;
var a: *std.mem.Allocator = undefined;
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
var arg_it = ... | test/cli.zig |
const std = @import("std");
const sqlite = @import("sqlite");
pub const AWTFDB_BLAKE3_CONTEXT = "awtfdb Sun Mar 20 16:58:11 AM +00 2022 main hash key";
const HELPTEXT =
\\ awtfdb-manage: main program for awtfdb file management
\\
\\ usage:
\\ awtfdb-manage [global options..] <action> [action options.... | src/main.zig |
const std = @import("../../index.zig");
const enum3 = @import("enum3.zig").enum3;
const enum3_data = @import("enum3.zig").enum3_data;
const lookup_table = @import("lookup.zig").lookup_table;
const HP = @import("lookup.zig").HP;
const math = std.math;
const mem = std.mem;
const assert = std.debug.assert;
pub const Floa... | std/fmt/errol/index.zig |
const std = @import("../index.zig");
const math = std.math;
const assert = std.debug.assert;
fn modf_result(comptime T: type) type {
return struct {
fpart: T,
ipart: T,
};
}
pub const modf32_result = modf_result(f32);
pub const modf64_result = modf_result(f64);
pub fn modf(x: var) modf_result... | std/math/modf.zig |
const std = @import("std");
const File = std.fs.File;
const stdout = &std.io.getStdOut().writer();
const opt = @import("opt.zig");
const warn = std.debug.warn;
const BUFSIZ: u16 = 4096;
// Reads first n lines of file and
// prints to stdout
pub fn head(n: u32, file: std.fs.File, is_stdin: bool, is_bytes: bool) !void ... | src/head.zig |
const std = @import("std");
const builtin = @import("builtin");
pub const TypeId = builtin.TypeId;
pub const printf = std.io.stdout.printf;
pub const assert = std.debug.assert;
pub const e = 2.7182818284590452354; // e
pub const log2_e = 1.4426950408889634074; // log_2(e)
pub const log10_e = 0.43429448... | src/index.zig |
pub const WAIT_OBJECT_0 = @as(u32, 0);
pub const WAIT_ABANDONED = @as(u32, 128);
pub const WAIT_ABANDONED_0 = @as(u32, 128);
pub const WAIT_IO_COMPLETION = @as(u32, 192);
pub const PRIVATE_NAMESPACE_FLAG_DESTROY = @as(u32, 1);
pub const PROC_THREAD_ATTRIBUTE_REPLACE_VALUE = @as(u32, 1);
pub const THREAD_POWER_THROTTLIN... | win32/system/threading.zig |
const std = @import("std");
const math = std.math;
const assert = std.debug.assert;
const L = std.unicode.utf8ToUtf16LeStringLiteral;
const zwin32 = @import("zwin32");
const w = zwin32.base;
const d3d12 = zwin32.d3d12;
const hrPanic = zwin32.hrPanic;
const hrPanicOnFail = zwin32.hrPanicOnFail;
const zd3d12 = @import("z... | samples/rasterization/src/rasterization.zig |
const std = @import("std");
const max_line_length = 60;
const im = 139968;
const ia = 3877;
const ic = 29573;
var seed: u32 = 42;
fn nextRandom(max: f64) f64 {
seed = (seed * ia + ic) % im;
return max * @intToFloat(f64, seed) / @intToFloat(f64, im);
}
const AminoAcid = struct {
l: u8,
p: f64,
};
fn... | bench/algorithm/fasta/1.zig |
const std = @import("std");
const builtin = @import("builtin");
const arch = builtin.cpu.arch;
const os = builtin.os.tag;
// Ported from llvm-project d32170dbd5b0d54436537b6b75beaf44324e0c28
// The compiler generates calls to __clear_cache() when creating
// trampoline functions on the stack for use with nested funct... | lib/compiler_rt/clear_cache.zig |
// Possible TODOs:
// - Parse source to ensure all dependencies are actually used
// - Allow multiple packages in one repo
// - Fetch packages at build time
const std = @import("std");
const builtin = @import("builtin");
update_step: std.build.Step,
b: *std.build.Builder,
dir: []const u8,
deps: std.StringArrayHashM... | example/Deps.zig |
const std = @import("std");
const col = @import("../term/colors.zig");
const r = col.reset();
const Cmd = @import("../cli.zig").Cmd;
pub const intro_msg = col.Color.dim(.blue, .normal_fg) ++
\\
\\ Oh wow, uh, this cli is...
++ col.res... | src/cli/help.zig |
const std = @import("std");
const util = @import("util.zig");
const data = @embedFile("../data/day07.txt");
const Input = struct {
positions: std.ArrayList(u11) = std.ArrayList(u11).init(std.testing.allocator),
pub fn init() !@This() {
var instance = Input{};
try instance.positions.ensureTotal... | src/day07.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 Commit = opaque {
pub fn deinit(self: *Commit) void {
log.debug("Commit.deinit called", .{});
c.git_commi... | src/commit.zig |
const std = @import("std");
const Compiler = @import("Compiler.zig");
const Context = @import("Context.zig");
const Lexer = @import("Lexer.zig");
const Node = @import("Node.zig");
const Parser = @import("Parser.zig");
fn printUsage() !void {
std.log.err("Usage: zedc <your_program_file.zed>", .{});
return erro... | src/zedc.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const input = @embedFile("../in02.txt");
pub fn main() !void {
var inputit = std.mem.tokenize(input, "\n");
var valids: usize = 0;
while (inputit.next()) |line| {
var l... | src/day02.zig |
const std = @import("std");
const testing = std.testing;
const allocator = std.testing.allocator;
pub const Game = struct {
const BOARD_SIZE = 10;
const Player = struct {
name: usize,
pos: usize,
score: usize,
pub fn init(name: usize, start: usize) Player {
var sel... | 2021/p21/game.zig |
//! Types may implement a custom serialization or deserialization routine with a
//! function named `serialize` or `deserialize` in the form of:
//! ```
//! pub fn deserialize(self: *Self, deserializer: anytype) !void
//! ```
//! or
//! ```
//! pub fn serialize(self: *Self, serializer: anytype) !void
//! ```
//! thes... | serialization.zig |
const std = @import("std");
const panic = std.debug.panic;
const print = std.debug.print;
const fmt = std.fmt;
const ascii = std.ascii;
const alloc = std.heap.page_allocator;
const ArrayList = std.ArrayList;
const HashMap = std.AutoHashMap;
const Error = error{InfiteLoop};
const Kind = enum {
Jmp,
Acc,
No... | src/08.zig |
const std = @import("std");
const bigint = std.math.big.int;
const fact_table_size_128 = 35;
const fact_table_size_64 = 21;
const fact_table64 =
comptime blk: {
var tbl64: [fact_table_size_64]u64 = undefined;
tbl64[0] = 1;
var n: u64 = 1;
while (n < fact_table_size_64) : (n += 1) {
tbl64[... | src/permutations.zig |
const std = @import("std");
const tht = @import("tenhourtime.zig");
const PrintMode = enum {
Raw,
Formatted,
};
const TimeToGet = union(enum) {
Current: void,
MsSinceEpoch: u64,
MsSinceDayStart: u64,
};
// stdout shouldn't be var here, that doesn't make sense vvvv
fn printTime(stdout: var, timeToG... | src/cli.zig |
const std = @import("std");
const path = std.fs.path;
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
const glslc_command = if (std.builtin.os.tag == .windows) "tools/win/glslc.exe" else "glslc";
pub fn build(b: *Builder) void {
const exe = b.addExecutable("zig-gltf", "src/main.z... | build.zig |
const std = @import("std");
const gl = @import("../deps/zgl/zgl.zig");
const datauri = @import("datauri.zig");
const util = @import("util.zig");
const zm = @import("zm.zig");
pub const File = struct {
arena: std.heap.ArenaAllocator,
scene: ?*Scene,
scenes: []Scene,
nodes: []Node,
meshes: []Mesh,
... | src/gltf.zig |
const std = @import("std");
const assert = std.debug.assert;
const c = @cImport({
@cInclude("SDL2/SDL.h");
});
const raytracer = @import("raytracer.zig");
const f32_3 = raytracer.f32_3;
const PixelFormatBGRASizeInBytes: u32 = 4;
const ImageCpuBitDepth: u32 = 32;
fn linear_to_srgb(color: f32_3) f32_3 {
// FI... | src/sdl2_backend.zig |
const std = @import("std");
const io = @import("io.zig");
const config = @import("config.zig");
const parseTask = @import("task_parser.zig").parseTask;
const Arguments = @import("args.zig");
const Todo = @import("todo.zig");
const Date = @import("date.zig");
const util = @import("util.zig");
const Allocator = std.mem.A... | src/cli.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const webgpu = @import("../../webgpu.zig");
const dummy = @import("./dummy.zig");
pub const Device = struct {
const vtable = webgpu.Device.VTable{
.destroy_fn = destroy,
.create_buffer_fn = createBuffer,
.create_texture_fn ... | src/backends/dummy/device.zig |
const neg = @import("negXi2.zig");
const testing = @import("std").testing;
fn test__negdi2(a: i64, expected: i64) !void {
var result = neg.__negdi2(a);
try testing.expectEqual(expected, result);
}
test "negdi2" {
// TODO ensuring that math.minInt(i64); returns error
try test__negdi2(-3, 3);
try t... | lib/std/special/compiler_rt/negdi2_test.zig |
const std = @import("std");
const builtin = @import("builtin");
const os = std.os;
const linux = os.linux;
const assert = std.debug.assert;
const supported_os = switch(builtin.os) {
builtin.os.linux => true,
builtin.os.macosx => true,
else => @compileError("unsupported os"),
};
const supported_archit... | src/termios.zig |
const std = @import("std");
const hzzp = @import("hzzp");
pub const FileServer = hzzp.base.Server.BaseServer(std.fs.File.Reader, std.fs.File.Writer);
const HandlerFn = fn (*FileServer) void;
const HandlerMap = std.StringHashMap(HandlerFn);
pub const Options = struct {
port: u16 = 8080,
};
pub const Server = stru... | src/server.zig |
const std = @import("std");
const assert = std.debug.assert;
const warn = std.debug.warn;
const window = @import("Window.zig");
const c = @import("c.zig").c;
const expect = std.testing.expect;
const loadFile = @import("../Files.zig").loadFile;
const builtin = @import("builtin");
const ReferenceCounter = @import("../Ref... | src/WindowGraphicsInput/Shader.zig |
const std = @import("std");
const grail = @import("grailsort.zig");
const testing = std.testing;
const print = std.debug.print;
var gpa_storage = std.heap.GeneralPurposeAllocator(.{}){};
const gpa = &gpa_storage.allocator;
const verify_sorted = false;
pub fn main() void {
doIntTests(u8);
doIntTests(i32);
... | Zig/SpexGuy/src/benchmark.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
//;
const builtins = @import("builtins.zig");
//;
// stack 0 is top
// once you parse something to values
// you can get rid of the original text string
// the vm deep copies strings
// values returned from parse
... | src/lib.zig |
const std = @import("std");
usingnamespace @import("kiragine").kira.log;
const engine = @import("kiragine");
usingnamespace @import("kiragine").kira.log;
const Ship = struct {
firerate: f32 = 0.5,
firetimer: f32 = 0,
firecount: u32 = 0,
position: engine.Vec2f = engine.Vec2f{},
speed: engine.Vec2f ... | examples/simpleshooter.zig |
const std = @import("std");
pub const Product = enum(u16) {
/// Base product
essence,
/// Company of Heroes
coho,
_,
};
pub const SGAHeader = struct {
/// Version | Title
/// ------- | -----
/// 4 | Company of Heroes 1
/// 5 | Dawn of War II - Broken
/// 6 | Unknown
/// 7 ... | lib/sga.zig |
const cpu = @import("mk20dx256.zig");
pub fn enable() void {
asm volatile ("CPSIE i"
:
:
: "memory"
);
}
pub fn disable() void {
asm volatile ("CPSID i"
:
:
: "memory"
);
}
pub fn trigger_pendsv() void {
cpu.SystemControl.ICSR = 0x10000000;
}
exter... | src/teensy3_2/interrupt.zig |
const std = @import("std");
const Fundude = @import("main.zig");
const Matrix = @import("util.zig").Matrix;
const MatrixSlice = @import("util.zig").MatrixSlice;
const EnumArray = @import("util.zig").EnumArray;
const SCREEN_WIDTH = 160;
const SCREEN_HEIGHT = 144;
const DOTS_PER_LINE = 456;
const BUFFER_LINES = 10;
con... | src/video.zig |
const std = @import("std");
const expect = std.testing.expect;
const mem = std.mem;
const Tag = std.meta.Tag;
test "@tagName" {
try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three"));
comptime try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three"));
}
fn testEnumTagNameBare(n:... | test/behavior/enum_llvm.zig |
const std = @import("../std.zig");
const mem = std.mem;
const math = std.math;
const RoundParam = struct {
a: usize,
b: usize,
c: usize,
d: usize,
e: usize,
i: u32,
};
fn roundParam(a: usize, b: usize, c: usize, d: usize, e: usize, i: u32) RoundParam {
return RoundParam{
.a = a,
... | lib/std/crypto/sha1.zig |
const std = @import("std");
const Builder = std.build.Builder;
const builtin = std.builtin;
const CrossTarget = std.zig.CrossTarget;
const debug = std.debug;
const LibExeObjStep = std.build.LibExeObjStep;
const NativePaths = std.zig.system.NativePaths;
const Target = std.Target;
const global = @import("src/global.zig"... | build.zig |
const std = @import("std");
const mem = std.mem;
const Emoji = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 35,
hi: u21 = 129750,
pub fn init(allocator: *mem.Allocator) !Emoji {
var instance = Emoji{
.allocator = allocator,
.array = try allocator.alloc(bool, 129716),
};
... | src/components/autogen/emoji-data/Emoji.zig |
const std = @import("std");
const mem = std.mem;
const unicode = std.unicode;
const ascii = @import("ascii.zig");
pub const Context = @import("Context.zig");
pub const Letter = @import("components/aggregate/Letter.zig");
pub const Mark = @import("components/aggregate/Mark.zig");
pub const Number = @import("components... | src/ziglyph.zig |
const zang = @import("zang");
const common = @import("common.zig");
const c = @import("common/c.zig");
const Module = @import("modules.zig").NiceInstrument;
pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb;
pub const AUDIO_SAMPLE_RATE = 48000;
pub const AUDIO_BUFFER_SIZE = 1024;
pub const DESCRIPTION =
\... | examples/example_polyphony2.zig |
const GBA = @import("core.zig").GBA;
pub const Background = struct {
pub const Palette = @intToPtr([*]GBA.PaletteBank, @ptrToInt(GBA.BG_PALETTE_RAM));
pub const BackgroundControl = packed struct {
priority: u2 = 0,
characterBaseBlock: u2 = 0,
dummy: u2 = 0,
mosaic: bool = false... | GBA/background.zig |
const std = @import("std");
const testing = std.testing;
const allocator = std.heap.page_allocator;
pub const Game = struct {
pub const SIZE = 1_000_000;
size: usize, // actual size used
cups: *[SIZE]usize, // value at each position
next: *[SIZE]usize, // position for next value (linked list)
val... | 2020/p23/game.zig |
const std = @import("std");
const builtin = @import("builtin");
// XXX TODO "build_options" doesn't reach here from build.zig.
// pub const enable = if (builtin.is_test) false else @import("build_options").enable_tracy;
pub const enable = false;
extern fn ___tracy_emit_frame_mark_start(name: ?[*:0]const u8) void;
ext... | common/tracy.zig |
const georgios = @import("georgios");
const utils = @import("utils");
const io = @import("io.zig");
const print = @import("print.zig");
const Allocator = @import("memory.zig").Allocator;
const List = @import("list.zig").List;
const debug = false;
const dump_segments = false;
pub const Error = georgios.elf.Error;
/... | kernel/elf.zig |
const std = @import("std");
const Crc32 = std.hash.Crc32;
const warn = std.debug.warn;
const RawDeflateReader = @import("./raw_deflate_reader.zig").RawDeflateReader;
pub fn GzipInStream(comptime InStreamType: type) type {
return struct {
const Self = @This();
const RawDeflateReaderType = RawDefla... | src/gzip.zig |
const std = @import("std");
const rom_header_begin = 0x0100;
const rom_header_end = 0x0150;
comptime {
std.debug.assert(@sizeOf(RomHeader) == rom_header_end - rom_header_begin);
}
pub const RomHeader = packed struct {
// 0x0100 .. 0x0103
entry_point: [4]u8,
// 0x0104 .. 0x0133
nintendo_logo: [48... | src/rom.zig |
const std = @import("std");
const path = std.fs.path;
const assert = std.debug.assert;
const target_util = @import("target.zig");
const Compilation = @import("Compilation.zig");
const build_options = @import("build_options");
const trace = @import("tracy.zig").trace;
pub fn buildStaticLib(comp: *Compilation) !void {
... | src/libunwind.zig |
pub usingnamespace @import("ingble.zig");
var session_complete: bool = true;
const print = platform_printf;
pub var all_services_discoverer: AllServicesDiscoverer = undefined;
const AllServicesDiscoverer = struct {
status: u8 = 0,
frame: ? (anyframe -> ?gatt_client_service_t)= null,
service: gatt_clien... | examples-gcc/central_fota/src/gatt_client_async.zig |
const std = @import("std");
const stdout = std.io.getStdOut().writer();
const stderr = std.io.getStdErr().writer();
const Writer = std.io.Writer;
const Dir = std.fs.Dir;
const MAX_PATH_BYTES = std.fs.MAX_PATH_BYTES;
const AccessError = std.os.AccessError;
const Findup = struct { program: []u8, target: ?[]u8, cwd: Dir,... | src/main.zig |
const std = @import("std");
const index = @import("../index.zig");
const events = @import("events");
const waitpid = @import("waitpid");
const WaitResult = waitpid.WaitResult;
const Status = struct {
const normal = try waitpid.interpret_status(34175);
const exit = try waitpid.interpret_status(0);
// these... | tests/src/events.zig |
const clap = @import("clap");
const format = @import("format");
const it = @import("ziter");
const std = @import("std");
const ston = @import("ston");
const util = @import("util");
const debug = std.debug;
const fmt = std.fmt;
const fs = std.fs;
const heap = std.heap;
const io = std.io;
const log = std.log;
const math... | src/randomizers/tm35-rand-stats.zig |
pub const LIBID_Accessibility = Guid.initString("1ea4dbf0-3c3b-11cf-810c-00aa00389b71");
pub const CLSID_AccPropServices = Guid.initString("b5f8350b-0548-48b1-a6ee-88bd00b4a5e7");
pub const IIS_IsOleaccProxy = Guid.initString("902697fa-80e4-4560-802a-a13f22a64709");
pub const IIS_ControlAccessible = Guid.initString("38... | deps/zigwin32/win32/ui/accessibility.zig |
const std = @import("std");
const stdx = @import("stdx");
const t = stdx.testing;
// Based on w3c specs. New keys are added at the end.
// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
pub const KeyCode = enum(u8) {
Unknown = 0,
Backspace = 8,
Tab = 9,
Enter = 13,
Shift = 1... | platform/keyboard.zig |
const std = @import("std");
const Backend = @import("build_options").GraphicsBackend;
const stdx = @import("stdx");
const ds = stdx.ds;
const gl = @import("gl");
const vk = @import("vk");
const lyon = @import("lyon");
const Vec2 = stdx.math.Vec2;
const Vec4 = stdx.math.Vec4;
const graphics = @import("../../graphics.zi... | graphics/src/backend/gpu/batcher.zig |
pub const NEUTRAL = 0x00;
pub const DEFAULT = 0x01;
pub const SYS_DEFAULT = 0x02;
pub const CUSTOM_DEFAULT = 0x03;
pub const CUSTOM_UNSPECIFIED = 0x04;
pub const UI_CUSTOM_DEFAULT = 0x05;
pub const AFRIKAANS_SOUTH_AFRICA = 0x01;
pub const ALBANIAN_ALBANIA = 0x01;
pub const ALSATIAN_FRANCE = 0x01;
pub const AMHARIC_ETHI... | lib/std/os/windows/sublang.zig |
const std = @import("std");
const testing = std.testing;
const ArrayList = std.ArrayList;
const global_allocator = std.debug.global_allocator;
fn concatT(comptime T: type) type {
return struct {
const Self = @This();
const Iterator = struct {
iter1: ArrayList(T).Iterator,
... | src/concat.zig |
const fmath = @import("index.zig");
const expo2 = @import("_expo2.zig").expo2;
pub fn cosh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(coshf, x),
f64 => @inlineCall(coshd, x),
else => @compileError("cosh not implemented for " ++ @typeName(T)),
}
}
... | src/cosh.zig |
const std = @import("std");
const assert = std.debug.assert;
const mem = std.mem;
const os = std.os;
const target = std.Target.current;
const is_linux = target.os.tag == .linux;
const config = @import("config.zig");
const log = std.log.scoped(.message_bus);
const vsr = @import("vsr.zig");
const Header = vsr.Header;
... | src/message_bus.zig |