code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const zp = @import("zplay");
const dig = zp.deps.dig;
const fontawesome = dig.fontawesome;
var big_font: *dig.Font = undefined;
var small_font: *dig.Font = undefined;
fn init(ctx: *zp.Context) anyerror!void {
std.log.info("game init", .{});
// init imgui
try dig.init(ctx.windo... | examples/imgui_ttf.zig |
const c = @import("c");
const intToError = @import("error.zig").intToError;
const errorToInt = @import("error.zig").errorToInt;
const Error = @import("error.zig").Error;
const Matrix = @import("types.zig").Matrix;
const BBox = @import("types.zig").BBox;
const Vector = @import("image.zig").Vector;
const Outline = @This... | freetype/src/freetype/Outline.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const expectEqualStrings = std.testing.expectEqualStrings;
const panic = std.debug.panic;
const yeti = @import("yeti");
const List = yeti.List;
test "list push" {
var gpa = std.heap.GeneralPurposeAllocator(... | src/tests/test_list.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const nvg = @import("nanovg");
const gui = @import("../gui.zig");
const Rect = @import("../geometry.zig").Rect;
const Scrollbar = @This();
widget: gui.Widget,
allocator: Allocator,
orientation: gui.Orientation,
mouse_offset: f32 = 0,
value: f32 = 0,
... | src/gui/widgets/Scrollbar.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const builtin = @import("builtin");
test "cmpxchg" {
try testCmpxchg();
comptime try testCmpxchg();
}
fn testCmpxchg() !void {
var x: i32 = 1234;
if (@cmpxchgWeak(i32, &x, 99, 5678, .SeqCst, .Se... | test/behavior/atomics.zig |
const std = @import("std");
usingnamespace @import("common.zig");
const parser = @import("../main.zig").parser.client;
const hzzp = @import("hzzp");
const base64 = std.base64;
const ascii = std.ascii;
const math = std.math;
const rand = std.rand;
const time = std.time;
const mem = std.mem;
const Sha1 = std.crypto.... | src/base/client.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
const Paper = struct {
const Fold = struct {
axis: u1,
pos: u11,
};
points: std.AutoHashMap([2]u11, bool),
folds: []*Fold,
next: usize,
bb: [2]u11,
alloc: std.mem.Allocator,
pub fn init(alloc: std.mem.Allo... | 2021/13/aoc.zig |
const std = @import("std");
const palettes = @import("palettes.zig");
const assert = std.debug.assert;
/// Format `fmt` with ANSI color codes.
/// 16-color format:
/// - `<fg.black>`
/// - `<bg.blue>`
/// 256-color format:
/// - `<fg.88>`
/// - `<bg.255>`
/// Modes:
/// - `<b>`: Bold
/// - `<d>`: Dim
/// - `<r>`: Rese... | src/main.zig |
const std = @import("std");
const x509 = @import("iguanaTLS").x509;
const tls = @import("iguanaTLS");
const TypeOfRequest = enum { GET, POST, PUT, DELETE };
pub fn makeGetRequestAlloc(allocator: std.mem.Allocator, host: []const u8, path: []const u8) ![]const u8 {
return makeRequestAlloc(allocator, host, path, "",... | src/request.zig |
const platform = @import("platform");
const proto = @import("proto");
const gdb = @import("gdb");
const std = @import("std");
pub const RW = enum { r, w };
pub var device_reader: std.fs.File.Reader = undefined;
pub var device_writer: std.fs.File.Writer = undefined;
/// When single stepping, you may need to hook some... | src/client/client.zig |
const std = @import("std");
const awshttp = @import("awshttp.zig");
const json = @import("json.zig");
const url = @import("url.zig");
const case = @import("case.zig");
const servicemodel = @import("servicemodel.zig");
const log = std.log.scoped(.aws);
pub const Options = struct {
region: []const u8 = "aws-global... | src/aws.zig |
const std = @import("std");
const SDL = @import("sdl2");
const bus = @import("bus.zig");
const cpu = @import("cpu.zig");
const rsp = @import("rsp.zig");
const ai = @import("ai.zig");
const vi = @import("vi.zig");
const Controller = packed struct {
dr : bool = false,
dl : bool = false,
dd : bool ... | src/core/n64.zig |
const combn = @import("../combn/combn.zig");
const Result = combn.gllparser.Result;
const Parser = combn.gllparser.Parser;
const Error = combn.gllparser.Error;
const Context = combn.gllparser.Context;
const PosKey = combn.gllparser.PosKey;
const ParserPath = combn.gllparser.ParserPath;
const Sequence = combn.gllparser.... | src/dsl/compiler.zig |
const std = @import("std");
const xml = @import("lib.zig");
const attributes_field_name = "__attributes__";
const item_field_name = "__item__";
pub fn StructTraverser(comptime Self: type) type {
return struct {
pub fn traverseStruct(self: *Self, input: anytype, parent: xml.Node) !void {
inline... | src/traverser.zig |
pub const FileType = enum(i32) {
invalid = 0,
gltf = 1,
glb = 2,
_,
};
pub const Result = enum(i32) {
success = 0,
data_too_short = 1,
unknown_format = 2,
invalid_json = 3,
invalid_gltf = 4,
invalid_options = 5,
file_not_found = 6,
io_error = 7,
out_of_memory = 8,
... | cgltf.zig |
const std = @import("std");
const input = @embedFile("data/input02");
usingnamespace @import("util.zig");
pub fn main() !void {
var valid_count1: usize = 0;
var valid_count2: usize = 0;
var reader = LineIterator.init(input);
while (reader.next()) |line| {
const e = Entry.parse(line) orelse retu... | src/day02.zig |
pub const libpq = @cImport({
@cInclude("libpq-fe.h");
});
pub const Raw = struct {
pub const ConnStatusType = enum(libpq.ConnStatusType) {
CONNECTION_OK = libpq.CONNECTION_OK,
CONNECTION_BAD = libpq.CONNECTION_BAD,
CONNECTION_STARTED = libpq.CONNECTION_STARTED,
CONNECTION_MADE =... | src/connect.zig |
const std = @import("std");
const process = std.process;
const os = std.os;
const fs = std.fs;
const Allocator = std.mem.Allocator;
const builtin = @import("builtin");
const posix = @import("./os/posix.zig");
const windows = @import("./os/windows.zig");
pub const BohioError = error{
CouldNotGetCurrentWorkingDirect... | src/lib.zig |
const inputFile = @embedFile("./input/day11.txt");
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const Str = []const u8;
const BitSet = std.DynamicBitSet;
const assert = std.debug.assert;
const tokenize = std.mem.tokenize;
const print = std.debug.print;
fn sort(compt... | src/day11.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/day11.zig |
const std = @import("std");
const fs = std.fs;
const Allocator = std.mem.Allocator;
const PATH = "src";
const LINE_LENGTH = 100;
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
const format = try chec... | src/tools/lint.zig |
const std = @import("std");
const print = std.debug.print;
const data = @embedFile("../data/day03.txt");
fn day01() !usize {
var iterator = std.mem.tokenize(data, "\r\n");
var accumulation = [12]i16{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
var token_size : ?usize = null;
while (iterator.next()) |token| {
i... | src/day03.zig |
const std = @import("std");
const print = std.debug.print;
const data = @embedFile("../data/day11.txt");
fn dump(grid : [100]u8) void {
for (grid) |g, i| {
if (g > 9) {
print(" ", .{});
} else {
print("{}", .{g});
}
if ((i % 10) == 9) {
print("\n", .{});
}
}
print("\n", .... | src/day11.zig |
usingnamespace @import("root").preamble;
/// Represents the physical location of a key on the keyboard, not affected by keyboard layouts
pub const Location = enum {
escape,
f1,
f2,
f3,
f4,
f5,
f6,
f7,
f8,
f9,
f10,
f11,
f12,
f13,
f14,
f15,
f16,
f17... | lib/input/keyboard/keys.zig |
const cfg = @import("cfg.zig");
const std = @import("std");
/// minifier that removes whitespace and replaces any words starting with _
/// with smaller allocated identifiers
const Minify = struct {
const Language = enum {
js,
wgsl,
};
const CharType = enum {
whitespace, // any whi... | src/minify.zig |
const assert = @import("../debug.zig").assert;
const builtin = @import("builtin");
const arch = switch (builtin.arch) {
builtin.Arch.x86_64 => @import("x86_64.zig"),
else => @compileError("unsupported arch"),
};
pub use @import("syscall.zig");
pub use @import("errno.zig");
const std = @import("../../index.zig"... | std/os/freebsd/index.zig |
const MachO = @This();
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const fs = std.fs;
const log = std.log.scoped(.link);
const macho = std.macho;
const codegen = @import("../codegen.zig");
const math = std.math;
const mem = std.mem;
const trace = @import("../tracy.... | src-self-hosted/link/MachO.zig |
const std = @import("std");
const c = @cImport({
@cInclude("epoxy/gl.h");
});
comptime {
std.testing.refAllDecls(@This());
}
pub const VertexArray = enum(c.GLuint) {
invalid = 0,
_,
pub const create = createVertexArray;
pub const delete = deleteVertexArray;
pub const gen = genVertexArray... | zgl.zig |
const std = @import("std");
const assertOrPanic = std.debug.assertOrPanic;
extern fn run_c_tests() void;
export fn zig_panic() noreturn {
@panic("zig_panic called from C");
}
test "C importing Zig ABI Tests" {
run_c_tests();
}
extern fn c_u8(u8) void;
extern fn c_u16(u16) void;
extern fn c_u32(u32) void;
ex... | test/stage1/c_abi/main.zig |
const print = @import("std").debug.print;
const TripError = error{ Unreachable, EatenByAGrue };
const Place = struct {
name: []const u8,
paths: []const Path = undefined,
};
var a = Place{ .name = "Archer's Point" };
var b = Place{ .name = "Bridge" };
var c = Place{ .name = "Cottage" };
var d = Place{ .name =... | exercises/075_quiz8.zig |
const assert = @import("std").debug.assert;
const mem = @import("std").mem;
test "int to ptr cast" {
const x = usize(13);
const y = @intToPtr(&u8, x);
const z = @ptrToInt(y);
assert(z == 13);
}
test "integer literal to pointer cast" {
const vga_mem = @intToPtr(&u16, 0xB8000);
assert(@ptrToInt(... | test/cases/cast.zig |
const clap = @import("../clap.zig");
const std = @import("std");
const testing = std.testing;
const heap = std.heap;
const mem = std.mem;
const debug = std.debug;
pub fn ComptimeClap(comptime Id: type, comptime params: []const clap.Param(Id)) type {
var flags: usize = 0;
var options: usize = 0;
var conver... | clap/comptime.zig |
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("game", "src/main.zig");
const git_sub_cmd = [_][]const u8{ "git", "submodule", "update", "--init", "--recurs... | build.zig |
const std = @import("std");
const process = std.process;
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const mem = std.mem;
fn interpret(stdin: anytype, stdout: anytype, code: []const u8) !void {
var tape = [_]u8{0} ** 30_000;
var pdata: u32 = 0;
var pinst: u32 = 0;
while (pinst ... | bf.zig |
const std = @import("std");
const mem = std.mem;
const stdin = std.io.getStdIn();
const stdout = std.io.getStdOut().writer();
const exit = std.process.exit;
const Error = error{
CommandFailed,
UnknownCommand,
EmptyCommand,
};
// split arguments by white space
fn getArgs(allocator: mem.Allocator, cmd: []co... | code/shell.zig |
const base = @import("base.zig");
const letter = @import("letter.zig");
const tables = @import("tables.zig");
const unicode = @import("index.zig");
const t = @import("../testing/index.zig");
const warn = @import("std").debug.warn;
const notletterTest = []u32{
0x20,
0x35,
0x375,
0x619,
0x700,
0x... | src/unicode/index_test.zig |
const std = @import("std");
const debug = std.debug;
const fmt = std.fmt;
const math = std.math;
const mem = std.mem;
const unicode = std.unicode;
const testing = std.testing;
pub const ascii = @import("src/ascii.zig");
pub const utf8 = @import("src/utf8.zig");
/// The result of a successful parse
pub fn Result(comp... | src/mecha/mecha.zig |
usingnamespace @import("root").preamble;
const libalign = lib.libalign;
const allocator = os.memory.vmm.backed(.Ephemeral);
const pmm = os.memory.pmm;
const paging = os.memory.paging;
const pci = os.platform.pci;
const assert = std.debug.assert;
/// Descriptor iterator helper.
pub const DescIter = struct {
drv: *... | subprojects/flork/src/drivers/misc/virtio_pci.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectError = std.testing.expectError;
const expectEqual = std.testing.expectEqual;
test "switch with numbers" {
try testSwitchWithNumbers(13);
}
fn testSwitchWithNumbers(x: u32) !void {
const result = switch (x) {
1, 2, 3, 4...8 => ... | test/behavior/switch.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 Credential = extern struct {
credtype: CredentialType,
free: fn (*Credential) callconv(.C) void,
pub fn deinit(se... | src/credential.zig |
const std = @import("std");
/// Entry in the param list
pub const Entry = struct {
key: []const u8,
value: []const u8,
};
/// Small radix trie used for routing
/// This radix trie works different from regular radix tries
/// as each node is made up from a piece rather than a singular character
pub fn Trie(com... | src/trie.zig |
const c = @cImport({
@cInclude("SDL.h");
});
const assert = @import("std").debug.assert;
// See https://github.com/zig-lang/zig/issues/565
// SDL_video.h:#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
// SDL_video.h:#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MA... | example/main.zig |
const std = @import("std");
const stdx = @import("stdx");
const builtin = @import("builtin");
const build_options = @import("build_options");
const string = stdx.string;
const graphics = @import("graphics");
const Graphics = graphics.Graphics;
const StdColor = graphics.Color;
const ds = stdx.ds;
const v8 = @import("v8"... | runtime/js_env.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const assert = std.debug.assert;
const leb = std.leb;
const mem = std.mem;
const wasm = std.wasm;
const Module = @import("../Module.zig");
const Decl = Module.Decl;
const ir = @import("../ir.zig");
const Inst = ir.Inst;
c... | src/codegen/wasm.zig |
const aoc = @import("../aoc.zig");
const std = @import("std");
const TokenState = enum {
turn_toggle, on_off, start_coord, through, end_coord
};
const Command = enum {
turn_on, turn_off, toggle
};
const Light = struct {
p1: u1 = 0, p2: u8 = 0,
};
pub fn run(problem: *aoc.Problem) !aoc.Solution {
var ... | src/main/zig/2015/day06.zig |
const std = @import("std");
const utils = @import("utils");
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const print = utils.print;
pub fn readInput(arena: *ArenaAllocator, lines_it: *utils.FileLineIterator) anyerror![][]const u8 {
var allocator = &arena.allocator;
var ... | day3/src/main.zig |
const std = @import("std");
const vl = @import("value.zig");
const stack = @import("stack.zig");
const debug = @import("debug.zig");
const OpCode = @import("chunk.zig").OpCode;
const Chunk = @import("chunk.zig").Chunk;
const Value = vl.Value;
const Obj = vl.Obj;
const String = vl.String;
const Function = vl.Function;... | src/vm.zig |
const std = @import("std");
const testing = std.testing;
const allocator = std.heap.page_allocator;
pub const Map = struct {
const OFFSET = 1000;
space: Space,
min: Pos,
max: Pos,
cells: [2]std.AutoHashMap(Pos, Tile),
curr: usize,
next: usize,
pub const Space = enum {
Dim3,
... | 2020/p17/map.zig |
const std = @import("std");
const c = @import("c.zig");
const assert = std.debug.assert;
const panic = std.debug.panic;
const grid_png_data = @embedFile("../assets/grid.png");
const font_bmp_data = @embedFile("../assets/font.bmp");
const player_png_data = @embedFile("../assets/player.png");
pub fn main() anyerror!voi... | src/main.zig |
// DO NOT MODIFY. This is not actually a source file; it is a textual representation of generated code.
// Use only for debugging purposes.
// Auto-generated constructor
// Access: public
Method <init> : V
(
// (no arguments)
) {
ALOAD 0
// Method descriptor: ()V
INVOKESPECIAL java/lang/Object#<init>... | localproxyservice/target/generated-sources/gizmo/io/quarkus/deployment/steps/UndertowBuildStep$build23.zig |
const gdt = @import("gdt.zig");
const isr = @import("isr.zig");
const mem = @import("mem.zig");
const timer = @import("timer.zig");
const tty = @import("tty.zig");
const x86 = @import("x86.zig");
const Process = @import("process.zig").Process;
const Thread = @import("thread.zig").Thread;
const ThreadQueue = @import("th... | kernel/scheduler.zig |
const sf = @import("../sfml.zig");
const SoundBuffer = @This();
// Constructor/destructor
/// Loads music from a file
pub fn createFromFile(path: [:0]const u8) !SoundBuffer {
var sound = sf.c.sfSoundBuffer_createFromFile(path);
if (sound == null)
return sf.Error.resourceLoadingError;
return Sound... | src/sfml/audio/SoundBuffer.zig |
const lib = @import("lib.zig");
const types = lib.types;
pub const Opcode = enum(u8) {
@"error" = 0,
create_window = 1,
change_window_attributes = 2,
get_window_attributes = 3,
destroy_window = 4,
destroy_subwindows = 5,
change_save_set = 6,
reparent_window = 7,
map_window = 8,
... | src/request.zig |
const builtin = @import("builtin");
const TypeId = builtin.TypeId;
const std = @import("std");
const assert = std.debug.assert;
const warn = std.debug.warn;
const matrix = @import("matrix.zig");
const Matrix = matrix.Matrix;
const M44f32 = matrix.M44f32;
const vec = @import("vec.zig");
const V3f32 = vec.V3f32;
const... | screencoord.zig |
const std = @import("std");
const util = @import("util");
const input = @embedFile("14.txt");
const MaskValueInstr = struct {
addr: u36,
value: u36,
};
const MaskAddrInstr = struct {
addr: u36,
mask: u36,
value: u36,
};
usingnamespace comptime blk: {
@setEvalBranchQuota(input.len * 20);
v... | 2020/14.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
const Tile = struct {
num: usize,
lines: [][]u8,
width: usize,
top: u10,
right: u10,
bottom: u10,
left: u10,
alloc: std.mem.Allocator,
pub fn init(alloc: std.mem.Allocator, chunk: []const u8) !*Tile {
var s = t... | 2020/20/aoc.zig |
const std = @import("std");
const process = std.process;
const os = std.os;
const fs = std.fs;
pub const log_level: std.log.Level = .debug;
pub const scope_levels = [_]std.log.ScopeLevel{
.{ .scope = .crfl, .level = .debug },
.{ .scope = .config, .level = .info },
.{ .scope = .verbose, .level = .info },
... | src/main.zig |
const std = @import("std");
const c_args = [_][]const u8{
"-Wunreachable-code",
"-Wall",
"-Wpedantic",
"-fPIC",
};
pub fn build(b: *std.build.Builder) void {
const is_android = b.option(bool, "android", "building for the quest 2") orelse false;
const android_ndk = b.option([]const u8, "android... | build.zig |
const std = @import("std");
const testing = std.testing;
pub const Uuid = struct {
bytes: [16]u8,
pub const zero = Uuid{ .bytes = std.mem.zeroes([16]u8) };
pub fn v3(ns: []const u8, name: []const u8) Uuid {
return hashInit(std.crypto.hash.Md5, 3, ns, name);
}
pub fn v4() Uuid {
va... | uuid.zig |
const std = @import("std");
const os = std.os;
const assert = std.debug.assert;
const sockaddr = std.c.sockaddr;
const Address = std.net.Address;
const Allocator = std.mem.Allocator;
// What a router should do:
// 1. Poll and wait for a file descriptor to be ready
// 2. Read the available data to buffer
// 3. Interpr... | src/router.zig |
//--------------------------------------------------------------------------------
// Section: Types (4)
//--------------------------------------------------------------------------------
pub const JOB_OBJECT_LIMIT = enum(u32) {
LIMIT_WORKINGSET = 1,
LIMIT_PROCESS_TIME = 2,
LIMIT_JOB_TIME = 4,
LIMIT_AC... | deps/zigwin32/win32/system/job_objects.zig |
const std = @import("std");
const prot = @import("protocols.zig");
const Context = @import("client.zig").Context;
const Object = @import("client.zig").Object;
const fw_control_impl = @import("implementations/fw_control.zig");
const wl_compositor_impl = @import("implementations/wl_compositor.zig");
const wl_data_device... | src/implementations.zig |
const std = @import("std");
// TODO: maybe imvec4 is not worth it creating a dependency here
const upaya = @import("upaya");
usingnamespace upaya.imgui;
/// We aim at the following Markdown dialect:
///
/// Normal text.
/// Some **bold** text and some _italic_ text.
/// The combination is **_bold italic_** text or _**... | src/markdownlineparser.zig |
const std = @import("std");
pub const pkg = std.build.Pkg{
.name = "lyon",
.source = .{ .path = srcPath() ++ "/lyon.zig" },
};
pub const dummy_pkg = std.build.Pkg{
.name = "lyon",
.source = .{ .path = srcPath() ++ "/lyon_dummy.zig" },
};
pub fn addPackage(step: *std.build.LibExeObjStep, link_lyon: bo... | lib/clyon/lib.zig |
const std = @import("std.zig");
const builtin = @import("builtin");
const debug = std.debug;
const mem = std.mem;
const math = std.math;
const testing = std.testing;
pub const trait = @import("meta/trait.zig");
const TypeId = builtin.TypeId;
const TypeInfo = builtin.TypeInfo;
pub fn tagName(v: var) []const u8 {
... | lib/std/meta.zig |
const std = @import("../std.zig");
const fmt = std.fmt;
const math = std.math;
const mem = std.mem;
const testing = std.testing;
const Vector = std.meta.Vector;
const ChunkIterator = struct {
slice: []u8,
chunk_len: usize,
fn init(slice: []u8, chunk_len: usize) ChunkIterator {
return ChunkIterato... | lib/std/crypto/blake3.zig |
const freetype2 = @import("freetype2.zig");
const std = @import("std");
pub const FontRasterizer = struct {
pub var library: freetype2.FT_Library = null;
pub var fonts = [_]freetype2.FT_Face{null} ** 16;
pub var fonts_count: u8 = 0;
pub fn init(self: *@This()) void {
// var library: free... | font.zig |
const aoc = @import("../aoc.zig");
const std = @import("std");
const Allocator = std.mem.Allocator;
const Combinator = struct {
pub const CombinationResult = struct {
unprocessed: Elements = undefined,
sum: usize = 0,
product: usize = 1,
};
const Elements = []const usize;
const... | src/main/zig/2015/day24.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const log = std.log.scoped(.sema);
const Value = @import("value.zig").Value;
const Type = @import("type.zig").Type;
const TypedValue = @import("TypedValue.zig");
const ir = @import("ir.zig");
const z... | src/zir_sema.zig |
const std = @import("std");
const mach = @import("mach");
const gpu = @import("gpu");
const zm = @import("zmath");
const zigimg = @import("zigimg");
const glfw = @import("glfw");
const draw = @import("draw.zig");
const Atlas = @import("atlas.zig").Atlas;
const ft = @import("freetype");
const Label = @import("text.zig"... | examples/gkurve/main.zig |
const testing = @import("std").testing;
const Document = @import("xml").Document;
const full = @import("full.zig");
test "encoding to XML" {
var doc = try Document.new();
defer doc.deinit();
var root = try doc.createElement("root");
try doc.appendChild(root);
{
var element1 = try doc.crea... | test/test_xml.zig |
const std = @import("std");
const mem = std.mem;
const Unassigned = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 888,
hi: u21 = 1114111,
pub fn init(allocator: *mem.Allocator) !Unassigned {
var instance = Unassigned{
.allocator = allocator,
.array = try allocator.alloc(bool, 1113... | src/components/autogen/DerivedGeneralCategory/Unassigned.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/day17.txt");
//... | src/day17.zig |
const std = @import("std");
pub const gpu = @import("gpu/build.zig");
const gpu_dawn = @import("gpu-dawn/build.zig");
pub const glfw = @import("glfw/build.zig");
const Pkg = std.build.Pkg;
pub fn build(b: *std.build.Builder) void {
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions... | build.zig |
pub const APOERR_ALREADY_INITIALIZED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073919));
pub const APOERR_NOT_INITIALIZED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073918));
pub const APOERR_FORMAT_NOT_SUPPORTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2005073917));... | win32/media/audio/apo.zig |
const std = @import("std");
const assert = std.debug.assert;
const log = std.log.scoped(.state_machine);
usingnamespace @import("tigerbeetle.zig");
const HashMapAccounts = std.AutoHashMap(u128, Account);
const HashMapTransfers = std.AutoHashMap(u128, Transfer);
const HashMapCommits = std.AutoHashMap(u128, Commit);
p... | src/state_machine.zig |
const std = @import("std");
const io = std.io;
const ArrayList = std.ArrayList;
const expect = std.testing.expect;
const Allocator = std.mem.Allocator;
const test_allocator = std.testing.allocator;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer {
_ = gpa.deinit();
}
... | day03/src/main.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = true;
const assert = std.debug.assert;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
fn regIndex(name: []const u8) u32 {
var num: u32 = 0;
for (name) |c| {
num =... | 2017/day8.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = false;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
const assert = std.debug.assert;
pub const main = tools.defaultMain("2021/day19.txt", run);
pub fn run(input: []const u8, gp... | 2021/day19.zig |
const std = @import("std");
const testing = std.testing;
const Token = @import("zhtml/token").Token;
const Tokenizer = @import("zhtml/tokenizer").Tokenizer;
const ParseError = @import("zhtml/parse_error").ParseError;
//! Test runner for the html5lib-tests tokenizer tests
//! https://github.com/html5lib/html5lib-tests/... | test/tokenizer-html5lib.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const maxInt = std.math.maxInt;
const native_abi = builtin.abi;
const native_arch = builtin.cpu.arch;
const linux = std.os.linux;
const iovec = std.os.iovec;
const iovec_const = std.os.iovec_const;
const FILE = std.c.FILE;
pub const AF = linux.AF;
... | lib/std/c/linux.zig |
const std = @import("std");
const print = std.debug.print;
var alloc_buffer: [64 * 1024 * 1024]u8 = undefined;
pub fn main() anyerror!void {
var fixed_alloc = std.heap.FixedBufferAllocator.init(alloc_buffer[0..]);
const allocator = fixed_alloc.allocator();
var timer = try std.time.Timer.start();
var ... | src/main.zig |
const sabaton = @import("root").sabaton;
const regs = @import("regs.zig");
pub fn init() void {
var slice: [35]u32 align(16) = undefined;
var mbox = @intToPtr([*]volatile u32, @ptrToInt(&slice));
mbox[0] = 35 * 4; // size
mbox[1] = 0; // req
mbox[2] = 0x48004; // virtual width (ideally for scrolli... | src/platform/pi3_aarch64/display.zig |
const std = @import("std");
const builtin = std.builtin;
const Builder = std.build.Builder;
const Tcc1Info = struct {
const Extension = enum { c, S };
const Compile = struct {
path: []const u8,
base: []const u8,
ext: Extension = .c,
};
global_incs: ?[]const []const u8 = null,
... | build.zig |
const std = @import("std");
const ray = @import("ray.zig");
const config = @import("config.zig");
const vector = @import("vector.zig");
const Vec3 = config.Vec3;
pub const MaterialType = enum {
DIFFUSE,
GLOSSY,
MIRROR,
};
pub const Material = struct {
material_type: MaterialType = MaterialType.DIFFUS... | src/material.zig |
const std = @import("std");
const sys = std.os.system;
const tcgetattr = std.os.tcgetattr;
const tcsetattr = std.os.tcsetattr;
const stdin = std.os.STDERR_FILENO;
const stdout = std.os.STDOUT_FILENO;
const echo = sys.ECHO;
const icanon = sys.ICANON;
var originalTermios: ?std.os.termios = null;
pub fn enableRawMode(... | src/term/posix.zig |
const clap = @import("clap");
const format = @import("format");
const std = @import("std");
const ston = @import("ston");
const util = @import("util");
const ascii = std.ascii;
const debug = std.debug;
const fmt = std.fmt;
const fs = std.fs;
const heap = std.heap;
const io = std.io;
const math = std.math;
const mem = ... | src/randomizers/tm35-rand-pokeball-items.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const Loop = std.event.Loop;
/// A WaitGroup keeps track and waits for a group of async tasks to finish.
/// Call `begin` when creating new tasks, and have tasks call `finish` when done.
/// You can provide a count for both operations to perform th... | lib/std/event/wait_group.zig |
const std = @import("std");
pub const Alignment = enum { left, right, center };
pub const Button = struct {
command: []const u8,
button: ?u8,
};
pub const Monitor = union(enum) {
next,
previous,
first,
last,
nth: u8,
};
pub const AttrModifier = struct {
pub const Attribute = enum { over... | src/Formatter/property.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
fn readBits(comptime T: type, bits: []const u1, i: *usize) T {
const bit_count = @typeInfo(T).Int.bits;
var j: usize = 0;
var v: T = 0;
if (bit_count == 1) {
v = @as(T, bits[i.*]);
i.* += 1;
return v;
}
while... | 2021/16/aoc.zig |
const std = @import("std");
const tvg = @import("tvg");
const args = @import("args");
fn printUsage(stream: anytype) !void {
try stream.writeAll(
\\tvg-render [-o <file.tga>] [-g <geometry>] [-a] [-s <scale>] <input>
\\
\\Renders a TinyVG vector graphic into a TGA file.
\\
... | src/tools/render.zig |
const builtin = @import("builtin");
const std = @import("std");
const assert = std.debug.assert;
const segfault = true;
pub const JournalHeader = packed struct {
hash_chain_root: u128 = undefined,
prev_hash_chain_root: u128,
checksum: u128 = undefined,
magic: u64,
command: u32,
size: u32,
... | test/behavior/bugs/6781.zig |
const std = @import("std");
const Image = @import("image.zig").Image;
const Allocator = std.mem.Allocator;
const BmpError = error {
InvalidHeader,
InvalidCompression,
UnsupportedFormat
};
pub fn read(allocator: *Allocator, path: []const u8) !Image {
const file = try std.fs.cwd().openFile(path, .{ .rea... | didot-image/bmp.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const HashMap = std.AutoHashMap;
pub fn Grid(comptime T: type) type {
return struct {
m: usize,
n: usize,
data: []T,
allocator: Allocator,
const Self = @This();
pub fn... | src/helper.zig |
const std = @import("std");
usingnamespace @import("common.zig");
usingnamespace @import("lexer.zig");
usingnamespace @import("ast.zig");
usingnamespace @import("parser.zig");
usingnamespace @import("error_handler.zig");
usingnamespace @import("code_formatter.zig");
pub const TypeFlags = packed struct {
... | src/types.zig |
pub const TVI_ROOT = @import("../zig.zig").typedConst(HTREEITEM, @as(i32, -65536));
pub const TVI_FIRST = @import("../zig.zig").typedConst(HTREEITEM, @as(i32, -65535));
pub const TVI_LAST = @import("../zig.zig").typedConst(HTREEITEM, @as(i32, -65534));
pub const TVI_SORT = @import("../zig.zig").typedConst(HTREEITEM, @a... | deps/zigwin32/win32/ui/controls.zig |
const std = @import("std");
const DOUBLE_QUOTE = '\"';
const BACKSLASH = '\\';
const BACKSPACE = 0x08;
const TAB = '\t';
const NEWLINE = '\n';
const FORM_FEED = 0x0C;
const CARRIAGE_RETURN = '\r';
const HEX_DIGITS = [_]u8{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
/// Escapes ... | src/ser/impl/formatter/details/escape.zig |
const std = @import("std");
pub fn Stalloc(comptime B: type, comptime T: type, comptime S: usize) type {
return struct {
entries: [S]Entry,
const Self = @This();
const Entry = struct {
in_use: bool,
index: usize,
belongs_to: *B,
value: T,
... | src/stalloc.zig |
const std = @import("std");
pub const wasm = @import("log_wasm.zig");
const builtin = @import("builtin");
const UseStd = !builtin.target.isWasm();
const UseTimer = builtin.mode == .Debug and true;
var timer: ?std.time.Timer = null;
fn initTimerOnce() void {
if (timer == null) {
timer = std.time.Timer.sta... | stdx/log.zig |
const std = @import("std");
const math = std.math;
const mem = std.mem;
const meta = std.meta;
// XXX: Why is this necessary?
comptime {
_ = ColorblindnessFlavor;
_ = RGB;
_ = HSV;
_ = HSL;
_ = XYZ;
_ = LMS;
_ = hsl_to_rgb;
_ = rgb_to_hsv;
_ = rgb_to_hsl;
_ = rgb_to_xyz;
_ =... | color.zig |