diff options
author | Araq <rumpf_a@web.de> | 2014-10-02 10:52:32 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-10-02 10:52:32 +0200 |
commit | 4298553de48ba1a3bd9b98b4c1716674294cf4da (patch) | |
tree | 9db01ed5127ff9df838c6ce7e71b9cd3b2577455 | |
parent | c99ec1654452eede8b374eb85cb05b2e759be23f (diff) | |
download | Nim-4298553de48ba1a3bd9b98b4c1716674294cf4da.tar.gz |
system.writeFile works at compile-time
-rw-r--r-- | compiler/vmops.nim | 9 | ||||
-rw-r--r-- | todo.txt | 2 | ||||
-rw-r--r-- | web/news.txt | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/compiler/vmops.nim b/compiler/vmops.nim index 8e75cc23a..aa25d208a 100644 --- a/compiler/vmops.nim +++ b/compiler/vmops.nim @@ -21,6 +21,9 @@ template mathop(op) {.immediate, dirty.} = template osop(op) {.immediate, dirty.} = 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.} = proc `op Wrapper`(a: VmArgs) {.nimcall.} = setResult(a, op(getFloat(a, 0))) @@ -36,6 +39,11 @@ template wrap1s(op) {.immediate, dirty.} = setResult(a, op(getString(a, 0))) 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) = wrap1f(sqrt) wrap1f(ln) @@ -64,3 +72,4 @@ proc registerAdditionalOps*(c: PCtx) = wrap1s(existsEnv) wrap1s(dirExists) wrap1s(fileExists) + wrap2svoid(writeFile) diff --git a/todo.txt b/todo.txt index b5d832fe0..ed09a21d1 100644 --- a/todo.txt +++ b/todo.txt @@ -1,10 +1,8 @@ version 0.10 ============ -- document the new concurrency system - Test nimfix on various babel packages - deprecate recursive tuples; tuple needs laxer type checking -- string case should require an 'else' - # echo type.int - VM: try does not work at all - VM: Pegs do not work at compile-time diff --git a/web/news.txt b/web/news.txt index 233a8e2c7..7edd7c9df 100644 --- a/web/news.txt +++ b/web/news.txt @@ -57,7 +57,7 @@ News - There is a new ``parallel`` statement for safe fork&join parallel computing. - ``guard`` and ``lock`` pragmas have been implemented to support safer concurrent programming. - + - ``system.writeFile`` can be used at compile-time. Library Additions ----------------- |