summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-09-15 09:27:51 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-09-15 09:27:51 +0200
commit39f0195ebf30cc9f4b96953423298d7a2130eac8 (patch)
treebb4daf580c239b59d232e186814b69fc642ce6d5 /doc
parentbc738d63a728ee6030cc224c8808990a6f641feb (diff)
parent2ef65d5cdf3d65cbfab4c39796ddb4e70e9ebb37 (diff)
downloadNim-39f0195ebf30cc9f4b96953423298d7a2130eac8.tar.gz
Merge branch 'devel' into araq
Diffstat (limited to 'doc')
-rw-r--r--doc/advopt.txt2
-rw-r--r--doc/lib.rst3
-rw-r--r--doc/manual/ffi.txt6
-rw-r--r--doc/manual/lexing.txt2
-rw-r--r--doc/manual/procs.txt12
-rw-r--r--doc/nimc.rst27
-rw-r--r--doc/tut1.rst9
-rw-r--r--doc/tut2.rst10
8 files changed, 46 insertions, 25 deletions
diff --git a/doc/advopt.txt b/doc/advopt.txt
index b88e5f063..fb6fd719b 100644
--- a/doc/advopt.txt
+++ b/doc/advopt.txt
@@ -65,7 +65,7 @@ Advanced options:
   --skipUserCfg             do not read the user's configuration file
   --skipParentCfg           do not read the parent dirs' configuration files
   --skipProjCfg             do not read the project's configuration file
-  --gc:refc|v2|markAndSweep|boehm|go|none
+  --gc:refc|v2|markAndSweep|boehm|go|none|regions
                             select the GC to use; default is 'refc'
   --index:on|off            turn index file generation on|off
   --putenv:key=value        set an environment variable
diff --git a/doc/lib.rst b/doc/lib.rst
index ea43c0db9..64c3c11eb 100644
--- a/doc/lib.rst
+++ b/doc/lib.rst
@@ -539,9 +539,6 @@ Network Programming and Internet Protocols
 * `joyent_http_parser <joyent_http_parser.html>`_
   Wrapper for the joyent's high-performance HTTP parser.
 
-* `libcurl <libcurl.html>`_
-  Wrapper for the libcurl library.
-
 * `openssl <openssl.html>`_
   Wrapper for OpenSSL.
 
diff --git a/doc/manual/ffi.txt b/doc/manual/ffi.txt
index e9b52eaca..06fed1430 100644
--- a/doc/manual/ffi.txt
+++ b/doc/manual/ffi.txt
@@ -132,7 +132,7 @@ translated into a C array of undetermined size:
 
 .. code-block:: nim
   type
-    ArrayPart{.unchecked.} = array[0..0, int]
+    ArrayPart{.unchecked.} = array[0, int]
     MySeq = object
       len, cap: int
       data: ArrayPart
@@ -146,10 +146,6 @@ Produces roughly this C code:
     NI data[];
   } MySeq;
 
-The bounds checking done at compile time is not disabled for now, so to access
-``s.data[C]`` (where ``C`` is a constant) the array's index needs to
-include ``C``.
-
 The base type of the unchecked array may not contain any GC'ed memory but this
 is currently not checked.
 
diff --git a/doc/manual/lexing.txt b/doc/manual/lexing.txt
index d4c11adf7..3147dd97c 100644
--- a/doc/manual/lexing.txt
+++ b/doc/manual/lexing.txt
@@ -130,7 +130,7 @@ Two identifiers are considered equal if the following algorithm returns true:
 .. code-block:: nim
   proc sameIdentifier(a, b: string): bool =
     a[0] == b[0] and
-      a.replace(re"_|–", "").toLower == b.replace(re"_|–", "").toLower
+      a.replace("_", "").toLower == b.replace("_", "").toLower
 
 That means only the first letters are compared in a case sensitive manner. Other
 letters are compared case insensitively and underscores are ignored.
diff --git a/doc/manual/procs.txt b/doc/manual/procs.txt
index 5f4c9f2fa..6d09ac3f5 100644
--- a/doc/manual/procs.txt
+++ b/doc/manual/procs.txt
@@ -248,12 +248,20 @@ calls can use the ``do`` keyword:
 .. code-block:: nim
   sort(cities) do (x,y: string) -> int:
     cmp(x.len, y.len)
+
   # Less parenthesis using the method plus command syntax:
   cities = cities.map do (x:string) -> string:
     "City of " & x
 
+  # In macros, the do notation is often used for quasi-quoting
+  macroResults.add quote do:
+    if not `ex`:
+      echo `info`, ": Check failed: ", `expString`
+
 ``do`` is written after the parentheses enclosing the regular proc params.
 The proc expression represented by the do block is appended to them.
+In calls using the command syntax, the do block will bind to the immediately
+preceeding expression, transforming it in a call.
 
 ``do`` with parentheses is an anonymous ``proc``; however a ``do`` without
 parentheses is just a block of code. The ``do`` notation can be used to
@@ -275,8 +283,8 @@ Nonoverloadable builtins
 The following builtin procs cannot be overloaded for reasons of implementation
 simplicity (they require specialized semantic checking)::
 
