avatar_url
stringlengths 46
116
⌀ | name
stringlengths 1
46
| full_name
stringlengths 7
60
| created_at
stringdate 2016-04-01 08:17:56
2025-05-20 11:38:17
| description
stringlengths 0
387
⌀ | default_branch
stringclasses 45
values | open_issues
int64 0
4.93k
| stargazers_count
int64 0
78.2k
| forks_count
int64 0
3.09k
| watchers_count
int64 0
78.2k
| tags_url
stringlengths 0
94
| license
stringclasses 27
values | topics
listlengths 0
20
| size
int64 0
4.82M
| fork
bool 2
classes | updated_at
stringdate 2018-11-13 14:41:18
2025-05-22 08:23:54
| has_build_zig
bool 2
classes | has_build_zig_zon
bool 2
classes | zig_minimum_version
stringclasses 60
values | repo_from
stringclasses 3
values | dependencies
listlengths 0
121
| readme_content
stringlengths 0
437k
| dependents
listlengths 0
21
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
https://avatars.githubusercontent.com/u/166043157?v=4 | zig | FnCtrlOption/zig | 2021-07-18T23:53:06Z | General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/FnCtrlOption/zig/tags | MIT | [
"zig"
]
| 152,732 | true | 2024-08-24T22:55:01Z | true | false | unknown | github | []
|
A general-purpose programming language and toolchain for maintaining
<strong>robust</strong>, <strong>optimal</strong>, and <strong>reusable</strong> software.
Resources
<ul>
<li><a>Introduction</a></li>
<li><a>Download & Documentation</a></li>
<li><a>Chapter 0 - Getting Started | ZigLearn.org</a></li>
<li><a>Community</a></li>
<li><a>Contributing</a></li>
<li><a>Code of Conduct</a></li>
<li><a>Frequently Asked Questions</a></li>
<li><a>Community Projects</a></li>
</ul>
Installation
<ul>
<li><a>download a pre-built binary</a></li>
<li><a>install from a package manager</a></li>
<li><a>build from source</a></li>
<li><a>bootstrap zig for any target</a></li>
</ul>
License
The ultimate goal of the Zig project is to serve users. As a first-order
effect, this means users of the compiler, helping programmers to write better
software. Even more important, however, are the end-users.
Zig is intended to be used to help <strong>end-users</strong> accomplish their goals. Zig
should be used to empower end-users, never to exploit them financially, or to
limit their freedom to interact with hardware or software in any way.
However, such problems are best solved with social norms, not with software
licenses. Any attempt to complicate the software license of Zig would risk
compromising the value Zig provides.
Therefore, Zig is available under the MIT (Expat) License, and comes with a
humble request: use it to make software better serve the needs of end-users.
This project redistributes code from other projects, some of which have other
licenses besides MIT. Such licenses are generally similar to the MIT license
for practical purposes. See the subdirectories and files inside lib/ for more
details. | []
|
https://avatars.githubusercontent.com/u/3133628?v=4 | Zag | Yong-Yue/Zag | 2021-06-10T07:43:21Z | A web framework for Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Yong-Yue/Zag/tags | MIT | [
"zig",
"ziglang"
]
| 1 | false | 2021-06-10T07:48:43Z | false | false | unknown | github | []
| Zag
A web framework for Zig. | []
|
https://avatars.githubusercontent.com/u/442455?v=4 | nim-opengl-test | dinau/nim-opengl-test | 2022-01-24T12:26:54Z | OpenGL test program with Nim language | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/dinau/nim-opengl-test/tags | MIT | [
"glfw",
"glfw3",
"mandelbrot",
"nim",
"nim-lang",
"opengl",
"zig",
"ziglang"
]
| 16,171 | false | 2023-11-09T06:26:24Z | false | false | unknown | github | []
|
<ul>
<li><a>nim-opengl-test</a></li>
<li><a>Draw Mandelbrot</a></li>
<li><a>Build and run</a></li>
<li><a>Nim Verson and make</a></li>
<li><a>Winodws10 64bit dll</a></li>
<li><a>Static link</a></li>
<li><a>Operation</a></li>
</ul>
nim-opengl-test
OpenGL test program with Nim language
This program is referred from this page,
* https://github.com/rylmovuk/zig-opengl-test
Thank you nice demo.
and converted to Nim language.
Draw Mandelbrot
Note: I only confirmed on Windows10 32bit enviromnet at this moment.
Build and run
<code>sh
git clone http://github.com/dinau/nim-opengl-test.git
cd nim-opengl-test
nimble run</code>
Nim Verson and make
If you'd like to use <code>nimble build/run</code> or etc,
Nim version must be <code>nim-1.6.0</code> or later.
Because GFLW-3.3 warpper depends on nim-1.6.0 or later.
However if you'd like to use <code>nim-1.0.0</code> or later,
use to build,
<code>sh
make</code>
Winodws10 64bit dll
If you are on Windows10 64bit OS,
replace <code>glfw3.dll</code> with <code>glfw3.dll-64bit/glfw3.dll</code>.
Static link
If you'd like to statically link glfw3 library,
enable below line,
<code>switch "define","glfwStaticLib"`</code>
in <code>config.nims</code>
Operation
<ul>
<li>Pause drawing: Press <code>S</code> key : toggled</li>
<li>Quit program: Press <code>Q</code> key or <code>Esc</code> key</li>
<li>Reset windows size: Press <code>R</code> key</li>
</ul> | []
|
https://avatars.githubusercontent.com/u/32725020?v=4 | zig-8 | lappn99/zig-8 | 2021-03-08T05:56:22Z | WIP Chip-8 Interpreter | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/lappn99/zig-8/tags | - | [
"zig"
]
| 101 | false | 2021-03-27T21:17:56Z | true | false | unknown | github | []
| zig-8
CHIP-8 Interpreter in the Zig programming language
Using <a>Cowgods Technical Reference</a> as a technical guide
| Feature | Working | Note |
| ------------- |-------------| -----|
| Full instruction set | no | 00E0 - Fx1E implemented |
| Memory | yes | |
| Renderer | yes | |
| Input | yes | |
| Sound | no | Probaly the last thing ill do |
| Timers | almost | Delay timer, need to do sound timer |
WIP
The "countdown.ch8" program should work in the interpreters current state. | []
|
https://avatars.githubusercontent.com/u/877376?v=4 | req | ixalender/req | 2021-02-20T16:19:25Z | A simple HTTP client | master | 1 | 0 | 0 | 0 | https://api.github.com/repos/ixalender/req/tags | - | [
"command-line-tool",
"http-client",
"zig",
"ziglang"
]
| 2 | false | 2021-02-20T17:25:50Z | true | false | unknown | github | []
| Req
A simple http client
Dependencies
<a>Zig</a> 0.7.1
Installation
After cloning the repository, run <code>zig build</code>. The req executable will be located in <code>zig-cache/bin/req</code>.
Usage
```
req [METHOD] URL
METHOD
The HTTP method to be used for the request (GET, POST, PUT, DELETE, ...).
By default req uses GET method.
URL
Default scheme is 'http://' if the URL does not include any.
General Options:
<code>-h, --help Usage information
</code>
``` | []
|
https://avatars.githubusercontent.com/u/39606633?v=4 | zmcdata | kvoli/zmcdata | 2021-06-17T14:21:53Z | mcdata code generator for zig. 1.8-1.17.1 packets supported. Serde and utility functions provided. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/kvoli/zmcdata/tags | - | [
"minecraft",
"zig"
]
| 250 | false | 2022-01-19T20:03:16Z | true | false | unknown | github | []
| zmcdata
A Zig 1.8-1.17 packet protocol library.
Parses data from <a>minecraft-data</a> and generates Zig packet types.
automatic serialization/deseriaization are also provided. | []
|
https://avatars.githubusercontent.com/u/5475256?v=4 | zigzag | CORDEA/zigzag | 2021-12-30T13:47:03Z | Answers to rosettacode's tasks | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/CORDEA/zigzag/tags | CC0-1.0 | [
"rosettacode",
"zig"
]
| 7 | false | 2022-01-08T03:32:46Z | true | false | unknown | github | []
| zigzag | []
|
https://avatars.githubusercontent.com/u/1892046?v=4 | tint | nsmryan/tint | 2021-05-28T14:09:01Z | Tint is an experiment in attempting to encode integers and other data in the Zig type system. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/nsmryan/tint/tags | - | [
"zig"
]
| 4 | false | 2021-05-30T13:19:46Z | true | false | unknown | github | []
| This repository contains a few type level programming experiments
in Zig. I wrote a short blog post about it here:
https://itscomputersciencetime.netlify.app/zig-type-level-programming | []
|
https://avatars.githubusercontent.com/u/25717773?v=4 | greddit-server | yikedu7/greddit-server | 2021-05-17T02:15:39Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/yikedu7/greddit-server/tags | - | [
"aws",
"aws-lambda",
"gofiber",
"golang",
"serverless",
"serverless-framework",
"zig"
]
| 138 | false | 2021-11-23T15:13:31Z | false | false | unknown | github | []
|
This project show you how to host an API server on AWS Lambda Function.
<strong>DO NOT USE IT ON PRODUCTION!!!</strong>
<a>Online Demo</a>
Tech Stack
<ul>
<li>Golang / Gofiber for backend</li>
<li>SQLite for storage</li>
<li>AWS / Serverless Framework for deployment</li>
<li>Zig for cgo cross-compile</li>
</ul>
Local Setup
<ol>
<li>Create <code>.env.local</code> file like <code>.env.example</code></li>
<li>To run this project locally, run this command in root directory:
<code>shell
go run ./cmd/server/main.go</code></li>
</ol>
Deploy
<ol>
<li><a>Install and setup Serverless Framework and AWS.</a></li>
<li><a>Install Zig.</a></li>
<li>Run this command to deploy lambda function:
<code>shell
make deploy</code></li>
</ol> | []
|
https://avatars.githubusercontent.com/u/15804258?v=4 | dross-zig | ZealousProgramming/dross-zig | 2021-05-01T23:31:19Z | dross-zig is a bare bones game framework written in ⚡Zig⚡, and created as a means of learning game framework architecture in a zig environment. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/ZealousProgramming/dross-zig/tags | MIT | [
"dross-zig",
"zig"
]
| 1,328 | false | 2022-08-06T23:38:57Z | true | false | unknown | github | []
| <strong>dross-zig</strong>
<em><strong>dross-zig</strong></em> is a bare bones game framework written in :zap:<a>Zig</a>:zap:, and created as a means of learning game framework architecture in a zig environment.
<strong>Disclaimer</strong>
I do <strong><em>not</em></strong> recommend using this framework as its existence has been purely for educational purposes. The code that you see is poorly optimized and completely novice.
Dependencies
<strong>Zig</strong>:
- <a>zalgebra</a>
- <a>zig-miniaudio</a>
<strong>C/C++ libraries</strong>:
- GLFW (Window and input)
- OpenGL (Graphics API)
- GLAD (OpenGL helper)
- FreeType2 (Font Loading)
- Sean Barrett Collection:
- stb_image (Image Loading)
- Miniaudio via zig-miniaudio(Audio)
Feature TODOs
<ul>
<li>Legend: x - Initial Implementation
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> - Batch Rendering
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> - Input Wrapper
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> - Font Rendering
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> - Audio System</li>
</ul> | []
|
https://avatars.githubusercontent.com/u/145012?v=4 | zig-ulid | toffaletti/zig-ulid | 2021-11-29T08:53:21Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/toffaletti/zig-ulid/tags | MIT | [
"zig"
]
| 4 | false | 2021-12-22T22:55:07Z | true | false | unknown | github | []
| 404 | []
|
https://avatars.githubusercontent.com/u/104643?v=4 | handmade-zero | charlieman/handmade-zero | 2021-03-23T06:14:10Z | Handmade Hero written in ⚡ Zig ⚡ | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/charlieman/handmade-zero/tags | MIT | [
"game-development",
"handmade-hero",
"zig"
]
| 46 | false | 2021-07-08T07:29:48Z | true | false | unknown | github | []
| 404 | []
|
https://avatars.githubusercontent.com/u/2859122?v=4 | entities | kooparse/entities | 2021-02-13T13:31:43Z | A generic system for entities with handle behavior. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/kooparse/entities/tags | MIT | [
"entities",
"game-engine",
"gamedev",
"generational-index",
"zig",
"ziglang"
]
| 10 | false | 2021-06-05T11:12:29Z | true | false | unknown | github | []
| Entities
Generic system of entities written in zig. Without ABA problems, using
generational index in order to access the associated data. The code is clear and simple to understand.
Examples
```zig
usingnamespace @import("entities");
pub fn main () void {
var entities = Entities(f32).init(default_allocator);
const handle_1 = try entities.append(1.5);
const handle_2 = try entities.append(2.5);
const handle_3 = try entities.append(3.5);
// You could hardcode specific handle id.
const handle_4 = try entities.append_hard(4.5, 55);
// Getting the inner data by using associated handle.
print("{}\n", .{entities.get(handle_2)});
// Removes data using bucket pooling.
entities.remove(handle_1);
// Iterator over all active handles.
var it = entities.interate();
while(it.next()) |datum| {
print("datum: {}\n", .{datum.*});
}
}
``` | []
|
https://avatars.githubusercontent.com/u/674705?v=4 | godot-zig | atomicptr/godot-zig | 2022-01-23T19:04:11Z | Zig bindings for the Godot script API | master | 8 | 0 | 0 | 0 | https://api.github.com/repos/atomicptr/godot-zig/tags | MIT | [
"gdnative",
"gdnative-bindings",
"godot",
"godot-engine",
"zig"
]
| 789 | false | 2022-12-12T19:37:42Z | true | false | unknown | github | []
| godot-zig
This repository contains Zig bindings for the <a>Godot Engine</a>'s GDNative API.
<strong>This project is a work in progress and you probably shouldn't use it.</strong>
Engine compatibility
Currently only Godot 3.4 is officially supported. You can probably get other 3.x versions working by switching
the tag of godot-headers and re-generating the bindings.
Usage
TODO: add usage examples...
Inspired by
<ul>
<li><a>godotengine/godot-cpp</a></li>
<li><a>godot-rust/godot-rust</a></li>
<li><a>outrera/godot-zig</a></li>
</ul>
License
MIT | []
|
https://avatars.githubusercontent.com/u/6346865?v=4 | awesome-envoy | oslook/awesome-envoy | 2021-07-14T12:38:29Z | The examples and SDK ( WASM in many languages as Go, C++, Typescript, etc) for Envoy and Envoy Mobiles, The Artifacts pushed by Github Action. | main | 0 | 0 | 1 | 0 | https://api.github.com/repos/oslook/awesome-envoy/tags | MIT | [
"emscripten",
"envoy",
"envoy-mobile",
"envoyproxy",
"github-actions",
"wasm",
"webassembly",
"zig"
]
| 34 | false | 2024-03-01T18:00:26Z | false | false | unknown | github | []
| envoy-actions
Getting Started
Requirements
<ul>
<li>System: MacOS, Ubuntu or Windows</li>
<li>Bazel</li>
<li>Docker</li>
</ul>
Installation
Build and run Examples by Github Actions
:dart: Envoy
<ul>
<li>
build in docker ( Windows,Ubuntu )
<a></a>
</li>
<li>
build with bazel (MacOS, Windows, Ubuntu)
<a></a>
</li>
<li>
build in sandbox
<a></a>
</li>
<li>
supported:ubuntu
</li>
<li>:whale: build on docker image like <code>envoyproxy/envoy-build-ubuntu</code> </li>
</ul>
:dart: envoy-mobile
Mobile client networking libraries based on the Envoy project.
To build Envoy Mobile, your system must also be set up for building Envoy. To get started, you can use the Github Action Workflows.
Envoy Mobile can build on MacOS, selected macOS for the 3 cpu cores.
The output of Envoy Mobile for each launguage(Android,iOS):
- Java: envoy_android_aar_sources
- Kotlin: envoy_android_aar_sources
- objective-c: envoy_ios_framework
- Swift: envoy_ios_cocoapods
Github Action Workflows
- Android
<a></a>
<ul>
<li>
CPU Arch supported: <code>x86, armeabi-v7a, arm64-v8a</code> (Official only <code>x86</code>)
</li>
<li>
iOS
<a></a>
</li>
<li>
CPU Arch supported: i386,x86_64,armv7,arm64
</li>
<li>
Artifacts
<a></a>
</li>
<li>The workflow not use the github cache, fully build and upload the sdk and examples.</li>
</ul>
:dart: envoy-mobile-app
TODO:
Compatible Envoy builds
Envoy is the first host side implementation of Proxy-Wasm ABI,
and we run end-to-end tests with multiple versions of Envoy and Envoy-based <a>istio/proxy</a> in order to verify each Proxy-Wasm SDK works as expected.
Please refer to <a>workflows</a> for which version is used for End-to-End tests.
External links
<ul>
<li><a>WebAssembly for Proxies (ABI specification)</a></li>
<li><a>WebAssembly for Proxies (AssemblyScript SDK)</a></li>
<li><a>WebAssembly for Proxies (C++ SDK)</a></li>
<li><a>WebAssembly for Proxies (Rust SDK)</a></li>
<li><a>WebAssembly for Proxies (Zig SDK)</a></li>
</ul> | []
|
https://avatars.githubusercontent.com/u/52403031?v=4 | eczig | cs-t1/eczig | 2022-01-05T16:54:10Z | ECC library for Zig, making use of the language's comptime features. It uses type reflection to automatize in-depth data extraction | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/cs-t1/eczig/tags | AGPL-3.0 | [
"ecc",
"error-correcting-codes",
"reflect",
"zig"
]
| 24 | false | 2022-01-07T08:44:59Z | true | false | unknown | github | []
| eczig
This is an automatic batteries-included solution for ECC over arbitrary values. An automatic data-extracion is performed, so every single bte of data inside the value you want to keep track of is getting handled. | []
|
https://avatars.githubusercontent.com/u/1330164?v=4 | zignify | enkore/zignify | 2021-12-12T17:19:39Z | Re-implementation of OpenBSD signify(1) in Zig (first code in Zig) | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/enkore/zignify/tags | ISC | [
"crypto",
"cryptography",
"signify",
"zig"
]
| 86 | false | 2022-01-02T14:10:53Z | true | false | unknown | github | []
| 404 | []
|
https://avatars.githubusercontent.com/u/53922987?v=4 | ziget | Ocysellus/ziget | 2021-04-04T02:51:36Z | simple wget in zig without libc | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/Ocysellus/ziget/tags | Unlicense | [
"networking",
"zig"
]
| 11 | true | 2021-04-04T03:20:07Z | true | false | unknown | github | []
| 404 | []
|
https://avatars.githubusercontent.com/u/31083665?v=4 | zig | DoWalet/zig | 2021-09-19T12:30:10Z | ZigUI | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/DoWalet/zig/tags | BSD-3-Clause | [
"component",
"components",
"components-library",
"library",
"ui",
"ui-components",
"zig",
"zigui"
]
| 8 | false | 2021-09-24T09:57:16Z | false | false | unknown | github | []
| Zig Componenets | []
|
https://avatars.githubusercontent.com/u/34610?v=4 | microzig | marnix/microzig | 2022-01-13T10:45:21Z | Unified abstraction layer and HAL for several microcontrollers (focus of this fork is STM32F3DISCOVERY board support) | marnix-main | 0 | 0 | 0 | 0 | https://api.github.com/repos/marnix/microzig/tags | Zlib | [
"hal",
"stm32f303",
"stm32f3discovery",
"zig"
]
| 17,974 | true | 2022-02-25T08:35:16Z | true | true | unknown | github | [
{
"commit": "c523a4d23469282f95658a879f5ba925757dc9d9.tar.gz",
"name": "uf2",
"tar_url": "https://github.com/ZigEmbeddedGroup/uf2/archive/c523a4d23469282f95658a879f5ba925757dc9d9.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/ZigEmbeddedGroup/uf2"
},
{
"commit": "b0ded63fc284da0ed9f4776eb7d1c4ad7175622d.tar.gz",
"name": "regz",
"tar_url": "https://github.com/ZigEmbeddedGroup/regz/archive/b0ded63fc284da0ed9f4776eb7d1c4ad7175622d.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/ZigEmbeddedGroup/regz"
},
{
"commit": "99d815adfbc5cc4ad385dd765a6192f85e54179f.tar.gz",
"name": "umm-zig",
"tar_url": "https://github.com/ZigEmbeddedGroup/umm-zig/archive/99d815adfbc5cc4ad385dd765a6192f85e54179f.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/ZigEmbeddedGroup/umm-zig"
}
]
| 404 | [
"https://github.com/FranciscoLlobet/efm32-freertos-zig",
"https://github.com/Harry-Heath/micro"
]
|
https://avatars.githubusercontent.com/u/12471122?v=4 | aoc2021InZig | sendilkumarn/aoc2021InZig | 2021-12-02T20:17:50Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/sendilkumarn/aoc2021InZig/tags | - | [
"advent-of-code",
"advent-of-code-2021",
"adventofcode",
"adventofcode2021",
"zig",
"ziglang"
]
| 18 | false | 2021-12-07T10:37:20Z | false | false | unknown | github | []
| aoc2021InZig
<em>learning zig via advent of code.</em> | []
|
https://avatars.githubusercontent.com/u/12179851?v=4 | othello-nnue | leesongun/othello-nnue | 2021-06-24T05:29:44Z | A NNUE Othello engine | master | 0 | 0 | 2 | 0 | https://api.github.com/repos/leesongun/othello-nnue/tags | - | [
"bitboard",
"nnue",
"othello",
"zig"
]
| 145 | false | 2022-03-21T01:35:14Z | true | false | unknown | github | []
| Introduction
This is <a>Zig</a> port of <a>Othello move generator</a>.
Directory structure
<code>.
├── engine # Engine code
├── game # Othello implementation
│ ├── amd64 # AMD64-specific codes
│ └── arm64 # ARM64-specific codes
├── game # Othello implementation
├── perf # Benchmark tests
├── training # NNUE training
├── tui # Othello on terminal
├── build.zig # build file
└── readme.md
</code>
Move generation
We implement <a>Kogge-Stone Algorithm</a> for move generation. It should compile to vector instructions.
Move resolution
AMD64
On x86-64-v3 processors we implement PDEP/PEXT bitboard using 16.5KiB of LUT, which would fit in the L1D cache. We are working to reduce LUT further without harming performance.
Name | Type | Size
----:|----:|----:
<code>index</code>|<code>[64][4]u16</code>|0.5KiB
<code>mask</code>|<code>[64][4][2]u64</code>|4KiB
<code>result</code>|<code>[0x3000]u8</code>|12KiB
ARM
On ARM processors we implement <a>Hyperbola Quintessence</a> using <a>rbit instruction</a> and 2KiB of LUT.
Name | Type | Size
----:|----:|----:
<code>mask</code>|<code>[64][4]u64</code>|2KiB
Evaluation
AlphaZero
We train an <a>improved</a> version of AlphaZero, which generates game for NNUE training data. | []
|
https://avatars.githubusercontent.com/u/1067001?v=4 | lc3vm-zig | mdaverde/lc3vm-zig | 2021-09-08T20:15:25Z | Virtual machine for the LC3 ISA written in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/mdaverde/lc3vm-zig/tags | MIT | [
"lc3",
"vm",
"zig"
]
| 47 | false | 2021-10-01T14:39:37Z | true | false | unknown | github | []
| LC3vm-zig
Written entirely in Zig, this project implements a virtual machine for LC-3 programs.
Note: because Zig isn't stable yet and this project was based off a source code build off master (version below), this might be broken against your version of Zig. I'll be using this project as an excuse to keep up to date with the language so hopefully fixes will be merged when I get to it.
About LC-3
<blockquote>
Little Computer 3, or LC-3, is a type of computer educational programming language, an assembly language, which is a type of low-level programming language. The LC-3 was developed by Yale N. Patt at the University of Texas at Austin and Sanjay J. Patel at the University of Illinois at Urbana–Champaign. Their specification of the instruction set, the overall architecture of the LC-3, and a hardware implementation can be found in their textbook "Introduction to Computing Systems."
</blockquote>
<a>Wikipedia</a>
Instruction Set Architecture (ISA)
The specification for the ISA can be found <a>here</a>
Usage
Dependencies
Development was done using, at the time, the latest master branch of <a>Zig</a> on a Linux x86_64 machine.
<code>shell
$ zig version
0.9.0-dev.952+0c091feb5</code>
Build
<code>shell
$ zig build
$ ./zig-out/bin/lc3vm lc3program.obj</code>
Running from source
<code>$ zig run ./src/main.zig -- lc3program.obj</code>
Testing
<code>shell
$ zig test ./test.zig
All tests passed.</code>
References
For original inspiration, see <a>lc3-vm</a>
Could be cool to add
Full blown simulation debugging tools might be too much but could also be kinda fun
Windows support and macOS testing
License
MIT - Maintained by <a>Milan</a> | []
|
https://avatars.githubusercontent.com/u/2256154?v=4 | psm | sakateka/psm | 2021-07-02T18:44:07Z | Process Smaps Memory view | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/sakateka/psm/tags | MIT | [
"memory",
"monitoring",
"zig"
]
| 61 | false | 2024-05-19T18:56:24Z | true | true | unknown | github | [
{
"commit": "refs",
"name": "clap",
"tar_url": "https://github.com/Hejsil/zig-clap/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/Hejsil/zig-clap"
}
]
| psm
Process Smaps Memory view
This programm collects metrics from <code>/proc/<PID>/smaps_rollup</code>, then aggregates these numbers.
Aggregation is performed by the binary name from the <code>/proc/<PID>/exe</code> link.
The last step is to pretty print the resulting numbers.
screenshot
Note: tests.zig - is just a copy paste in the course of my reading https://ziglearn.org | []
|
https://avatars.githubusercontent.com/u/60219950?v=4 | SciMarkdown | omgitsmoe/SciMarkdown | 2021-06-20T23:22:59Z | A WIP Markdown variant with a focus on creating reproducible scientific documents. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/omgitsmoe/SciMarkdown/tags | MIT | [
"markdown",
"scientific-writing",
"zig"
]
| 603 | false | 2022-11-22T03:40:29Z | true | false | unknown | github | []
| SciMarkdown
A WIP Markdown variant with a focus on creating reproducible scientific documents.
Features
<ul>
<li>non-ambiguous syntax</li>
<li>convenient comments with <code>%%</code> (subject to change)</li>
<li>more intuitive in comparison with CommonMark Markdown and other variants:<ul>
<li>blocks don't require a leading blank line</li>
<li>removed superfluous syntax: e. g. Setext headings
<code>md
Heading
=======</code></li>
<li>two spaces at the end of the line for line breaks was removed, since
it wasn't visible when editing the raw markdown,
use <code>\</code> at the end of a line to force a line break instead</li>
<li>nested emphasis must be alternated:
<code>md
CommonMark: Combined emphasis with **asterisks and *underscores***.
SciMarkdown: Combined emphasis with **asterisks and _underscores_**.</code></li>
</ul>
</li>
<li>more emphasis options: strikethrough, sub-/superscript, smallcaps</li>
<li>execute fenced <strong>and</strong> inline code of supported programming lanugages (currently Python and R)
and include the stdout/-err output</li>
<li>labels and cross-references</li>
<li>citation support provided by <a>citeproc</a> -- for now</li>
<li>support for latex math formulas</li>
<li>no inline html, everything should be expressible in pure SciMarkdown</li>
<li>thus it will be easier to add more backends</li>
</ul>
Examples
See <a>this file</a> for a complete example of using SciMarkdown,
the HTML output can bee seen <a>here</a>.
Usage
```
Usage: scimd [-h] [-o ] [-r ] [-s ] [-l ] [--write-bib-conversion]
-h, --help
Display this help and exit.
<code>-o, --out <FILENAME>
Output filename.
-r, --references <FILENAME>
Path to references file (BibLaTeX or CSL-JSON).
-s, --citation-style <FILENAME>
Path to CSL file.
-l, --locale <LOCALE>
Specify locale as BCP 47 language tag.
--write-bib-conversion
Whether to write out the converted .bib file as CSL-JSON
</code>
``` | []
|
https://avatars.githubusercontent.com/u/799439?v=4 | begrudge | klardotsh/begrudge | 2021-09-27T09:52:52Z | convert ANSI-escaped colorized terminal output to classed HTML | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/klardotsh/begrudge/tags | 0BSD | [
"ansi",
"ansi-colors",
"html",
"zig"
]
| 46 | false | 2021-10-10T22:15:22Z | true | false | unknown | github | []
| begrudge: convert ANSI-escaped colorized terminal output to classed HTML
<code>begrudge(1)</code> is a small tool written in Zig to convert colorized terminal
output that uses <a>ANSI escape
sequences</a> into
class-based HTML snippets. It may be useful for converting the output of tools
such as <a><code>bat(1)</code></a> or
<a><code>glow(1)</code></a> into something web browsers
can understand, without the need to reinvent or even modify those renderers.
<code>begrudge</code> does not attempt to implement all known ANSI escape sequence
commands or the entire <a>Paul Flo Williams state
machine</a>, instead implementing the same
subset as <a><code>a2h(1)</code></a>, a similar
tool written in Ruby (though <code>a2h</code>'s code was not used here), thus, the
following escape sequences are supported:
<code><ESC>[0m
Resets all attributes / closes all HTML tags.
<ESC>[1m=<span class='begrudge-bold'>
Bold.
<ESC>[4m=<span class='begrudge-underscore'>
Underscore.
<ESC>[5m=<span class='begrudge-blink'>
Blink. For goodness' sake, please don't actually make your CSS blink this.
<ESC>[8m=<span class='begrudge-span'>
Hidden.
<ESC>[30-37m=<span class='begrudge-fg-0'>
Foreground color (30 -> 0, 37 -> 7, you get the idea).
Escape 38, "default color", is not yet implemented.
<ESC>[40-47m=<span style='background-color:color>
Background color (40 -> 0, 47 -> 7, you get the idea).
Escape 48, "default color", is not yet implemented.
<ESC>[90-97m=<span style='color:color>
Bright foreground color (90 -> 0, 97 -> 7, you get the idea).
<ESC>[100-107m=<span style='background-color:color>
Bright background color (100 -> 0, 107 -> 7, you get the idea).</code>
I personally consider truecolor (full rgb) terrible UX (if I set a 16 colour
palette, use it, damn it, I don't care about your design choices) and thus will
stubbornly be refusing to implement support for it for now. if you hate this
decision, you have three options:
<ul>
<li>write it in a fork and go on to achieve world domination with said fork,
to which I could well remain blissfully ignorant forever</li>
<li>write it and submit a patch. I'll merge it if it's clean, tested code,
even if it will, I insist, bring disorder and chaos to the cosmos</li>
<li>bug me about it until I cave and write a truecolor to <code><span style=...></code>
translator some time in the next few decades, maybe</li>
</ul>
Getting Started
To my knowledge, <code>begrudge</code> is not yet packaged anywhere. You'll need to build
it from source using a Zig 0.11 compiler. The standard <code>zig build</code> workflow is
supported (and will be used in the below examples, though you're free to copy
the resultant binary to wherever). There are no dependencies outside of the
standard library. On Linux, at least, the produced binary has no sofile (dynamic
linking) dependencies at runtime, either.
<code>begrudge</code> has no command line arguments: simply pipe ANSI-escaped data into
it, and it will spit out the HTML span-ified version to standard output. For
example, to render <code>begrudge</code>'s own source via <code>bat</code>, which uses
<a>syntect's</a> engine under the hood:
```sh
bat -fp --theme=ansi begrudge.zig | zig build -Drelease-fast run
...
const std = @import("std");
const eql = std.mem.eql;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const expectEqualStrings = std.testing.expectEqualStrings;
const trimLeft = std.mem.trimLeft;
```
To integrate with <code>glow</code>, try <code>PAGER="zig build -Drelease-fast run" glow -p
README.md</code> (however, note that <code>glow</code>'s output is not especially polite - it
has a tendency to set styles, print a single character, reset the terminal, and
repeat, over and over and over. This leads to <em>very</em> large, albeit
compressable, output HTML).
You could extend this further, perhaps wrapping the entire thing in <code><pre></code>,
writing a stylesheet mapping the couple dozen possible classes to CSS styles,
and putting it on your blog as a snippet system. You may also be interested in
my other project (that spawned the idea for <code>begrudge</code> in the first place),
<a><code>gawsh</code></a> (still under extremely early
development at time of writing).
Development Notes
All commits should pass <code>make lint</code> and <code>make test</code> (CI will probably exist
eventually). <code>begrudge</code> uses <a>Chronologic Versioning
2019.05.19</a>, tagged whenever the <code>main</code>
branch looks good for a release. It's super informal, because this is a tiny
tool that is unlikely to change often, if at all. | []
|
https://avatars.githubusercontent.com/u/49767738?v=4 | zig-hc256 | quentin-k/zig-hc256 | 2021-12-15T16:46:17Z | Hc256 Cipher in zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/quentin-k/zig-hc256/tags | Apache-2.0 | [
"zig",
"zig-package"
]
| 48 | false | 2022-10-24T18:58:30Z | true | false | unknown | github | []
| Zig Hc256
An implementation of the hc-256 cipher in zig.
License
Apache 2.0
Usage
<ol>
<li>initialize the cipher with a key and iv</li>
<li>use the <code>apply_stream</code> method on a slice of <code>u8</code>s to encrypt/decrypt the data</li>
</ol>
The test vectors file (<code>/tests/test-vectors.zig</code>) shows examples on how to use the library. | []
|
https://avatars.githubusercontent.com/u/51237?v=4 | embedded_zig | fb/embedded_zig | 2021-04-14T20:58:09Z | null | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/fb/embedded_zig/tags | - | [
"arm-cortex-m0",
"lpc812",
"zig"
]
| 17 | true | 2022-04-25T11:20:41Z | true | false | unknown | github | []
| embedded_zig
A "minimal" ARM cortex-M firmware in Zig built for an LPC812.
Building
<code>zig build
</code> | []
|
https://avatars.githubusercontent.com/u/39484230?v=4 | don-carlos | zenith391/don-carlos | 2022-01-15T09:58:25Z | A small platformer for WASM-4 fantasy console | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/zenith391/don-carlos/tags | GPL-3.0 | [
"wasm-4",
"zig"
]
| 131 | false | 2022-04-15T16:50:29Z | true | false | unknown | github | []
| Don Carlos
A WASM-4 video game. | []
|
https://avatars.githubusercontent.com/u/13089667?v=4 | customNumberSystem | matu3ba/customNumberSystem | 2021-08-16T14:30:45Z | spartanic hacked together custom runtime-choosable number system in C, C++ and Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/matu3ba/customNumberSystem/tags | Unlicense | [
"c",
"cpp",
"number-system",
"number-system-conversion",
"number-system-converter",
"zig"
]
| 4 | false | 2022-09-08T21:54:21Z | false | false | unknown | github | []
| customNumberSystem
spartanic custom runtime-choosable number system in C, C++ and Zig | []
|
https://avatars.githubusercontent.com/u/23298480?v=4 | zmenu | yohannd1/zmenu | 2021-03-07T17:49:35Z | A dmenu recreation in Zig (see ground-up-remake branch) | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/yohannd1/zmenu/tags | - | [
"dmenu",
"rewrite",
"zig",
"ziglang"
]
| 93 | false | 2021-06-24T21:29:43Z | true | false | unknown | github | []
| *<em>zmenu_\1</em> - it's dmenu, but in Zig!
Beware that this code is incomplete and experimental in itself, and
might not even compile. On top of that, Zig is currently also on a very
"liquid" state so there might be some problems with old syntax or
compiler bugs. | []
|
https://avatars.githubusercontent.com/u/60233333?v=4 | rajrupdasofficial | rajrupdasofficial/rajrupdasofficial | 2021-08-02T04:04:26Z | welcome to Rajrup Das github profile | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/rajrupdasofficial/rajrupdasofficial/tags | - | [
"ai",
"appwrite",
"artificial-intelligence",
"cassandra",
"developer",
"github",
"github-config",
"machine-learning",
"nextjs",
"postgresql",
"programmer",
"python",
"reactnative",
"rust",
"sveltekit",
"zig"
]
| 30 | false | 2025-04-11T16:38:55Z | false | false | unknown | github | []
| <ul>
<li>👋 Hi, I’m Rajrup Das</li>
<li>👀 I’m interested in Programming, Technologies, Robotics, AI, LLMS</li>
<li>🌱 I have completed my Masters in Computer Science degree successfully and I am currently a programmer.</li>
<li>🔥 I am also learning Zig programming language and Rust programming language to collaborate in Low level System Engineering field</li>
<li>🦎 ⚡️ Zig and Rust are my favorite programming languages ❤️</li>
<li>💞️ I’m actively developing websites, applications, softwares for my clients also offering IT consult and support.</li>
<li>🩷 My tech stack -</li>
<li><a></a></li>
<li>📫 Do you have any queries? you can contact me on -> [email protected] </li>
<li>🏞️ Find me on Fosstodon - https://fosstodon.org/@rajrupdasid</li>
<li>🌎 Find me on Mastodon - https://mastodon.social/@rajrupofficial</li>
<li>🚜 I am also doing freelancing - checkout my offerings @ https://webstackpros.net</li>
<li>🐳 Please contribute to Linux and Open Source softwares and Projects.
<code> ----- Hope you have a great day 💞️ -----
</code>
</li>
</ul>
| []
|
https://avatars.githubusercontent.com/u/62475953?v=4 | Advent-Of-Code-2021 | Jomy10/Advent-Of-Code-2021 | 2021-12-21T22:21:09Z | My code for Advent Of Code 2021. The first few days were written in Rust, as that is what I was learning at the time. It all is quite messy (hence the learning). | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/Jomy10/Advent-Of-Code-2021/tags | - | [
"advent-of-code",
"advent-of-code-2021",
"javascript",
"ruby",
"rust",
"swift",
"zig"
]
| 64,998 | false | 2022-11-28T11:17:55Z | false | false | unknown | github | []
| Advent-Of-Code-2021
My code for Advent Of Code 2021. Mostly written in Rust as that is what I was learning at the time.
Be warned, it is quite messy. Also, I am in no means an expert, this is just for fun and to develop my Rust (and other languages eventually) skills.
(me in 2021 just starting to learn Rust) Looking at what other people have come up with, it seems like I still have a lot that I can learn from this language.
After day 10 I decided to make a separate project for each day. | []
|
https://avatars.githubusercontent.com/u/96973604?v=4 | zpp-cli | zpplibs/zpp-cli | 2022-01-14T07:50:15Z | a build tool for c/c++ with seamless cross-compilation via the zig toolchain | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/zpplibs/zpp-cli/tags | Apache-2.0 | [
"build",
"cross-compile",
"zig"
]
| 22 | false | 2022-02-16T02:21:44Z | true | false | unknown | github | []
| zpp
a build tool for c/c++ with seamless cross-compilation via the zig toolchain
Quick start
Download the release binaries <a>here</a>
Building
Requirements
<ul>
<li>zig (the compiler/toolchain)</li>
</ul>
You can download zig via https://ziglang.org/download/
Alternatively, you can use <a>zigup</a> which downloads the binaries for you and allows you to conveniently switch versions when a new version of zig is released. https://github.com/dyu/zigup/releases
<code>sh
zigup 0.9.1</code>
Once you have zig installed, run:
<code>sh
./bootstrap.sh</code>
Build
<code>sh
./build.sh</code>
Run
<code>sh
./build.sh run -- version</code>
Usage
<code>sh
./zig-out/bin/zpp help</code>
Help text:
```
The available commands are:
- help
- version
- mod fetch
- mod init
- mod sum
- mod license
zpp 0.1.0 macos aarch64
```
Dist (cross-compilation)
<code>sh
./build.sh dist</code>
Release
<code>sh
./build.sh dist VERSION GITHUB_TOKEN</code>
Clean
<code>sh
./build.sh clean</code> | []
|
https://avatars.githubusercontent.com/u/1152671?v=4 | zlox | cmourglia/zlox | 2022-01-04T18:17:15Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/cmourglia/zlox/tags | MIT | [
"zig",
"ziglang"
]
| 28 | false | 2024-04-08T14:40:30Z | true | false | unknown | github | []
| Toying with Zig and the awesome <a>Crafting Interpreters</a> | []
|
https://avatars.githubusercontent.com/u/62105998?v=4 | ZigFuck | AI-nsley69/ZigFuck | 2021-11-03T23:36:55Z | Simple brainfuck interpreter written in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/AI-nsley69/ZigFuck/tags | - | [
"brainfuck",
"brainfuck-interpreter",
"zig"
]
| 20 | false | 2021-11-06T01:02:20Z | true | false | unknown | github | []
| Building
To build this project, simply run
<code>zig build -Drelease-safe=true</code>
after you've cloned the git repository and installed zig.
Usage
You can execute the binary, it will scan for a file called <code>code.bf</code> in the working directory (for now). Example on linux:
<code>./zigfuck code.bf</code>
Where <code>code.bf</code> is the name of brainfuck file you wish to run. | []
|
https://avatars.githubusercontent.com/u/14153763?v=4 | nand2tetris | milomg/nand2tetris | 2022-01-22T21:25:14Z | nand2tetris implementation | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/milomg/nand2tetris/tags | - | [
"nand2tetris",
"zig"
]
| 425 | false | 2025-03-15T02:45:38Z | false | false | unknown | github | []
| 404 | []
|
https://avatars.githubusercontent.com/u/166043157?v=4 | zig-nano | FnCtrlOption/zig-nano | 2022-02-25T21:36:31Z | GNU nano but with the Zig build system | zig | 0 | 0 | 0 | 0 | https://api.github.com/repos/FnCtrlOption/zig-nano/tags | GPL-3.0 | [
"zig"
]
| 38,614 | false | 2024-08-24T22:55:08Z | true | false | unknown | github | []
| <code> GNU nano -- a simple editor, inspired by Pico
</code>
Purpose
<code>Nano is a small and simple text editor for use on the terminal.
It copied the interface and key bindings of the Pico editor but
added several missing features: undo/redo, syntax highlighting,
line numbers, softwrapping, multiple buffers, selecting text by
holding Shift, search-and-replace with regular expressions, and
several other conveniences.
</code>
Appearance
<code>In rough ASCII graphics, this is what nano's screen looks like:
</code>
| GNU nano 6.2 filename Modified |
| This is the text window, displaying the contents of a 'buffer', |
| the contents of the file you are editing. |
| |
| The top row of the screen is the 'title bar'; it shows nano's |
| version, the name of the file, and whether you modified it. |
| The two bottom rows display the most important shortcuts; in |
| those lines ^ means Ctrl. The third row from the bottom shows |
| some feedback message, or gets replaced with a prompt bar when |
| you tell nano to do something that requires extra input. |
| |
| [ Some status message ] |
|^G Help ^O Write Out ^W Where Is ^K Cut ^T Execute |
|^X Exit ^R Read File ^\ Replace ^U Paste ^J Justify |
Origin
<code>The nano project was started in 1999 because of a few "problems"
with the wonderfully easy-to-use and friendly Pico text editor.
First and foremost was its license: the Pine suite does not use
the GPL, and (before using the Apache License) it had unclear
restrictions on redistribution. Because of this, Pine and Pico
were not included in many GNU/Linux distributions. Furthermore,
some features (like go-to-line-number or search-and-replace) were
unavailable for a long time or require a command-line flag. Yuck.
Nano aimed to solve these problems by: 1) being truly free software
by using the GPL, 2) emulating the functionality of Pico as closely
as is reasonable, and 3) including extra functionality by default.
Nowadays, nano wants to be a generally useful editor with sensible
defaults (linewise scrolling, no automatic line breaking).
The nano editor is an official GNU package. For more information on
GNU and the Free Software Foundation, please see https://www.gnu.org/.
</code>
License
<code>Nano's code and documentation are covered by the GPL version 3 or
(at your option) any later version, except for two functions that
were copied from busybox which are under a BSD license. Nano's
documentation is additionally covered by the GNU Free Documentation
License version 1.2 or (at your option) any later version. See the
files COPYING and COPYING.DOC for the full text of these licenses.
When in any file of this package a copyright notice mentions a
year range (such as 1999-2011), it is a shorthand for a list of
all the years in that interval.
</code>
How to compile and install nano
<code>Download the latest nano source tarball, and then:
tar -xvf nano-x.y.tar.gz
cd nano-x.y
./configure
make
make install
You will need the header files of ncurses installed for ./configure
to succeed -- get them from libncurses-dev (Debian) or ncurses-devel
(Fedora) or a similarly named package. Use --prefix with ./configure
to override the default installation directory of /usr/local.
After installation you may want to copy the doc/sample.nanorc file
to your home directory, rename it to ".nanorc", and then edit it
according to your taste.
</code>
Web Page
<code>https://nano-editor.org/
</code>
Mailing Lists
<code>There are three nano-related mailing-lists.
* <[email protected]> is a very low traffic list used to announce
new nano versions or other important info about the project.
* <[email protected]> is for those seeking to get help without
wanting to hear about the technical details of its development.
* <[email protected]> is the list used by the people that make nano
and a general development discussion list, with moderate traffic.
To subscribe, send email to <name>[email protected] with a subject
of "subscribe", where <name> is the list you want to subscribe to.
The archives of the development and help mailing lists are here:
https://lists.gnu.org/archive/html/nano-devel/
https://lists.gnu.org/archive/html/help-nano/
</code>
Bug Reports
<code>If you find a bug, please file a detailed description of the problem
on nano's issue tracker: https://savannah.gnu.org/bugs/?group=nano
(you will need an account to be able to do so), or send an email
to the nano-devel list (no need to subscribe, but mention it if
you want to be CC'ed on an answer).
</code> | []
|
https://avatars.githubusercontent.com/u/166043157?v=4 | zig-libgit2 | FnCtrlOption/zig-libgit2 | 2022-02-22T02:39:44Z | Zig bindings to libgit2 | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/FnCtrlOption/zig-libgit2/tags | MIT | [
"zig"
]
| 2,843 | true | 2024-08-24T22:55:11Z | true | false | unknown | github | []
| zig-libgit2
Zig bindings to <a>libgit2</a>
This is an in-progress zig binding to libgit2, unfortunately libgit2 doesn't full document all possible errors so every errorable function returns the full errorset.
There is currently no plan to port all the headers within "include/git2/sys", if anyone requires any of that functionailty raise an issue.
Files fully wrapped (others maybe partially complete)
<ul>
<li>[X] annotated_commit.h</li>
<li>[X] apply.h</li>
<li>[X] attr.h</li>
<li>[X] blame.h</li>
<li>[X] blob.h</li>
<li>[X] branch.h</li>
<li>[X] buffer.h</li>
<li>[X] cert.h</li>
<li>[X] checkout.h</li>
<li>[X] cherrypick.h</li>
<li>[X] clone.h</li>
<li>[X] commit.h</li>
<li>[X] common.h</li>
<li>[X] config.h</li>
<li>[X] credential.h</li>
<li>[X] describe.h
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> diff.h</li>
<li>[X] errors.h</li>
<li>[X] filter.h</li>
<li>[X] global.h</li>
<li>[X] graph.h</li>
<li>[X] ignore.h</li>
<li>[X] index.h</li>
<li>[X] indexer.h</li>
<li>[X] mailmap.h
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> merge.h</li>
<li>[X] message.h</li>
<li>[X] notes.h</li>
<li>[X] object.h
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> odb.h</li>
<li>[X] oid.h</li>
<li>[X] oidarray.h</li>
<li>[X] pack.h</li>
<li>[X] patch.h</li>
<li>[X] pathspec.h</li>
<li>[X] proxy.h</li>
<li>[X] rebase.h</li>
<li>[X] refdb.h</li>
<li>[X] reflog.h
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> refs.h</li>
<li>[X] refspec.h</li>
<li>[X] remote.h</li>
<li>[X] repository.h</li>
<li>[X] reset.h</li>
<li>[X] revert.h</li>
<li>[X] revparse.h</li>
<li>[X] revwalk.h</li>
<li>[X] signature.h</li>
<li>[X] stash.h</li>
<li>[X] status.h</li>
<li>[X] strarray.h
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> submodule.h</li>
<li>[X] tag.h</li>
<li>[X] trace.h</li>
<li>[X] transaction.h</li>
<li>[X] tree.h</li>
<li>[X] worktree.h</li>
<li>[X] sys/alloc.h</li>
<li>[X] sys/credential.h</li>
<li>[X] sys/diff.h</li>
<li>[X] sys/hashsig.h</li>
<li>[X] sys/path.h</li>
<li>[X] sys/repository.h</li>
</ul> | []
|
https://avatars.githubusercontent.com/u/45506003?v=4 | zigdownload.py | izonu/zigdownload.py | 2022-11-27T17:18:22Z | Quick script for downloading the latest Zig version | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/izonu/zigdownload.py/tags | MIT | [
"zig"
]
| 6 | false | 2022-11-27T17:19:17Z | false | false | unknown | github | []
| zigdownload.py
a script for downloading the latest zig from master branch and another one for adding the downloaded version to your $PATH (for fish shell) | []
|
https://avatars.githubusercontent.com/u/2773256?v=4 | zcomplete | dasimmet/zcomplete | 2022-12-06T16:53:09Z | a python argcomplete inspired completion engine for zig-clap | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/dasimmet/zcomplete/tags | MIT | [
"zig",
"zig-package"
]
| 80 | false | 2025-05-11T06:58:22Z | true | true | 0.15.0-dev.386+2e35fdd03 | github | [
{
"commit": "755d56fc47cebd9dedd6bbeba753e969f6e5187e",
"name": "zware",
"tar_url": "https://github.com/malcolmstill/zware/archive/755d56fc47cebd9dedd6bbeba753e969f6e5187e.tar.gz",
"type": "remote",
"url": "https://github.com/malcolmstill/zware"
},
{
"commit": "a4e784da8399c51d5eeb5783e6a485b960d5c1f9",
"name": "clap",
"tar_url": "https://github.com/Hejsil/zig-clap/archive/a4e784da8399c51d5eeb5783e6a485b960d5c1f9.tar.gz",
"type": "remote",
"url": "https://github.com/Hejsil/zig-clap"
},
{
"commit": "aa24df42183ad415d10bc0a33e6238c437fc0f59",
"name": "known_folders",
"tar_url": "https://github.com/ziglibs/known-folders/archive/aa24df42183ad415d10bc0a33e6238c437fc0f59.tar.gz",
"type": "remote",
"url": "https://github.com/ziglibs/known-folders"
}
]
| zcomplete
a python argcomplete inspired shell completion engine for zig argument parsers.
Traditionally, <a>bash-completion</a>
works by command line programs shipping their own <code>bash</code> code to handle
suggestions when users type the command and hit <code><TAB></code> on the keyboard.
Since these scripts are:
<ul>
<li><code>bash</code> specific</li>
<li>maintained separately from the binary and might not match the behaviour
of it.</li>
</ul>
Zcomplete instead works like this:
<ul>
<li>Generate a separate <code>.wasm</code> version of your program's argument parser</li>
<li>embed the <code>.wasm</code> in a special <code>zcomplete.wasm</code> ELF section using a linker script</li>
<li>provides a generic tool called <code>zcomp</code> that needs to be installed in <code>PATH</code>
once, along with a simple <code>zcomplete.bash</code> completion script.</li>
<li>when pressing <code><TAB></code> in bash, <code>zcomp</code> will try to
extract and instanciate the <code>zcomplete.wasm</code> section with a <a>Webassembly Runtime</a>,
then pass in the current command line and the current arg to be completed.</li>
<li>evaluate the response and generate bash completion</li>
<li>SUCCESS!</li>
</ul>
Zcomplete vs argcomplete
Python's <a>argcomplete</a> works
by running the actual python script until the <code>argparse</code> instance is created,
and uses the contained info to generate the completion suggestions.
It's main shortcomings are:
<ul>
<li>needs to run the actual python script. We cannot do that on a native binary
safely. It uses a <code>PYTHON_ARGCOMPLETE_OK</code> magic string to determine a
script's eligibility for completion.</li>
<li>May take longer than bearable by users on each <code><TAB></code> press,
since starting python and reading all source code is slow.</li>
</ul>
TODOs
This project is in a Proof-of-concept stage. It barely generates
useful completion for itself.
Support other shells than <code>bash</code>
<ul>
<li><a><code>zsh</code></a></li>
<li><a><code>fish</code></a></li>
<li><a><code>powershell</code></a></li>
</ul>
Povide completion for file paths in the filesystem
<ul>
<li>Offer a way for <code>.wasm</code> to query filesystem files?</li>
<li>report back valid extensions or magic numbers from <code>.wasm</code> to <code>zcomp</code>?</li>
</ul>
Alternatives if embedding in ELF is not an option.
<ul>
<li>Embedded Windows Resource files?</li>
<li>MachO?</li>
<li>Support <code>.wasm</code> separate from the binary?
This needs a reasonably fast way of associating a binary and the <code>.wasm</code>.
Optionally, a single <code>.wasm</code> core could serve completions for multiple
binaries, like and <code>zcomplete</code> could use the <code>.wasm</code> files like a plugin system.</li>
</ul>
make a non-mvp target it work with zig master
at the moment we set an explicit generic target (which means only <code>mvp</code>
wasm features are on):
<code>zig
.target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
.abi = .none,
.cpu_model = .{
.explicit = std.Target.Cpu.Model.generic(.wasm32),
},
}),</code>
zware works always with 0.14.0, on master with only <code>wasm32-freestanding</code>
it fails. Maybe only <code>mvp</code> wasm32 should be supported, but this is the
error:
```
error: ValidatorCallIndirectNoTable
/home/dasimmet/.cache/zig/p/zware-0.0.1-ZA7j6X3jBABhBIltmAF9N6OP7VTsgFP3O1xPkgiaCY_t/src/module/parser.zig:384:68: 0x11c7aec in next (zcomp)
if (tableidx >= self.module.tables.list.items.len) return error.ValidatorCallIndirectNoTable;
^
/home/dasimmet/.cache/zig/p/zware-0.0.1-ZA7j6X3jBABhBIltmAF9N6OP7VTsgFP3O1xPkgiaCY_t/src/module/parser.zig:63:16: 0x11d9292 in parseFunction (zcomp)
while (try self.next()) |instr| {
^
/home/dasimmet/.cache/zig/p/zware-0.0.1-ZA7j6X3jBABhBIltmAF9N6OP7VTsgFP3O1xPkgiaCY_t/src/module.zig:798:9: 0x11d973a in readFunction (zcomp)
return parser.parseFunction(funcidx, locals, code);
^
/home/dasimmet/.cache/zig/p/zware-0.0.1-ZA7j6X3jBABhBIltmAF9N6OP7VTsgFP3O1xPkgiaCY_t/src/module.zig:686:33: 0x11d9e27 in decodeCodeSection (zcomp)
const parsed_code = try self.readFunction(module, locals, function_index_start + i);
^
/home/dasimmet/.cache/zig/p/zware-0.0.1-ZA7j6X3jBABhBIltmAF9N6OP7VTsgFP3O1xPkgiaCY_t/src/module.zig:174:22: 0x11dade0 in decodeSection (zcomp)
.Code => try self.decodeCodeSection(module),
^
/home/dasimmet/.cache/zig/p/zware-0.0.1-ZA7j6X3jBABhBIltmAF9N6OP7VTsgFP3O1xPkgiaCY_t/src/module.zig:106:25: 0x11dba05 in decode (zcomp)
else => return err,
^
/home/dasimmet/repos/zig/zcomplete/src/zcomp.zig:69:5: 0x11fc840 in complete (zcomp)
try module.decode();
^
``` | []
|
https://avatars.githubusercontent.com/u/13558411?v=4 | move-square-cpp-zig-ada | phillvancejr/move-square-cpp-zig-ada | 2022-07-11T03:54:17Z | simple graphical app to test if I want to use Zig or Ada in addition to C++ | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/phillvancejr/move-square-cpp-zig-ada/tags | - | [
"ada",
"cpp",
"graphics",
"zig"
]
| 251 | false | 2022-07-11T03:56:39Z | false | false | unknown | github | []
| Move Square C++ vs Zig vs Ada
simple graphical app to test if I want to use Zig or Ada in addition to C++
Zig
I like Zig's syntax, especially for importing modules. I think Zig probably has the best import syntax of any language. In Zig, you always know where an identifier comes from and there is no global glob import. A strength and weakness of Zig is that it is very similar to C++/C. It is a procedural language and so you solve problems the same way you would in C or C++. This is great, but I'm not looking to replace C++ so I want something a little more different. But Zig is still very interesting and I'm keeping my eye on it and waiting for the self hosted compiler
Ada
Ada is very interesting to me. I don't think I wrote this program in a very Ada way, it doesn't feel like I'm actually taking advantage of Ada's featuers and so I'll continue to play with it. Oddly enough one of the things I find frustrating about Zig is its strict typing and verbose conversion code but super strong typing is Ada's main selling point and I actaully like the way Ada does it. Similar to Zig it has good C interop and can automatically generate bindings (including #define constants) via the gnat ada gcc compiler <code>gcc -C -fdump-ada-spec some_c_header.h</code>. I also really like Ada's task system for concurrent and parallel code. Ada feels more different from C++ than Zig does and so I am more interested in it than Zig at the moment. It is very interesitng to try to design a domain for your program and reason about it using specialized types. I think the biggest annoyance with Ada in this project is that Ada only implements bitwise operations for unsigned/modulo types in the interfaces package, however I'm sure this is less of an issue than it seems on the surface.
update
Added two new Ada versions. The leg (legacy) version is the original, ada_square2 overloads the + operator for the Pos type instead of using clamp, which I takes more advantage of Ada features. The new ada_square.adb is just a cleaned up and simplified version of teh legacy file and is the shortest and most simple version. Given that the most simple solution is pertty much just an Ada port of the C++ version, I'm not sure there was any benefit to using Ada here. The version that uses the Pos type and overloads the + operator is kind of neat, but I could do the same thing in C++ with a custom type, an int cast operator and operator overloading.
| []
|
https://avatars.githubusercontent.com/u/8497012?v=4 | zig-cert | apple-x-co/zig-cert | 2022-08-09T23:57:17Z | for learning | main | 1 | 0 | 0 | 0 | https://api.github.com/repos/apple-x-co/zig-cert/tags | - | [
"zig"
]
| 4 | false | 2023-11-01T17:24:58Z | true | false | unknown | github | []
| zig-cert
Build
<code>bash
zig build -Doptimize=ReleaseFast</code>
Run
<code>bash
zig build run -- example.com</code> | []
|
https://avatars.githubusercontent.com/u/14258692?v=4 | c-project-workflow | initdc/c-project-workflow | 2022-11-08T04:59:02Z | C just need build once time! | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/initdc/c-project-workflow/tags | MPL-2.0 | [
"actions",
"build",
"c",
"docker",
"release",
"workflow",
"zig"
]
| 42 | false | 2022-11-22T15:23:21Z | false | false | unknown | github | []
| <a>C Project Workflow</a>
<blockquote>
Project written by c, you just need build once time.
</blockquote>
Build on Linux Host
<ol>
<li>
deps
<ul>
<li>zig</li>
<li>ruby</li>
<li>tree</li>
<li>sha256sum</li>
<li>docker</li>
</ul>
</li>
<li>
build
<blockquote>
edit config and build CMD as you need
</blockquote>
```
build binarys
ruby build.rb
ruby build.rb --run-test
ruby build.rb v0.0.1
ruby build.rb less ## build bin for LESS_OS_ARCH
echo > version.rb 'VERSION = "fix-bug-001"'
ruby build.rb test --run-test
build docker images
ruby docker-tag.rb
ruby docker-tag.rb v0.0.1
ruby docker-tag.rb dev
ruby docker-tag.rb v$(TZ=Asia/Shanghai date +%Y.%m.%d)
```
</li>
</ol>
GitHub actions
<ul>
<li>build binarys</li>
<li>upload release files</li>
<li>build docker images</li>
</ul>
More about docker
Check https://github.com/initdc/ssh-proxy-by-caddy-l4
License
MPL 2.0 | []
|
https://avatars.githubusercontent.com/u/6756180?v=4 | rsDemangle-zig | kassane/rsDemangle-zig | 2022-05-22T14:08:53Z | rust demangle on zig | main | 1 | 0 | 0 | 0 | https://api.github.com/repos/kassane/rsDemangle-zig/tags | Apache-2.0 | [
"demangle",
"rust",
"wrapper",
"zig"
]
| 101 | false | 2022-12-29T15:48:37Z | true | false | unknown | github | []
| rsDemangle-zig
Note
This is a rustc-demangle experiment using zig. [<strong>WiP</strong>]
To better understand it I suggest you read:
- https://github.com/kubkon/zld/issues/6
- https://github.com/rui314/mold/issues/371#issuecomment-1159529529
I would also like to thank <a>@eddyb</a> for providing an initial example written in c.
Reference
<ul>
<li>https://github.com/LykenSol/rust-demangle.c</li>
</ul> | []
|
https://avatars.githubusercontent.com/u/1193542?v=4 | zig-playground | remyroez/zig-playground | 2022-07-29T11:55:02Z | ⚡ my zig playground | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/remyroez/zig-playground/tags | MIT | [
"practice",
"zig"
]
| 90 | false | 2022-08-03T08:51:58Z | false | false | unknown | github | []
| zig-playground
⚡ my zig playground | []
|
https://avatars.githubusercontent.com/u/71298177?v=4 | nova-zig | snow-developments/nova-zig | 2022-05-01T18:14:16Z | Advanced Zig language support for Nova | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/snow-developments/nova-zig/tags | MIT | [
"nova",
"nova-extension",
"zig"
]
| 44 | false | 2023-04-01T06:59:38Z | false | false | unknown | github | []
| <blockquote>
⚠️ Use Felix Krause's <a>Zig language extension</a>.
</blockquote>
<strong>Zig</strong> provides syntax highlighting and autocompletion for <a>Zig</a>.
Language Support
Zig currently supports the following features of Zig:
<ul>
<li>Inline Assembly</li>
<li>etc.</li>
</ul>
Support for:
<ul>
<li>Sit</li>
<li>Amet </li>
</ul>
is planned for a future update. | []
|
https://avatars.githubusercontent.com/u/67346305?v=4 | simple_file_transfer_z | rlapz/simple_file_transfer_z | 2022-09-01T14:46:46Z | Socket programming exercise (based on https://github.com/teainside/simple_file_transfer) | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/rlapz/simple_file_transfer_z/tags | - | [
"tcp-socket",
"zig"
]
| 14 | false | 2022-09-01T15:06:29Z | true | false | unknown | github | []
| simple_file_transfer_z
Socket programing exercise (based on https://github.com/teainside/simple_file_transfer)
Zig version: <a>0.10.0-dev.3840+2b92c5a23</a>
How to build:
1. Release Safe
<code>bash
zig build -Drelease-safe</code>
<ol>
<li>
Release Fast
<code>bash
zig build -Drelease-fast</code>
</li>
<li>
Relase Debug
<code>bash
zig build</code>
</li>
</ol>
How to change the configuration(s):
1. Edit file <code>./src/config.zig</code>
2. Rebuild
How to run:
1. Server:
<code>bash
./zig-out/bin/simple_file_transfer_z server [IP] [PORT]</code>
2. Client:
<code>bash
./zig-out/bin/simple_file_transfer_z client [IP TARGET] [PORT TARGET] [FILE]</code>
Event handlers:
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Poll
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Epoll
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> IO Uring | []
|
https://avatars.githubusercontent.com/u/62779291?v=4 | zIGA | shimamura-sakura/zIGA | 2022-08-13T10:00:15Z | InnocentGrey IGA format extractor in Zig language. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/shimamura-sakura/zIGA/tags | GPL-3.0 | [
"reverse-engineering",
"zig"
]
| 37 | false | 2025-03-15T10:27:38Z | false | false | unknown | github | []
| zIGA
InnocentGrey IGA format extractor in Zig language.
Build
<code>sh
$ ./build.sh
or
$ zig build-exe main.zig</code>
Usage
<code>sh
$ ./main [path_to_iga_file] [folder_to_place_extracted_files]</code>
without output dir - list files
will automatically apply XOR to script files (.s)
Examples:
<code>sh
$ ./main bgm.iga # list files
$ ./main bgm.iga ./bgm
$ ./main script.iga ./script</code>
Note
might be difficult to port, because it uses MMAP_PRIVATE to avoid allocating memory | []
|
https://avatars.githubusercontent.com/u/62779291?v=4 | zig-cp932 | shimamura-sakura/zig-cp932 | 2022-11-18T07:33:52Z | Simple CP932 to Unicode decoder and encoder for Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/shimamura-sakura/zig-cp932/tags | MIT | [
"cp932",
"zig"
]
| 107 | false | 2023-11-01T17:11:52Z | false | false | unknown | github | []
| CP932 for Zig
Download <a>this file</a> as <code>CP932.TXT</code>, and run <code>make_table.py</code> to generate <code>cp932.zig</code>.
Read the code for usage (very simple).
Run <code>python make_table.py > cp932.zig</code> | []
|
https://avatars.githubusercontent.com/u/7189568?v=4 | gamefx | maihd/gamefx | 2022-11-27T19:11:21Z | MaiHD's Game Framework for small game development | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/maihd/gamefx/tags | Unlicense | [
"game",
"game-development",
"game-engine",
"gamedev",
"zig"
]
| 38,614 | false | 2023-12-28T23:31:05Z | true | false | unknown | github | []
| MaiHD's Game Framework for small game development
WIP, API maybe changed!
<blockquote>
<strong><em>NOTE:</em></strong> I found making a game framework in the first attempt was too big, I havenot release a game yet. So this project now is for learning purpose only. So I donot often work in this project. I found MonoGame is more suit for making mobile game, <a>Yolo game development</a> for fast release indie game. Zig for game engine and Beef for scripting (wasi in Zig, build Beef to wasm) will be my long-term target.
</blockquote>
Features
<ul>
<li>Focus on mobile gamedev: lightweight, fast, low-power consumption.</li>
<li>Focus on 2D gamedev: Pixels, casual graphics. Auto background playing.</li>
<li>Zig-based gamedev: rich libraries, easy custom backends, fast machine code generation, cross building.</li>
<li>Multi-backends: raylib, zig-gamedev.</li>
<li>Graphics: 2D, 3D, geometry drawing, vector, text, spine animation (wip).</li>
<li>Audios: 2D, 2D.</li>
<li>Assets: load from file system, caching, load from package (wip).</li>
<li>Math: zig's @Vector for fast computing, easy programming, use zig-gamedev's zmath as backend.</li>
<li>GUI: raygui for in-game immediate-mode gui, zgui (wip) for editor.</li>
<li>Tilemap: tile texture drawing, tilemesh drawing, loading ldtk and present with native tilemap data structures (planning).</li>
</ul>
Acknownledge
<ul>
<li><a>raysan5</a> and his <a>Raylib</a>.</li>
<li><a>michal-z</a> and his <a>zig-gamedev</a>.</li>
<li>Zig author and community.</li>
</ul> | []
|
https://avatars.githubusercontent.com/u/23312691?v=4 | leetcode | lavrd/leetcode | 2022-03-23T13:18:08Z | Different algorithm and data structures | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/lavrd/leetcode/tags | MIT | [
"algorithms",
"data-structures",
"go",
"golang",
"leetcode",
"leetcode-go",
"leetcode-golang",
"leetcode-rust",
"leetcode-solutions",
"rust",
"rust-lang",
"zig",
"ziglang"
]
| 62 | false | 2024-09-16T07:05:55Z | false | false | unknown | github | []
| leetcode
Problems
<a>9. Palindrome Number</a>\
<a>125. Valid Palindrome</a>
Algorithms
<a>QuickSort</a>\
<a>Graph</a>\
<a>Dynamic Programming</a>\
<a>Hash Table</a>\
<a>Binary Search</a>\
<a>Greedy</a>\
<a>Selection Sort</a>\
<a>Find Max Size Squire Plots</a>\
<a>Sum Array</a>
Usage
To add new lib don't forget to add <code>--vcs none</code>.
<code>shell
cargo new --lib --vcs none problems/n_125_valid_palindrome</code> | []
|
https://avatars.githubusercontent.com/u/9347096?v=4 | qp-zig | massivelivefun/qp-zig | 2022-03-24T04:08:40Z | Zig FFI bindings and wrapper for Quantum Leaps' Quantum Platform. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/massivelivefun/qp-zig/tags | MIT | [
"actor",
"actor-model",
"bindings",
"embedded",
"event-driven",
"framework",
"fsm",
"qp",
"rtos",
"wrapper",
"zig"
]
| 8 | false | 2024-09-25T04:19:46Z | true | false | unknown | github | []
| qp-zig
Zig FFI bindings and wrapper for Quantum Leaps' Quantum Platform. | []
|
https://avatars.githubusercontent.com/u/11492844?v=4 | cppfront-to-wasm | fjebaker/cppfront-to-wasm | 2023-01-26T18:03:42Z | Hello World example for compiling cppfront to WASM using either clang or zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/fjebaker/cppfront-to-wasm/tags | MIT | [
"clang",
"cpp",
"cppfront",
"llvm",
"wasm",
"zig",
"zig-wasm"
]
| 2 | false | 2023-01-26T18:05:10Z | false | false | unknown | github | []
| cppfront to WASM
This repository contains a tiny hello world example for compiling <a>cppfront</a> (aka C++ Syntax 2) to WASM, using clang or optionally <a>zig</a>.
Requires that <a>cppfront</a> is in the path. The Makefile also needs to be modified at the top to point the include directory for cppfront to the right place.
Setup (no zig)
Install LLVM via Homebrew and link
<code>bash
brew install llvm \
&& echo 'export PATH="$(brew --prefix)/opt/llvm/bin:$PATH"' >> ~/.zshrc \
&& source ~/.zshrc</code>
Download releases from <a>WebAssembly/wasi-sdk</a>:
<code>bash
wget "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sysroot-19.0.tar.gz" \
&& wget "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/libclang_rt.builtins-wasm32-wasi-19.0.tar.gz" \
&& tar xf wasi-sysroot-19.0.tar.gz \
&& tar xf libclang_rt.builtins-wasm32-wasi-19.0.tar.gz</code>
Move the <code>lib/wasi</code> directory extracted to clang lib (note: versions may differ):
<code>bash
mv lib/wasi $(brew --prefix)/Cellar/llvm/15.0.7_1/lib/clang/15.0.7/lib/ \
&& rm -d lib</code>
Then
<code>bash
make</code>
Run it with <a>bytecodealliance/wasmtime</a>:
```bash
wasmtime cart.wasm
Hello world from cppfront!
```
Cool and nice and fast with zig
Use Zig target (none of the above required, only needs zig in <code>PATH</code>):
<code>bash
make zig</code>
Recommended tools
<ul>
<li><a>WebAssembly/wabt</a></li>
</ul> | []
|
https://avatars.githubusercontent.com/u/93975999?v=4 | Computational-Gas-Dynamics-S11-2022 | paveloom-university/Computational-Gas-Dynamics-S11-2022 | 2022-11-23T14:33:24Z | Modelling convection with the large-particle method | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/paveloom-university/Computational-Gas-Dynamics-S11-2022/tags | MIT | [
"gas-dynamics",
"zig"
]
| 87 | false | 2022-11-25T14:03:55Z | true | false | unknown | github | []
| Notices
Mirrors
Repository:
- <a>Codeberg</a>
- <a>GitHub</a>
- <a>GitLab</a>
Prerequisites
Make sure you have installed:
<ul>
<li><a>Julia</a></li>
<li><a>Zig</a> (<code>v0.10.0</code>)</li>
<li><a>Zigmod</a></li>
</ul>
Optionally, you might also want to install <a>Tracy Profiler</a>.
Build
First, fetch the dependencies with <code>zigmod fetch</code>.
To build and install the library, run <code>zig build install</code>.
To run unit tests, run <code>zig build test</code>.
See <code>zig build --help</code> for more build options.
Example
To run the example which simulates the convection process, run one of the following:
```bash
Run with the default allocator
zig build run -- -o res.bin -j $(nproc)
zig build run -Drelease-fast -- -o res.bin -j $(nproc)
Run with the Tracy integration
zig build run -Dtracy -Drelease-fast -- -o res.bin
zig build run -Dtracy -Dtracy-depth=10 -Drelease-fast -- -o res.bin
Run with the testing allocator
zig build test-run
Run the benchmark
zig build bench
zig build bench -Drelease-fast
```
See <code>zig build --help</code> for more build options.
See <code>zig build run -- --help</code> for CLI arguments.
To animate the results, first, instantiate the project with
<code>bash
julia --project=. -e "using Pkg; Pkg.instantiate()"</code>
Then, run one of the following
```bash
Run without a daemon
julia --project=. scripts/animate.jl res.bin
julia --project=. scripts/animate.jl --postfix "'Custom postfix'" res.bin
Run with a daemon
./julia.bash scripts/animate.jl res.bin
./julia.bash scripts/animate.jl --postfix "'Custom postfix'" res.bin
```
Use the <code>--help</code> flag to get help information.
To kill the daemon, run <code>./julia.bash kill</code>. | []
|
https://avatars.githubusercontent.com/u/6756180?v=4 | zig-espressif-bootstrap | kassane/zig-espressif-bootstrap | 2022-10-02T15:29:43Z | take off every zig (forked) | xtensa | 0 | 19 | 1 | 19 | https://api.github.com/repos/kassane/zig-espressif-bootstrap/tags | - | [
"espressif-llvm",
"xtensa",
"xtensa-toolchain",
"zig"
]
| 430,667 | true | 2025-05-15T13:35:59Z | false | false | unknown | github | []
| bootstrap-zig
The purpose of this project is to start with minimum system dependencies and
end with a fully operational Zig compiler for any target.
Version Information
This repository copies sources from upstream. Patches listed below. Use git
to find and inspect the patch diffs.
<ul>
<li>LLVM, LLD, Clang 19.1.7</li>
<li>zlib 1.3.1</li>
<li>zstd 1.5.2</li>
<li>zig 0.14.0-dev.2257+e6d2e1641</li>
</ul>
For other versions, check the git tags of this repository.
Patches
<ul>
<li>all: Deleted unused files.</li>
<li>LLVM: Support .lib extension for static zstd.</li>
<li>LLVM: Portable handling of .def linker flag</li>
<li>Clang: Disable building of libclang-cpp.so.</li>
<li>LLD: Added additional include directory to Zig's libunwind.</li>
<li>LLD: Respect <code>LLD_BUILD_TOOLS=OFF</code></li>
<li>zlib: Delete the ability to build a shared library.</li>
<li><a>LLVM: Fix crash when FREEZE a half(f16) type on loongarch</a></li>
</ul>
Host System Dependencies
<ul>
<li>C++ compiler capable of building LLVM, Clang, and LLD from source (GCC 5.1+
or Clang)</li>
<li>CMake 3.19 or later</li>
<li>make, ninja, or any other build system supported by CMake</li>
<li>POSIX system (bash, mkdir, cd)</li>
<li>Python 3</li>
</ul>
Build Instructions
<code>./build <arch>-<os>-<abi> <mcpu></code>
All parameters are required:
<ul>
<li><code><arch>-<os>-<abi></code>: Replace with one of the Supported Triples below, or use
<code>native</code> for the <code><arch></code> value (e.g. <code>native-linux-gnu</code>) to use the native
architecture.</li>
<li><code><mcpu></code>: Replace with a <code>-mcpu</code> parameter of Zig. <code>baseline</code> is recommended
and means it will target a generic CPU for the target. <code>native</code> means it
will target the native CPU. See the Zig documentation for more details.</li>
</ul>
Please be aware of the following two CMake environment variables that can
significantly affect how long it takes to build:
<ul>
<li><code>CMAKE_GENERATOR</code> can be used to select a different generator instead of the
default. For example, <code>CMAKE_GENERATOR=Ninja</code>.</li>
<li><code>CMAKE_BUILD_PARALLEL_LEVEL</code> can be used to introduce parallelism to build
systems (such as make) which do not default to parallel builds. This option
is irrelevant when using Ninja.</li>
</ul>
When it succeeds, output can be found in <code>out/zig-<triple>-<cpu>/</code>.
Windows Build Instructions
Bootstrapping on Windows with MSVC is also possible via <code>build.bat</code>, which
takes the same arguments as <code>build</code> above.
This script requires that the "C++ CMake tools for Windows" component be
installed via the Visual Studio installer.
The script must be run within the <code>Developer Command Prompt for VS 2019</code> shell:
<code>build.bat <arch>-<os>-<abi> <mcpu></code>
To build for x86 Windows, run the script within the <code>x86 Native Tools Command Prompt for VS 2019</code>.
Supported Triples
If you try a "not tested" one and find a problem please file an issue,
and a pull request linking to the issue in the table.
If you try a "not tested" one and find that it works, please file a pull request
changing the status to "OK".
If you try an "OK" one and it does not work, please check if there is an existing
issue, and if not, file an issue.
Note: Generally, for Linux targets, we prefer the musl libc builds over the
glibc builds here, because musl builds end up producing a static binary, which
is more portable across Linux distributions.
| triple | support status |
|-----------------------------|----------------|
| <code>aarch64-linux-gnu</code> | OK |
| <code>aarch64-linux-musl</code> | OK |
| <code>aarch64-macos-none</code> | OK |
| <code>aarch64-windows-gnu</code> | OK |
| <code>aarch64_be-linux-gnu</code> | OK |
| <code>aarch64_be-linux-musl</code> | OK |
| <code>arm-linux-gnueabi</code> | OK |
| <code>arm-linux-gnueabihf</code> | OK |
| <code>arm-linux-musleabi</code> | OK |
| <code>arm-linux-musleabihf</code> | OK |
| <code>armeb-linux-gnueabi</code> | OK |
| <code>armeb-linux-gnueabihf</code> | OK |
| <code>armeb-linux-musleabi</code> | OK |
| <code>armeb-linux-musleabihf</code> | OK |
| <code>loongarch64-linux-gnu</code> | OK |
| <code>loongarch64-linux-gnusf</code> | OK |
| <code>loongarch64-linux-musl</code> | OK |
| <code>mips-linux-gnueabi</code> | OK |
| <code>mips-linux-gnueabihf</code> | OK |
| <code>mips-linux-musleabi</code> | OK |
| <code>mips-linux-musleabihf</code> | OK |
| <code>mips64-linux-gnuabi64</code> | OK |
| <code>mips64-linux-gnuabin32</code> | OK |
| <code>mips64-linux-muslabi64</code> | OK |
| <code>mips64-linux-muslabin32</code> | OK |
| <code>mips64el-linux-gnuabi64</code> | OK |
| <code>mips64el-linux-gnuabin32</code> | OK |
| <code>mips64el-linux-muslabi64</code> | OK |
| <code>mips64el-linux-muslabin32</code> | OK |
| <code>mipsel-linux-gnueabi</code> | OK |
| <code>mipsel-linux-gnueabihf</code> | OK |
| <code>mipsel-linux-musleabi</code> | OK |
| <code>mipsel-linux-musleabihf</code> | OK |
| <code>powerpc-linux-gnueabi</code> | OK |
| <code>powerpc-linux-gnueabihf</code> | OK |
| <code>powerpc-linux-musleabi</code> | OK |
| <code>powerpc-linux-musleabihf</code> | OK |
| <code>powerpc64-linux-gnu</code> | <a>#113</a> |
| <code>powerpc64-linux-musl</code> | OK |
| <code>powerpc64le-linux-gnu</code> | OK |
| <code>powerpc64le-linux-musl</code> | OK |
| <code>riscv32-linux-gnu</code> | <a>#205</a> |
| <code>riscv32-linux-musl</code> | OK |
| <code>riscv64-linux-gnu</code> | <a>#205</a> |
| <code>riscv64-linux-musl</code> | OK |
| <code>s390x-linux-gnu</code> | OK |
| <code>s390x-linux-musl</code> | OK |
| <code>sparc-linux-gnu</code> | <a>#117</a> |
| <code>sparc64-linux-gnu</code> | <a>#172</a> |
| <code>thumb-linux-musleabi</code> | OK |
| <code>thumb-linux-musleabihf</code> | OK |
| <code>thumb-windows-gnu</code> | OK |
| <code>thumbeb-linux-musleabi</code> | OK |
| <code>thumbeb-linux-musleabihf</code> | OK |
| <code>x86-linux-gnu</code> | OK |
| <code>x86-linux-musl</code> | OK |
| <code>x86-windows-gnu</code> | OK |
| <code>x86_64-freebsd-none</code> | <a>#45</a> |
| <code>x86_64-linux-gnu</code> | OK |
| <code>x86_64-linux-gnux32</code> | OK |
| <code>x86_64-linux-musl</code> | OK |
| <code>x86_64-linux-muslx32</code> | OK |
| <code>x86_64-macos-none</code> | OK |
| <code>x86_64-netbsd-none</code> | <a>#71</a> |
| <code>x86_64-windows-gnu</code> | OK |
Other Notable Targets Known to Work
<ul>
<li><code>arm-linux-musleabi</code> with mcpu value of <code>generic+v6kz</code>. This produces a
build of Zig that runs on the RPi 1 and RPi Zero.</li>
<li>If you want to produce a build for this CPU exactly, use <code>arm1176jzf_s</code>.</li>
</ul> | []
|
https://avatars.githubusercontent.com/u/40190339?v=4 | zig-wasm-logger | daneelsan/zig-wasm-logger | 2022-07-13T23:00:28Z | A simple implementation of console.log() in Zig + JS + Wasm | master | 0 | 19 | 0 | 19 | https://api.github.com/repos/daneelsan/zig-wasm-logger/tags | - | [
"javascript",
"wasm",
"zig"
]
| 302 | false | 2025-05-07T19:59:43Z | true | false | unknown | github | []
| zig-wasm-logger
A simple implementation of <code>console.log()</code> in Zig + JS + Wasm.
https://daneelsan.github.io/zig-wasm-logger/
Usage
```zig
const JS = @import("JS.zig");
/// Print <code>args</code> formatted by <code>format</code> into Javascript's console.
JS.Console.log(format, args)
```
Example:
```zig
const JS = @import("JS.zig");
export fn step(timestamp: f32) void {
JS.Console.log("timestamp: {}\n", .{timestamp});
}
```
Build
<code>shell
$ zig version
0.14.0</code>
<code>shell
$ zig build --verbose</code>
<code>shell
$ ls zig-out/bin/*.wasm
zig-out/bin/example.wasm</code>
References
<ul>
<li>https://github.com/daneelsan/minimal-zig-wasm-canvas</li>
<li>https://github.com/daneelsan/zig-wefx</li>
<li>https://github.com/ziglang/zig/blob/master/lib/std/io/writer.zig</li>
<li>https://github.com/hexops/mach/blob/main/src/platform/wasm.zig</li>
<li>https://github.com/hexops/mach/blob/main/src/platform/mach.js</li>
</ul> | []
|
https://avatars.githubusercontent.com/u/51487819?v=4 | zig-pico | paperdev-code/zig-pico | 2022-08-24T19:10:33Z | Not so scuffed Zig project for using the Raspberry Pi Pico SDK | main | 0 | 18 | 3 | 18 | https://api.github.com/repos/paperdev-code/zig-pico/tags | MIT | [
"c",
"microcontrollers",
"pico-sdk",
"rpi-pico",
"zig"
]
| 219 | false | 2025-02-18T19:46:29Z | true | false | unknown | github | []
| Update
Going to do a complete rewrite as this doesn't work on Zig 0.10.x, archiving.
- Paperdev
Zig on the Raspberry Pi Pico
Zig on the Raspberry Pi Pico without losing access to the SDK.
Requirements
Install the Pico SDK dependencies
<code>sh
sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib</code>
Clone the Pico SDK
<code>sh
git clone https://github.com/raspberrypi/pico-sdk path/to/pico-sdk</code>
Make sure <code>PICO_SDK_PATH</code> is set
<code>sh
export PICO_SDK_PATH path/to/pico-sdk</code>
Usage
Check <code>build.zig</code> and <code>example/main.zig</code>, it's fairly self explanatory.
Build
To build the example for the Pico W
<code>zig build</code>
Running
If you have picotool installed, load the resulting <code>uf2</code> file
<code>picotool load -f zig-out/uf2/pico-app.uf2</code>
Todo
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> integrate cmake into zig build
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> add include paths of pico libraries to app
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> optimize cmake build steps
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> wrap pico-sdk functions into Pkgs
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> ???
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> profit
License
MIT | []
|
https://avatars.githubusercontent.com/u/109492796?v=4 | zigcc.github.io | zigcc/zigcc.github.io | 2022-07-20T04:03:00Z | Zig 语言中文社区 | main | 1 | 18 | 14 | 18 | https://api.github.com/repos/zigcc/zigcc.github.io/tags | MIT | [
"zig",
"ziglang"
]
| 1,655 | false | 2025-05-21T01:45:04Z | false | false | unknown | github | []
| 404 | []
|
https://avatars.githubusercontent.com/u/22148308?v=4 | escape-guldur | hazeycode/escape-guldur | 2022-08-16T13:44:47Z | A minimalistic "retro action RPG" written in Zig for the WASM-4 fantasy console | master | 13 | 17 | 0 | 17 | https://api.github.com/repos/hazeycode/escape-guldur/tags | MIT | [
"2d",
"game",
"retro",
"wasm",
"wasm-4",
"zig"
]
| 312 | false | 2025-02-19T16:01:45Z | true | false | unknown | github | []
| Escape Guldur
A "retro" action-RPG written in <a>Zig</a> for the <a>WASM-4 fantasy console</a>. Originally made for <a>WASM-4 Jam #2</a>.
Building
Requirements
<ul>
<li><a>Zig 0.10.x</a></li>
<li><a>WASM-4</a></li>
<li><a>wasm-opt</a></li>
</ul>
Build and run all tests with:
<code>shell
zig build test</code>
Build (debug) the cart (zig-out/lib/cart.wasm) by running:
<code>shell
zig build</code>
then run it with:
<code>shell
w4 watch zig-out/lib/cart.wasm</code>
Produce a size-optimised release build (zig-out/lib/opt.wasm) by running:
<code>shell
zig build -Drelease-small=true release</code>
and remember to test it with:
<code>shell
w4 run zig-out/lib/opt.wasm</code>
Distribution
```shell
cp zig-out/lib.opt.wasm game.wasm
wapm login
wapm publish
w4 bundle game.wasm --title "Escape Guldur" --html escape_guldur.html
``` | []
|
https://avatars.githubusercontent.com/u/426959?v=4 | extra-syntax-highlighting-eclipse-plugin | sebthom/extra-syntax-highlighting-eclipse-plugin | 2022-03-29T18:36:08Z | Eclipse plugin that provides syntax highlighing support for additional languages. | main | 0 | 17 | 0 | 17 | https://api.github.com/repos/sebthom/extra-syntax-highlighting-eclipse-plugin/tags | EPL-2.0 | [
"bazel",
"eclipse",
"eclipse-plugin",
"editor",
"glsl",
"graphql",
"graphviz-dot",
"hcl",
"json5",
"kotlin",
"nushell",
"ocaml",
"plantuml",
"prisma",
"sentinel",
"svelte",
"syntax-highlighting",
"terraform",
"toml",
"zig"
]
| 2,256 | false | 2025-05-21T19:57:43Z | false | false | unknown | github | []
| "Extra Syntax Highlighting" plugin for Eclipse
<a></a>
<a></a>
<a></a>
<a></a>
<strong>Feedback and high-quality pull requests are highly welcome!</strong>
<ol>
<li><a>What is it?</a></li>
<li><a>Installation</a></li>
<li><a>Supported File Formats/Languages</a></li>
<li><a>Building from Sources</a></li>
<li><a>License</a></li>
</ol>
<a name="what-is-it"></a>What is it?
This <a>EclipseⓇ</a> plug-in adds syntax highlighting support for the following languages/file formats utilizing <a>TM4E</a>:
1. ANTRL4 - https://www.antlr.org/
1. Apache HTTP configuration files - https://httpd.apache.org/docs/current/configuring.html
1. Astro - https://astro.build/
1. Ballerina - https://ballerina.io/
1. Bazel - https://bazel.build/
1. BF - https://en.wikipedia.org/wiki/Brainfuck
1. Carbon - https://carbon-lang.dev
1. COBOL - https://en.wikipedia.org/wiki/COBOL
1. Crystal (<code>*.cr</code>) - https://crystal-lang.org/
1. D2 - https://d2lang.com/
1. Eclipse External null Annotations (<code>*.eea</code>) - https://wiki.eclipse.org/JDT_Core/Null_Analysis/External_Annotations#File_format
1. EditorConfig - https://editorconfig.org
1. Elm - https://elm-lang.org/
1. Entity-Relationship Diagram (<code>*.er</code>) - https://github.com/BurntSushi/erd
1. Erlang (<code>*.erl</code>) - https://www.erlang.org/
1. Fish (<code>*.fish</code>) - https://fishshell.com/docs/current/language.html
1. Fortran - https://fortran-lang.org/
1. gitattributes - https://git-scm.com/docs/gitattributes
1. Gleam (<code>*.gleam</code>) - https://gleam.run/
1. GLSL (OpenGL Shading Language) - https://registry.khronos.org/OpenGL/index_gl.php#apispecs
1. GraphQL - https://graphql.org/
1. Graphviz Dot (<code>*.dot</code>) - https://graphviz.org/doc/info/lang.html
1. HashiCorp HCL (<code>*.hcl</code>) - https://github.com/hashicorp/hcl (e.g. used by HasiCorp Packer)
1. HashiCorp Sentinel (<code>*.sentinel</code>) - https://www.hashicorp.com/sentinel
1. HashiCorp Terraform (<code>*.tf</code>) - https://www.terraform.io/
1. Haxe - https://haxe.org
1. Helm (<code>*.tpl</code>) - https://helm.sh/
1. Janet - https://janet-lang.org/
1. Jinja Templates - https://jinja.palletsprojects.com/
1. JSON5 (<code>*.json5</code>) - https://json5.org/
1. Jsonnet (<code>*.jsonnet</code>) - https://jsonnet.org/
1. Kotlin - https://kotlinlang.org/
1. LDIF - https://en.wikipedia.org/wiki/LDAP_Data_Interchange_Format
1. Mako Templates (<code>*.mako</code>) - https://www.makotemplates.org/
1. Markdoc (<code>*.markdoc</code>) - https://markdoc.dev/
1. Markdown (<code>*.md</code>) - https://daringfireball.net/projects/markdown/
1. MDX (<code>*.mdx</code>) - https://mdxjs.com/
1. Mermaid (<code>*.mmd, *.mermaid</code>) - https://github.com/mermaid-js/mermaid/
1. NginX (<code>nginx.conf</code>) - https://www.nginx.com/
1. Nunjucks (<code>*.njk</code>) - https://mozilla.github.io/nunjucks/
1. Nushell (<code>*.nu</code>) - https://github.com/nushell/nushell
1. OCaml (<code>*.ml</code>) - https://ocaml.org/
1. Odin - https://odin-lang.org/
1. Pascal (<code>*.pas</code>) - https://en.wikipedia.org/wiki/Pascal_(programming_language)
1. PlantUML (<code>*.pu</code>) - https://plantuml.com/
1. Pony (<code>*.pony</code>) - https://www.ponylang.io/
1. Prisma - https://www.prisma.io/
1. Reason (<code>*.re</code>) - https://reasonml.github.io/
1. Roc (<code>*.roc</code>) - https://www.roc-lang.org/
1. Svelte - https://svelte.dev/
1. TOML - https://toml.io/en/
1. Wing - https://www.winglang.io/
1. Zig - https://ziglang.org/
For a lot more formats install the TM4E <strong>Language Pack</strong> from the TM4E update site https://download.eclipse.org/tm4e/releases/latest/
For the following languages/file formats you can also install specialised Eclipse plug-ins with additional features:
- HTML, CSS, SCSS, SASS, LESS, JavaScript, TypeScript, JSON, YAML (incl. Kubernetes schema validation), XML, XSL, XSD, DTD, ESLint, Angular React (JSX, TSX), Vue.js: <a>Wild Web Developer</a>
- AsciiDoc: <a>Asciidoctor Editor</a>
- Bash Scripts: <a>ShellWax</a> or <a>Bash Editor</a>
- Dockerfile: <a>Eclipse Docker Tooling</a>
- Groovy: <a>Groovy Development Tools</a>
- Jenkins Pipelines (<code>Jenkinsfile</code>): <a>Jenkins Editor</a>
- Python: <a>PyDev - Python IDE for Eclipse</a>
- SQL: <a>SQL Editor</a> or <a>DBeaver</a> or <a>PL/SQL Workbench</a>
- Windows Batch Files (<code>*.bat</code>, <code>*.cmd</code>): <a>Batch Editor</a>
- JSON: <a>JSON Editor Plugin</a> or <a>Hi(speed)JSON Editor</a> or <a>Wild Web Developer</a>
- YAML: <a>YAML Editor</a> or <a>Wild Web Developer</a>
<a name="installation"></a>Installation
To install the plugin into an existing Eclipse installation do:
1. Within Eclipse go to: Help -> Install New Software...
1. Enter the following update site URL: https://raw.githubusercontent.com/sebthom/extra-syntax-highlighting-eclipse-plugin/updatesite
1. Select the <code>Extra Syntax Highlighting</code> feature to install.
1. Ensure that the option <code>Contact all update sites during install to find required software</code> is enabled.
1. Click <code>Next</code> twice.
1. Read/accept the license terms and click <code>Finish</code>.
1. Eclipse will now download the necessary files in the background.
1. When the download has finished, Eclipse will ask about installing unsigned content. You need to accept if you want to
1. After installation you will be prompted for a restart of Eclipse, which is recommended.
<a name="supported-fileformats"></a>Supported File Formats/Languages
| Language/Format | File Associations | Source
|:--------------- |:----------------- |:------ |
| ANTLR | file-extensions="g, g4" | <a>master@mike-lischke/vscode-antlr4</a>
| Apache HTTP Config | file-extensions="conf, htaccess, htgroups, htpasswd" | <a>master@mrmlnc/vscode-apache</a>
| Astro | file-extensions="astro" | <a>main@withastro/language-tools</a>
| Ballerina | file-extensions="bal" | <a>master@ballerina-platform/ballerina-grammar</a>
| bazelrc | file-extensions="bazelrc"file-names=".bazelrc, bazel.rc" | <a>master@bazelbuild/vscode-bazel</a>
| Branflakes | file-extensions="bf, bfsck, brainfuck" | <a>main@chrisvrose/bf-server</a>
| Carbon | file-extensions="carbon" | <a>trunk@carbon-language/carbon-lang</a>
| COBOL | file-extensions="cbl, cob, cobol, copy, cpy"file-patterns="**/broadcommfd.cobol-language-support/*/copybooks/**" | <a>development@eclipse-che4z/che-che4z-lsp-for-cobol</a>
| Crystal | file-extensions="cr" | <a>master@crystal-lang-tools/vscode-crystal-lang</a> <a>[upstream]</a>
| Crystal Slang | file-extensions="slang" | <a>master@crystal-lang-tools/vscode-crystal-lang</a>
| d2 | file-extensions="d2" | <a>master@terrastruct/d2-vscode</a>
| EditorConfig | file-extensions="editorconfig" | <a>main@editorconfig/editorconfig-vscode</a>
| Elm | file-extensions="elm" | <a>main@elm-tooling/elm-language-client-vscode</a>
| Embedded Crystal | file-extensions="ecr" | <a>master@crystal-lang-tools/vscode-crystal-lang</a>
| Entity Relationship | file-extensions="er" | <a>master@mikkel-ol/vsc-er-syntax-highlighting</a>
| Erlang | file-extensions="config, erl, escript, hrl, src" | <a>main@erlang-ls/vscode</a>
| Fish | file-extensions="fish" | <a>master@bmalehorn/vscode-fish</a>
| Fortran | file-extensions="F03, F08, F18, F90, F95, FPP, FYPP, PF, f03, f08, f18, f90, f95, fpp, fypp, pf" | <a>main@fortran-lang/vscode-fortran-support</a>
| Fortran77 | file-extensions="F, F77, FOR, f, f77, for" | <a>main@fortran-lang/vscode-fortran-support</a>
| Gleam | file-extensions="gleam" | <a>main@gleam-lang/vscode-gleam</a>
| GraphQL | file-extensions="gql, graphql, graphqls" | <a>main@graphql/graphiql</a>
| GraphViz DOT File | file-extensions="dot" | <a>master@textmate/graphviz.tmbundle</a>
| HashiCorp Sentinel | file-extensions="sentinel" | <a>main@hashicorp/syntax</a>
| HashiCorp Terraform | file-extensions="tf, tfvars" | <a>main@hashicorp/syntax</a>
| Haxe | file-extensions="hx" | <a>master@vshaxe/haxe-TmLanguage</a>
| HCL Config File | file-extensions="hcl" | <a>main@hashicorp/syntax</a>
| helm-template | file-patterns="**/templates/**/*.tpl, **/templates/**/*.yaml, **/templates/**/*.yml, **/templates/*.tpl, **/templates/*.yaml, **/templates/*.yml" | <a>master@vscode-kubernetes-tools/vscode-kubernetes-tools</a>
| Janet | file-extensions="janet" | <a>master@janet-lang/vscode-janet</a>
| Jinja C++ | file-extensions="c.j2, c.jinja, c.jinja2, cpp.j2, cpp.jinja, cpp.jinja2, h.j2, h.jinja, h.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Cisco Config | file-extensions="cisco.j2, cisco.jinja, cisco.jinja2, ios.j2, ios.jinja, ios.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja CSS | file-extensions="css.j2, css.jinja, css.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Cython | file-extensions="pxd.j2, pxd.jinja, pxd.jinja2, pxi.j2, pxi.jinja, pxi.jinja2, pyx.j2, pyx.jinja, pyx.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Dockerfile | file-extensions="dockerfile.j2, dockerfile.jinja, dockerfile.jinja2"file-names="Dockerfile.j2, Dockerfile.jinja, Dockerfile.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Groovy | file-extensions="groovy.j2, groovy.jinja, groovy.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja HTML | file-extensions="htm.j2, htm.jinja, htm.jinja2"file-patterns="*html.j2, *html.jinja, *html.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Java | file-extensions="java.j2, java.jinja, java.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja JavaScript | file-extensions="js.j2, js.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja JSON | file-extensions="code-workspace.j2, code-workspace.jinja, code-workspace.jinja2, json.j2, json.jinja, json.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja LaTeX | file-extensions="latex.j2, latex.jinja2, tex.j2, tex.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Lua | file-extensions="lua.j2, lua.jinja, lua.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Markdown | file-extensions="md.j2, md.jinja, md.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Nginx | file-extensions="conf.j2, conf.jinja, conf.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja PHP | file-extensions="php.j2, php.jinja, php.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Properties/ini/Conf | file-extensions="cfg.j2, conf.j2, desktop.j2, directory.j2, ini.j2, properties.j2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Python | file-extensions="py.j2, py.jinja, py.jinja2, pyi.j2, pyi.jinja, pyi.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Ruby | file-extensions="rb.j2, rb.jinja2, rbw.j2, rbw.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Rust | file-extensions="rs.j2, rs.jinja, rs.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Shell Script | file-extensions="bash.j2, bash_aliases.j2, bash_login.j2, bash_logout.j2, bash_profile.j2, bashrc.j2, ebuild.j2, env.j2, env.jinja, env.jinja2, install.j2, ksh.j2, profile.j2, sh.j2, zlogin.j2, zlogout.j2, zprofile.j2, zsh-theme.j2, zsh.j2, zshenv.j2, zshrc.j2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja SQL | file-extensions="sql.j2, sql.jinja, sql.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Systemd Unit File | file-extensions="automount.j2, automount.jinja, automount.jinja2, device.j2, device.jinja, device.jinja2, link.j2, link.jinja, link.jinja2, mount.j2, mount.jinja, mount.jinja2, netdev.j2, netdev.jinja, netdev.jinja2, network.j2, network.jinja, network.jinja2, path.j2, path.jinja, path.jinja2, scope.j2, scope.jinja, scope.jinja2, service.j2, service.jinja, service.jinja2, slice.j2, slice.jinja, slice.jinja2, snapshot.j2, snapshot.jinja, snapshot.jinja2, socket.j2, socket.jinja, socket.jinja2, swap.j2, swap.jinja, swap.jinja2, target.j2, target.jinja, target.jinja2, timer.j2, timer.jinja, timer.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja Terraform | file-extensions="hcl.j2, hcl.jinja, hcl.jinja2, tf.j2, tf.jinja, tf.jinja2, tfvars.j2, tfvars.jinja, tfvars.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja TOML | file-extensions="toml.j2, toml.jinja, toml.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja TypeScript | file-extensions="ts.j2, ts.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja XML | file-extensions="xml.j2, xml.jinja, xml.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| Jinja YAML | file-extensions="sls, yaml.j2, yaml.jinja, yaml.jinja2, yml.j2, yml.jinja, yml.jinja2" | <a>main@samuelcolvin/jinjahtml-vscode</a>
| JSON5 | file-extensions="json5" | <a>master@katjanakosic/vscode-json5</a>
| Jsonnet | file-extensions="jsonnet, libsonnet" | <a>main@grafana/vscode-jsonnet</a>
| Kotlin | file-extensions="kt, kts" | <a>main@fwcd/vscode-kotlin</a>
| LDIF File | file-extensions="ldif" | <a>master@FlashSystems/LDIF-Syntax</a>
| Mako Template | file-extensions="mako" | <a>master@marconi/mako-tmbundle</a>
| Markdoc | file-extensions="markdoc, markdoc.md, mdoc" | <a>main@markdoc/language-server</a>
| Markdown | file-extensions="livemd, markdown, md, mdown, mdwn, mkd, mkdn, mkdown, ronn, scd, workbook" | <a>main@wooorm/markdown-tm-language</a>
| MDX | file-extensions="mdx" | <a>main@mdx-js/mdx-analyzer</a>
| mermaid | file-extensions="mermaid, mmd" | <a>master@bpruitt-goddard/vscode-mermaid-syntax-highlight</a>
| NGINX Conf | file-extensions="conf, conf.default, conf.template, fastcgi_params, mime.types, nginx, nginx.conf, scgi_params, uwsgi_params" | <a>main@ahmadalli/vscode-nginx-conf</a>
| Nunjucks HTML | file-extensions="njk, njk.html" | <a>main@edheltzel/better-nunjucks-for-visual-studio-code</a>
| nushell | file-extensions="nu" | <a>main@nushell/vscode-nushell-lang</a>
| OCaml | file-extensions="eliom, ml, ocamlinit" | <a>master@ocamllabs/vscode-ocaml-platform</a>
| OCaml Interface | file-extensions="eliomi, mli" | <a>master@ocamllabs/vscode-ocaml-platform</a>
| OCaml.mlx | file-extensions="mlx" | <a>master@ocamllabs/vscode-ocaml-platform</a>
| OCamlFormat | file-extensions="ocamlformat" | <a>master@ocamllabs/vscode-ocaml-platform</a>
| odin | file-extensions="odin" | <a>master@DanielGavin/ols</a>
| opam | file-extensions="opam, opam.locked, opam.template"file-names="opam" | <a>master@ocamllabs/vscode-ocaml-platform</a>
| OpenGL Shading Language | file-extensions="comp, csh, frag, fs, fsh, fshader, geom, glsl, gs, gsh, gshader, mesh, rahit, rcall, rchit, rgen, rint, rmiss, task, tesc, tese, vert, vs, vsh, vshader" | <a>master@GeForceLegend/vscode-glsl</a>
| Pascal | file-extensions="dfm, dpk, dpr, fmx, lfm, lpr, p, pas" | <a>master@textmate/pascal.tmbundle</a>
| PlantUML | file-extensions="iuml, plantuml, pu, puml, wsd" | <a>master@qjebbs/vscode-plantuml</a>
| Pony | file-extensions="pony" | <a>main@chalcolith/eohippus</a>
| Prisma | file-extensions="prisma" | <a>main@prisma/language-tools</a>
| Reason | file-extensions="re, rei" | <a>master@ocamllabs/vscode-ocaml-platform</a>
| Ring | file-extensions="rform, rh, ring" | <a>master@ring-lang/ring</a>
| Roc | file-extensions="roc" | <a>main@ivan-demchenko/roc-vscode-unofficial</a>
| Starlark | file-extensions="BUILD, WORKSPACE, bazel, bzl, bzlmod, sky, star"file-names="BUILD, WORKSPACE" | <a>master@bazelbuild/vscode-bazel</a>
| Svelte | file-extensions="svelte" | <a>master@sveltejs/language-tools</a>
| TOML Config File | file-extensions="toml"file-names="Cargo.lock, Pipfile, pdm.lock" | <a>master@juggernautjp/less-toml</a> <a>[upstream]</a>
| Wing | file-extensions="w, wsim" | <a>main@winglang/wing</a>
| Zig | file-extensions="zig, zon" | <a>master@ziglang/vscode-zig</a>
<a></a>Building from Sources
To ensure reproducible builds this Maven project inherits from the <a>vegardit-maven-parent</a>
project which declares fixed versions and sensible default settings for all official Maven plug-ins.
The project also uses the <a>maven-toolchains-plugin</a> which decouples the JDK that is
used to execute Maven and it's plug-ins from the target JDK that is used for compilation and/or unit testing. This ensures full binary
compatibility of the compiled artifacts with the runtime library of the required target JDK.
To build the project follow these steps:
<ol>
<li>Download and install a Java 17 SDK, e.g. from:</li>
<li>https://adoptium.net/releases.html?variant=openjdk17</li>
<li>
https://www.azul.com/downloads/?version=java-17-lts&architecture=x86-64-bit&package=jdk
</li>
<li>
Download and install the latest <a>Maven distribution</a>.
</li>
<li>
In your user home directory create the file <code>.m2/toolchains.xml</code> with the following content:
</li>
</ol>
```xml
jdk
17
default
[PATH_TO_YOUR_JDK_17]
```
Set the <code>[PATH_TO_YOUR_JDK_17]</code> parameter accordingly.
<ol>
<li>
Checkout the code using one of the following methods:
<ul>
<li><code>git clone https://github.com/sebthom/extra-syntax-highlighting-eclipse-plugin</code></li>
<li>`svn co https://github.com/sebthom/extra-syntax-highlighting-eclipse-plugin extra-syntax-highlighting-eclipse-plugin</li>
</ul>
</li>
<li>
Run <code>mvn clean verify</code> in the project root directory. This will execute compilation, unit-testing, integration-testing and
packaging of all artifacts.
</li>
</ol>
<a name="license"></a>License
If not otherwise specified (see below), files in this repository fall under the <a>Eclipse Public License 2.0</a>.
Individual files contain the following tag instead of the full license text:
<code>SPDX-License-Identifier: EPL-2.0</code>
This enables machine processing of license information based on the SPDX License Identifiers that are available here: https://spdx.org/licenses/.
An exception is made for:
1. files in readable text which contain their own license information, or
2. files in a directory containing a separate <code>LICENSE.txt</code> file, or
3. files where an accompanying file exists in the same directory with a <code>.LICENSE.txt</code> suffix added to the base-name of the original file.
For example <code>foobar.js</code> is may be accompanied by a <code>foobar.LICENSE.txt</code> license file. | []
|
https://avatars.githubusercontent.com/u/107726195?v=4 | zig-3ds | zig-homebrew/zig-3ds | 2022-06-19T18:49:44Z | Starter pack for developing 3ds games/applications with Zig | master | 0 | 16 | 3 | 16 | https://api.github.com/repos/zig-homebrew/zig-3ds/tags | - | [
"3ds",
"devkitpro",
"zig"
]
| 4 | false | 2025-05-16T12:11:27Z | true | false | unknown | github | []
| zig-3ds
Getting started
<ul>
<li><a>zig</a></li>
<li><a>devkitPro</a></li>
</ul>
<code>pacman -S 3ds-dev
git clone https://github.com/zig-homebrew/zig-3ds
cd zig-3ds/
zig build # then run zig-out/zig-3ds.3dsx with citra</code>
Resources
<ul>
<li><a>3ds-examples</a></li>
<li><a>libctru repository</a></li>
<li><a>libctru documentation</a></li>
</ul> | []
|
https://avatars.githubusercontent.com/u/35064754?v=4 | soft | wooster0/soft | 2022-11-01T06:43:36Z | A software renderer | main | 0 | 16 | 0 | 16 | https://api.github.com/repos/wooster0/soft/tags | MIT | [
"2d",
"graphics",
"opengl",
"software-renderer",
"vulkan",
"webassembly",
"zig"
]
| 283 | false | 2025-02-25T09:19:25Z | true | false | unknown | github | []
|
Soft - a software renderer (GPU is not used)
<i>Drawing graphics anywhere!</i>
<i><b>The <a>metaballs</a> example running in the UEFI (TODO: build.zig broken ATM), on the web, in the terminal, and natively using OpenGL</b></i>
Usage
For now, until we have a <a>package manager</a>, copying this directory (not just <code>src/</code> as it doesn't include <code>LICENSE</code>)
into a <code>lib/</code> of yours might have to do. You can do something like this in your <code>build.zig</code>:
<code>zig
exe.addPackagePath("soft", "lib/src/main.zig");</code>
Building & Running examples
Run <code>zig build --help</code> and see <code>Project-Specific Options</code>:
<code>-Dexample=[string] The example to run (pass "help" for a list)
-Dbackend=[string] The backend to use for examples and tests:
none, opengl, terminal, uefi, vulkan, web (default: terminal)</code>
This means e.g. <code>zig build run -Dexample=rectangle -Dbackend=terminal</code> will build and run the <code>examples/rectangle.zig</code> example in your terminal (Ctrl+C to quit).
Goals
<ul>
<li>Have a simple, portable way to show graphics on the screen, using the CPU.</li>
<li>Easy integration into any environment.</li>
<li>Ability to test graphics output:
Often in graphics and video games it's hard to test output accurately.
Soft being a software renderer, it's easy to accurately test graphics output. The GPU is not used and all pixels are rendered by hand.</li>
<li>Reusability and flexibility:
As an example, a single <code>drawRect</code> serves to draw rectangles with solid colors, gradients, rounded corners, everything.
All this keeps the library small yet powerful.</li>
</ul>
Application
<ul>
<li><strong>Video games</strong>:
Soft provides a lot of primitives for making video games.</li>
<li><strong>Embedded</strong>:
The microcontroller you're developing for may not have a GPU.</li>
<li><strong>GUIs</strong>:
Soft provides a solid base for creating graphical user interfaces.</li>
<li><strong>Emulators</strong>:
Many older systems work in a similar fashion to framebuffers and didn't use GPUs as advanced as we have them today.
This means Soft might be a good fit for emulators.</li>
<li><strong>Prototyping and experimentation</strong>:
Soft is very easy to use and quickly lets you draw something to the screen.
This makes Soft an excellent candidate for experiments.
A great example of this use case in practice can be found at <code>examples/</code>.</li>
</ul>
Why do the drawing on the CPU instead of the GPU?
<ul>
<li>Simplicity</li>
<li>More control, over every pixel</li>
<li>Portability</li>
<li>A GPU may not be available</li>
<li>You know exactly what's happening</li>
</ul>
How is there an OpenGL and a Vulkan backend if "the GPU is not used"?
To clarify, these two backends only take a bunch of CPU-rendered pixels (a texture) and display that on the screen.
That is the only purpose all the backends serve. The main work of creating those pixels is done by Soft itself.
FAQ
Question
Why are the example backends not part of Soft itself?
So that I doesn't have to copy the example backend that renders the grid into my app for my platform/environment?
Answer
This is because doing so would be a monumental task and significantly increase complexity.
For example, if the Vulkan example backend would be a backend as part of the Soft library itself:
how would we ever provide enough control over what's happening inside the backend for every use case?
The Vulkan API gives the user a ton of control that we would have to pass through our abstraction.
Or for Wasm: how would we include the JavaScript that interpolates the memory it gets from
Zig through Wasm as an image in the Soft library and make it so that the user has enough control over it?
All this is why platform/environment-specific backends stay out of the Soft library itself and drawing the grid is left to the user.
As always, you can take inspiration from the example backends for rendering your grid in your environment.
This is one thing Soft does not do for you out of the box. | []
|
https://avatars.githubusercontent.com/u/2286349?v=4 | zig-sbi | leecannon/zig-sbi | 2022-03-03T23:01:23Z | Zig wrapper around the RISC-V SBI specification | master | 0 | 16 | 5 | 16 | https://api.github.com/repos/leecannon/zig-sbi/tags | MIT | [
"osdev",
"risc-v",
"riscv",
"riscv32",
"riscv64",
"sbi",
"zig",
"zig-package",
"ziglang"
]
| 138 | false | 2025-04-28T05:31:08Z | true | true | 0.14.0-dev.3445+6c3cbb0c8 | github | []
| zig-sbi
Zig wrapper around the <a>RISC-V SBI specification</a>.
Compatible with SBI Specification v3.0-rc1.
Installation
Add the dependency to <code>build.zig.zon</code>:
<code>sh
zig fetch --save git+https://github.com/leecannon/zig-sbi</code>
Then add the following to <code>build.zig</code>:
<code>zig
const sbi = b.dependency("sbi", .{});
exe.root_module.addImport("sbi", sbi.module("sbi"));</code> | []
|
https://avatars.githubusercontent.com/u/32315224?v=4 | ct | phreppo/ct | 2023-01-12T11:06:50Z | ⚡ The fastest line counter. At least on my computer. | master | 0 | 16 | 0 | 16 | https://api.github.com/repos/phreppo/ct/tags | MIT | [
"blazingly-fast",
"cli",
"line-counter",
"zig"
]
| 743 | false | 2025-04-09T10:23:42Z | true | false | unknown | github | []
| CounT
⚡ The fastest line counter on my computer ⚡
Usage
See the usage with <code>ct --help</code>.
<code>usage: ct [OPTIONS] [input]...
OPTIONS
--threads,-t <threads> Sets the number of threads to use. (default: 1)
--chunks-size,-c <chunks-size> Sets the size (in bytes) of the chunks allocated. (default: 2048Kb)
--help,-h Prints the help message.
ARGS
<input> Path to the input file(s).</code>
The Algorithm
<code>ct</code> uses a multithreaded algorithm that reads the input file in chunks.
It allocates a fixed amount of memory for each thread (that can be set with <code>--chunks-size</code>), and reuses it for the whole execution of the program.
This minimizes the number of allocations and makes the execution quite fast.
Setting the <code>--chunk-size</code> parameter properly can have a huge impact on the performance.
Benchmarks
There is a script file to generate test data for comparison.
Run <code>./scripts/gen.zig</code> to generate files of different sizes, up to 16Gb.
The files are saved in the directory <code>./files</code>.
Generating the files might take a while.
They are generated by a blazingly fast Zig script.
You can reproduce the benchmarks by running <code>make benchmark</code>.
You need <code>hyperfine</code> and <code>cw</code> installed.
To see how the results are obtained check <code>./scripts/benchmark.sh</code>.
Single Thread Benchmarks
I compared <code>ct</code> to <code>wc -l</code>, <a><code>cw -l</code></a> and a trivial Python script.
The Python script (<code>./scripts/countlines.py</code>) fails on the 16Gb file, so that I do not include it in what follows.
Multithreaded Benchmarks
<code>ct</code>'s algorithm is optimized for multithreading.
<code>wc -l</code> is not multithreaded, so that we have to compare to sequential code.
Here are the results using 4 threads in <code>ct</code> and <code>cw</code>:
The results are unfair, because <code>cw</code> does not allow multithreaded execution on a single file (at least in version <code>0.7.0</code>), as it puts each different input file on a different thread.
This implies that for a single file, <code>ct</code> is by far the fastest line counter out there!
To perform a fair comparison with <code>cw</code>, we have to use as many files as threads, so that the tool can parallelize optimally its computations.
Here, I use 4 threads.
Observe that this case is particularly advantageous for <code>cw</code> because the tasks are perfectly balanced.
By giving as input files of different sizes <code>cw</code> does not scale lineraly.
<code>ct</code> scales better in this case because it divides the overall work fairly over the threads.
Scalability
<code>ct</code> scales reasonably well:
My Machine
<ul>
<li>Ubuntu 20.04.6 LTS</li>
<li>Intel® Core™ i7-8650U CPU @ 1.90GHz × 8</li>
<li>16Gb Memory</li>
<li>512Gb SSD</li>
</ul>
Building
Zig should be version <code>>= 0.12.0</code>.
To build simply run <code>make</code>.
If you want to build the optimized version use <code>make release</code>. | []
|
https://avatars.githubusercontent.com/u/124217829?v=4 | nvim-fuel | javiorfo/nvim-fuel | 2023-02-02T02:20:37Z | Neovim plugin for running a main or script in several languages | master | 0 | 16 | 0 | 16 | https://api.github.com/repos/javiorfo/nvim-fuel/tags | MIT | [
"assembly",
"cpp",
"go",
"haskell",
"java",
"kotlin",
"lua",
"main",
"neovim",
"neovim-plugin",
"python",
"rust",
"scala",
"scheme",
"zig"
]
| 199 | false | 2025-04-09T10:23:58Z | false | false | unknown | github | []
| nvim-fuel
Fuel for your programs
<em>nvim-fuel is a Neovim plugin for running a main or script in several languages. This is meant to be useful for practicing and maybe teaching.</em>
Caveats
<ul>
<li>To use this plugin in a particular language, <strong>the compiler or language itself needs to be installed</strong>.</li>
<li>Supported languages are: <strong>Assembly, C, C++, Clojure, Go, Haskell, Java, Kotlin, Lua, Python, Rust, Scala, Scheme and Zig</strong></li>
<li>Posibility to add custom language implementations</li>
<li>This plugin has been developed on and for Linux following open source philosophies.</li>
</ul>
Overview
| Feature | nvim-fuel | NOTE |
| ------- | ------------- | ---- |
| Command to show results in Fuel Console | :heavy_check_mark: | Set by <code>Fuel</code> |
| Command to close Fuel Console | :heavy_check_mark: | Set by <code>FuelStop</code> |
| Execution in Normal Mode | :heavy_check_mark: | Set by <code>Fuel</code> |
| Execution in Insert Mode | :heavy_check_mark: | Set by <code>Fuel</code> |
| Console size configurable | :heavy_check_mark: | By <code>setup</code> |
| Autosave configurable | :heavy_check_mark: | By <code>setup</code> |
| Supports different languages in same window (different buffers) | :heavy_check_mark: | |
| Supports custom language implementations | :heavy_check_mark: | |
| Main arguments | :x: | |
| Stdin | :heavy_check_mark: | |
| Popup console | :heavy_check_mark: | By <code>setup</code> |
Installation
<code>Packer</code>
<code>lua
use {
'javiorfo/nvim-fuel',
requires = 'javiorfo/nvim-popcorn'
}</code>
<code>Lazy</code>
```lua
{
'javiorfo/nvim-fuel',
lazy = true,
dependencies = { 'javiorfo/nvim-popcorn' },
-- ft could contain only the languages nvim-fuel will be used for
ft = { "asm", "c", "cpp", "clojure", "go", "haskell", "java", "kotlin", "lua", "python", "rust", "scala", "scheme", "zig" },
opts = {
-- Not necessary. Only if you want to change the setup
view = {
-- Default console size (this applies to popup size too)
console_size = 10,
<code> -- Default autosave before pressing the Fuel shortcut
autosave = true,
-- Default false. If you want to show the console in a popup instead of a buffer
popup = false
}
},
keys = {
{ "<leader>fu", "<Plug>Fuel" },
{ "<leader>fs", "<Plug>FuelStop" }
}
</code>
}
```
Configuration (Packer)
<ul>
<li>Set mappings in <em>init.vim</em> or <em>init.lua</em>
```lua
local opts = { noremap = true, silent = true }</li>
</ul>
-- Normal mode
vim.api.nvim_set_keymap('n', 'fu', 'Fuel', opts)
vim.api.nvim_set_keymap('n', 'fs', 'FuelStop', opts)
```
<ul>
<li>
Only the installation step is required to use this plugin, but you can modify this options if you like:
```lua
require'fuel'.setup{
view = {
-- Default console size (this applies to popup size too)
console_size = 10,
<code>-- Default autosave before pressing the Fuel shortcut
autosave = true,
-- Default false. If you want to show the console in a popup instead of a buffer
popup = false
</code>
},
-- Override language implementations or implement a missing language
language_implementations = {
-- C example
c = {
-- Required build function
-- file_with_extension is this case will be 'file_name.c'
-- file is this case will be 'file_name'
build = function (file_with_extension, file)
vim.cmd("autocmd BufDelete c_fuel_main_console silent !rm -f " .. file)
return string.format("gcc -Wall %s -o /tmp/%s && /tmp/%s && rm -f /tmp/%s 2> /dev/null", file_with_extension, file, file, file)
end,
<code> -- Required statusline function
-- This will print on cmd statusline after build is executed
get_statusline = function(file)
return util.statusline_style(" C", file)
end,
-- Required get_footer function
-- This will print on footer popup after build is executed
get_footer = function(file)
return util.footer(" C", file)
end
}
</code>
}
}
```
</li>
</ul>
Usage
<ul>
<li>Executing the map corresponding to <code>Fuel</code> in a main or scripting file, it will compile and execute the aforementioned file opening a console ouput.</li>
<li>Execute the map corresponding to <code>FuelStop</code> to close all open Fuel console. In case you are using <code>popup = true</code> just press </li>
<li>To see the execution string use the command <code>:FuelInfo</code> which will open a popup with info</li>
</ul>
Screenshots
Java:
C:
Haskell and Rust in the same window:
Kotlin:
With popup console
<strong>NOTE:</strong> The colorscheme <strong>nebula</strong> from <a>nvim-nyctophilia</a> is used in this image.
Donate
<ul>
<li><strong>Bitcoin</strong> <a>(QR)</a> <code>1GqdJ63RDPE4eJKujHi166FAyigvHu5R7v</code></li>
<li><a>Paypal</a></li>
</ul> | []
|
https://avatars.githubusercontent.com/u/20110944?v=4 | zig-embshell | ringtailsoftware/zig-embshell | 2023-01-31T00:09:50Z | Small embeddable command line shell in zig | main | 0 | 16 | 0 | 16 | https://api.github.com/repos/ringtailsoftware/zig-embshell/tags | MIT | [
"cli",
"embedded",
"shell",
"zig",
"zig-package",
"ziglang"
]
| 40 | false | 2025-04-26T11:07:02Z | true | true | unknown | github | []
| EmbShell
A very small interactive command shell for (embedded) Zig programs.
EmbShell makes an ideal system monitor for debugging and interacting with a small embedded system. It interactively takes lines of text, parses commands and makes callbacks into handler functions.
Compared with Readline, Linenoise and Editline - EmbShell is tiny. It lacks most of their features, but it does have:
<ul>
<li>Tab completion for command names</li>
<li>Backspace for line editing</li>
<li>No reliance on libc and very little use of Zig's <code>std</code> (ie. no fancy print formatting)</li>
<li>Very little RAM use (just a configurable buffer for the incoming command line)</li>
</ul>
In EmbShell:
<ul>
<li>All commands and configuration are set at <code>comptime</code> to optimise footprint</li>
<li>All arguments are separated by whitespace, there is no support for quoted strings, multiline commands or escaped data</li>
<li>All handler arguments are strings, leaving it to the app to decide how to parse them</li>
<li>No runtime memory allocations</li>
</ul>
Using
Developed with <code>zig 0.14.0</code>
Run the sample
<code>cd example-posix
zig build run
</code>
<code>myshell> help
echo
led
myshell> echo hello world
You said: { echo, hello, world }
OK
myshell> led 1
If we had an LED it would be set to true
OK</code>
Using in your own project
First add the library as a dependency in your <code>build.zig.zon</code> file.
<code>zig fetch --save git+https://github.com/ringtailsoftware/zig-embshell.git</code>
And add it to <code>build.zig</code> file.
<code>zig
const embshell_dep = b.dependency("embshell", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("embshell", embshell_dep.module("embshell"));</code>
<code>@import</code> the module and provide a configuration.
<ul>
<li><code>.prompt</code> is the string shown to the user before each command is entered</li>
<li><code>.maxargs</code> is the maximum number of arguments EmbShell will process (e.g. "mycmd foo bar" is 3 arguments)</li>
<li><code>.maxlinelen</code> is the maximum length of a line to be handled, a buffer of this size will be created</li>
<li><code>.cmdtable</code> an array of names and handler function for commands</li>
</ul>
<code>zig
const UserdataT = u32;
const EmbShellT = @import("embshell").EmbShellFixedParams(UserdataT);
const EmbShell = @import("embshell").EmbShellFixed(.{
.prompt = "myshell> ",
.maxargs = 16,
.maxlinelen = 128,
.cmdtable = &.{
.{ .name = "echo", .handler = echoHandler },
.{ .name = "led", .handler = ledHandler },
},
.userdataT = UserdataT,
});</code>
Each handler function is in the following form. EmbShell prints "OK" after successfully executing each function and "Failed" if an error is returned.
<code>zig
fn myHandler(userdata: UserdataT, args:[][]const u8) anyerror!void {
// process args
// optionally return error
}</code>
Next, call <code>.init()</code> and provide a write callback to allow EmbShell to emit data
```zig
fn write(data:[]const u8) void {
// emit data to terminal
}
var shell = try EmbShell.init(write, userdata);
```
Finally, feed EmbShell with incoming data from the terminal to be processed
<code>zig
const buf = readFromMyTerminal();
shell.feed(buf)</code> | []
|
https://avatars.githubusercontent.com/u/107726195?v=4 | zig-gba | zig-homebrew/zig-gba | 2022-06-18T15:57:10Z | Starter pack for developing GBA games/applications with Zig | master | 2 | 15 | 3 | 15 | https://api.github.com/repos/zig-homebrew/zig-gba/tags | - | [
"devkitpro",
"gba",
"zig"
]
| 12 | false | 2025-02-26T11:12:52Z | true | false | unknown | github | []
| zig-gba
Getting started
<ul>
<li><a>zig</a></li>
<li><a>devkitPro</a></li>
</ul>
<code>pacman -S gba-dev
git clone https://github.com/zig-homebrew/zig-gba
cd zig-gba/
zig build # then run zig-out/zig-gba.gba with mgba</code>
Resources
<ul>
<li><a>gba-examples</a></li>
<li><a>libgba repository</a></li>
<li><a>libgba documentation</a></li>
<li><a>gbadev resources</a></li>
<li><a>GBATEK</a></li>
</ul> | []
|
https://avatars.githubusercontent.com/u/35909?v=4 | nats.zig | ianic/nats.zig | 2022-04-09T20:09:43Z | zig client lib for nats-server | master | 0 | 15 | 1 | 15 | https://api.github.com/repos/ianic/nats.zig/tags | MIT | [
"nats-client",
"zig",
"zig-library"
]
| 197 | false | 2025-03-13T13:37:22Z | true | false | unknown | github | []
| nats.zig - <a>Zig</a> client for the <a>NATS</a> messaging system
About
Minimal synchronous NATS Zig client.
Features:
* subject subscription
* message publishing
* tls connections
* nkey authentication
* connecting to the <a>ngs</a>
* non allocating protocol parser
Try
Build project:
<code>sh
git clone --recurse-submodules [email protected]:ianic/nats.zig.git
cd nats.zig
zig build</code>
Tested only using latest master 0.10-dev <a>release</a>.
You should have <a>installed</a> nats-server. Start it locally:
<code>sh
nats-server</code>
Start subscriber in one terminal:
<code>sh
./zig-out/bin/sub</code>
and publisher to send few messages to the <code>foo</code> subject on which subscriber is listening:
<code>sh
./zig-out/bin/pub</code>
ngs example
To connect and publish/subscribe to the ngs network you need valid credentials file. Start the ngs example and point it to the credentials file and specify a subject name. Example will both subscribe and publish few messages.
<code>sh
./zig-out/bin/ngs credentials_file.creds subject</code>
LibreSSL
Project depends on libressl for handling tls connections. Can be built using libressl from project or system.
To install libressl on macos:
<code>sh
brew install libressl</code>
and on linux:
<code>sh
wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.6.0.tar.gz
tar -xf libressl-3.6.0.tar.gz
ls -al
cd libressl-3.6.0/
./configure
sudo make install</code>
After that project can be build using system libressl:
<code>sh
zig build -Duse-system-libressl</code>
References
<ul>
<li><a>zig-libressl</a></li>
<li><a>nats protocol</a> documentation (that page is referencing also Derek's <a>talk</a> about zero allocation parser) </li>
<li><a>zig-nats</a> and <a>zig-nkeys</a> by Rutger Broekhoff </li>
<li>Twitter <a>conversLation</a> </li>
</ul> | []
|
https://avatars.githubusercontent.com/u/9960133?v=4 | zig-lvgl-nuttx | lupyuen/zig-lvgl-nuttx | 2022-06-28T02:15:22Z | Zig LVGL Touchscreen App on Apache NuttX RTOS | main | 0 | 15 | 1 | 15 | https://api.github.com/repos/lupyuen/zig-lvgl-nuttx/tags | Apache-2.0 | [
"bl602",
"bl604",
"embedded",
"lvgl",
"nuttx",
"pinecone",
"pinedio",
"zig"
]
| 329 | false | 2025-03-15T01:33:22Z | false | false | unknown | github | []
|
Zig LVGL Touchscreen App on Apache NuttX RTOS
Read the article...
<ul>
<li><a>"Build an LVGL Touchscreen App with Zig"</a></li>
</ul>
Can we use Zig to code an LVGL Touchscreen App for Apache NuttX RTOS?
Maybe make LVGL a little safer and friendlier... By wrapping the LVGL API in Zig?
Or will we get blocked by something beyond our control? (Like Bit Fields in LVGL Structs)
Let's find out!
LVGL Test App in C
Here's our barebones LVGL App in C (pic above): <a>lvgltest.c</a>
```c
static void create_widgets(void) {
// Get the Active Screen
lv_obj_t *screen = lv_scr_act();
// Create a Label Widget
lv_obj_t *label = lv_label_create(screen, NULL);
// Wrap long lines in the label text
lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK);
// Interpret color codes in the label text
lv_label_set_recolor(label, true);
// Center align the label text
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
// Set the label text and colors
lv_label_set_text(
label,
"#ff0000 HELLO# " // Red Text
"#00aa00 PINEDIO# " // Green Text
"#0000ff STACK!# " // Blue Text
);
// Set the label width
lv_obj_set_width(label, 200);
// Align the label to the center of the screen, shift 30 pixels up
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, -30);
// Omitted: LVGL Canvas
}
```
NuttX compiles the LVGL Test App with this GCC command...
```bash
App Source Directory
cd $HOME/nuttx/apps/examples/lvgltest
Compile lvgltest.c with GCC
riscv64-unknown-elf-gcc \
-c \
-fno-common \
-Wall \
-Wstrict-prototypes \
-Wshadow \
-Wundef \
-Os \
-fno-strict-aliasing \
-fomit-frame-pointer \
-fstack-protector-all \
-ffunction-sections \
-fdata-sections \
-g \
-march=rv32imafc \
-mabi=ilp32f \
-mno-relax \
-isystem "$HOME/nuttx/nuttx/include" \
-D__NuttX__ \
-DNDEBUG \
-DARCH_RISCV \
-pipe \
-I "$HOME/nuttx/apps/graphics/lvgl" \
-I "$HOME/nuttx/apps/graphics/lvgl/lvgl" \
-I "$HOME/nuttx/apps/include" \
-DLV_LVGL_H_INCLUDE_SIMPLE \
-Wno-format \
-Dmain=lvgltest_main \
-lvgltest.c \
-o lvgltest.c.home.user.nuttx.apps.examples.lvgltest.o
```
(Observed from <code>make --trace</code>)
Let's convert the LVGL Test App from C to Zig...
Auto-Translate LVGL App to Zig
The Zig Compiler can auto-translate C code to Zig. <a>(See this)</a>
Here's how we auto-translate our LVGL App <a>lvgltest.c</a> from C to Zig...
<ul>
<li>
Take the GCC command from above
</li>
<li>
Change <code>riscv64-unknown-elf-gcc</code> to <code>zig translate-c</code>
</li>
<li>
Add the target <code>-target riscv32-freestanding-none -mcpu=baseline_rv32-d</code>
</li>
<li>
Remove <code>-march=rv32imafc</code>
</li>
<li>
Surround the C Flags by <code>-cflags</code> ... <code>--</code>
</li>
</ul>
Like this...
```bash
App Source Directory
cd $HOME/nuttx/apps/examples/lvgltest
Auto-translate lvgltest.c from C to Zig
zig translate-c \
-target riscv32-freestanding-none \
-mcpu=baseline_rv32-d \
-cflags \
-fno-common \
-Wall \
-Wstrict-prototypes \
-Wshadow \
-Wundef \
-Os \
-fno-strict-aliasing \
-fomit-frame-pointer \
-fstack-protector-all \
-ffunction-sections \
-fdata-sections \
-g \
-mabi=ilp32f \
-mno-relax \
-Wno-format \
-- \
-isystem "$HOME/nuttx/nuttx/include" \
-D__NuttX__ \
-DNDEBUG \
-DARCH_RISCV \
-I "$HOME/nuttx/apps/graphics/lvgl" \
-I "$HOME/nuttx/apps/graphics/lvgl/lvgl" \
-I "$HOME/nuttx/apps/include" \
-DLV_LVGL_H_INCLUDE_SIMPLE \
-Dmain=lvgltest_main \
lvgltest.c \
<blockquote>
lvgltest.zig
```
</blockquote>
To fix the translation we need to insert this...
```c
if defined(<strong>NuttX</strong>) && defined(<strong>clang</strong>) // Workaround for NuttX with zig cc
include
include "../../nuttx/include/limits.h"
define FAR
endif // defined(<strong>NuttX</strong>) && defined(<strong>clang</strong>)
```
<a>(Source)</a>
And change this...
```c
static void monitor_cb(lv_disp_drv_t * disp_drv, uint32_t time, uint32_t px)
{
ifndef <strong>clang</strong> // Doesn't compile with zig cc
ginfo("%" PRIu32 " px refreshed in %" PRIu32 " ms\n", px, time);
endif // <strong>clang</strong>
}
```
<a>(Source)</a>
<a>(See the changes)</a>
Here's the original C code: <a>lvgltest.c</a>
And the auto-translation from C to Zig: <a>translated/lvgltest.zig</a>
Zig Auto-Translation is Incomplete
The Auto-Translation from C to Zig is missing 2 key functions: <code>lvgltest_main</code> and <code>create_widgets</code>...
```zig
// lvgltest.c:129:13: warning: unable to translate function, demoted to extern
pub extern fn create_widgets() callconv(.C) void;
// lvgltest.c:227:17: warning: local variable has opaque type
// (no file):353:14: warning: unable to translate function, demoted to extern
pub extern fn lvgltest_main(arg_argc: c_int, arg_argv: [<em>c][</em>c]u8) c_int;
```
<a>(Source)</a>
When we look up <code>lvgltest.c</code> line 227...
<code>c
int lvgltest_main(int argc, FAR char *argv[])
{
// lvgltest.c:227:17: warning: local variable has opaque type
lv_disp_drv_t disp_drv;
lv_disp_buf_t disp_buf;
...</code>
<a>(Source)</a>
We see that Zig couldn't translate the type <code>lv_disp_drv_t</code> because it's opaque.
Let's find out why.
Opaque Types
To find out why the type is opaque, we search for <code>lv_disp_drv_t</code> in the Zig Translation...
```zig
// nuttx/apps/graphics/lvgl/lvgl/src/lv_hal/lv_hal_disp.h:154:9:
// warning: struct demoted to opaque type - has bitfield
pub const lv_disp_drv_t = struct__disp_drv_t;
pub const struct__disp_drv_t = opaque {};
// nuttx/apps/graphics/lvgl/lvgl/src/lv_hal/lv_hal_disp.h:59:23:
// warning: struct demoted to opaque type - has bitfield
pub const lv_disp_t = struct__disp_t;
pub const struct__disp_t = opaque {};
pub const lv_disp_buf_t = opaque {};
```
<a>(Source)</a>
Below are the C definitions of <code>lv_disp_drv_t</code>, <code>lv_disp_t</code> and <code>lv_disp_buf_t</code>.
The structs couldn't be translated to Zig because they contain Bit Fields...
```c
typedef struct _disp_drv_t {
uint32_t rotated : 1;
uint32_t dpi : 10;
...
} lv_disp_drv_t;
typedef struct _disp_t {
uint8_t del_prev : 1;
uint32_t inv_p : 10;
...
} lv_disp_t;
typedef struct {
volatile uint32_t last_area : 1;
volatile uint32_t last_part : 1;
...
} lv_disp_buf_t;
```
Let's fix the Opaque Types.
Fix Opaque Types
Earlier we saw that Zig couldn't translate and import these structs because they contain Bit Fields...
<ul>
<li>
<code>lv_disp_drv_t</code> (Display Driver)
</li>
<li>
<code>lv_disp_buf_t</code> (Display Buffer)
</li>
</ul>
Instead of creating instances of these structs in Zig, we do it in C instead...
```c
/<strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em>*
* Name: get_disp_drv
*
* Description:
* Return the static instance of Display Driver, because Zig can't
* allocate structs wth bitfields inside.
*
</strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong>****/
lv_disp_drv_t *get_disp_drv(void)
{
static lv_disp_drv_t disp_drv;
return &disp_drv;
}
/<strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em>*
* Name: get_disp_buf
*
* Description:
* Return the static instance of Display Buffer, because Zig can't
* allocate structs wth bitfields inside.
*
</strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong>****/
lv_disp_buf_t *get_disp_buf(void)
{
static lv_disp_buf_t disp_buf;
return &disp_buf;
}
/<strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em>*
* Name: init_disp_drv
*
* Description:
* Initialise the Display Driver, because Zig can't access its fields.
*
</strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong>****/
void init_disp_drv(lv_disp_drv_t <em>disp_drv,
lv_disp_buf_t </em>disp_buf,
void (<em>monitor_cb)(struct _disp_drv_t </em>, uint32_t, uint32_t))
{
assert(disp_drv != NULL);
assert(disp_buf != NULL);
assert(monitor_cb != NULL);
lv_disp_drv_init(disp_drv);
disp_drv->buffer = disp_buf;
disp_drv->monitor_cb = monitor_cb;
}
/<strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em>*
* Name: init_disp_buf
*
* Description:
* Initialise the Display Buffer, because Zig can't access the fields.
*
</strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong>****/
void init_disp_buf(lv_disp_buf_t *disp_buf)
{
assert(disp_buf != NULL);
lv_disp_buf_init(disp_buf, buffer1, buffer2, DISPLAY_BUFFER_SIZE);
}
```
<a>(Source)</a>
Then we fetch the pointers to these structs in our Main Function and initialise the structs...
<code>c
int lvgltest_main(int argc, FAR char *argv[])
{
lv_disp_drv_t *disp_drv = get_disp_drv();
lv_disp_buf_t *disp_buf = get_disp_buf();
...
/* Basic LVGL display driver initialization */
init_disp_buf(disp_buf);
init_disp_drv(disp_drv, disp_buf, monitor_cb);
...
/* Touchpad Initialization */
lv_indev_drv_t *indev_drv = get_indev_drv();
init_indev_drv(indev_drv, tp_read);</code>
<a>(Source)</a>
(<code>get_indev_drv</code> and <code>init_indev_drv</code> are explained in the next section)
After this modification, our Auto-Translation from C to Zig now contains the 2 missing functions...
<ul>
<li>
<a><code>lvgltest_main</code></a>
</li>
<li>
<a><code>create_widgets</code></a>
</li>
</ul>
Input Driver
Our Input Driver <code>lv_indev_drv_t</code> is also an Opaque Type because it contains Bit Fields.
We fix <code>lv_indev_drv_t</code> the same way as other Opaque Types: We allocate and initialise the structs in C (instead of Zig)...
```c
/<strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em>*
* Name: get_indev_drv
*
* Description:
* Return the static instance of Input Driver, because Zig can't
* allocate structs wth bitfields inside.
*
</strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong>****/
lv_indev_drv_t *get_indev_drv(void)
{
static lv_indev_drv_t indev_drv;
return &indev_drv;
}
/<strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em>*
* Name: init_indev_drv
*
* Description:
* Initialise the Input Driver, because Zig can't access its fields.
*
</strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong>****/
void init_indev_drv(lv_indev_drv_t <em>indev_drv,
bool (</em>read_cb)(struct _lv_indev_drv_t <em>, lv_indev_data_t </em>))
{
assert(indev_drv != NULL);
assert(read_cb != NULL);
lv_indev_drv_init(indev_drv);
indev_drv->type = LV_INDEV_TYPE_POINTER;
/<em> This function will be called periodically (by the library) to get the
* mouse position and state.
</em>/
indev_drv->read_cb = read_cb;
lv_indev_drv_register(indev_drv);
}
```
<a>(Source)</a>
Color Type
We also commented out all references to <code>lv_color_t</code>...
<code>``c
// LVGL Canvas Demo doesn't work with zig cc because of</code>lv_color_t`
if defined(CONFIG_USE_LV_CANVAS) && !defined(<strong>clang</strong>)
// Set the Canvas Buffer (Warning: Might take a lot of RAM!)
static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_TRUE_COLOR(CANVAS_WIDTH, CANVAS_HEIGHT)];
...
```
<a>(Source)</a>
That's because <code>lv_color_t</code> is also an Opaque Type...
```zig
pub const lv_color_t = lv_color16_t;
pub const lv_color16_t = extern union {
ch: struct_unnamed_7,
full: u16,
};
// nuttx/apps/graphics/lvgl/lvgl/src/lv_core/../lv_draw/../lv_misc/lv_color.h:240:18:
// warning: struct demoted to opaque type - has bitfield
const struct_unnamed_7 = opaque {};
```
<a>(Source)</a>
That contains Bit Fields...
<code>c
typedef union {
struct {
// Bit fields for lv_color16_t (aliased to lv_color_t)
uint16_t blue : 5;
uint16_t green : 6;
uint16_t red : 5;
} ch;
uint16_t full;
} lv_color16_t;</code>
LVGL App in Zig
We copy these functions from the Auto-Translated Zig code...
<ul>
<li>
<a><code>lvgltest_main</code></a>
</li>
<li>
<a><code>create_widgets</code></a>
</li>
</ul>
And paste them into our Zig LVGL App...
https://github.com/lupyuen/zig-lvgl-nuttx/blob/ec4d58e84140cbf2b8fd6a80b65c06f6da97edfc/lvgltest.zig#L1-L164
We compile our Zig LVGL App...
```bash
Download our Zig LVGL App for NuttX
git clone --recursive https://github.com/lupyuen/zig-lvgl-nuttx
cd zig-lvgl-nuttx
Compile the Zig App for BL602 (RV32IMACF with Hardware Floating-Point)
zig build-obj \
--verbose-cimport \
-target riscv32-freestanding-none \
-mcpu=baseline_rv32-d \
-isystem "$HOME/nuttx/nuttx/include" \
-I "$HOME/nuttx/apps/graphics/lvgl" \
-I "$HOME/nuttx/apps/graphics/lvgl/lvgl" \
-I "$HOME/nuttx/apps/include" \
-I "$HOME/nuttx/apps/examples/lvgltest" \
lvgltest.zig
Patch the ELF Header of <code>lvgltest.o</code> from Soft-Float ABI to Hard-Float ABI
xxd -c 1 lvgltest.o \
| sed 's/00000024: 01/00000024: 03/' \
| xxd -r -c 1 - lvgltest2.o
cp lvgltest2.o lvgltest.o
Copy the compiled app to NuttX and overwrite <code>lvgltest.o</code>
TODO: Change "$HOME/nuttx" to your NuttX Project Directory
cp lvgltest.o $HOME/nuttx/apps/examples/lvgltest/lvgltest*.o
Build NuttX to link the Zig Object from <code>lvgltest.o</code>
TODO: Change "$HOME/nuttx" to your NuttX Project Directory
cd $HOME/nuttx/nuttx
make
```
When tested on PineDio Stack BL604, our Zig LVGL App correctly renders the screen and correctly handles touch input (pic below). Yay!
<code>text
NuttShell (NSH) NuttX-10.3.0
nsh> lvgltest
Zig LVGL Test
tp_init: Opening /dev/input0
cst816s_open:
cst816s_poll_notify:
cst816s_get_touch_data:
cst816s_i2c_read:
cst816s_get_touch_data: DOWN: id=0, touch=0, x=176, y=23
cst816s_get_touch_data: id: 0
cst816s_get_touch_data: flags: 19
cst816s_get_touch_data: x: 176
cst816s_get_touch_data: y: 23
...
tp_cal result
offset x:23, y:14
range x:189, y:162
invert x/y:1, x:0, y:1</code>
<a>(Source)</a>
Clean Up
After cleaning up our Zig LVGL App, here's our Main Function <code>lvgltest_main</code>...
```zig
/// Main Function that will be called by NuttX. We render an LVGL Screen and
/// handle Touch Input.
pub export fn lvgltest_main(
_argc: c_int,
_argv: [<em>]const [</em>]const u8
) c_int {
debug("Zig LVGL Test", .{});
// Command-line args are not used
_ = _argc;
_ = _argv;
<code>// Init LVGL Library
c.lv_init();
// Init Display Buffer
const disp_buf = c.get_disp_buf().?;
c.init_disp_buf(disp_buf);
// Init Display Driver
const disp_drv = c.get_disp_drv().?;
c.init_disp_drv(disp_drv, disp_buf, monitorCallback);
// Init LCD Driver
if (c.lcddev_init(disp_drv) != c.EXIT_SUCCESS) {
// If failed, try Framebuffer Driver
if (c.fbdev_init(disp_drv) != c.EXIT_SUCCESS) {
// No possible drivers left, fail
return c.EXIT_FAILURE;
}
}
// Register Display Driver
_ = c.lv_disp_drv_register(disp_drv);
// Init Touch Panel
_ = c.tp_init();
// Init Input Device. tp_read will be called periodically
// to get the touched position and state
const indev_drv = c.get_indev_drv().?;
c.init_indev_drv(indev_drv, c.tp_read);
// Create the widgets for display
createWidgetsUnwrapped()
catch |e| {
// In case of error, quit
std.log.err("createWidgets failed: {}", .{e});
return c.EXIT_FAILURE;
};
// To call the LVGL API that's wrapped in Zig, change
// `createWidgetsUnwrapped` above to `createWidgetsWrapped`
// Start Touch Panel calibration
c.tp_cal_create();
// Loop forever handing LVGL tasks
while (true) {
// Handle LVGL tasks
_ = c.lv_task_handler();
// Sleep a while
_ = c.usleep(10000);
}
return 0;
</code>
}
```
<a>(Source)</a>
And here's our <code>createWidgetsUnwrapped</code> function that creates widgets...
```zig
/// Create the LVGL Widgets that will be rendered on the display. Calls the
/// LVGL API directly, without wrapping in Zig. Based on
/// https://docs.lvgl.io/7.11/widgets/label.html#label-recoloring-and-scrolling
fn createWidgetsUnwrapped() !void {
<code>// Get the Active Screen
const screen = c.lv_scr_act().?;
// Create a Label Widget
const label = c.lv_label_create(screen, null).?;
// Wrap long lines in the label text
c.lv_label_set_long_mode(label, c.LV_LABEL_LONG_BREAK);
// Interpret color codes in the label text
c.lv_label_set_recolor(label, true);
// Center align the label text
c.lv_label_set_align(label, c.LV_LABEL_ALIGN_CENTER);
// Set the label text and colors
c.lv_label_set_text(
label,
"#ff0000 HELLO# " ++ // Red Text
"#00aa00 PINEDIO# " ++ // Green Text
"#0000ff STACK!# " // Blue Text
);
// Set the label width
c.lv_obj_set_width(label, 200);
// Align the label to the center of the screen, shift 30 pixels up
c.lv_obj_align(label, null, c.LV_ALIGN_CENTER, 0, -30);
</code>
}
```
<a>(Source)</a>
The Zig Functions look very similar to C: <a>lvgltest.c</a>
Note that we used <code>.?</code> to check for Null Pointers returned by C Functions. Let's find out why...
Zig Checks Null Pointers
<em>What happens if a C Function returns a Null Pointer...</em>
<code>c
lv_disp_drv_t *get_disp_drv(void) {
// Return a Null Pointer
return NULL;
}</code>
<em>And we call it from Zig?</em>
<code>zig
const disp_drv = c.get_disp_drv().?;</code>
Note that we used <code>.?</code> to check for Null Pointers returned by C Functions.
When we run this code, we'll see a Zig Panic...
```text
nsh> lvgltest
Zig LVGL Test
!ZIG PANIC!
attempt to use null value
Stack Trace:
0x23023606
```
The Stack Trace Address <code>23023606</code> points to the line of code that encountered the Null Pointer...
<code>text
zig-lvgl-nuttx/lvgltest.zig:50
const disp_drv = c.get_disp_drv().?;
230235f4: 23089537 lui a0,0x23089
230235f8: 5ac50513 addi a0,a0,1452 # 230895ac <__unnamed_10>
230235fc: 4581 li a1,0
230235fe: 00000097 auipc ra,0x0
23023602: c92080e7 jalr -878(ra) # 23023290 <panic>
23023606: ff042503 lw a0,-16(s0)
2302360a: fea42623 sw a0,-20(s0)</code>
So Zig really helps us to write safer programs.
<em>What if we omit <code>.?</code> and do this?</em>
<code>zig
const disp_drv = c.get_disp_drv();</code>
This crashes with a RISC-V Exception when the code tries to dereference the Null Pointer later. Which is not as helpful as a Zig Panic.
Thus we always use <code>.?</code> to check for Null Pointers returned by C Functions!
(Hopefully someday we'll have a Zig Lint Tool that will warn us if we forget to use <code>.?</code>)
Simplify LVGL API
<em>Can we simplify the LVGL API in Zig? Such that this code...</em>
```zig
// Get the Active Screen
const screen = c.lv_scr_act().?;
// Create a Label Widget
const label = c.lv_label_create(screen, null).?;
// Wrap long lines in the label text
c.lv_label_set_long_mode(label, c.LV_LABEL_LONG_BREAK);
// Interpret color codes in the label text
c.lv_label_set_recolor(label, true);
```
<a>(Source)</a>
<em>Becomes this?</em>
```zig
// Get the Active Screen
var screen = try lvgl.getActiveScreen();
// Create a Label Widget
var label = try screen.createLabel();
// Wrap long lines in the label text
label.setLongMode(c.LV_LABEL_LONG_BREAK);
// Interpret color codes in the label text
label.setRecolor(true);
```
<a>(Source)</a>
Yes we can! By wrapping the LVGL API in Zig, which we'll do in the next section.
Note that we now use <code>try</code> instead of <code>.?</code>.
<em>What happens if we forget to use <code>try</code>?</em>
If we don't <code>try</code>, like this...
<code>``zig
// Get the Active Screen without</code>try`
var screen = lvgl.getActiveScreen();
// Attempt to use the Active Screen
_ = screen;
```
Zig Compiler stops us with an error...
<code>text
./lvgltest.zig:109:9:
error: error is discarded.
consider using `try`, `catch`, or `if`
_ = screen;
^</code>
Thus <code>try</code> is actually safer than <code>.?</code>, Zig Compiler mandates that we check for errors.
<em>What if the LVGL API returns a Null Pointer to our Zig App?</em>
Our app will fail with this message...
<code>text
lv_scr_act failed
createWidgets failed: error.UnknownError</code>
Wrap LVGL API
Let's wrap the LVGL API in Zig.
Here's the implementation of <code>getActiveScreen</code>, which returns the LVGL Active Screen...
```zig
/// Return the Active Screen
pub fn getActiveScreen() !Object {
<code>// Get the Active Screen
const screen = c.lv_scr_act();
// If successfully fetched...
if (screen) |s| {
// Wrap Active Screen as Object and return it
return Object.init(s);
} else {
// Unable to get Active Screen
std.log.err("lv_scr_act failed", .{});
return LvglError.UnknownError;
}
</code>
}
```
<a>(Source)</a>
<code>Object</code> is a Zig Struct that wraps around an LVGL Object...
```zig
/// LVGL Object
pub const Object = struct {
<code>/// Pointer to LVGL Object
obj: *c.lv_obj_t,
/// Init the Object
pub fn init(obj: *c.lv_obj_t) Object {
return .{ .obj = obj };
}
/// Create a Label as a child of the Object
pub fn createLabel(self: *Object) !Label {
// Assume we won't copy from another Object
const copy: ?*const c.lv_obj_t = null;
// Create the Label
const label = c.lv_label_create(self.obj, copy);
// If successfully created...
if (label) |l| {
// Wrap as Label and return it
return Label.init(l);
} else {
// Unable to create Label
std.log.err("lv_label_create failed", .{});
return LvglError.UnknownError;
}
}
</code>
};
```
<a>(Source)</a>
<code>Label</code> is a Zig Struct that wraps around an LVGL Label...
```zig
/// LVGL Label
pub const Label = struct {
<code>/// Pointer to LVGL Label
obj: *c.lv_obj_t,
/// Init the Label
pub fn init(obj: *c.lv_obj_t) Label {
return .{ .obj = obj };
}
/// Set the wrapping of long lines in the label text
pub fn setLongMode(self: *Label, long_mode: c.lv_label_long_mode_t) void {
c.lv_label_set_long_mode(self.obj, long_mode);
}
/// Set the label text alignment
pub fn setAlign(self: *Label, alignment: c.lv_label_align_t) void {
c.lv_label_set_align(self.obj, alignment);
}
/// Enable or disable color codes in the label text
pub fn setRecolor(self: *Label, en: bool) void {
c.lv_label_set_recolor(self.obj, en);
}
/// Set the label text and colors
pub fn setText(self: *Label, text: [*c]const u8) void {
c.lv_label_set_text(self.obj, text);
}
/// Set the object width
pub fn setWidth(self: *Label, w: c.lv_coord_t) void {
c.lv_obj_set_width(self.obj, w);
}
/// Set the object alignment
pub fn alignObject(self: *Label, alignment: c.lv_align_t, x_ofs: c.lv_coord_t, y_ofs: c.lv_coord_t) void {
const base: ?*const c.lv_obj_t = null;
c.lv_obj_align(self.obj, base, alignment, x_ofs, y_ofs);
}
</code>
};
```
<a>(Source)</a>
Let's call the wrapped LVGL API...
After Wrapping LVGL API
With the wrapped LVGL API, our Zig App becomes simpler and safer...
```zig
/// Create the LVGL Widgets that will be rendered on the display. Calls the
/// LVGL API that has been wrapped in Zig. Based on
/// https://docs.lvgl.io/7.11/widgets/label.html#label-recoloring-and-scrolling
fn createWidgetsWrapped() !void {
<code>// Get the Active Screen
var screen = try lvgl.getActiveScreen();
// Create a Label Widget
var label = try screen.createLabel();
// Wrap long lines in the label text
label.setLongMode(c.LV_LABEL_LONG_BREAK);
// Interpret color codes in the label text
label.setRecolor(true);
// Center align the label text
label.setAlign(c.LV_LABEL_ALIGN_CENTER);
// Set the label text and colors
label.setText(
"#ff0000 HELLO# " ++ // Red Text
"#00aa00 PINEDIO# " ++ // Green Text
"#0000ff STACK!# " // Blue Text
);
// Set the label width
label.setWidth(200);
// Align the label to the center of the screen, shift 30 pixels up
label.alignObject(c.LV_ALIGN_CENTER, 0, -30);
</code>
}
```
<a>(Source)</a>
(TODO: Convert <code>LV_LABEL_LONG_BREAK</code>, <code>LV_LABEL_ALIGN_CENTER</code> and other constants to Enums)
Let's talk about creating the Zig Wrapper...
Auto-Generate Zig Wrapper
<em>Can we auto-generate the Wrapper Code?</em>
We might use Zig Type Reflection...
<ul>
<li><a>"Zig Type Reflection"</a></li>
</ul>
Or we can parse the Type Info JSON generated by Zig Compiler...
```bash
Emit IR, BC and Type Info
zig build-obj \
-femit-llvm-ir \
-femit-llvm-bc \
-femit-analysis \
--verbose-cimport \
-target riscv32-freestanding-none \
-mcpu=baseline_rv32-d \
-isystem "$HOME/nuttx/nuttx/include" \
-I "$HOME/nuttx/apps/graphics/lvgl" \
-I "$HOME/nuttx/apps/graphics/lvgl/lvgl" \
-I "$HOME/nuttx/apps/include" \
-I "$HOME/nuttx/apps/examples/lvgltest" \
lvgltest.zig
```
This produces the IR, BC and Type Info JSON files:
<code>text
lvgltest.ll
lvgltest.bc
lvgltest-analysis.json</code>
Let's look up the Type Info for the LVGL Function <code>lv_obj_align</code>.
We search for <code>lv_obj_align</code> in <code>lvgltest-analysis.json</code>...
<code>json
"decls":
...
{
"import": 99,
"src": 1962,
"name": "lv_obj_align",
"kind": "const",
"type": 148,
"value": 60
},</code>
Then we look up type 148 in <code>lvgltest-analysis.json</code>...
<code>bash
$ jq '.types[148]' lvgltest-analysis.json
{
"kind": 18,
"name": "fn(?*.cimport:10:11.struct__lv_obj_t, ?*const .cimport:10:11.struct__lv_obj_t, u8, i16, i16) callconv(.C) void",
"generic": false,
"ret": 70,
"args": [
79,
194,
95,
134,
134
]
}</code>
The First Parameter has type 79, so we look up <code>lvgltest-analysis.json</code> and follow the trail...
```bash
$ jq '.types[79]' lvgltest-analysis.json
{
"kind": 13,
"child": 120
}
Kind 13 is <code>?</code> (Optional)
$ jq '.types[120]' lvgltest-analysis.json
{
"kind": 6,
"elem": 137
}
Kind 6 is <code>*</code> (Pointer)
$ jq '.types[137]' lvgltest-analysis.json
{
"kind": 20,
"name": ".cimport:10:11.struct__lv_obj_t"
}
Kind 20 is <code>struct</code>???
```
Which gives us the complete type of the First Parameter...
<code>zig
?*.cimport:10:11.struct__lv_obj_t</code>
We don't have the Parameter Names though, we might need to parse the <code>.cimport</code> file.
<a>(More about jq)</a>
Object-Oriented Wrapper for LVGL
<em>Is LVGL really Object-Oriented?</em>
Yep the LVGL API is actually Object-Oriented since it uses Inheritance.
All LVGL Widgets (Labels, Buttons, etc) have the same Base Type: <code>lv_obj_t</code>. But some LVGL Functions will work only for specific Widgets, whereas some LVGL Functions will work on any Widget...
<ul>
<li>
<code>lv_label_set_text</code> works only for Labels
</li>
<li>
<code>lv_obj_set_width</code> works for any Widget
</li>
</ul>
The LVGL Docs also say that LVGL is Object-Oriented...
<ul>
<li><a>"Base object (lv_obj)"</a></li>
</ul>
Creating an Object-Oriented Zig Wrapper for LVGL might be challenging: Our Zig Wrapper needs to support <code>setWidth</code> for all LVGL Widgets.
To do this we might use Zig Interfaces and <code>@fieldParentPtr</code>...
<ul>
<li>
<a>"Interfaces in Zig"</a>
</li>
<li>
<a>"Zig Interfaces for the Uninitiated"</a>
</li>
</ul>
Which look somewhat similar to VTables in C++...
<ul>
<li><a>"Allocgate is coming in Zig 0.9"</a></li>
</ul>
<em>Are there any Object-Oriented Bindings for LVGL?</em>
The official Python Bindings for LVGL appear to be Object-Oriented. This could inspire our Object-Oriented Wrapper in Zig...
<ul>
<li><a>Python Bindings for LVGL</a></li>
</ul>
However the Python Bindings are Dynamically Typed, might be tricky implementing them as Static Types in Zig.
The LVGL Wrapper in this article was inspired by the <a>zgt GUI Library</a>, which works with GTK, Win32 and WebAssembly...
<ul>
<li><a>"Build a PinePhone App with Zig and zgt"</a></li>
</ul> | []
|
https://avatars.githubusercontent.com/u/99468136?v=4 | kinda | beaver-lodge/kinda | 2022-10-06T03:09:12Z | Ship C library with Zig-based NIF for Elixir | main | 0 | 14 | 1 | 14 | https://api.github.com/repos/beaver-lodge/kinda/tags | - | [
"elixir",
"zig"
]
| 181 | false | 2025-04-13T01:24:48Z | true | false | unknown | github | []
| Kinda
Kinda is an Elixir package using Zig to bind a C library to BEAM the Erlang virtual machine.
The core idea here is using comptime features in Zig to create a "resource kind" which is "higher-kinded" type abstracts the NIF resource object, C type and Elixir module.
The general source code generating and building approach here is highly inspired by the TableGen/.inc in LLVM.
Kinda will generate NIFs exported by resource kinds and and provide Elixir macros to generate higher level API to call them and create resource.
With Kinda, NIFs generated and hand-rolled co-exist and complement each other.
Installation
If <a>available in Hex</a>, the package can be installed
by adding <code>Kinda</code> to your list of dependencies in <code>mix.exs</code>:
<code>elixir
def deps do
[
{:kinda, "~> 0.7.1"}
]
end</code>
Documentation can be generated with <a>ExDoc</a>
and published on <a>HexDocs</a>. Once published, the docs can
be found at <a>https://hexdocs.pm/Kinda</a>.
Usage
A full example could be found in <a>kinda_example</a>
More examples
<ul>
<li>define a root module for the C library</li>
</ul>
<code>elixir
defmodule Foo.CAPI do
use Kinda.Library, kinds: [Foo.BarKind]
end</code>
<ul>
<li>define a forwarder module
<code>elixir
defmodule Foo.Native do
use Kinda.Forwarder, root_module: CAPI
end</code></li>
<li>define kinds
<code>elixir
defmodule Foo.BarKind do
use Kinda.ResourceKind,
forward_module: Foo.Native
end</code></li>
</ul>
What Kinda does
<ul>
<li>Make NIF more of a purely function dispatch. So that you can break the complicity among C/Zig and Elixir.</li>
<li>Make it possible to pattern matching a C type in Elixir.</li>
<li>Everything in Kinda could be a NIF resource, including primitive types like integer and C struct. This makes it possible to pass them to C functions as pointers.</li>
<li>Kinda will generate a NIF function for every C function in your wrapper header, and register every C struct as NIF resource.</li>
</ul>
Cool features in Kinda enabled by Zig
<ul>
<li>Packing anything into a resource</li>
</ul>
Almost all C++/Rust implementation seems to force you to map a fixed size type to a resource type.
In fact for same resource type, you can have Erlang allocate memory of any size.
With Zig's comptime <code>sizeof</code> you can easily pack a list of items into an array/struct without adding any abstraction and overhead. An illustration:
<code>[(address to item1), item1, item2, item3, ...]</code>
So the memory is totally managed by Erlang, and you can use Zig's comptime feature to infer everything involved.
<ul>
<li>Saving lib/include path to a Zig source and use them in your <code>build.zig</code>. You can use Elixir to find all the paths. It is way better than configuring with make/CMake because you are using Elixir a whole programming language to do it. It is described in Zig doc as:</li>
</ul>
<blockquote>
Surfacing build configuration as comptime values by providing a file that can be imported by Zig code.
</blockquote>
<ul>
<li>Inter NIF resource exchange. Because it is Zig, just import the Zig source from another Hex package.</li>
</ul>
Differences from Zigler
Kinda borrows a lot of good ideas and code from Zigler (Zigler is awesome~) but there are some differences:
<ul>
<li>Kinda's primary goal is to help you consume a C library, not helping you write NIFs in Zig.</li>
<li>Kinda expects you to have a <code>build.zig</code>. So if you want to also sneak CMake/Bazel inside, go for it.</li>
<li>In functions generated by Kinda, all memory are allocated and managed by Erlang as resource.</li>
</ul>
Differences from Rustler
Kinda is also inspired by Rustler. Rustler really define what a ergonomic NIF lib should be like.
<ul>
<li>Kinda should have the sugar for resource open and NIF declaration similar to Rustler but are provided in Elixir (<code>nif_gen</code> and <code>type_gen</code>).</li>
<li>Due to the absence of official Zig package indexing, as for now Kinda's approach could be more of a monolithic NIF lib while in Rustler, you can break things into different crates which is really nice.</li>
<li>The only protection Kinda might provide is the resource type checks. Lifetime and other more sophisticated checks are expected to be provided by the C library you are consuming.</li>
</ul>
Differences from TableGen
<ul>
<li>Usually TableGen generates C/C++ source code. While in Kinda it is expected to generate Elixir AST and get compiled directly.</li>
<li>To generate Zig code, Kinda takes in C <code>.h</code> files instead of <code>.td</code> files.</li>
</ul>
Core concepts
<ul>
<li>
<code>ResourceKind</code>: a Zig struct to bundle:
</li>
<li>
C types
</li>
<li>Erlang NIF resource object type</li>
<li>functions to open/fetch/make a resource object.</li>
<li>
there could be higher order <code>ResourceKind</code> to bundle one or more different <code>ResourceKind</code>s
</li>
<li>
<code>root_module</code>: the NIF module will load the C shared library
</li>
<li><code>forward_module</code>: module implement functions like <code>array/2</code>, <code>ptr/1</code> to forward functions to <code>root_module</code>. By implementing different callbacks, you might choose to use Elixir struct to wrap a resource or use it directly.</li>
<li>
Recommended module mapping convention:
</li>
<li>
let's say you have a Elixir module to manage a C type. And the NIF module is <code>SomeLib.CAPI</code>
<code>elixir
defmodule SomeLib.I64 do
defstruct ref: nil
def create() do
ref = apply(SomeLib.CAPI, Module.concat([__MODULE__, :create]) |> Kinda.check!
struct!(__MODULE__, %{ref: ref})
end
end</code>
</li>
<li>
in <code>SomeLib.CAPI</code> there should be a NIF generated by Kinda with name <code>:"Elixir.SomeLib.I64.create"/0</code>
</li>
<li>
wrapper: a <code>.h</code> C header file including all the C types and functions you want to use in Elixir. Kinda will generate a NIF module for every wrapper file.
</li>
<li>wrapped functions, C function with corresponding NIF function name, will be called in the NIF module.</li>
<li>kinds to generate: return type and argument types of every functions in wrapper will be generated. User will need to implement the behavior <code>Kinda.CodeGen</code> for a type with a special name (usually it is C function pointer), or it is the type name in C source by default.</li>
<li>raw nifs: nifs doesn't follow involved in the resource kind naming convention. Insides these NIFs it is recommended to use NIF resource types registered by Kinda.</li>
</ul>
Internals
Source code generation
<ol>
<li>calling Zig's <code>translation-c</code> to generate Zig source code from wrapper header</li>
<li>
parse Zig source into ast and then:
</li>
<li>
collect C types declared as constants in Zig (mainly structs), generate kinds for them
</li>
<li>generate kinds for primitive types like int, float, etc.</li>
<li>
generate pointer/array kinds for all types
</li>
<li>
generate NIF source for every C function in the wrapper header
</li>
<li>generate kind source for every C type used in C functions</li>
</ol>
Pre-built mode
<ul>
<li>Out of the box Kinda supports generating and loading pre-built NIF library.</li>
</ul>
<code>elixir
use Kinda.Prebuilt,
otp_app: :beaver,
base_url: "[URL]",
version: "[VERSION]"</code>
<ul>
<li>It reuses code in <a>rustler_precompiled</a> to follow the same convention of checksum checks and OTP compatibility rules.</li>
<li>In Kinda, besides the main NIF library, there might be <code>kinda-meta-*.ex</code> for functions signatures and multiple shared libraries the main NIF library depends on. (Zig doesn't support static linking yet so we have to ship shared ones. <a>Related issue</a>)</li>
</ul>
Release
<ul>
<li>run the example</li>
</ul>
<code>cd kinda_example
mix deps.get
mix test --force
mix compile --force</code> | []
|
https://avatars.githubusercontent.com/u/5464072?v=4 | zig-docker | nektro/zig-docker | 2022-03-07T10:25:26Z | Zig bindings for the Docker Engine API | master | 0 | 14 | 1 | 14 | https://api.github.com/repos/nektro/zig-docker/tags | MIT | [
"bindings",
"docker",
"zig"
]
| 64 | false | 2025-05-21T00:18:00Z | true | false | unknown | github | []
| zig-docker
Zig bindings for the Docker Engine API.
API docs: https://docs.docker.com/engine/api/v1.41/
WIP as its based on the partially-incomplete Swagger API (https://github.com/moby/moby/issues/27919)
Updating
<code>$ zig build run
$ zig fmt src/direct.zig</code>
Example Program
<code>$ zig build test</code> | []
|
https://avatars.githubusercontent.com/u/76353?v=4 | zig-with-cpp | anagram3k/zig-with-cpp | 2022-11-28T17:38:50Z | Zig Language example on interfacing with C++ code | main | 0 | 14 | 2 | 14 | https://api.github.com/repos/anagram3k/zig-with-cpp/tags | MIT | [
"cpp",
"zig",
"ziglang"
]
| 10 | false | 2025-04-30T05:53:09Z | true | false | unknown | github | []
| <code>Zig</code> with <code>C++</code>
This is a simple example to demonstrate Zig interfacing with C++ code.
The only requirement is a C interface.
The c++ code is based on <a>C Wrappers for C++ Libraries and Interoperability</a>
Run
Use below script to run.
<code>bash
zig build run</code> | []
|
https://avatars.githubusercontent.com/u/5464072?v=4 | zig-tls | nektro/zig-tls | 2022-10-28T21:49:40Z | [WIP] A pure-Zig TLS 1.3 client implementation. | master | 0 | 13 | 0 | 13 | https://api.github.com/repos/nektro/zig-tls/tags | MIT | [
"tls",
"tls13",
"zig",
"zig-package"
]
| 40 | false | 2024-06-22T18:27:40Z | true | false | unknown | github | []
| zig-tls
A pure-Zig <a>RFC8446 TLS 1.3</a> client implementation.
Crypto is hard, please feel free to view the source and open issues for any improvements.
Indebted to https://tls13.xargs.org/ and multiple readings of the RFC.
License
MIT | []
|
https://avatars.githubusercontent.com/u/80392719?v=4 | zfat | ZigEmbeddedGroup/zfat | 2022-05-07T08:35:40Z | Generic purpose platform-independent FAT driver for Zig | main | 0 | 13 | 5 | 13 | https://api.github.com/repos/ZigEmbeddedGroup/zfat/tags | MIT | [
"fat",
"fat32",
"filesystem",
"zig",
"zig-package"
]
| 2,339 | false | 2025-05-02T16:00:06Z | true | true | unknown | github | [
{
"commit": null,
"name": "fatfs",
"tar_url": null,
"type": "remote",
"url": "http://elm-chan.org/fsw/ff/arc/ff15a.zip"
}
]
| zfat
Bindings for the <a>FatFs</a> library | []
|
https://avatars.githubusercontent.com/u/10215376?v=4 | doseijisho | ymndoseijin/doseijisho | 2022-11-17T04:12:03Z | A new (WIP) multilingual dictionary GUI program made in Zig. | master | 1 | 13 | 0 | 13 | https://api.github.com/repos/ymndoseijin/doseijisho/tags | GPL-2.0 | [
"dictionary",
"gui",
"japanese",
"zig",
"ziglang"
]
| 165 | false | 2024-05-29T09:09:59Z | true | false | unknown | github | []
| 土星辞書 Doseijisho
Description
Doseijisho is a new multilingual dictionary GUI program made in Zig. Currently, it supports StarDict, EPWING and TAB formats. In it, you can load multiple dictionaries. Still quite a WIP, I'll tidy things up soon enough.
It uses <a>MeCab</a> for converting phrases into 分かち, separating them into words, making it possible to serach using entire phrases (like in <a>Jotoba</a>). That, besides personal amusement, is mostly the reason I made this, for I couldn't find a good desktop dictionary that could do that, that and Linux's dictionary software is quite lacking.
Installation
Doseijisho has an AppImage on its <a>release page</a>, you may choose to install it that way. Currently, it's not in any package managers.
Build instructions
Doseijisho's dependencies are <code>gtk4</code>, <code>MeCab</code> and <code>libeb</code>. Plus it's written in Zig, on Arch Linux (similarly enough on other *NIX systems) these can be installed by:
```
pacman -S gtk4
$ paru -S mecab-git mecab-ipadic libeb // or manually or using any other AUR helper
$ paru -S zig-dev-bin // project works with zig master
```
Then, you can simply clone the repository and run <code>zig build run</code> to start the program. The binary is currently in <code>zig-out/bin/doseijisho</code>.
For common usage, I recommend using <code>zig build -Doptimize=ReleaseFast</code> instead. When debugging, it's better to disable it.
Usage
```
doseijisho [options] ... [dictionary] [search-queries] ...
[dictionary] sets the target dictionary for search in the cli interface
[search-queries] sets the search words to the target dictionary, it can take more than one word.
If no [search-queries] are set, it will read from stdin by default. If [dictionary] and [search-queries] aren't set, it will trigger the GTK interface.
-h --help shows this menu
-s --stardict [stardict-file] sets StarDict dictionary
-t --tab [tab-file] sets tabulated dictionary
-e --epwing [eb-file] sets EB(EPWING, EBG...) dictionary
-l --list list dictionary titles (separated by newlines)
-v --verbose enable verbose output (useful for debugging)
-c --cli-only disable all other interfaces besides cli
```
For example:
<code>doseijisho -e ~/docs/dict/Daijirin -e ~/docs/dict/Kenkyusha_Waei_Daijiten_V5 -s /home/saturnian/docs/dict/stardict-kanjidic2-2.4.2/ -s ~/docs/dict/stardict-jmdict-ja-en-2.4.2/ -s ~/docs/dict/stardict-latin-english-2.4.2/ -s ~/docs/dict/stardict-enamdict-2.4.2</code>
For the cli:
```
doseijisho -e ~/docs/dict/Daijirin -e ~/docs/dict/Kenkyusha_Waei_Daijiten_V5 -c "研究社 新和英大辞典 第5版" "優しい"
優しい:
やさしい2【優しい】 <?>(yasashii)
〔柔和な〕 gentle; tender; soft; meek; 〔優雅な〕 graceful; delicate; 〔愛情ある〕 affectionate; sweet; 〔温和な〕 mild(-mannered); 〔親切
〕 kind(hearted); kindly; 〔温順な〕 suave; quiet; 〔人当たりのよい〕 amiable; sweet.
...
```
For other examples on the cli interface, you may look at the scripts on the root of the repository. | []
|
https://avatars.githubusercontent.com/u/121678877?v=4 | zig-libuv | paveloom-z/zig-libuv | 2022-12-30T14:41:07Z | Zig bindings for the `libuv` library | main | 0 | 13 | 1 | 13 | https://api.github.com/repos/paveloom-z/zig-libuv/tags | MIT | [
"libuv",
"zig"
]
| 199 | false | 2024-10-29T20:19:14Z | true | false | unknown | github | []
| Notices
Mirrors
Repository:
- <a>Codeberg</a>
- <a>GitHub</a>
- <a>GitLab</a>
Prerequisites
Make sure you have installed:
<ul>
<li>A development library for <code>libuv</code></li>
<li><a>Zig</a> (<code>v0.10.1</code>)</li>
</ul>
Build
To build and install the library, run <code>zig build install</code>.
To run unit tests, run <code>zig build test</code>.
See <code>zig build --help</code> for more build options, including how to run examples.
Integrate
To integrate the bindings into your project:
1) Add this repository as a dependency in <code>zigmod.yml</code>:
<code>```yml
# <...>
root_dependencies:
- src: git https://github.com/paveloom-z/zig-libuv
```
</code>
2) Make sure you have added the dependencies in your build script:
<code>```zig
// <...>
const deps = @import("deps.zig");
const uv_pkg = deps.pkgs.uv.pkg.?;
// <...>
pub fn build(b: *std.build.Builder) !void {
// <...>
// For each step
inline for (steps) |step| {
// Add the library package
step.addPackage(uv_pkg);
// Link the libraries
step.linkLibC();
step.linkSystemLibrary("libuv");
// Use the `stage1` compiler because of
// https://github.com/ziglang/zig/issues/12325
step.use_stage1 = true;
}
// <...>
}
```
If you'd like a static build, take a look at the stab in the [`zigmod.yml`](zigmod.yml) file.
</code> | []
|
https://avatars.githubusercontent.com/u/107519028?v=4 | learn-zig | better-zig/learn-zig | 2022-06-15T00:09:56Z | zig quick learn | main | 0 | 12 | 1 | 12 | https://api.github.com/repos/better-zig/learn-zig/tags | Apache-2.0 | [
"ffi",
"ffi-bindings",
"zig",
"zig-package",
"ziglang"
]
| 49 | false | 2025-01-01T02:47:27Z | false | false | unknown | github | []
| learn-zig
<ul>
<li>learning zig language</li>
</ul>
<blockquote>
related:
</blockquote>
<ul>
<li>✅ https://github.com/better-zig/ziglings-solutions<ul>
<li>zig 语法练习</li>
</ul>
</li>
</ul>
Features:
<ul>
<li><a>basic</a>: zig basic example</li>
<li><a>toolbox</a> : zig toolbox</li>
<li><a>zig-utils</a> : zig utils</li>
</ul>
<blockquote>
与 C 语言互操作性:
</blockquote>
<ul>
<li>✅ <a>c</a>: 使用 zig 作为 C 编译器, 直接编译 C 代码</li>
<li><code>cd packages/c; task run</code></li>
<li>or <code>task c:run</code></li>
<li>✅ <a>zig-use-c</a>: zig 调用 C 代码</li>
<li>✅ <a>zig-to-c</a>: zig 编译成 C Lib(C ABI), 基于 <code>FFI</code>, 被其他语言(如 dart)调用</li>
</ul>
QuickStart:
<blockquote>
requirements:
</blockquote>
<ul>
<li>zig: <code>0.10.0-dev.2617+47c4d4450</code></li>
<li>zigmod: <code>zigmod r80 macos aarch64 none</code></li>
</ul>
<blockquote>
install:
</blockquote>
```ruby
install zig:
task install:zig:dev
-> % zig version
0.10.0-dev.2617+47c4d4450
macos + m1 cpu:
task install:zigmod:m1
or macos + intel cpu
task install:zigmod:intel
```
<blockquote>
run:
</blockquote>
<code>ruby
task basic:run</code>
<blockquote>
test:
</blockquote>
<code>ruby
task basic:test</code>
Structure:
```ruby
-> % tree ./packages/ -L 2
./packages/
├── basic
│ ├── Taskfile.yml
│ ├── build.zig
│ ├── src
│ ├── zig-cache
│ ├── zig-out
│ └── zigmod.yml
├── toolbox
│ ├── Taskfile.yml
│ ├── build.zig
│ ├── src
│ └── zigmod.yml
└── zig-utils
├── Taskfile.yml
├── build.zig
├── src
├── zig-cache
└── zigmod.yml
``` | []
|
https://avatars.githubusercontent.com/u/1562827?v=4 | pegzi | travisstaloch/pegzi | 2023-01-04T06:30:30Z | a PEG (parsing expression grammar) parser in zig | main | 0 | 12 | 2 | 12 | https://api.github.com/repos/travisstaloch/pegzi/tags | NOASSERTION | [
"zig",
"ziglang"
]
| 71 | false | 2025-04-02T12:25:54Z | true | false | unknown | github | []
| pegzi
a PEG (parsing expression grammar) parser in zig
resources
<ul>
<li>https://en.wikipedia.org/wiki/Parsing_expression_grammar</li>
<li>https://www.piumarta.com/software/peg/peg.1.html</li>
<li>https://github.com/ziglang/zig-spec</li>
<li>https://github.com/zigtools/sus</li>
</ul>
goals
generate pseudo-zig source code for use by the sus fuzzer | []
|
https://avatars.githubusercontent.com/u/15584994?v=4 | tunez | haze/tunez | 2022-04-14T03:51:36Z | tunez is a general purpose audio metadata library made in zig | main | 2 | 12 | 1 | 12 | https://api.github.com/repos/haze/tunez/tags | - | [
"audio",
"id3v2",
"metadata",
"zig"
]
| 233 | false | 2025-05-08T15:54:19Z | true | true | 0.14.0 | github | []
| <strong>tunez</strong> is a general purpose audio metadata library
(Planned) features
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> "good enough" id3v2 support (v2.3, v2.4)
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> <strong>full</strong> id3v2 support (v2.2, all frames, rich frames)
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> "good enough" flac/ogg vorbis comments support
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> <strong>full</strong> flac/ogg vorbis comments support
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> 100% code coverage + documentation (tests are welcome!)
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> compile time <code>MetadataResolver</code> stack; give a file path and a list of possible metadata types and just get info | [
"https://github.com/lun-4/awtfdb"
]
|
https://avatars.githubusercontent.com/u/604708?v=4 | ZigMachine | shazz/ZigMachine | 2022-12-29T15:26:14Z | A FantasyConsole compiled as WebAssembly and written in Zig | main | 29 | 12 | 0 | 12 | https://api.github.com/repos/shazz/ZigMachine/tags | - | [
"demoscene",
"fantasy-console",
"oldschool",
"wasm",
"webassembly",
"zig",
"ziglang"
]
| 3,758 | false | 2025-05-17T08:58:58Z | true | false | unknown | github | []
| ZigMachine
A <a>Fantasy Console</a> (or Fantasy Computer, not sure) written in <a>Zig</a> and running in the browser as a <a>Web Assembly</a> binary. The ZigMachine is dedicated to provide a fun sandbox to learn how to code <a>oldskool effects</a> as no advanced features are provided, only the basics of the 80s computers and video game consoles.
This project is inspired by <a>WAB</a> and <a>CODEF</a> by my friend <a>NoNameNo</a> who... already more than 10 years ago... provided a way to code oldskool effects in the browser without Flash but only HTML5 and javascript. Time to go one step further. 0% Flash, 0% HTML, 0% Javascript, only Zig!
Screenshots and live version below!
Live version
Live website with the latest build: <a>ZigMachine</a> (Click on the + and - buttons to change channels!)
Specs
The specs of the ZigMachine will definitively evolve over time but for now they try to match what I would have loved to get in the 80-90s:
Memory / CPU
<ul>
<li>2 MB of RAM available (32 pages of 64KB).</li>
<li>CPU frequency is what your Web Assembly browser framework can do. So, pretty (too...) fast. I'd love to be able to provide a restricted and stable execution speed one day if I find a way to do it. Currently my not-that-optimized flat shaded triangle routine can display around 1000 triangles/frame.</li>
</ul>
Graphics
<ul>
<li>1 physical RGBA framebuffer of 400x280 pixels without borders, 320x200 pixels with borders.</li>
<li>4 logical linear indexed colors framebuffers (each pixel is an entry of the 256 colors RGBA palette) of 320x200 pixels</li>
<li>1 palette of 256 colors (RGBA, 8 bits per component) for each logical framebuffer.</li>
<li>Blocking VBL and HBL callbacks on logical framebuffers and on the physical framebuffer.</li>
<li>Overscan possible but a little tricky to set up else no fun!</li>
</ul>
Sound
<ul>
<li>Nothing yet! Soon! (Hopefully)</li>
</ul>
OS
<ul>
<li>Limited ZigOS for basic setup and framebuffer managemenent.</li>
<li>8x8 sytem font with print capability</li>
</ul>
Demo framework
In addition to the fantasy console and the ZigOS, a library for classic oldsk00l demo effects is provided featuring:
<ul>
<li>Horizontal scrolltext with offset tables in X and Y</li>
<li>2D starfield</li>
<li>3D starfield</li>
<li>3D transformations</li>
<li>Triangle, line and pixel drawing</li>
<li>Sprites</li>
<li>Bobs</li>
<li>Screen fading</li>
<li>Background image</li>
<li>Static text display</li>
</ul>
I started to port some of my favorites Atari and Amiga cracktros (from WAB) to show how to use the ZigMachine. Check the source code and the channels in the live demo.
Next in my TODO list:
<ul>
<li>Stero digital sound channel (44100Hz, 32 bits).</li>
<li>Soundchip (YM2149 probably) emulation.</li>
<li>Blitter emulation for line drawing and polyfilling.</li>
<li>Mapped memory in addition to OS functions.</li>
<li>Emulated hardware scrolling.</li>
<li>Z-Buffer, face culling, Gouraud shading.</li>
<li>3D Objects loader.</li>
</ul>
For the moment, only Zig is supported to code stuff on the ZigMachine (so the name...) but maybe one day, some custom 68K like assembly code or probably inline Web Assembly. Who knows :) Want to add things? Please leave a message in the <a>Discussions</a>
Project status
The project status is available here: https://github.com/users/shazz/projects/2/
Build
Prerequisites
<ul>
<li><a>Zig 0.10.0+ </a></li>
<li><a>Python 3+</a>, pretty nice to preprocess images and host the wasm with one line</li>
<li>Optional VScode with Zig extensions</li>
</ul>
The default (and only) target for this build is <code>wasm32-freestanding-musl</code>.
To build the wasm module, run:
For Web Assembly
<code>shell
% zig build -Drelease=true -Dwasm</code>
Note: <code>build.zig</code> specifies various wasm-ld parameters. For example, it sets the initial memory size and maximum size to be xxx pages, where each page consists of 64kB. Use the <code>--verbose</code> flag to see the complete list of flags the build uses.
Run
Start up the server in the html directory:
<code>shell
cd docs
python3 -m http.server 3333</code>
Go to your favorite browser and type to the URL <code>http://localhost:3333</code> or <code>http://localhost:3333/debug.html</code> for a debug view of each logical framebuffer.
Screenshots
| []
|
https://avatars.githubusercontent.com/u/16517858?v=4 | rayworld-ng | bfeldpw/rayworld-ng | 2023-01-01T16:25:28Z | Simple (well, gettin' more complex) Raycaster to learn Zig | dev | 0 | 12 | 0 | 12 | https://api.github.com/repos/bfeldpw/rayworld-ng/tags | GPL-3.0 | [
"raycasting",
"stb-truetype",
"zig",
"zig-lang"
]
| 10,811 | false | 2024-11-14T22:01:36Z | true | false | unknown | github | []
| rayworld-ng
Simple Raycaster to learn Zig
<em>Teaser, further screenshots see below</em>
Introduction
My first steps in Zig, importing native C with Glfw and OpenGL for learning purposes. Code might be hacky in some places, hopefully improving while learning. ~~OpenGL fixed function pipeline is used purely out of lazyness and the fact, that a simple vertical line (maybe textured) is all that is needed for a raycasting algorithm in its most simplistic form. Might switch to core profile later, but that's secondary.~~ OpenGL core profile is used to be able to do optimisations and effects such as ambient occlusion using shaders. For now, the map is hardcoded as are parameters (nevertheless there are parameters and not some magic numbers ;-)). Later, a map, its features, and configuration should be loaded from files, of course.
News
<strong>Next up</strong> The next thing to tackle will most probably be something internal again. Since a lot of vertices are dynamically updated and send to the GPU in each frame, optimisation might be possible by using glStorageBuffer and persistent mapping via glMapBufferRange with persistence and coherence bits set.
<strong>2024-08-08</strong> There was some time off due to another pet project. Nevertheless, several internal adjustments were made. This includes cleaning up the ray casting code structures to be prepared for further additions (floor casting, lights,...).
Apart from that, dependency towards zstbi has been removed, using stb_image directly
<strong>2023-12-09</strong> OpenGL core profile has been merged to main branch. After a lot of work, the main functionality has been moved to modern OpenGL, this includes:
* Ambient occlusion has been re-introduced (better, shader-based)
* Framebuffer objects (FBO) have been implemented and are used for
* Rendering the scene in lower (subsampling, GPU performance gain) or higher (super-sampling, anti-aliasing) resolution
* Rendering the simulation to a framebuffer's texture which can be mapped to a wall segment ("monitor")
* Finally, a thread pool is used for raycasting which leads to a great performance gain. While multithreading
has been beneficial before, the thread spawning in every frame caused some unneccessary overhead.
<ul>
<li> </li>
</ul>
Note: GUI overlay has not been ported, yet.
<strong>2023-04-07</strong> While major work on different aspects is going on in the background, a very simple, yet visually apparent feature has been added: not-that-flat-shading. Well, I guess it's technically flat shading, but since the relative angle to the wall changes with each ray, there is also a smoothing on flat walls and a kind of ambient occlusion in corners. Of course, pillars are a bit prettier (as in "rounder, more 3D"), as well.
<ul>
<li> </li>
</ul>
<strong>2023-03-26</strong> In the last two weeks, a font manager has been implemented using stb_truetype for rasterisation. It features
* Loading fonts
* Rasterising fonts
* Configuration option for auto-rasterisation. Enabling this rasterises fonts on the fly if required
* Limiting the maximum number of font atlasses and auto removing idle fonts
* The configuration sets a boolean for auto removal. If a new font is to be rasterised and the maximum number of font atlasses is reached, the most idle font (not used for the longest time) is removed
* Minimum idle time: Another configuration parameter sets the minimum time for auto removal. If there is no font with a larger idle time, an error is thrown. This is to handle situations, where the maximum number of rasterised fonts is used in a single frame and hence, the first font drawn in the frame (with the highest idle time) would be removed.
* Calculating text length and height including new lines to scale output
* Rendering font atlasses and text: Both functions rely on a gfx_impl.zig file that can be adjusted to the graphics engine by the user
* Several unit tests have been implemented
Overall, the font manager is a good candidate to be separated as a library to be used outside of rayworld. I will try to create a MIT-licensed version on GitHub soon.
The next image depicts rendering the help information to the screen:
<ul>
<li> </li>
</ul>
<strong>2023-03-10</strong> Apart from adding CI via GitHub Actions, two major features were implemented in the past 6 weeks:
* Subsampling of rays is now possible. When subsampling, quads are drawn instead of lines. Since texture coordinates and heights are interpolated correctly and material transitions and depth discontinuities are taken into account, visual quality doesn't noticably decrease if not subsampling excessively. Additionally, each reflecting wall element can be configured individually to increase subsampling in order to reduce processing costs. A debug view with elevated camera shows reflections with reduced sampling
<ul>
<li>
</li>
<li>
Background simulation: In a spontaneous attempt to add some story, a background simulation has been implemented. The player is on a space station, orbiting a planet with space debris/asteroids. Utilising SIMD operations, a threads computes 10 000 objects orbiting the planet without too much impact on performance. A system map depicting planet, station and debris can be overlayed.
</li>
<li></li>
</ul>
<strong>2023-01-29</strong> A lot of new features found there way into the build this week. Most interesting is glass. First, refraction based on material index has been implemented. Some scenerios looked a little weird, because of the lack of total inner reflection, which was implemented next.
<ul>
<li>
*
</li>
<li>
</li>
</ul>
Secondly, round pillars can now be placed. While their radius is still a fixed parameter, it will be a variable parameter in the map attributes soon. Lastly, a bit of testing has been done to scatter ray segments reflected by walls to simulate diffuse reflections.
<ul>
<li> </li>
</ul>
<strong>2023-01-20</strong> Texture mapping has been implemented. Since, as mentioned above, I was using the immediate mode ("fixed function pipeline"), this became quite taxing due to calls to OpenGL. Since I am aware of people using the integrated Intel GPU with its linux drivers, that are somewhat buggy in my experience when it comes to core profile, I tried to stay withing OpenGL <= 2.0. This lead to DrawArrays. A memory structure has been set up to store all information of primitives to be drawn for different depth layers (reflections/mirrors). A first test for "manual" mip mapping has been done as well.
Getting back to the core of ray casting, all wall elements have been made slightly reflective, too. There is a maximum amount of ray bounces much lower than that of mirrors, though.
<ul>
<li></li>
</ul>
<strong>2023-01-12:</strong> Floor and ceiling are now represented by a very simple colour grading. This will be improved, when those cells are drawn during tracing, which also allows for ground textures. Additionally, some light vertical ambient occlusion is rendered, which is a very hacky specific function blending vertical colour-graded line segments.
<strong>2023-01-11:</strong> The basic structure to store more map attributes has been implemented. As a first test, RGBA colours are set for every cell.
<strong>2023-01-10:</strong> A first version of mirrors has been implemented. The underlying system based on ray segments allows for different scenarios, "spawning" ray segments is only limited to a maximum amount to avoid infinite reflections and high processing loads. Wall and mirror features are fixed in this early version. In the future, map features, such as mirrors and walls will have several attributes.
<ul>
<li></li>
</ul>
<strong>2023-01-09:</strong> Implemented a simple interpolation between two vertical lines so only half of the rays need to be calculated. Additionally, multithreading was added for they ray calculations. At the moment, it's statically set to 4 threads, to avoid too much overhead of spawning without a threadpool. The overhead might become noticable, since the ray casting itself is pretty fast (non-complex as of yet). Using both methods, there is a ~75% reduction of computing time on my system.
Early implementation
A scene with mirror elements, different colors and a little ambient occlusion can be seen in Figure 1,
the overview map is on the bottom left:
<ul>
<li></li>
</ul>
<em>Figure 1: Scene and map representation</em>
Figure 2 shows an enlarged version of a similar scene as seen in Figure 1 to demonstrate the ray propagation:
<ul>
<li></li>
</ul>
<em>Figure 2: Enlarged map view of the ray propagation</em>
Installation and dependencies
Zig seems to be very handy when it comes to cross compiling. I only tried within Linux, GLFW3, GLEW and thus, OpenGL have to be installed.
| []
|
https://avatars.githubusercontent.com/u/4645331?v=4 | zava | chaoyangnz/zava | 2022-08-23T08:56:50Z | Mini Java VM in Zig | master | 0 | 11 | 3 | 11 | https://api.github.com/repos/chaoyangnz/zava/tags | - | [
"bytecode",
"java",
"java-8",
"jvm",
"zig"
]
| 55,389 | false | 2025-01-21T14:53:00Z | true | false | unknown | github | []
| zava
Mini Java VM in Zig <code>v0.13.0</code>
What it is
Zava is a Java* VM implementation in Zig. This is a sister project of <a>Gava</a> which is using Go.
The goal of Zava is to implement a couple of features which are not capable of doing by Go, such as GC and fine control of memory allocation.
The reference of the implement is <a>JVM Spec 8 edition</a> and it is supposed to be compatible with Java 8 bytecode.
<blockquote>
* JAVA is a trademark of Oracle America, Inc.
</blockquote>
Roadmap
Feature:
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> type system definition
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> class file parser
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> instructions interpretion
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> native methods bridge to support HelloWorld
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> class loading
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> bootstrap class loader
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> user defined class loader
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> string pool
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> basic reflection support (Class, Field, Method, Consutructor)
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> multi-thread and concurrency
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> garbage collector
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> profiling and Debugger integration
Non-functional:
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> sufficent unit test coverage
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> code readability and clear documentation of high-level design
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> mini ebook to describe how to evolve a mini VM from scratch
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> VSCode debugging extension
Get started
Download <a>JDK</a> and extract to <code>jdk</code> folder.
The default class path is <code>examples/classes</code> and <code>jdk/classes</code>, so any classes located in the path can be loaded by <code>zava</code>.
<ul>
<li>HelloWorld
```
zig build</li>
</ul>
./zava HelloWorld
```
Debugging
A VS code launch.json is configured for your debugging.
And after running the program, a <code>zava.log</code> is produced to trace the execution.
<ul>
<li>info level: only method calls are logged</li>
<li>debug level: per instruction executions are also logged with the context</li>
</ul> | []
|
https://avatars.githubusercontent.com/u/33030965?v=4 | zig-fp | tizee/zig-fp | 2022-07-31T01:37:43Z | some iterator patterns for Zig lang | main | 1 | 11 | 0 | 11 | https://api.github.com/repos/tizee/zig-fp/tags | Apache-2.0 | [
"iterator",
"zig"
]
| 93 | false | 2024-11-08T22:24:33Z | true | false | unknown | github | []
| zig-fp
Functional programmimng style patterns in Zig lang.
<code>zig version
0.10.0-dev.3340+c6f5832bb</code>
Features
<ul>
<li>Iterators</li>
<li>Monad</li>
</ul>
Usage
```zig
const std = @import("std");
const it = @import("zig-fp");
fn isEven(val: u32) bool {
return val % 2 == 0;
}
fn toChar(val: u32) u8 {
if(val % 4 == 0) {
return '0';
}else{
return '1';
}
}
fn print(val: u8) void{
std.debug.print("{}\n", .{val});
}
it.range(u32,0,100,1)
.filter(isEven)
.map(toChar)
.for_each(print);
```
<blockquote>
Currently Zig does not support closure but we can achieve similar functionality with <code>comptime</code> and <code>type</code> to build the context for reusing the same iterator interface.
</blockquote> | []
|
https://avatars.githubusercontent.com/u/126710?v=4 | web4-min-contract | vgrichina/web4-min-contract | 2022-11-30T03:43:48Z | Minimal useful Web4 contract. Can be used together with web4-deploy to deploy static websites | main | 0 | 11 | 4 | 11 | https://api.github.com/repos/vgrichina/web4-min-contract/tags | - | [
"ipfs",
"nearprotocol",
"web3",
"web4",
"zig"
]
| 71 | false | 2025-02-17T18:47:51Z | true | false | unknown | github | []
| web4-min-contract
Minimal useful <a>Web4</a> contract. Can be used together with <a>web4-deploy</a>
to deploy website tied to your <code>.near</code> account, with static content hosted on IPFS.
Building from source
Install <a>Zig</a>. Below command uses <a>v0.13.0</a>.
Then run:
<code>bash
zig build --release=small</code>
You should get <code>zig-out/bin/web4-min</code> file.
Deploying smart contract
Install <a>near-cli-rs</a> first.
Then run:
<code>bash
near deploy --wasmFile zig-out/bin/web4-min --accountId <your-account>.near</code>
See more on <a>how to deploy NEAR smart contracts</a>.
Deploying website
Run <a>web4-deploy</a> using <code>npx</code>:
<code>bash
npx web4-deploy path/to/your/website <your-account>.near</code>
How it works
<code>web4-deploy</code> will upload your website to IPFS and then call <code>web4_setStaticUrl</code> method in this smart contract to set IPFS hash of your website.
Then you can access your website using <code>https://<your-account>.near.page</code> Web4 gateway.
Contract Functions
<ul>
<li><code>web4_get</code>: Serves static content from IPFS, with SPA support (redirects to index.html)</li>
<li><code>web4_setStaticUrl</code>: Updates the IPFS URL for static content</li>
<li><code>web4_setOwner</code>: Updates the contract owner account</li>
</ul>
SPA Support
The contract automatically redirects paths without file extensions to <code>index.html</code>, making it suitable for Single Page Applications (SPAs). For example:
- <code>/about</code> -> serves <code>/index.html</code>
- <code>/style.css</code> -> serves directly
Storage
The contract uses two storage keys:
- <code>web4:staticUrl</code> - IPFS URL for static content
- <code>web4:owner</code> - Optional owner account that can manage the contract
Default Content
When no static URL is set, the contract serves content from:
<code>ipfs://bafybeidc4lvv4bld66h4rmy2jvgjdrgul5ub5s75vbqrcbjd3jeaqnyd5e</code>
This contains instructions for getting started.
Access Control
The contract can be managed by:
- The contract account itself
- An owner account (if set via web4_setOwner)
Memory Management
The contract is optimized for NEAR's ephemeral runtime environment:
- Memory is automatically freed after each contract call
- No explicit memory management is needed
- Built with <code>-O ReleaseSmall</code> for minimal contract size
Development
Run tests:
<code>bash
zig build test</code>
Note: The contract is designed for NEAR's ephemeral runtime environment where memory is automatically freed after execution. | []
|
https://avatars.githubusercontent.com/u/6756180?v=4 | zFFI | kassane/zFFI | 2022-05-01T14:20:00Z | CBindgen FFI test | main | 0 | 11 | 2 | 11 | https://api.github.com/repos/kassane/zFFI/tags | Unlicense | [
"ffi",
"rust",
"tokio-rs",
"zig"
]
| 32 | false | 2025-01-14T15:37:04Z | true | false | unknown | github | []
| zFFI
CBindgen FFI test
How to run
Execute:
<code>bash
$> zig build cargo # to build rustlib
$> zig build run # to run</code> | []
|
https://avatars.githubusercontent.com/u/10042482?v=4 | cyborg | desttinghim/cyborg | 2022-10-13T03:05:53Z | Cyborg is a minimalist, self-contained toolkit for building Android apps | main | 1 | 11 | 0 | 11 | https://api.github.com/repos/desttinghim/cyborg/tags | - | [
"android",
"apk",
"dex",
"zig"
]
| 4,747 | false | 2025-04-22T15:39:39Z | true | true | unknown | github | [
{
"commit": null,
"name": "zig_archive",
"tar_url": null,
"type": "relative",
"url": "zig-archive/"
}
]
| 404 | []
|
https://avatars.githubusercontent.com/u/11492844?v=4 | advent-of-code-2022 | fjebaker/advent-of-code-2022 | 2022-12-01T09:06:11Z | Solutions to AoC 2022 in zig | main | 0 | 10 | 1 | 10 | https://api.github.com/repos/fjebaker/advent-of-code-2022/tags | - | [
"advent-of-code",
"advent-of-code-2022",
"zig",
"ziglang"
]
| 83 | false | 2025-04-15T12:19:13Z | true | false | unknown | github | []
| 404 | []
|
https://avatars.githubusercontent.com/u/44317699?v=4 | nectar | ajkachnic/nectar | 2022-06-29T01:20:30Z | A cross-platform audio plugin framework for Zig. | main | 5 | 10 | 0 | 10 | https://api.github.com/repos/ajkachnic/nectar/tags | MIT | [
"zig"
]
| 718 | false | 2024-12-16T09:32:50Z | true | false | unknown | github | []
|
A cross-platform audio plugin platform for Zig.
<strong><em>WARNING</em></strong>: <em>This is in like a pre-alpha state, and probably very buggy and incomplete; Here be dragons</em>
Nectar is made up of a number of packages:
<ul>
<li><a><code>nectar/core</code></a> - Core utilities and tools used across most other packages</li>
<li><a><code>nectar/midi</code></a> - Mostly <em>tested</em> MIDI Parser</li>
<li><a><code>nectar/vst2</code></a> - Bindings to the VST 2.4 SDK and some utilities</li>
<li><a><code>nectar/standalone</code></a> - Bindings to libsoundio for standalone applications</li>
</ul>
Project Status
<em>As of August 23rd, 2022:</em>
Nectar has basic support for building a VST2 plugin, with a cross-platform interface. But things like GUI Support, other plugin formats, and general DSP abstractions are not here yet.
I've created issues for all of the features I plan on supporting for an alpha v0.1 release. Here's an abridged list:
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> <a>Redesign parameter API</a>
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> <a>Tweak build setup and make it less complex</a>
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> <a>Document core APIs</a>
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> <a>Add Clap plugin support</a>
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Add VST3 plugin support
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Add GitHub actions for automated builds and tests
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Possibly: Add basic GUI support (more likely, just creating windows and nanovg-style drawing)
See <a>here</a> for the full list of issues.
Long term goals
Thinking further ahead than just the next release, here are some goals I'd like to achieve before a 1.0 release.
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> GUI support with proper widgets and layout
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Standalone support (pretty much requires GUI support)
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Numerous tutorials and resources on the docs website
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> A nice, easy to use DSP library
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> ~100% test coverage for applicable packages
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Get some outside contributors and people excited about Zig audio involved
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Potentially redesign the docs site
Planned Targets (checked are implemented)
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> VST2
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> VST3
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> CLAP
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Standalone (libsoundio)
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> LV2 | []
|
https://avatars.githubusercontent.com/u/10344925?v=4 | monkey.zig | ktanaka101/monkey.zig | 2022-09-11T05:30:51Z | 🐵 Monkey interpreter in Zig. 🚀 | main | 0 | 10 | 1 | 10 | https://api.github.com/repos/ktanaka101/monkey.zig/tags | MIT | [
"interpreter",
"language",
"monkey",
"monkey-language",
"programming-language",
"repl",
"zig"
]
| 50 | false | 2025-03-27T12:53:32Z | true | true | 0.13.0 | github | [
{
"commit": "refs",
"name": "string",
"tar_url": "https://github.com/JakubSzark/zig-string/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/JakubSzark/zig-string"
}
]
| 🐵 monkey.zig
Summury
We can learn how to make an interpreter in this book.
====> ☆☆☆ <strong><a>"Writing An Interpreter in Go"</a></strong> ☆☆☆
That interpreter is called Monkey in the book.
The Monkey is written in Go in the book, but in this repository it is written in Zig.
Using Zig Version
Zig: v0.13.0
Supports
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Lexer
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Parser
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Evaluator
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> REPL
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Test case
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Macro
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Compiler
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> VM
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Linux
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Mac
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Windows
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Multibyte character
🐒 Example
REPL
```sh
$ zig build run
<blockquote>
<blockquote>
let a = 5
null
a
5
a + 10
15
let add = fn(x, y) { x + y }
null
add(10, 20)
30
let closure = fn(x) { a + x }
null
closure(10)
15
let new_closure = fn(a) { fn() { a; }; };
null
let closure = new_closure(99);
null
closure();
99
```
</blockquote>
</blockquote>
Fibonacchi
<code>monkey
let fibonacci = fn(x) {
if (x == 0) {
return 0;
} else {
if (x == 1) {
return 1;
} else {
fibonacci(x - 1) + fibonacci(x - 2);
}
}
};
fibonacci(15); #=> 610</code>
Run tests
<code>sh
$ zig build test --summary all</code>
Contributors
<ul>
<li><a>ktanaka101</a> - creator, maintainer</li>
</ul>
License
MIT | []
|
https://avatars.githubusercontent.com/u/12878831?v=4 | zingle-header | Deecellar/zingle-header | 2022-02-24T03:03:27Z | Adding single header files in zig programs | master | 0 | 10 | 0 | 10 | https://api.github.com/repos/Deecellar/zingle-header/tags | MIT | [
"interop",
"single-header",
"zig"
]
| 78 | false | 2024-01-31T00:12:00Z | true | false | unknown | github | []
| zingle-header
Simple Step for adding single source files
Just add the the file zingle_header.zig to your build file and add it either as a step or use the helper function
example in build.zig =)
License
This MIT and you can use it, is a dumb implementation mostly based on ZTT code | []
|
https://avatars.githubusercontent.com/u/25405?v=4 | zdoc | x1ddos/zdoc | 2022-08-03T21:52:29Z | zig docs on command line | master | 0 | 10 | 1 | 10 | https://api.github.com/repos/x1ddos/zdoc/tags | MIT | [
"command-line-tool",
"zig"
]
| 340 | false | 2024-05-29T09:13:53Z | true | false | unknown | github | []
| <a>zig</a> docs on command line.
usage:
<code>zdoc [-s] <source> [identifier]
</code>
the program searches source code for matching public identifiers,
printing found types and their doc comments to stdout.
the search is case-insensitive and non-exhaustive. no semantic
analysis is run.
if -s option is specified, any identifier substring matches.
as a side effect, the -s with no identifier arg results in
printing out only top level doc comments.
for example, look up "hello" identifier in a project file:
<code>zdoc ./src/main.zig hello
</code>
search across all .zig files starting from the src directory,
recursively and following symlinks:
<code>zdoc ./src hello
</code>
if the source starts with <code>std.</code>, the dot delimiters are replaced
with filesystem path separator and "std." with the <code>std_dir</code> value
from <code>zig env</code> command output.
for example, look up format function in std lib:
<code>zdoc std.fmt format
</code>
list all expectXxx functions from the testing module:
<code>zdoc -s std.testing expect
</code>
as a special case, if the source is exactly <code>std</code> and no such file
or directory exists, zdoc searches across the whole zig std lib.
zdoc outputs results in a basic colored format unless <code>NO_COLOR</code>
env variable is set or <code>--nocolor</code> flag is seen on command line.
supported versions
zdoc <code>master</code> branch requires zig v0.11. however, zdoc can be built with zig v0.10
from the <code>0.10</code> branch.
contributing
to contribute, create a pull request or send a patch with
<a>git send-mail</a> to alex-dot-cloudware.io.
before sending a change, please make sure tests pass:
<code>zig build test
</code>
and all code is formatted:
<code>zig fmt --check .
</code>
license
same as zig license. | []
|
https://avatars.githubusercontent.com/u/107726195?v=4 | zig-switch | zig-homebrew/zig-switch | 2022-06-18T17:33:36Z | Starter pack for developing Switch games/applications with Zig | master | 0 | 10 | 1 | 10 | https://api.github.com/repos/zig-homebrew/zig-switch/tags | - | [
"devkitpro",
"switch",
"zig"
]
| 5 | false | 2025-03-06T02:55:27Z | true | false | unknown | github | []
| zig-switch
Getting started
<ul>
<li><a>zig</a></li>
<li><a>devkitPro</a></li>
</ul>
<code>pacman -S switch-dev
git clone https://github.com/zig-homebrew/zig-switch
cd zig-switch/
zig build # then run zig-out/zig-switch.nro with ryujinx</code>
Resources
<ul>
<li><a>switch-examples</a></li>
<li><a>libnx repository</a></li>
<li><a>libgba documentation</a></li>
</ul> | []
|
https://avatars.githubusercontent.com/u/5640649?v=4 | zig-spirv-test-executor | Snektron/zig-spirv-test-executor | 2022-11-24T21:26:22Z | Zig SPIR-V testing utility | main | 1 | 10 | 2 | 10 | https://api.github.com/repos/Snektron/zig-spirv-test-executor/tags | - | [
"opencl",
"spirv",
"zig"
]
| 114 | false | 2025-05-15T04:30:43Z | true | true | unknown | github | [
{
"commit": "edde6cc92611ca526ce652d81b1688cb03c084bb.tar.gz",
"name": "opencl",
"tar_url": "https://github.com/Snektron/opencl-zig/archive/edde6cc92611ca526ce652d81b1688cb03c084bb.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/Snektron/opencl-zig"
},
{
"commit": "604416bf44baf95568c428e1aa55499aa8e07607.tar.gz",
"name": "vulkan_zig",
"tar_url": "https://github.com/Snektron/vulkan-zig/archive/604416bf44baf95568c428e1aa55499aa8e07607.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/Snektron/vulkan-zig"
},
{
"commit": "v1.4.309.tar.gz",
"name": "vulkan_headers",
"tar_url": "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.4.309.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/KhronosGroup/Vulkan-Headers"
}
]
| Zig SPIR-V Test Executor
This is a program to run Zig tests for the SPIR-V target. This is currently mainly used for the compiler behavior tests, and only supports the OpenCL environment. A SPIR-V-capable OpenCL implementation is required, such as Rusticl, POCL, or Intels
Building
In order to build the executor, we need a few system dependencies:
- The <a>OpenCL Headers</a>
- An OpenCL implementation. Its usually the best to link against an ICD loader so that the actual backend that is used may be swapped out at runtime, such as the <a>Khronos OpenCL ICD Loader</a>.
- <a>SPIRV-Tools</a> is required for extra validation of the module.
After obtaining these dependencies, simply run <code>zig build</code> to build the project.
Running tests
To actually run tests, use something like the following:
<code>$ zig test src/test_kernel.zig \
--test-runner src/test_runner.zig \
-target spirv64-opencl-gnu \
-mcpu generic+Int64+Int16+Int8+Float64+Float16 \
-fno-llvm \
--test-cmd zig-out/bin/zig-spirv-test-executor \
--test-cmd --platform \
--test-cmd Intel \
--test-cmd-bin</code>
Flake
The devshell in <code>flake.nix</code> sets up an environment with a bunch of OpenCL capable drivers, such as a slim debug build of recent Mesa, Intel's CPU OpenCL runtime, and POCL 5.0. | []
|
https://avatars.githubusercontent.com/u/22438427?v=4 | recblock | bernardassan/recblock | 2022-03-19T22:34:41Z | Blockchain for a record management and money transfer system | master | 1 | 9 | 2 | 9 | https://api.github.com/repos/bernardassan/recblock/tags | BSD-3-Clause | [
"blockchain",
"blockchain-from-scratch",
"crypto",
"cryptography",
"zig"
]
| 302 | false | 2025-04-15T13:34:53Z | true | true | 0.15.0-dev.151+6e8493daa | github | [
{
"commit": "76d7aea86c1d05afaddab9a1081b6dad68088756.tar.gz",
"name": "s2s",
"tar_url": "https://github.com/Ultra-Code/s2s/archive/76d7aea86c1d05afaddab9a1081b6dad68088756.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/Ultra-Code/s2s"
},
{
"commit": "refs",
"name": "lmdb",
"tar_url": "https://github.com/allyourcodebase/lmdb/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/allyourcodebase/lmdb"
}
]
| recblock
Blockchain for a record management and money transfer system
Build package native
<code>zsh
$ zig build</code>
Build for windows on linux
<code>zsh
$ zig build -Dtarget=-Dtarget=x86_64-windows-gnu</code>
Build for linux static
<code>zsh
$ zig build -Dtarget=x86_64-linux-musl</code>
Build in release mode
<code>zsh
$ zig build -Drelease-fast</code>
HOW TO USE PROGRAM
create a wallet
```zsh
$ zig build run -- createwallet
.eg. to create two new wallets
Assan's wallet
$ zig-dev build run -- createwallet
Your new address is 'AY0IZ21T7XFFEPwoiVxAbnYMxuZNshdRzg'
Gaddy's wallet
$ zig-dev build run -- createwallet
Your new address is 'AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ'
```
create a chain
```zsh
create a blockchain at Gaddy's wallet
$ zig-dev build run -- createchain AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ
.eg output
$ zig-dev build run -- createchain AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ
info: new blockchain is create with address 'AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ'
hash of the created blockchain is '0031D180D286BD75D0BD543AD391E071A36A32157C2D11D9629B9B7EA5B5349C'
info: You get a reward of RBC 10 for mining the coinbase transaction
```
get balance
```zsh
$ zig-dev build run -- getbalance AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ
get Gaddy's balance
$ zig-dev build run -- getbalance AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ
'AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ' has a balance of RBC 10
get Assan's balance
$ zig-dev build run -- getbalance AY0IZ21T7XFFEPwoiVxAbnYMxuZNshdRzg
'AY0IZ21T7XFFEPwoiVxAbnYMxuZNshdRzg' has a balance of RBC 0
```
send RBC to another Address
```zsh
$ zig-dev build run -- send --amount 7 --from AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ --to AY0IZ21T7XFFEPwoiVxAbnYMxuZNshdRzg
send RBC 7 from Gaddy's wallet to Assan's wallet
$ zig-dev build run -- send --amount 7 --from AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ --to AY0IZ21T7XFFEPwoiVxAbnYMxuZNshdRzg
info: new transaction is '000AFBA4B03A90EDDF3B4534176714E39981F86AD8CAF5C773D48DE520F164B8'
done sending RBC 7 from 'AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ' to 'AY0IZ21T7XFFEPwoiVxAbnYMxuZNshdRzg'
'AZqc8JTbSu1xMQQD2TcVRZnj5oji5oIOLQ' now has a balance of 3 and 'AY0IZ21T7XFFEPwoiVxAbnYMxuZNshdRzg' a balance of 7
```
print the blockchain ledger after performing some transactions
```zsh
$ zig build run -- printchain
eg
$ zig build run -- printchain
info: starting blockchain iteration
info: previous hash is '00DAEC993931264A1125D31C7350DD8CEB5324AD66395BC3275B37AB11890623'
info: hash of current block is '00F37D69BA313642C046202009326F3B6C7DC264A14349642A227CFB542908D3'
info: nonce is 42
info: POW: true
info: previous hash is '005DD84136F0389689A89700347D0385396B7DED10A52178F2A932FE68CAC2FE'
info: hash of current block is '00DAEC993931264A1125D31C7350DD8CEB5324AD66395BC3275B37AB11890623'
info: nonce is 660
info: POW: true
info: previous hash is '000AFBA4B03A90EDDF3B4534176714E39981F86AD8CAF5C773D48DE520F164B8'
info: hash of current block is '005DD84136F0389689A89700347D0385396B7DED10A52178F2A932FE68CAC2FE'
info: nonce is 539
info: POW: true
info: previous hash is '0031D180D286BD75D0BD543AD391E071A36A32157C2D11D9629B9B7EA5B5349C'
info: hash of current block is '000AFBA4B03A90EDDF3B4534176714E39981F86AD8CAF5C773D48DE520F164B8'
info: nonce is 29
info: POW: true
info: previous hash is '0000000000000000000000000000000000000000000000000000000000000000'
info: hash of current block is '0031D180D286BD75D0BD543AD391E071A36A32157C2D11D9629B9B7EA5B5349C'
info: nonce is 387
info: POW: true
info: done
```
print the list of valid addresses for transactions
```zsh
$ zig build run -- listaddress
info: address 0
Acj4k6QpclfGwTB625MOUnS_0ob7B6xumg
info: address 1
ATM0mGFtqU0lsUafDFKgBSWARA6bBrPClA
info: address 2
AT_YZ3gWStL1bVZtFVbd4pkxjcqul9gX3g
```
👏 Credit
<strong>A lot of inspiration and learning came from <em><a>jeiwan.net/</a></em></strong> | []
|
https://avatars.githubusercontent.com/u/121678877?v=4 | zig-gtk4 | paveloom-z/zig-gtk4 | 2023-01-19T15:48:55Z | Zig bindings for the `gtk4` library | main | 0 | 9 | 1 | 9 | https://api.github.com/repos/paveloom-z/zig-gtk4/tags | MIT | [
"gtk4",
"zig"
]
| 13 | false | 2025-05-16T05:12:11Z | true | false | unknown | github | []
| Notices
Mirrors
Repository:
- <a>Codeberg</a>
- <a>GitHub</a>
- <a>GitLab</a>
Prerequisites
Make sure you have installed:
<ul>
<li>A development library for <code>gtk4</code></li>
<li><a>Zig</a> (<code>v0.10.1</code>)</li>
</ul>
Build
To build and install the library, run <code>zig build install</code>.
To run unit tests, run <code>zig build test</code>.
See <code>zig build --help</code> for more build options, including how to run examples.
Integrate
To integrate the bindings into your project:
1) Add this repository as a dependency in <code>zigmod.yml</code>:
<code>```yml
# <...>
root_dependencies:
- src: git https://github.com/paveloom-z/zig-gtk4
```
</code>
2) Make sure you have added the dependencies in your build script:
<code>```zig
// <...>
const deps = @import("deps.zig");
const gtk4_pkg = deps.pkgs.gtk4.pkg.?;
// <...>
pub fn build(b: *std.build.Builder) !void {
// <...>
// For each step
inline for (steps) |step| {
// Add the library package
step.addPackage(gtk4_pkg);
// Link the libraries
step.linkLibC();
step.linkSystemLibrary("gtk4");
// Use the `stage1` compiler
step.use_stage1 = true;
}
// <...>
}
```
</code> | []
|
https://avatars.githubusercontent.com/u/4337696?v=4 | wave | nikneym/wave | 2023-01-19T08:54:19Z | Tiny WAV encoder/decoder for Zig ⚡ | main | 1 | 9 | 0 | 9 | https://api.github.com/repos/nikneym/wave/tags | MIT | [
"decode",
"encode",
"wav",
"wave",
"zig",
"ziglang"
]
| 5 | false | 2025-01-23T11:15:58Z | true | false | unknown | github | []
| 404 | [
"https://github.com/allyourcodebase/boost-libraries-zig"
]
|
https://avatars.githubusercontent.com/u/124872?v=4 | zig-ecdsa | jedisct1/zig-ecdsa | 2022-06-01T10:09:55Z | ECDSA signatures for Zig. | master | 0 | 8 | 1 | 8 | https://api.github.com/repos/jedisct1/zig-ecdsa/tags | - | [
"zig",
"ziglang"
]
| 33 | false | 2022-06-11T21:47:01Z | true | false | unknown | github | []
| 404 | []
|
https://avatars.githubusercontent.com/u/63465728?v=4 | jigar | alichraghi/jigar | 2022-08-04T17:30:46Z | Case convertion library for ziguanas | master | 1 | 8 | 1 | 8 | https://api.github.com/repos/alichraghi/jigar/tags | MIT | [
"case-conversion",
"zig",
"zig-package"
]
| 50 | false | 2023-09-30T11:26:03Z | true | false | unknown | github | []
| Jigar
case convertion library for ziguanas
supports: <code>lower case</code>, <code>UPPER CASE</code>, <code>MACRO_CASE</code>, <code>TRAIN-CASE</code>, <code>snake_case</code>, <code>snake_Camel</code>, <code>Snake_Pascal</code>, <code>kebab-case</code>, <code>Kebab-Pascal</code>, <code>camelCase</code> and <code>PascalCase</code>
Usage
```zig
const jigar = @import("jigar");
pub fn main() void {
var my_hello = "Hello World".*;
jigar.snakeCase(&my_hello); // results: hello_world
}
``` | []
|
https://avatars.githubusercontent.com/u/40190339?v=4 | zig-wefx | daneelsan/zig-wefx | 2022-05-03T01:56:32Z | WEFX is a simple graphics drawing package using Zig, WASM, and an HTML canvas. | master | 0 | 8 | 1 | 8 | https://api.github.com/repos/daneelsan/zig-wefx/tags | - | [
"gfx",
"html5-canvas",
"javascript",
"wasm",
"zig"
]
| 693 | false | 2025-03-08T02:59:24Z | true | false | unknown | github | []
| WEFX
WEFX is a simple graphics drawing package using Zig, WASM, and an HTML canvas.
See it live at: https://daneelsan.github.io/zig-wefx/
This is a port of the original implementation written in C found in https://github.com/robrohan/wefx.
The library aims to serve a similar purpose to <a>gfx</a>, in that it is simple and easy to learn. However, instead of having a <a>X11</a> backend like the gfx library has, WEFX is meant to be compiled into a WASM module where the backend will be both Javascript and HTML5 canvas.
API
The WEFX package can be found in the <a>wefx/WEFX.zig</a> file.
WEFX.zig defines a struct with the following fields:
| Field | Description |
| ------------------------------ | ----------------------------------------------------------------------------- |
| <code>allocator: std.mem.Allocator</code> | allocates memory for the screen and buffer |
| <code>width: u32</code> | the maximum value of the x coordinate |
| <code>height: u32</code> | the maximum value of the y coordinate |
| <code>foreground_color: u32</code> | the color used when drawing points, lines, etc. |
| <code>background_color: u32</code> | the color used when clearing the screen |
| <code>buffer: []u32</code> | a slice of pixels which will be modified when drawing points, lines, etc. |
| <code>screen: []u32</code> | a slice of pixels which will be filled from the buffer when flush() is called |
And the following methods:
| Method | Description | GFX |
| ------ | ----------- | ----|
| <code>wefx.open(width: u32, height: u32)</code> | allocates memory for both the screen and buffer slices | <code>wefx_open(width, height, title)</code> |
| <code>wefx.clearColor(r: u8, g: u8, b: u8)</code> | change the current background color | <code>wefx_clear_color(r, g, b)</code> |
| <code>wefx.clear()</code> | clear the graphics screen to the background color | <code>wefx_clear()</code> |
| <code>wefx.color(r: u8, g: u8, b: u8)</code> | change the current drawing (foreground) color | <code>wefx_color(r, g, b)</code> |
| <code>wefx.point(x: u32, y: u32)</code> | draw a point at (x,y) | <code>wefx_point(x, y)</code> |
| <code>wefx.line(x1: u32, y1: u32, x2: u32, y2: u32)</code> | draw a line from (x1,y1) to (x2,y2) | <code>wefx_line(x1, y1, x2, y2)</code> |
| <code>wefx.circle(x: u32, y: u32, r: u32)</code> | draw a circle centered in (x,y) with radius r | |
| <code>wefx.flush()</code> | flush all previous output to the screen | <code>wefx_flush()</code> |
WEFX.zig also exports some functions/symbols that are meant to be used in the JS side:
| Export | Description |
| ------ | ----------- |
| <code>wefx_xsize(wefx: *WEFX)</code> | returns the width of the screen |
| <code>wefx_ysize(wefx: *WEFX)</code> | returns the height of the screen |
| <code>wefx_screen_offset(wefx: *WEFX)</code> | returns the pointer to the screen slice (an offset in the WASM memory) |
| <code>wefx_flush(wefx: *WEFX)</code> | calls wefx.flush() to fill the pixels in the screen |
Writing an App
To write an app, the user will have to define two callbacks in a .zig file:
| Callback | Description |
| ------ | ----------- |
| <code>export fn init() ?*WEFX</code> | called once at the start of the app (should return a pointer to a WEFX instance) |
| <code>export fn main_loop(time: f32) void</code> | called every frame with time being time since app start |
These callbacks will be called from the <a>script.js</a> file.
Build
The latest `zig`` version this project has been built in is:
<code>shell
$ zig version
0.14.0</code>
There are some examples in the examples/ directory.
The <a>build.zig</a> file by default builds the example1.zig file:
<code>shell
$ zig build --verbose</code>
The output binary is called <code>wefx-example.wasm</code> and is stored in the <code>zig-out/lib/</code> directory:
<code>shell
$ ls zig-out/bin/*.wasm
zig-out/bin/wefx-example.wasm</code>
Finally, copy it into the <code>docs/</code> directory so that the <code>script.js</code> file can load it:
<code>shell
$ cp zig-out/bin/wefx-example.wasm docs/wefx-example.wasm</code>
The user can simply modify the contents of the <a>example1.zig</a> file, or write a new file and modify the build.zig file to build it.
TODO
The WEFX package should also handle events, i.e. mouse clicks and keyboard presses.
Resources
<ul>
<li>https://github.com/robrohan/wefx</li>
<li>https://www3.nd.edu/~dthain/courses/cse20211/fall2013/gfx/</li>
</ul> | []
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.