README for the people
This commit is contained in:
88
README.md
Normal file
88
README.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# Building my own castle
|
||||
|
||||
I'm building my own castle in Zig ⚡.
|
||||
|
||||
This is a collection of experimental, recreational or actually useful libraries,
|
||||
which I may or may not use as a part of some other projects. Most of them are
|
||||
work in progress and might remain so indefinitely.
|
||||
|
||||
## cjit
|
||||
|
||||
JIT compiler for the C language inspired by Fabrice Bellard's Tiny C Compiler
|
||||
(TCC). Meant to compile x86_64 and aarch64 for Windows and Linux straight to
|
||||
virtual memory, without the ability to output an executable file or library. C
|
||||
standard library is not fully supported, only some includes and builtins (see
|
||||
[src/includes](packages/cjit/src/includes)).
|
||||
|
||||
It's in very early stage and cannot be used as of now. Currently, parts of the
|
||||
tokenizer, x86_64 emit code and relocation logic are implemented. Aarch64 would
|
||||
come after x86_64 is fully implemented and actually works.
|
||||
|
||||
You can see an example of how this library is supposed to be used in
|
||||
[test/root.zig](packages/cjit/test/root.zig).
|
||||
|
||||
## js
|
||||
|
||||
Zig bindings for Fabrice Bellard's QuickJS. Original C sources are included and
|
||||
compiled with Zig's build system. The bindings are not complete, but usable.
|
||||
|
||||
## media
|
||||
|
||||
Set of utilities for decoding and encoding media files. As of now, no purely Zig
|
||||
decoder/encoder exists, which would be the goal. There is fairly comprehensive
|
||||
PNG chunk decoder, though.
|
||||
|
||||
Bindings for stb_image.h from Sean T. Barrett's single-file C libraries are
|
||||
included. They can be used to decode PNG, JPEG and HDR images and support Zig's
|
||||
allocator interface in a thread-safe manner.
|
||||
|
||||
This package is actually used by my other project, codenamed
|
||||
[voxel-game](/:root/renati/voxel-game).
|
||||
|
||||
## myid
|
||||
|
||||
Remnants of a project meant to provide a simpler alternative to OpenID Connect
|
||||
(OIDC). It contains an HTTP server, which has since been improved and resides
|
||||
in *web* package.
|
||||
|
||||
The ideas behind *myid* were developed further in another project I created
|
||||
using TypeScript and Bun as a runtime. I might backport them back to Zig when I
|
||||
find the time and motivation, which would be implemented on top of the HTTP
|
||||
server from the *web* package.
|
||||
|
||||
## vecmath
|
||||
|
||||
Vector math library with support for vectors, matrices and ×8 SIMD operations
|
||||
(utilizing SOA layout).
|
||||
|
||||
This package is actually used by my other project, codenamed
|
||||
[voxel-game](/:root/renati/voxel-game) and is probably the most complete package
|
||||
in this repository.
|
||||
|
||||
## web
|
||||
|
||||
An HTTP server library and collection of other utilities commonly associated
|
||||
with web technologies.
|
||||
|
||||
The HTTP server implements HTTP version 1.1 using worker threads and supports
|
||||
SSL via OpenSSL library. The server is very low level and does not provide any
|
||||
logic to handle proper HTTP semantics. It is up to the user of the HTTP server
|
||||
library to respect (or not) all HTTP methods and headers. The server is designed
|
||||
or Linux only and uses Linux syscalls directly in its implementation.
|
||||
|
||||
The other utilities include:
|
||||
|
||||
- HTTP/1.1 request parser, which is part of the HTTP server, but can be used
|
||||
independently,
|
||||
- OpenSSL bindings, which are used by the HTTP server, but can be used
|
||||
independently (full mechanical C translation is provided and partial manual
|
||||
Zig translation),
|
||||
- UUID type and generators for v4, v5 and v7,
|
||||
- Generic ID type, a wrapper around UUID (or anything that is 16 bytes long)
|
||||
that can be instantiated for each distinct use of ID with a tag to help avoid
|
||||
type confusion at compile time.
|
||||
|
||||
## x11
|
||||
|
||||
Zig bindings for Xlib (aka libX11), a C library implementing a client of the X
|
||||
Window System protocol. The bindings are not complete.
|
||||
@@ -195,7 +195,7 @@ const import = struct {
|
||||
no_add: bool = false,
|
||||
/// Internal use.
|
||||
no_exotic: bool = false,
|
||||
_pad14: u18 = 0,
|
||||
_pad18: u14 = 0,
|
||||
};
|
||||
|
||||
pub const JS_EVAL = packed struct(u32) {
|
||||
@@ -1168,7 +1168,7 @@ pub const Value = extern struct {
|
||||
}
|
||||
|
||||
pub fn getClassId(self: Value) ClassId {
|
||||
return .{ .class_id = import.JS_GetClassID(self) };
|
||||
return .{ .class_id = import.JS_GetClassID(self.value) };
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1182,7 +1182,7 @@ pub const ClassId = extern struct {
|
||||
pub const invalid: ClassId = .{ .class_id = 0 };
|
||||
|
||||
pub fn new() ClassId {
|
||||
var class_id: import.JSClassId = 0;
|
||||
var class_id: import.JSClassID = 0;
|
||||
return .{ .class_id = import.JS_NewClassID(&class_id) };
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user