summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2022-12-06 11:37:03 +0300
committerGitHub <noreply@github.com>2022-12-06 09:37:03 +0100
commit739e1badb6e48741e28420739769d3714ac6ceda (patch)
tree745718d54a61118535ae657ec884dc5bee6d83a6 /lib/pure
parent5d469686b05ba0435690fccf6fb6f7d95cf09c73 (diff)
downloadNim-739e1badb6e48741e28420739769d3714ac6ceda.tar.gz
stdlib organization & documentation improvements (#20971)
* stdlib organization & documentation improvements

* fix CI

* Update doc/lib.md

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>

* fix ci, remove jshttpcore, export in jsfetch instead

* fix alphabetical order violations

* add cmdline, db_odbc

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/async.nim3
-rw-r--r--lib/pure/asyncdispatch.nim3
-rw-r--r--lib/pure/asyncmacro.nim2
-rw-r--r--lib/pure/math.nim1
-rw-r--r--lib/pure/mersenne.nim51
-rw-r--r--lib/pure/oswalkdir.nim13
-rw-r--r--lib/pure/random.nim1
-rw-r--r--lib/pure/reservedmem.nim2
8 files changed, 7 insertions, 69 deletions
diff --git a/lib/pure/async.nim b/lib/pure/async.nim
index 482ab32c6..249c5f639 100644
--- a/lib/pure/async.nim
+++ b/lib/pure/async.nim
@@ -1,3 +1,6 @@
+## Exports [asyncmacro](asyncmacro.html) and [asyncfutures](asyncfutures.html) for native backends,
+## and [asyncjs](asyncjs.html) on the JS backend. 
+
 when defined(js):
   import asyncjs
   export asyncjs
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim
index 38b93e213..214b7d12c 100644
--- a/lib/pure/asyncdispatch.nim
+++ b/lib/pure/asyncdispatch.nim
@@ -1983,7 +1983,8 @@ proc send*(socket: AsyncFD, data: string,
   return retFuture
 
 # -- Await Macro
-include asyncmacro
+import asyncmacro
+export asyncmacro
 
 proc readAll*(future: FutureStream[string]): owned(Future[string]) {.async.} =
   ## Returns a future that will complete when all the string data from the
diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim
index d85e3e621..7ee324369 100644
--- a/lib/pure/asyncmacro.nim
+++ b/lib/pure/asyncmacro.nim
@@ -7,7 +7,7 @@
 #    distribution, for details about the copyright.
 #
 
-## `asyncdispatch` module depends on the `asyncmacro` module to work properly.
+## Implements the `async` and `multisync` macros for `asyncdispatch`.
 
 import macros, strutils, asyncfutures
 
diff --git a/lib/pure/math.nim b/lib/pure/math.nim
index 15324f882..bea655a0e 100644
--- a/lib/pure/math.nim
+++ b/lib/pure/math.nim
@@ -47,7 +47,6 @@ runnableExamples:
 ## * `fenv module <fenv.html>`_ for handling of floating-point rounding
 ##   and exceptions (overflow, zero-divide, etc.)
 ## * `random module <random.html>`_ for a fast and tiny random number generator
-## * `mersenne module <mersenne.html>`_ for the Mersenne Twister random number generator
 ## * `stats module <stats.html>`_ for statistical analysis
 ## * `strformat module <strformat.html>`_ for formatting floats for printing
 ## * `system module <system.html>`_ for some very basic and trivial math operators
diff --git a/lib/pure/mersenne.nim b/lib/pure/mersenne.nim
deleted file mode 100644
index 37c5085b1..000000000
--- a/lib/pure/mersenne.nim
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-#
-#            Nim's Runtime Library
-#        (c) Copyright 2015 Nim Contributors
-#    See the file "copying.txt", included in this
-#    distribution, for details about the copyright.
-## The [Mersenne Twister](https://en.wikipedia.org/wiki/Mersenne_Twister)
-## random number generator.
-## .. note:: The procs in this module work at compile-time.
-
-{.deprecated: "use `std/random` instead".}
-
-runnableExamples:
-  var rand = newMersenneTwister(uint32.high)  ## must be "var"
-  doAssert rand.getNum() != rand.getNum()  ## pseudorandom number
-## See also
-## ========
-## * `random module<random.html>`_ for Nim's standard random number generator
-type
-  MersenneTwister* = object
-    ## The Mersenne Twister.
-    mt: array[0..623, uint32]
-    index: int
-
-proc newMersenneTwister*(seed: uint32): MersenneTwister =
-  ## Creates a new `MersenneTwister` with seed `seed`.
-  result.index = 0
-  result.mt[0] = seed
-  for i in 1'u32 .. 623'u32:
-    result.mt[i] = (0x6c078965'u32 * (result.mt[i-1] xor
-                                      (result.mt[i-1] shr 30'u32)) + i)
-
-proc generateNumbers(m: var MersenneTwister) =
-
-  for i in 0..623:
-    var y = (m.mt[i] and 0x80000000'u32) +
-            (m.mt[(i+1) mod 624] and 0x7fffffff'u32)
-    m.mt[i] = m.mt[(i+397) mod 624] xor uint32(y shr 1'u32)
-    if (y mod 2'u32) != 0:
-      m.mt[i] = m.mt[i] xor 0x9908b0df'u32
-
-proc getNum*(m: var MersenneTwister): uint32 =
-  ## Returns the next pseudorandom `uint32`.
-  if m.index == 0:
-    generateNumbers(m)
-  result = m.mt[m.index]
-  m.index = (m.index + 1) mod m.mt.len
-  result = result xor (result shr 11'u32)
-  result = result xor ((result shl 7'u32) and 0x9d2c5680'u32)
-  result = result xor ((result shl 15'u32) and 0xefc60000'u32)
-  result = result xor (result shr 18'u32)
diff --git a/lib/pure/oswalkdir.nim b/lib/pure/oswalkdir.nim
deleted file mode 100644
index 866f9ed70..000000000
--- a/lib/pure/oswalkdir.nim
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-#
-#            Nim's Runtime Library
-#        (c) Copyright 2015 Andreas Rumpf
-#
-#    See the file "copying.txt", included in this
-#    distribution, for details about the copyright.
-#
-
-## This module is deprecated, `import os` instead.
-{.deprecated: "import os.nim instead".}
-import os
-export PathComponent, walkDir, walkDirRec
diff --git a/lib/pure/random.nim b/lib/pure/random.nim
index 9418924da..c36ab445b 100644
--- a/lib/pure/random.nim
+++ b/lib/pure/random.nim
@@ -66,7 +66,6 @@ runnableExamples:
 ## See also
 ## ========
 ## * `std/sysrand module <sysrand.html>`_ for a cryptographically secure pseudorandom number generator
-## * `mersenne module <mersenne.html>`_ for the Mersenne Twister random number generator
 ## * `math module <math.html>`_ for basic math routines
 ## * `stats module <stats.html>`_ for statistical analysis
 ## * `list of cryptographic and hashing modules <lib.html#pure-libraries-hashing>`_
diff --git a/lib/pure/reservedmem.nim b/lib/pure/reservedmem.nim
index bf14fc574..528b0095c 100644
--- a/lib/pure/reservedmem.nim
+++ b/lib/pure/reservedmem.nim
@@ -9,7 +9,7 @@
 
 ## :Authors: Zahary Karadjov
 ##
-## This module provides utilities for reserving a portions of the
+## This module provides utilities for reserving portions of the
 ## address space of a program without consuming physical memory.
 ## It can be used to implement a dynamically resizable buffer that
 ## is guaranteed to remain in the same memory location. The buffer