code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
/// The Layout of an I/O Port
/// You cannot have two channels with the same name
/// in your layout.
pub const IOLayout = []const Channel;
/// Represents a single channel in the layout of a whole
/// I/O Port
pub const Channel = struct {
pub const Arrangement = union(enum) {
C... | src/audio_io.zig |
const upaya = @import("upaya");
const sokol = @import("sokol");
const Texture = upaya.Texture;
const std = @import("std");
const uianim = @import("uianim.zig");
const tcache = @import("texturecache.zig");
const slides = @import("slides.zig");
const parser = @import("parser.zig");
const render = @import("sliderenderer.z... | src/main.zig |
pub const StatusCode = enum(u32) {
/// Continue indicates that the initial part of a request has been received and has not yet been rejected by the server.
Continue = 100,
/// SwitchingProtocols indicates that the server understands and is willing to comply with the client's request, via the Upgrade header... | zig/src/olin/http/status_codes.zig |
const std = @import("std");
const io = std.io;
const os = std.os;
pub fn main() !void {
// Get stdin and stdout
const in_stream = io.getStdIn();
// const out_stream = io.getStdOut();
// Save current termios
const original_termios = try os.tcgetattr(in_stream.handle);
// Set new termios
va... | tests/keypress.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
test "examples" {
const test1 = try aoc.Ints(aoc.talloc, i64, aoc.test1file);
defer aoc.talloc.free(test1);
const inp = try aoc.Ints(aoc.talloc, i64, aoc.inputfile);
defer aoc.talloc.free(inp);
try aoc.assertEq(@as(i64, 127), part1(te... | 2020/09/aoc.zig |
const index = @import("index.zig");
const builtin = @import("builtin");
const std = @import("std");
const os = std.os;
const is_posix = builtin.os != builtin.Os.windows;
const is_windows = builtin.os == builtin.Os.windows;
pub const Fs = struct {
pub fn init() Fs {
return Fs{};
}
pub fn deinit(fs... | src/os.zig |
const std = @import("std");
const opt = @import("opt.zig");
const warn = std.debug.warn;
//Globals for flags
var ALPHA: bool = false;
var RECUR: bool = false;
var ALL: bool = false;
var TABS: usize = 0;
const lsFlags = enum {
All,
Alpha,
Recursive,
Help,
};
var flags = [_]opt.Flag(lsFlags){
.{
... | src/ls.zig |
const std = @import("std");
const zang = @import("zang");
const note_frequencies = @import("zang-12tet");
pub const PhaseModOscillator = struct {
pub const num_outputs = 1;
pub const num_temps = 2;
pub const Params = struct {
sample_rate: f32,
freq: f32,
relative: bool,
// r... | examples/modules.zig |
const fmath = @import("index.zig");
pub fn log10(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(log10f, x),
f64 => @inlineCall(log10d, x),
else => @compileError("log10 not implemented for " ++ @typeName(T)),
}
}
fn log10f(x_: f32) -> f32 {
const i... | src/log10.zig |
const std = @import("std");
const mem = std.mem;
const builtin = @import("builtin");
pub const c = @import("./c.zig");
pub usingnamespace @import("./monitor.zig");
pub usingnamespace @import("./window.zig");
/// Video mode type.
pub const VideoMode = c.GLFWvidmode;
/// Gamma ramp type.
pub const GammaRamp = struct ... | src/main.zig |
const std = @import("std");
const common = @import("../utils/common.zig");
const FV = common.FV;
pub const HMGET = struct {
key: []const u8,
fields: []const []const u8,
/// Instantiates a new HMGET command.
pub fn init(key: []const u8, fields: []const []const u8) HMGET {
return .{ .key = key,... | src/commands/hashes/hmget.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");
/// The diff object that contains all individual file deltas.
/// A `diff` represents the cumulative list of differences between two sna... | src/diff.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 Vec3 = struct {
x: i64,
y: i64,
z: i64,
};
const Part = struct {
p: V... | 2017/day20.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const assert = std.debug.assert;
const print = std.debug.print;
const EOL = '\n';
pub fn readInput(allocator: *Allocator) !ArrayList(u32) {
var entries = ArrayList(u32).init(allocator);
const file = try std.fs.c... | src/day01.zig |
const std = @import("std");
const panic = std.debug.panic;
const builtin = @import("builtin");
const warn = std.debug.warn;
const join = std.fs.path.join;
const pi = std.math.pi;
usingnamespace @import("c.zig");
const Camera = @import("camera.zig").Camera;
const Shader = @import("shader.zig").Shader;
const glm = @im... | src/1_7_camera.zig |
const std = @import("std");
const upaya = @import("upaya");
const ts = @import("../tilescript.zig");
usingnamespace @import("imgui");
const object_editor = @import("object_editor.zig");
var filter_buffer: [25]u8 = undefined;
var filter = false;
var selected_index: usize = std.math.maxInt(usize);
pub fn draw(state: *... | tilescript/windows/objects.zig |
// zig build-exe examples/basic.zig --pkg-begin ziglet src/index.zig --pkg-end
const std = @import("std");
const ziglet = @import("ziglet");
const app = ziglet.app;
const Key = app.event.Key;
const Event = app.event.Event;
const Window = app.Window;
pub fn main() !void {
var direct_allocator = std.heap.DirectA... | examples/events.zig |
const std = @import("std");
const mem = std.mem;
const fmt = std.fmt;
const testing = std.testing;
use @import("ip");
test "IpV4Address.fromSlice()" {
var array = [_]u8{ 127, 0, 0, 1 };
const ip = IpV4Address.fromSlice(&array);
testing.expect(IpV4Address.Localhost.equals(ip));
}
test "IpV4Address.fromAr... | test/ipv4.zig |
const std = @import("std");
const testing = std.testing;
const Allocator = std.mem.Allocator;
pub const Error = error{
KeysLikelyNotUnique,
OutOfMemory,
};
pub inline fn murmur64(h: u64) u64 {
var v = h;
v ^= v >> 33;
v *%= 0xff51afd7ed558ccd;
v ^= v >> 33;
v *%= 0xc4ceb9fe1a85ec53;
v ... | src/util.zig |
const macro = @import("pspmacros.zig");
comptime {
asm (macro.import_module_start("sceHttp", "0x00090011", "83"));
asm (macro.import_function("sceHttp", "0x0282A3BD", "sceHttpGetContentLength"));
asm (macro.import_function("sceHttp", "0x03D9526F", "sceHttpSetResolveRetry"));
asm (macro.import_function(... | src/psp/nids/psphttp.zig |
const c = @cImport({
@cInclude("cfl_valuator.h");
});
const widget = @import("widget.zig");
pub const Valuator = struct {
inner: ?*c.Fl_Slider,
pub fn new(x: i32, y: i32, w: i32, h: i32, title: [*c]const u8) Valuator {
const ptr = c.Fl_Slider_new(x, y, w, h, title);
if (ptr == null) unreach... | src/valuator.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const Allocator = std.mem.Allocator;
const bog = @import("bog.zig");
const Vm = bog.Vm;
const Errors = bog.Errors;
pub fn run(gpa: *Allocator, reader: anytype, writer: anytype) !void {
var vm = Vm.init(gpa, .{ .repl = true, .import_files = true });
d... | src/repl.zig |
const std = @import("std");
const testing = std.testing;
const CircBuf = struct {
head: usize = 0,
tail: usize = 0,
buf: [*]u8 = null,
buf_len: usize = 0,
const Error = error{
InvalidParam,
Empty,
};
pub fn init(buf: [*]u8, buf_len: usize) CircBuf {
std.debug.asser... | circbuf/u8_circbuf.zig |
const zigvale = @import("zigvale").v2;
// Allocate a stack
// We add an extra bit in the form of a null terminator at the end, which allows us to point to the end of the stack
export var stack_bytes: [16 * 1024:0]u8 align(16) linksection(".bss") = undefined;
// This is the stivale2 header. Contained in the ELF sectio... | src/kernel.zig |
const std = @import("std");
const debug = std.debug;
const math = std.math;
const mem = std.mem;
const testing = std.testing;
/// Tests that an iterator returns all the items in the `expected`
/// slice, and no more.
pub fn testIt(_it: anytype, hint: LengthHint, expected: anytype) !void {
var it = iterator(_it);
... | ziter.zig |
const std = @import("std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const mem = std.mem;
const math = std.math;
const ziggurat = @import("rand/ziggurat.zig");
const maxInt = std.math.maxInt;
// When you ne... | lib/std/rand.zig |
const std = @import("std");
const io = std.io;
const fs = std.fs;
const mem = std.mem;
const process = std.process;
const Allocator = mem.Allocator;
const ArrayList = std.ArrayList;
const ast = std.zig.ast;
const Module = @import("Module.zig");
const link = @import("link.zig");
const Package = @import("Package.zig");
c... | src-self-hosted/main.zig |
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
const builtin = @import("builtin");
const TypeId = builtin.TypeId;
/// Returns the natural logarithm of x.
///
/// Special Cases:
/// - ln(+inf) = +inf
/// - ln(0) = -inf
/// - ln(x) = nan if x < 0
/// - ln(nan) ... | lib/std/math/ln.zig |
const __fixtfsi = @import("fixtfsi.zig").__fixtfsi;
const std = @import("std");
const math = std.math;
const testing = std.testing;
const warn = std.debug.warn;
fn test__fixtfsi(a: f128, expected: i32) void {
const x = __fixtfsi(a);
//warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", a, @bitCast(u128, ... | lib/std/special/compiler_rt/fixtfsi_test.zig |
const std = @import("std.zig");
const crypto = std.crypto;
const Hasher = crypto.auth.siphash.SipHash128(1, 3); // provides enough collision resistance for the CacheHash use cases, while being one of our fastest options right now
const fs = std.fs;
const base64 = std.base64;
const ArrayList = std.ArrayList;
const asser... | lib/std/cache_hash.zig |
const uefi = @import("std").os.uefi;
const BootServices = uefi.tables.BootServices;
const ConfigurationTable = uefi.tables.ConfigurationTable;
const Handle = uefi.Handle;
const RuntimeServices = uefi.tables.RuntimeServices;
const SimpleTextInputProtocol = uefi.protocols.SimpleTextInputProtocol;
const SimpleTextOutputPr... | lib/std/os/uefi/tables/system_table.zig |
// https://github.com/P-H-C/phc-string-format
const std = @import("std");
const fmt = std.fmt;
const io = std.io;
const mem = std.mem;
const meta = std.meta;
const fields_delimiter = "$";
const version_param_name = "v";
const params_delimiter = ",";
const kv_delimiter = "=";
pub const Error = std.crypto.errors.Enco... | lib/std/crypto/phc_encoding.zig |
const std = @import("std");
const builtin = @import("builtin");
// const build_options = @import("build_options")
const zinput = @import("src/zinput/src/main.zig");
var builder: *std.build.Builder = undefined;
pub fn config(step: *std.build.Step) anyerror!void {
@setEvalBranchQuota(2500);
std.debug.warn("Wel... | build.zig |
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
/// Atomic counter
///
/// When used with single threaded builds, will defer to `NonAtomic`
pub const Atomic = if (builtin.single_threaded) NonAtomic else struct {
const T = usize;
pub const MAX = std.math.maxInt(T);
... | src/main.zig |
pub const enum3 = []u64 {
0x4e2e2785c3a2a20b,
0x240a28877a09a4e1,
0x728fca36c06cf106,
0x1016b100e18e5c17,
0x3159190e30e46c1d,
0x64312a13daa46fe4,
0x7c41926c7a7122ba,
0x08667a3c8dc4bc9c,
0x18dde996371c6060,
0x297c2c31a31998ae,
0x368b870de5d93270,
0x57d561def4a9ee32,
0x... | std/fmt/errol/enum3.zig |
pub const Backend = @import("backend.zig").Backend;
pub const Device = @import("backend/session.zig").Device;
pub const Session = @import("backend/session.zig").Session;
pub const DmabufAttributes = @import("render/dmabuf.zig").DmabufAttributes;
pub const Renderer = @import("render/renderer.zig").Renderer;
pub const ... | src/wlroots.zig |
usingnamespace @import("PeerType/PeerType.zig");
const std = @import("std");
fn MixtimeType(comptime description: anytype, comptime Tuple: type) type {
const Context = enum { compiletime, runtime };
const StructField = std.builtin.TypeInfo.StructField;
const tuple_fields = std.meta.fields(Tuple);
var s... | src/mixtime.zig |
//--------------------------------------------------------------------------------
// Section: Types (3)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows10.0.14393'
const IID_IRadialControllerInterop_Value = @import("../../zig.zig").G... | win32/ui/input/radial.zig |
const std = @import("std");
const json = std.json;
const debug = std.debug;
const io = std.io;
const fs = std.fs;
const mem = std.mem;
const zig = std.zig;
const protocol = @import("protocol.zig");
const types = @import("types.zig");
const serial = @import("json_serialize.zig");
const data = @import("data.zig");
pub ... | src/server.zig |
const std = @import("std");
const server = &@import("../main.zig").server;
const Error = @import("../command.zig").Error;
const PhysicalDirection = @import("../command.zig").PhysicalDirection;
const Orientation = @import("../command.zig").Orientation;
const Seat = @import("../Seat.zig");
const View = @import("../Vie... | source/river-0.1.0/river/command/move.zig |
const Self = @This();
const std = @import("std");
const mem = std.mem;
const wlr = @import("wlroots");
const wayland = @import("wayland");
const wl = wayland.server.wl;
const river = wayland.server.river;
const server = &@import("main.zig").server;
const util = @import("util.zig");
const Layout = @import("Layout.zi... | source/river-0.1.0/river/LayoutManager.zig |
fn Borrow(comptime T: type, comptime borrows: *usize) type {
comptime var alive = true;
return struct {
pointer: *const T,
pub fn read(self: *const @This(), comptime uniq: anytype) T {
if (!alive)
@compileError("Borrow no longer alive!");
return self.po... | src/main.zig |
const std = @import("std");
const util = @import("util");
const input = @embedFile("13.txt");
usingnamespace comptime blk: {
@setEvalBranchQuota(input.len * 20);
var offset: u32 = 0;
var buf: []const [2]u32 = &[_][2]u32{};
var lines = std.mem.tokenize(input, "\n");
const timestamp = util.parseUint(... | 2020/13.zig |
const sf = @import("../sfml.zig");
const std = @import("std");
const VertexArray = @This();
// Constructors/destructors
/// Creates an empty vertex array
pub fn create() !VertexArray {
var va = sf.c.sfVertexArray_create();
if (va) |vert| {
return VertexArray{ ._ptr = vert };
} else return sf.Err... | src/sfml/graphics/VertexArray.zig |
const std = @import("std");
const zua = @import("zua.zig");
const Function = zua.object.Function;
const OpCode = zua.opcodes.OpCode;
const Instruction = zua.opcodes.Instruction;
const max_stack_size = zua.parse.max_stack_size;
pub fn checkcode(function: *const Function) !void {
_ = try symbexec(function, null);
}
... | src/debug.zig |
const std = @import("std");
const c = @cImport(@cInclude("lmdb.h"));
const os = std.os;
const fs = std.fs;
const mem = std.mem;
const math = std.math;
const meta = std.meta;
const debug = std.debug;
const testing = std.testing;
const panic = debug.panic;
const assert = debug.assert;
pub const Environment = packed st... | lmdb.zig |
const std = @import("std");
const builtin = std.builtin;
const assert = std.debug.assert;
const testing = std.testing;
const math = std.math;
usingnamespace @import("../include/psprtc.zig");
usingnamespace @import("../include/pspthreadman.zig");
/// Spurious wakeups are possible and no precision of timing is guarante... | src/psp/os/time.zig |
const std = @import("std");
const Builder = std.build.Builder;
const libxml2 = @import("vendor/zig-libxml2/libxml2.zig");
const ScdocStep = @import("src-build/ScdocStep.zig");
// Zig packages in use
const pkgs = struct {
const flightplan = pkg("src/main.zig");
};
/// pkg can be called to get the Pkg for this lib... | build.zig |
const ComputePassTimestampWrite = @import("structs.zig").ComputePassTimestampWrite;
const ComputePipeline = @import("ComputePipeline.zig");
const QuerySet = @import("QuerySet.zig");
const BindGroup = @import("BindGroup.zig");
const Buffer = @import("Buffer.zig");
const ComputePassEncoder = @This();
/// The type erase... | gpu/src/ComputePassEncoder.zig |
const std = @import("std");
const testing = std.testing;
const mem = std.mem;
const assert = std.debug.assert;
const ArrayList = std.ArrayList;
const Allocator = std.mem.Allocator;
const DW = std.dwarf;
// zig fmt: off
/// Definitions of all of the x64 registers. The order is semantically meaningful.
/// The register... | src/arch/x86_64/bits.zig |
const std = @import("std");
// The buffer needed for the hex values. This includes two spaces at the
// beginning, and the extra space in the middle.
const hex_size = 3 * 16 + 2;
const ascii_size = 16;
const HexBuf = std.BoundedArray(u8, hex_size);
const AsciiBuf = std.BoundedArray(u8, ascii_size);
// Convenience f... | src/pdump.zig |
const std = @import("std");
const mem = std.mem;
const OtherNumber = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 178,
hi: u21 = 127244,
pub fn init(allocator: *mem.Allocator) !OtherNumber {
var instance = OtherNumber{
.allocator = allocator,
.array = try allocator.alloc(bool, 12... | src/components/autogen/DerivedGeneralCategory/OtherNumber.zig |
//--------------------------------------------------------------------------------
// Section: Types (9)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows8.0'
const IID_IWebApplicationScriptEvents_Value = Guid.initString("7c3f6998-1567... | win32/system/diagnostics/debug/web_app.zig |
const std = @import("std");
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 Replacement = struct {
from: []const u8,
to: []const u8,
};
fn parse_line(line: []const u8) ?Replacement {
... | 2015/day19.explose.zig |
const std = @import("std");
const assert = std.debug.assert;
const expect = std.testing.expect;
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const fixedBufferStream = std.io.fixedBufferStream;
const countingOutStream = std.io.countingOutStream;
const ExecError = error{
InvalidOpcode,
I... | zig/07.zig |
const std = @import("std");
const tht = @import("tenhourtime.zig");
const c = @cImport({
@cInclude("libxfce4panel/xfce-panel-plugin.h");
});
const OverflowError = error{OverflowError};
const EachTick = extern struct {
label: [*c]c.GtkLabel,
previi: u8,
pub const Error = OverflowError;
fn update(any... | src/panel.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const data = @embedFile("data/day21.txt");
const EntriesList = std.ArrayList(Record);
const FoodSet = BitSet(200);
const AllerSet = BitSet(8);
const Record = struct {
foods: FoodSet =... | src/day21.zig |
const std = @import("std");
const assert = std.dbg.assert;
const math = std.math;
const epsilon : f32 = 0.00001;
pub const Vec3 = extern struct {
v: [3]f32,
pub inline fn init( x: f32, y : f32, z: f32 ) Vec3 {
return .{ .v = [_]f32{ x, y, z } };
}
pub inline fn initZero() Vec3 {
c... | src/vecmath_j.zig |
const std = @import("std");
const Atomic = std.atomic.Atomic;
/// Multiple-Producer single-consumer struct.
/// It's safe to send between threads, but only one
/// thread should call pop()
pub fn Queue(comptime T: type) type {
return struct {
pub const Node = struct {
next: Atomic(?*Node) = Ato... | src/mpsc.zig |
const std = @import("std");
const json = @import("../json.zig");
const common = @import("common.zig");
const general = @import("general.zig");
const language_features = @import("language_features.zig");
/// Params of a response (result)
pub const ResponseParams = union(enum) {
none: void,
string: []const u8,
... | src/types/responses.zig |
const std = @import("std");
const common = @import("common.zig");
const VertexBufferHandle = common.VertexBufferHandle;
const VertexLayoutDesc = common.VertexLayoutDesc;
const VertexLayoutHandle = common.VertexLayoutHandle;
const TextureFormat = common.TextureFormat;
const TextureHandle = common.TextureHandle;
const C... | modules/graphics/src/metal.zig |
const std = @import("std");
const Builder = std.build.Builder;
const pkgs = @import("deps.zig").pkgs;
const Artifacts = enum {
library, tests, all
};
const ContextErrors = error {
UnsupportedGLESVersion
};
const Context = struct {
library_path: ?[]const u8,
include_path: ?[]const u8,
mode: std.builtin.Mode... | build.zig |
const std = @import("std");
const builtin = std.builtin;
const crypto = std.crypto;
const debug = std.debug;
const mem = std.mem;
const meta = std.meta;
const fiat = @import("p256_64.zig");
const NonCanonicalError = crypto.errors.NonCanonicalError;
const NotSquareError = crypto.errors.NotSquareError;
const Limbs = ... | lib/std/crypto/pcurves/p256/field.zig |
const std = @import("std");
usingnamespace @import("av-common.zig");
const SourceFile = struct {
formatContext: [*c]AVFormatContext = undefined,
codecContext: [*c]AVCodecContext = undefined,
frame: [*c]AVFrame = undefined,
packet: [*c]AVPacket = undefined,
streamIndex: usize = undefined,
pub ... | nativemap/src/audio-extractor.zig |
const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const linux = std.os.linux;
const SYS = linux.SYS;
const socklen_t = linux.socklen_t;
const iovec = std.os.iovec;
const iovec_const = std.os.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
const sockaddr ... | lib/std/os/linux/mips.zig |
const std = @import("std");
const Deps = @import("Deps.zig");
const slimy_version = std.SemanticVersion.parse("0.1.0-dev") catch unreachable;
pub fn build(b: *std.build.Builder) !void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const singlethread = b.option(bool... | build.zig |
const std = @import("std");
const fs = std.fs;
const print = std.debug.print;
const mem = std.mem;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = &gpa.allocator;
const input = try fs.cwd().readFileAlloc(allocator, "data/input_19_1.txt", std.math.maxInt(usize));... | 2020/src/day_19.zig |
const std = @import("std");
const Format = @import("format.zig").Format;
const testing = std.testing;
const value = @import("value.zig");
const builtin = @import("builtin");
pub const fix_map_max = 15;
pub const map16_max = 65535;
pub const fix_array_max = 15;
pub const array16_max = 65535;
const fix_str_max = 31;
con... | src/encode.zig |
const std = @import("std");
const statemachine = @import("../state-machine.zig");
const gamepad = @import("../gamepad.zig");
const w4 = @import("../wasm4.zig");
const statusbar = @import("../components/status-bar.zig");
const projectile = @import("../components/projectile.zig");
const gavels = @import("../components/g... | src/screens/house-of-commons.zig |
const std = @import("std");
const builtin = std.builtin;
const platform = @import("platform.zig");
const w3 = @import("wasm3.zig");
const vfs = @import("vfs.zig");
const task = @import("task.zig");
const process = @import("process.zig");
const time = @import("time.zig");
const utsname = @import("utsname.zig");
const... | kernel/main.zig |
const std = @import("std");
const sf = @import("../sfml.zig");
const Packet = @This();
// Constructor/destructor
/// Inits an empty packet
pub fn create() !Packet {
var pack = sf.c.sfPacket_create();
if (pack) |p| {
return Packet{ ._ptr = p };
} else
return sf.Error.nullptrUnknownReason;... | src/sfml/network/Packet.zig |
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
/// Returns 2 raised to the power of x (2^x).
///
/// Special Cases:
/// - exp2(+inf) = +inf
/// - exp2(nan) = nan
pub fn exp2(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
return switch (T) {
f32 => exp2_... | lib/std/math/exp2.zig |
const aoc = @import("../aoc.zig");
const std = @import("std");
const Address = isize;
const SubInstruction = enum { ACC, JMP, NOP };
const Instruction = struct {
instr: SubInstruction, offset: i16
};
const ExecutionResult = struct {
pc: Address, acc: isize
};
pub fn run(problem: *aoc.Problem) !aoc.Solution {... | src/main/zig/2020/day08.zig |
const std = @import("std");
const assert = std.debug.assert;
const DottedIdentifier = std.TailQueue([]const u8);
pub const Key = union(enum) {
None,
DottedIdent: DottedIdentifier,
Ident: []const u8,
pub fn deinit(key: *Key, allocator: *std.mem.Allocator) void {
if (key.* == .DottedIdent) {
... | src/toml.zig |
const olin = @import("./olin/olin.zig");
pub const os = olin;
pub const panic = os.panic;
const cwagi = olin.cwagi;
const std = @import("std");
const fmt = std.fmt;
const Headers = std.http.Headers;
var alloc = std.heap.page_allocator;
pub fn main() anyerror!void {
const fout = try olin.resource.stdout();
con... | zig/src/cwagi.zig |
const std = @import("std");
const zephyr = @import("zephyr.zig");
const sys = @import("src/sys.zig");
const FlashArea = sys.flash.FlashArea;
const image = @import("image.zig");
pub fn flashTest() !void {
std.log.info("Running flash test", .{});
var fa = try FlashArea.open(@enumToInt(image.Slot.PrimarySecure... | testing.zig |
const std = @import("std");
const c = @import("c.zig");
const utils = @import("utils.zig");
const intToError = @import("error.zig").intToError;
const Error = @import("error.zig").Error;
const GlyphSlot = @import("freetype.zig").GlyphSlot;
const LoadFlags = @import("freetype.zig").LoadFlags;
const FaceFlags = @import("f... | freetype/src/freetype/Face.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 {
var count_with_pairs: usize = 0;
var count_with_triplets: usize = 0;
// part1
{
var it = std.mem.tokenize(u8, input, ", \n\r... | 2018/day02.zig |
const std = @import("std");
usingnamespace @import("shared.zig");
var tag_collection: std.StringHashMap(void) = undefined;
var allocator: *std.mem.Allocator = undefined;
var string_arena: *std.mem.Allocator = undefined;
pub fn main() !u8 {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.dei... | tools/verifier.zig |
pub const RTCCS_FORCE_PROFILE = @as(u32, 1);
pub const RTCCS_FAIL_ON_REDIRECT = @as(u32, 2);
pub const RTCMT_AUDIO_SEND = @as(u32, 1);
pub const RTCMT_AUDIO_RECEIVE = @as(u32, 2);
pub const RTCMT_VIDEO_SEND = @as(u32, 4);
pub const RTCMT_VIDEO_RECEIVE = @as(u32, 8);
pub const RTCMT_T120_SENDRECV = @as(u32, 16);
pub con... | win32/system/real_time_communications.zig |
const std = @import("std");
const TestContext = @import("../../src/test.zig").TestContext;
// 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_arch = .x86_64,
.os_tag = .linux,
};
pub fn a... | test/stage2/cbe.zig |
// types
const Starship = struct {
name: []const u8,
number: u32,
captain: []const u8 = "?",
};
pub fn main() !void {
const file_name = std.fs.path.basename(@src().file);
print("\n file: {}\n", .{file_name});
}
test "AutoHashMap" {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var a... | 12_hash_maps.zig |
const std = @import("std");
const registry = @import("registry.zig");
const xml = @import("../xml.zig");
const mem = std.mem;
const Allocator = mem.Allocator;
const testing = std.testing;
const ArraySize = registry.Array.ArraySize;
const TypeInfo = registry.TypeInfo;
pub const Token = struct {
kind: Kind,
text... | generator/openxr/c_parse.zig |
const Types = @import("zig_grammar.types.zig");
const Errors = @import("zig_grammar.errors.zig");
const Tokens = @import("zig_grammar.tokens.zig");
usingnamespace Types;
usingnamespace Errors;
usingnamespace Tokens;
pub const StackItem = struct {
item: usize,
state: i16,
value: StackValue,
};
pub const ... | zig/zig_grammar.actions.zig |
const bs = @import("./bitstream.zig");
const bits = @import("./bits.zig");
const std = @import("std");
const expect = std.testing.expect;
test "istream_basic" {
var is: bs.istream_t = undefined;
const init = [_]u8{0x47}; // 0100 0111
const arr: [9]u8 = [_]u8{ 0x45, 0x48 } ++ [_]u8{0x00} ** 7; // 01000101 ... | src/bitstream_test.zig |
const std = @import("std");
const builtin = @import("builtin");
const zc = @import("zetacore");
const zm = @import("zetamath");
const zr = @import("zetarender");
const ECS = zc.Schema(u22, .{
HealthComponent,
PositionComponent,
VelocityComponent,
});
const HealthComponent = struct {
health: usize,
};... | examples/simple-core/main.zig |
const bld = @import("std").build;
pub fn build(b: *bld.Builder) void {
const dir = "src/shdc/";
const sources = [_][]const u8 {
"args.cc",
"bare.cc",
"bytecode.cc",
"input.cc",
"main.cc",
"sokol.cc",
"sokolzig.cc",
"spirv.cc",
"spirvcross.... | build.zig |
const zgt = @import("zgt");
const std = @import("std");
// Small block needed for correct WebAssembly support
pub usingnamespace zgt.cross_platform;
var graph: LineGraph_Impl = undefined;
pub const LineGraph_Impl = struct {
pub usingnamespace zgt.internal.All(LineGraph_Impl);
peer: ?zgt.backend.Canvas = nul... | examples/graph.zig |
const std = @import("std");
const soundio = @import("soundio.zig");
const sndfile = @import("sndfile");
const hzzp = @import("hzzp");
const ao = struct {
pub const c = @cImport({
@cInclude("ao/ao.h");
});
};
const VirtualContext = struct {
fd: std.os.fd_t,
cursor: usize = 0,
write_error: ?... | src/main.zig |
const std = @import("std");
const Builder = std.build.Builder;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
const exe = b.addExecutable("zua", "src/zua.zig");
exe.setBuildMode(mode);
exe.setTarget(target);
exe.install();... | build.zig |
const std = @import("std");
const assert = std.debug.assert;
const print = std.debug.print;
pub const RunError = std.mem.Allocator.Error || std.fmt.ParseIntError || error{ UnsupportedInput, InvalidEnumName, UnexpectedEOS };
const MainError = RunError || std.fs.File.OpenError || std.os.ReadError || std.os.SeekError || ... | common/tools.zig |
const std = @import("std");
const min = std.math.min;
const uefi = @import("uefi/uefi.zig");
const graphics_output = uefi.protocols.graphics_output;
pub const Pixel = struct {
red: u8,
blue: u8,
green: u8
};
pub const Frame = struct {
const Self = @This();
pub info: graphics_output.Mo... | src/graphics.zig |
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
const types = @import("types.zig");
pub const Double = types.Double;
pub const Float = types.Float;
pub const Int64 = types.Int64;
pub const Int32 = types.Int32;
pub const Uint64 = types.Uint64;
pub const Uint32 = types.Uint3... | src/main.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const core = @import("../index.zig");
const Coord = core.geometry.Coord;
const makeCoord = core.geometry.makeCoord;
const Species = core.protocol.Species;
const game_model = @import("./game_model.zig");
const Individual = game_model.Individual;
const Terra... | src/server/map_gen.zig |
const std = @import("std");
const v = @import("v.zig");
// TODO: return normalized vector and magnitude, to allow determining normal even in the case of collisions
/// Returns the closest point to the origin.
pub fn minimumPoint(
shape: anytype,
comptime support: fn (@TypeOf(shape), d: v.Vec2) v.Vec2,
) v.Vec... | gjk.zig |
const std = @import("std");
const proxywasm = @import("proxy-wasm-zig-sdk");
const allocator = proxywasm.allocator;
const contexts = proxywasm.contexts;
const enums = proxywasm.enums;
const hostcalls = proxywasm.hostcalls;
extern fn __wasm_call_ctors() void;
const vm_id = "ziglang_vm";
pub fn main() void {
// Se... | example/example.zig |
const std = @import("std");
const tvg = @import("tvg");
const args = @import("args");
fn printUsage(stream: anytype) !void {
try stream.writeAll(
\\tvg-text [-I <fmt>] [-O <fmt>] [-o <output>] <input>
\\
\\Converts TinyVG related files between different formats. Only supports a single input... | src/tools/text.zig |
const stdx = @import("stdx");
const std = @import("std");
const stbtt = @import("stbtt");
const stbi = @import("stbi");
const ft = @import("freetype");
const graphics = @import("../../graphics.zig");
const gpu = graphics.gpu;
const Font = graphics.Font;
const RenderFont = gpu.RenderFont;
const OpenTypeFont = graphics.... | graphics/src/backend/gpu/font_renderer.zig |
const std = @import("std");
const Location = @import("location.zig").Location;
pub const Diagnostics = struct {
const Self = @This();
pub const MessageKind = enum {
@"error", warning, notice
};
pub const Message = struct {
kind: MessageKind,
location: Location,
messag... | src/library/compiler/diagnostics.zig |
const Benchmark = @This();
const std = @import("std");
const fs = std.fs;
const io = std.io;
const math = std.math;
const mem = std.mem;
const process = std.process;
const time = std.time;
////////////////////////////////////////////////////////////////////////////////
stderr: fs.File.OutStream,
stdout: fs.File.OutS... | src/benchmark.zig |