aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2019-05-09 02:57:55 -0500
committerGanesh Viswanathan <dev@genotrance.com>2019-05-09 02:57:55 -0500
commit2352e77c5e02bba9e327c6a140a04a8c283480af (patch)
treeafd53347e347f31d5086818afc3e64a9c3c8c1e3
parenta7be010832aca542faa298e3eefafb442c18f94f (diff)
downloadnimterop-2352e77c5e02bba9e327c6a140a04a8c283480af.tar.gz
nimterop-2352e77c5e02bba9e327c6a140a04a8c283480af.zip
Import macros in plugin, no newlines in enum expressions, strformat issue
-rw-r--r--nimterop/cimport.nim2
-rw-r--r--nimterop/getters.nim4
2 files changed, 3 insertions, 3 deletions
diff --git a/nimterop/cimport.nim b/nimterop/cimport.nim
index e356d11..d2c1e69 100644
--- a/nimterop/cimport.nim
+++ b/nimterop/cimport.nim
@@ -258,7 +258,7 @@ macro cPlugin*(body): untyped =
sym.name = sym.name.replace("SDL_", "")
let
- data = "import nimterop/plugin\n\n" & body.repr
+ data = "import macros, nimterop/plugin\n\n" & body.repr
hash = data.hash().abs()
path = getTempDir() / "nimterop_" & $hash & ".nim"
diff --git a/nimterop/getters.nim b/nimterop/getters.nim
index 67482d1..6eaf049 100644
--- a/nimterop/getters.nim
+++ b/nimterop/getters.nim
@@ -94,7 +94,7 @@ proc checkIdentifier(name, kind, parent, origName: string) =
if name.len != 0:
let
- origStr = if name != origName: ", originally '{origName}' before 'cPlugin:onSymbol()', still" else: ""
+ origStr = if name != origName: &", originally '{origName}' before 'cPlugin:onSymbol()', still" else: ""
errmsg = &"Identifier '{parentStr}{name}' ({kind}){origStr} contains"
doAssert name[0] != '_' and name[^1] != '_', errmsg & " leading/trailing underscores '_'"
@@ -331,7 +331,7 @@ proc getNimExpression*(expr: string): string =
(" ", ""),
("<<", " shl "), (">>", " shr "),
("^", " xor "), ("&", " and "), ("|", " or "),
- ("~", " not ")
+ ("~", " not "), ("\n", " "), ("\r", "")
])
proc getSplitComma*(joined: seq[string]): seq[string] =