Skip to content

broken/napi-wrapper-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Napi Wrapper Generator

This reads C++ header files, and generates the necessary C++ header and source files using node-addon-api to use them as native Node components.

This is regloss of my Node-Webkit-Cpp-Wrapper which does the same thing but for Nan.

I wish I didn't have to write this myself, but I cannot find anything else like it. T_T

Requirements

  • java (jdk)

  • node-webkit

  • nw-gyp

  • nan (v2+)

  • ant

  • antlr

  • create a shortlink to your files to convert. Example: ln -s ../sse/be/src resources

Dislaimer Section

  1. This is currently a work in progress to meet the needs for my current project. As such, it is unfinished and has no support.

  2. I wrote just enough to wrap the classes I needed. For one, that means it's written mostly like a script, and less like a well structured program. It also means this is by no means an exhaustive translation tool. However, it's simple enough that you should be able to plug the holes to fit your needs.

  3. I do not know antlr. I read just enough to build this grammar to work for me. After testing a true C grammar on my header files, I realized that any complete grammar would be overkill, and writing my own would be much easier when building the translation listeners.

  4. Please submit patches if you used/improved this. Or, let me know if you have run across a better tool, and I'll point to it from this doc.

For new projects

Create a main class that lists the files to process. See SoulSifterWrapperTool.java

Update the build.xml to point to your new tool file.

How to run

ant all

note: that I haven't taken the time to split this out for other projects.

Sample output

You can view the output of this program by checking out the _wrap.[h,cc] files in my SoulSifterE project.

Test grammar

ant -Dfile=file.h gui

About

A generator for reading C++ header files, and creating node-addon-api wrapper header and source files for them.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published