summaryrefslogtreecommitdiffhomepage
path: root/Readme.mdown
blob: 8ca731bf8188481e3b07d2d6b9bcc2cfe5105223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
![FelBind](https://github.com/realtradam/FelBind/blob/master/logos/felbind-logo-text.png?raw=true)

[![MIT License](https://img.shields.io/github/license/realtradam/felbind?style=flat)](https://github.com/realtradam/FelBind/blob/master/LICENSE)
[![Ko-Fi](https://img.shields.io/static/v1?message=Buy%20me%20a%20coffee&logo=kofi&labelColor=ff5e5b&color=434B57&logoColor=white&label=%20)](https://ko-fi.com/tradam)


A binding assistant and generator for C/C++ to mruby(Under heavy WIP)

---

### How I plan for it to work:

1. Run the scanner which will generate a func.json file. This json file will contain all functions(and their params) as well as all structs(and their params)
2. Create a configuration file where you can reference specific functions and how you want their bindings to be generated differently
	- for example, under what module or class a function should belong
	- if a certain param should use self instead of passing in something
	- ignore some functions if you dont need them
	- insert bindings you made yourself
3. Run the generator with the configuration file - this generates the resulting binding code

### Opinionated Bindings

The defaults of FelBind make some assumptions on how you would like the resulting interface to look like.

- Functions get bound to methods using snake_case and kwargs
	- `SomeFunction(someValue)` => `some_function(some_value: thing)`
- Functions are defined under a module(by default `Test`)
	- `Test.some_function`
- Structs are defined as classes under a module(by default `Test`)
	- `Test::MyStruct`
- Functions beginning with `Set` get bound as a method with `=`
	- `SetSomeFunction(value)` => `some_function = value`
- Functions beginning with `Get` get bound as a method without it
	- `GetSomeFunction()` => `some_function`

### What Currently Works:

- Wrapping functions that return or have parameters that are of the basic C types(int, float, char \*, etc) or their pointers(int \*, float \*, etc[except char *])
- Wrapping function that return or have parameters that are structs or their pointers
- Wrapping structs
- Giving struct objects initializers and accessers

### What Doesn't Work:

- Binding C functions that begin with `Set` are bound incorrectly
- Making accessors for structs that contain structs
- kwargs should follow snake_case naming conventions
- The config system
- Struct Aliases(might make this manually done)

### What isnt currently planned to make work:

- Functions that utilize the `* void` type
- Nested Pointers
- Functions with variable arguments