From 2680a613bef0b98ed0f0b7529a988162548d38ff Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 01:12:43 +0200 Subject: [PATCH 01/11] Always use https:// in git clone git:// is unencrypted. --- bootstrap.sh | 2 +- tests/manyloc/keineschweine/README.md | 2 +- web/download.rst | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index dd551b52dd..5d05ddbf8a 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -3,7 +3,7 @@ set -e set -x if [ ! -e csources/.git ]; then - git clone --depth 1 git://github.com/nim-lang/csources.git csources + git clone --depth 1 https://github.com/nim-lang/csources.git csources fi cd "csources" diff --git a/tests/manyloc/keineschweine/README.md b/tests/manyloc/keineschweine/README.md index 1323f4ae39..20facbced3 100644 --- a/tests/manyloc/keineschweine/README.md +++ b/tests/manyloc/keineschweine/README.md @@ -11,7 +11,7 @@ Just a dumb little game ### How to build? -* `git clone --recursive git://github.com/fowlmouth/keineSchweine.git somedir` +* `git clone --recursive https://github.com/fowlmouth/keineSchweine.git somedir` * `cd somedir` * `nim c -r nakefile test` or `nim c -r keineschweine && ./keineschweine` diff --git a/web/download.rst b/web/download.rst index 6593a928cd..583398c204 100644 --- a/web/download.rst +++ b/web/download.rst @@ -70,9 +70,9 @@ directory where you would like the download to take place. The following commands can be used to download the current development branch and then to build it:: - git clone git://github.com/nim-lang/Nim.git + git clone https://github.com/nim-lang/Nim.git cd Nim - git clone --depth 1 git://github.com/nim-lang/csources + git clone --depth 1 https://github.com/nim-lang/csources cd csources && sh build.sh cd .. bin/nim c koch From 4f1886621eea509e1a907fcdf5a660bf0309c2ce Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:17:57 +0200 Subject: [PATCH 02/11] os: createSymlink: fix typo in documentation --- lib/pure/os.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pure/os.nim b/lib/pure/os.nim index d9ae5a1e62..c2ee212dff 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1047,7 +1047,7 @@ proc copyDir*(source, dest: string) {.rtl, extern: "nos$1", proc createSymlink*(src, dest: string) = ## Create a symbolic link at `dest` which points to the item specified - ## by `src`. On most operating systems, will fail if a lonk + ## by `src`. On most operating systems, will fail if a link already exists. ## ## **Warning**: ## Some OS's (such as Microsoft Windows) restrict the creation From af2b0aed06236beddbece65df10a95cc38e37184 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:18:42 +0200 Subject: [PATCH 03/11] algorithm: sort: fix link in documentation --- lib/pure/algorithm.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index b83daf2454..739cdc16bb 100644 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -179,7 +179,7 @@ proc sort*[T](a: var openArray[T], ## sort(myStrArray, system.cmp) ## ## You can inline adhoc comparison procs with the `do notation - ## `_. Example: + ## `_. Example: ## ## .. code-block:: nim ## From 21433477df28ab1078c15bbd20c12fd313a7fdb8 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:20:45 +0200 Subject: [PATCH 04/11] os: createHardlink: clarify documentation I know no (UNIX-like) system which restricts creation of hardlinks. --- lib/pure/os.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pure/os.nim b/lib/pure/os.nim index c2ee212dff..e7c5ad5f4d 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1070,8 +1070,8 @@ proc createHardlink*(src, dest: string) = ## Create a hard link at `dest` which points to the item specified ## by `src`. ## - ## **Warning**: Most OS's restrict the creation of hard links to - ## root users (administrators) . + ## **Warning**: Some OS's restrict the creation of hard links to + ## root users (administrators). when defined(Windows): when useWinUnicode: var wSrc = newWideCString(src) From 6a0d288cae9023e9b45cc67c28c331871e58eed5 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:21:25 +0200 Subject: [PATCH 05/11] doc: tut2: simplify debug macro example --- doc/tut2.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/tut2.rst b/doc/tut2.rst index 3f94325ff1..845feb6d1a 100644 --- a/doc/tut2.rst +++ b/doc/tut2.rst @@ -674,17 +674,18 @@ variable number of arguments: macro debug(n: varargs[expr]): stmt = # `n` is a Nim AST that contains a list of expressions; - # this macro returns a list of statements: + # this macro returns a list of statements (n is passed for proper line + # information): result = newNimNode(nnkStmtList, n) # iterate over any argument that is passed to this macro: - for i in 0..n.len-1: + for x in n: # add a call to the statement list that writes the expression; # `toStrLit` converts an AST to its string representation: - result.add(newCall("write", newIdentNode("stdout"), toStrLit(n[i]))) + result.add(newCall("write", newIdentNode("stdout"), toStrLit(x))) # add a call to the statement list that writes ": " result.add(newCall("write", newIdentNode("stdout"), newStrLitNode(": "))) # add a call to the statement list that writes the expressions value: - result.add(newCall("writeLine", newIdentNode("stdout"), n[i])) + result.add(newCall("writeLine", newIdentNode("stdout"), x)) var a: array[0..10, int] From b52240fc9e7991926345f3b3a34175b66da1f783 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:21:55 +0200 Subject: [PATCH 06/11] system: TaintedString: reduce duplication and link to manual --- lib/system.nim | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/system.nim b/lib/system.nim index be87f35d06..4cd0378b7f 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1313,20 +1313,20 @@ when defined(boehmgc): when taintMode: type TaintedString* = distinct string ## a distinct string type that - ## is `tainted`:idx:. It is an alias for + ## is `tainted`:idx:, see `taint mode + ## `_ for + ## details. It is an alias for ## ``string`` if the taint mode is not - ## turned on. Use the ``-d:taintMode`` - ## command line switch to turn the taint - ## mode on. + ## turned on. proc len*(s: TaintedString): int {.borrow.} else: type TaintedString* = string ## a distinct string type that - ## is `tainted`:idx:. It is an alias for + ## is `tainted`:idx:, see `taint mode + ## `_ for + ## details. It is an alias for ## ``string`` if the taint mode is not - ## turned on. Use the ``-d:taintMode`` - ## command line switch to turn the taint - ## mode on. + ## turned on. when defined(profiler): proc nimProfile() {.compilerProc, noinline.} From 14e80a1abe93d423adfc1a3c3b4acade8bef32e1 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:22:23 +0200 Subject: [PATCH 07/11] system: high, low: add example which uses the type --- lib/system.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/system.nim b/lib/system.nim index 4cd0378b7f..cbfcd8b811 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -226,6 +226,7 @@ proc high*[T](x: T): T {.magic: "High", noSideEffect.} ## var arr = [1,2,3,4,5,6,7] ## high(arr) #=> 6 ## high(2) #=> 9223372036854775807 + ## high(int) #=> 9223372036854775807 proc low*[T](x: T): T {.magic: "Low", noSideEffect.} ## returns the lowest possible index of an array, a sequence, a string or @@ -236,6 +237,7 @@ proc low*[T](x: T): T {.magic: "Low", noSideEffect.} ## var arr = [1,2,3,4,5,6,7] ## low(arr) #=> 0 ## low(2) #=> -9223372036854775808 + ## low(int) #=> -9223372036854775808 type range*{.magic: "Range".}[T] ## Generic type to construct range types. From a6e32365f703de28c0b9d393aad54616b2098e7b Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:22:49 +0200 Subject: [PATCH 08/11] system: use more consistent spaces in seq declaration --- lib/system.nim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/system.nim b/lib/system.nim index cbfcd8b811..f6992c89e8 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1412,7 +1412,7 @@ proc del*[T](x: var seq[T], i: Natural) {.noSideEffect.} = ## This is an O(1) operation. ## ## .. code-block:: nim - ## var i = @[1,2,3,4,5] + ## var i = @[1, 2, 3, 4, 5] ## i.del(2) #=> @[1, 2, 5, 4] let xl = x.len - 1 shallowCopy(x[i], x[xl]) @@ -1423,7 +1423,7 @@ proc delete*[T](x: var seq[T], i: Natural) {.noSideEffect.} = ## This is an O(n) operation. ## ## .. code-block:: nim - ## var i = @[1,2,3,4,5] + ## var i = @[1, 2, 3, 4, 5] ## i.delete(2) #=> @[1, 2, 4, 5] template defaultImpl = let xl = x.len @@ -1442,8 +1442,8 @@ proc insert*[T](x: var seq[T], item: T, i = 0.Natural) {.noSideEffect.} = ## inserts `item` into `x` at position `i`. ## ## .. code-block:: nim - ## var i = @[1,2,3,4,5] - ## i.insert(2,4) #=> @[1, 2, 3, 4, 2, 5] + ## var i = @[1, 2, 3, 4, 5] + ## i.insert(2, 4) #=> @[1, 2, 3, 4, 2, 5] template defaultImpl = let xl = x.len setLen(x, xl+1) @@ -1467,8 +1467,8 @@ proc repr*[T](x: T): string {.magic: "Repr", noSideEffect.} ## debugging tool. ## ## .. code-block:: nim - ## var s: seq[string] = @["test2","test2"] - ## var i = @[1,2,3,4,5] + ## var s: seq[string] = @["test2", "test2"] + ## var i = @[1, 2, 3, 4, 5] ## repr(s) #=> 0x1055eb050[0x1055ec050"test2", 0x1055ec078"test2"] ## repr(i) #=> 0x1055ed050[1, 2, 3, 4, 5] From e28bed3d84595ea427cd80c2b4411392d4cc8c1e Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:23:54 +0200 Subject: [PATCH 09/11] system: <: add example of output to documentation --- lib/system.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/system.nim b/lib/system.nim index f6992c89e8..d5c859c48c 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -605,7 +605,7 @@ proc `<`*[T](x: Ordinal[T]): T {.magic: "UnaryLt", noSideEffect.} ## unary ``<`` that can be used for nice looking excluding ranges: ## ## .. code-block:: nim - ## for i in 0 .. <10: echo i + ## for i in 0 .. <10: echo i #=> 0 1 2 3 4 5 6 7 8 9 ## ## Semantically this is the same as ``pred``. From d255bf498c912779d599fb8ee73f587370f2176c Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:24:14 +0200 Subject: [PATCH 10/11] system: shl: remove superfluous spaces in documentation --- lib/system.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/system.nim b/lib/system.nim index d5c859c48c..2eda631639 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -891,8 +891,8 @@ proc `shl` *(x, y: int64): int64 {.magic: "ShlI", noSideEffect.} ## computes the `shift left` operation of `x` and `y`. ## ## .. code-block:: Nim - ## 1'i32 shl 4 == 0x0000_0010 - ## 1'i64 shl 4 == 0x0000_0000_0000_0010 + ## 1'i32 shl 4 == 0x0000_0010 + ## 1'i64 shl 4 == 0x0000_0000_0000_0010 proc `and` *(x, y: int): int {.magic: "BitandI", noSideEffect.} proc `and` *(x, y: int8): int8 {.magic: "BitandI", noSideEffect.} From a61e6b0d65a9ae6424a2752fa04001fbfe266e56 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 15 Sep 2016 04:24:45 +0200 Subject: [PATCH 11/11] system: writeLine: escape \n in documentation --- lib/system.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/system.nim b/lib/system.nim index 2eda631639..16258988f1 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2794,7 +2794,7 @@ when not defined(JS): #and not defined(nimscript): proc writeLine*[Ty](f: File, x: varargs[Ty, `$`]) {.inline, tags: [WriteIOEffect], benign.} - ## writes the values `x` to `f` and then writes "\n". + ## writes the values `x` to `f` and then writes "\\n". ## May throw an IO exception. proc getFileSize*(f: File): int64 {.tags: [ReadIOEffect], benign.}