code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
/// 128 bytes:
/// A 64-byte Account will not improve performance significantly, and drops too much functionality.
/// Reduces cognitive complexity by reducing the number of fields from 15 fields to 11 fields.
/// Enables referencing at least two third-party UUIDs, e.g. for tuple accounts: A Payable To B.
/// Enables ... | docs/types_balanced.zig |
const std = @import("std");
const fs = std.fs;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = &gpa.allocator;
const input = try fs.cwd().readFileAlloc(allocator, "data/input_06_1.txt", std.math.maxInt(usize));
{ // Solution 1
var lines = std.mem.tok... | 2020/src/day_06.zig |
const std = @import("std");
const painterz = @import("painterz");
/// This is the TVG magic number which recognizes the icon format.
/// Magic numbers might seem unnecessary, but they will be the first
/// guard in line against bad input and prevent unnecessary cycles
/// to detect those.
pub const magic_number = [2]u... | src/lib/tvg.zig |
const concepts = @import("../../lib.zig").concepts;
/// A data format that can deserialize any data type supported by Getty.
///
/// This interface is generic over the following:
///
/// - An `E` type representing the error set in the return type of
/// all of `Deserializer`'s required methods.
///
/// Data mode... | src/de/interface/deserializer.zig |
const std = @import("std");
const hzzp = @import("hzzp");
fn read_timer() u64 {
return asm volatile (
\\rdtsc
\\shlq $32, %%rdx
\\orq %%rdx, %%rax
: [ret] "={rax}" (-> u64),
:
: "rax", "rdx"
);
}
const tests = .{
"response1.http",
"response2.http",
"... | .gyro/hzzp-truemedian-github.com-91ab8e74/pkg/test/benchmark.zig |
const std = @import("std");
const zig_builtin = @import("builtin");
const build_options = @import("build_options");
const Config = @import("./Config.zig");
const DocumentStore = @import("./DocumentStore.zig");
const readRequestHeader = @import("./header.zig").readRequestHeader;
const requests = @import("./requests.zig"... | src/main.zig |
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
pub fn atan2(comptime T: type, y: T, x: T) T {
return switch (T) {
f32 => atan2_32(y, x),
f64 => atan2_64(y, x),
else => @compileError("atan2 not implemented for " ++ @typeName(T)),
};
}
fn at... | std/math/atan2.zig |
const arm_m = @import("arm_m");
const Pl011 = @import("pl011.zig").Pl011;
const TzMpc = @import("tz_mpc.zig").TzMpc;
const CmsdkTimer = @import("cmsdk_timer.zig").CmsdkTimer;
/// UART 0 (secure) - J10 port
pub const uart0 = Pl011.withBase(0x40200000);
pub const uart0_s = Pl011.withBase(0x50200000); // Secure alias
/... | examples/drivers/an505.zig |
const std = @import("std");
const zang = @import("zang");
const common = @import("common.zig");
const c = @import("common/c.zig");
pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb;
pub const AUDIO_SAMPLE_RATE = 48000;
pub const AUDIO_BUFFER_SIZE = 1024;
pub const DESCRIPTION =
\\example_two
\\
\\A... | examples/example_two.zig |
const PortIO = @import("io.zig").PortIO;
/// Programmable Interrupt Controller 8259
pub const IRQ_TIMER = 0x01;
pub const IRQ_KBD = 0x02;
pub const IRQ_CASCADE = 0x04;
pub const IRQ_COM2 = 0x08;
pub const IRQ_COM1 = 0x10;
pub const IRQ_LPT2 = 0x20;
pub const IRQ_FLOPPY = 0x40;
pub const IRQ_LPT1 = 0x80;
pub const PI... | src/pic.zig |
pub const MS_SHOWMAGNIFIEDCURSOR = @as(i32, 1);
pub const MS_CLIPAROUNDCURSOR = @as(i32, 2);
pub const MS_INVERTCOLORS = @as(i32, 4);
pub const MW_FILTERMODE_EXCLUDE = @as(u32, 0);
pub const MW_FILTERMODE_INCLUDE = @as(u32, 1);
//--------------------------------------------------------------------------------
// Secti... | win32/ui/magnification.zig |
const std = @import("std");
const debug = std.debug;
const mem = std.mem;
const log = std.log;
const testing = std.testing;
const Allocator = mem.Allocator;
const AutoHashMap = std.AutoHashMap;
const StaticBitSet = std.StaticBitSet;
const readInput = @import("parser.zig").readInput;
const grid = @import("grid.zig");
c... | day24/src/solve.zig |
const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const linux = std.os.linux;
const SYS = linux.SYS;
const socklen_t = linux.socklen_t;
const iovec = std.os.iovec;
const iovec_const = std.os.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
const stack_t =... | lib/std/os/linux/i386.zig |
const std = @import("std");
const math = std.math;
const common = @import("common.zig");
const FloatStream = @import("FloatStream.zig");
const isEightDigits = @import("common.zig").isEightDigits;
const mantissaType = common.mantissaType;
// Arbitrary-precision decimal class for fallback algorithms.
//
// This is only ... | lib/std/fmt/parse_float/decimal.zig |
const std = @import("std");
const builtin = @import("builtin");
const Compilation = @import("compilation.zig").Compilation;
const Scope = @import("scope.zig").Scope;
const ast = std.zig.ast;
const Allocator = std.mem.Allocator;
const Value = @import("value.zig").Value;
const Type = Value.Type;
const assert = std.debug.... | src-self-hosted/ir.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
// const Batch = std.event.Batch;
// const Group = std.event.Group;
// const Locked = std.event.Locked;
const regex = @import("regex");
const clap = @import("clap");
const lscolors = @import("lscolors");
const LsColors = ... | src/main.zig |
//
// This header is generated from the Khronos Vulkan XML API Registry.
//
//
const assert = @import("std").debug.assert;
pub const CString = [*:0]const u8;
pub fn FlagsMixin(comptime FlagType: type) type {
comptime assert(@sizeOf(FlagType) == 4);
return struct {
pub const IntType = Flags;
pu... | src/vk.zig |
const std = @import("std");
const print = std.debug.print;
const expect = std.testing.expect;
const eql = std.mem.eql;
const startsWith = std.mem.startsWith;
const endsWith = std.mem.endsWith;
test "string concat at comptime" {
const str1 = "one";
const str2: []const u8 = "two";
const str3 = str1 ++ " " ++... | web/src/203_strings/strings.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const expectError = std.testing.expectError;
var result: [3]u8 = undefined;
var index: usize = undefined;
fn runSomeErrorDefers(x: bool) !bool {
index = 0;
defer {
result[index] = 'a';
i... | test/behavior/defer_stage1.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const Date = @import("date.zig");
const util = @import("util.zig");
pub const Task = @import("task.zig");
pub const Tasks = std.TailQueue(Task);
const Self = @This();
alloc: *Allocator,
tasks: Tasks,
timezone: Date.Timezone,
pub const Parser = struct {... | src/todo.zig |
const std = @import("std");
const os = std.os;
const mem = std.mem;
pub const NameserverList = std.ArrayList([]const u8);
/// Read the `/etc/resolv.conf` file in the system and return a list
/// of nameserver addresses
pub fn readNameservers(allocator: *std.mem.Allocator) !NameserverList {
var file = try std.fs.c... | src/pkg2/resolvconf.zig |
const std = @import("std");
const Arena = std.heap.ArenaAllocator;
const assert = std.debug.assert;
const panic = std.debug.panic;
const initCodebase = @import("init_codebase.zig").initCodebase;
const List = @import("list.zig").List;
const ecs = @import("ecs.zig");
const Entity = ecs.Entity;
const ECS = ecs.ECS;
const... | src/parser.zig |
const Opcode = @import("instruction.zig").Opcode;
const Instruction = @import("function.zig").Instruction;
pub const LimitType = enum(u8) {
Min,
MinMax,
};
pub fn limitMatch(min_imported: u32, max_imported: ?u32, min_stated: u32, max_stated: ?u32) bool {
// TODO: this is a bit confusing, clean it up
i... | src/common.zig |
const builtin = @import("builtin");
const std = @import("std");
const mem = std.mem;
const redis = @import("./redismodule.zig");
const cuckoo = @import("./lib/zig-cuckoofilter.zig");
const t_ccf = @import("./t_cuckoofilter.zig");
// We save the initial state of Xoroshiro seeded at 42 at compile-time,
// used to initia... | src/redis-cuckoofilter.zig |
const std = @import("std");
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
const Pkg = std.build.Pkg;
const CrossTarget = std.zig.CrossTarget;
const Mode = std.builtin.Mode;
const string = []const u8;
const pkg_sokol = Pkg {
.name = "sokol",
.path = .{ .path = "src/sokol/soko... | clibs.zig |
const std = @import("std");
const win32 = @import("win32");
const WMI = win32.system.wmi;
const COM = win32.system.com;
const OLE = win32.system.ole;
const Foundation = win32.foundation;
const Allocator = std.mem.Allocator;
pub const SysInfoWMI = extern struct {
/// Property for when `initialiseIWbemServices()` is... | lib/core/wmi.zig |
const std = @import("std");
const testing = std.testing;
pub const Passport = struct {
seen: std.AutoHashMap(usize, void),
top: usize,
pub fn init() Passport {
const allocator = std.heap.page_allocator;
var self = Passport{
.seen = std.AutoHashMap(usize, void).init(allocator),
... | 2020/p05/passport.zig |
const builtin = @import("builtin");
const std = @import("std");
const fmt = std.fmt;
const mem = std.mem;
const testing = std.testing;
/// Parses RedisBlobString values
pub const BlobStringParser = struct {
pub fn isSupported(comptime T: type) bool {
return switch (@typeInfo(T)) {
.Int, .Float,... | src/parser/t_string_blob.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = false;
const assert = std.debug.assert;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 {
var input_... | 2019/day16.zig |
const std = @import("std");
pub const CreateFlags = packed struct {
antialias: bool = false,
stencil_strokes: bool = false,
debug: bool = false,
fn toCInt(self: CreateFlags) c_int {
return @bitCast(std.meta.Int(.unsigned, @bitSizeOf(CreateFlags)), self);
}
};
pub const Color = extern stru... | nanovg.zig |
const std = @import("std");
const testing = std.testing;
const math = std.math;
const utils = @import("utils.zig");
const Vec2 = @import("vec2.zig").Vec2;
const Mat4 = @import("mat4.zig").Mat4;
/// A Mat3 identity matrix
pub const mat3_identity = Mat3{
.data = .{
.{ 1, 0, 0 },
.{ 0, 1, 0 },
... | src/mat3.zig |
const std = @import("std");
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
const Step = std.build.Step;
const builtin = @import("builtin");
pub fn build(b: *Builder) void {
// Blue Pill STM32F103C8T6
const target = .{
.cpu_arch = .thumb,
.cpu_model = .{ .expl... | build.zig |
const std = @import("std");
usingnamespace @import("oidavm.zig");
const parser = @import("parser.zig");
const RunMode = enum {
Debug,
Run,
};
pub fn main() !void {
var allocator = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer allocator.deinit();
const alloc = &allocator.allocator;
... | src/main.zig |
const std = @import("std");
const msgpack = @import("msgpack.zig");
pub const Status = enum {
Okay,
Changed,
Done,
};
pub const Buffer = struct {
const Self = @This();
lines: [][]const u8,
alloc: *std.mem.Allocator,
pub fn init(alloc: *std.mem.Allocator) !Self {
const lines = tr... | src/buffer.zig |
// TODO: 3D camera
// TODO: Some kind of ecs
// TODO: Simple layering system
const std = @import("std");
const renderer = @import("kira/renderer.zig");
const gl = @import("kira/gl.zig");
const c = @import("kira/c.zig");
const m = @import("kira/math/common.zig");
usingnamespace @import("sharedtypes.zig");
usingna... | src/kiragine/renderer.zig |
const Self = @This();
const std = @import("std");
const util = @import("util.zig");
const Server = @import("Server.zig");
const Mode = @import("Mode.zig");
const AttachMode = @import("view_stack.zig").AttachMode;
const View = @import("View.zig");
pub const FocusFollowsCursorMode = enum {
disabled,
/// Only... | source/river-0.1.0/river/Config.zig |
const std = @import("std");
const print = std.debug.print;
const List = std.ArrayList;
const util = @import("util.zig");
const gpa = util.gpa;
const data = @embedFile("../data/day14.txt");
const Rule = struct {
pair: []const u8,
insert: u8,
};
const Pair = struct {
a: u8,
b: u8,
pub fn new(a: u... | 2021/src/day14.zig |
const std = @import("std");
const id3v2 = @import("id3v2.zig");
const id3v2_data = @import("id3v2_data.zig");
const id3v1 = @import("id3v1.zig");
const flac = @import("flac.zig");
const vorbis = @import("vorbis.zig");
const ape = @import("ape.zig");
const mp4 = @import("mp4.zig");
const Allocator = std.mem.Allocator;
c... | src/metadata.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");
/// An instance for a custom memory allocator
///
/// Setting the pointers of this structure allows the developer to implement custom me... | src/alloc.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 Indexer = opaque {
/// Add data to the indexer
///
/// ## Parameters
/// * `data` - The data to add
/// *... | src/indexer.zig |
const std = @import("std");
const pike = @import("pike.zig");
const mem = std.mem;
const meta = std.meta;
const math = std.math;
const testing = std.testing;
const assert = std.debug.assert;
pub const Waker = struct {
const EMPTY = 0;
const NOTIFIED: usize = 1;
const SHUTDOWN: usize = 2;
state: usiz... | waker.zig |
pub const MILBITMAPEFFECT_SDK_VERSION = @as(u32, 16777216);
pub const CLSID_MILBitmapEffectGroup = Guid.initString("ac9c1a9a-7e18-4f64-ac7e-47cf7f051e95");
pub const CLSID_MILBitmapEffectBlur = Guid.initString("a924df87-225d-4373-8f5b-b90ec85ae3de");
pub const CLSID_MILBitmapEffectDropShadow = Guid.initString("459a3fbe... | win32/ui/wpf.zig |
const std = @import("std");
const upaya = @import("upaya");
usingnamespace @import("imgui");
const persistence = @import("persistence.zig");
const ts = @import("tilescript.zig");
const TileScript = ts.TileScript;
const Texture = upaya.Texture;
const Map = ts.Map;
pub const AppState = struct {
map: Map,
// ge... | tilescript/app_state.zig |
usingnamespace @import("../windows/bits.zig");
const ws2_32 = @import("../windows/ws2_32.zig");
// TODO: Stop using os.iovec in std.fs et al on Windows in the future
const posix = @import("posix.zig");
pub const iovec = posix.iovec;
pub const iovec_const = posix.iovec_const;
pub const fd_t = HANDLE;
pub const ino_t ... | lib/std/os/bits/windows.zig |
// // const sokol = @import("sokol");
// const sokol = @import("sokol/sokol.zig");
// const app = sokol.app;
// const sg = sokol.gfx;
// const sgapp = sokol.app_gfx_glue;
// const time = sokol.time;
// const gfx = @import("gfx.zig");
// // usingnamespace @import("math.zig");
// const SpriteBatcher = @import("s... | src/main.zig |
const std = @import("std");
const assert = std.debug.assert;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = &gpa.allocator;
const Form = struct {
answers: [26]bool = [1]bool{false} ** 26,
pub fn parse(self: *@This(), questions: []const u8) void {
for (questions) |question| {
... | src/day06.zig |
const fmath = @import("index.zig");
const expo2 = @import("_expo2.zig").expo2;
pub fn tanh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(tanhf, x),
f64 => @inlineCall(tanhd, x),
else => @compileError("tanh not implemented for " ++ @typeName(T)),
}
}
... | src/tanh.zig |
const wasm4 = @import("wasm4.zig");
const wasm4_omissions = struct { // documented but not provided in wasm4.zig
/// Draws text using the built-in system font, given external string length.
pub extern fn textUtf8(strUtf8: [*]const u8, byteLength: u32, x: i32, y: i32) void;
comptime {
std.debug.asse... | src/wrapper4.zig |
const interrupt = @import("interrupt.zig");
const isr = @import("isr.zig");
const layout = @import("layout.zig");
const pmem = @import("pmem.zig");
const scheduler = @import("scheduler.zig");
const tty = @import("tty.zig");
const x86 = @import("x86.zig");
const assert = @import("std").debug.assert;
// A single entry i... | kernel/vmem.zig |
const std = @import("std");
pub const ASTNode = union(enum) {
alias: *Alias,
and_: *And,
annotation: *Annotation,
annotation_def: *AnnotationDef,
arg: *Arg,
array_literal: *ArrayLiteral,
asm_: *Asm,
asm_operand: *AsmOperand,
assign: *Assign,
block: *Block,
bool_literal: *Boo... | ast.zig |
const std = @import("std");
const c = @cImport({
@cInclude("ini.h");
});
test "parser create/destroy" {
var buffer: c.ini_Parser = undefined;
c.ini_create_buffer(&buffer, "", 0);
c.ini_destroy(&buffer);
}
fn expectNull(record: c.ini_Record) void {
std.testing.expectEqual(c.ini_RecordType.INI_RECO... | src/lib-test.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const vk = @import("../include/vk.zig");
const zva = @import("zva");
const Context = @import("context.zig").Context;
pub const Buffer = struct {
initFn: fn (self: *Buffer, allocator: *Allocator, vallocator: *zva.Allocator, context: *const Context) ... | render/src/backend/buffer.zig |
const expect = @import("std").testing.expect;
pub const EmptyStruct = struct {};
test "optional pointer to size zero struct" {
var e = EmptyStruct{};
var o: ?*EmptyStruct = &e;
expect(o != null);
}
test "equality compare nullable pointers" {
testNullPtrsEql();
comptime testNullPtrsEql();
}
fn te... | test/stage1/behavior/optional.zig |
const std = @import("std");
const mem = std.mem;
const c = @import("c.zig");
const Compilation = @import("compilation.zig").Compilation;
const Target = std.Target;
const ObjectFormat = Target.ObjectFormat;
const LibCInstallation = @import("libc_installation.zig").LibCInstallation;
const assert = std.debug.assert;
const... | src-self-hosted/link.zig |
const std = @import("std");
const Value = @import("value.zig").Value;
const Type = @import("type.zig").Type;
const Module = @import("Module.zig");
const assert = std.debug.assert;
const codegen = @import("codegen.zig");
/// These are in-memory, analyzed instructions. See `zir.Inst` for the representation
/// of instru... | src-self-hosted/ir.zig |
const std = @import("std");
const Builder = std.build.Builder;
const system_sdk = @import("system_sdk.zig");
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
const main_tests = b.addTest("src/main.zig");
main_tests.setBuildMode(mod... | build.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 Mailmap = opaque {
/// Allocate a new mailmap object.
///
/// This object is empty, so you'll have to add a mailma... | src/mailmap.zig |
const memory = @import("memory.zig");
pub fn List(comptime Type: type) type {
return struct {
const Self = @This();
pub const Node = struct {
next: ?*Node,
prev: ?*Node,
value: Type,
};
alloc: *memory.Allocator,
head: ?*Node = null,
... | kernel/list.zig |
const mem = @import("../mem.zig");
const math = @import("../math/index.zig");
const endian = @import("../endian.zig");
const builtin = @import("builtin");
const debug = @import("../debug/index.zig");
const fmt = @import("../fmt/index.zig");
const RoundParam = struct {
a: usize,
b: usize,
c: usize,
d: u... | std/crypto/md5.zig |
const std = @import("std");
const mem = std.mem;
const json = std.json;
const Lexer = @import("lexer.zig").Lexer;
const TokenIds = [_][]const u8{
"Invalid",
"Whitespace",
"Text",
"AtxHeader",
"EOF",
};
pub const TokenId = enum {
Invalid,
Whitespace,
Text,
AtxHeader,
EOF,
... | src/md/token.zig |
const sg = @import("sokol").gfx;
//
// #version:1# (machine generated, don't edit!)
//
// Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
//
// Cmdline: sokol-shdc -i main.glsl -o main.zig -l glsl330:glsl100:hlsl4:metal_macos -f sokol_zig
//
// Overview:
//
// Shader program 'main':
// ... | src/shaders/main.zig |
const std = @import("std");
const imr = @import("imr.zig");
const Allocator = std.mem.Allocator;
const eqlIgnoreCase = std.ascii.eqlIgnoreCase;
const Url = @import("../url.zig").Url;
const LineType = enum {
text,
link,
heading
};
const ParserState = union(enum) {
Text,
Link,
Preformatting,
... | zervo/markups/gemini.zig |
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
const x86 = @import("machine.zig");
const Instruction = x86.Instruction;
const AsmError = x86.AsmError;
const Machine = x86.Machine;
const Operand = x86.Operand;
const Mnemonic = x86.Mnemonic;
const EncodingControl = x86.Encod... | src/x86/util.zig |
const std = @import("std");
pub fn pkg(b: *std.build.Builder, pkg_name: []const u8, dir: []const u8) std.build.Pkg {
const step = ClassGenStep.init(b, pkg_name, dir);
// Create main pkg
var main_pkg = std.build.Pkg{
.name = pkg_name,
.path = .{ .generated = &step.out_file },
};
//... | classgen.zig |
const std = @import("std");
const wren = @import("wren");
pub var alloc = std.testing.allocator;
// This will be a foreign class in Wren
pub const Point = struct {
size:f64 = 0,
pub fn setSize (vm:?*wren.VM) void {
// Get the Wren class handle which holds our Zig instance memory
if(wren.getSlo... | example/foreign_class.zig |
const macro = @import("pspmacros.zig");
comptime {
asm (macro.import_module_start("ThreadManForUser", "0x40010000", "126"));
asm (macro.import_function("ThreadManForUser", "0x6E9EA350", "_sceKernelReturnFromCallback"));
asm (macro.import_function("ThreadManForUser", "0x0C106E53", "sceKernelRegisterThreadEv... | src/psp/nids/pspthreadman.zig |
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const Element = @import("AllKeysFile.zig").Element;
const Elements = @import("AllKeysFile.zig").Elements;
const Key = @import("AllKeysFile.zig").Key;
const NodeMap = std.AutoHashMap(u21, Node);
const Node = struct {
value: ?Elements,
... | src/collator/CollatorTrie.zig |
pub const struct_xcb_connection_t = opaque {};
pub const xcb_connection_t = struct_xcb_connection_t;
pub const xcb_generic_iterator_t = extern struct {
data: ?*anyopaque,
rem: c_int,
index: c_int,
};
pub const xcb_generic_reply_t = extern struct {
response_type: u8,
pad0: u8,
sequence: u16,
... | modules/platform/src/linux/X11/xcb/xcb.zig |
const std = @import("std");
const tvg = @import("tinyvg.zig");
/// Renders a binary TinyVG graphic to SVG.
/// - `allocator` will be used for temporary allocations in both the TVG parser and the SVG renderer.
/// - `tvg_buffer` provides a binary TinyVG file
/// - `writer` will receive the UTF-8 encoded SVG text.
pub f... | src/lib/svg.zig |
const Allocator = std.mem.Allocator;
const Headers = @import("./headers/headers.zig").Headers;
const Method = @import("methods.zig").Method;
const std = @import("std");
const Uri = @import("./uri/uri.zig").Uri;
const UriError = @import("./uri/uri.zig").Error;
const Version = @import("versions.zig").Version;
const Allo... | src/request.zig |
const std = @import("std");
const stdx = @import("stdx");
const uv = @import("uv");
const graphics = @import("graphics");
const t = stdx.testing;
const runtime = @import("runtime.zig");
const RuntimeContext = runtime.RuntimeContext;
const CsWindow = runtime.CsWindow;
const log = stdx.log.scoped(.devmode);
const DevMo... | runtime/devmode.zig |
const std = @import("std");
const builtin = @import("builtin");
const liu = @import("./lib.zig");
const NULL = std.math.maxInt(u32);
pub const EntityId = struct {
index: u32,
generation: u32,
pub const NULL: EntityId = .{ .index = std.math.maxInt(u32), .generation = 0 };
};
fn FreeEnt(comptime T: type) ... | src/liu/ecs.zig |
const std = @import("std");
usingnamespace @import("ast.zig");
usingnamespace @import("interpreter.zig");
usingnamespace @import("gc.zig");
usingnamespace @import("sourcelocation.zig");
// Intrinsic symbol- and function expressions. These expressions are not registered with
// the GC and are thus considered pinned and... | src/intrinsics.zig |
const std = @import("std");
const Asm = @This();
const space_width = 8;
const space = " ";
output_file: std.fs.File,
output_writer: std.fs.File.Writer,
stack_depth: usize = 0,
pub fn init(file: []const u8) !Asm {
const output_file = try std.fs.cwd().createFile(file, .{});
return Asm{ .output_file = output_fil... | src/asm.zig |
const c = @import("c.zig");
const nk = @import("../nuklear.zig");
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
pub const Type = c.nk_tree_type;
pub fn push(
ctx: *nk.Context,
comptime Id: type,
t: Type,
title: []const u8,
initial_state: nk.CollapseStates,
) bool {... | src/tree.zig |
const std = @import("std");
const fun = @import("fun");
// TODO: When https://github.com/zig-lang/zig/issues/855 is fixed. Make this into a package import instead of this HACK
const nds = @import("../../src/nds/index.zig");
const generic = fun.generic;
const heap = std.heap;
const os = std.os;
const io = std.io;
const... | tools/nds-util/main.zig |
const xcb = @import("../xcb.zig");
/// @brief CHAR2B
pub const CHAR2B = struct {
@"byte1": u8,
@"byte2": u8,
};
pub const WINDOW = u32;
pub const PIXMAP = u32;
pub const CURSOR = u32;
pub const FONT = u32;
pub const GCONTEXT = u32;
pub const COLORMAP = u32;
pub const ATOM = u32;
pub const DRAWABLE = u... | src/auto/xproto.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/day12.zig |
const std = @import("std");
usingnamespace (@import("../machine.zig"));
usingnamespace (@import("../util.zig"));
const reg = Operand.register;
const regRm = Operand.registerRm;
const imm = Operand.immediate;
test "rotate and shift" {
const m32 = Machine.init(.x86_32);
const m64 = Machine.init(.x64);
deb... | src/x86/tests/rotate.zig |
const std = @import("std");
const testing = std.testing;
const stderr = std.io.getStdErr().writer();
const hts = @cImport({
@cInclude("htslib_struct_access.h");
@cInclude("htslib/hts.h");
@cInclude("htslib/vcf.h");
@cInclude("htslib/tbx.h");
});
pub const Field = enum {
info,
format,
};
/// ... | zig-hts-zig/src/vcf.zig |
const c = @import("c.zig").c;
// -*- Solarized Light/Dark -*-
// http://www.zovirl.com/2011/07/22/solarized_cheat_sheet/
pub const base03 = c.ImVec4{ .x = 0.00, .y = 0.17, .z = 0.21, .w = 1.00 };
pub const base02 = c.ImVec4{ .x = 0.03, .y = 0.21, .z = 0.26, .w = 1.00 };
pub const base01 = c.ImVec4{ .x = 0.35, .y = 0.4... | src/theme.zig |
const std = @import("std");
pub const Error = error{ FailedtoAllocate, IsNotUnique, InvalidID, DataOverflow };
pub fn UniqueList(comptime generic_type: type) type {
return struct {
pub const T = generic_type;
const Self = @This();
pub const Item = struct {
data: ?T = null,
... | src/core/utils.zig |
const std = @import("std");
const math = std.math;
const assert = std.debug.assert;
const glfw = @import("glfw");
const gpu = @import("gpu");
const c = @cImport({
@cInclude("dawn/dawn_proc.h");
@cInclude("dawn_native_mach.h");
});
const objc = @cImport({
@cInclude("objc/message.h");
});
pub const cimgui = @... | libs/zgpu/src/zgpu.zig |
const std = @import("std");
const wots = @import("main.zig");
const expect = std.testing.expect;
const print = std.debug.print;
const ChaCha20Poly1305 = std.crypto.aead.chacha_poly.ChaCha20Poly1305;
const Sha = std.crypto.hash.sha2.Sha256;
const Timer = std.time.Timer;
test "PrivateKey" {
const n = Sha.digest_le... | src/test.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 d2d1 = zwin32.d2d1;
const d3d12 = zwin32.d3d12;
const dwrite = zwin32.dwrite;
const hrPanicOnFail = zwin32.hrPanicOnFail;
... | samples/intro/src/intro0.zig |
const c = @import("../c.zig");
const math = @import("../math/math.zig");
const std = @import("std");
const Logger = @import("../logger.zig").Logger;
const Scene = @import("view/scene.zig").Scene;
const SdlError = error {
SDLInitializationFailed,
};
pub const Renderer = struct {
allocator: *std.mem.Allocator,
... | src/gfx/renderer.zig |
pub usingnamespace @import("std").zig.c_builtins;
pub const __builtin_va_list = [*c]u8;
pub const va_list = __builtin_va_list;
pub const __gnuc_va_list = __builtin_va_list;
pub const ptrdiff_t = c_longlong;
pub const wchar_t = c_ushort;
pub const max_align_t = extern struct {
__clang_max_align_nonce1: c_longlong al... | src/pdcurses.zig |
const std = @import("std");
const testing = std.testing;
const Allocator = std.mem.Allocator;
const CharStream = struct {
string: []const u8,
i: usize = 0,
pub fn init(string: []const u8) CharStream {
return .{ .string = string };
}
pub fn next(self: *CharStream) ?u8 {
if (self.i... | src/main.zig |
const std = @import("std");
pub const Interpreter = @import("spu-mk2/interpreter.zig").Interpreter;
pub const ExecutionCondition = enum(u3) {
always = 0,
when_zero = 1,
not_zero = 2,
greater_zero = 3,
less_than_zero = 4,
greater_or_equal_zero = 5,
less_or_equal_zero = 6,
overflow = 7,
... | src/codegen/spu-mk2.zig |
const std = @import("std");
usingnamespace (@import("../machine.zig"));
usingnamespace (@import("../util.zig"));
test "AVX" {
const m32 = Machine.init(.x86_32);
const m64 = Machine.init(.x64);
const reg = Operand.register;
const pred = Operand.registerPredicate;
const predRm = Operand.rmPredicate;... | src/x86/tests/avx.zig |
usingnamespace @import("root").preamble;
/// We are exporting Node from non-atomic queue module, since we want the same Node type to be used
/// both for atomic and non-atomic queues
pub const Node = lib.containers.queue.Node;
/// Multi producer single consumer unbounded atomic queue.
/// NOTE: Consumer is responsibl... | lib/containers/atomic_queue.zig |
const std = @import("std");
const io = std.io;
const mem = std.mem;
const fs = std.fs;
const process = std.process;
const Allocator = mem.Allocator;
const ArrayList = std.ArrayList;
const ArrayListSentineled = std.ArrayListSentineled;
const Target = std.Target;
const CrossTarget = std.zig.CrossTarget;
const self_hoste... | src-self-hosted/stage2.zig |
const std = @import("std");
const mem = std.mem;
const expect = std.testing.expect;
const builtin = @import("builtin");
test "implicit cast vector to array - bool" {
const S = struct {
fn doTheTest() void {
const a: @Vector(4, bool) = [_]bool{ true, false, true, false };
const resul... | test/stage1/behavior/vector.zig |
const std = @import("std");
const types = @import("types.zig");
const ast = std.zig.ast;
pub const Encoding = enum {
utf8,
utf16,
};
pub const DocumentPosition = struct {
line: []const u8,
line_index: usize,
absolute_index: usize,
};
pub fn documentPosition(doc: types.TextDocument, position: type... | src/offsets.zig |
const builtin = @import("builtin");
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
/// Returns x raised to the power of y (x^y).
///
/// Special Cases:
/// - pow(x, +-0) = 1 for any x
/// - pow(1, y) = 1 for any y
/// - pow(x, 1) = x for any x
/// - pow(n... | lib/std/math/pow.zig |
const std = @import("std");
const mach = @import("mach");
const gpu = @import("gpu");
const glfw = @import("glfw");
const zm = @import("zmath");
const Vec = zm.Vec;
const Mat = zm.Mat;
const Quat = zm.Quat;
const App = @This();
queue: gpu.Queue,
cube: Cube,
camera: Camera,
light: Light,
depth: ?Texture,
keys: u8 = ... | examples/advanced-gen-texture-light/main.zig |
const aoc = @import("../aoc.zig");
const std = @import("std");
pub fn run(problem: *aoc.Problem) !aoc.Solution {
var easy_digs: usize = 0;
var sum: usize = 0;
while (problem.line()) |line| {
var unprocessed_digits = [_]u7 {0} ** 6;
var definite_digits = [_]u7 {0} ** 10;
var tokens ... | src/main/zig/2021/day08.zig |
const os = @cImport({
@cInclude("FreeRTOS.h");
@cInclude("task.h");
});
const tzmcfi = @cImport(@cInclude("TZmCFI/Gateway.h"));
const port = @import("../ports/" ++ @import("build_options").BOARD ++ "/common.zig");
export const SystemCoreClock: u32 = port.system_core_clock;
// `SecureContext_LoadContext`
com... | examples/nonsecure-common/oshooks.zig |
const std = @import("std");
const c = @import("c.zig");
// The Debounce struct is triggered with update(dt). After dt milliseconds,
// a call to check() returns true. Intermediate calls to update() will restart
// the timer and change the value which will eventually be returned by check().
pub const Debounce = stru... | src/debounce.zig |
const std = @import("std");
const mem = std.mem;
allocator: *mem.Allocator,
map: std.AutoHashMap(u21, u8),
const CccMap = @This();
pub fn init(allocator: *mem.Allocator) !CccMap {
var instance = CccMap{
.allocator = allocator,
.map = std.AutoHashMap(u21, u8).init(allocator),
};
var index... | src/components/autogen/DerivedCombiningClass/CccMap.zig |