Skip to content

Commit ecf041d

Browse files
committed
Documentation updates.
1 parent 1e294d8 commit ecf041d

5 files changed

Lines changed: 12 additions & 13 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Wrapping C and C++ libraries by hand for use in Ruby has traditionally been a long, arduous task. For large, complex libraries it can take months. As a result, many C/C++ libraries are either never exposed to Ruby or their bindings quickly become outdated, especially in scientific and technical domains.
44

5-
`ruby-bindgen's` solves this problem by automatically creating bindings from C and C++ header files. It can even generate a CMake build system if needed. It has been battle tested against large C/C++ libraries such as Proj and OpenCv.
5+
`ruby-bindgen` solves this problem by automatically creating bindings from C and C++ header files. It can even generate a CMake build system if needed. It has been battle-tested against large C/C++ libraries such as Proj and OpenCV.
66

7-
For much more information read the extensive [documenation](https://ruby-rice.github.io/ruby-bindgen/).
7+
For much more information, read the extensive [documentation](https://ruby-rice.github.io/ruby-bindgen/).
88

99
## Quick Start
1010

docs/architecture.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ lib/ruby-bindgen/
9898
├── version.rb
9999
├── refinements/ # Extensions to ffi-clang classes
100100
│ ├── cursor.rb
101-
│ ├── source_range.rb
102101
│ ├── type.rb
103102
│ ├── string.rb
104103
└── generators/
@@ -119,15 +118,15 @@ Most generator methods delegate to ERB templates for code generation. Each templ
119118
For example, the Rice generator's `cxx_method.erb` template generates a `define_method` call:
120119

121120
```cpp
122-
define_method<<%= method_signature(cursor) %>("<%= cursor.ruby_name %>", &<%= cursor.qualified_name %>,
123-
<%= arguments(cursor) %>).
121+
define_method<%= signature %>("<%= name %>", &<%= qualified_parent %>::<%= cursor.spelling %>,
122+
<%= all_args.join(", ") %>)
124123
```
125124

126125
## Key Classes
127126

128127
### Config
129128

130-
The `Config` class loads the YAML configuration file and resolves platform-specific settings. It detects whether to use `clang:` or `clang-cl:` based on `RUBY_PLATFORM` (`mswin` and `mingw` use `clang-cl:`), resolves relative paths against the config file's directory, and provides hash-like access to all configuration values.
129+
The `Config` class loads the YAML configuration file and resolves platform-specific settings. It detects whether to use `clang:` or `clang-cl:` based on `RUBY_PLATFORM` (`mswin` uses `clang-cl:`; Linux, macOS, and MinGW use `clang:`), resolves relative paths against the config file's directory, and provides hash-like access to all configuration values.
131130

132131
### Inputter
133132

@@ -177,10 +176,9 @@ The `Namer` class converts C++ names to Ruby conventions:
177176

178177
`ruby-bindgen` extends ffi-clang's classes using Ruby refinements in `lib/ruby-bindgen/refinements/`:
179178

180-
- **Cursor** - adds `ruby_name`, `cruby_name`, `qualified_name`, and methods for finding children by kind
181-
- **Type** - adds `fully_qualified_spelling` for reconstructing C++ type names with proper namespace qualification and template arguments
179+
- **Cursor** - adds `ruby_name`, `cruby_name`, and `anonymous_definer`
180+
- **Type** - adds `fully_qualified_name` compatibility and helpers for reconstructing C++ type names with proper namespace qualification and template arguments
182181
- **String** - adds `camelize` and `underscore` for name conversion
183-
- **SourceRange** - adds `text` for extracting source text from a range
184182

185183
## Rice Generator Details
186184

docs/contributing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Guidelines for changing `ruby-bindgen` and its generated-output tests.
1717
Run all tests before updating expected files:
1818

1919
```bash
20+
bundle exec ruby -Ilib -Itest test/ffi_test.rb
2021
bundle exec ruby -Ilib -Itest test/rice_test.rb
2122
bundle exec ruby -Ilib -Itest test/cmake_test.rb
2223
```

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Wrapping C and C++ libraries by hand is a long, arduous task. For large, complex libraries it can take months. As a result, many C/C++ libraries are either never exposed to Ruby or their bindings quickly become outdated, especially in scientific and technical domains.
44

5-
`ruby-bindgen` and its ecosystem solve this problem by automating binding generation. For simpler libraries, it can generate ready to use bindings. For more complex libraries, it can also generate bindings but some [customizations](#customization) may be needed.
5+
`ruby-bindgen` and its ecosystem solve this problem by automating binding generation. For simpler libraries, it can generate ready-to-use bindings. For more complex libraries, it can also generate bindings but some [customizations](#customization) may be needed.
66

7-
As an example, there are older, hand-crafted Ruby [bindings](https://github.com/ruby-opencv/ruby-opencv) for [OpenCV](https://opencv.org/). However, they are based on the C API which was subsequently remove by the OpenCV project. `ruby-bindgen` was used to create new OpenCv [bindings](https://github.com/cfis/opencv-ruby) based on the new C++ API. The bindings wrap over [1,000](https://cfis.github.io/opencv-ruby/) C++ classes and almost [10,000](https://cfis.github.io/opencv-ruby/) method calls. Imagine having to do that by hand!
7+
As an example, there are older, hand-crafted Ruby [bindings](https://github.com/ruby-opencv/ruby-opencv) for [OpenCV](https://opencv.org/). However, they are based on the C API which was subsequently removed by the OpenCV project. `ruby-bindgen` was used to create new OpenCV [bindings](https://github.com/cfis/opencv-ruby) based on the new C++ API. The bindings wrap over [1,000](https://cfis.github.io/opencv-ruby/) C++ classes and almost [10,000](https://cfis.github.io/opencv-ruby/) method calls. Imagine having to do that by hand!
88

99
## Ecosystem
1010
`ruby-bindgen` is part of the C/C++ to Ruby toolchain.

docs/type_spelling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ C++11 `using` declarations.
124124

125125
Concrete types and template instantiations.
126126

127-
- Start from `fully_qualified_spelling`
127+
- Start from `fully_qualified_name`
128128
- Optionally consult `canonical.spelling`
129129
- Only when it does not introduce implementation types
130130
- Qualify template arguments using `qualify_template_args`
@@ -189,7 +189,7 @@ The current design reflects these constraints deliberately.
189189

190190
- Qualified name helpers:
191191
`lib/ruby-bindgen/refinements/type.rb`
192-
(`fully_qualified_spelling`)
192+
(`fully_qualified_name`)
193193

194194
- Template argument qualification:
195195
`lib/ruby-bindgen/generators/rice/rice.rb`

0 commit comments

Comments
 (0)