init
I will never get tired of vendoring dependencies. ha ha. It is possible I am insane. I had to do a lot of pruning to get these not to be ridiculous (especially the unicode data, which had nearly 1 million lines of... stuff).
This commit is contained in:
21
deps/GapBuffer/LICENSE
vendored
Normal file
21
deps/GapBuffer/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Rylee Alanza Lyman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
38
deps/GapBuffer/README.org
vendored
Normal file
38
deps/GapBuffer/README.org
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
* GapBuffer.zig
|
||||
|
||||
A gap buffer is like a =std.ArrayList=, except that rather than having one contiguous block of items, there are two, with a moveable “gap” between them. Although moving the gap requires a copy, insertions and deletions at either side of the gap become O(1) operations.
|
||||
|
||||
This repository implements managed, unmanaged and optionally aligned versions of =GapBuffer(T)=. The API is directly inspired by =std.ArrayList=. The main differences are “Before” and “After” versions of operations that operate or affect the gap—“Before” operations will add or remove elements before the gap. There are also convenience functions for translating a “logical” index into an offset, an element, or a pointer from the buffer,
|
||||
allowing the user to be largely agnostic about the location of the gap.
|
||||
|
||||
Also implemented is a “struct of arrays” transform of =GapBuffer(T)= where =T= is a struct or tagged union type, =MultiGapBuffer(T)=.
|
||||
|
||||
To add this package to your project, pick a commit hash =<hash>= and run this:
|
||||
|
||||
#+begin_src bash
|
||||
$ zig fetch --save https://github.com/ryleelyman/GapBuffer.zig/archive/<hash>.tar.gz
|
||||
#+end_src
|
||||
|
||||
Then in your =build.zig= you can add this:
|
||||
|
||||
#+begin_src zig
|
||||
const gap_buffer = b.dependency("gap_buffer", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
const gb = gap_buffer.module("gap_buffer");
|
||||
|
||||
// For whatever you're building; in this case let's assume it's called exe.
|
||||
exe.root_module.addImport("gap_buffer", gb);
|
||||
#+end_src
|
||||
|
||||
and in your source code:
|
||||
|
||||
#+begin_src zig
|
||||
// import
|
||||
const gb = @import("gap_buffer");
|
||||
|
||||
// and use it something like this...
|
||||
var buffer = gb.GapBuffer(u8).init(allocator);
|
||||
#+end_src
|
||||
|
20
deps/GapBuffer/build.zig
vendored
Normal file
20
deps/GapBuffer/build.zig
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
_ = b.addModule("gap_buffer", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/root.zig"),
|
||||
});
|
||||
|
||||
const tests = b.addTest(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/root.zig"),
|
||||
});
|
||||
const run_tests = b.addRunArtifact(tests);
|
||||
const tests_step = b.step("test", "run gap buffer tests");
|
||||
tests_step.dependOn(&run_tests.step);
|
||||
}
|
5
deps/GapBuffer/build.zig.zon
vendored
Normal file
5
deps/GapBuffer/build.zig.zon
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.{
|
||||
.name = "gap_buffer",
|
||||
.version = "0.1.0-alpha",
|
||||
.paths = .{ "build.zig", "build.zig.zon", "src" },
|
||||
}
|
3072
deps/GapBuffer/src/gap_buffer.zig
vendored
Normal file
3072
deps/GapBuffer/src/gap_buffer.zig
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1132
deps/GapBuffer/src/multi_gap_buffer.zig
vendored
Normal file
1132
deps/GapBuffer/src/multi_gap_buffer.zig
vendored
Normal file
File diff suppressed because it is too large
Load Diff
12
deps/GapBuffer/src/root.zig
vendored
Normal file
12
deps/GapBuffer/src/root.zig
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
const gb = @import("gap_buffer.zig");
|
||||
pub const GapBuffer = gb.GapBuffer;
|
||||
pub const GapBufferAligned = gb.GapBufferAligned;
|
||||
pub const GapBufferUnmanaged = gb.GapBufferUnmanaged;
|
||||
pub const GapBufferAlignedUnmanaged = gb.GapBufferAlignedUnmanaged;
|
||||
|
||||
const mgb = @import("multi_gap_buffer.zig");
|
||||
pub const MultiGapBuffer = mgb.MultiGapBuffer;
|
||||
|
||||
test "refAllDecls" {
|
||||
@import("std").testing.refAllDecls(@This());
|
||||
}
|
Reference in New Issue
Block a user