code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const builtin = @import("builtin");
const native_arch = builtin.cpu.arch;
// AArch64 is the only ABI (at the moment) to support f16 arguments without the
// need for extending them to wider fp types.
pub const F16T = if (native_arch.isAARCH64()) f16 else u16;
pub fn __truncxfhf2(a: f80) ca... | lib/std/special/compiler_rt/trunc_f80.zig |
const std = @import("std");
const math = std.math;
const windows = std.os.windows;
const kernel32 = windows.kernel32;
const INT = windows.INT;
const BOOL = windows.BOOL;
const CHAR = windows.CHAR;
const SHORT = windows.SHORT;
const DWORD = windows.DWORD;
const WINAPI = windows.WINAPI;
const LPVOID = windows.LPVOID;
co... | src/main.zig |
const std = @import("std");
//! This contains the logic for errors
//! Errors can be written to a writer compliant to std.io.writer interface
pub const Error = struct {
/// The formatted message
fmt: []const u8,
/// type of the error: Error, Warning, Info
kind: ErrorType,
/// index of the token wh... | src/error.zig |
const std = @import("std");
const vector = @import("vector.zig");
const Vec4 = Vec4;
const initPoint = vector.initPoint;
const initVector = vector.initVector;
const Mat4 = @import("matrix.zig").Mat4;
const Canvas = @import("canvas.zig").Canvas;
const Color = @import("color.zig").Color;
const Pattern = @import("patter... | draw_world.zig |
const std = @import("std");
const tests = &[_]Test{
.{ .success = false },
.{ .args = &[_][]const u8{"help"} },
Test.help(.parse),
Test.hello(.parse, null, null),
Test.help(.build),
Test.hello(.build, null, null),
Test.hello(.build, &[_][]const u8{"--format=compact"}, null),
Test.ok(.bu... | test/cases.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const HashMap = std.StringHashMap;
const bindings = @import("bindings.zig");
const c = bindings.c;
const Sdl = bindings.Sdl;
const Gl = bindings.Gl;
const Imgui = bindings.Imgui;
const Context = @import("context.zig").Context;
const PixelBuffer = @impor... | src/sdl/imgui.zig |
const print = std.debug.print;
const std = @import("std");
const os = std.os;
const assert = std.debug.assert;
const mem = @import("std").mem;
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
pub fn main() anyerror!void {
std.log.info("All your codebase are belong to us.", .{});
print("Hel... | src/main.zig |
const builtin = @import("builtin");
const std = @import("std");
pub const BackendAPI = enum {
default,
opengl,
d3d11,
};
pub fn usingBackendAPI(comptime backend_api: BackendAPI) type {
return struct {
// Graphics API abstraction
pub const backend = switch (backend_api) {
... | modules/graphics/src/main.zig |
const std = @import("std");
const builtin = @import("builtin");
const math = std.math;
const Allocator = std.mem.Allocator;
const MIN_DEPTH = 4;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var global_allocator = gpa.allocator();
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
const n ... | bench/algorithm/merkletrees/1.zig |
const std = @import("std");
const math = std.math;
const testing = std.testing;
const vecs = @import("vec.zig");
const Vec2 = vecs.Vec2;
const Vec3 = vecs.Vec3;
const Vec4 = vecs.Vec4;
const BiVec3 = vecs.BiVec3;
const mats = @import("mat.zig");
const Mat3 = mats.Mat3;
pub const Rotor2 = extern struct {
dot: f32... | src/geo/rotor.zig |
const std = @import("std.zig");
const testing = std.testing;
// TODO: Add support for multi-byte ops (e.g. table operations)
/// Wasm instruction opcodes
///
/// All instructions are defined as per spec:
/// https://webassembly.github.io/spec/core/appendix/index-instructions.html
pub const Opcode = enum(u8) {
@"u... | lib/std/wasm.zig |
const std = @import("std");
const testing = std.testing;
// Probably broken version of Russ Cox's Simple Glob at https://research.swtch.com/glob
pub fn globMatch(pattern: []const u8, name: []const u8) bool {
// Current position in the pattern
var p_x: usize = 0;
// Current position in the compared text
... | src/glob.zig |
const std = @import("std");
const Mutex = std.Thread.Mutex;
const expect = std.testing.expect;
extern fn cbtAlignedAllocSetCustomAligned(
alloc: fn (size: usize, alignment: i32) callconv(.C) ?*anyopaque,
free: fn (ptr: ?*anyopaque) callconv(.C) void,
) void;
var allocator: ?std.mem.Allocator = null;
var allo... | libs/zbullet/src/zbullet.zig |
const sf = @import("../sfml.zig");
const Transform = @This();
/// Identity matrix (doesn't do anything)
pub const Identity = Transform{ .matrix = .{ 1, 0, 0, 0, 1, 0, 0, 0, 1 } };
/// Converts this transform to a csfml one
/// For inner workings
pub fn _toCSFML(self: Transform) sf.c.sfTransform {
return @bitCas... | src/sfml/graphics/Transform.zig |
const assert = @import("std").debug.assert;
const sf = struct {
pub usingnamespace @import("../sfml.zig");
pub usingnamespace sf.system;
pub usingnamespace sf.graphics;
};
const ConvexShape = @This();
// Constructor/destructor
/// Creates a new empty convex shape
pub fn create() !ConvexShape {
var s... | src/sfml/graphics/ConvexShape.zig |
const std = @import("std");
pub fn Json(comptime T: type) type {
return struct {
data: T,
pub fn format(self: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
_ = fmt;
_ = options;
// TODO: convert stringify options
... | src/format.zig |
const std = @import("std");
const print = std.debug.print;
const Distances = std.StringHashMap(std.StringHashMap(usize));
pub fn main() anyerror!void {
const global_allocator = std.heap.page_allocator;
var file = try std.fs.cwd().openFile(
"./inputs/day09.txt",
.{
.read = true,
... | src/day09.zig |
const std = @import("std");
const ascii = std.ascii;
const mem = std.mem;
const io = std.io;
const Buffer = std.Buffer;
pub const EXTENSION_NO_INTRA_EMPHASIS = 1;
pub const EXTENSION_TABLES = 2;
pub const EXTENSION_FENCED_CODE = 4;
pub const EXTENSION_AUTOLINK = 8;
pub const EXTENSION_STRIKETHROUGH = 16;
pub const E... | src/markdown/markdown.zig |
const std = @import("std");
const build = std.build;
usingnamespace @import("dcommon.zig");
pub fn getBoard(b: *build.Builder) !Board {
return b.option(Board, "board", "Target board.") orelse
error.UnknownBoard;
}
pub fn getArch(board: Board) Arch {
return switch (board) {
.qemu_arm64, .rockp... | common/dbuild.zig |
const std = @import("std");
const core = @import("../index.zig");
const Coord = core.geometry.Coord;
pub fn Matrix(comptime T: type) type {
return struct {
const Self = @This();
width: u16,
height: u16,
data: []T,
pub fn initEmpty() Self {
return Self{
... | src/core/matrix.zig |
const std = @import("std");
const assert = std.debug.assert;
const expect = std.testing.expect;
/// Similiar to std.meta.eql but pointers are followed.
/// Also Unions and ErrorUnions are excluded.
pub fn eq(a: anytype, b: @TypeOf(a)) bool {
const T = @TypeOf(a);
switch (@typeInfo(T)) {
.Int, .Comptim... | src/meta.zig |
const std = @import("std");
fn root() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
}
fn pathJoinRoot(comptime components: []const []const u8) []const u8 {
var ret = root();
inline for (components) |component|
ret = ret ++ std.fs.path.sep_str ++ component;
return ret;
}
co... | libs/libssh2/libssh2.zig |
const std = @import("std");
const cast = std.meta.cast;
const mode = std.builtin.mode; // Checked arithmetic is disabled in non-debug modes to avoid side channels
pub const Limbs = [4]u64;
/// The function addcarryxU64 is an addition with carry.
/// Postconditions:
/// out1 = (arg1 + arg2 + arg3) mod 2^64
/// ou... | lib/std/crypto/pcurves/p256/p256_scalar_64.zig |
const builtin = @import("builtin");
const expect = std.testing.expect;
const std = @import("../std.zig");
const math = std.math;
/// Returns x rounded to the nearest integer, rounding half away from zero.
///
/// Special Cases:
/// - round(+-0) = +-0
/// - round(+-inf) = +-inf
/// - round(nan) = nan
pub fn rou... | lib/std/math/round.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const builtin = @import("builtin");
const glfw = @import("glfw");
const gpu = @import("gpu");
const platform = @import("platform.zig");
const structs = @import("structs.zig");
const enums = @import("enums.zig");
const Timer = @import("Timer.zig");
const ... | src/Engine.zig |
const std = @import("std");
const network = @import("zig-network");
const uri = @import("zig-uri");
const args_parse = @import("zig-args");
const known_folder = @import("known-folders");
const ssl = @import("zig-bearssl");
const app_name = "gurl";
const TrustLevel = enum {
all,
ca,
tofu,
};
pub fn main(... | src/main.zig |
const std = @import("std");
const root = @import("root");
const builtin = @import("builtin");
pub const KnownFolder = enum {
home,
documents,
pictures,
music,
videos,
desktop,
downloads,
public,
fonts,
app_menu,
cache,
roaming_configuration,
local_configuration,
... | src/pkg/known_folders.zig |
const std = @import("std");
const utils = @import("utils");
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const print = utils.print;
const Instruction = union(enum) { Forward: i32, Down: i32, Up: i32 };
pub fn readInput(arena: *ArenaAllocator, lines_it: *utils.FileLineIterator)... | day2/src/main.zig |
const std = @import("std");
const Sha1 = std.crypto.hash.Sha1;
const opt = @import("opt.zig");
const Allocator = std.mem.Allocator;
const stdout = &std.io.getStdOut().writer();
const warn = std.debug.warn;
const BUFSIZ = 4096;
pub fn sha1(allocator: *Allocator, file: std.fs.File) ![40]u8 {
var h = Sha1.init(.{});
... | src/sha1.zig |
const std = @import("../../index.zig");
const assert = std.debug.assert;
const builtin = @import("builtin");
const vdso = @import("vdso.zig");
pub use switch (builtin.arch) {
builtin.Arch.x86_64 => @import("x86_64.zig"),
builtin.Arch.i386 => @import("i386.zig"),
else => @compileError("unsupported arch"),
};... | std/os/linux/index.zig |
const std = @import("std");
const deps = @import("deps.zig");
// const mode_names = blk: {
// const fields = @typeInfo(std.builtin.Mode).Enum.fields;
// var names: [fields.len][]const u8 = undefined;
// inline for (fields) |field, i| names[i] = "[ " ++ field.name ++ " ] ";
// break :blk names;
// };
//... | build.zig |
const std = @import("std");
const testing = std.testing;
const winmd = @import("winmd.zig");
test "TypeReader with no files" {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer {
const leaked = gpa.deinit();
if (leaked) testing.expect(false); //fail test
}
var allocator = &gpa... | src/winmd_test.zig |
pub const XPS_E_SIGREQUESTID_DUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2142108795));
pub const XPS_E_PACKAGE_NOT_OPENED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2142108794));
pub const XPS_E_PACKAGE_ALREADY_OPENED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2142108793));
pub const... | win32/storage/xps.zig |
const DEBUGMODE = true;
const std = @import("std");
pub const sg = @import("sokol").gfx;
const sapp = @import("sokol").app;
const stime = @import("sokol").time;
const sgapp = @import("sokol").app_gfx_glue;
const sdtx = @import("sokol").debugtext;
const PNG = @import("fileformats").Png;
const vec3 = @import("math.zig... | src/main.zig |
const std = @import("std");
const fmt = std.fmt;
fn testVector(comptime fiat: type, expected_s: []const u8) !void {
// Find the type of the limbs and the size of the serialized representation.
const repr = switch (@typeInfo(@TypeOf(fiat.fromBytes))) {
.Fn => |f| .{
.Limbs = switch (@typeInf... | fiat-zig/src/main.zig |
const wlr = @import("../wlroots.zig");
const os = @import("std").os;
const pixman = @import("pixman");
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const Output = extern struct {
pub const Mode = extern struct {
width: i32,
height: i32,
refresh: i32,
pref... | src/types/output.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const input = @embedFile("../input/day04.txt");
const Passport = struct {
byr: ?[]const u8 = null,
iyr: ?[]const u8 = null,
eyr: ?[]const u8 = null,
hgt: ?[]const u8 = null,
... | src/day04.zig |
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for rest... | engine/build.zig |
const std = @import("std");
const builtin = @import("builtin");
const cpu = builtin.cpu;
const arch = cpu.arch;
const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak;
// This parameter is true iff the target architecture supports the bare minimum
// to implement the atomic load/store in... | lib/std/special/compiler_rt/atomics.zig |
// SPDX-License-Identifier: MIT
// This file is part of the `termcon` project under the MIT license.
const std = @import("std");
const backend = @import("../backend.zig").backend;
const view = @import("../view.zig");
pub const Cell = view.Cell;
pub const Position = view.Position;
pub const Rune = view.Rune;
pub con... | src/view/screen.zig |
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
const Allocator = std.mem.Allocator;
// ustar tar implementation
pub const Header = extern struct {
name: [100]u8,
mode: [7:0]u8,
uid: [7:0]u8,
gid: [7:0]u8,
size: [11:0]u8,
mtime: [11:0]u8,
checks... | src/main.zig |
const std = @import("std");
const upaya = @import("upaya");
const ts = @import("../tilescript.zig");
usingnamespace @import("imgui");
const TileDefinitions = ts.data.TileDefinitions;
pub fn draw(state: *ts.AppState) void {
if (state.prefs.windows.tile_definitions) {
ogSetNextWindowSize(.{ .x = 210, .y = -1... | tilescript/windows/tile_definitions.zig |
const std = @import("std");
const ziglet = @import("../ziglet.zig");
const util = @import("util.zig");
const assert = std.debug.assert;
const native = @import("windows/native.zig");
const mem = std.mem;
pub const Event = ziglet.app.event.Event;
pub const Key = ziglet.app.event.Key;
pub const MouseButton = ziglet.app... | src/app/windows.zig |
const debug = @import("std").debug;
const stdmath = @import("std").math;
const mathutil = @import("../math/MathUtil.zig");
const vec3 = @import("../math/Vec3.zig");
const mat4x4 = @import("../math/Mat4x4.zig");
const quat = @import("../math/Quat.zig");
const Vec3 = vec3.Vec3;
const Mat4x4 = mat4x4.Mat4x4;
const Quat ... | src/presentation/Camera.zig |
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const assert = std.debug.assert;
const Tokenizer = @This();
bytes: []const u8,
index: usize = 0,
pub const Location = struct {
line: usize = 1,
column: usize = 1,
};
const log = std.log.scoped(.tokenizer);
pub const Token = struc... | lib/Tokenizer.zig |
const std = @import("std");
const warn = std.debug.warn;
const TypeId = @import("builtin").TypeId;
const c = @cImport({
@cInclude("sys/socket.h");
@cInclude("netinet/in.h");
@cInclude("unistd.h");
@cInclude("errno.h");
@cInclude("string.h");
@cInclude("errno-access.h");
@cInclude("signal.h"... | src/server.zig |
usingnamespace @import("psptypes.zig");
pub const PspSysMemBlockTypes = extern enum(c_int) {
MemLow = 0,
MemHigh = 1,
MemAddr = 2,
};
pub const SceKernelSysMemAlloc_t = c_int;
// Allocate a memory block from a memory partition.
//
// @param partitionid - The UID of the partition to allocate from.
// @para... | src/psp/sdk/pspsysmem.zig |
const std = @import("std");
const slf = @import("slf.zig");
const args_parser = @import("args");
pub fn printUsage(stream: anytype) !void {
try stream.writeAll(
\\slf-ld [-h] [-o <file>] [-b <base>] [-s 8|16|32|64] [-a <align>] <object> ...
\\
\\Links several SLF files together into a singl... | src/ld.zig |
const nk = @import("nuklear");
const std = @import("std");
const c = @cImport({
@cInclude("GLFW/glfw3.h");
});
const examples = @import("examples.zig");
const heap = std.heap;
const math = std.math;
const mem = std.mem;
const unicode = std.unicode;
pub fn main() !void {
const allocator = heap.c_allocator;
... | examples/main.zig |
const std = @import("std");
const assert = std.debug.assert;
const config = @import("config.zig");
const tb = @import("tigerbeetle.zig");
const Account = tb.Account;
const Transfer = tb.Transfer;
const Commit = tb.Commit;
const CreateAccountsResult = tb.CreateAccountsResult;
const CreateTransfersResult = tb.CreateTr... | src/demo.zig |
const std = @import("std");
const Signal = @import("signal.zig").Signal;
const Delegate = @import("delegate.zig").Delegate;
/// helper used to connect and disconnect listeners on the fly from a Signal. Listeners are wrapped in Delegates
/// and can be either free functions or functions bound to a struct.
pub fn Sink(c... | src/signals/sink.zig |
pub const Window = @import("window.zig").Window;
pub const Widget = @import("widget.zig").Widget;
pub usingnamespace @import("button.zig");
pub usingnamespace @import("label.zig");
pub usingnamespace @import("text.zig");
pub usingnamespace @import("canvas.zig");
pub usingnamespace @import("containers.zig");
pub usingn... | src/main.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const fs = std.fs;
//
// Build
//
pub fn build(b: *std.build.Builder) void {
const pkg_version = "0.0.0";
const abi_version = b.version(0, 0, 0);
const inst_step = b.getInstallStep();
const test_step = b.step("test", "Run tests");
const bench_ste... | build.zig |
pub const __int8_t = i8;
pub const __uint8_t = u8;
pub const __int16_t = c_short;
pub const __uint16_t = c_ushort;
pub const __int32_t = c_int;
pub const __uint32_t = c_uint;
pub const __int64_t = c_longlong;
pub const __uint64_t = c_ulonglong;
pub const __darwin_intptr_t = c_long;
pub const __darwin_natural_t = c_uint... | redismodule.zig |
const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
const meta = std.meta;
const debug = std.debug;
const testing = std.testing;
const TypeInfo = builtin.TypeInfo;
const TypeId = builtin.TypeId;
fn ByteToSliceResult(comptime Elem: type, comptime SliceOrArray: type) type {
if (@typ... | src/generic/slice.zig |
const x86_64 = @import("../index.zig");
const bitjuggle = @import("bitjuggle");
const std = @import("std");
pub const EnsureNoInterrupts = struct {
enabled: bool,
pub fn start() EnsureNoInterrupts {
return .{
.enabled = areEnabled(),
};
}
pub fn end(self: EnsureNoInterrupt... | src/instructions/interrupts.zig |
const std = @import("std");
const builtin = @import("builtin");
const cstr = std.cstr;
const File = std.os.File;
const c = @cImport({
@cInclude("stdio.h");
});
// File access
var stdin_file: File = undefined;
export var stdin = &stdin_file;
var stdout_file: File = undefined;
export var stdout = &stdout_file;
... | src/stdio.zig |
pub const Scancode = enum(u8) {
// Unknown = 0x00
// Escape
EscPressed = 0x01,
// Digits
OnePressed = 0x02,
TwoPressed = 0x03,
ThreePressed = 0x04,
FourPressed = 0x05,
FivePressed = 0x06,
SixPressed = 0x07,
SevenPressed = 0x08,
EightPressed = 0x09,
NinePressed = 0x... | kernel/arch/x86/keyboard.zig |
const std = @import("std");
const assert = std.debug.assert;
const windows = std.os.windows;
const L = std.unicode.utf8ToUtf16LeStringLiteral;
const zwin32 = @import("zwin32");
const d3d12 = zwin32.d3d12;
const kernel32 = windows.kernel32;
const ole32 = windows.ole32;
const shell32 = windows.shell32;
const HMODULE = wi... | libs/zpix/src/zpix.zig |
const std = @import("std");
const string = []const u8;
const range = @import("range").range;
pub fn fmtByteCountIEC(alloc: std.mem.Allocator, b: u64) !string {
return try reduceNumber(alloc, b, 1024, "B", "KMGTPEZY");
}
pub fn reduceNumber(alloc: std.mem.Allocator, input: u64, comptime unit: u64, comptime base: s... | src/lib.zig |
const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
const Allocator = mem.Allocator;
const assert = std.debug.assert;
const _chunk = @import("./chunk.zig");
const _obj = @import("./obj.zig");
const _token = @import("./token.zig");
const _vm = @import("./vm.zig");
const _value = @import... | src/compiler.zig |
const std = @import("std");
const rpc = @import("antiphony");
const CreateError = error{ OutOfMemory, UnknownCounter };
const UsageError = error{ OutOfMemory, UnknownCounter };
// Define our RPC service via function signatures.
const RcpDefinition = rpc.CreateDefinition(.{
.host = .{
.createCounter = fn (... | examples/linux.zig |
const std = @import("std");
const backend = @import("backend.zig");
const Widget = @import("widget.zig").Widget;
const lasting_allocator = @import("internal.zig").lasting_allocator;
const Size = @import("data.zig").Size;
const Rectangle = @import("data.zig").Rectangle;
pub const Layout = fn (peer: Callbacks, widgets: ... | src/containers.zig |
const std = @import("std");
const mem = std.mem;
const Ideographic = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 12294,
hi: u21 = 201546,
pub fn init(allocator: *mem.Allocator) !Ideographic {
var instance = Ideographic{
.allocator = allocator,
.array = try allocator.alloc(bool, ... | src/components/autogen/PropList/Ideographic.zig |
const sabaton = @import("../../sabaton.zig");
comptime {
asm(
\\ .section .data
\\ .balign 8
\\ framebuffer_tag:
\\ .8byte 0x506461d2950408fa // framebuffer identifier
\\ .8byte 0 // next
\\ .8byte 0 // addr
\\ .2byte 720 // wid... | src/platform/pine_aarch64/display.zig |
const mon13 = @import("mon13");
const std = @import("std");
pub export const mon13_gregorian = mon13.gregorian;
pub export const mon13_gregorian_year_zero = mon13.gregorian_year_zero;
pub export const mon13_tranquility = mon13.tranquility;
pub export const mon13_tranquility_year_zero = mon13.tranquility_year_zero;
pub... | binding/c/bindc.zig |
const std = @import("std");
const ray = @import("../c.zig").ray;
const main = @import("../main.zig");
const dice = @import("./dice.zig");
const CommandLineOptions = @import("../args.zig").CommandLineOptions;
pub const State = main.State;
pub const GameScreenId = enum {
MainMenu,
Game,
WinScreen,
};
var ... | src/gui/ui.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);
}
const Vec2 = tools.Vec2;
const Map = tools.Map(u8, 85, 85, false);
const PoiDist = struct ... | 2019/day18.zig |
const builtin = @import("builtin");
const TypeId = builtin.TypeId;
const std = @import("std");
const math = std.math;
const assert = std.debug.assert;
const warn = std.debug.warn;
const ft2 = @import("freetype2.zig");
fn mapCtoZigTypeFloat(comptime T: type) type {
return switch (@sizeOf(T)) {
2 => f16,
... | test.zig |
pub const bucket_count: u16 = 154;
pub const max_bucket_length: u16 = 4;
pub const max_hash_used: u16 = 152;
pub const hash_table = [_]u32 {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x01fc207f, 0x0... | kernel/platform/code_point_437.zig |
pub const X86 = enum(usize) {
restart_syscall = 0,
exit = 1,
fork = 2,
read = 3,
write = 4,
open = 5,
close = 6,
waitpid = 7,
creat = 8,
link = 9,
unlink = 10,
execve = 11,
chdir = 12,
time = 13,
mknod = 14,
chmod = 15,
lchown = 16,
@"break" = 17,... | lib/std/os/linux/syscalls.zig |
const std = @import("std");
const term = @import("ansi-term");
usingnamespace @import("ast.zig");
usingnamespace @import("code_formatter.zig");
usingnamespace @import("code_runner.zig");
usingnamespace @import("common.zig");
usingnamespace @import("dot_printer.zig");
usingnamespace @import("error_handler.zig")... | src/compiler.zig |
const sf = struct {
pub usingnamespace @import("../sfml.zig");
pub usingnamespace sf.system;
pub usingnamespace sf.graphics;
};
const View = @This();
/// Creates a view from a rectangle
pub fn fromRect(rect: sf.FloatRect) View {
var ret: View = undefined;
ret.center = rect.getCorner();
ret.si... | src/sfml/graphics/View.zig |
const std = @import("std");
const testing = std.testing;
const tok = @import("./token.zig");
const log = std.log.scoped(.lexer);
const ascii = std.ascii;
const Token = tok.Token;
const Cursor = tok.Cursor;
const tfmt = @import("./fmt.zig");
const colors = @import("../term/colors.zig");
const Color = colors.Color;
const... | src/lang/lexer.zig |
const Server = @This();
const std = @import("std");
const json = @import("json.zig");
const utils = @import("utils.zig");
const types = @import("types.zig");
const offsets = @import("offsets.zig");
const RequestHeader = @import("RequestHeader.zig");
pub const ServerMessage = union(enum) {
request: types.requests.... | src/Server.zig |
const std = @import("std");
usingnamespace @import("common/shader.zig");
usingnamespace @import("common/font.zig");
usingnamespace @import("ui_builder");
usingnamespace @import("zalgebra");
const glfw = @import("common/c.zig").glfw;
usingnamespace @import("common/c.zig").gl;
var gpa = std.heap.GeneralPurposeAllocator... | demo/glfw_gl3.zig |
const std = @import("std");
const warn = std.debug.print;
const Allocator = std.mem.Allocator;
const AnyErrorOutStream = std.io.OutStream(anyerror);
const enabled = false;
/// Formerly LoggingAllocator
/// This allocator is used in front of another allocator and logs to the provided stream
/// on every call to the a... | src/warning_allocator.zig |
const std = @import("std");
const main = @import("../main.zig");
const Op = @import("Op.zig");
const Reg8 = main.Cpu.Reg8;
const Reg16 = main.Cpu.Reg16;
test "" {
_ = @import("impl_daa_test.zig");
}
pub fn Result(lengt: u2, duration: anytype) type {
if (duration.len == 1) {
return extern struct {
... | src/Cpu/impl.zig |
const std = @import("../std.zig");
const mem = std.mem;
const math = std.math;
const debug = std.debug;
const htest = @import("test.zig");
const RoundParam = struct {
a: usize,
b: usize,
c: usize,
d: usize,
x: usize,
y: usize,
};
fn roundParam(a: usize, b: usize, c: usize, d: usize, x: usize, ... | lib/std/crypto/blake2.zig |
usingnamespace @import("combn.zig");
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
// Confirms that a direct left-recursive grammar for an empty language actually rejects
// all input strings, and does not just hang indefinitely:
//
// ```ebnf
// Expr = Expr ;
// Grammar = Expr ;
// ``... | src/combn/test_complex.zig |
const Allocator = std.mem.Allocator;
const TcpConnection = @import("connection.zig").TcpConnection;
const Method = @import("http").Method;
const network = @import("network");
const Response = @import("response.zig").Response;
const std = @import("std");
const StreamingResponse = @import("response.zig").StreamingRespons... | src/client.zig |
pub const platform = @import("root");
pub const io_impl = @import("io/io.zig");
pub const util = @import("lib/util.zig");
pub const dtb = @import("lib/dtb.zig");
pub const pmm = @import("lib/pmm.zig");
pub const acpi = @import("platform/acpi.zig");
pub const paging = @import("platform/paging.zig");
pub const pci = @im... | src/sabaton.zig |
const assert = @import("std").debug.assert;
const testing = @import("std").testing;
const Image = @import("zigimg").Image;
const PixelFormat = @import("zigimg").PixelFormat;
usingnamespace @import("helpers.zig");
test "Create Image Bpp1" {
const image = try Image.create(testing.allocator, 24, 32, PixelFormat.Bpp1)... | tests/image_test.zig |
const std = @import("std");
const expect = std.testing.expect;
const test_allocator = std.testing.allocator;
pub fn main() anyerror!void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
const str = @embedFile("../input.txt");
var valu... | day01/src/main.zig |
// Todo: the order of the bits in the deflate format is different.
const std = @import("std");
const expect = std.testing.expect;
/// Appendable list of individual bits.
pub const BitList = struct {
bytes: std.ArrayList(u8) = undefined,
bit_index: u32 = 0,
pub fn init(a: *std.mem.Allocator) !BitList {
... | src/bit_list.zig |
const wlr = @import("../wlroots.zig");
const wayland = @import("wayland");
const wl = wayland.server.wl;
const xdg = wayland.server.xdg;
pub const XdgShell = extern struct {
global: *wl.Global,
clients: wl.list.Head(XdgClient, "link"),
popup_grabs: wl.list.Head(XdgPopupGrab, "link"),
ping_timeout: u32... | src/types/xdg_shell.zig |
const std = @import( "std" );
const nan = std.math.nan;
const isNan = std.math.isNan;
usingnamespace @import( "util.zig" );
pub const Axis = struct {
tieFrac: f64,
tieCoord: f64,
scale: f64,
/// Size may be Nan if this axis isn't visible yet!
viewport_PX: Interval,
/// If size is Nan, this wi... | src/core/core.zig |
const std = @import("std");
const c = @import("internal/c.zig");
const git = @import("git.zig");
/// Options for connecting through a proxy.
/// Note that not all types may be supported, depending on the platform and compilation options.
pub const ProxyOptions = struct {
/// The type of proxy to use, by URL, auto... | src/proxy.zig |
// SPDX-License-Identifier: MIT
// This file is part of the `termcon` project under the MIT license.
// WINAPI defines not made in standard library as of Zig commit 84d50c892
pub extern "kernel32" fn SetConsoleMode(hConsoleHandle: windows.HANDLE, dwMode: windows.DWORD) callconv(.Stdcall) windows.BOOL;
pub extern "ker... | src/backend/windows.zig |
// [~] const char* cm_get_error(void);
// [x] void cm_init(int samplerate);
// [~] void cm_set_lock(cm_EventHandler lock);
// [x] void cm_set_master_gain(double gain);
// [ ] void cm_process(cm_Int16 *dst, int len);
// [ ] cm_Source* cm_new_source(const cm_SourceInfo *info);
// [ ] cm_Source* cm_new_source_from_file(c... | src/audio/mixer.zig |
const std = @import("std");
const testing = std.testing;
pub const terminfo = @import("terminfo.zig");
const History = @import("history.zig");
const terminal = @import("terminal.zig");
const Self = @This();
alloc: *std.mem.Allocator,
file: std.fs.File,
history: History,
terminfo: terminfo.TermInfo,
buffer: std.Array... | src/main.zig |
const std = @import("std");
usingnamespace @import("../json.zig");
const Allocator = std.mem.Allocator;
const Parser = std.json.Parser;
const ObjectMap = std.json.ObjectMap;
const assert = std.debug.assert;
const StoS = std.StringHashMap([]const u8);
const SessionGetRequest = struct {
username: []const u8,
p... | simple-server/main.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const Metadata = @import("metadata.zig").Metadata;
const vorbis = @import("vorbis.zig");
pub const flac_stream_marker = "fLaC";
pub const block_type_vorbis_comment = 4;
/// Expects the stream to be at the start of the FLAC stream marker (i.e.
/// any I... | src/flac.zig |
const terminal = @import("./vga.zig").terminal;
const IdtEntry = struct {
func_offset_low_word: u16,
selector: u16,
dcount: u8,
attribute: u8,
func_offset_high_word: u16,
pub fn setHandler(self: *IdtEntry, attr: u8, handler: HandlerFunc) void {
const handler_ptr = @ptrToInt(handler);
... | x86os/src/idt.zig |
pub const lib = struct {
pub const Bss = struct {
pub fn prepare() void {
@memset(@ptrCast([*]u8, &__bss_start), 0, @ptrToInt(&__bss_end) - @ptrToInt(&__bss_start));
}
};
pub const Adc = struct {
pub const busy_registers = mmio(0x40007400, extern struct {
bus... | lib_basics.zig |
const std = @import("std");
const iup = @import("iup.zig");
const c = @cImport({
@cInclude("iup.h");
});
const trait = std.meta.trait;
pub const Handle = c.Ihandle;
pub const NativeCallbackFn = c.Icallback;
pub const consts = struct {
pub const IUP_ERROR = c.IUP_ERROR;
pub const IUP_NOERROR = c.IUP_NOER... | src/interop.zig |
const std = @import("std");
const sqlite = @import("sqlite");
const manage_main = @import("main.zig");
const libpcre = @import("libpcre");
const Context = manage_main.Context;
const log = std.log.scoped(.afind);
const VERSION = "0.0.1";
const HELPTEXT =
\\ afind: execute queries on the awtfdb index
\\
\\ ... | src/find_main.zig |
//--------------------------------------------------------------------------------
// Section: Types (1)
//--------------------------------------------------------------------------------
pub const WSL_DISTRIBUTION_FLAGS = enum(u32) {
NONE = 0,
ENABLE_INTEROP = 1,
APPEND_NT_PATH = 2,
ENABLE_DRIVE_MOUNT... | win32/system/subsystem_for_linux.zig |
const std = @import("std");
const alka = @import("alka");
const gui = @import("gui.zig");
const game = @import("game.zig");
usingnamespace alka.log;
pub const mlog = std.log.scoped(.app);
pub const log_level: std.log.Level = .debug;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
c... | examples/example_shooter_game/src/main.zig |
const gllparser = @import("../gllparser/gllparser.zig");
const Error = gllparser.Error;
const Parser = gllparser.Parser;
const ParserContext = gllparser.Context;
const Result = gllparser.Result;
const NodeName = gllparser.NodeName;
const std = @import("std");
const testing = std.testing;
const mem = std.mem;
pub cons... | src/combn/parser/literal.zig |