Unnamed: 0
int64
0
0
repo_id
stringlengths
5
186
file_path
stringlengths
15
223
content
stringlengths
1
32.8M
0
repos/pe-ziglang
repos/pe-ziglang/pe-0002/pe-0002.zig
//! Even Fibonacci Numbers //! https://projecteuler.net/problem=2 const std = @import("std"); const time = std.time; const Instant = time.Instant; const print = std.debug.print; pub fn main() !void { const start = try Instant.now(); const answer = evenFibonacciNumbers(); const end = try Instant.now(); ...
0
repos/pe-ziglang
repos/pe-ziglang/docs/README.md
# Zig Project Euler solutions <p align="center"><img src="logo.png"></p> **WIP**...
0
repos
repos/zerve/zig.mod
name: zerve main: src/zerve.zig license: MIT description: Simple web framework for zig min_zig_version: 0.12.0 dependencies:
0
repos
repos/zerve/gyro.zzz
pkgs: zerve: version: 0.0.23 license: MIT description: Simple web framework for zig source_url: "https://github.com/floscodes/zerve" root: src/zerve.zig files: README.md LICENSE zig.mod build.zig src/*.zig tags: http server framework ht...
0
repos
repos/zerve/README.md
# zerve A simple framework for writing web services in zig. * [Create a simple Web App](#create-a-simple-web-app) * [Types](#types) * [Route](#route) * [Handler Functions](#handler-functions) * [Request](#request) * [Get Query Params](#get-query-params) * [Get Header Value by Key](#get-val...
0
repos
repos/zerve/build.zig.zon
.{ .name = "zerve", .version = "0.0.23", .minimum_zig_version = "0.12.0", .paths = .{ "build.zig", "build.zig.zon", "src", "LICENSE", "README.md", }, }
0
repos
repos/zerve/build.zig
const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); _ = b.addModule("zerve", .{ .root_source_file = b.path("src/zerve.zig"), }); const lib = b.addStaticLibrary(.{ .name = "zerv...
0
repos/zerve
repos/zerve/src/server.zig
const std = @import("std"); pub const io_mode: std.io.Mode = .evented; const olderVersion: bool = @import("builtin").zig_version.minor < 11; const eql = std.mem.eql; const types = @import("types.zig"); const Route = types.Route; const Request = types.Request; const Response = types.Response; const Header = types.Heade...
0
repos/zerve
repos/zerve/src/types.zig
const std = @import("std"); const tuple = std.meta.Tuple; const allocator = std.heap.page_allocator; const eql = std.mem.eql; const stat = @import("./status.zig"); const rescookie = @import("./res_cookie.zig"); const reqcookie = @import("./req_cookie.zig"); /// Route is a touple that consists of the path and the funct...
0
repos/zerve
repos/zerve/src/zerve.zig
const std = @import("std"); const types = @import("types.zig"); const status = @import("status.zig"); const server = @import("server.zig"); pub const Server = server.Server; pub const Route = types.Route; pub const Header = types.Header; pub const Request = types.Request; pub const Response = types.Response; pub const...
0
repos/zerve
repos/zerve/src/res_cookie.zig
const std = @import("std"); const types = @import("types.zig"); pub const Cookie = struct { name: []const u8, value: []const u8, path: []const u8 = "/", domain: []const u8 = "", /// Indicates the number of seconds until the cookie expires. maxAge: i64 = 0, secure: bool = true, httpOnly:...
0
repos/zerve
repos/zerve/src/status.zig
/// Representing the HTTP status pub const Status = enum(u32) { // INFORMATION RESPONSES CONTINUE = 100, SWITCHING_PROTOCOLS = 101, PROCESSING = 102, EARLY_HINTS = 103, // SUCCESSFUL RESPONSES OK = 200, CREATED = 201, ACCEPTED = 202, NON_AUTHORATIVE_INFORMATION = 203, NO_CO...
0
repos/zerve
repos/zerve/src/req_cookie.zig
const std = @import("std"); const trim = std.mem.trim; const split = std.mem.split; const olderVersion: bool = @import("builtin").zig_version.minor < 11; pub const Cookie = struct { name: []const u8, value: []const u8, pub fn parse(item2: []const u8, allocator: std.mem.Allocator) ![]const Cookie { ...
0
repos
repos/uxnyap/run.sh
#!/bin/sh ROM_PATH="${ROM_PATH:-uxnyap.rom}" ZIG_BUILD_ARGS=${ZIG_BUILD_ARGS:-} REQ_PIPE="${REQ_PIPE:-reqs.fifo}" RES_PIPE="${RES_PIPE:-resps.fifo}" rm -rf "${REQ_PIPE}" "${RES_PIPE}" "${ROM_PATH}" resp_debug mkfifo "${REQ_PIPE}" mkfifo "${RES_PIPE}" uxnasm client.tal "${ROM_PATH}" # shellcheck disable=SC2086 { z...
0
repos
repos/uxnyap/README.md
**WARNING: THIS PROJECT IS ABANDONED.** It's retained here for documentation purposes, but please don't attempt to actually use this. The protocol needs serious work (eg. a better data structure for fixed-length transmissions such that a double-null sequence isn't required to end the stream), and I almost guarante...
0
repos
repos/uxnyap/build.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...
0
repos/uxnyap
repos/uxnyap/src/main.zig
// This source code is part of the uxnyap project, released under the CC0-1.0 // dedication found in the COPYING file in the root directory of this source // tree, or at https://creativecommons.org/publicdomain/zero/1.0/ // tested on zig 0.8.1 by klardotsh. requires libcurl dev headers and, of // course, linkable obje...
0
repos
repos/zriscv/README.md
# zriscv [![CI](https://github.com/leecannon/zriscv/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/leecannon/zriscv/actions/workflows/main.yml) RISC-V emulator in Zig ## What to expect This is the first emulator I've made other than CHIP-8, don't expect high quality nor speed. The only thing...
0
repos
repos/zriscv/build.zig
const std = @import("std"); // TODO: Re-write this file const zriscv_version = std.SemanticVersion{ .major = 0, .minor = 1, .patch = 1 }; pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const output = b.option(bool, "output...
0
repos/zriscv
repos/zriscv/zriscv/instruction.zig
const std = @import("std"); const bitjuggle = @import("bitjuggle"); const tracy = @import("tracy"); const zriscv = @import("zriscv"); pub const InstructionType = enum { Illegal, Unimplemented, LUI, AUIPC, JAL, JALR, BEQ, BNE, BLT, BGE, BLTU, BGEU, LB, LH, LW,...
0
repos/zriscv
repos/zriscv/zriscv/types.zig
const std = @import("std"); const zriscv = @import("zriscv"); pub const PrivilegeLevel = enum(u2) { User = 0, Supervisor = 1, Machine = 3, pub fn getPrivilegeLevel(value: u2) !PrivilegeLevel { return std.meta.intToEnum(PrivilegeLevel, value) catch { std.log.err("invalid privlege mo...
0
repos/zriscv
repos/zriscv/zriscv/Executable.zig
const std = @import("std"); const zriscv = @import("zriscv"); const tracy = @import("tracy"); const Executable = @This(); pub const RegionDescriptor = struct { load_address: u64, // This length can be less than the length of `memory`, this allows a region to have a zeroed section length: u64, memory: ...
0
repos/zriscv
repos/zriscv/zriscv/tests.zig
const std = @import("std"); comptime { refAllDeclsRecursive(@This()); } // This code is from `std.testing.refAllDeclsRecursive` but as it is in the file it can access private decls fn refAllDeclsRecursive(comptime T: type) void { if (!@import("builtin").is_test) return; inline for (comptime std.meta.decla...
0
repos/zriscv
repos/zriscv/zriscv/hart.zig
const std = @import("std"); const zriscv = @import("zriscv"); const tracy = @import("tracy"); pub inline fn Hart(comptime mode: zriscv.Mode) type { return switch (mode) { .system => SystemHart, .user => UserHart, }; } const LoadError = error{ ExecutionOutOfBounds, Unimplemented, }; co...
0
repos/zriscv
repos/zriscv/zriscv/memory.zig
const std = @import("std"); const zriscv = @import("zriscv"); pub inline fn Memory(comptime mode: zriscv.Mode) type { return switch (mode) { .system => SystemMemory, .user => UserMemory, }; } // TODO: Thread-safety for mutliple harts pub const SystemMemory = struct { memory: []align(std.me...
0
repos/zriscv
repos/zriscv/zriscv/csr.zig
const std = @import("std"); const bitjuggle = @import("bitjuggle"); const zriscv = @import("zriscv"); pub const Csr = enum(u12) { // Cycle counter for RDCYCLE instruction cycle = 0xC00, /// Hardware thread ID mhartid = 0xF14, pub fn getCsr(value: u12) !Csr { return std.meta.intToEnum(Csr,...
0
repos/zriscv
repos/zriscv/zriscv/zriscv.zig
const std = @import("std"); pub usingnamespace @import("types.zig"); const csr = @import("csr.zig"); pub const Csr = csr.Csr; const execution = @import("execution.zig"); pub const ExecutionOptions = execution.ExecutionOptions; pub const step = execution.step; const machine = @import("machine.zig"); pub const Machin...
0
repos/zriscv
repos/zriscv/zriscv/execution.zig
const std = @import("std"); const zriscv = @import("zriscv"); const tracy = @import("tracy"); const build_options = @import("build_options"); pub const ExecutionOptions = struct { unrecognised_instruction_is_fatal: bool = true, illegal_instruction_is_fatal: bool = true, unrecognised_csr_is_fatal: bool = tr...
0
repos/zriscv
repos/zriscv/zriscv/machine.zig
const std = @import("std"); const zriscv = @import("zriscv"); const tracy = @import("tracy"); pub inline fn Machine(comptime mode: zriscv.Mode) type { return switch (mode) { .system => SystemMachine, .user => UserMachine, }; } pub const SystemMachine = struct { allocator: std.mem.Allocator...
0
repos/zriscv
repos/zriscv/riscof/config.ini
[RISCOF] ReferencePlugin=sail_cSim ReferencePluginPath=sail_cSim DUTPlugin=zriscv DUTPluginPath=zriscv [zriscv] pluginpath=zriscv ispec=zriscv/zriscv_isa.yaml pspec=zriscv/zriscv_platform.yaml target_run=1 [sail_cSim] pluginpath=sail_cSim
0
repos/zriscv
repos/zriscv/riscof/run_tests.sh
#!/bin/bash set -e die() { >&2 echo "die: $*" exit 1 } RISCOF_BASE_DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P) TEST_DIR="$RISCOF_BASE_DIR/riscv-arch-test" ZRISCV_BIN_DIR="$RISCOF_BASE_DIR/../zig-out/bin" pushd $RISCOF_BASE_DIR > /dev/null cleanup() { popd > /dev/null } trap cleanup EXIT if [ ! -d $...
0
repos/zriscv/riscof
repos/zriscv/riscof/zriscv/zriscv_isa.yaml
hart_ids: [0] hart0: ISA: RV64IM physical_addr_sz: 48 User_Spec_Version: '2.3' Privilege_Spec_Version: '1.11' supported_xlen: [64] misa: rv64: accessible: true
0
repos/zriscv/riscof
repos/zriscv/riscof/zriscv/zriscv_platform.yaml
mtime: implemented: true address: 0xbff8 mtimecmp: implemented: true address: 0x4000 nmi: label: nmi_vector reset: label: reset_vector
0
repos/zriscv/riscof
repos/zriscv/riscof/zriscv/riscof_zriscv.py
import os import re import shutil import subprocess import shlex import logging import random import string from string import Template import sys import riscof.utils as utils import riscof.constants as constants from riscof.pluginTemplate import pluginTemplate logger = logging.getLogger() class zriscv(pluginTemplat...
0
repos/zriscv/riscof/zriscv
repos/zriscv/riscof/zriscv/env/model_test.h
#ifndef _COMPLIANCE_MODEL_H #define _COMPLIANCE_MODEL_H #define RVMODEL_DATA_SECTION \ .pushsection .tohost,"aw",@progbits; \ .align 8; .global tohost; tohost: .dword 0; \ .align 8; .global fromhost; fromhost: .dword 0; \ .po...
0
repos/zriscv/riscof/zriscv
repos/zriscv/riscof/zriscv/env/link.ld
OUTPUT_ARCH( "riscv" ) ENTRY(rvtest_entry_point) SECTIONS { . = 0x80000000; .text.init : { *(.text.init) } . = ALIGN(0x1000); .tohost : { *(.tohost) } . = ALIGN(0x1000); .text : { *(.text) } . = ALIGN(0x1000); .data : { *(.data) } .data.string : { *(.data.string)} .bss : { *(.bss) } _end = .; }
0
repos/zriscv/riscof
repos/zriscv/riscof/sail_cSim/__init__.py
from pkgutil import extend_path __path__ = extend_path(__path__, __name__)
0
repos/zriscv/riscof
repos/zriscv/riscof/sail_cSim/riscof_sail_cSim.py
import os import re import shutil import subprocess import shlex import logging import random import string from string import Template import riscof.utils as utils from riscof.pluginTemplate import pluginTemplate import riscof.constants as constants from riscv_isac.isac import isac logger = logging.getLogger() clas...
0
repos/zriscv/riscof/sail_cSim
repos/zriscv/riscof/sail_cSim/env/model_test.h
#ifndef _COMPLIANCE_MODEL_H #define _COMPLIANCE_MODEL_H #define RVMODEL_DATA_SECTION \ .pushsection .tohost,"aw",@progbits; \ .align 8; .global tohost; tohost: .dword 0; \ .align 8; .global fromhost; fromhost: .dword 0; \ .p...
0
repos/zriscv/riscof/sail_cSim
repos/zriscv/riscof/sail_cSim/env/link.ld
OUTPUT_ARCH( "riscv" ) ENTRY(rvtest_entry_point) SECTIONS { . = 0x80000000; .text.init : { *(.text.init) } . = ALIGN(0x1000); .tohost : { *(.tohost) } . = ALIGN(0x1000); .text : { *(.text) } . = ALIGN(0x1000); .data : { *(.data) } .data.string : { *(.data.string)} .bss : { *(.bss) } _end = .; }
0
repos/zriscv
repos/zriscv/zriscv_cli/Interactive.zig
const std = @import("std"); const known_folders = @import("known_folders"); const bestline = @import("bestline"); const Self = @This(); allocator: std.mem.Allocator, history_path: [:0]const u8, pub fn init(allocator: std.mem.Allocator, file_path: []const u8) !Self { const history_path = try getHistoryPathAndEnsu...
0
repos/zriscv
repos/zriscv/zriscv_cli/main.zig
const std = @import("std"); const builtin = @import("builtin"); const build_options = @import("build_options"); const args = @import("args"); const tracy = @import("tracy"); const zriscv = @import("zriscv"); const Interactive = @import("Interactive.zig"); // Configure tracy pub const trace = build_options.trace; pub c...
0
repos/zriscv
repos/zriscv/.devcontainer/devcontainer.json
{ "image": "mcr.microsoft.com/devcontainers/universal:2", "features": { "ghcr.io/devcontainers-contrib/features/zig:1": { "version": "master" } }, "postCreateCommand": "git submodule update --init", "customizations": { "vscode": { "extensions": [ "tiehuis.zig", "AugusteRame.zls-vscode" ] }...
0
repos/zriscv
repos/zriscv/zriscv_gui/main.zig
const std = @import("std"); const builtin = @import("builtin"); const build_options = @import("build_options"); const args = @import("args"); const tracy = @import("tracy"); const zriscv = @import("zriscv"); // Configure tracy pub const trace = build_options.trace; pub const trace_callstack = build_options.trace_calls...
0
repos/zriscv
repos/zriscv/.vscode/extensions.json
{ "recommendations": [ "tiehuis.zig", "augusterame.zls-vscode" ] }
0
repos/zriscv
repos/zriscv/.vscode/tasks.json
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "zig build", "type": "process", "command": "zig", "args": [ "build" ]...
0
repos/zriscv/libraries
repos/zriscv/libraries/tracy/tracy.zig
const std = @import("std"); const root = @import("root"); const builtin = @import("builtin"); const enable: bool = if (builtin.is_test and !@hasDecl(root, "trace")) false else root.trace; const enable_callstack: bool = if (builtin.is_test and !@hasDecl(root, "trace_callstack")) false else root.trace_callstack; const c...
0
repos/zriscv/libraries
repos/zriscv/libraries/bestline/bestline.zig
const std = @import("std"); pub const c = @cImport(@cInclude("bestline.h")); pub const Completions = extern struct { len: c_ulong, cvec: [*c][*c]u8, pub inline fn addCompletion(self: *Completions, str: [:0]const u8) void { c.bestlineAddCompletion(@as([*c]c.bestlineCompletions, @ptrCast(self)), str...
0
repos
repos/zorrow/CODE_OF_CONDUCT.md
# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex ch...
0
repos
repos/zorrow/README.md
# Zorrow This is a userlevel implementation of borrowchk in Zig. This system is *not* borrowchk, as it requires to pass in unique types for operations like acquiring a borrow, and reading from it. This library does not check for uniqueness of the types passed in, it's up to the programmer to do this correctly. An exam...
0
repos
repos/zorrow/build.zig
const Builder = @import("std").build.Builder; pub fn build(b: *Builder) void { const mode = b.standardReleaseOptions(); const lib = b.addStaticLibrary("zorrow", "src/main.zig"); lib.setBuildMode(mode); lib.install(); var main_tests = b.addTest("src/main.zig"); main_tests.setBuildMode(mode); ...
0
repos/zorrow
repos/zorrow/src/main.zig
const testing = @import("std").testing; fn Borrow(comptime T: type, comptime borrows: *usize) type { comptime var alive = true; return struct { pointer: *const T, const Self = @This(); pub fn read(self: *const Self, comptime uniq: anytype) T { _ = uniq; if (!ali...
0
repos
repos/zcoff/README.md
# zcoff Like `dumpbin.exe` but cross-platform. ## Usage Available options: ``` > zcoff /? Usage: zcoff [options] file General options: -archivemembers Print archive members summary. -archivesymbols Print archive symbol table. -directives Print linker directives. -headers ...
0
repos
repos/zcoff/build.zig
const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const mode = b.standardOptimizeOption(.{}); const exe = b.addExecutable(.{ .name = "zcoff", .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimi...
0
repos/zcoff
repos/zcoff/src/Library.zig
gpa: Allocator, data: []const u8, symdef: Symdef = .{}, symdef_sorted: SymdefSorted = .{}, longnames: []const u8 = &[0]u8{}, members: std.MultiArrayList(Member) = .{}, pub fn isLibrary(data: []const u8) bool { return std.mem.eql(u8, data[0..magic.len], magic); } pub fn deinit(self: *Library) void { self.symd...
0
repos/zcoff
repos/zcoff/src/main.zig
const std = @import("std"); const Library = @import("Library.zig"); const Object = @import("Object.zig"); var allocator = std.heap.GeneralPurposeAllocator(.{}){}; const gpa = allocator.allocator(); const usage = \\Usage: zcoff [options] file \\ \\General options: \\-archivemembers Print arc...
0
repos/zcoff
repos/zcoff/src/Object.zig
gpa: Allocator, data: []const u8, is_image: bool = false, coff_header_offset: usize = 0, pub fn print(self: *const Object, writer: anytype, options: anytype) !void { if (options.headers) try self.printHeaders(writer); if (options.directives) try self.printDirectives(writer); var base_relocs_dir: ?coff.Im...
0
repos
repos/zzdoc/zeit.zig
const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const s_per_day = std.time.s_per_day; const days_per_era = 365 * 400 + 97; pub fn now() Date { const ts = std.time.timestamp(); const days = daysSinceEpoch(ts); return civilFromDays(days); } pub const Date = ...
0
repos
repos/zzdoc/zzdoc.zig
const std = @import("std"); const assert = std.debug.assert; const zeit = @import("zeit.zig"); pub fn addManpageStep(b: *std.Build, options: ManpageOptions) *ManpageStep { const self = b.allocator.create(ManpageStep) catch unreachable; self.* = ManpageStep.create(b, options); return self; } pub const Manp...
0
repos
repos/zzdoc/main.zig
const std = @import("std"); const zzdoc = @import("zzdoc.zig"); pub fn main() !void { const stdin = std.io.getStdIn().reader(); const stdout = std.io.getStdOut().writer(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer { const deinit_status = gpa.deinit(); if (deinit_status =...
0
repos
repos/zzdoc/README.md
# zzdoc `zzdoc` is a 1:1 port of `scdoc`, designed for use in your `build.zig` file. It will compile `scdoc` syntax into roff manpages. It will do so without requiring `scdoc` to be installed on the host system. All `scdoc` tests have been ported as well, ensuring `zzdoc` produces consistent output. ## Usage `zzdoc`...
0
repos
repos/zzdoc/build.zig.zon
.{ .name = "zzdoc", .version = "0.0.0", .dependencies = .{}, .paths = .{ "LICENSE", "build.zig", "build.zig.zon", "zeit.zig", "zzdoc.zig", }, }
0
repos
repos/zzdoc/build.zig
const std = @import("std"); const zzdoc = @import("zzdoc.zig"); pub usingnamespace zzdoc; pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); _ = b.addModule("zzdoc", .{ .root_source_file = b.path("zzdoc.zig"), .t...
0
repos
repos/nanovg/premake4.lua
local action = _ACTION or "" solution "nanovg" location ( "build" ) configurations { "Debug", "Release" } platforms {"native", "x64", "x32"} project "nanovg" language "C" kind "StaticLib" includedirs { "src" } files { "src/*.c" } targetdir("build") defines { "_CRT_SECURE_NO_WARNINGS" } --,"FONS_US...
0
repos
repos/nanovg/LICENSE.txt
Copyright (c) 2013 Mikko Mononen memon@inside.org This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial a...
0
repos
repos/nanovg/README.md
*This project is not actively maintained.* NanoVG ========== NanoVG is small antialiased vector graphics rendering library for OpenGL. It has lean API modeled after HTML5 canvas API. It is aimed to be a practical and fun toolset for building scalable user interfaces and visualizations. ## Screenshot ![screenshot of...
0
repos/nanovg
repos/nanovg/example/perf.c
#include "perf.h" #include <stdio.h> #include <string.h> #include <math.h> #ifdef NANOVG_GLEW # include <GL/glew.h> #endif #include <GLFW/glfw3.h> #include "nanovg.h" #ifdef _MSC_VER #define snprintf _snprintf #elif !defined(__MINGW32__) #include <iconv.h> #endif // timer query support #ifndef GL_ARB_timer_query #de...
0
repos/nanovg
repos/nanovg/example/example_gles3.c
// // Copyright (c) 2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // ...
0
repos/nanovg
repos/nanovg/example/example_gl3.c
// // Copyright (c) 2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // ...
0
repos/nanovg
repos/nanovg/example/example_gles2.c
// // Copyright (c) 2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // ...
0
repos/nanovg
repos/nanovg/example/example_fbo.c
// // Copyright (c) 2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // ...
0
repos/nanovg
repos/nanovg/example/stb_image_write.h
/* stbiw-0.92 - public domain - http://nothings.org/stb/stb_image_write.h writes out PNG/BMP/TGA images to C stdio - Sean Barrett 2010 no warranty implied; use at your own risk Before including, #define STB_IMAGE_WRITE_IMPLEMENTATION in the file that you want to have the implement...
0
repos/nanovg
repos/nanovg/example/example_gl2.c
// // Copyright (c) 2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // ...
0
repos/nanovg
repos/nanovg/example/perf.h
#ifndef PERF_H #define PERF_H #include "nanovg.h" #ifdef __cplusplus extern "C" { #endif enum GraphrenderStyle { GRAPH_RENDER_FPS, GRAPH_RENDER_MS, GRAPH_RENDER_PERCENT, }; #define GRAPH_HISTORY_COUNT 100 struct PerfGraph { int style; char name[32]; float values[GRAPH_HISTORY_COUNT]; int head; }; ty...
0
repos/nanovg
repos/nanovg/example/demo.c
#include "demo.h" #include <stdio.h> #include <string.h> #include <math.h> #ifdef NANOVG_GLEW # include <GL/glew.h> #endif #include <GLFW/glfw3.h> #include "nanovg.h" #define STB_IMAGE_WRITE_IMPLEMENTATION #include "stb_image_write.h" #ifdef _MSC_VER #define snprintf _snprintf #elif !defined(__MINGW32__) #include <i...
0
repos/nanovg
repos/nanovg/example/LICENSE_OFL.txt
This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------...
0
repos/nanovg
repos/nanovg/example/images.txt
Image credits http://cuteoverload.com/2013/11/05/mom-taxi-xvi-birthday-party/ http://cuteoverload.com/2013/11/05/benson-hedges-private-eye-in-the-case-of-the-crafty-craftsman/ http://cuteoverload.com/2013/11/05/no-underwater-ballets/ http://cuteoverload.com/2013/11/05/every-nose-has-a-story/ http://cuteoverload.com/201...
0
repos/nanovg
repos/nanovg/example/demo.h
#ifndef DEMO_H #define DEMO_H #include "nanovg.h" #ifdef __cplusplus extern "C" { #endif struct DemoData { int fontNormal, fontBold, fontIcons, fontEmoji; int images[12]; }; typedef struct DemoData DemoData; int loadDemoData(NVGcontext* vg, DemoData* data); void freeDemoData(NVGcontext* vg, DemoData* data); void ...
0
repos/nanovg
repos/nanovg/src/nanovg.c
// // Copyright (c) 2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // ...
0
repos/nanovg
repos/nanovg/src/stb_image.h
/* stb_image - v2.10 - public domain image loader - http://nothings.org/stb_image.h no warranty implied; use at your own risk Do this: #define STB_IMAGE_IMPLEMENTATION before you include this file in *one* C or C++ file to create the implementation. // i.e. it shoul...
0
repos/nanovg
repos/nanovg/src/nanovg.h
// // Copyright (c) 2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // ...
0
repos/nanovg
repos/nanovg/src/fontstash.h
// // Copyright (c) 2009-2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose...
0
repos/nanovg
repos/nanovg/src/stb_truetype.h
// stb_truetype.h - v1.24 - public domain // authored from 2009-2020 by Sean Barrett / RAD Game Tools // // ======================================================================= // // NO SECURITY GUARANTEE -- DO NOT USE THIS ON UNTRUSTED FONT FILES // // This library does no range checking of the offsets found in ...
0
repos/nanovg
repos/nanovg/src/nanovg_gl.h
// // Copyright (c) 2009-2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose...
0
repos/nanovg
repos/nanovg/src/nanovg_gl_utils.h
// // Copyright (c) 2009-2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose...
0
repos/nanovg
repos/nanovg/obsolete/nanovg_gl2.h
// // Copyright (c) 2009-2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose...
0
repos/nanovg
repos/nanovg/obsolete/nanovg_gl3.h
// // Copyright (c) 2009-2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose...
0
repos/nanovg
repos/nanovg/obsolete/obsolete.md
The files in this folder will be removed in near future. - nanovg_gl2.h and nanovg_gl3.h - These were the first GL2 and GL3 backends - an optimized version of the gl3 backed was build and later GL2 support was added to it - the new combined backend has superseded the individual backends
0
repos
repos/gpt4all.zig/zig.news.md
# Bringing ChatGPT-like AI Models to Your Local Machine with ZIG This is yet another showcase of how easy it is to build a C/C++ codebase with Zig, opening up the opportunity to even extend or build on it with Zig in the future. _Please note, this article was almost entirely written by ChatGPT, based on the README of...
0
repos
repos/gpt4all.zig/LICENSE.gpt4all.cpp
MIT License Copyright (c) 2023 Georgi Gerganov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, d...
0
repos
repos/gpt4all.zig/README.md
<h1 align="center">GPT4All.zig</h1> <p align="center">ZIG build for a terminal-based chat client for an assistant-style large language model with ~800k GPT-3.5-Turbo Generations based on LLaMa</p> <p align="center"></p> ![](https://github.com/renerocksai/gpt4all.zig/actions/workflows/checkzig11.yml/badge.svg) # Run a...
0
repos
repos/gpt4all.zig/build.zig
const std = @import("std"); // thanks to github.com/mattnite !!! const libcurl = @import("src/zig-libcurl/libcurl.zig"); const mbedtls = @import("src/zig-libcurl/zig-mbedtls/mbedtls.zig"); const zlib = @import("src/zig-libcurl/zig-zlib/zlib.zig"); const libssh2 = @import("src/zig-libcurl/zig-libssh2/libssh2.zig"); pu...
0
repos
repos/gpt4all.zig/flake.nix
{ description = "zap dev shell"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; flake-utils.url = "github:numtide/flake-utils"; # required for latest zig zig.url = "github:mitchellh/zig-overlay"; # Used for shell.nix flake-compat = { url = github:edolstra/flake-compa...
0
repos
repos/gpt4all.zig/flake.lock
{ "nodes": { "flake-compat": { "flake": false, "locked": { "lastModified": 1673956053, "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type...
0
repos/gpt4all.zig
repos/gpt4all.zig/src/main.zig
const std = @import("std"); const download_to_file = @import("download.zig").download_to_file; pub extern fn cpp_main(argc: c_int, argv: [*][*c]const u8) c_int; const DEFAULT_MODEL_URL = "https://gpt4all.io/models/ggml-gpt4all-j.bin"; const DEFAULT_MODEL = "ggml-gpt4all-j.bin"; pub fn main() !u8 { const allocato...
0
repos/gpt4all.zig
repos/gpt4all.zig/src/download.zig
const std = @import("std"); const curl = @import("curl"); /// download url -> output_fn /// first read into a fifo and only on completion, write everything to file pub fn download_to_file(url: []const u8, output_fn: []const u8) !void { const Fifo = std.fifo.LinearFifo(u8, .{ .Dynamic = {} }); try curl.globalI...
0
repos/gpt4all.zig/src
repos/gpt4all.zig/src/llm/gptj.cpp
#include "gptj.h" #include "ggml/ggml.h" #include "utils.h" #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <map> #include <string> #include <vector> #include <iostream> #include <unistd.h> // load the model's weights from a stream bool gptj_model_load(const std:...
0
repos/gpt4all.zig/src
repos/gpt4all.zig/src/llm/gptj.h
#ifndef GPTJ_H #define GPTJ_H #include <string> #include <functional> #include <vector> #include "llmodel.h" #include "ggml/ggml.h" #include "utils.h" #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <map> #include <string> #include <vector> #include <iostream> #...
0
repos/gpt4all.zig/src
repos/gpt4all.zig/src/llm/utils.cpp
#include "utils.h" #include <fstream> #include <regex> bool gpt_params_parse(int argc, char ** argv, gpt_params & params) { for (int i = 1; i < argc; i++) { std::string arg = argv[i]; if (arg == "-s" || arg == "--seed") { params.seed = std::stoi(argv[++i]); } else if (arg == "...
0
repos/gpt4all.zig/src
repos/gpt4all.zig/src/llm/utils.h
// Various helper functions and utilities #pragma once #include <string> #include <map> #include <vector> #include <random> #include <thread> // // CLI argument parsing // struct gpt_params { int32_t seed = -1; // RNG seed int32_t n_threads = std::min(4, (int32_t) std::thread::hardware_concurrency()); ...