Git Product home page Git Product logo

felbind's Introduction

FelBind

MIT License Ko-Fi

A binding assistant and generator for C(and maybe C++ later?) 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
  • Struct values are read or written to by using the snake_case version of their respective members
    • my_struct_object.value_example
    • my_struct_object.value_example = 5
  • Functions beginning with Set get bound as a method with =
    • SetSomeFunction(value) => Test.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 into objects
  • Giving struct objects initializers and accessers

What Doesn't Work:

  • Binding accessors for structs that contain structs or pointers
  • Cloning struct objects
  • The config system
  • Struct Aliases(might make this manually done in the config system)

What isnt currently planned to make work:

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

felbind's People

Contributors

realtradam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.