Skip to content

Commit 005ecd0

Browse files
authored
Merge pull request #67 from sue445/ruby_h2go
Move to _tools/ruby_h2go/
2 parents 468909a + 05ac1a6 commit 005ecd0

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@
2020
# Go workspace file
2121
go.work
2222
go.work.sum
23-
24-
dist/

CONTRIBUTING.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ To avoid this problem, we need to call the C function without variable-length ar
1010
See `RbRaise` implementation in [ruby-internal-error.go](ruby-internal-error.go) for details
1111

1212
### 1. Generate skeleton
13-
Run `ruby _scripts/dump_ruby_c_functions.rb`
13+
Run `ruby _tools/ruby_h2go/ruby_h2go.rb`
1414

15-
Executing [`ruby _scripts/dump_ruby_c_functions.rb`](./_scripts/dump_ruby_c_functions.rb) will generate Go source code under `_scripts/dist/` based on `ruby.h`
16-
17-
In many cases there is an error on the last `go fmt`, but it's not a problem :sweat_smile:
15+
See [_tools/ruby_h2go/](_tools/ruby_h2go/)
1816

1917
### 2. Move function to top directory
2018
Modify some of the auto-generated functions and add them to the ruby package in the top directory

_scripts/dist/.keep

Whitespace-only changes.

_tools/ruby_h2go/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

_tools/ruby_h2go/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ruby_h2go
2+
Convert Ruby C function definition in `ruby.h` to Go source and dump to `dist/`.
3+
4+
## Requirements
5+
* Ruby
6+
* Go
7+
* ctags
8+
* NOTE: `universal-ctags` is required when macOS
9+
* c.f. https://formulae.brew.sh/formula/universal-ctags
10+
11+
## Usage
12+
```bash
13+
ruby ruby_h2go.rb -H path/to/ruby/header/dir
14+
```
15+
16+
* `-H` : path to ruby header dir. (default: `RbConfig::CONFIG["rubyhdrdir"]`)
17+
18+
In many cases there is an error on the last `go fmt`, but it's not a problem :sweat_smile:

_scripts/dump_ruby_c_functions.rb renamed to _tools/ruby_h2go/ruby_h2go.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# Convert Ruby C function definition to Go source and dump to dist/
22
#
33
# Usage:
4-
# dump_ruby_c_functions.rb -H path/to/ruby/header/dir
5-
#
6-
# Requirements
7-
# * Go
8-
# * ctags
9-
# * NOTE: `universal-ctags` is required when MacOS
10-
# * c.f. https://formulae.brew.sh/formula/universal-ctags
4+
# ruby_h2go.rb -H path/to/ruby/header/dir
115

126
require "optparse"
137
require "fileutils"

0 commit comments

Comments
 (0)