gem-ext-zig_builder 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gem/ext/zig_builder/version.rb +1 -1
- data/lib/gem/ext/zig_builder.rb +25 -8
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d7466a233e3ca02ab9137d1754002e95deda5aa1f3f6916a4117fb2464856ec
|
4
|
+
data.tar.gz: b0d4ab1d2965d8a3a351abb0b88099c8f01f1c4e299446527fd8bff6fbd07894
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60edf309fae80f11c200e8b026a3ef99fac2969b1ca52c224b5f1708514eace16ea230018d5e016df1cfc53891d8ffa5ad2dad09f1c353d8a26a5364d88123d1
|
7
|
+
data.tar.gz: c53e1848aaee44c23e1611c444fec6a6367c56ef4adc506dd6f62076c1f9d198bde19ad8ad92102afcda79183a9822eaf15c6ac8f9ec74c1c47f8addc5945f72
|
data/lib/gem/ext/zig_builder.rb
CHANGED
@@ -17,26 +17,43 @@ require 'tmpdir'
|
|
17
17
|
# const target = b.standardTargetOptions(.{});
|
18
18
|
# const lib = b.addSharedLibrary(.{
|
19
19
|
# .name = "zigrb_example",
|
20
|
-
# .root_source_file = .
|
20
|
+
# .root_source_file = b.path("src/zigrb.zig"),
|
21
21
|
# .target = target,
|
22
22
|
# .optimize = optimize,
|
23
23
|
# });
|
24
|
-
# lib.linkSystemLibrary(std.
|
24
|
+
# lib.linkSystemLibrary(std.posix.getenv("RUBY_PC") orelse "ruby");
|
25
25
|
# lib.linkSystemLibrary("c");
|
26
26
|
# b.installArtifact(lib);
|
27
|
+
#
|
28
|
+
# const unit_tests = b.addTest(.{
|
29
|
+
# .root_source_file = b.path("src/zigrb.zig"),
|
30
|
+
# .target = target,
|
31
|
+
# .optimize = optimize,
|
32
|
+
# });
|
33
|
+
# unit_tests.linkSystemLibrary(std.posix.getenv("RUBY_PC") orelse "ruby");
|
34
|
+
# unit_tests.linkSystemLibrary("c");
|
35
|
+
# const run_unit_tests = b.addRunArtifact(unit_tests);
|
36
|
+
# const test_step = b.step("test", "Run unit tests");
|
37
|
+
# test_step.dependOn(&run_unit_tests.step);
|
27
38
|
# }
|
28
39
|
#
|
29
40
|
# A minimal zigrb.zig example:
|
30
41
|
#
|
31
42
|
# const std = @import("std");
|
32
43
|
# const ruby = @cImport(@cInclude("ruby/ruby.h"));
|
44
|
+
#
|
45
|
+
# // Export the extension init function:
|
33
46
|
# export fn Init_libzigrb_example() void {
|
34
47
|
# ruby.ruby_init();
|
35
48
|
# }
|
36
49
|
#
|
50
|
+
# // For development releases of ruby:
|
51
|
+
# const rubyABIVersion = if (@hasField(ruby, "RUBY_ABI_VERSION")) ruby.RUBY_ABI_VERSION else 0;
|
52
|
+
# export fn ruby_abi_version() ruby.VALUE { return rubyABIVersion; }
|
53
|
+
#
|
37
54
|
# An example of defining a ruby class and adding a zig method:
|
38
55
|
#
|
39
|
-
#
|
56
|
+
# const zig_rb_class: ruby.VALUE = ruby.rb_define_class("ZigExample", ruby.rb_cObject);
|
40
57
|
# _ = ruby.rb_define_method(zig_rb_class, "method_name", rb_example_method, 2);
|
41
58
|
#
|
42
59
|
# An example of a zig ruby method:
|
@@ -45,17 +62,17 @@ require 'tmpdir'
|
|
45
62
|
# var ap = @cVaStart();
|
46
63
|
# defer @cVaEnd(&ap);
|
47
64
|
# // first argument is `self` in ruby; discard it
|
48
|
-
#
|
65
|
+
# const self = @cVaArg(&ap, ruby.VALUE); _ = self;
|
49
66
|
# // additional arguments
|
50
|
-
#
|
51
|
-
#
|
67
|
+
# const _ = @cVaArg(&ap, ruby.VALUE);
|
68
|
+
# const _ = @cVaArg(&ap, ruby.VALUE);
|
52
69
|
# return ruby.QNil
|
53
70
|
# }
|
54
71
|
#
|
55
72
|
# An example of ruby zig type conversions:
|
56
73
|
#
|
57
|
-
#
|
58
|
-
#
|
74
|
+
# const m = ruby.NUM2INT(@cVaArg(&ap, ruby.VALUE));
|
75
|
+
# const n = ruby.NUM2INT(@cVaArg(&ap, ruby.VALUE));
|
59
76
|
# return ruby.INT2NUM(f(m, n));
|
60
77
|
#
|
61
78
|
class Gem::Ext::ZigBuilder < Gem::Ext::Builder
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-ext-zig_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank J. Cameron
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email:
|
@@ -28,7 +28,7 @@ metadata:
|
|
28
28
|
source_code_uri: https://gitlab.com/fjc/gem-ext-zig_builder
|
29
29
|
changelog_uri: https://gitlab.com/fjc/gem-ext-zig_builder
|
30
30
|
rubygems_mfa_required: 'true'
|
31
|
-
post_install_message:
|
31
|
+
post_install_message:
|
32
32
|
rdoc_options: []
|
33
33
|
require_paths:
|
34
34
|
- lib
|
@@ -43,8 +43,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
|
-
rubygems_version: 3.
|
47
|
-
signing_key:
|
46
|
+
rubygems_version: 3.3.15
|
47
|
+
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Gem extension builder for zig
|
50
50
|
test_files: []
|