diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-03-11 14:54:37 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-03-11 14:54:37 -0500 |
| commit | 9fc0bb99b30487b73f6f6bcec843944a8d33665d (patch) | |
| tree | 349f0e163ab6e28821b3cc0a417df22ef0b7dd36 | |
| parent | fc1bc78250432059edd552679b3efbb0e99a302c (diff) | |
| parent | fcc1dde1239ca6c7c553a2252a93177d62cf18a1 (diff) | |
| download | nimterop-9fc0bb99b30487b73f6f6bcec843944a8d33665d.tar.gz nimterop-9fc0bb99b30487b73f6f6bcec843944a8d33665d.zip | |
Merge branch 'master' of https://github.com/genotrance/nimterop
| -rw-r--r-- | README.md | 13 | ||||
| -rw-r--r-- | nimterop/cimport.nim | 4 | ||||
| -rw-r--r-- | nimterop/types.nim | 2 |
3 files changed, 10 insertions, 9 deletions
@@ -1,7 +1,9 @@ -[](https://gitter.im/nimgen/Lobby) +[](https://gitter.im/nimterop/Lobby) [](https://ci.appveyor.com/project/genotrance/nimterop-8jcj7/branch/master) [](https://travis-ci.org/nimterop/nimterop) +Detailed documentation [here](https://nimterop.github.io/nimterop/theindex.html). + Nimterop is a [Nim](https://nim-lang.org/) package that aims to make C/C++ interop seamless Nim has one of the best FFI you can find - importing C/C++ is supported out of the box. All you need to provide is type and proc definitions for Nim to interop with C/C++ binaries. Generation of these wrappers is easy for simple libraries but quickly gets out of hand. [c2nim](https://github.com/nim-lang/c2nim) greatly helps here by parsing and converting C/C++ into Nim but is limited due to the complex and constantly evolving C/C++ grammar. [nimgen](https://github.com/genotrance/nimgen) mainly focuses on automating the wrapping process and fills some holes but is again limited to c2nim's capabilities. @@ -25,8 +27,9 @@ nimble install nimterop -y ``` or: ```bash -git clone http://github.com/genotrance/nimterop && cd nimterop -nimble install -y +git clone http://github.com/nimterop/nimterop && cd nimterop +nimble develop -y +nimble build ``` This will download and install nimterop in the standard Nimble package location, typically `~/.nimble`. Once installed, it can be imported into any Nim program. Note that the `~/.nimble/bin` directory needs to be added to the `PATH` for nimterop to work. @@ -50,8 +53,6 @@ Refer to the ```tests``` directory for examples on how the library can be used. The `toast` binary can also be used directly on the CLI. The `--help` flag provides more details. -Detailed documentation is available: [cimport](https://genotrance.github.io/nimterop/cimport.html), [plugin](https://genotrance.github.io/nimterop/plugin.html), [git](https://genotrance.github.io/nimterop/git.html) - __Implementation Details__ In order to use the tree-sitter C library, it has to be compiled into a separate binary called `toast` (to AST) since the Nim VM doesn't yet support FFI. `toast` takes a C/C++ file and runs it through the tree-sitter API which returns an AST data structure. This can then be printed out to stdout in a Lisp S-Expression format or the relevant Nim wrapper output. This content can be saved to a `.nim` file and imported if so desired. @@ -68,4 +69,4 @@ Nimterop depends on [tree-sitter](http://tree-sitter.github.io/tree-sitter/) and __Feedback__ -Nimterop is a work in progress and any feedback or suggestions are welcome. It is hosted on [GitHub](https://github.com/genotrance/nimterop) with an MIT license so issues, forks and PRs are most appreciated. +Nimterop is a work in progress and any feedback or suggestions are welcome. It is hosted on [GitHub](https://github.com/nimterop/nimterop) with an MIT license so issues, forks and PRs are most appreciated. diff --git a/nimterop/cimport.nim b/nimterop/cimport.nim index 4950d7b..90b10d8 100644 --- a/nimterop/cimport.nim +++ b/nimterop/cimport.nim @@ -139,7 +139,7 @@ proc getToast(fullpath: string, recurse: bool = false): string = cmd.add &" {fullpath.quoteShell}" echo cmd - # see https://github.com/genotrance/nimterop/issues/69 + # see https://github.com/nimterop/nimterop/issues/69 (result, ret) = gorgeEx(cmd, cache=getCacheValue(fullpath)) doAssert ret == 0, getToastError(result) @@ -297,7 +297,7 @@ macro cDefine*(name: static string, val: static string = ""): untyped = result = newNimNode(nnkStmtList) var str = name - # todo: see https://github.com/genotrance/nimterop/issues/100 for + # todo: see https://github.com/nimterop/nimterop/issues/100 for # edge case of empty strings if val.nBl: str &= &"={val.quoteShell}" diff --git a/nimterop/types.nim b/nimterop/types.nim index 17b4795..d161ddb 100644 --- a/nimterop/types.nim +++ b/nimterop/types.nim @@ -1,4 +1,4 @@ -# see https://github.com/genotrance/nimterop/issues/79 +# see https://github.com/nimterop/nimterop/issues/79 when (NimMajor, NimMinor, NimPatch) < (0, 19, 9): # clean this up once upgraded; adapted from std/time_t |
