remove deprecated stuff from the stdlib; introduce better deprecation warnings
This commit is contained in:
parent
608017801d
commit
bbb0fd4eb7
54 changed files with 44 additions and 287 deletions
|
|
@ -12,7 +12,7 @@ import sockets, strutils, parseutils, times, os, asyncio
|
||||||
|
|
||||||
from asyncnet import nil
|
from asyncnet import nil
|
||||||
from nativesockets import nil
|
from nativesockets import nil
|
||||||
from asyncdispatch import PFuture
|
from asyncdispatch import Future
|
||||||
## **Note**: This module is deprecated since version 0.11.3.
|
## **Note**: This module is deprecated since version 0.11.3.
|
||||||
## You should use the async version of this module
|
## You should use the async version of this module
|
||||||
## `asyncftpclient <asyncftpclient.html>`_.
|
## `asyncftpclient <asyncftpclient.html>`_.
|
||||||
|
|
|
||||||
|
|
@ -853,7 +853,6 @@ type
|
||||||
DirKind = enum # must be ordered alphabetically!
|
DirKind = enum # must be ordered alphabetically!
|
||||||
dkNone, dkAuthor, dkAuthors, dkCode, dkCodeBlock, dkContainer, dkContents,
|
dkNone, dkAuthor, dkAuthors, dkCode, dkCodeBlock, dkContainer, dkContents,
|
||||||
dkFigure, dkImage, dkInclude, dkIndex, dkRaw, dkTitle
|
dkFigure, dkImage, dkInclude, dkIndex, dkRaw, dkTitle
|
||||||
{.deprecated: [TDirKind: DirKind].}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
DirIds: array[0..12, string] = ["", "author", "authors", "code",
|
DirIds: array[0..12, string] = ["", "author", "authors", "code",
|
||||||
|
|
@ -1114,7 +1113,6 @@ proc parseHeadline(p: var RstParser): PRstNode =
|
||||||
|
|
||||||
type
|
type
|
||||||
IntSeq = seq[int]
|
IntSeq = seq[int]
|
||||||
{.deprecated: [TIntSeq: IntSeq].}
|
|
||||||
|
|
||||||
proc tokEnd(p: RstParser): int =
|
proc tokEnd(p: RstParser): int =
|
||||||
result = p.tok[p.idx].col + len(p.tok[p.idx].symbol) - 1
|
result = p.tok[p.idx].col + len(p.tok[p.idx].symbol) - 1
|
||||||
|
|
@ -1408,8 +1406,6 @@ type
|
||||||
hasArg, hasOptions, argIsFile, argIsWord
|
hasArg, hasOptions, argIsFile, argIsWord
|
||||||
DirFlags = set[DirFlag]
|
DirFlags = set[DirFlag]
|
||||||
SectionParser = proc (p: var RstParser): PRstNode {.nimcall.}
|
SectionParser = proc (p: var RstParser): PRstNode {.nimcall.}
|
||||||
{.deprecated: [TDirFlag: DirFlag, TDirFlags: DirFlags,
|
|
||||||
TSectionParser: SectionParser].}
|
|
||||||
|
|
||||||
proc parseDirective(p: var RstParser, flags: DirFlags): PRstNode =
|
proc parseDirective(p: var RstParser, flags: DirFlags): PRstNode =
|
||||||
## Parses arguments and options for a directive block.
|
## Parses arguments and options for a directive block.
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,6 @@ type
|
||||||
## the document or the section
|
## the document or the section
|
||||||
level*: int ## valid for some node kinds
|
level*: int ## valid for some node kinds
|
||||||
sons*: RstNodeSeq ## the node's sons
|
sons*: RstNodeSeq ## the node's sons
|
||||||
{.deprecated: [TRstNodeKind: RstNodeKind, TRstNodeSeq: RstNodeSeq,
|
|
||||||
TRstNode: RstNode].}
|
|
||||||
|
|
||||||
proc len*(n: PRstNode): int =
|
proc len*(n: PRstNode): int =
|
||||||
result = len(n.sons)
|
result = len(n.sons)
|
||||||
|
|
@ -99,7 +97,6 @@ type
|
||||||
RenderContext {.pure.} = object
|
RenderContext {.pure.} = object
|
||||||
indent: int
|
indent: int
|
||||||
verbatim: int
|
verbatim: int
|
||||||
{.deprecated: [TRenderContext: RenderContext].}
|
|
||||||
|
|
||||||
proc renderRstToRst(d: var RenderContext, n: PRstNode,
|
proc renderRstToRst(d: var RenderContext, n: PRstNode,
|
||||||
result: var string) {.gcsafe.}
|
result: var string) {.gcsafe.}
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,6 @@ type
|
||||||
SortOrder* = enum ## sort order
|
SortOrder* = enum ## sort order
|
||||||
Descending, Ascending
|
Descending, Ascending
|
||||||
|
|
||||||
{.deprecated: [TSortOrder: SortOrder].}
|
|
||||||
|
|
||||||
|
|
||||||
proc `*`*(x: int, order: SortOrder): int {.inline.} =
|
proc `*`*(x: int, order: SortOrder): int {.inline.} =
|
||||||
## flips `x` if ``order == Descending``;
|
## flips `x` if ``order == Descending``;
|
||||||
## if ``order == Ascending`` then `x` is returned.
|
## if ``order == Ascending`` then `x` is returned.
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ type
|
||||||
FutureError* = object of Exception
|
FutureError* = object of Exception
|
||||||
cause*: FutureBase
|
cause*: FutureBase
|
||||||
|
|
||||||
{.deprecated: [PFutureBase: FutureBase, PFuture: Future].}
|
|
||||||
|
|
||||||
when not defined(release):
|
when not defined(release):
|
||||||
var currentID = 0
|
var currentID = 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,6 @@ type
|
||||||
reusePort: bool
|
reusePort: bool
|
||||||
maxBody: int ## The maximum content-length that will be read for the body.
|
maxBody: int ## The maximum content-length that will be read for the body.
|
||||||
|
|
||||||
{.deprecated: [TRequest: Request, PAsyncHttpServer: AsyncHttpServer,
|
|
||||||
THttpCode: HttpCode, THttpVersion: HttpVersion].}
|
|
||||||
|
|
||||||
proc newAsyncHttpServer*(reuseAddr = true, reusePort = false,
|
proc newAsyncHttpServer*(reuseAddr = true, reusePort = false,
|
||||||
maxBody = 8388608): AsyncHttpServer =
|
maxBody = 8388608): AsyncHttpServer =
|
||||||
## Creates a new ``AsyncHttpServer`` instance.
|
## Creates a new ``AsyncHttpServer`` instance.
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,6 @@ type
|
||||||
protocol: Protocol
|
protocol: Protocol
|
||||||
AsyncSocket* = ref AsyncSocketDesc
|
AsyncSocket* = ref AsyncSocketDesc
|
||||||
|
|
||||||
{.deprecated: [PAsyncSocket: AsyncSocket].}
|
|
||||||
|
|
||||||
proc newAsyncSocket*(fd: AsyncFD, domain: Domain = AF_INET,
|
proc newAsyncSocket*(fd: AsyncFD, domain: Domain = AF_INET,
|
||||||
sockType: SockType = SOCK_STREAM,
|
sockType: SockType = SOCK_STREAM,
|
||||||
protocol: Protocol = IPPROTO_TCP, buffered = true): AsyncSocket =
|
protocol: Protocol = IPPROTO_TCP, buffered = true): AsyncSocket =
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,6 @@ type
|
||||||
methodPost, ## query uses the POST method
|
methodPost, ## query uses the POST method
|
||||||
methodGet ## query uses the GET method
|
methodGet ## query uses the GET method
|
||||||
|
|
||||||
{.deprecated: [TRequestMethod: RequestMethod, ECgi: CgiError].}
|
|
||||||
|
|
||||||
proc cgiError*(msg: string) {.noreturn.} =
|
proc cgiError*(msg: string) {.noreturn.} =
|
||||||
## raises an ECgi exception with message `msg`.
|
## raises an ECgi exception with message `msg`.
|
||||||
var e: ref CgiError
|
var e: ref CgiError
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@ import strutils
|
||||||
type
|
type
|
||||||
Color* = distinct int ## a color stored as RGB
|
Color* = distinct int ## a color stored as RGB
|
||||||
|
|
||||||
{.deprecated: [TColor: Color].}
|
|
||||||
|
|
||||||
proc `==` *(a, b: Color): bool {.borrow.}
|
proc `==` *(a, b: Color): bool {.borrow.}
|
||||||
## compares two colors.
|
## compares two colors.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ type
|
||||||
Complex* = tuple[re, im: float]
|
Complex* = tuple[re, im: float]
|
||||||
## a complex number, consisting of a real and an imaginary part
|
## a complex number, consisting of a real and an imaginary part
|
||||||
|
|
||||||
{.deprecated: [TComplex: Complex].}
|
|
||||||
|
|
||||||
proc toComplex*(x: SomeInteger): Complex =
|
proc toComplex*(x: SomeInteger): Complex =
|
||||||
## Convert some integer ``x`` to a complex number.
|
## Convert some integer ``x`` to a complex number.
|
||||||
result.re = x
|
result.re = x
|
||||||
|
|
|
||||||
|
|
@ -83,9 +83,6 @@ type
|
||||||
foreignKey*: bool ## is this a foreign key?
|
foreignKey*: bool ## is this a foreign key?
|
||||||
DbColumns* = seq[DbColumn]
|
DbColumns* = seq[DbColumn]
|
||||||
|
|
||||||
{.deprecated: [EDb: DbError, TSqlQuery: SqlQuery, FDb: DbEffect,
|
|
||||||
FReadDb: ReadDbEffect, FWriteDb: WriteDbEffect].}
|
|
||||||
|
|
||||||
template sql*(query: string): SqlQuery =
|
template sql*(query: string): SqlQuery =
|
||||||
## constructs a SqlQuery from the string `query`. This is supposed to be
|
## constructs a SqlQuery from the string `query`. This is supposed to be
|
||||||
## used as a raw-string-literal modifier:
|
## used as a raw-string-literal modifier:
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,6 @@ import strutils
|
||||||
type
|
type
|
||||||
LibHandle* = pointer ## a handle to a dynamically loaded library
|
LibHandle* = pointer ## a handle to a dynamically loaded library
|
||||||
|
|
||||||
{.deprecated: [TLibHandle: LibHandle].}
|
|
||||||
|
|
||||||
proc loadLib*(path: string, global_symbols=false): LibHandle {.gcsafe.}
|
proc loadLib*(path: string, global_symbols=false): LibHandle {.gcsafe.}
|
||||||
## loads a library from `path`. Returns nil if the library could not
|
## loads a library from `path`. Returns nil if the library could not
|
||||||
## be loaded.
|
## be loaded.
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ type
|
||||||
EncodingError* = object of ValueError ## exception that is raised
|
EncodingError* = object of ValueError ## exception that is raised
|
||||||
## for encoding errors
|
## for encoding errors
|
||||||
|
|
||||||
{.deprecated: [EInvalidEncoding: EncodingError, PConverter: EncodingConverter].}
|
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
proc eqEncodingNames(a, b: string): bool =
|
proc eqEncodingNames(a, b: string): bool =
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,6 @@ type
|
||||||
s: seq[EventHandler]
|
s: seq[EventHandler]
|
||||||
EventError* = object of ValueError
|
EventError* = object of ValueError
|
||||||
|
|
||||||
{.deprecated: [TEventArgs: EventArgs, TEventHandler: EventHandler,
|
|
||||||
TEventEmitter: EventEmitter, EInvalidEvent: EventError].}
|
|
||||||
|
|
||||||
proc initEventHandler*(name: string): EventHandler =
|
proc initEventHandler*(name: string): EventHandler =
|
||||||
## Initializes an EventHandler with the specified name and returns it.
|
## Initializes an EventHandler with the specified name and returns it.
|
||||||
result.handlers = @[]
|
result.handlers = @[]
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ type
|
||||||
Hash* = int ## a hash value; hash tables using these values should
|
Hash* = int ## a hash value; hash tables using these values should
|
||||||
## always have a size of a power of two and can use the ``and``
|
## always have a size of a power of two and can use the ``and``
|
||||||
## operator instead of ``mod`` for truncation of the hash value.
|
## operator instead of ``mod`` for truncation of the hash value.
|
||||||
{.deprecated: [THash: Hash].}
|
|
||||||
|
|
||||||
proc `!&`*(h: Hash, val: int): Hash {.inline.} =
|
proc `!&`*(h: Hash, val: int): Hash {.inline.} =
|
||||||
## mixes a hash value `h` with `val` to produce a new hash value. This is
|
## mixes a hash value `h` with `val` to produce a new hash value. This is
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,6 @@ type
|
||||||
tagVar, ## the HTML ``var`` element
|
tagVar, ## the HTML ``var`` element
|
||||||
tagVideo, ## the HTML ``video`` element
|
tagVideo, ## the HTML ``video`` element
|
||||||
tagWbr ## the HTML ``wbr`` element
|
tagWbr ## the HTML ``wbr`` element
|
||||||
{.deprecated: [THtmlTag: HtmlTag].}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
tagToStr* = [
|
tagToStr* = [
|
||||||
|
|
|
||||||
|
|
@ -219,10 +219,6 @@ type
|
||||||
## and ``postContent`` proc,
|
## and ``postContent`` proc,
|
||||||
## when the server returns an error
|
## when the server returns an error
|
||||||
|
|
||||||
{.deprecated: [TResponse: Response, PProxy: Proxy,
|
|
||||||
EInvalidProtocol: ProtocolError, EHttpRequestErr: HttpRequestError
|
|
||||||
].}
|
|
||||||
|
|
||||||
const defUserAgent* = "Nim httpclient/" & NimVersion
|
const defUserAgent* = "Nim httpclient/" & NimVersion
|
||||||
|
|
||||||
proc httpError(msg: string) =
|
proc httpError(msg: string) =
|
||||||
|
|
@ -362,8 +358,6 @@ proc parseResponse(s: Socket, getBody: bool, timeout: int): Response =
|
||||||
else:
|
else:
|
||||||
result.body = ""
|
result.body = ""
|
||||||
|
|
||||||
{.deprecated: [THttpMethod: HttpMethod].}
|
|
||||||
|
|
||||||
when not defined(ssl):
|
when not defined(ssl):
|
||||||
type SSLContext = ref object
|
type SSLContext = ref object
|
||||||
var defaultSSLContext {.threadvar.}: SSLContext
|
var defaultSSLContext {.threadvar.}: SSLContext
|
||||||
|
|
@ -585,7 +579,7 @@ proc request*(url: string, httpMethod: string, extraHeaders = "",
|
||||||
|
|
||||||
result = parseResponse(s, httpMethod != "HEAD", timeout)
|
result = parseResponse(s, httpMethod != "HEAD", timeout)
|
||||||
|
|
||||||
proc request*(url: string, httpMethod = httpGET, extraHeaders = "",
|
proc request*(url: string, httpMethod = HttpGET, extraHeaders = "",
|
||||||
body = "", sslContext = defaultSSLContext, timeout = -1,
|
body = "", sslContext = defaultSSLContext, timeout = -1,
|
||||||
userAgent = defUserAgent, proxy: Proxy = nil): Response
|
userAgent = defUserAgent, proxy: Proxy = nil): Response
|
||||||
{.deprecated.} =
|
{.deprecated.} =
|
||||||
|
|
@ -627,13 +621,13 @@ proc get*(url: string, extraHeaders = "", maxRedirects = 5,
|
||||||
## server takes longer than specified an ETimeout exception will be raised.
|
## server takes longer than specified an ETimeout exception will be raised.
|
||||||
##
|
##
|
||||||
## **Deprecated since version 0.15.0**: use ``HttpClient.get`` instead.
|
## **Deprecated since version 0.15.0**: use ``HttpClient.get`` instead.
|
||||||
result = request(url, httpGET, extraHeaders, "", sslContext, timeout,
|
result = request(url, HttpGET, extraHeaders, "", sslContext, timeout,
|
||||||
userAgent, proxy)
|
userAgent, proxy)
|
||||||
var lastURL = url
|
var lastURL = url
|
||||||
for i in 1..maxRedirects:
|
for i in 1..maxRedirects:
|
||||||
if result.status.redirection():
|
if result.status.redirection():
|
||||||
let redirectTo = getNewLocation(lastURL, result.headers)
|
let redirectTo = getNewLocation(lastURL, result.headers)
|
||||||
result = request(redirectTo, httpGET, extraHeaders, "", sslContext,
|
result = request(redirectTo, HttpGET, extraHeaders, "", sslContext,
|
||||||
timeout, userAgent, proxy)
|
timeout, userAgent, proxy)
|
||||||
lastURL = redirectTo
|
lastURL = redirectTo
|
||||||
|
|
||||||
|
|
@ -687,13 +681,13 @@ proc post*(url: string, extraHeaders = "", body = "",
|
||||||
if not multipart.isNil:
|
if not multipart.isNil:
|
||||||
xh.add(withNewLine("Content-Type: " & mpContentType))
|
xh.add(withNewLine("Content-Type: " & mpContentType))
|
||||||
|
|
||||||
result = request(url, httpPOST, xh, xb, sslContext, timeout, userAgent,
|
result = request(url, HttpPOST, xh, xb, sslContext, timeout, userAgent,
|
||||||
proxy)
|
proxy)
|
||||||
var lastURL = url
|
var lastURL = url
|
||||||
for i in 1..maxRedirects:
|
for i in 1..maxRedirects:
|
||||||
if result.status.redirection():
|
if result.status.redirection():
|
||||||
let redirectTo = getNewLocation(lastURL, result.headers)
|
let redirectTo = getNewLocation(lastURL, result.headers)
|
||||||
var meth = if result.status != "307": httpGet else: httpPost
|
var meth = if result.status != "307": HttpGet else: HttpPost
|
||||||
result = request(redirectTo, meth, xh, xb, sslContext, timeout,
|
result = request(redirectTo, meth, xh, xb, sslContext, timeout,
|
||||||
userAgent, proxy)
|
userAgent, proxy)
|
||||||
lastURL = redirectTo
|
lastURL = redirectTo
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,6 @@ type
|
||||||
## TCP/IP tunnel, usually used for proxies.
|
## TCP/IP tunnel, usually used for proxies.
|
||||||
HttpPatch ## Applies partial modifications to a resource.
|
HttpPatch ## Applies partial modifications to a resource.
|
||||||
|
|
||||||
{.deprecated: [httpGet: HttpGet, httpHead: HttpHead, httpPost: HttpPost,
|
|
||||||
httpPut: HttpPut, httpDelete: HttpDelete, httpTrace: HttpTrace,
|
|
||||||
httpOptions: HttpOptions, httpConnect: HttpConnect].}
|
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
Http100* = HttpCode(100)
|
Http100* = HttpCode(100)
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ when false:
|
||||||
# TODO: Fix this, or get rid of it.
|
# TODO: Fix this, or get rid of it.
|
||||||
type
|
type
|
||||||
RequestMethod = enum reqGet, reqPost
|
RequestMethod = enum reqGet, reqPost
|
||||||
{.deprecated: [TRequestMethod: RequestMethod].}
|
|
||||||
|
|
||||||
proc executeCgi(client: Socket, path, query: string, meth: RequestMethod) =
|
proc executeCgi(client: Socket, path, query: string, meth: RequestMethod) =
|
||||||
var env = newStringTable(modeCaseInsensitive)
|
var env = newStringTable(modeCaseInsensitive)
|
||||||
|
|
@ -225,7 +224,6 @@ type
|
||||||
PAsyncHTTPServer* = ref AsyncHTTPServer
|
PAsyncHTTPServer* = ref AsyncHTTPServer
|
||||||
AsyncHTTPServer = object of Server
|
AsyncHTTPServer = object of Server
|
||||||
asyncSocket: AsyncSocket
|
asyncSocket: AsyncSocket
|
||||||
{.deprecated: [TAsyncHTTPServer: AsyncHTTPServer, TServer: Server].}
|
|
||||||
|
|
||||||
proc open*(s: var Server, port = Port(80), reuseAddr = false) =
|
proc open*(s: var Server, port = Port(80), reuseAddr = false) =
|
||||||
## creates a new server at port `port`. If ``port == 0`` a free port is
|
## creates a new server at port `port`. If ``port == 0`` a free port is
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,13 @@ proc createAsyncNativeSocket*(domain: Domain = Domain.AF_INET,
|
||||||
createAsyncNativeSocketImpl(domain, sockType, protocol)
|
createAsyncNativeSocketImpl(domain, sockType, protocol)
|
||||||
|
|
||||||
proc newAsyncNativeSocket*(domain: cint, sockType: cint,
|
proc newAsyncNativeSocket*(domain: cint, sockType: cint,
|
||||||
protocol: cint): AsyncFD {.deprecated.} =
|
protocol: cint): AsyncFD {.deprecated: "use createAsyncNativeSocket instead".} =
|
||||||
createAsyncNativeSocketImpl(domain, sockType, protocol)
|
createAsyncNativeSocketImpl(domain, sockType, protocol)
|
||||||
|
|
||||||
proc newAsyncNativeSocket*(domain: Domain = Domain.AF_INET,
|
proc newAsyncNativeSocket*(domain: Domain = Domain.AF_INET,
|
||||||
sockType: SockType = SOCK_STREAM,
|
sockType: SockType = SOCK_STREAM,
|
||||||
protocol: Protocol = IPPROTO_TCP): AsyncFD
|
protocol: Protocol = IPPROTO_TCP): AsyncFD
|
||||||
{.deprecated.} =
|
{.deprecated: "use createAsyncNativeSocket instead".} =
|
||||||
createAsyncNativeSocketImpl(domain, sockType, protocol)
|
createAsyncNativeSocketImpl(domain, sockType, protocol)
|
||||||
|
|
||||||
when defined(windows) or defined(nimdoc):
|
when defined(windows) or defined(nimdoc):
|
||||||
|
|
|
||||||
|
|
@ -12,50 +12,6 @@ when not defined(nimscript):
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
import winlean
|
import winlean
|
||||||
|
|
||||||
proc osErrorMsg*(): string {.rtl, extern: "nos$1", deprecated.} =
|
|
||||||
## Retrieves the operating system's error flag, ``errno``.
|
|
||||||
## On Windows ``GetLastError`` is checked before ``errno``.
|
|
||||||
## Returns "" if no error occurred.
|
|
||||||
##
|
|
||||||
## **Deprecated since version 0.9.4**: use the other ``osErrorMsg`` proc.
|
|
||||||
|
|
||||||
result = ""
|
|
||||||
when defined(Windows) and not defined(nimscript):
|
|
||||||
var err = getLastError()
|
|
||||||
if err != 0'i32:
|
|
||||||
when useWinUnicode:
|
|
||||||
var msgbuf: WideCString
|
|
||||||
if formatMessageW(0x00000100 or 0x00001000 or 0x00000200 or 0x000000FF,
|
|
||||||
nil, err, 0, addr(msgbuf), 0, nil) != 0'i32:
|
|
||||||
result = $msgbuf
|
|
||||||
if msgbuf != nil: localFree(cast[pointer](msgbuf))
|
|
||||||
else:
|
|
||||||
var msgbuf: cstring
|
|
||||||
if formatMessageA(0x00000100 or 0x00001000 or 0x00000200 or 0x000000FF,
|
|
||||||
nil, err, 0, addr(msgbuf), 0, nil) != 0'i32:
|
|
||||||
result = $msgbuf
|
|
||||||
if msgbuf != nil: localFree(msgbuf)
|
|
||||||
when not defined(nimscript):
|
|
||||||
if errno != 0'i32:
|
|
||||||
result = $c_strerror(errno)
|
|
||||||
|
|
||||||
{.push warning[deprecated]: off.}
|
|
||||||
proc raiseOSError*(msg: string = "") {.noinline, rtl, extern: "nos$1",
|
|
||||||
deprecated.} =
|
|
||||||
## raises an OSError exception with the given message ``msg``.
|
|
||||||
## If ``msg == ""``, the operating system's error flag
|
|
||||||
## (``errno``) is converted to a readable error message. On Windows
|
|
||||||
## ``GetLastError`` is checked before ``errno``.
|
|
||||||
## If no error flag is set, the message ``unknown OS error`` is used.
|
|
||||||
##
|
|
||||||
## **Deprecated since version 0.9.4**: use the other ``raiseOSError`` proc.
|
|
||||||
if len(msg) == 0:
|
|
||||||
var m = osErrorMsg()
|
|
||||||
raise newException(OSError, if m.len > 0: m else: "unknown OS error")
|
|
||||||
else:
|
|
||||||
raise newException(OSError, msg)
|
|
||||||
{.pop.}
|
|
||||||
|
|
||||||
proc `==`*(err1, err2: OSErrorCode): bool {.borrow.}
|
proc `==`*(err1, err2: OSErrorCode): bool {.borrow.}
|
||||||
proc `$`*(err: OSErrorCode): string {.borrow.}
|
proc `$`*(err: OSErrorCode): string {.borrow.}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,9 +158,6 @@ type
|
||||||
JsonKindError* = object of ValueError ## raised by the ``to`` macro if the
|
JsonKindError* = object of ValueError ## raised by the ``to`` macro if the
|
||||||
## JSON kind is incorrect.
|
## JSON kind is incorrect.
|
||||||
|
|
||||||
{.deprecated: [TJsonEventKind: JsonEventKind, TJsonError: JsonError,
|
|
||||||
TJsonParser: JsonParser, TTokKind: TokKind].}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
errorMessages: array[JsonError, string] = [
|
errorMessages: array[JsonError, string] = [
|
||||||
"no error",
|
"no error",
|
||||||
|
|
@ -622,9 +619,6 @@ type
|
||||||
|
|
||||||
JsonParsingError* = object of ValueError ## is raised for a JSON error
|
JsonParsingError* = object of ValueError ## is raised for a JSON error
|
||||||
|
|
||||||
{.deprecated: [EJsonParsingError: JsonParsingError, TJsonNode: JsonNodeObj,
|
|
||||||
PJsonNode: JsonNode, TJsonNodeKind: JsonNodeKind].}
|
|
||||||
|
|
||||||
proc raiseParseErr*(p: JsonParser, msg: string) {.noinline, noreturn.} =
|
proc raiseParseErr*(p: JsonParser, msg: string) {.noinline, noreturn.} =
|
||||||
## raises an `EJsonParsingError` exception.
|
## raises an `EJsonParsingError` exception.
|
||||||
raise newException(JsonParsingError, errorMsgExpected(p, msg))
|
raise newException(JsonParsingError, errorMsgExpected(p, msg))
|
||||||
|
|
@ -695,7 +689,7 @@ proc getBiggestInt*(n: JsonNode, default: BiggestInt = 0): BiggestInt =
|
||||||
if n.isNil or n.kind != JInt: return default
|
if n.isNil or n.kind != JInt: return default
|
||||||
else: return n.num
|
else: return n.num
|
||||||
|
|
||||||
proc getNum*(n: JsonNode, default: BiggestInt = 0): BiggestInt {.deprecated.} =
|
proc getNum*(n: JsonNode, default: BiggestInt = 0): BiggestInt {.deprecated: "use getInt or getBiggestInt instead".} =
|
||||||
## **Deprecated since v0.18.2:** use ``getInt`` or ``getBiggestInt`` instead.
|
## **Deprecated since v0.18.2:** use ``getInt`` or ``getBiggestInt`` instead.
|
||||||
getBiggestInt(n, default)
|
getBiggestInt(n, default)
|
||||||
|
|
||||||
|
|
@ -709,7 +703,7 @@ proc getFloat*(n: JsonNode, default: float = 0.0): float =
|
||||||
of JInt: return float(n.num)
|
of JInt: return float(n.num)
|
||||||
else: return default
|
else: return default
|
||||||
|
|
||||||
proc getFNum*(n: JsonNode, default: float = 0.0): float {.deprecated.} =
|
proc getFNum*(n: JsonNode, default: float = 0.0): float {.deprecated: "use getFloat instead".} =
|
||||||
## **Deprecated since v0.18.2:** use ``getFloat`` instead.
|
## **Deprecated since v0.18.2:** use ``getFloat`` instead.
|
||||||
getFloat(n, default)
|
getFloat(n, default)
|
||||||
|
|
||||||
|
|
@ -720,7 +714,7 @@ proc getBool*(n: JsonNode, default: bool = false): bool =
|
||||||
if n.isNil or n.kind != JBool: return default
|
if n.isNil or n.kind != JBool: return default
|
||||||
else: return n.bval
|
else: return n.bval
|
||||||
|
|
||||||
proc getBVal*(n: JsonNode, default: bool = false): bool {.deprecated.} =
|
proc getBVal*(n: JsonNode, default: bool = false): bool {.deprecated: "use getBool instead".} =
|
||||||
## **Deprecated since v0.18.2:** use ``getBool`` instead.
|
## **Deprecated since v0.18.2:** use ``getBool`` instead.
|
||||||
getBool(n, default)
|
getBool(n, default)
|
||||||
|
|
||||||
|
|
@ -946,7 +940,7 @@ proc contains*(node: JsonNode, val: JsonNode): bool =
|
||||||
assert(node.kind == JArray)
|
assert(node.kind == JArray)
|
||||||
find(node.elems, val) >= 0
|
find(node.elems, val) >= 0
|
||||||
|
|
||||||
proc existsKey*(node: JsonNode, key: string): bool {.deprecated.} = node.hasKey(key)
|
proc existsKey*(node: JsonNode, key: string): bool {.deprecated: "use hasKey instead".} = node.hasKey(key)
|
||||||
## **Deprecated:** use `hasKey` instead.
|
## **Deprecated:** use `hasKey` instead.
|
||||||
|
|
||||||
proc `[]=`*(obj: JsonNode, key: string, val: JsonNode) {.inline.} =
|
proc `[]=`*(obj: JsonNode, key: string, val: JsonNode) {.inline.} =
|
||||||
|
|
@ -1277,7 +1271,6 @@ else:
|
||||||
from math import `mod`
|
from math import `mod`
|
||||||
type
|
type
|
||||||
JSObject = object
|
JSObject = object
|
||||||
{.deprecated: [TJSObject: JSObject].}
|
|
||||||
|
|
||||||
proc parseNativeJson(x: cstring): JSObject {.importc: "JSON.parse".}
|
proc parseNativeJson(x: cstring): JSObject {.importc: "JSON.parse".}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,6 @@ type
|
||||||
offsetBase*: int # use ``offsetBase + bufpos`` to get the offset
|
offsetBase*: int # use ``offsetBase + bufpos`` to get the offset
|
||||||
refillChars: set[char]
|
refillChars: set[char]
|
||||||
|
|
||||||
{.deprecated: [TBaseLexer: BaseLexer].}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
chrSize = sizeof(char)
|
chrSize = sizeof(char)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,10 +96,6 @@ when not defined(js):
|
||||||
logFiles: int # how many log files already created, e.g. basename.1, basename.2...
|
logFiles: int # how many log files already created, e.g. basename.1, basename.2...
|
||||||
bufSize: int # size of output buffer (-1: use system defaults, 0: unbuffered, >0: fixed buffer size)
|
bufSize: int # size of output buffer (-1: use system defaults, 0: unbuffered, >0: fixed buffer size)
|
||||||
|
|
||||||
{.deprecated: [PFileLogger: FileLogger, PRollingFileLogger: RollingFileLogger].}
|
|
||||||
|
|
||||||
{.deprecated: [TLevel: Level, PLogger: Logger, PConsoleLogger: ConsoleLogger].}
|
|
||||||
|
|
||||||
var
|
var
|
||||||
level {.threadvar.}: Level ## global log filter
|
level {.threadvar.}: Level ## global log filter
|
||||||
handlers {.threadvar.}: seq[Logger] ## handlers with their own log levels
|
handlers {.threadvar.}: seq[Logger] ## handlers with their own log levels
|
||||||
|
|
|
||||||
|
|
@ -309,7 +309,6 @@ when not defined(testing) and isMainModule:
|
||||||
Node = object
|
Node = object
|
||||||
next, prev: PNode
|
next, prev: PNode
|
||||||
data: string
|
data: string
|
||||||
{.deprecated: [TNode: Node].}
|
|
||||||
|
|
||||||
proc buildList(): PNode =
|
proc buildList(): PNode =
|
||||||
new(result)
|
new(result)
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,6 @@ type
|
||||||
else:
|
else:
|
||||||
handle: cint
|
handle: cint
|
||||||
|
|
||||||
{.deprecated: [TMemFile: MemFile].}
|
|
||||||
|
|
||||||
proc mapMem*(m: var MemFile, mode: FileMode = fmRead,
|
proc mapMem*(m: var MemFile, mode: FileMode = fmRead,
|
||||||
mappedSize = -1, offset = 0): pointer =
|
mappedSize = -1, offset = 0): pointer =
|
||||||
## returns a pointer to a mapped portion of MemFile `m`
|
## returns a pointer to a mapped portion of MemFile `m`
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ type
|
||||||
mt: array[0..623, uint32]
|
mt: array[0..623, uint32]
|
||||||
index: int
|
index: int
|
||||||
|
|
||||||
{.deprecated: [TMersenneTwister: MersenneTwister].}
|
|
||||||
|
|
||||||
proc newMersenneTwister*(seed: uint32): MersenneTwister =
|
proc newMersenneTwister*(seed: uint32): MersenneTwister =
|
||||||
result.index = 0
|
result.index = 0
|
||||||
result.mt[0] = seed
|
result.mt[0] = seed
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ type
|
||||||
MimeDB* = object
|
MimeDB* = object
|
||||||
mimes: StringTableRef
|
mimes: StringTableRef
|
||||||
|
|
||||||
{.deprecated: [TMimeDB: MimeDB].}
|
|
||||||
|
|
||||||
const mimes* = {
|
const mimes* = {
|
||||||
"ez": "application/andrew-inset",
|
"ez": "application/andrew-inset",
|
||||||
"anx": "application/annodex",
|
"anx": "application/annodex",
|
||||||
|
|
|
||||||
|
|
@ -85,9 +85,6 @@ type
|
||||||
length*: int
|
length*: int
|
||||||
addrList*: seq[string]
|
addrList*: seq[string]
|
||||||
|
|
||||||
{.deprecated: [TPort: Port, TDomain: Domain, TType: SockType,
|
|
||||||
TProtocol: Protocol, TServent: Servent, THostent: Hostent].}
|
|
||||||
|
|
||||||
when useWinVersion:
|
when useWinVersion:
|
||||||
let
|
let
|
||||||
osInvalidSocket* = winlean.INVALID_SOCKET
|
osInvalidSocket* = winlean.INVALID_SOCKET
|
||||||
|
|
@ -640,7 +637,7 @@ proc pruneSocketSet(s: var seq[SocketHandle], fd: var TFdSet) =
|
||||||
inc(i)
|
inc(i)
|
||||||
setLen(s, L)
|
setLen(s, L)
|
||||||
|
|
||||||
proc select*(readfds: var seq[SocketHandle], timeout = 500): int {.deprecated.} =
|
proc select*(readfds: var seq[SocketHandle], timeout = 500): int {.deprecated: "use selectRead instead".} =
|
||||||
## When a socket in ``readfds`` is ready to be read from then a non-zero
|
## When a socket in ``readfds`` is ready to be read from then a non-zero
|
||||||
## value will be returned specifying the count of the sockets which can be
|
## value will be returned specifying the count of the sockets which can be
|
||||||
## read from. The sockets which can be read from will also be removed
|
## read from. The sockets which can be read from will also be removed
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,6 @@ when defineSsl:
|
||||||
serverGetPskFunc: SslServerGetPskFunc
|
serverGetPskFunc: SslServerGetPskFunc
|
||||||
clientGetPskFunc: SslClientGetPskFunc
|
clientGetPskFunc: SslClientGetPskFunc
|
||||||
|
|
||||||
{.deprecated: [ESSL: SSLError, TSSLCVerifyMode: SSLCVerifyMode,
|
|
||||||
TSSLProtVersion: SSLProtVersion, PSSLContext: SSLContext,
|
|
||||||
TSSLAcceptResult: SSLAcceptResult].}
|
|
||||||
else:
|
else:
|
||||||
type
|
type
|
||||||
SslContext* = void # TODO: Workaround #4797.
|
SslContext* = void # TODO: Workaround #4797.
|
||||||
|
|
@ -159,10 +156,6 @@ type
|
||||||
Peek,
|
Peek,
|
||||||
SafeDisconn ## Ensures disconnection exceptions (ECONNRESET, EPIPE etc) are not thrown.
|
SafeDisconn ## Ensures disconnection exceptions (ECONNRESET, EPIPE etc) are not thrown.
|
||||||
|
|
||||||
{.deprecated: [TSocketFlags: SocketFlag, ETimeout: TimeoutError,
|
|
||||||
TReadLineResult: ReadLineResult, TSOBool: SOBool, PSocket: Socket,
|
|
||||||
TSocketImpl: SocketImpl].}
|
|
||||||
|
|
||||||
type
|
type
|
||||||
IpAddressFamily* {.pure.} = enum ## Describes the type of an IP address
|
IpAddressFamily* {.pure.} = enum ## Describes the type of an IP address
|
||||||
IPv6, ## IPv6 address
|
IPv6, ## IPv6 address
|
||||||
|
|
@ -176,8 +169,6 @@ type
|
||||||
of IpAddressFamily.IPv4:
|
of IpAddressFamily.IPv4:
|
||||||
address_v4*: array[0..3, uint8] ## Contains the IP address in bytes in
|
address_v4*: array[0..3, uint8] ## Contains the IP address in bytes in
|
||||||
## case of IPv4
|
## case of IPv4
|
||||||
{.deprecated: [TIpAddress: IpAddress].}
|
|
||||||
|
|
||||||
|
|
||||||
proc socketError*(socket: Socket, err: int = -1, async = false,
|
proc socketError*(socket: Socket, err: int = -1, async = false,
|
||||||
lastError = (-1).OSErrorCode): void {.gcsafe.}
|
lastError = (-1).OSErrorCode): void {.gcsafe.}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ when not declared(system.StackTrace):
|
||||||
type StackTrace = object
|
type StackTrace = object
|
||||||
lines: array[0..20, cstring]
|
lines: array[0..20, cstring]
|
||||||
files: array[0..20, cstring]
|
files: array[0..20, cstring]
|
||||||
{.deprecated: [TStackTrace: StackTrace].}
|
|
||||||
proc `[]`*(st: StackTrace, i: int): cstring = st.lines[i]
|
proc `[]`*(st: StackTrace, i: int): cstring = st.lines[i]
|
||||||
|
|
||||||
# We use a simple hash table of bounded size to keep track of the stack traces:
|
# We use a simple hash table of bounded size to keep track of the stack traces:
|
||||||
|
|
@ -39,7 +38,6 @@ type
|
||||||
total: int
|
total: int
|
||||||
st: StackTrace
|
st: StackTrace
|
||||||
ProfileData = array[0..64*1024-1, ptr ProfileEntry]
|
ProfileData = array[0..64*1024-1, ptr ProfileEntry]
|
||||||
{.deprecated: [TProfileEntry: ProfileEntry, TProfileData: ProfileData].}
|
|
||||||
|
|
||||||
proc `==`(a, b: StackTrace): bool =
|
proc `==`(a, b: StackTrace): bool =
|
||||||
for i in 0 .. high(a.lines):
|
for i in 0 .. high(a.lines):
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ type
|
||||||
fuzz: int32 ##
|
fuzz: int32 ##
|
||||||
count: int32 ##
|
count: int32 ##
|
||||||
|
|
||||||
{.deprecated: [Toid: Oid].}
|
|
||||||
|
|
||||||
proc `==`*(oid1: Oid, oid2: Oid): bool =
|
proc `==`*(oid1: Oid, oid2: Oid): bool =
|
||||||
## Compare two Mongo Object IDs for equality
|
## Compare two Mongo Object IDs for equality
|
||||||
return (oid1.time == oid2.time) and (oid1.fuzz == oid2.fuzz) and (oid1.count == oid2.count)
|
return (oid1.time == oid2.time) and (oid1.fuzz == oid2.fuzz) and (oid1.count == oid2.count)
|
||||||
|
|
|
||||||
|
|
@ -431,8 +431,6 @@ type
|
||||||
fpOthersWrite, ## write access for others
|
fpOthersWrite, ## write access for others
|
||||||
fpOthersRead ## read access for others
|
fpOthersRead ## read access for others
|
||||||
|
|
||||||
{.deprecated: [TFilePermission: FilePermission].}
|
|
||||||
|
|
||||||
proc getFilePermissions*(filename: string): set[FilePermission] {.
|
proc getFilePermissions*(filename: string): set[FilePermission] {.
|
||||||
rtl, extern: "nos$1", tags: [ReadDirEffect].} =
|
rtl, extern: "nos$1", tags: [ReadDirEffect].} =
|
||||||
## retrieves file permissions for `filename`. `OSError` is raised in case of
|
## retrieves file permissions for `filename`. `OSError` is raised in case of
|
||||||
|
|
@ -730,8 +728,6 @@ type
|
||||||
pcDir, ## path refers to a directory
|
pcDir, ## path refers to a directory
|
||||||
pcLinkToDir ## path refers to a symbolic link to a directory
|
pcLinkToDir ## path refers to a symbolic link to a directory
|
||||||
|
|
||||||
{.deprecated: [TPathComponent: PathComponent].}
|
|
||||||
|
|
||||||
|
|
||||||
when defined(posix):
|
when defined(posix):
|
||||||
proc getSymlinkFileKind(path: string): PathComponent =
|
proc getSymlinkFileKind(path: string): PathComponent =
|
||||||
|
|
@ -1441,18 +1437,6 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect].} =
|
||||||
if result.len == 0:
|
if result.len == 0:
|
||||||
result = getApplHeuristic()
|
result = getApplHeuristic()
|
||||||
|
|
||||||
proc getApplicationFilename*(): string {.rtl, extern: "nos$1", deprecated.} =
|
|
||||||
## Returns the filename of the application's executable.
|
|
||||||
## **Deprecated since version 0.8.12**: use ``getAppFilename``
|
|
||||||
## instead.
|
|
||||||
result = getAppFilename()
|
|
||||||
|
|
||||||
proc getApplicationDir*(): string {.rtl, extern: "nos$1", deprecated.} =
|
|
||||||
## Returns the directory of the application's executable.
|
|
||||||
## **Deprecated since version 0.8.12**: use ``getAppDir``
|
|
||||||
## instead.
|
|
||||||
result = splitFile(getAppFilename()).dir
|
|
||||||
|
|
||||||
proc getAppDir*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect].} =
|
proc getAppDir*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect].} =
|
||||||
## Returns the directory of the application's executable.
|
## Returns the directory of the application's executable.
|
||||||
result = splitFile(getAppFilename()).dir
|
result = splitFile(getAppFilename()).dir
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,6 @@ type
|
||||||
|
|
||||||
OSErrorCode* = distinct int32 ## Specifies an OS Error Code.
|
OSErrorCode* = distinct int32 ## Specifies an OS Error Code.
|
||||||
|
|
||||||
{.deprecated: [FReadEnv: ReadEnvEffect, FWriteEnv: WriteEnvEffect,
|
|
||||||
FReadDir: ReadDirEffect,
|
|
||||||
FWriteDir: WriteDirEffect,
|
|
||||||
TOSErrorCode: OSErrorCode
|
|
||||||
].}
|
|
||||||
const
|
const
|
||||||
doslikeFileSystem* = defined(windows) or defined(OS2) or defined(DOS)
|
doslikeFileSystem* = defined(windows) or defined(OS2) or defined(DOS)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,6 @@ type
|
||||||
Process* = ref ProcessObj ## represents an operating system process
|
Process* = ref ProcessObj ## represents an operating system process
|
||||||
|
|
||||||
|
|
||||||
{.deprecated: [TProcess: ProcessObj, PProcess: Process,
|
|
||||||
TProcessOption: ProcessOption].}
|
|
||||||
|
|
||||||
const poUseShell* {.deprecated.} = poUsePath
|
const poUseShell* {.deprecated.} = poUsePath
|
||||||
## Deprecated alias for poUsePath.
|
## Deprecated alias for poUsePath.
|
||||||
|
|
||||||
|
|
@ -373,17 +370,15 @@ template streamAccess(p) =
|
||||||
when defined(Windows) and not defined(useNimRtl):
|
when defined(Windows) and not defined(useNimRtl):
|
||||||
# We need to implement a handle stream for Windows:
|
# We need to implement a handle stream for Windows:
|
||||||
type
|
type
|
||||||
PFileHandleStream = ref FileHandleStream
|
FileHandleStream = ref object of StreamObj
|
||||||
FileHandleStream = object of StreamObj
|
|
||||||
handle: Handle
|
handle: Handle
|
||||||
atTheEnd: bool
|
atTheEnd: bool
|
||||||
{.deprecated: [TFileHandleStream: FileHandleStream].}
|
|
||||||
|
|
||||||
proc hsClose(s: Stream) = discard # nothing to do here
|
proc hsClose(s: Stream) = discard # nothing to do here
|
||||||
proc hsAtEnd(s: Stream): bool = return PFileHandleStream(s).atTheEnd
|
proc hsAtEnd(s: Stream): bool = return FileHandleStream(s).atTheEnd
|
||||||
|
|
||||||
proc hsReadData(s: Stream, buffer: pointer, bufLen: int): int =
|
proc hsReadData(s: Stream, buffer: pointer, bufLen: int): int =
|
||||||
var s = PFileHandleStream(s)
|
var s = FileHandleStream(s)
|
||||||
if s.atTheEnd: return 0
|
if s.atTheEnd: return 0
|
||||||
var br: int32
|
var br: int32
|
||||||
var a = winlean.readFile(s.handle, buffer, bufLen.cint, addr br, nil)
|
var a = winlean.readFile(s.handle, buffer, bufLen.cint, addr br, nil)
|
||||||
|
|
@ -395,13 +390,13 @@ when defined(Windows) and not defined(useNimRtl):
|
||||||
result = br
|
result = br
|
||||||
|
|
||||||
proc hsWriteData(s: Stream, buffer: pointer, bufLen: int) =
|
proc hsWriteData(s: Stream, buffer: pointer, bufLen: int) =
|
||||||
var s = PFileHandleStream(s)
|
var s = FileHandleStream(s)
|
||||||
var bytesWritten: int32
|
var bytesWritten: int32
|
||||||
var a = winlean.writeFile(s.handle, buffer, bufLen.cint,
|
var a = winlean.writeFile(s.handle, buffer, bufLen.cint,
|
||||||
addr bytesWritten, nil)
|
addr bytesWritten, nil)
|
||||||
if a == 0: raiseOSError(osLastError())
|
if a == 0: raiseOSError(osLastError())
|
||||||
|
|
||||||
proc newFileHandleStream(handle: Handle): PFileHandleStream =
|
proc newFileHandleStream(handle: Handle): FileHandleStream =
|
||||||
new(result)
|
new(result)
|
||||||
result.handle = handle
|
result.handle = handle
|
||||||
result.closeImpl = hsClose
|
result.closeImpl = hsClose
|
||||||
|
|
@ -752,14 +747,14 @@ elif not defined(useNimRtl):
|
||||||
copyMem(result[i], addr(x[0]), x.len+1)
|
copyMem(result[i], addr(x[0]), x.len+1)
|
||||||
inc(i)
|
inc(i)
|
||||||
|
|
||||||
type StartProcessData = object
|
type
|
||||||
|
StartProcessData = object
|
||||||
sysCommand: string
|
sysCommand: string
|
||||||
sysArgs: cstringArray
|
sysArgs: cstringArray
|
||||||
sysEnv: cstringArray
|
sysEnv: cstringArray
|
||||||
workingDir: cstring
|
workingDir: cstring
|
||||||
pStdin, pStdout, pStderr, pErrorPipe: array[0..1, cint]
|
pStdin, pStdout, pStderr, pErrorPipe: array[0..1, cint]
|
||||||
options: set[ProcessOption]
|
options: set[ProcessOption]
|
||||||
{.deprecated: [TStartProcessData: StartProcessData].}
|
|
||||||
|
|
||||||
const useProcessAuxSpawn = declared(posix_spawn) and not defined(useFork) and
|
const useProcessAuxSpawn = declared(posix_spawn) and not defined(useFork) and
|
||||||
not defined(useClone) and not defined(linux)
|
not defined(useClone) and not defined(linux)
|
||||||
|
|
|
||||||
|
|
@ -125,9 +125,6 @@ type
|
||||||
tok: Token
|
tok: Token
|
||||||
filename: string
|
filename: string
|
||||||
|
|
||||||
{.deprecated: [TCfgEventKind: CfgEventKind, TCfgEvent: CfgEvent,
|
|
||||||
TTokKind: TokKind, TToken: Token, TCfgParser: CfgParser].}
|
|
||||||
|
|
||||||
# implementation
|
# implementation
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,6 @@ type
|
||||||
CsvError* = object of IOError ## exception that is raised if
|
CsvError* = object of IOError ## exception that is raised if
|
||||||
## a parsing error occurs
|
## a parsing error occurs
|
||||||
|
|
||||||
{.deprecated: [TCsvRow: CsvRow, TCsvParser: CsvParser, EInvalidCsv: CsvError].}
|
|
||||||
|
|
||||||
proc raiseEInvalidCsv(filename: string, line, col: int,
|
proc raiseEInvalidCsv(filename: string, line, col: int,
|
||||||
msg: string) {.noreturn.} =
|
msg: string) {.noreturn.} =
|
||||||
var e: ref CsvError
|
var e: ref CsvError
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,6 @@ type
|
||||||
## or the argument, ``value`` is not "" if
|
## or the argument, ``value`` is not "" if
|
||||||
## the option was given a value
|
## the option was given a value
|
||||||
|
|
||||||
{.deprecated: [TCmdLineKind: CmdLineKind, TOptParser: OptParser].}
|
|
||||||
|
|
||||||
proc parseWord(s: string, i: int, w: var string,
|
proc parseWord(s: string, i: int, w: var string,
|
||||||
delim: set[char] = {'\x09', ' '}): int =
|
delim: set[char] = {'\x09', ' '}): int =
|
||||||
result = i
|
result = i
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,6 @@ type
|
||||||
## or the argument, ``value`` is not "" if
|
## or the argument, ``value`` is not "" if
|
||||||
## the option was given a value
|
## the option was given a value
|
||||||
|
|
||||||
{.deprecated: [TCmdLineKind: CmdLineKind, TOptParser: OptParser].}
|
|
||||||
|
|
||||||
proc initOptParser*(cmdline: seq[string]): OptParser {.rtl.} =
|
proc initOptParser*(cmdline: seq[string]): OptParser {.rtl.} =
|
||||||
## Initalizes option parses with cmdline. cmdline should not contain
|
## Initalizes option parses with cmdline. cmdline should not contain
|
||||||
## argument 0 - program name.
|
## argument 0 - program name.
|
||||||
|
|
@ -122,8 +120,6 @@ proc cmdLineRest*(p: OptParser): TaintedString {.rtl, extern: "npo2$1", deprecat
|
||||||
type
|
type
|
||||||
GetoptResult* = tuple[kind: CmdLineKind, key, val: TaintedString]
|
GetoptResult* = tuple[kind: CmdLineKind, key, val: TaintedString]
|
||||||
|
|
||||||
{.deprecated: [TGetoptResult: GetoptResult].}
|
|
||||||
|
|
||||||
iterator getopt*(p: var OptParser): GetoptResult =
|
iterator getopt*(p: var OptParser): GetoptResult =
|
||||||
## This is an convenience iterator for iterating over the given OptParser object.
|
## This is an convenience iterator for iterating over the given OptParser object.
|
||||||
## Example:
|
## Example:
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,6 @@ type
|
||||||
SqlLexer* = object of BaseLexer ## the parser object.
|
SqlLexer* = object of BaseLexer ## the parser object.
|
||||||
filename: string
|
filename: string
|
||||||
|
|
||||||
{.deprecated: [TToken: Token, TSqlLexer: SqlLexer].}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
tokKindToStr: array[TokKind, string] = [
|
tokKindToStr: array[TokKind, string] = [
|
||||||
"invalid", "[EOF]", "identifier", "quoted identifier", "string constant",
|
"invalid", "[EOF]", "identifier", "quoted identifier", "string constant",
|
||||||
|
|
|
||||||
|
|
@ -365,8 +365,6 @@ type
|
||||||
ikVar, ## ``var`` part of the interpolated string
|
ikVar, ## ``var`` part of the interpolated string
|
||||||
ikExpr ## ``expr`` part of the interpolated string
|
ikExpr ## ``expr`` part of the interpolated string
|
||||||
|
|
||||||
{.deprecated: [TInterpolatedKind: InterpolatedKind].}
|
|
||||||
|
|
||||||
iterator interpolatedFragments*(s: string): tuple[kind: InterpolatedKind,
|
iterator interpolatedFragments*(s: string): tuple[kind: InterpolatedKind,
|
||||||
value: string] =
|
value: string] =
|
||||||
## Tokenizes the string `s` into substrings for interpolation purposes.
|
## Tokenizes the string `s` into substrings for interpolation purposes.
|
||||||
|
|
|
||||||
|
|
@ -98,9 +98,6 @@ type
|
||||||
filename: string
|
filename: string
|
||||||
options: set[XmlParseOption]
|
options: set[XmlParseOption]
|
||||||
|
|
||||||
{.deprecated: [TXmlParser: XmlParser, TXmlParseOptions: XmlParseOption,
|
|
||||||
TXmlError: XmlErrorKind, TXmlEventKind: XmlEventKind].}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
errorMessages: array[XmlErrorKind, string] = [
|
errorMessages: array[XmlErrorKind, string] = [
|
||||||
"no error",
|
"no error",
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,8 @@ type
|
||||||
line: int ## line the symbol has been declared/used in
|
line: int ## line the symbol has been declared/used in
|
||||||
col: int ## column the symbol has been declared/used in
|
col: int ## column the symbol has been declared/used in
|
||||||
flags: set[NonTerminalFlag] ## the nonterminal's flags
|
flags: set[NonTerminalFlag] ## the nonterminal's flags
|
||||||
rule: Node ## the rule that the symbol refers to
|
rule: Peg ## the rule that the symbol refers to
|
||||||
Node {.shallow.} = object
|
Peg* {.shallow.} = object ## type that represents a PEG
|
||||||
case kind: PegKind
|
case kind: PegKind
|
||||||
of pkEmpty..pkWhitespace: nil
|
of pkEmpty..pkWhitespace: nil
|
||||||
of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle: term: string
|
of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle: term: string
|
||||||
|
|
@ -83,13 +83,9 @@ type
|
||||||
of pkCharChoice, pkGreedyRepSet: charChoice: ref set[char]
|
of pkCharChoice, pkGreedyRepSet: charChoice: ref set[char]
|
||||||
of pkNonTerminal: nt: NonTerminal
|
of pkNonTerminal: nt: NonTerminal
|
||||||
of pkBackRef..pkBackRefIgnoreStyle: index: range[0..MaxSubpatterns]
|
of pkBackRef..pkBackRefIgnoreStyle: index: range[0..MaxSubpatterns]
|
||||||
else: sons: seq[Node]
|
else: sons: seq[Peg]
|
||||||
NonTerminal* = ref NonTerminalObj
|
NonTerminal* = ref NonTerminalObj
|
||||||
|
|
||||||
Peg* = Node ## type that represents a PEG
|
|
||||||
|
|
||||||
{.deprecated: [TPeg: Peg, TNode: Node].}
|
|
||||||
|
|
||||||
proc term*(t: string): Peg {.nosideEffect, rtl, extern: "npegs$1Str".} =
|
proc term*(t: string): Peg {.nosideEffect, rtl, extern: "npegs$1Str".} =
|
||||||
## constructs a PEG from a terminal string
|
## constructs a PEG from a terminal string
|
||||||
if t.len != 1:
|
if t.len != 1:
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,6 @@ type
|
||||||
length: int
|
length: int
|
||||||
data: string # != nil if a leaf
|
data: string # != nil if a leaf
|
||||||
|
|
||||||
{.deprecated: [PRope: Rope].}
|
|
||||||
|
|
||||||
proc isConc(r: Rope): bool {.inline.} = return isNil(r.data)
|
proc isConc(r: Rope): bool {.inline.} = return isNil(r.data)
|
||||||
|
|
||||||
# Note that the left and right pointers are not needed for leafs.
|
# Note that the left and right pointers are not needed for leafs.
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,6 @@ type
|
||||||
disp: Dispatcher
|
disp: Dispatcher
|
||||||
AsyncScgiState* = ref AsyncScgiStateObj
|
AsyncScgiState* = ref AsyncScgiStateObj
|
||||||
|
|
||||||
{.deprecated: [EScgi: ScgiError, TScgiState: ScgiState,
|
|
||||||
PAsyncScgiState: AsyncScgiState].}
|
|
||||||
|
|
||||||
proc recvBuffer(s: var ScgiState, L: int) =
|
proc recvBuffer(s: var ScgiState, L: int) =
|
||||||
if L > s.bufLen:
|
if L > s.bufLen:
|
||||||
s.bufLen = L
|
s.bufLen = L
|
||||||
|
|
|
||||||
|
|
@ -316,18 +316,18 @@ else:
|
||||||
include ioselects/ioselectors_poll
|
include ioselects/ioselectors_poll
|
||||||
|
|
||||||
proc register*[T](s: Selector[T], fd: int | SocketHandle,
|
proc register*[T](s: Selector[T], fd: int | SocketHandle,
|
||||||
events: set[Event], data: T) {.deprecated.} =
|
events: set[Event], data: T) {.deprecated: "use registerHandle instead".} =
|
||||||
## **Deprecated since v0.18.0:** Use ``registerHandle`` instead.
|
## **Deprecated since v0.18.0:** Use ``registerHandle`` instead.
|
||||||
s.registerHandle(fd, events, data)
|
s.registerHandle(fd, events, data)
|
||||||
|
|
||||||
proc setEvent*(ev: SelectEvent) {.deprecated.} =
|
proc setEvent*(ev: SelectEvent) {.deprecated: "use trigger instead".} =
|
||||||
## Trigger event ``ev``.
|
## Trigger event ``ev``.
|
||||||
##
|
##
|
||||||
## **Deprecated since v0.18.0:** Use ``trigger`` instead.
|
## **Deprecated since v0.18.0:** Use ``trigger`` instead.
|
||||||
ev.trigger()
|
ev.trigger()
|
||||||
|
|
||||||
proc update*[T](s: Selector[T], fd: int | SocketHandle,
|
proc update*[T](s: Selector[T], fd: int | SocketHandle,
|
||||||
events: set[Event]) {.deprecated.} =
|
events: set[Event]) {.deprecated: "use updateHandle instead".} =
|
||||||
## Update file/socket descriptor ``fd``, registered in selector
|
## Update file/socket descriptor ``fd``, registered in selector
|
||||||
## ``s`` with new events set ``event``.
|
## ``s`` with new events set ``event``.
|
||||||
##
|
##
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,6 @@ type
|
||||||
Smtp* = SmtpBase[Socket]
|
Smtp* = SmtpBase[Socket]
|
||||||
AsyncSmtp* = SmtpBase[AsyncSocket]
|
AsyncSmtp* = SmtpBase[AsyncSocket]
|
||||||
|
|
||||||
{.deprecated: [EInvalidReply: ReplyError, TMessage: Message, TSMTP: Smtp].}
|
|
||||||
|
|
||||||
proc debugSend(smtp: Smtp | AsyncSmtp, cmd: string) {.multisync.} =
|
proc debugSend(smtp: Smtp | AsyncSmtp, cmd: string) {.multisync.} =
|
||||||
if smtp.debug:
|
if smtp.debug:
|
||||||
echo("C:" & cmd)
|
echo("C:" & cmd)
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,6 @@ type
|
||||||
y_stats*: RunningStat ## stats for second set of data
|
y_stats*: RunningStat ## stats for second set of data
|
||||||
s_xy: float ## accumulated data for combined xy
|
s_xy: float ## accumulated data for combined xy
|
||||||
|
|
||||||
{.deprecated: [TFloatClass: FloatClass, TRunningStat: RunningStat].}
|
|
||||||
|
|
||||||
# ----------- RunningStat --------------------------
|
# ----------- RunningStat --------------------------
|
||||||
proc clear*(s: var RunningStat) =
|
proc clear*(s: var RunningStat) =
|
||||||
## reset `s`
|
## reset `s`
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,6 @@ type
|
||||||
tags: [WriteIOEffect], gcsafe.}
|
tags: [WriteIOEffect], gcsafe.}
|
||||||
flushImpl*: proc (s: Stream) {.nimcall, tags: [WriteIOEffect], gcsafe.}
|
flushImpl*: proc (s: Stream) {.nimcall, tags: [WriteIOEffect], gcsafe.}
|
||||||
|
|
||||||
{.deprecated: [PStream: Stream, TStream: StreamObj].}
|
|
||||||
|
|
||||||
proc flush*(s: Stream) =
|
proc flush*(s: Stream) =
|
||||||
## flushes the buffers that the stream `s` might use.
|
## flushes the buffers that the stream `s` might use.
|
||||||
if not isNil(s.flushImpl): s.flushImpl(s)
|
if not isNil(s.flushImpl): s.flushImpl(s)
|
||||||
|
|
@ -76,27 +74,14 @@ proc atEnd*(s: Stream): bool =
|
||||||
## been read.
|
## been read.
|
||||||
result = s.atEndImpl(s)
|
result = s.atEndImpl(s)
|
||||||
|
|
||||||
proc atEnd*(s, unused: Stream): bool {.deprecated.} =
|
|
||||||
## checks if more data can be read from `f`. Returns true if all data has
|
|
||||||
## been read.
|
|
||||||
result = s.atEndImpl(s)
|
|
||||||
|
|
||||||
proc setPosition*(s: Stream, pos: int) =
|
proc setPosition*(s: Stream, pos: int) =
|
||||||
## sets the position `pos` of the stream `s`.
|
## sets the position `pos` of the stream `s`.
|
||||||
s.setPositionImpl(s, pos)
|
s.setPositionImpl(s, pos)
|
||||||
|
|
||||||
proc setPosition*(s, unused: Stream, pos: int) {.deprecated.} =
|
|
||||||
## sets the position `pos` of the stream `s`.
|
|
||||||
s.setPositionImpl(s, pos)
|
|
||||||
|
|
||||||
proc getPosition*(s: Stream): int =
|
proc getPosition*(s: Stream): int =
|
||||||
## retrieves the current position in the stream `s`.
|
## retrieves the current position in the stream `s`.
|
||||||
result = s.getPositionImpl(s)
|
result = s.getPositionImpl(s)
|
||||||
|
|
||||||
proc getPosition*(s, unused: Stream): int {.deprecated.} =
|
|
||||||
## retrieves the current position in the stream `s`.
|
|
||||||
result = s.getPositionImpl(s)
|
|
||||||
|
|
||||||
proc readData*(s: Stream, buffer: pointer, bufLen: int): int =
|
proc readData*(s: Stream, buffer: pointer, bufLen: int): int =
|
||||||
## low level proc that reads data into an untyped `buffer` of `bufLen` size.
|
## low level proc that reads data into an untyped `buffer` of `bufLen` size.
|
||||||
result = s.readDataImpl(s, buffer, bufLen)
|
result = s.readDataImpl(s, buffer, bufLen)
|
||||||
|
|
@ -114,11 +99,6 @@ proc readAll*(s: Stream): string =
|
||||||
inc r, bufferSize
|
inc r, bufferSize
|
||||||
setLen(result, r+bufferSize)
|
setLen(result, r+bufferSize)
|
||||||
|
|
||||||
proc readData*(s, unused: Stream, buffer: pointer,
|
|
||||||
bufLen: int): int {.deprecated.} =
|
|
||||||
## low level proc that reads data into an untyped `buffer` of `bufLen` size.
|
|
||||||
result = s.readDataImpl(s, buffer, bufLen)
|
|
||||||
|
|
||||||
proc peekData*(s: Stream, buffer: pointer, bufLen: int): int =
|
proc peekData*(s: Stream, buffer: pointer, bufLen: int): int =
|
||||||
## low level proc that reads data into an untyped `buffer` of `bufLen` size
|
## low level proc that reads data into an untyped `buffer` of `bufLen` size
|
||||||
## without moving stream position
|
## without moving stream position
|
||||||
|
|
@ -153,11 +133,6 @@ proc write*(s: Stream, x: string) =
|
||||||
else:
|
else:
|
||||||
if x.len > 0: writeData(s, unsafeAddr x[0], x.len)
|
if x.len > 0: writeData(s, unsafeAddr x[0], x.len)
|
||||||
|
|
||||||
proc writeLn*(s: Stream, args: varargs[string, `$`]) {.deprecated.} =
|
|
||||||
## **Deprecated since version 0.11.4:** Use **writeLine** instead.
|
|
||||||
for str in args: write(s, str)
|
|
||||||
write(s, "\n")
|
|
||||||
|
|
||||||
proc writeLine*(s: Stream, args: varargs[string, `$`]) =
|
proc writeLine*(s: Stream, args: varargs[string, `$`]) =
|
||||||
## writes one or more strings to the the stream `s` followed
|
## writes one or more strings to the the stream `s` followed
|
||||||
## by a new line. No length field or terminating zero is written.
|
## by a new line. No length field or terminating zero is written.
|
||||||
|
|
@ -348,8 +323,6 @@ when not defined(js):
|
||||||
data*: string
|
data*: string
|
||||||
pos: int
|
pos: int
|
||||||
|
|
||||||
{.deprecated: [PStringStream: StringStream, TStringStream: StringStreamObj].}
|
|
||||||
|
|
||||||
proc ssAtEnd(s: Stream): bool =
|
proc ssAtEnd(s: Stream): bool =
|
||||||
var s = StringStream(s)
|
var s = StringStream(s)
|
||||||
return s.pos >= s.data.len
|
return s.pos >= s.data.len
|
||||||
|
|
@ -409,7 +382,6 @@ when not defined(js):
|
||||||
FileStream* = ref FileStreamObj ## a stream that encapsulates a `File`
|
FileStream* = ref FileStreamObj ## a stream that encapsulates a `File`
|
||||||
FileStreamObj* = object of Stream
|
FileStreamObj* = object of Stream
|
||||||
f: File
|
f: File
|
||||||
{.deprecated: [PFileStream: FileStream, TFileStream: FileStreamObj].}
|
|
||||||
|
|
||||||
proc fsClose(s: Stream) =
|
proc fsClose(s: Stream) =
|
||||||
if FileStream(s).f != nil:
|
if FileStream(s).f != nil:
|
||||||
|
|
@ -472,9 +444,6 @@ else:
|
||||||
handle*: FileHandle
|
handle*: FileHandle
|
||||||
pos: int
|
pos: int
|
||||||
|
|
||||||
{.deprecated: [PFileHandleStream: FileHandleStream,
|
|
||||||
TFileHandleStream: FileHandleStreamObj].}
|
|
||||||
|
|
||||||
proc newEOS(msg: string): ref OSError =
|
proc newEOS(msg: string): ref OSError =
|
||||||
new(result)
|
new(result)
|
||||||
result.msg = msg
|
result.msg = msg
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,7 @@ import
|
||||||
|
|
||||||
when defined(js):
|
when defined(js):
|
||||||
{.pragma: rtlFunc.}
|
{.pragma: rtlFunc.}
|
||||||
{.pragma: deprecatedGetFunc.}
|
|
||||||
else:
|
else:
|
||||||
{.pragma: deprecatedGetFunc, deprecatedGet.}
|
|
||||||
{.pragma: rtlFunc, rtl.}
|
{.pragma: rtlFunc, rtl.}
|
||||||
import os
|
import os
|
||||||
include "system/inclrtl"
|
include "system/inclrtl"
|
||||||
|
|
@ -38,9 +36,6 @@ type
|
||||||
|
|
||||||
StringTableRef* = ref StringTableObj ## use this type to declare string tables
|
StringTableRef* = ref StringTableObj ## use this type to declare string tables
|
||||||
|
|
||||||
{.deprecated: [TStringTableMode: StringTableMode,
|
|
||||||
TStringTable: StringTableObj, PStringTable: StringTableRef].}
|
|
||||||
|
|
||||||
proc len*(t: StringTableRef): int {.rtlFunc, extern: "nst$1".} =
|
proc len*(t: StringTableRef): int {.rtlFunc, extern: "nst$1".} =
|
||||||
## returns the number of keys in `t`.
|
## returns the number of keys in `t`.
|
||||||
result = t.counter
|
result = t.counter
|
||||||
|
|
@ -73,10 +68,6 @@ type
|
||||||
useKey ## do not replace ``$key`` if it is not found
|
useKey ## do not replace ``$key`` if it is not found
|
||||||
## in the table (or in the environment)
|
## in the table (or in the environment)
|
||||||
|
|
||||||
{.deprecated: [TFormatFlag: FormatFlag].}
|
|
||||||
|
|
||||||
# implementation
|
|
||||||
|
|
||||||
const
|
const
|
||||||
growthFactor = 2
|
growthFactor = 2
|
||||||
startSize = 64
|
startSize = 64
|
||||||
|
|
@ -118,17 +109,12 @@ template get(t: StringTableRef, key: string) =
|
||||||
raise newException(KeyError, "key not found")
|
raise newException(KeyError, "key not found")
|
||||||
|
|
||||||
proc `[]`*(t: StringTableRef, key: string): var string {.
|
proc `[]`*(t: StringTableRef, key: string): var string {.
|
||||||
rtlFunc, extern: "nstTake", deprecatedGetFunc.} =
|
rtlFunc, extern: "nstTake".} =
|
||||||
## retrieves the location at ``t[key]``. If `key` is not in `t`, the
|
## retrieves the location at ``t[key]``. If `key` is not in `t`, the
|
||||||
## ``KeyError`` exception is raised. One can check with ``hasKey`` whether
|
## ``KeyError`` exception is raised. One can check with ``hasKey`` whether
|
||||||
## the key exists.
|
## the key exists.
|
||||||
get(t, key)
|
get(t, key)
|
||||||
|
|
||||||
proc mget*(t: StringTableRef, key: string): var string {.deprecated.} =
|
|
||||||
## retrieves the location at ``t[key]``. If `key` is not in `t`, the
|
|
||||||
## ``KeyError`` exception is raised. Use ```[]``` instead.
|
|
||||||
get(t, key)
|
|
||||||
|
|
||||||
proc getOrDefault*(t: StringTableRef; key: string, default: string = ""): string =
|
proc getOrDefault*(t: StringTableRef; key: string, default: string = ""): string =
|
||||||
var index = rawGet(t, key)
|
var index = rawGet(t, key)
|
||||||
if index >= 0: result = t.data[index].val
|
if index >= 0: result = t.data[index].val
|
||||||
|
|
@ -193,7 +179,8 @@ proc newStringTable*(mode: StringTableMode): StringTableRef {.
|
||||||
result.counter = 0
|
result.counter = 0
|
||||||
newSeq(result.data, startSize)
|
newSeq(result.data, startSize)
|
||||||
|
|
||||||
proc clear*(s: StringTableRef, mode: StringTableMode) =
|
proc clear*(s: StringTableRef, mode: StringTableMode) {.
|
||||||
|
rtlFunc, extern: "nst$1".} =
|
||||||
## resets a string table to be empty again.
|
## resets a string table to be empty again.
|
||||||
s.mode = mode
|
s.mode = mode
|
||||||
s.counter = 0
|
s.counter = 0
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,6 @@ type
|
||||||
SubexError* = object of ValueError ## exception that is raised for
|
SubexError* = object of ValueError ## exception that is raised for
|
||||||
## an invalid subex
|
## an invalid subex
|
||||||
|
|
||||||
{.deprecated: [EInvalidSubex: SubexError].}
|
|
||||||
|
|
||||||
proc raiseInvalidFormat(msg: string) {.noinline.} =
|
proc raiseInvalidFormat(msg: string) {.noinline.} =
|
||||||
raise newException(SubexError, "invalid format string: " & msg)
|
raise newException(SubexError, "invalid format string: " & msg)
|
||||||
|
|
||||||
|
|
@ -44,7 +42,6 @@ type
|
||||||
else:
|
else:
|
||||||
f: cstring
|
f: cstring
|
||||||
num, i, lineLen: int
|
num, i, lineLen: int
|
||||||
{.deprecated: [TFormatParser: FormatParser].}
|
|
||||||
|
|
||||||
template call(x: untyped): untyped =
|
template call(x: untyped): untyped =
|
||||||
p.i = i
|
p.i = i
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,12 @@ type
|
||||||
hostname*, port*, path*, query*, anchor*: string
|
hostname*, port*, path*, query*, anchor*: string
|
||||||
opaque*: bool
|
opaque*: bool
|
||||||
|
|
||||||
{.deprecated: [TUrl: Url, TUri: Uri].}
|
|
||||||
|
|
||||||
{.push warning[deprecated]: off.}
|
{.push warning[deprecated]: off.}
|
||||||
proc `$`*(url: Url): string {.deprecated.} =
|
proc `$`*(url: Url): string {.deprecated: "use Uri instead".} =
|
||||||
## **Deprecated since 0.9.6**: Use ``Uri`` instead.
|
## **Deprecated since 0.9.6**: Use ``Uri`` instead.
|
||||||
return string(url)
|
return string(url)
|
||||||
|
|
||||||
proc `/`*(a, b: Url): Url {.deprecated.} =
|
proc `/`*(a, b: Url): Url {.deprecated: "use Uri instead".} =
|
||||||
## Joins two URLs together, separating them with / if needed.
|
## Joins two URLs together, separating them with / if needed.
|
||||||
##
|
##
|
||||||
## **Deprecated since 0.9.6**: Use ``Uri`` instead.
|
## **Deprecated since 0.9.6**: Use ``Uri`` instead.
|
||||||
|
|
@ -40,7 +38,7 @@ proc `/`*(a, b: Url): Url {.deprecated.} =
|
||||||
urlS.add(bs)
|
urlS.add(bs)
|
||||||
result = Url(urlS)
|
result = Url(urlS)
|
||||||
|
|
||||||
proc add*(url: var Url, a: Url) {.deprecated.} =
|
proc add*(url: var Url, a: Url) {.deprecated: "use Uri instead".} =
|
||||||
## Appends url to url.
|
## Appends url to url.
|
||||||
##
|
##
|
||||||
## **Deprecated since 0.9.6**: Use ``Uri`` instead.
|
## **Deprecated since 0.9.6**: Use ``Uri`` instead.
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ type
|
||||||
## for invalid XML.
|
## for invalid XML.
|
||||||
errors*: seq[string] ## All detected parsing errors.
|
errors*: seq[string] ## All detected parsing errors.
|
||||||
|
|
||||||
{.deprecated: [EInvalidXml: XmlError].}
|
|
||||||
|
|
||||||
proc raiseInvalidXml(errors: seq[string]) =
|
proc raiseInvalidXml(errors: seq[string]) =
|
||||||
var e: ref XmlError
|
var e: ref XmlError
|
||||||
new(e)
|
new(e)
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,6 @@ type
|
||||||
fAttr: XmlAttributes
|
fAttr: XmlAttributes
|
||||||
fClientData: int ## for other clients
|
fClientData: int ## for other clients
|
||||||
|
|
||||||
{.deprecated: [PXmlNode: XmlNode, TXmlNodeKind: XmlNodeKind, PXmlAttributes:
|
|
||||||
XmlAttributes, TXmlNode: XmlNodeObj].}
|
|
||||||
|
|
||||||
proc newXmlNode(kind: XmlNodeKind): XmlNode =
|
proc newXmlNode(kind: XmlNodeKind): XmlNode =
|
||||||
## creates a new ``XmlNode``.
|
## creates a new ``XmlNode``.
|
||||||
new(result)
|
new(result)
|
||||||
|
|
@ -155,11 +152,6 @@ proc `[]`* (n: var XmlNode, i: int): var XmlNode {.inline.} =
|
||||||
assert n.k == xnElement
|
assert n.k == xnElement
|
||||||
result = n.s[i]
|
result = n.s[i]
|
||||||
|
|
||||||
proc mget*(n: var XmlNode, i: int): var XmlNode {.inline, deprecated.} =
|
|
||||||
## returns the `i`'th child of `n` so that it can be modified. Use ```[]```
|
|
||||||
## instead.
|
|
||||||
n[i]
|
|
||||||
|
|
||||||
iterator items*(n: XmlNode): XmlNode {.inline.} =
|
iterator items*(n: XmlNode): XmlNode {.inline.} =
|
||||||
## iterates over any child of `n`.
|
## iterates over any child of `n`.
|
||||||
assert n.k == xnElement
|
assert n.k == xnElement
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue