Render deprecated pragmas (#8886)
* Render deprecated pragmas * fix the expected html * clean up the documentation regarding deprecations * fix typo * fix system.nim * fix random
This commit is contained in:
parent
64518380a5
commit
7d217a71d3
21 changed files with 180 additions and 117 deletions
|
|
@ -221,9 +221,8 @@ proc binarySearch*[T](a: openArray[T], key: T): int =
|
|||
assert binarySearch([0, 1, 4, 2, 3], 4) == 2
|
||||
binarySearch(a, key, cmp[T])
|
||||
|
||||
proc smartBinarySearch*[T](a: openArray[T], key: T): int {.deprecated.} =
|
||||
## **Deprecated since version 0.18.1**; Use `binarySearch proc
|
||||
## <#binarySearch,openArray[T],T>`_ instead.
|
||||
proc smartBinarySearch*[T](a: openArray[T], key: T): int {.deprecated:
|
||||
"Deprecated since v0.18.1; Use 'binarySearch'".} =
|
||||
binarySearch(a, key, cmp[T])
|
||||
|
||||
const
|
||||
|
|
|
|||
|
|
@ -1840,8 +1840,7 @@ proc waitFor*[T](fut: Future[T]): T =
|
|||
|
||||
fut.read
|
||||
|
||||
proc setEvent*(ev: AsyncEvent) {.deprecated.} =
|
||||
proc setEvent*(ev: AsyncEvent) {.deprecated:
|
||||
"Deprecated since v0.18.0: Use 'trigger' instead.".} =
|
||||
## Set event ``ev`` to signaled state.
|
||||
##
|
||||
## **Deprecated since v0.18.0:** Use ``trigger`` instead.
|
||||
ev.trigger()
|
||||
|
|
|
|||
|
|
@ -176,12 +176,12 @@ proc `$`*[T](heap: HeapQueue[T]): string =
|
|||
result.addQuoted(x)
|
||||
result.add("]")
|
||||
|
||||
proc newHeapQueue*[T](): HeapQueue[T] {.deprecated.} =
|
||||
## **Deprecated since v0.20.0:** use ``initHeapQueue`` instead.
|
||||
proc newHeapQueue*[T](): HeapQueue[T] {.deprecated:
|
||||
"Deprecated since v0.20.0: use 'initHeapQueue' instead.".} =
|
||||
initHeapQueue[T]()
|
||||
|
||||
proc newHeapQueue*[T](heap: var HeapQueue[T]) {.deprecated.} =
|
||||
## **Deprecated since v0.20.0:** use ``clear`` instead.
|
||||
proc newHeapQueue*[T](heap: var HeapQueue[T]) {.deprecated:
|
||||
"Deprecated since v0.20.0: use 'clear' instead.".} =
|
||||
heap.clear()
|
||||
|
||||
when isMainModule:
|
||||
|
|
|
|||
|
|
@ -604,17 +604,13 @@ proc rightSize*(count: Natural): int {.inline.} =
|
|||
|
||||
|
||||
proc initSet*[A](initialSize = defaultInitialSize): HashSet[A] {.deprecated:
|
||||
"Deprecated since v0.20, use `initHashSet`"} = initHashSet[A](initialSize)
|
||||
## Deprecated since v0.20, use `initHashSet <#initHashSet,int>`_.
|
||||
"Deprecated since v0.20, use 'initHashSet'"} = initHashSet[A](initialSize)
|
||||
|
||||
proc toSet*[A](keys: openArray[A]): HashSet[A] {.deprecated:
|
||||
"Deprecated since v0.20, use `toHashSet`"} = toHashSet[A](keys)
|
||||
## Deprecated since v0.20, use `toHashSet <#toHashSet,openArray[A]>`_.
|
||||
"Deprecated since v0.20, use 'toHashSet'"} = toHashSet[A](keys)
|
||||
|
||||
proc isValid*[A](s: HashSet[A]): bool {.deprecated:
|
||||
"Deprecated since v0.20; sets are initialized by default"} =
|
||||
## **Deprecated since v0.20; sets are initialized by default**
|
||||
##
|
||||
## Returns `true` if the set has been initialized (with `initHashSet proc
|
||||
## <#initHashSet,int>`_ or `init proc <#init,HashSet[A],int>`_).
|
||||
##
|
||||
|
|
@ -942,7 +938,6 @@ iterator pairs*[A](s: OrderedSet[A]): tuple[a: int, b: A] =
|
|||
|
||||
proc isValid*[A](s: OrderedSet[A]): bool {.deprecated:
|
||||
"Deprecated since v0.20; sets are initialized by default"} =
|
||||
## **Deprecated since v0.20; sets are initialized by default**
|
||||
##
|
||||
## Returns `true` if the set has been initialized (with `initHashSet proc
|
||||
## <#initOrderedSet,int>`_ or `init proc <#init,OrderedSet[A],int>`_).
|
||||
|
|
|
|||
|
|
@ -92,8 +92,7 @@ proc deinitSharedList*[A](t: var SharedList[A]) =
|
|||
clear(t)
|
||||
deinitLock t.lock
|
||||
|
||||
proc initSharedList*[A](): SharedList[A] {.deprecated.} =
|
||||
## Deprecated. Use `init` instead.
|
||||
proc initSharedList*[A](): SharedList[A] {.deprecated: "use 'init' instead".} =
|
||||
## This is not posix compliant, may introduce undefined behavior.
|
||||
initLock result.lock
|
||||
result.head = nil
|
||||
|
|
|
|||
|
|
@ -219,8 +219,8 @@ proc deinitSharedTable*[A, B](t: var SharedTable[A, B]) =
|
|||
deallocShared(t.data)
|
||||
deinitLock t.lock
|
||||
|
||||
proc initSharedTable*[A, B](initialSize=64): SharedTable[A, B] {.deprecated.} =
|
||||
## Deprecated. Use `init` instead.
|
||||
proc initSharedTable*[A, B](initialSize=64): SharedTable[A, B] {.deprecated:
|
||||
"use 'init' instead".} =
|
||||
## This is not posix compliant, may introduce undefined behavior.
|
||||
assert isPowerOfTwo(initialSize)
|
||||
result.counter = 0
|
||||
|
|
|
|||
|
|
@ -239,8 +239,8 @@ proc getBiggestInt*(n: JsonNode, default: BiggestInt = 0): BiggestInt =
|
|||
if n.isNil or n.kind != JInt: return default
|
||||
else: return n.num
|
||||
|
||||
proc getNum*(n: JsonNode, default: BiggestInt = 0): BiggestInt {.deprecated: "use getInt or getBiggestInt instead".} =
|
||||
## **Deprecated since v0.18.2:** use ``getInt`` or ``getBiggestInt`` instead.
|
||||
proc getNum*(n: JsonNode, default: BiggestInt = 0): BiggestInt {.deprecated:
|
||||
"Deprecated since v0.18.2; use 'getInt' or 'getBiggestInt' instead".} =
|
||||
getBiggestInt(n, default)
|
||||
|
||||
proc getFloat*(n: JsonNode, default: float = 0.0): float =
|
||||
|
|
@ -253,8 +253,8 @@ proc getFloat*(n: JsonNode, default: float = 0.0): float =
|
|||
of JInt: return float(n.num)
|
||||
else: return default
|
||||
|
||||
proc getFNum*(n: JsonNode, default: float = 0.0): float {.deprecated: "use getFloat instead".} =
|
||||
## **Deprecated since v0.18.2:** use ``getFloat`` instead.
|
||||
proc getFNum*(n: JsonNode, default: float = 0.0): float {.deprecated:
|
||||
"Deprecated since v0.18.2; use 'getFloat' instead".} =
|
||||
getFloat(n, default)
|
||||
|
||||
proc getBool*(n: JsonNode, default: bool = false): bool =
|
||||
|
|
@ -264,8 +264,8 @@ proc getBool*(n: JsonNode, default: bool = false): bool =
|
|||
if n.isNil or n.kind != JBool: return default
|
||||
else: return n.bval
|
||||
|
||||
proc getBVal*(n: JsonNode, default: bool = false): bool {.deprecated: "use getBool instead".} =
|
||||
## **Deprecated since v0.18.2:** use ``getBool`` instead.
|
||||
proc getBVal*(n: JsonNode, default: bool = false): bool {.deprecated:
|
||||
"Deprecated since v0.18.2; use 'getBool' instead".} =
|
||||
getBool(n, default)
|
||||
|
||||
proc getFields*(n: JsonNode,
|
||||
|
|
@ -511,8 +511,8 @@ proc contains*(node: JsonNode, val: JsonNode): bool =
|
|||
assert(node.kind == JArray)
|
||||
find(node.elems, val) >= 0
|
||||
|
||||
proc existsKey*(node: JsonNode, key: string): bool {.deprecated: "use hasKey instead".} = node.hasKey(key)
|
||||
## **Deprecated:** use `hasKey` instead.
|
||||
proc existsKey*(node: JsonNode, key: string): bool {.deprecated: "use 'hasKey' instead".} =
|
||||
node.hasKey(key)
|
||||
|
||||
proc `{}`*(node: JsonNode, keys: varargs[string]): JsonNode =
|
||||
## Traverses the node and gets the given value. If any of the
|
||||
|
|
|
|||
|
|
@ -188,8 +188,8 @@ proc nextPowerOfTwo*(x: int): int {.noSideEffect.} =
|
|||
result = result or (result shr 1)
|
||||
result += 1 + ord(x<=0)
|
||||
|
||||
proc countBits32*(n: int32): int {.noSideEffect, deprecated: "use bitops.countSetBits instead".} =
|
||||
## **Deprecated since version v0.20.0**: Use ``bitops.countSetBits`` instead.
|
||||
proc countBits32*(n: int32): int {.noSideEffect, deprecated:
|
||||
"Deprecated since v0.20.0; use 'bitops.countSetBits' instead".} =
|
||||
runnableExamples:
|
||||
doAssert countBits32(7) == 3
|
||||
doAssert countBits32(8) == 1
|
||||
|
|
@ -594,11 +594,10 @@ when not defined(JS): # C
|
|||
## echo gamma(11.0) # 3628800.0
|
||||
## echo gamma(-1.0) # nan
|
||||
proc tgamma*(x: float32): float32
|
||||
{.deprecated: "use gamma instead", importc: "tgammaf", header: "<math.h>".}
|
||||
{.deprecated: "Deprecated since v0.19.0; use 'gamma' instead", importc: "tgammaf", header: "<math.h>".}
|
||||
proc tgamma*(x: float64): float64
|
||||
{.deprecated: "use gamma instead", importc: "tgamma", header: "<math.h>".}
|
||||
{.deprecated: "Deprecated since v0.19.0; use 'gamma' instead", importc: "tgamma", header: "<math.h>".}
|
||||
## The gamma function
|
||||
## **Deprecated since version 0.19.0**: Use ``gamma`` instead.
|
||||
proc lgamma*(x: float32): float32 {.importc: "lgammaf", header: "<math.h>".}
|
||||
proc lgamma*(x: float64): float64 {.importc: "lgamma", header: "<math.h>".}
|
||||
## Computes the natural log of the gamma function for ``x``.
|
||||
|
|
@ -729,11 +728,8 @@ when not defined(JS): # C
|
|||
## echo trunc(PI) # 3.0
|
||||
## echo trunc(-1.85) # -1.0
|
||||
|
||||
proc fmod*(x, y: float32): float32 {.deprecated: "use mod instead", importc: "fmodf", header: "<math.h>".}
|
||||
proc fmod*(x, y: float64): float64 {.deprecated: "use mod instead", importc: "fmod", header: "<math.h>".}
|
||||
## **Deprecated since version 0.19.0**: Use the `mod proc
|
||||
## <#mod,float64,float64>`_ instead.
|
||||
##
|
||||
proc fmod*(x, y: float32): float32 {.deprecated: "Deprecated since v0.19.0; use 'mod' instead", importc: "fmodf", header: "<math.h>".}
|
||||
proc fmod*(x, y: float64): float64 {.deprecated: "Deprecated since v0.19.0; use 'mod' instead", importc: "fmod", header: "<math.h>".}
|
||||
## Computes the remainder of ``x`` divided by ``y``.
|
||||
|
||||
proc `mod`*(x, y: float32): float32 {.importc: "fmodf", header: "<math.h>".}
|
||||
|
|
@ -772,9 +768,7 @@ else: # JS
|
|||
## ( 6.5 mod -2.5) == 1.5
|
||||
## (-6.5 mod -2.5) == -1.5
|
||||
|
||||
proc round*[T: float32|float64](x: T, places: int): T {.deprecated: "use format instead".} =
|
||||
## **Deprecated:** use `strformat module <strformat.html>`_
|
||||
##
|
||||
proc round*[T: float32|float64](x: T, places: int): T {.deprecated: "use strformat module instead".} =
|
||||
## Decimal rounding on a binary floating point number.
|
||||
##
|
||||
## This function is NOT reliable. Floating point numbers cannot hold
|
||||
|
|
|
|||
|
|
@ -201,21 +201,17 @@ proc createNativeSocket*(domain: cint, sockType: cint,
|
|||
proc newNativeSocket*(domain: Domain = AF_INET,
|
||||
sockType: SockType = SOCK_STREAM,
|
||||
protocol: Protocol = IPPROTO_TCP): SocketHandle
|
||||
{.deprecated.} =
|
||||
{.deprecated: "deprecated since v0.18.0; use 'createNativeSocket' instead".} =
|
||||
## Creates a new socket; returns `osInvalidSocket` if an error occurs.
|
||||
##
|
||||
## **Deprecated since v0.18.0:** Use ``createNativeSocket`` instead.
|
||||
createNativeSocket(domain, sockType, protocol)
|
||||
|
||||
proc newNativeSocket*(domain: cint, sockType: cint,
|
||||
protocol: cint): SocketHandle
|
||||
{.deprecated.} =
|
||||
{.deprecated: "deprecated since v0.18.0; use 'createNativeSocket' instead".} =
|
||||
## Creates a new socket; returns `osInvalidSocket` if an error occurs.
|
||||
##
|
||||
## Use this overload if one of the enums specified above does
|
||||
## not contain what you need.
|
||||
##
|
||||
## **Deprecated since v0.18.0:** Use ``createNativeSocket`` instead.
|
||||
createNativeSocket(domain, sockType, protocol)
|
||||
|
||||
proc close*(socket: SocketHandle) =
|
||||
|
|
|
|||
|
|
@ -206,17 +206,15 @@ proc skipRandomNumbers*(s: var Rand) =
|
|||
s.a0 = s0
|
||||
s.a1 = s1
|
||||
|
||||
proc random*(max: int): int {.benign, deprecated.} =
|
||||
## **Deprecated since version 0.18.0:**
|
||||
## Use `rand(int)<#rand,int>`_ instead.
|
||||
proc random*(max: int): int {.benign, deprecated:
|
||||
"Deprecated since v0.18.0; use 'rand' istead".} =
|
||||
while true:
|
||||
let x = next(state)
|
||||
if x < randMax - (randMax mod ui(max)):
|
||||
return int(x mod uint64(max))
|
||||
|
||||
proc random*(max: float): float {.benign, deprecated.} =
|
||||
## **Deprecated since version 0.18.0:**
|
||||
## Use `rand(float)<#rand,float>`_ instead.
|
||||
proc random*(max: float): float {.benign, deprecated:
|
||||
"Deprecated since v0.18.0; use 'rand' istead".} =
|
||||
let x = next(state)
|
||||
when defined(JS):
|
||||
result = (float(x) / float(high(uint32))) * max
|
||||
|
|
@ -224,14 +222,12 @@ proc random*(max: float): float {.benign, deprecated.} =
|
|||
let u = (0x3FFu64 shl 52u64) or (x shr 12u64)
|
||||
result = (cast[float](u) - 1.0) * max
|
||||
|
||||
proc random*[T](x: HSlice[T, T]): T {.deprecated.} =
|
||||
## **Deprecated since version 0.18.0:**
|
||||
## Use `rand[T](HSlice[T, T])<#rand,HSlice[T,T]>`_ instead.
|
||||
proc random*[T](x: HSlice[T, T]): T {.deprecated:
|
||||
"Deprecated since v0.18.0; use 'rand' instead".} =
|
||||
result = T(random(x.b - x.a)) + x.a
|
||||
|
||||
proc random*[T](a: openArray[T]): T {.deprecated.} =
|
||||
## **Deprecated since version 0.18.0:**
|
||||
## Use `sample[T](openArray[T])<#sample,openArray[T]>`_ instead.
|
||||
proc random*[T](a: openArray[T]): T {.deprecated:
|
||||
"Deprecated since v0.18.0; use 'sample' instead".} =
|
||||
result = a[random(a.low..a.len)]
|
||||
|
||||
proc rand*(r: var Rand; max: Natural): int {.benign.} =
|
||||
|
|
@ -367,9 +363,8 @@ proc rand*[T: Ordinal or SomeFloat](x: HSlice[T, T]): T =
|
|||
doAssert rand(1..6) == 6
|
||||
result = rand(state, x)
|
||||
|
||||
proc rand*[T](r: var Rand; a: openArray[T]): T {.deprecated.} =
|
||||
## **Deprecated since version 0.20.0:**
|
||||
## Use `sample[T](Rand, openArray[T])<#sample,Rand,openArray[T]>`_ instead.
|
||||
proc rand*[T](r: var Rand; a: openArray[T]): T {.deprecated:
|
||||
"Deprecated since v0.20.0; use 'sample' instead".} =
|
||||
result = a[rand(r, a.low..a.high)]
|
||||
|
||||
proc rand*[T: SomeInteger](t: typedesc[T]): T =
|
||||
|
|
@ -401,9 +396,8 @@ proc rand*[T: SomeInteger](t: typedesc[T]): T =
|
|||
else:
|
||||
result = cast[T](state.next)
|
||||
|
||||
proc rand*[T](a: openArray[T]): T {.deprecated.} =
|
||||
## **Deprecated since version 0.20.0:**
|
||||
## Use `sample[T](openArray[T])<#sample,openArray[T]>`_ instead.
|
||||
proc rand*[T](a: openArray[T]): T {.deprecated:
|
||||
"Deprecated since v0.20.0; use 'sample' instead".} =
|
||||
result = a[rand(a.low..a.high)]
|
||||
|
||||
proc sample*[T](r: var Rand; s: set[T]): T =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue