-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb0b0da
commit e8c2bdb
Showing
19 changed files
with
305 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
.{ | ||
.name = "flatbuffers", | ||
.version = "0.0.2", | ||
.version = "0.0.3", | ||
.dependencies = .{ | ||
.clap = .{ | ||
.url = "https://github.com/Hejsil/zig-clap/archive/f49b94700e0761b7514abdca0e4f0e7f3f938a93.tar.gz", | ||
.hash = "1220f48518ce22882e102255ed3bcdb7aeeb4891f50b2cdd3bd74b5b2e24d3149ba2" | ||
}, | ||
.flatbuffers = .{ | ||
.url = "https://github.com/clickingbuttons/flatbuffers/archive/refs/tags/0.0.3.tar.gz", | ||
.hash = "122049e1449018ff433beb3e5ee6107d081e561a93744b9ee59bd485acf23beb6f61" | ||
.url = "https://github.com/clickingbuttons/flatbuffers/archive/refs/tags/0.0.4.tar.gz", | ||
.hash = "122094e2b1ae9ef4b8bc50ecde2ee886aab1d4bf2e8b648927b53b48f7810b60e243" | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,30 @@ | ||
const std = @import("std"); | ||
const Builder = @import("flatbuffers").Builder; | ||
const example_footer = @import("../arrow/test.zig").example_footer; | ||
const samples = @import("../arrow/test.zig"); | ||
|
||
const testing = std.testing; | ||
|
||
extern fn verifySchema(buf: [*]c_char, len: usize) bool; | ||
extern fn verifyMessage(buf: [*]c_char, len: usize) bool; | ||
extern fn verifyFooter(buf: [*]c_char, len: usize) bool; | ||
|
||
test "arrow cpp verifies flatbuffer" { | ||
fn verifyPack(comptime s: anytype, comptime verifier: anytype) !void { | ||
var builder = Builder.init(testing.allocator); | ||
const offset = try example_footer.pack(&builder); | ||
const offset = try s.pack(&builder); | ||
const bytes = try builder.finish(offset); | ||
defer testing.allocator.free(bytes); | ||
|
||
try std.testing.expectEqual(true, verifyFooter(@ptrCast(bytes.ptr), bytes.len)); | ||
try std.testing.expectEqual(true, verifier(@ptrCast(bytes.ptr), bytes.len)); | ||
} | ||
|
||
test "arrow cpp verifies schema flatbuffer" { | ||
try verifyPack(samples.example_schema, verifySchema); | ||
} | ||
|
||
test "arrow cpp verifies message flatbuffer" { | ||
try verifyPack(samples.example_message, verifyMessage); | ||
} | ||
|
||
test "arrow cpp verifies footer flatbuffer" { | ||
try verifyPack(samples.example_footer, verifyFooter); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! generated by flatc-zig from Schema.fbs | ||
|
||
const flatbuffers = @import("flatbuffers"); | ||
|
||
/// Logically the same as Binary, but the internal representation uses a view | ||
/// struct that contains the string length and either the string's entire data | ||
/// inline (for small strings) or an inlined prefix, an index of another buffer, | ||
/// and an offset pointing to a slice in that buffer (for non-small strings). | ||
/// | ||
/// Since it uses a variable number of data buffers, each Field with this type | ||
/// must have a corresponding entry in `variadicBufferCounts`. | ||
pub const BinaryView = struct { | ||
const Self = @This(); | ||
|
||
pub fn pack(self: Self, builder: *flatbuffers.Builder) flatbuffers.Error!u32 { | ||
_ = self; | ||
try builder.startTable(); | ||
return builder.endTable(); | ||
} | ||
}; | ||
|
||
/// Logically the same as Binary, but the internal representation uses a view | ||
/// struct that contains the string length and either the string's entire data | ||
/// inline (for small strings) or an inlined prefix, an index of another buffer, | ||
/// and an offset pointing to a slice in that buffer (for non-small strings). | ||
/// | ||
/// Since it uses a variable number of data buffers, each Field with this type | ||
/// must have a corresponding entry in `variadicBufferCounts`. | ||
pub const PackedBinaryView = struct {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//! generated by flatc-zig from Schema.fbs | ||
|
||
const flatbuffers = @import("flatbuffers"); | ||
|
||
/// Same as ListView, but with 64-bit offsets and sizes, allowing to represent | ||
/// extremely large data values. | ||
pub const LargeListView = struct { | ||
const Self = @This(); | ||
|
||
pub fn pack(self: Self, builder: *flatbuffers.Builder) flatbuffers.Error!u32 { | ||
_ = self; | ||
try builder.startTable(); | ||
return builder.endTable(); | ||
} | ||
}; | ||
|
||
/// Same as ListView, but with 64-bit offsets and sizes, allowing to represent | ||
/// extremely large data values. | ||
pub const PackedLargeListView = struct {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//! generated by flatc-zig from Schema.fbs | ||
|
||
const flatbuffers = @import("flatbuffers"); | ||
|
||
/// Represents the same logical types that List can, but contains offsets and | ||
/// sizes allowing for writes in any order and sharing of child values among | ||
/// list values. | ||
pub const ListView = struct { | ||
const Self = @This(); | ||
|
||
pub fn pack(self: Self, builder: *flatbuffers.Builder) flatbuffers.Error!u32 { | ||
_ = self; | ||
try builder.startTable(); | ||
return builder.endTable(); | ||
} | ||
}; | ||
|
||
/// Represents the same logical types that List can, but contains offsets and | ||
/// sizes allowing for writes in any order and sharing of child values among | ||
/// list values. | ||
pub const PackedListView = struct {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.