diff --git a/doc/advopt.txt b/doc/advopt.txt index 197c0d7da9..7b3695532d 100644 --- a/doc/advopt.txt +++ b/doc/advopt.txt @@ -85,7 +85,7 @@ Advanced options: that --dynlibOverride:lua matches dynlib: "liblua.so.3" --listCmd list the commands used to execute external programs - --parallelBuild=0|1|... perform a parallel build + --parallelBuild:0|1|... perform a parallel build value = number of processors (0 for auto-detect) --verbosity:0|1|2|3 set Nim's verbosity level (1 is default) --cs:none|partial set case sensitivity level (default: none); diff --git a/tools/website.tmpl b/tools/website.tmpl index e1fdf67012..b233c69285 100644 --- a/tools/website.tmpl +++ b/tools/website.tmpl @@ -7,7 +7,6 @@
+parallel: + var i = 0 + while i <= a.high: + spawn f(a[i]) + spawn f(a[i+1]) + # ERROR: cannot prove a[i] is disjoint from a[i+1] + # BUT: replace 'i += 1' with 'i += 2' and the code compiles! + i += 1 ++
# compute average line length ++# compute average line length var sum = 0 count = 0 @@ -68,8 +82,9 @@ echo("Average line length: ",
# create and greet someone -type Person = object ++# create and greet someone +type Person = object name: string age: int @@ -81,58 +96,43 @@ echo("Average line length: ", p.greet() # or greet(p)
-parallel: - var i = 0 - while i <= a.high: - spawn f(a[i]) - spawn f(a[i+1]) - # ERROR: cannot prove a[i] is disjoint from a[i+1] - # BUT: replace 'i += 1' with 'i += 2' and the code compiles! - i += 1 -
-proc unsafeScanf(f: File; s: cstring) - {.importc: "fscanf", - header: "<stdio.h>", varargs.} - -var x: cint -unsafeScanf(stdin, "%d", addr x) -
+# declare a C procedure.. +proc unsafeScanf(f: File, s: cstring) + {.varargs, + importc: "fscanf", + header: "<stdio.h>".} + +# ..and use it... +var x: cint +stdin.unsafeScanf("%d", addr x) ++
Compile and run with:
$ nim c -r example.nim
+# a simple web server import jester, asyncdispatch, htmlgen -routes: - get "/": - resp h1("Hello world") +# using jester commands +routes: + get "/": + resp h1("Hello world") runForever() -
-Compile and run with:
-nim c -r example.nim
-View at: localhost:5000
-
View in browser at:
localhost:5000