-  declared, defined, definedInScope, compiles, low, high, sizeOf,
-  is, of, shallowCopy, getAst, astToStr, spawn, procCall
+  declared, defined, definedInScope, compiles, sizeOf,
+  is, shallowCopy, getAst, astToStr, spawn, procCall
 
 Thus they act more like keywords than like ordinary identifiers; unlike a
 keyword however, a redefinition may `shadow`:idx: the definition in
diff --git a/doc/nimc.rst b/doc/nimc.rst
index 5d9ed03ab..e949df69c 100644
--- a/doc/nimc.rst
+++ b/doc/nimc.rst
@@ -189,12 +189,28 @@ resides in its own directory so that the generated ``nimcache`` directory
 is not shared between different projects.
 
 
+Compiler Selection
+==================
+
+To change the compiler from the default compiler (at the command line)::
+
+  nim c --cc:llvm_gcc --compile_only myfile.nim
+
+This uses the configuration defined in ``config\nim.cfg`` for ``lvm_gcc``.
+
+If nimcache already contains compiled code from a different compiler for the same project,
+add the ``-f`` flag to force all files to be recompiled.
+
+The default compiler is defined at the top of ``config\nim.cfg``.  Changing this setting
+affects the compiler used by ``koch`` to (re)build Nim.
+
+
 Cross compilation
 =================
 
 To cross compile, use for example::
 
-  nim c --cpu:i386 --os:linux --compile_only --gen_script myproject.nim
+  nim c --cpu:i386 --os:linux --compileOnly --genScript myproject.nim
 
 Then move the C code and the compile script ``compile_myproject.sh`` to your
 Linux i386 machine and run the script.
@@ -262,6 +278,15 @@ Define               Effect
                      what's in the Nim file with what's in the C header
                      (requires a C compiler with _Static_assert support, like
                      any C11 compiler)
+``tempDir``          This symbol takes a string as its value, like 
+                     ``--define:tempDir:/some/temp/path`` to override the
+                     temporary directory returned by ``os.getTempDir()``.
+                     The value **should** end with a directory separator 
+                     character. (Relevant for the Android platform)
+``useShPath``        This symbol takes a string as its value, like 
+                     ``--define:useShPath:/opt/sh/bin/sh`` to override the
+                     path for the ``sh`` binary, in cases where it is not
+                     located in the default location ``/bin/sh``
 ==================   =========================================================
 
 
diff --git a/doc/tut1.rst b/doc/tut1.rst
index fc8e411cb..89893a39a 100644
--- a/doc/tut1.rst
+++ b/doc/tut1.rst
@@ -138,7 +138,7 @@ comments can also be nested.
     ]#
   ]#
 
-You can also use the `discard statement`_ together with *long string
+You can also use the `discard statement <#procedures-discard-statement>`_ together with *long string
 literals* to create block comments:
 
 .. code-block:: nim
@@ -364,8 +364,7 @@ iterator:
     echo i
   # --> Outputs 1 2 3 4 5 6 7 8 9 10 on different lines
 
-The built-in `$ <system.html#$>`_ operator turns an integer (``int``) and many
-other types into a string. The variable ``i`` is implicitly declared by the
+The variable ``i`` is implicitly declared by the
 ``for`` loop and has the type ``int``, because that is what `countup
 <system.html#countup>`_ returns. ``i`` runs through the values 1, 2, .., 10.
 Each value is ``echo``-ed. This code does the same:
@@ -501,10 +500,6 @@ differences:
 The ``when`` statement is useful for writing platform specific code, similar to
 the ``#ifdef`` construct in the C programming language.
 
-**Note**: To comment out a large piece of code, it is often better to use a
-``when false:`` statement than to use real comments. This way nesting is
-possible.
-
 
 Statements and indentation
 ==========================
diff --git a/doc/tut2.rst b/doc/tut2.rst
index f145528a1..0bb4c94e1 100644
--- a/doc/tut2.rst
+++ b/doc/tut2.rst
@@ -218,7 +218,7 @@ So "pure object oriented" code is easy to write:
   import strutils, sequtils
 
   stdout.writeLine("Give a list of numbers (separated by spaces): ")
-  stdout.write(stdin.readLine.split.map(parseInt).max.`$`)
+  stdout.write(stdin.readLine.splitWhitespace.map(parseInt).max.`$`)
   stdout.writeLine(" is the maximum!")
 
 
@@ -233,15 +233,15 @@ is needed:
 
   type
     Socket* = ref object of RootObj
-      host: int # cannot be accessed from the outside of the module due to missing star
+      h: int # cannot be accessed from the outside of the module due to missing star
 
   proc `host=`*(s: var Socket, value: int) {.inline.} =
     ## setter of host address
-    s.host = value
+    s.h = value
 
   proc host*(s: Socket): int {.inline.} =
     ## getter of host address
-    s.host
+    s.h
 
   var s: Socket
   new s
@@ -723,7 +723,7 @@ regular expressions:
 
 .. code-block:: nim
 
-  macro case_token(n: typed): typed =
+  macro case_token(n: varargs[untyped]): typed =
     # creates a lexical analyzer from regular expressions
     # ... (implementation is an exercise for the reader :-)
     discard