system.writeFile works at compile-time
This commit is contained in:
parent
c99ec16544
commit
4298553de4
3 changed files with 10 additions and 3 deletions
|
|
@ -21,6 +21,9 @@ template mathop(op) {.immediate, dirty.} =
|
||||||
template osop(op) {.immediate, dirty.} =
|
template osop(op) {.immediate, dirty.} =
|
||||||
registerCallback(c, "stdlib.os." & astToStr(op), `op Wrapper`)
|
registerCallback(c, "stdlib.os." & astToStr(op), `op Wrapper`)
|
||||||
|
|
||||||
|
template systemop(op) {.immediate, dirty.} =
|
||||||
|
registerCallback(c, "stdlib.system." & astToStr(op), `op Wrapper`)
|
||||||
|
|
||||||
template wrap1f(op) {.immediate, dirty.} =
|
template wrap1f(op) {.immediate, dirty.} =
|
||||||
proc `op Wrapper`(a: VmArgs) {.nimcall.} =
|
proc `op Wrapper`(a: VmArgs) {.nimcall.} =
|
||||||
setResult(a, op(getFloat(a, 0)))
|
setResult(a, op(getFloat(a, 0)))
|
||||||
|
|
@ -36,6 +39,11 @@ template wrap1s(op) {.immediate, dirty.} =
|
||||||
setResult(a, op(getString(a, 0)))
|
setResult(a, op(getString(a, 0)))
|
||||||
osop op
|
osop op
|
||||||
|
|
||||||
|
template wrap2svoid(op) {.immediate, dirty.} =
|
||||||
|
proc `op Wrapper`(a: VmArgs) {.nimcall.} =
|
||||||
|
op(getString(a, 0), getString(a, 1))
|
||||||
|
systemop op
|
||||||
|
|
||||||
proc registerAdditionalOps*(c: PCtx) =
|
proc registerAdditionalOps*(c: PCtx) =
|
||||||
wrap1f(sqrt)
|
wrap1f(sqrt)
|
||||||
wrap1f(ln)
|
wrap1f(ln)
|
||||||
|
|
@ -64,3 +72,4 @@ proc registerAdditionalOps*(c: PCtx) =
|
||||||
wrap1s(existsEnv)
|
wrap1s(existsEnv)
|
||||||
wrap1s(dirExists)
|
wrap1s(dirExists)
|
||||||
wrap1s(fileExists)
|
wrap1s(fileExists)
|
||||||
|
wrap2svoid(writeFile)
|
||||||
|
|
|
||||||
2
todo.txt
2
todo.txt
|
|
@ -1,10 +1,8 @@
|
||||||
version 0.10
|
version 0.10
|
||||||
============
|
============
|
||||||
|
|
||||||
- document the new concurrency system
|
|
||||||
- Test nimfix on various babel packages
|
- Test nimfix on various babel packages
|
||||||
- deprecate recursive tuples; tuple needs laxer type checking
|
- deprecate recursive tuples; tuple needs laxer type checking
|
||||||
- string case should require an 'else'
|
|
||||||
- # echo type.int
|
- # echo type.int
|
||||||
- VM: try does not work at all
|
- VM: try does not work at all
|
||||||
- VM: Pegs do not work at compile-time
|
- VM: Pegs do not work at compile-time
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ News
|
||||||
- There is a new ``parallel`` statement for safe fork&join parallel computing.
|
- There is a new ``parallel`` statement for safe fork&join parallel computing.
|
||||||
- ``guard`` and ``lock`` pragmas have been implemented to support safer
|
- ``guard`` and ``lock`` pragmas have been implemented to support safer
|
||||||
concurrent programming.
|
concurrent programming.
|
||||||
|
- ``system.writeFile`` can be used at compile-time.
|
||||||
|
|
||||||
Library Additions
|
Library Additions
|
||||||
-----------------
|
-----------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue