diff --git a/nimterop.nimble b/nimterop.nimble index 87e1bc4..15a8ed1 100644 --- a/nimterop.nimble +++ b/nimterop.nimble @@ -9,7 +9,7 @@ bin = @["nimterop/toast", "nimterop/loaf"] installDirs = @["nimterop"] # Dependencies -requires "nim >= 0.20.2", "regex >= 0.15.0", "cligen >= 1.5.3" +requires "nim >= 0.20.2", "regex >= 0.15.0", "cligen >= 1.0.0" import nimterop/docs import os diff --git a/nimterop/build/getheader.nim b/nimterop/build/getheader.nim index 6c83939..918e923 100644 --- a/nimterop/build/getheader.nim +++ b/nimterop/build/getheader.nim @@ -59,17 +59,6 @@ macro isDefined*(def: untyped): untyped = false ) -macro getDefine*(def: untyped): untyped = - let version = newIdentNode(def.strVal()) - let verVal = - if gDefines.hasKey(def.strVal()): - gDefines[def.strVal()] - else: - "" - result = quote do: - const `version` {.strdefine.} = `verVal` - `version` - proc getDynlibExt(): string = when defined(Windows): result = "[0-9.\\-]*\\.dll" diff --git a/nimterop/build/shell.nim b/nimterop/build/shell.nim index 7df8f15..24075cf 100644 --- a/nimterop/build/shell.nim +++ b/nimterop/build/shell.nim @@ -206,13 +206,13 @@ proc getFileDate*(fullpath: string): string = when defined(Windows): let (head, tail) = fullpath.splitPath() - &"forfiles /P {head.sanitizePath()} /M {tail.sanitizePath} /C \"cmd /c echo @fdate @ftime\"" + &"cmd /c forfiles /P {head.sanitizePath()} /M {tail.sanitizePath} /C \"cmd /c echo @fdate @ftime @fsize\"" elif defined(Linux): - &"stat -c %Y {fullpath.sanitizePath}" + &"stat -c %y {fullpath.sanitizePath}" elif defined(OSX) or defined(FreeBSD): &"stat -f %m {fullpath.sanitizePath}" - (result, ret) = execAction(cmd, die=false) + (result, ret) = execAction(cmd) proc touchFile*(fullpath: string) = ## Touch file to update modified date diff --git a/nimterop/enumtypepub.nim b/nimterop/enumtypepub.nim deleted file mode 100644 index 7700e30..0000000 --- a/nimterop/enumtypepub.nim +++ /dev/null @@ -1,42 +0,0 @@ -import macros - -macro defineEnum*(typ: untyped): untyped = - result = newNimNode(nnkStmtList) - - # Enum mapped to distinct cint - result.add quote do: - type `typ`* = distinct cint - - for i in ["+", "-", "*", "div", "mod", "shl", "shr", "or", "and", "xor", "<", "<=", "==", ">", ">="]: - let - ni = newIdentNode(i) - typout = if i[0] in "<=>": newIdentNode("bool") else: typ # comparisons return bool - if i[0] == '>': # cannot borrow `>` and `>=` from templates - let - nopp = if i.len == 2: newIdentNode("<=") else: newIdentNode("<") - result.add quote do: - proc `ni`*(x: `typ`, y: cint): `typout` = `nopp`(y, x) - proc `ni`*(x: cint, y: `typ`): `typout` = `nopp`(y, x) - proc `ni`*(x, y: `typ`): `typout` = `nopp`(y, x) - else: - result.add quote do: - proc `ni`*(x: `typ`, y: cint): `typout` {.borrow.} - proc `ni`*(x: cint, y: `typ`): `typout` {.borrow.} - proc `ni`*(x, y: `typ`): `typout` {.borrow.} - result.add quote do: - proc `ni`*(x: `typ`, y: int): `typout` = `ni`(x, y.cint) - proc `ni`*(x: int, y: `typ`): `typout` = `ni`(x.cint, y) - - let - divop = newIdentNode("/") # `/`() - dlrop = newIdentNode("$") # `$`() - notop = newIdentNode("not") # `not`() - result.add quote do: - proc `divop`*(x, y: `typ`): `typ` = `typ`((x.float / y.float).cint) - proc `divop`*(x: `typ`, y: cint): `typ` = `divop`(x, `typ`(y)) - proc `divop`*(x: cint, y: `typ`): `typ` = `divop`(`typ`(x), y) - proc `divop`*(x: `typ`, y: int): `typ` = `divop`(x, y.cint) - proc `divop`*(x: int, y: `typ`): `typ` = `divop`(x.cint, y) - - proc `dlrop`*(x: `typ`): string {.borrow.} - proc `notop`*(x: `typ`): `typ` {.borrow.} diff --git a/nimterop/toastlib/getters.nim b/nimterop/toastlib/getters.nim index 2e1ac4c..f0a4735 100644 --- a/nimterop/toastlib/getters.nim +++ b/nimterop/toastlib/getters.nim @@ -31,7 +31,7 @@ yield""".split(Whitespace).toHashSet() const # Enum macro read from file - written into wrapper when required - gEnumMacroConst = "import nimterop / enumtypepub" + gEnumMacroConst = staticRead(currentSourcePath.parentDir().parentDir() / "enumtype.nim") var gEnumMacro* = gEnumMacroConst