code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
pub usingnamespace @import("raylib-wa.zig");
const rl = @This();
pub const Vector2 = extern struct {
x: f32,
y: f32,
};
pub const Vector3 = extern struct {
x: f32,
y: f32,
z: f32,
};
pub const Vector4 = extern struct {
x: f32,
y: f32,
z: f32,
w: f32,
};
pub const Quaternion = Ve... | lib/raylib-zig.zig |
const std = @import("std");
const print = std.debug.print;
const ArrayList = std.ArrayList;
const Allocator = std.mem.Allocator;
const builtin = @import("builtin");
const utils = @import("utils.zig");
const ea = @import("extend_align.zig");
const ba = @import("banded_align.zig");
const Cigar = @import("cigar.zig").Ci... | src/main.zig |
const std = @import("std");
const zt = @import("zt");
const ig = @import("imgui");
const zg = zt.custom_components;
const scenes_n = [_][]const u8{
"2D Rendering",
"2D Shaders",
"2D Render Targets",
"2D Spatial Hash (Squares)",
"2D Collider Support",
"ImGui Demo",
};
const scenes = [_]fn (*Samp... | example/src/main.zig |
const zig_std = @import("std");
// Import all runtime namespaces
pub usingnamespace @import("common/ir.zig");
pub usingnamespace @import("common/compile-unit.zig");
pub usingnamespace @import("common/disassembler.zig");
pub usingnamespace @import("common/decoder.zig");
/// Contains functions and structures for execu... | src/library/main.zig |
const std = @import("std");
const c = @import("c.zig");
const types = @import("types.zig");
const GlyphSlot = @import("GlyphSlot.zig");
const Library = @import("Library.zig");
const Error = @import("error.zig").Error;
const intToError = @import("error.zig").intToError;
const utils = @import("utils.zig");
const Face = ... | freetype/src/Face.zig |
pub extern fn zip_strerror(errnum: c_int) [*c]const u8;
pub const struct_zip_t = opaque {};
pub extern fn zip_open(zipname: [*c]const u8, level: c_int, mode: u8) ?*struct_zip_t;
pub extern fn zip_close(zip: ?*struct_zip_t) void;
pub extern fn zip_is64(zip: ?*struct_zip_t) c_int;
pub extern fn zip_entry_open(zip: ?*stru... | src/deps/zip/zip.zig |
pub const RDCE_TABLE_FULL = @as(u32, 2147745793);
pub const RDCE_TABLE_CORRUPT = @as(u32, 2147745794);
pub const MSRDC_SIGNATURE_HASHSIZE = @as(u32, 16);
pub const SimilarityFileIdMinSize = @as(u32, 4);
pub const SimilarityFileIdMaxSize = @as(u32, 32);
pub const MSRDC_VERSION = @as(u32, 65536);
pub const MSRDC_MINIMUM_... | win32/networking/remote_differential_compression.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
pub const main = tools.defaultMain("2021/day03.txt", run);
fn filter_in_place(initial_list: []u16, mode: enum { least_frequent, most_frequent }) u16 {
var list = initial_list;
var bit_index: u4 = 15;
while (bit_in... | 2021/day03.zig |
const std = @import("std");
const Answer = struct { @"0": u32, @"1": u64 };
const WinLoss = struct {
wins: u64,
losses: u64,
};
fn add_win_loss(u: WinLoss, v: WinLoss) WinLoss {
return WinLoss{
.wins = u.wins + v.wins,
.losses = u.losses + v.losses,
};
}
fn scale_win_loss(c: u64, v: W... | src/day21.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const warn = std.debug.warn;
const Order = std.math.Order;
const testing = std.testing;
const expect = testing.expect;
const expectEqual = testing.expectEqual;
const expectError = testing.expectError;
/// Min-Max Heap for... | min_max_heap.zig |
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
pub const VInt = @import("vint.zig");
const Allocator = std.mem.Allocator;
const File = std.fs.File;
pub const ids = @import("element_ids.zig");
/// Records the ID, location, and width of an EBML element in a file.
pub cons... | src/main.zig |
const std = @import("std");
const io = std.io;
const mem = std.mem;
const net = std.net;
const os = std.os;
usingnamespace @import("../primitive_types.zig");
const sm = @import("../string_map.zig");
const testing = @import("../testing.zig");
pub const PrimitiveWriter = struct {
const Self = @This();
wbuf: s... | src/primitive/writer.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = mem.Allocator;
const c = @import("c.zig");
const nvg = @import("nvg.zig");
const Game = @import("game.zig");
extern fn gladLoadGL() callconv(.C) c_int; // init OpenGL function pointers on Windows and Linux
extern fn SetProcessDPIAware() callconv(.C) ... | src/main.zig |
const std = @import("std");
const mem = std.mem;
pub const decode = @import("midi/decode.zig");
pub const encode = @import("midi/encode.zig");
pub const file = @import("midi/file.zig");
test "midi" {
_ = @import("midi/test.zig");
_ = decode;
_ = file;
}
pub const File = file.File;
pub const Message = s... | midi.zig |
const std = @import("std");
const testing = std.testing;
pub const AEffect = extern struct {
pub const Magic: i32 = ('V' << 24) | ('s' << 16) | ('t' << 8) | 'P';
/// Magic bytes required to identify a VST Plugin
magic: i32 = Magic,
/// Host to Plugin Dispatcher
dispatcher: DispatcherCallback,
... | src/api.zig |
const std = @import("std");
const gamekit = @import("gamekit.zig");
const renderkit = @import("renderkit");
const math = gamekit.math;
// high level wrapper objects that use the low-level backend api
pub const Texture = @import("graphics/texture.zig").Texture;
pub const OffscreenPass = @import("graphics/offscreen_pass... | gamekit/gfx.zig |
const std = @import("std");
const link = @import("link.zig");
const ir = @import("ir.zig");
const Allocator = std.mem.Allocator;
var global_ctx: TestContext = undefined;
test "self-hosted" {
try global_ctx.init();
defer global_ctx.deinit();
try @import("stage2_tests").addCases(&global_ctx);
try glob... | src-self-hosted/test.zig |
const std = @import("std");
const mem = std.mem;
const unicode = std.unicode;
const CodePointIterator = @import("CodePointIterator.zig");
const Context = @import("../Context.zig");
allocator: *mem.Allocator,
context: *Context,
cp_iter: CodePointIterator,
const Self = @This();
pub fn new(ctx: *Context, str: []const... | src/zigstr/GraphemeIterator.zig |
const std = @import("std");
const os = std.os;
const DEBUG: bool = false;
const QD :u13 = 32;
const BS :usize = (16 * 1024);
var infd :std.fs.File = undefined;
var outfd :std.fs.File = undefined;
/// some code is borrowed from <NAME> thx to him
const IoData = struct {
rw_flag: os.linux.IORING_OP,
first_of... | io_uring/cp/zig/io_uring_cp.zig |
const std = @import("std");
const cpuinfo = @import("cpuinfo");
const slimy = @import("slimy.zig");
const version = @import("version.zig");
const zc = @import("zcompute");
pub fn main() u8 {
mainInternal() catch |err| {
std.debug.print("error: {s}\n", .{@errorName(err)});
if (@errorReturnTrace()) |... | src/bench.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/day02.txt");
f... | src/day02.zig |
const std = @import("std");
const fs = std.fs;
const mem = std.mem;
const log = std.log.scoped(.tapi);
const Allocator = mem.Allocator;
const Yaml = @import("tapi/yaml.zig").Yaml;
const VersionField = union(enum) {
string: []const u8,
float: f64,
int: u64,
};
pub const TbdV3 = struct {
archs: []const... | src/link/tapi.zig |
const std = @import("std");
const Builder = std.build.Builder;
const dbuild = @import("src/common/dbuild.zig");
const dcommon = @import("src/common/dcommon.zig");
pub fn build(b: *Builder) !void {
const board = try dbuild.getBoard(b);
var target = dbuild.crossTargetFor(board);
target.os_tag = .uefi;
... | dainboot/build.zig |
const std = @import("std");
const real_input = @embedFile("day-15_real-input");
const test_input = @embedFile("day-15_test-input");
pub fn main() !void {
std.debug.print("--- Day 15 ---\n", .{});
const result = try execute(real_input, true);
std.debug.print("lowest total risk is {}\n", .{ result });
}
fn ... | day-15.zig |
const std = @import("std");
const iup = @import("iup.zig");
const MainLoop = iup.MainLoop;
const Dialog = iup.Dialog;
const Button = iup.Button;
const MessageDlg = iup.MessageDlg;
const Multiline = iup.Multiline;
const Label = iup.Label;
const Text = iup.Text;
const VBox = iup.VBox;
const HBox = iup.HBox;
const Menu =... | src/tree_example.zig |
const std = @import("std");
const zt = @import("../zt.zig");
const ig = @import("imgui");
/// You can't remove the background from this, but you can make it invisible with
/// style.Colors.
pub fn ztViewPort() ig.ImGuiID {
const dockNodeFlags = ig.ImGuiDockNodeFlags_PassthruCentralNode;
const windowFlags =
... | src/zt/customComponents.zig |
const std = @import("std");
const builtin = @import("builtin");
const expect = std.testing.expect;
const mem = std.mem;
fn initStaticArray() [10]i32 {
var array: [10]i32 = undefined;
array[0] = 1;
array[4] = 2;
array[7] = 3;
array[9] = 4;
return array;
}
const static_array = initStaticArray();
... | test/behavior/undefined.zig |
const builtin = @import("builtin");
const std = @import("std");
const time = std.time;
const Timer = time.Timer;
const hash = std.hash;
const KiB = 1024;
const MiB = 1024 * KiB;
const GiB = 1024 * MiB;
var prng = std.rand.DefaultPrng.init(0);
const Hash = struct {
ty: type,
name: []const u8,
has_iterati... | lib/std/hash/benchmark.zig |
const builtin = @import("builtin");
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
/// Returns the tangent of the radian value x.
///
/// Special Cases:
/// - tan(+-0) = +-0
/// - tan(+-inf) = nan
/// - tan(nan) = nan
pub fn tan(x: anytype) @TypeOf(x) {
const T... | lib/std/math/tan.zig |
const std = @import("std");
const mem = std.mem;
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const ir = @import("ir.zig");
const fs = std.fs;
const elf = std.elf;
const codegen = @import("codegen.zig");
const default_entry_addr = 0x8000000;
pub const ErrorMsg = struct {
byte_offset: usiz... | src-self-hosted/link.zig |
const std = @import("std");
const mem = std.mem;
const Extender = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 183,
hi: u21 = 125254,
pub fn init(allocator: *mem.Allocator) !Extender {
var instance = Extender{
.allocator = allocator,
.array = try allocator.alloc(bool, 125072),
... | src/components/autogen/PropList/Extender.zig |
const std = @import("std");
const Builder = std.build.Builder;
const Step = std.build.Step;
const FileSource = std.build.FileSource;
const GeneratedFile = std.build.GeneratedFile;
const LibExeObjStep = std.build.LibExeObjStep;
const Sdk = @This();
fn sdkRoot() []const u8 {
return std.fs.path.dirname(@src().file)... | Sdk.zig |
pub const DosQVariant = anyopaque;
pub const DosQModelIndex = anyopaque;
pub const DosQAbstractItemModel = anyopaque;
pub const DosQAbstractListModel = anyopaque;
pub const DosQAbstractTableModel = anyopaque;
pub const DosQQmlApplicationEngine = anyopaque;
pub const DosQQuickView = anyopaque;
pub const DosQQmlContext =... | src/DOtherSideTypes.zig |
const std = @import("std");
// TODO consider showing the username (-n/--show-username) on process
pub const Config = struct {
show_swap: bool = false,
// discriminate by pid
per_pid: bool = false,
// if null, then should show all the processes that the user has access of (WIP)
pid_list: ?[]const u... | src/utils.zig |
const std = @import("std");
const heap = std.heap;
const mem = std.mem;
const zig = std.zig;
fn getJsonObject(allocator: *std.mem.Allocator) !std.json.Value {
var value = std.json.Value{ .Object = std.json.ObjectMap.init(allocator) };
_ = try value.Object.put("one", std.json.Value{ .Integer = @intCast(i64, 1) ... | src/fmt.zig |
//--------------------------------------------------------------------------------
// Section: Types (11)
//--------------------------------------------------------------------------------
pub const BROADCAST_SYSTEM_MESSAGE_FLAGS = enum(u32) {
ALLOWSFW = 128,
FLUSHDISK = 4,
FORCEIFHUNG = 32,
IGNORECURR... | win32/system/stations_and_desktops.zig |
pub fn isParserType(comptime T: type) bool {
const tid = @typeInfo(T);
if ((tid == .Struct or tid == .Enum or tid == .Union) and
@hasDecl(T, "Redis") and @hasDecl(T.Redis, "Parser"))
{
if (!@hasDecl(T.Redis.Parser, "parse"))
@compileError(
\\`Redis.Parser` trait requi... | src/traits.zig |
const std = @import("std");
const nvg = @import("nanovg");
const gui = @import("../gui.zig");
const Rect = @import("../geometry.zig").Rect;
const Point = @import("../geometry.zig").Point;
const TextBox = @This();
widget: gui.Widget,
allocator: *std.mem.Allocator,
text: std.ArrayList(u8),
text_alignment: gui.TextAlig... | src/gui/widgets/TextBox.zig |
pub const EVCF_HASSETTINGS = @as(u32, 1);
pub const EVCF_ENABLEBYDEFAULT = @as(u32, 2);
pub const EVCF_REMOVEFROMLIST = @as(u32, 4);
pub const EVCF_ENABLEBYDEFAULT_AUTO = @as(u32, 8);
pub const EVCF_DONTSHOWIFZERO = @as(u32, 16);
pub const EVCF_SETTINGSMODE = @as(u32, 32);
pub const EVCF_OUTOFDISKSPACE = @as(u32, 64);
... | win32/ui/legacy_windows_environment_features.zig |
const std = @import("std");
const builtin = @import("builtin");
const lola = @import("../main.zig");
const root = @import("root");
const GlobalObjectPool = if (builtin.is_test)
// we need to do a workaround here for testing purposes
lola.runtime.ObjectPool([_]type{
LoLaList,
LoLaDictionary,
... | src/library/libraries/runtime.zig |
const clint = @import("clint.zig");
const debug = @import("debug.zig");
const exceptions = [_][]const u8{
"Instruction address misaligned",
"Instruction access fault",
"Illegal instruction",
"Breakpoint",
"Load address misaligned",
"Load access fault",
"Store/AMO address misaligned",
"S... | src/trap.zig |
--- src/link/Elf.zig.orig 2021-09-07 02:41:54 UTC
+++ src/link/Elf.zig
@@ -3353,19 +3353,22 @@ const CsuObjects = struct {
const crt_dir_path = lci.crt_dir orelse return error.LibCInstallationMissingCRTDir;
switch (link_options.target.os.tag) {
.dragonfly => {
+ ... | bucket_BC/zig/patches/patch-src_link_Elf.zig |
const std = @import("std");
const TestContext = @import("../../src/test.zig").TestContext;
const build_options = @import("build_options");
// These tests should work with all platforms, but we're using linux_x64 for
// now for consistency. Will be expanded eventually.
const linux_x64 = std.zig.CrossTarget{
.cpu_ar... | test/stage2/llvm.zig |
const std = @import("std");
const stdout = std.io.getStdOut().writer();
const Word = @import("./word.zig").Word;
pub const InterpreterError = error{
Bye,
};
pub fn ForthInterpreter(comptime STACK_SIZE: usize) type {
return struct {
const Self = @This();
stack: [STACK_SIZE]i64 = [_]i64{0} ** ST... | src/interpreter.zig |
const std = @import("std");
const dcommon = @import("common/dcommon.zig");
const arch_paging = switch (dcommon.daintree_arch) {
.arm64 => @import("arm64/paging.zig"),
.riscv64 => @import("riscv64/paging.zig"),
};
const hw = @import("hw.zig");
pub const Error = error{OutOfMemory};
pub const PAGING = arch_paging... | dainkrnl/src/paging.zig |
const std = @import("std");
const wm = @import("wm.zig");
const assert = std.debug.assert;
test "add and remove windows" {
var workspace = wm.Workspace{};
assert(workspace.amountOfWindows == 0);
assert(workspace.focusedWindow == 0);
assert(true == workspace.addWindow(1337));
assert(workspace.amoun... | src/test.zig |
const std = @import("std");
const mem = std.mem;
const fmt = std.fmt;
const unicode = std.unicode;
const testing = std.testing;
iter: usize,
entries: std.ArrayList(Entry),
const DecompFile = @This();
pub const Entry = struct {
key: [4]u8,
key_len: usize,
value: Decomp,
// Calculates the difference ... | src/normalizer/DecompFile.zig |
const stdx = @import("stdx");
const graphics = @import("graphics");
const Color = graphics.Color;
const platform = @import("platform");
const ui = @import("../ui.zig");
const widgets = ui.widgets;
const MouseArea = widgets.MouseArea;
const Row = widgets.Row;
const Flex = widgets.Flex;
const Sized = widgets.Sized;
cons... | ui/src/widgets/switch.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const sql = @import("sqlite");
const db = @import("db.zig");
const fs = std.fs;
const fmt = std.fmt;
const print = std.debug.print;
const log = std.log;
const http = @import("http.zig");
const mem = std.mem;
const shame = @import("shame.zig");
const time ... | src/feed_db.zig |
const std = @import("std");
const helper = @import("helper.zig");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const HashMap = std.AutoHashMap;
const PointSet = HashMap(Point, void);
const input = @embedFile("../inputs/day09.txt");
pub fn run(alloc: Allocator, stdout_: anytype) !void {
c... | src/day09.zig |
const sf = @import("../sfml_import.zig");
const math = @import("std").math;
pub const Color = packed struct {
const Self = @This();
/// Converts a color from a csfml object
/// For inner workings
pub fn fromCSFML(col: sf.c.sfColor) Self {
return Self{
.r = col.r,
.g = ... | src/sfml/graphics/color.zig |
const std = @import("std");
const fs = std.fs;
const i2c = @import("bus/i2c.zig");
// TODO : generate colorwheel pattern via comptime calls
const colors = [_][3]u8{
[_]u8{ 255, 0, 0 },
[_]u8{ 183, 72, 0 },
[_]u8{ 111, 144, 0 },
[_]u8{ 39, 216, 0 },
[_]u8{ 0, 222, 33 },
[_]u8{ 0, 150, 105 },
... | src/led_driver.zig |
const std = @import("std");
const redis = @cImport({
@cInclude("redismodule.h");
});
// MK.EVALKEY scriptkey numkeys [key ...] [arg ...]
pub export fn MK_EVALKEY(ctx: ?*redis.RedisModuleCtx, argv: [*c]?*redis.RedisModuleString, argc: c_int) c_int {
const not_enough_args = argc < 3;
if (1 == redis.RedisModu... | moonkey.zig |
usingnamespace @import("ncurses").ncurses;
const width: c_int = 30;
const height: c_int = 10;
var startx: c_int = 0;
var starty: c_int = 0;
const choices = [_][]const u8{
"Choice 1",
"Choice 2",
"Choice 3",
"Choice 4",
"Exit",
};
pub fn main() anyerror!void {
var highlight: usize = 1;
var... | examples/keys.zig |
pub usingnamespace @cImport({
@cDefine("GLFW_INCLUDE_GLCOREARB", "");
@cInclude("GLFW/glfw3.h");
@cInclude("stb_image_write.h");
});
pub var glCreateTextures: @typeInfo(PFNGLCREATETEXTURESPROC).Optional.child = undefined;
pub var glTextureStorage2D: @typeInfo(PFNGLTEXTURESTORAGE2DPROC).Optional.child = und... | src/c.zig |
const Plan9 = @This();
const std = @import("std");
const link = @import("../link.zig");
const Module = @import("../Module.zig");
const Compilation = @import("../Compilation.zig");
const aout = @import("Plan9/aout.zig");
const codegen = @import("../codegen.zig");
const trace = @import("../tracy.zig").trace;
const mem ... | src/link/Plan9.zig |
const std = @import("std");
const assert = std.debug.assert;
const VRegisterCount: u32 = 16;
pub const StackSize: u32 = 16;
const MemorySizeInBytes: u32 = 0x1000;
// Fonts
const FontTableGlyphCount: u32 = 16;
const GlyphSizeInBytes: u16 = 5;
// Display
pub const ScreenWidth: u32 = 64;
pub const ScreenHeight: u32 = 3... | src/chip8/cpu.zig |
const XdgPopup = @This();
const std = @import("std");
const assert = std.debug.assert;
const wlr = @import("wlroots");
const wl = @import("wayland").server.wl;
const util = @import("util.zig");
const Subsurface = @import("Subsurface.zig");
const Parent = Subsurface.Parent;
/// The parent at the root of this surfac... | source/river-0.1.0/river/XdgPopup.zig |
// Note: The manual lists a procmoncfg register but does not describe it.
// https://forums.sifive.com/t/fe310-g002-v1p0-manual-errata/4751
const Register = @import("../../../mmio_register.zig").Register;
pub fn useExternalCrystalOscillator() void {
hfrosccfg.modify(.{
.hfroscen = true,
});
// S... | src/target/soc/fe310-g002/prci.zig |
const std = @import("std");
const ast = @import("ast.zig");
const Allocator = std.mem.Allocator;
const Gc = @import("Gc.zig");
//! `Value` represents a primitive value for Luf
const Value = @This();
/// actual type of the `Value`
ty: Type,
/// is marked by the gc?
is_marked: bool = false,
/// Next Value in the Linke... | src/Value.zig |
const std = @import("std");
const assert = std.debug.assert;
const print = std.debug.print;
const testing = std.testing;
const wren = @import("./wren.zig");
const Configuration = @import("./vm.zig").Configuration;
const Vm = @import("./vm.zig").Vm;
const ErrorType = @import("./vm.zig").ErrorType;
pub const ForeignCla... | src/zapata/foreign.zig |
const std = @import("std");
const string = []const u8;
const range = @import("range").range;
const input = @embedFile("../input/day15.txt");
const Point = struct {
x: usize,
y: usize,
fn neighbors(self: Point, s: usize) [4]?Point {
return .{
if (self.y == 0) null else .{ .x = self.x, ... | src/day15.zig |
pub const std = @import("std");
pub const xml = @import("xml.zig");
pub const mem = std.mem;
pub const Protocol = struct {
name: []u8,
copyright: ?Copyright,
description: ?Description,
interfaces: []Interface,
allocator: mem.Allocator,
pub fn deinit(proto: *Protocol) void {
proto.allo... | scanner/wayland.zig |
const comptimePrint = @import("std").fmt.comptimePrint;
pub const update_interval = 600;
pub const Table = struct {
pub const item = struct {
pub const create =
\\CREATE TABLE IF NOT EXISTS item(
\\ id INTEGER PRIMARY KEY,
\\ feed_id INTEGER NOT NULL,
\\ ti... | src/queries.zig |
pub const PIPE_UNLIMITED_INSTANCES = @as(u32, 255);
pub const NMPWAIT_WAIT_FOREVER = @as(u32, 4294967295);
pub const NMPWAIT_NOWAIT = @as(u32, 1);
pub const NMPWAIT_USE_DEFAULT_WAIT = @as(u32, 0);
//--------------------------------------------------------------------------------
// Section: Types (1)
//---------------... | win32/system/pipes.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 Attribute = struct {
z_attr: [*c]const u8,
/// Check if an attribute is set on. In core git parlance, this the value ... | src/attribute.zig |
const std = @import("std");
const warn = std.debug.warn;
fn solve_sudoku(field: *[81]u8, rules: [3][9 * 9]u8) bool {
var set_mask = [_]u16{0} ** 81;
return sudoku_try_set_field(0, field, rules, &set_mask);
}
fn sudoku_try_set_field(index: u8, field: *[81]u8, rules: [3][81]u8, set_mask: *[81]u16) bool {
va... | zig/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);
}
const Map = tools.Map(200, 100, false);
const Vec2 = tools.Vec2;
fn compute_dists(start: u8... | 2016/day24.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/day09.zig |
const std = @import("std");
const fmt = std.fmt;
const heap = std.heap;
const mem = std.mem;
const net = std.net;
const os = std.os;
const testing = std.testing;
const time = std.time;
const Atomic = std.atomic.Atomic;
const assert = std.debug.assert;
const httpserver = @import("lib.zig");
const curl = @import("curl... | src/test.zig |
const std = @import("std");
const sf = @import("../sfml.zig");
const IpAddress = @This();
// Const addresses
// TODO: make those comptime
/// Any address or no address
pub fn any() IpAddress {
return IpAddress.initFromInt(0);
}
pub const none = any;
/// Broadcast address
pub fn broadcast() IpAddress {
return... | src/sfml/network/IpAddress.zig |
const std = @import("std");
const decoder = @import("decoder.zig");
const CPU = @import("cpu.zig").CPU;
const Instruction = decoder.Instruction;
pub const OpFuncError = error{
Unimplemented,
};
pub const OpFunc = fn (cpu: *CPU, inst: []Instruction, cur: usize) anyerror!void;
/// Execute next instruction.
pub in... | opfunc.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = std.mem.Allocator;
const ArrayListUnmanaged = std.ArrayListUnmanaged;
const assert = std.debug.assert;
const log = std.log.scoped(.module);
const BigIntConst = std.math.big.int.Const;
const BigIntMutable = std.math.big.int.Mutable;
const Target = std.T... | src/Module.zig |
const std = @import("index.zig");
const debug = std.debug;
const assert = debug.assert;
const mem = std.mem;
const os = std.os;
const builtin = @import("builtin");
const Os = builtin.Os;
const c = std.c;
const maxInt = std.math.maxInt;
const Allocator = mem.Allocator;
pub const c_allocator = &c_allocator_state;
var c... | std/heap.zig |
const std = @import("../../../std.zig");
const pid_t = linux.pid_t;
const uid_t = linux.uid_t;
const clock_t = linux.clock_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const linux = std.os.linux;
const sockaddr = linux.sockaddr;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const ... | lib/std/os/bits/linux/x86_64.zig |
const std = @import("std");
pub usingnamespace @import("../common.zig");
// This is only used on buffers with an LF delimiter, so only CR needs to be checked
// LF is a valid line ending (RFC 7230, Section 3.5)
pub fn normalizeLineEnding(buffer: []const u8) callconv(.Inline) []const u8 {
if (buffer[buffer.len - 1... | src/parser/common.zig |
const __fixsfdi = @import("fixsfdi.zig").__fixsfdi;
const std = @import("std");
const math = std.math;
const testing = std.testing;
const warn = std.debug.warn;
fn test__fixsfdi(a: f32, expected: i64) void {
const x = __fixsfdi(a);
//warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", a, @bitCast(u32, a)... | lib/std/special/compiler_rt/fixsfdi_test.zig |
const std = @import("std");
const builtin = @import("builtin");
const fs = std.fs;
const io = std.io;
const mem = std.mem;
const process = std.process;
const Archive = @import("archive/Archive.zig");
const overview =
\\Zig Archiver
\\
\\Usage: zar [options] [-]<operation>[modifiers] [relpos] [count] <arch... | src/main.zig |
const MachO = @This();
const std = @import("std");
const build_options = @import("build_options");
const builtin = @import("builtin");
const assert = std.debug.assert;
const fmt = std.fmt;
const fs = std.fs;
const log = std.log.scoped(.link);
const macho = std.macho;
const math = std.math;
const mem = std.mem;
const m... | src/link/MachO.zig |
const std = @import("std");
const TestContext = @import("../../src-self-hosted/test.zig").TestContext;
// self-hosted does not yet support PE executable files / COFF object files
// or mach-o files. So we do the ZIR transform test cases cross compiling for
// x86_64-linux.
const linux_x64 = std.zig.CrossTarget{
.cp... | test/stage2/zir.zig |
const std = @import("std");
const builtin = @import("builtin");
const Builder = std.build.Builder;
const path = std.fs.path;
const sep_str = path.sep_str;
const Target = std.build.Target;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{
... | build.zig |
const std = @import("std");
const testing = std.testing;
const Tree = @import("tree.zig").Tree;
const KV = @import("kv.zig").KV;
const Hash = @import("hash.zig").H;
pub const LinkTag = enum(u2) {
Pruned,
Modified,
Stored,
};
pub const Link = union(LinkTag) {
Pruned: Pruned,
Modified: Modified,
... | src/link.zig |
const std = @import("std");
const builtin = std.builtin;
const TypeInfo = builtin.TypeInfo;
const alignForward = std.mem.alignForward;
const pi = std.math.pi;
pub const Math = struct {
pub fn FixedPoint(comptime isSigned: bool, comptime integral: comptime_int, comptime fractional: comptime_int) type {
retu... | GBA/math.zig |
const Builder = @import("std").build.Builder;
usingnamespace @import("GBA/builder.zig");
pub fn build(b: *Builder) void {
const first = addGBAExecutable(b, "first", "examples/first/first.zig");
const mode3Draw = addGBAExecutable(b, "mode3draw", "examples/mode3draw/mode3draw.zig");
const debugPrint = addGBA... | build.zig |
usingnamespace @import("vulkan");
const VK_API_VERSION_1_2 = makeApiVersion(0, 1, 2, 0);
pub var vkb: BaseDispatch = undefined;
pub var vki: InstanceDispatch = undefined;
pub var vkd: DeviceDispatch = undefined;
pub const BaseDispatch = BaseWrapper(.{
.CreateInstance,
});
pub const InstanceDispatch = InstanceWra... | src/vulkan/vk.zig |
const std = @import("std");
pub const SMOVE = struct {
source: []const u8,
destination: []const u8,
member: []const u8,
/// Instantiates a new SMOVE command.
pub fn init(source: []const u8, destination: []const u8, member: []const u8) SMOVE {
// TODO: support std.hashmap used as a set!
... | src/commands/sets/smove.zig |
const std = @import("std");
const git = @import("git.zig");
test "simple repository init" {
const repo_path = "./zig-cache/test_repos/simple_repository_init";
std.fs.cwd().deleteTree(repo_path) catch {};
defer std.fs.cwd().deleteTree(repo_path) catch {};
const handle = try git.init();
defer handl... | src/tests.zig |
const std = @import("std");
const mem = std.mem;
const c = @cImport({
@cInclude("expat.h");
});
const gpa = std.heap.c_allocator;
const Context = struct {
const Self = @This();
protocol: Protocol,
interface: *Interface,
message: *Message,
enumeration: *Enum,
character_data: std.ArrayLi... | scanner.zig |
const std = @import("std");
const builtin = @import("builtin");
const Builder = std.build.Builder;
const print = std.debug.print;
const expected_zig_version: u32 = 9;
const c_options = &[_][]const u8{
"-Wall",
"-Wextra",
"-Werror",
// Looks like there is some kind of bug that prevents you from only... | build.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/puzzle/day06.tx... | src/day06.zig |
pub const Link = struct {
ptr: ?*Link,
};
pub const SingularLinkList = struct {
const Self = @This();
// tail.ptr.?.ptr is head
tail: Link,
fn init() Self {
return Self {
.tail = Link { .ptr = null, },
};
}
// Assumes the list is NOT mutated while being traver... | singular_link_list.zig |
const std = @import("std");
const utils = @import("utils.zig");
pub const Error = utils.Error;
const ToString = @This();
buffer: []u8,
got: usize = 0,
pub fn need(self: *const ToString, space: usize) Error!void {
if (space > (self.buffer.len - self.got)) {
return Error.NotEnoughDestination;
}
}
pub... | libs/utils/ToString.zig |
const std = @import("std");
const Random = std.rand.Random;
const math = std.math;
const RomuTrio = @This();
x_state: u64,
y_state: u64,
z_state: u64, // set to nonzero seed
pub fn init(init_s: u64) RomuTrio {
var x = RomuTrio{ .x_state = undefined, .y_state = undefined, .z_state = undefined };
x.seed(init_s... | lib/std/rand/RomuTrio.zig |
const std = @import("std");
const warn = std.debug.warn;
const InstructionBlock = struct {
instructions: std.ArrayList(Instruction),
page: u4,
addr: ?u12,
};
const Instruction = struct {
opcode: []const u8,
address: ?[]const u8,
};
const VariableDef = struct {
value: u16,
page: u4,
ad... | src/parser.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/link/MachO.zig |
const std = @import("std");
const assert = std.debug.assert;
const wgi = @import("../WindowGraphicsInput/WindowGraphicsInput.zig");
const ShaderProgram = wgi.ShaderProgram;
const ShaderObject = wgi.ShaderObject;
const ShaderType = wgi.ShaderType;
const ArrayList = @import("std").ArrayList;
const renderEngine = @import(... | src/RTRenderEngine/Shader.zig |
const std = @import("std");
const json = std.json;
const MaybeDefined = @import("json_serialize.zig").MaybeDefined;
pub const String = []const u8;
pub const Integer = i64;
pub const Float = f64;
pub const Bool = bool;
pub const Array = json.Array;
pub const Object = json.ObjectMap;
pub const Any = json.Value;
// Spec... | src/types.zig |
const std = @import("std");
const json = std.json;
const Tuple = std.meta.Tuple;
pub fn IntBackedEnumStringify(comptime T: type) type {
return struct {
pub fn jsonStringify(value: T, options: json.StringifyOptions, out_stream: anytype) !void {
try json.stringify(@enumToInt(value), options, out_... | lsp_generated.zig |
const std = @import("std");
const utils = @import("../utils.zig");
pub const TypeFlag = enum(u8) {
aregular = 0,
regular = '0',
link = '1',
symlink = '2',
char = '3',
block = '4',
directory = '5',
fifo = '6',
continuous = '7',
ext_header = 'x',
ext_global_header = 'g',
... | src/formats/tar.zig |
const Symbol = @This();
const std = @import("std");
const types = @import("types.zig");
/// Bitfield containings flags for a symbol
/// Can contain any of the flags defined in `Flag`
flags: u32,
/// Symbol name, when undefined this will be taken from the import.
name: [*:0]const u8,
/// An union that represents both ... | src/link/Wasm/Symbol.zig |