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>
This commit is contained in:
parent
5d469686b0
commit
739e1badb6
26 changed files with 167 additions and 53 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -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
|
||||
|
|
@ -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>`_
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue