code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const print = std.debug.print;
const net = std.net;
const os = std.os;
const heap = std.heap;
pub fn main() !void {
print("Configuring local address...\n", .{});
const localhost = try net.Address.parseIp4("127.0.0.1", 8080);
print("Creating socket...\n", .{});
const sock_li... | chap03/tcp_serve_chat.zig |
const std = @import("std");
const builtin = @import("builtin");
const TestContext = @import("../src/test.zig").TestContext;
pub fn addCases(ctx: *TestContext) !void {
{
const case = ctx.obj("wrong same named struct", .{});
case.backend = .stage1;
case.addSourceFile("a.zig",
\\p... | test/compile_errors.zig |
const builtin = @import("builtin");
const std = @import("std");
const assert = std.debug.assert;
const Atomic = std.atomic.Atomic;
const ThreadPool = @This();
stack_size: u32,
max_threads: u16,
queue: Node.Queue = .{},
join_event: Event = .{},
idle_event: Event = .{},
sync: Atomic(u32) = Atomic(u32).init(0),
threads: ... | src/thread_pool_go_based.zig |
const assert = @import("std").debug.assert;
const RenderTarget = @import("renderer.zig").RenderTarget;
pub const PSFontHeader = packed struct {
magic: u32,
version: u32,
headerSize: u32,
flag: u32,
glyphCount: u32,
bytesPerGlyph: u32,
height: u32,
width: u32,
};
pub const Color = u32;
... | kernel/psfont.zig |
const xcb = @import("../xcb.zig");
pub const id = xcb.Extension{ .name = "XVideo-MotionCompensation", .global_id = 0 };
pub const CONTEXT = u32;
pub const SURFACE = u32;
pub const SUBPICTURE = u32;
/// @brief SurfaceInfo
pub const SurfaceInfo = struct {
@"id": xcb.xvmc.SURFACE,
@"chroma_format": u16,
... | src/auto/xvmc.zig |
const xcb = @import("../xcb.zig");
pub const id = xcb.Extension{ .name = "SELinux", .global_id = 0 };
/// @brief QueryVersioncookie
pub const QueryVersioncookie = struct {
sequence: c_uint,
};
/// @brief QueryVersionRequest
pub const QueryVersionRequest = struct {
@"major_opcode": u8,
@"minor_opcode": u... | src/auto/xselinux.zig |
const std = @import("std");
const elf = std.elf;
const builtin = @import("builtin");
const assert = std.debug.assert;
const R_AMD64_RELATIVE = 8;
const R_386_RELATIVE = 8;
const R_ARM_RELATIVE = 23;
const R_AARCH64_RELATIVE = 1027;
const R_RISCV_RELATIVE = 3;
const ARCH_RELATIVE_RELOC = switch (builtin.arch) {
.i... | lib/std/os/linux/start_pie.zig |
const std = @import("std");
const Sdk = @This();
fn sdkRoot() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
}
fn assimpRoot() []const u8 {
return sdkRoot() ++ "/vendor/assimp";
}
builder: *std.build.Builder,
pub fn init(b: *std.build.Builder) *Sdk {
const sdk = b.allocator.create(Sdk... | Sdk.zig |
const std = @import("std");
const fmt = std.fmt;
const server = &@import("../main.zig").server;
const Error = @import("../command.zig").Error;
const Seat = @import("../Seat.zig");
const Config = @import("../Config.zig");
pub fn borderWidth(
allocator: *std.mem.Allocator,
seat: *Seat,
args: []const [:0]c... | source/river-0.1.0/river/command/config.zig |
const std = @import("std");
const warn = std.debug.warn;
const win = std.os.windows;
usingnamespace @import("externs.zig");
pub const LoadedLibrary = struct {
const Error = error{ UnresolvedImport, OutOfMemory };
const Options = struct { rand: ?*std.rand.Random = null };
image: []align(0x1000) u8,
///... | main.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: ?[*:0]const u8,
/// Check if an attribute is set on. In core git parlance, this the valu... | src/attribute.zig |
const std = @import("std");
const json = std.json;
const testing = std.testing;
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const Dir = std.fs.Dir;
const print = std.debug.print;
const nestedtext = @import("nestedtext");
const logger = std.log.scoped(.testsuite);
const testcases_path = "tes... | tests/testsuite.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const webgpu = @import("../../webgpu.zig");
const dummy = @import("./dummy.zig");
pub const Instance = struct {
const vtable = webgpu.Instance.VTable{
.destroy_fn = destroy,
.create_surface_fn = createSurface,
.request_adapt... | src/backends/dummy/instance.zig |
const std = @import("std");
pub fn Point(comptime T: type) type {
return struct {
x: T,
y: T,
const Self = @This();
pub fn make(x: T, y: T) Self {
return .{ .x = x, .y = y };
}
pub fn translate(self: *Self, point: Self) void {
self.x += poi... | src/gui/geometry.zig |
pub const WHV_PROCESSOR_FEATURES_BANKS_COUNT = @as(u32, 2);
pub const WHV_HYPERCALL_CONTEXT_MAX_XMM_REGISTERS = @as(u32, 6);
//--------------------------------------------------------------------------------
// Section: Types (84)
//--------------------------------------------------------------------------------
// TO... | deps/zigwin32/win32/system/hypervisor.zig |
const c = @import("c.zig");
const nk = @import("../nuklear.zig");
const std = @import("std");
const testing = std.testing;
pub fn items(
ctx: *nk.Context,
size: nk.Vec2,
item_height: usize,
selected: usize,
strings: []const nk.Slice,
) usize {
return @intCast(usize, c.nk_combo(
ctx,
... | src/combo.zig |
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const mem = std.mem;
const net = std.net;
const parseUnsigned = std.fmt.parseUnsigned;
const std = @import("std");
const ValueMap = std.StringHashMap([]const u8);
pub const Host = union(enum) {
ip: net.Address,
name: []const u8,
pub fn... | src/uri/uri.zig |
pub const Error = enum(c_int) {
NoSuchObject = 701,
InvalidCurrentTagValue = 702,
InvalidNewTagValue = 703,
RequiredTag = 704,
ReadOnlyTag = 705,
ParameterMismatch = 706,
UnsupportedOrInvalidSearchCriteria = 708,
UnsupportedOrInvalidSortCriteria = 709,
NoSuchContainer = 710,
Res... | src/upnp/definition/content_directory.zig |
const std = @import("std");
pub const Value = union(enum) {
Object: []Member,
Array: []Value,
String: []const u8,
Int: i64,
Float: f64,
Bool: bool,
Null: void,
fn get_obj(self: Value, key: []const u8) ?Value {
if (self == .Object) {
for (self.Object) |member| {
... | src/lib.zig |
const std = @import("std");
const c = @cImport({
@cInclude("Windows.h");
});
const Image = @import("Image.zig");
pub fn hasImage() bool {
const png_format = c.RegisterClipboardFormatA("PNG");
if (png_format != 0 and c.IsClipboardFormatAvailable(png_format) != 0) return true;
if (c.IsClipboardFormatAvai... | src/ClipboardWin32.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = true;
const assert = std.debug.assert;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
fn abs(a: i32) i32 {
return if (a > 0) a else -a;
}
fn min(a: i32, b: i32) i32 {
ret... | 2017/day11.zig |
const std = @import("std");
// dross-zig
const Dross = @import("../dross_zig.zig");
usingnamespace Dross;
// -----------------------------------------------------------------------------
// -----------------------------------------
// - Player -
// -----------------------------------------
///
pub const Player ... | src/sandbox/player.zig |
const c = @import("../../c_global.zig").c_imp;
const std = @import("std");
const za = @import("zalgebra");
// dross-zig
const VertexArrayGl = @import("vertex_array_opengl.zig").VertexArrayGl;
const vbgl = @import("vertex_buffer_opengl.zig");
const VertexBufferGl = vbgl.VertexBufferGl;
const BufferUsageGl = vbgl.Buffer... | src/renderer/backend/renderer_opengl.zig |
const std = @import("std");
const zs = @import("zstack.zig");
/// A piece is made up of many blocks. A block right now only indicates which piece it belonds to.
/// However, in the future we can add new attributes to do some more interesting mechanics to
/// the field.
///
/// Note that a field block is different from... | src/piece.zig |
const stb = @cImport({
// @cInclude("stb/stb_image_resize.h");
@cDefine("STBI_ASSERT(x)", "zig_assert(x)");
@cDefine("STBI_MALLOC(x)", "zig_malloc(x)");
@cDefine("STBI_REALLOC(x, n)", "zig_realloc(x, n)");
@cDefine("STBI_FREE(x)", "zig_free(x)");
@cDefine("STBI_NO_STDIO", {});
@cInclude("st... | stb/stb.zig |
const std = @import("std");
const mem = std.mem;
const fmt = std.fmt;
const testing = std.testing;
const heap = std.heap;
const fs = std.fs;
const log = std.log;
const process = std.process;
const debug = std.debug;
const builtin = std.builtin;
const io = std.io;
const network = @import("network");
const parsing = @i... | src/main.zig |
const std = @import("std");
inline fn isSet(set: u1024, idx: usize) bool {
const mask = @as(u1024, 1) << @intCast(u10, idx);
return set & mask != 0;
}
inline fn setBit(set: *u1024, idx: usize) void {
const mask = @as(u1024, 1) << @intCast(u10, idx);
set.* = set.* | mask;
}
fn common(most: bool, numbe... | shritesh+zig/3b.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const web = @import("zhp.zig");
const responses = web.responses;
const Status = responses.Status;
const Headers = web.Headers;
const Request = web.Request;
const IOStream = web.IOStream;
const Bytes = std.ArrayList(u8);
pub const Response = struct {
... | src/response.zig |
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const Allocator = std.mem.Allocator;
var gost_sbox_1: [256]u32 = undefined;
var gost_sbox_2: [256]u32 = undefined;
var gost_sbox_3: [256]u32 = undefined;
var gost_sbox_4: [256]u32 = undefined;
const sbox: [8][16]u32 =
.{ .{ 4, 10, 9, 2... | gosthash.zig |
const std = @import("std");
const Currency = @This();
platinum: u32 = 0,
gold: u32 = 0,
silver: u32 = 0,
copper: u32 = 0,
pub fn init(platinum: u32, gold: u32, silver: u32, copper: u32) Currency {
return .{
.platinum = platinum,
.gold = gold,
.silver = silver,
.copper = copper,
... | src/dnd/Currency.zig |
const std = @import("std");
const assert = std.debug.assert;
pub const Sleuth = struct {
match: Match,
lo: u32,
hi: u32,
pub const Match = enum {
TwoOrMore,
TwoOnly,
};
pub fn init(match: Match) Sleuth {
var self = Sleuth{
.match = match,
.lo = ... | 2019/p04/sleuth.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 Ingredient = struct {
name: []const u8,
capacity: i32,
durability: i32,
flavor: i32,
texture: i32,... | 2015/day15.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... | build.zig |
const std = @import("std");
const expect = std.testing.expect;
const Allocator = std.mem.Allocator;
const Node = struct {
//What changes would the children field need in order to implement sorting?
children: std.AutoHashMap(u8, *Node),
value: bool = false,
pub fn init(allocator: *Allocator) !*Node {
... | search_trees/trie.zig |
const std = @import("std");
const mem = std.mem;
const os = std.os;
const linux = @cImport({
@cInclude("linux/hidraw.h");
@cInclude("libudev.h");
@cInclude("sys/ioctl.h");
// for EVIOCGRAB:
@cInclude("linux/input.h");
});
const UNGRAB = 0;
const GRAB = 1;
const DeviceError = error{ CantGrab, NotFo... | src/udev.zig |
usingnamespace @import("root").preamble;
const gdt = @import("gdt.zig");
const regs = @import("regs.zig");
const interrupts = @import("interrupts.zig");
const apic = @import("apic.zig");
const Tss = @import("tss.zig").Tss;
pub const sched_stack_size = 0x10000;
pub const int_stack_size = 0x10000;
pub const task_stack_... | subprojects/flork/src/platform/x86_64/thread.zig |
const std = @import("std");
const nvg = @import("nanovg");
const gui = @import("../gui.zig");
const Rect = @import("../geometry.zig").Rect;
const Label = @This();
widget: gui.Widget,
allocator: std.mem.Allocator,
text: []const u8,
text_alignment: gui.TextAlignment = .left,
padding: f32 = 0,
draw_border: bool = false... | src/gui/widgets/Label.zig |
const std = @import("std");
pub const App = @import("zt/app.zig").App;
pub const Allocators = @import("zt/allocators.zig");
/// Forwarding known_folders.zig, a popular zig framework for finding predetermined folders cross platform.
pub const known_folders = @import("pkg/known_folders.zig");
pub const custom_components... | src/zt.zig |
const std = @import("std");
const ascii = std.ascii;
const mem = std.mem;
usingnamespace @import("common.zig");
const HeaderList = std.ArrayList(Header);
pub const Headers = struct {
allocator: *mem.Allocator,
list: HeaderList,
pub fn init(allocator: *mem.Allocator) Headers {
return .{
... | src/headers.zig |
const std = @import("std");
const shared = @import("../shared.zig");
const lib = @import("../../main.zig");
pub const c = @cImport({
@cInclude("gtk/gtk.h");
});
const wbin_new = @import("windowbin.zig").wbin_new;
const EventType = shared.BackendEventType;
const BackendError = shared.BackendError;
pub const Capabi... | src/backends/gtk/backend.zig |
const std = @import("../std.zig");
const assert = std.debug.assert;
const hmac = std.crypto.auth.hmac;
const mem = std.mem;
/// HKDF-SHA256
pub const HkdfSha256 = Hkdf(hmac.sha2.HmacSha256);
/// HKDF-SHA512
pub const HkdfSha512 = Hkdf(hmac.sha2.HmacSha512);
/// The Hkdf construction takes some source of initial keyi... | lib/std/crypto/hkdf.zig |
const tic = @import("tic80.zig");
const std = @import("std");
const RndGen = std.rand.DefaultPrng;
var rnd : std.rand.Random = undefined;
const screenWidth = 240;
const screenHeight = 136;
const toolbarHeight = 6;
var t : u32 = 0;
fn randomFloat(lower: f32, greater: f32) f32 {
return rnd.float(f32) * (greater-lo... | demos/bunny/wasmmark/src/main.zig |
const std = @import("std");
pub const Parser = struct {
document: []const u8,
current_tag: []const u8 = undefined,
char_buffer: [4]u8 = undefined,
mode: enum { normal, attrs, chars, entity } = .normal,
pub fn init(document: []const u8) Parser {
return Parser{
.document = docume... | lib/zig-xml/xml.zig |
// Fundamental types
pub const F32x4 = @Vector(4, f32);
pub const F32x8 = @Vector(8, f32);
pub const F32x16 = @Vector(16, f32);
pub const Boolx4 = @Vector(4, bool);
pub const Boolx8 = @Vector(8, bool);
pub const Boolx16 = @Vector(16, bool);
// Higher-level 'geometric' types
pub const Vec = F32x4;
pub const Mat = [4]F... | libs/zmath/zmath.zig |
const std = @import("std");
const input = @embedFile("day04.txt");
const Board = struct {
grid: [5][5]u8,
marked: u25,
};
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = &gpa.allocator;
var iter = std.mem.split(u8, input, "\n\n");
const nums: []u8 =... | 2021/day04.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
fn collapse(input: []u8, tmp: []u8) usize {
const bufs = [_][]u8{ input, tmp };
var pingpong: u32 = 0;
var len = input.len;
var changed = true;
while (changed) {
const in = bufs[pingpong][0..len];
... | 2018/day05.zig |
const std = @import("std");
const Builder = std.build.Builder;
const Allocator = std.mem.Allocator;
const Sdk = @import("../Sdk.zig");
const UserConfig = Sdk.UserConfig;
// This config stores tool paths for the current machine
const build_config_dir = ".build_config";
const local_config_file = "config.json";
const p... | build/auto-detect.zig |
const std = @import("../../../std.zig");
const linux = std.os.linux;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
pub const SYS_restart_syscall ... | lib/std/os/bits/linux/i386.zig |
const std = @import("std");
const builtin = std.builtin;
const event = std.event;
const assert = std.debug.assert;
const testing = std.testing;
const os = std.os;
const mem = std.mem;
const windows = os.windows;
const Loop = event.Loop;
const fd_t = os.fd_t;
const File = std.fs.File;
const Allocator = mem.Allocator;
c... | lib/std/fs/watch.zig |
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
@"64bit",
a,
c,
d,
e,
experimental_b,
experimental_v,
experimental_zba,
experimental_zbb,
experimental_zbc,
experimental_zbe,
... | lib/std/target/riscv.zig |
const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Event = uefi.Event;
const Status = uefi.Status;
const Time = uefi.Time;
const Ip6ModeData = uefi.protocols.Ip6ModeData;
const Ip6Address = uefi.protocols.Ip6Address;
const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
const SimpleN... | lib/std/os/uefi/protocols/udp6_protocol.zig |
const std = @import("std");
usingnamespace (@import("../machine.zig"));
usingnamespace (@import("../util.zig"));
test "x87 floating point instructions" {
const m16 = Machine.init(.x86_16);
const m32 = Machine.init(.x86_32);
const m64 = Machine.init(.x64);
const sreg = Operand.register;
const memRm... | src/x86/tests/float_x87.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const Value = @import("./value.zig").Value;
const String = @import("./object.zig").Obj.String;
const table_max_load = 0.75;
const Entry = struct {
key: ?*String = null,
value: Value = Value.nil,
};
pub const Table = struct {
count: u32,
... | src/table.zig |
const std = @import("std");
const zp = @import("../../zplay.zig");
const event = zp.event;
const sdl = zp.deps.sdl;
const sdl_impl = @import("sdl_impl.zig");
pub const c = @import("c.zig");
/// export friendly api
pub usingnamespace @import("api.zig");
/// icon font: font-awesome
pub const fontawesome = @import("fo... | src/deps/imgui/imgui.zig |
const std = @import("std");
const Value = @import("Value.zig");
const Gc = @import("Gc.zig");
pub const BuiltinError = error{ OutOfMemory, UnsupportedType, MismatchingTypes };
const BuiltinFn = Value.NativeFn;
pub const builtins = std.ComptimeStringMap(*Value, .{
.{ "len", &len_func.base },
.{ "add", &add_fun... | src/builtins.zig |
const std = @import("std");
pub const Markov = struct {
rows: std.StringHashMap(std.StringHashMap(u8)),
firsts: std.StringHashMap(u8),
final: []u8 = undefined,
arena: std.heap.ArenaAllocator,
pub fn init() Markov {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
... | src/tilemaps/markov.zig |
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const build_options = @import("build_options");
const amqp = @import("zamqp");
const server = @import("server.zig");
var logOut: enum { syslog, stderr } = .syslog;
// override the std implementation
pub fn log(
comptime level: std.log.L... | src/main.zig |
const std = @import("std");
const Lock = @import("./Lock.zig").Lock;
const Futex = @import("./Futex.zig").Futex;
const Thread = @import("./Thread.zig").Thread;
const Pool = @This();
counter: u32 = 0,
max_threads: u16,
spawned: ?*Worker = null,
run_queues: [Priority.Count]GlobalQueue = [_]GlobalQueue{.{}} ** Priority... | src/runtime/Pool.zig |
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
const build_mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
const tests = buildTests(b, build_mode, target);
const test_step = b.step("test", "Run enet tests");
test_step.dependOn(&tests.step);
}... | build.zig |
pub const E_UNKNOWNTYPE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2144665560));
//--------------------------------------------------------------------------------
// Section: Types (21)
//--------------------------------------------------------------------------------
pub const VisualMutationType = enum... | win32/ui/xaml/diagnostics.zig |
const mdb = struct {
usingnamespace @cImport({
@cInclude("lmdb.h");
});
};
const std = @import("std");
const panic = std.debug.panic;
const assert = std.debug.assert;
const info = std.log.info;
const testing = std.testing;
const err = std.os.E;
const s2s = @import("s2s");
const serialize = s2s.seriali... | src/lmdb.zig |
const std = @import("std");
const fs = std.fs;
const num_indices: usize = 20;
const Range = struct {
min: u32 = 0xFFFFFFFF,
max: u32 = 0,
const Self = @This();
pub fn fromString(s: []const u8) !Self {
var it = std.mem.tokenize(s, "-");
return Self{
.min = try std.fmt.pars... | 2020/src/day_16.zig |
const tone = @import("tone.zig");
const tune = @import("tune.zig");
const note = @import("note.zig");
const music = @import("music.zig");
const c4 = note.getFreq("C 4".*);
const c5 = note.getFreq("C 5".*);
const g4 = note.getFreq("G 4".*);
const a4 = note.getFreq("A 4".*);
const d4 = note.getFreq("D 4".*);
const e4 = ... | src/music/title-theme.zig |
const std = @import("std");
const os = @import("root").os;
const kepler = os.kepler;
/// Type of the object that can be stored in local object namespace
pub const ObjectType = enum {
/// Object which exposes Stream interface. See Stream class description
/// in kepler/ipc.zig. Not shareable.
Stream,
//... | src/kepler/objects.zig |
const Wwise = @import("../wwise.zig").Wwise;
const ImGui = @import("../imgui.zig").ImGui;
const DemoInterface = @import("demo_interface.zig").DemoInterface;
const std = @import("std");
pub const RtpcCarEngineDemo = struct {
allocator: std.mem.Allocator = undefined,
isVisibleState: bool = false,
bankID: u32... | src/demos/rtpc_car_engine_demo.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
// f... | build.zig |
const combn = @import("combn.zig");
const Result = combn.gllparser.Result;
const Parser = combn.gllparser.Parser;
const Error = combn.gllparser.Error;
const Context = combn.gllparser.Context;
const PosKey = combn.gllparser.PosKey;
const ParserPath = combn.gllparser.ParserPath;
const Literal = combn.parser.Literal;
cons... | src/combn/test_complex.zig |
const builtin = @import("builtin");
const std = @import("std");
const Builder = std.build.Builder;
var framework_dir: ?[]u8 = null;
const build_impl_type: enum { exe, static_lib, object_files } = .static_lib;
pub fn build(b: *std.build.Builder) !void {
const exe = b.addStaticLibrary("JunkLib", null);
linkArti... | gamekit/deps/imgui/build.zig |
const std = @import("std");
// Returns true if the version includes https://github.com/ziglang/zig/pull/10572/commits.
// When this is false, trying to place the stack first will result in data corruption.
fn version_supports_stack_first(zig_version: std.SemanticVersion) !bool {
if (zig_version.order(try std.Seman... | cli/assets/templates/zig/build.zig |
const std = @import("std");
const builtin = @import("builtin");
const os = std.os;
const io = std.io;
const mem = std.mem;
const Allocator = mem.Allocator;
const ArrayList = std.ArrayList;
const Buffer = std.Buffer;
const arg = @import("arg.zig");
const c = @import("c.zig");
const introspect = @import("introspect.zig... | src-self-hosted/main.zig |
const std = @import("std");
const zang = @import("../zang.zig");
const Source = @import("tokenize.zig").Source;
const BuiltinPackage = @import("builtins.zig").BuiltinPackage;
const BuiltinEnumValue = @import("builtins.zig").BuiltinEnumValue;
const ParamType = @import("parse.zig").ParamType;
const ModuleParam = @import(... | src/zangscript/runtime.zig |
const std = @import("std");
const mem = std.mem;
const math = std.math;
const assert = std.debug.assert;
const maxTreeHeight = 36;
// TODO:
//
// I would like some things optional at comptime that has storage or compute
// implications. For example by passing a struct like this to TreeType to enable
// certain featu... | avl_tree.zig |
const std = @import("std");
const zfetch = @import("zfetch");
const uca = @import("src/types.zig");
const fmtValueLiteral = @import("fmt-valueliteral").fmtValueLiteral;
const csi = @import("ansi").csi;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const alloc = &gpa.allocator;
co... | generate.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);
}
pub fn main() anyerror!void {
const stdout = std.io.getStdOut().writer();
var arena... | 2016/day19.zig |
const std = @import("std");
const testing = std.testing;
const math = @import("std").math;
const f_eq = @import("utils.zig").f_eq;
const debug = @import("std").debug;
pub const Vec4 = packed struct {
x: f32,
y: f32,
z: f32,
w: f32,
pub fn create(x: f32, y: f32, z: f32, w: f32) Vec4 {
retur... | src/vec4.zig |
pub const Key = @import("keys.zig").Key;
pub const Kind = enum {
Pressed, // Key is depressed. Should be followed by a release.
Released, // Key was released.
Hit, // Key doesn't support seperate pressed and released states.
};
pub const Modifiers = struct {
right_shift_is_pressed: bool = false,
l... | libs/georgios/keyboard.zig |
const std=@import("std");
const debug =std.debug;
const assert = std.debug.assert;
const mem =std.mem;
const encoding =enum.{
path,
pathSegment,
host,
zone,
userPassword,
queryComponent,
fragment,
};
pub const Error = error.{
EscapeError,
InvalidHostError,
};
fn shouldEscape(c : ... | src/net/url/url.zig |
const std = @import("std");
const pokemon = @import("pokemon");
const math = std.math;
const gen2 = pokemon.gen2;
const common = pokemon.common;
pub const Trainer = struct {
name: []const u8,
kind: u8,
party: []const gen2.Party.Member.WithBoth,
};
pub const first_trainers = []Trainer{
// FalknerGroup
Trai... | tools/offset-finder/gen2-constants.zig |
const std = @import("std");
var a: *std.mem.Allocator = undefined;
const stdout = std.io.getStdOut().writer(); //prepare stdout to write in
const Type = enum {
bright,
clear,
dark,
dim,
dotted,
drab,
dull,
faded,
light,
mirrored,
muted,
pale,
plaid,
posh,
sh... | day-07/part-2/lelithium.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... | build.zig |
const is_test = @import("builtin").is_test;
const std = @import("std");
const math = std.math;
const Log2Int = std.math.Log2Int;
const maxInt = std.math.maxInt;
const minInt = std.math.minInt;
const warn = std.debug.warn;
const DBG = false;
pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t... | float_to_int/fixint.zig |
const std = @import("std");
const log = std.log;
const cuda = @import("cudaz");
const cu = cuda.cu;
const ShmemReduce = cuda.Function("shmem_reduce_kernel");
const GlobalReduce = cuda.Function("global_reduce_kernel");
pub fn main() !void {
log.info("***** Lesson 3 ******", .{});
var general_purpose_allocator... | CS344/src/lesson3.zig |
const std = @import("std");
pub fn EmbeddedRingQueue(comptime TElement: type) type {
const assert = std.debug.assert;
return struct {
const Self = @This();
pub const Error = error{
Empty,
Full,
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - ... | libs/zpool/src/embedded_ring_queue.zig |
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
/// Returns e raised to the power of x (e^x).
///
/// Special Cases:
/// - exp(+inf) = +inf
/// - exp(nan) = nan
pub fn exp(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
return switch (T) {
f32 => exp32(x)... | lib/std/math/exp.zig |
const std = @import("std");
const builtin = std.builtin;
const page_size = std.mem.page_size;
pub const tokenizer = @import("c/tokenizer.zig");
pub const Token = tokenizer.Token;
pub const Tokenizer = tokenizer.Tokenizer;
pub const parse = @import("c/parse.zig").parse;
pub const ast = @import("c/ast.zig");
test "" {
... | lib/std/c.zig |
const tests = @import("tests.zig");
const builtin = @import("builtin");
pub fn addCases(cases: *tests.TranslateCContext) void {
if (builtin.os != builtin.Os.windows) {
// Windows treats this as an enum with type c_int
cases.add("big negative enum init values when C ABI supports long long enums",
... | test/translate_c.zig |
//! A condition provides a way for a kernel thread to block until it is signaled
//! to wake up. Spurious wakeups are possible.
//! This API supports static initialization and does not require deinitialization.
impl: Impl = .{},
const std = @import("../std.zig");
const Condition = @This();
const windows = std.os.win... | lib/std/Thread/Condition.zig |
const std = @import("std");
const direct_allocator = std.heap.direct_allocator;
const separate = std.mem.separate;
const parseInt = std.fmt.parseInt;
const warn = std.debug.warn;
const ArrayList = std.ArrayList;
const copy = std.mem.copy;
// Assume the input program is correct
const input = "1,0,0,3,1,1,2,3,1,3,4,3,1,... | aoc-2019/day2.zig |
const std = @import("std");
const os = std.os;
const panic = std.debug.panic;
const c = @import("c.zig");
const math3d = @import("math3d.zig");
const debug_gl = @import("debug_gl.zig");
const Vec4 = math3d.Vec4;
const Mat4x4 = math3d.Mat4x4;
const c_allocator = @import("std").heap.c_allocator;
pub const AllShaders = s... | src/all_shaders.zig |
const std = @import("std");
const fmt = std.fmt;
const mem = std.mem;
const Allocator = mem.Allocator;
const Linenoise = @import("main.zig").Linenoise;
const term = @import("term.zig");
const global_allocator = std.heap.c_allocator;
var global_linenoise = Linenoise.init(global_allocator);
var c_completion_callback: ... | src/c.zig |
const c = @import("c.zig");
const std = @import("std");
const Allocator = std.mem.Allocator;
const log = std.log.scoped(.glfw);
pub const WindowError = error {
InitializationError
};
fn checkError(shader: c.GLuint) void {
var status: c.GLint = undefined;
c.glGetShaderiv(shader, c.GL_COMPILE_STATUS, &statu... | src/cairo.zig |
const c = @import("c.zig");
const nk = @import("../nuklear.zig");
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
pub const Behavior = c.nk_button_behavior;
pub fn label(ctx: *nk.Context, title: []const u8) bool {
return c.nk_button_label(ctx, nk.slice(title)) != 0;
}
pub fn color(... | src/button.zig |
pub const WasmError = opaque {
/// Gets the error message
pub fn getMessage(self: *WasmError) ByteVec {
var bytes: ByteVec = undefined;
wasmtime_error_message(self, &bytes);
return bytes;
}
/// Frees the error resources
pub fn deinit(self: *WasmError) void {
wasmtime... | src/c.zig |
const std = @import("std");
const zbs = std.build;
const fs = std.fs;
const mem = std.mem;
pub fn build(b: *zbs.Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const scanner = ScanProtocolsStep.create(b);
inline for ([_][]const u8{ "globals", "list... | build.zig |
usingnamespace @import("raylib");
usingnamespace @import("raylib-math");
const MAX_BUILDINGS = 100;
pub fn main() anyerror!void
{
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
const screenHeight = 450;
InitWind... | examples/core/2d_camera.zig |
/// perfect.zig
/// Module to find perfect numbers
///
const std = @import("std");
//const heap = std.heap;
//const mem = std.mem;
//const warn = std.debug.warn;
/// Finding perfect numbers
/// Predicate for perfect numbers
pub fn is_perfect(comptime T: type, n: T) bool {
var i: T = 1;
var sum: T = 0;
wh... | Zig/benchmark/src/perfect.zig |
const std = @import("std");
const Sha1 = std.crypto.hash.Sha1;
const expectEqual = std.testing.expectEqual;
const fmt = std.fmt;
const mem = std.mem;
const os = std.os;
const testing = std.testing;
const des = @import("zig-crypto").des;
const DES = des.DES;
const TDES = des.TDES;
fn desRoundsInt(comptime crypt_mode: ... | test/des_test.zig |
const std = @import("std");
const Target = std.Target;
const CrossTarget = std.zig.CrossTarget;
fn setFeature(cpu: *Target.Cpu, feature: Target.x86.Feature, enabled: bool) void {
const idx = @as(Target.Cpu.Feature.Set.Index, @enumToInt(feature));
if (enabled) cpu.features.addFeature(idx) else cpu.features.rem... | lib/std/zig/system/x86.zig |
const std = @import("std");
const assert = std.debug.assert;
pub const math = std.math;
pub const Scalar = f32;
pub const Vec3 = [3]Scalar;
pub const Mat4 = [4][4]Scalar;
pub const scalar = struct {
pub fn modAngle(in_angle: Scalar) Scalar {
const angle = in_angle + math.pi;
var temp: Scalar = mat... | src/math.zig |
const std = @import("std");
const Builder = std.build.Builder;
const sabaton = @import("extern/Sabaton/build.zig");
fn baremetal_target(exec: *std.build.LibExeObjStep, arch: std.Target.Cpu.Arch) void {
var disabled_features = std.Target.Cpu.Feature.Set.empty;
var enabled_feautres = std.Target.Cpu.Feature.Set.... | build.zig |