Import macros in plugin, no newlines in enum expressions, strformat issue
This commit is contained in:
parent
a7be010832
commit
2352e77c5e
2 changed files with 3 additions and 3 deletions
|
|
@ -258,7 +258,7 @@ macro cPlugin*(body): untyped =
|
||||||
sym.name = sym.name.replace("SDL_", "")
|
sym.name = sym.name.replace("SDL_", "")
|
||||||
|
|
||||||
let
|
let
|
||||||
data = "import nimterop/plugin\n\n" & body.repr
|
data = "import macros, nimterop/plugin\n\n" & body.repr
|
||||||
hash = data.hash().abs()
|
hash = data.hash().abs()
|
||||||
path = getTempDir() / "nimterop_" & $hash & ".nim"
|
path = getTempDir() / "nimterop_" & $hash & ".nim"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ proc checkIdentifier(name, kind, parent, origName: string) =
|
||||||
|
|
||||||
if name.len != 0:
|
if name.len != 0:
|
||||||
let
|
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"
|
errmsg = &"Identifier '{parentStr}{name}' ({kind}){origStr} contains"
|
||||||
|
|
||||||
doAssert name[0] != '_' and name[^1] != '_', errmsg & " leading/trailing underscores '_'"
|
doAssert name[0] != '_' and name[^1] != '_', errmsg & " leading/trailing underscores '_'"
|
||||||
|
|
@ -331,7 +331,7 @@ proc getNimExpression*(expr: string): string =
|
||||||
(" ", ""),
|
(" ", ""),
|
||||||
("<<", " shl "), (">>", " shr "),
|
("<<", " shl "), (">>", " shr "),
|
||||||
("^", " xor "), ("&", " and "), ("|", " or "),
|
("^", " xor "), ("&", " and "), ("|", " or "),
|
||||||
("~", " not ")
|
("~", " not "), ("\n", " "), ("\r", "")
|
||||||
])
|
])
|
||||||
|
|
||||||
proc getSplitComma*(joined: seq[string]): seq[string] =
|
proc getSplitComma*(joined: seq[string]): seq[string] =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue