From a241b0f131f300c8c8827e0aed623523f19fb987 Mon Sep 17 00:00:00 2001 From: James Parkinson Date: Fri, 5 Aug 2016 20:55:25 +1000 Subject: Add doco on mapMem(), extend doco on open(), and add extra lines space for readability --- lib/pure/memfiles.nim | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/pure/memfiles.nim b/lib/pure/memfiles.nim index ff3e74d59..aa32778c5 100644 --- a/lib/pure/memfiles.nim +++ b/lib/pure/memfiles.nim @@ -42,6 +42,10 @@ type proc mapMem*(m: var MemFile, mode: FileMode = fmRead, mappedSize = -1, offset = 0): pointer = + ## returns a pointer to a mapped portion of MemFile `m` + ## + ## ``mappedSize`` of ``-1`` maps to the whole file, and + ## ``offset`` must be multiples of the PAGE SIZE of your OS var readonly = mode == fmRead when defined(windows): result = mapViewOfFileEx( @@ -68,7 +72,9 @@ proc mapMem*(m: var MemFile, mode: FileMode = fmRead, proc unmapMem*(f: var MemFile, p: pointer, size: int) = ## unmaps the memory region ``(p, `_. ## `delim`, `eat`, and delimiting logic is exactly as for - ## `memSlices <#memSlices>`_, but Nim strings are returned. Example: + ## `memSlices <#memSlices>`_, but Nim strings are returned. + ## + ## Example: ## ## .. code-block:: nim ## var buffer: TaintedString = "" @@ -335,7 +353,9 @@ iterator lines*(mfile: MemFile, delim='\l', eat='\r'): TaintedString {.inline.} ## Return each line in a file as a Nim string, like ## `lines(File) `_. ## `delim`, `eat`, and delimiting logic is exactly as for - ## `memSlices <#memSlices>`_, but Nim strings are returned. Example: + ## `memSlices <#memSlices>`_, but Nim strings are returned. + ## + ## Example: ## ## .. code-block:: nim ## for line in lines(memfiles.open("foo")): -- cgit 1.4.1-2-gfad0 From 2a84206e8915177addb73a9b7725fa6584010982 Mon Sep 17 00:00:00 2001 From: Mathijs Saey Date: Fri, 5 Aug 2016 17:57:51 +0200 Subject: Fixed #4574 --- lib/pure/math.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pure/math.nim b/lib/pure/math.nim index c088e3d7d..ce18f0030 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -360,7 +360,7 @@ proc `mod`*[T: float32|float64](x, y: T): T = proc `^`*[T](x, y: T): T = ## Computes ``x`` to the power ``y`. ``x`` must be non-negative, use ## `pow <#pow,float,float>` for negative exponents. - assert y >= 0 + assert y >= T(0) var (x, y) = (x, y) result = 1 -- cgit 1.4.1-2-gfad0 From 756beb5b5b535f02fe3559668132361e82da0565 Mon Sep 17 00:00:00 2001 From: Mathijs Saey Date: Fri, 5 Aug 2016 17:58:31 +0200 Subject: Removed trailing whitespace in math module --- lib/pure/math.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pure/math.nim b/lib/pure/math.nim index ce18f0030..58d9879b2 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -219,7 +219,7 @@ when not defined(JS): ## ## .. code-block:: nim ## echo ceil(-2.1) ## -2.0 - + when defined(windows) and defined(vcc): proc round0[T: float32|float64](x: T): T = ## Windows compilers prior to MSVC 2012 do not implement 'round', -- cgit 1.4.1-2-gfad0