styleCheck: Fix some inconsistent identifiers (#16177)
This commit is contained in:
parent
29c9a1c14b
commit
297c8e403d
20 changed files with 64 additions and 64 deletions
|
|
@ -138,7 +138,7 @@ proc sms(dataA: var DiffData; lowerA, upperA: int; dataB: DiffData; lowerB, uppe
|
||||||
|
|
||||||
for D in 0 .. maxD:
|
for D in 0 .. maxD:
|
||||||
# Extend the forward path.
|
# Extend the forward path.
|
||||||
for k in countUp(downK - D, downK + D, 2):
|
for k in countup(downK - D, downK + D, 2):
|
||||||
# find the only or better starting point
|
# find the only or better starting point
|
||||||
var x: int
|
var x: int
|
||||||
if k == downK - D:
|
if k == downK - D:
|
||||||
|
|
@ -164,7 +164,7 @@ proc sms(dataA: var DiffData; lowerA, upperA: int; dataB: DiffData; lowerB, uppe
|
||||||
y: downVector[downOffset + k] - k)
|
y: downVector[downOffset + k] - k)
|
||||||
|
|
||||||
# Extend the reverse path.
|
# Extend the reverse path.
|
||||||
for k in countUp(upK - D, upK + D, 2):
|
for k in countup(upK - D, upK + D, 2):
|
||||||
# find the only or better starting point
|
# find the only or better starting point
|
||||||
var x: int
|
var x: int
|
||||||
if k == upK + D:
|
if k == upK + D:
|
||||||
|
|
|
||||||
|
|
@ -1460,8 +1460,8 @@ else:
|
||||||
proc createTextNode*(d: Document, identifier: cstring): Node {.importcpp.}
|
proc createTextNode*(d: Document, identifier: cstring): Node {.importcpp.}
|
||||||
proc createComment*(d: Document, data: cstring): Node {.importcpp.}
|
proc createComment*(d: Document, data: cstring): Node {.importcpp.}
|
||||||
|
|
||||||
proc setTimeout*(action: proc(); ms: int): Timeout {.importc, nodecl.}
|
proc setTimeout*(action: proc(); ms: int): TimeOut {.importc, nodecl.}
|
||||||
proc clearTimeout*(t: Timeout) {.importc, nodecl.}
|
proc clearTimeout*(t: TimeOut) {.importc, nodecl.}
|
||||||
|
|
||||||
{.push importcpp.}
|
{.push importcpp.}
|
||||||
|
|
||||||
|
|
@ -1719,9 +1719,9 @@ proc offsetTop*(e: Node): int {.importcpp: "#.offsetTop", nodecl.}
|
||||||
proc offsetLeft*(e: Node): int {.importcpp: "#.offsetLeft", nodecl.}
|
proc offsetLeft*(e: Node): int {.importcpp: "#.offsetLeft", nodecl.}
|
||||||
|
|
||||||
since (1, 3):
|
since (1, 3):
|
||||||
func newDomParser*(): DOMParser {.importcpp: "new DOMParser()".}
|
func newDomParser*(): DomParser {.importcpp: "new DOMParser()".}
|
||||||
## DOM Parser constructor.
|
## DOM Parser constructor.
|
||||||
func parseFromString*(this: DOMParser; str: cstring; mimeType: cstring): Document {.importcpp.}
|
func parseFromString*(this: DomParser; str: cstring; mimeType: cstring): Document {.importcpp.}
|
||||||
## Parse from string to `Document`.
|
## Parse from string to `Document`.
|
||||||
|
|
||||||
proc newDomException*(): DomException {.importcpp: "new DomException()", constructor.}
|
proc newDomException*(): DomException {.importcpp: "new DomException()", constructor.}
|
||||||
|
|
@ -1733,7 +1733,7 @@ since (1, 3):
|
||||||
|
|
||||||
proc newFileReader*(): FileReader {.importcpp: "new FileReader()", constructor.}
|
proc newFileReader*(): FileReader {.importcpp: "new FileReader()", constructor.}
|
||||||
## File Reader constructor
|
## File Reader constructor
|
||||||
proc error*(f: FileReader): DOMException {.importcpp: "#.error", nodecl.}
|
proc error*(f: FileReader): DomException {.importcpp: "#.error", nodecl.}
|
||||||
## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/error
|
## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/error
|
||||||
proc readyState*(f: FileReader): FileReaderState {.importcpp: "#.readyState", nodecl.}
|
proc readyState*(f: FileReader): FileReaderState {.importcpp: "#.readyState", nodecl.}
|
||||||
## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readyState
|
## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readyState
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ iterator pairs*[K: JsKey, V](assoc: JsAssoc[K, V]): (K,V) =
|
||||||
yield (k.toJsKey(K), v)
|
yield (k.toJsKey(K), v)
|
||||||
{.emit: "}".}
|
{.emit: "}".}
|
||||||
|
|
||||||
iterator items*[K, V](assoc: JSAssoc[K, V]): V =
|
iterator items*[K, V](assoc: JsAssoc[K, V]): V =
|
||||||
## Yields the `values` in a JsAssoc.
|
## Yields the `values` in a JsAssoc.
|
||||||
var v: V
|
var v: V
|
||||||
{.emit: "for (var k in `assoc`) {".}
|
{.emit: "for (var k in `assoc`) {".}
|
||||||
|
|
@ -389,7 +389,7 @@ iterator items*[K, V](assoc: JSAssoc[K, V]): V =
|
||||||
yield v
|
yield v
|
||||||
{.emit: "}".}
|
{.emit: "}".}
|
||||||
|
|
||||||
iterator keys*[K: JsKey, V](assoc: JSAssoc[K, V]): K =
|
iterator keys*[K: JsKey, V](assoc: JsAssoc[K, V]): K =
|
||||||
## Yields the `keys` in a JsAssoc.
|
## Yields the `keys` in a JsAssoc.
|
||||||
var k: cstring
|
var k: cstring
|
||||||
{.emit: "for (var `k` in `assoc`) {".}
|
{.emit: "for (var `k` in `assoc`) {".}
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ when defined(createNimHcr):
|
||||||
when defined(testNimHcr): return ($arg).splitFile.name.splitFile.name
|
when defined(testNimHcr): return ($arg).splitFile.name.splitFile.name
|
||||||
else: return $arg
|
else: return $arg
|
||||||
|
|
||||||
{.pragma: nimhcr, compilerProc, exportc, dynlib.}
|
{.pragma: nimhcr, compilerproc, exportc, dynlib.}
|
||||||
|
|
||||||
# XXX these types are CPU specific and need ARM etc support
|
# XXX these types are CPU specific and need ARM etc support
|
||||||
type
|
type
|
||||||
|
|
@ -622,7 +622,7 @@ elif defined(hotcodereloading) or defined(testNimHcr):
|
||||||
elif defined(macosx): "libnimhcr." & dllExt
|
elif defined(macosx): "libnimhcr." & dllExt
|
||||||
else: "libnimhcr." & dllExt
|
else: "libnimhcr." & dllExt
|
||||||
|
|
||||||
{.pragma: nimhcr, compilerProc, importc, dynlib: nimhcrLibname.}
|
{.pragma: nimhcr, compilerproc, importc, dynlib: nimhcrLibname.}
|
||||||
|
|
||||||
proc hcrRegisterProc*(module: cstring, name: cstring, fn: pointer): pointer {.nimhcr.}
|
proc hcrRegisterProc*(module: cstring, name: cstring, fn: pointer): pointer {.nimhcr.}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
|
||||||
elif returnType.kind == nnkEmpty:
|
elif returnType.kind == nnkEmpty:
|
||||||
baseType = returnType
|
baseType = returnType
|
||||||
else:
|
else:
|
||||||
verifyReturnType(repr(returnType), returntype)
|
verifyReturnType(repr(returnType), returnType)
|
||||||
|
|
||||||
let subtypeIsVoid = returnType.kind == nnkEmpty or
|
let subtypeIsVoid = returnType.kind == nnkEmpty or
|
||||||
(baseType.kind == nnkIdent and returnType[1].eqIdent("void"))
|
(baseType.kind == nnkIdent and returnType[1].eqIdent("void"))
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ proc signal(cv: var Semaphore) =
|
||||||
const CacheLineSize = 32 # true for most archs
|
const CacheLineSize = 32 # true for most archs
|
||||||
|
|
||||||
type
|
type
|
||||||
Barrier {.compilerProc.} = object
|
Barrier {.compilerproc.} = object
|
||||||
entered: int
|
entered: int
|
||||||
cv: Semaphore # Semaphore takes 3 words at least
|
cv: Semaphore # Semaphore takes 3 words at least
|
||||||
when sizeof(int) < 8:
|
when sizeof(int) < 8:
|
||||||
|
|
@ -63,26 +63,26 @@ type
|
||||||
cacheAlign2: array[CacheLineSize-sizeof(int), byte]
|
cacheAlign2: array[CacheLineSize-sizeof(int), byte]
|
||||||
interest: bool # whether the master is interested in the "all done" event
|
interest: bool # whether the master is interested in the "all done" event
|
||||||
|
|
||||||
proc barrierEnter(b: ptr Barrier) {.compilerProc, inline.} =
|
proc barrierEnter(b: ptr Barrier) {.compilerproc, inline.} =
|
||||||
# due to the signaling between threads, it is ensured we are the only
|
# due to the signaling between threads, it is ensured we are the only
|
||||||
# one with access to 'entered' so we don't need 'atomicInc' here:
|
# one with access to 'entered' so we don't need 'atomicInc' here:
|
||||||
inc b.entered
|
inc b.entered
|
||||||
# also we need no 'fence' instructions here as soon 'nimArgsPassingDone'
|
# also we need no 'fence' instructions here as soon 'nimArgsPassingDone'
|
||||||
# will be called which already will perform a fence for us.
|
# will be called which already will perform a fence for us.
|
||||||
|
|
||||||
proc barrierLeave(b: ptr Barrier) {.compilerProc, inline.} =
|
proc barrierLeave(b: ptr Barrier) {.compilerproc, inline.} =
|
||||||
atomicInc b.left
|
atomicInc b.left
|
||||||
when not defined(x86): fence()
|
when not defined(x86): fence()
|
||||||
# We may not have seen the final value of b.entered yet,
|
# We may not have seen the final value of b.entered yet,
|
||||||
# so we need to check for >= instead of ==.
|
# so we need to check for >= instead of ==.
|
||||||
if b.interest and b.left >= b.entered: signal(b.cv)
|
if b.interest and b.left >= b.entered: signal(b.cv)
|
||||||
|
|
||||||
proc openBarrier(b: ptr Barrier) {.compilerProc, inline.} =
|
proc openBarrier(b: ptr Barrier) {.compilerproc, inline.} =
|
||||||
b.entered = 0
|
b.entered = 0
|
||||||
b.left = 0
|
b.left = 0
|
||||||
b.interest = false
|
b.interest = false
|
||||||
|
|
||||||
proc closeBarrier(b: ptr Barrier) {.compilerProc.} =
|
proc closeBarrier(b: ptr Barrier) {.compilerproc.} =
|
||||||
fence()
|
fence()
|
||||||
if b.left != b.entered:
|
if b.left != b.entered:
|
||||||
b.cv.initSemaphore()
|
b.cv.initSemaphore()
|
||||||
|
|
@ -114,7 +114,7 @@ type
|
||||||
FlowVarObj[T] = object of FlowVarBaseObj
|
FlowVarObj[T] = object of FlowVarBaseObj
|
||||||
blob: T
|
blob: T
|
||||||
|
|
||||||
FlowVar*{.compilerProc.}[T] = ref FlowVarObj[T] ## A data flow variable.
|
FlowVar*{.compilerproc.}[T] = ref FlowVarObj[T] ## A data flow variable.
|
||||||
|
|
||||||
ToFreeQueue = object
|
ToFreeQueue = object
|
||||||
len: int
|
len: int
|
||||||
|
|
@ -212,14 +212,14 @@ proc `=destroy`[T](fv: var FlowVarObj[T]) =
|
||||||
finished(fv)
|
finished(fv)
|
||||||
`=destroy`(fv.blob)
|
`=destroy`(fv.blob)
|
||||||
|
|
||||||
proc nimCreateFlowVar[T](): FlowVar[T] {.compilerProc.} =
|
proc nimCreateFlowVar[T](): FlowVar[T] {.compilerproc.} =
|
||||||
new(result)
|
new(result)
|
||||||
|
|
||||||
proc nimFlowVarCreateSemaphore(fv: FlowVarBase) {.compilerProc.} =
|
proc nimFlowVarCreateSemaphore(fv: FlowVarBase) {.compilerproc.} =
|
||||||
fv.cv.initSemaphore()
|
fv.cv.initSemaphore()
|
||||||
fv.usesSemaphore = true
|
fv.usesSemaphore = true
|
||||||
|
|
||||||
proc nimFlowVarSignal(fv: FlowVarBase) {.compilerProc.} =
|
proc nimFlowVarSignal(fv: FlowVarBase) {.compilerproc.} =
|
||||||
if fv.ai != nil:
|
if fv.ai != nil:
|
||||||
acquire(fv.ai.cv.L)
|
acquire(fv.ai.cv.L)
|
||||||
fv.ai.idx = fv.idx
|
fv.ai.idx = fv.idx
|
||||||
|
|
@ -305,7 +305,7 @@ proc isReady*(fv: FlowVarBase): bool =
|
||||||
else:
|
else:
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
proc nimArgsPassingDone(p: pointer) {.compilerProc.} =
|
proc nimArgsPassingDone(p: pointer) {.compilerproc.} =
|
||||||
let w = cast[ptr Worker](p)
|
let w = cast[ptr Worker](p)
|
||||||
signal(w.taskStarted)
|
signal(w.taskStarted)
|
||||||
|
|
||||||
|
|
@ -489,7 +489,7 @@ var
|
||||||
|
|
||||||
initLock stateLock
|
initLock stateLock
|
||||||
|
|
||||||
proc nimSpawn3(fn: WorkerProc; data: pointer) {.compilerProc.} =
|
proc nimSpawn3(fn: WorkerProc; data: pointer) {.compilerproc.} =
|
||||||
# implementation of 'spawn' that is used by the code generator.
|
# implementation of 'spawn' that is used by the code generator.
|
||||||
while true:
|
while true:
|
||||||
if selectWorker(readyWorker, fn, data): return
|
if selectWorker(readyWorker, fn, data): return
|
||||||
|
|
@ -574,7 +574,7 @@ var
|
||||||
|
|
||||||
initLock distinguishedLock
|
initLock distinguishedLock
|
||||||
|
|
||||||
proc nimSpawn4(fn: WorkerProc; data: pointer; id: ThreadId) {.compilerProc.} =
|
proc nimSpawn4(fn: WorkerProc; data: pointer; id: ThreadId) {.compilerproc.} =
|
||||||
acquire(distinguishedLock)
|
acquire(distinguishedLock)
|
||||||
if not distinguishedData[id].initialized:
|
if not distinguishedData[id].initialized:
|
||||||
activateDistinguishedThread(id)
|
activateDistinguishedThread(id)
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ proc close*(ev: SelectEvent) =
|
||||||
raiseIOSelectorsError(osLastError())
|
raiseIOSelectorsError(osLastError())
|
||||||
|
|
||||||
proc selectInto*[T](s: Selector[T], timeout: int,
|
proc selectInto*[T](s: Selector[T], timeout: int,
|
||||||
results: var openarray[ReadyKey]): int =
|
results: var openArray[ReadyKey]): int =
|
||||||
var maxres = MAX_POLL_EVENTS
|
var maxres = MAX_POLL_EVENTS
|
||||||
if maxres > len(results):
|
if maxres > len(results):
|
||||||
maxres = len(results)
|
maxres = len(results)
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ proc unregister*[T](s: Selector[T], ev: SelectEvent) =
|
||||||
s.delKey(fd)
|
s.delKey(fd)
|
||||||
|
|
||||||
proc selectInto*[T](s: Selector[T], timeout: int,
|
proc selectInto*[T](s: Selector[T], timeout: int,
|
||||||
results: var openarray[ReadyKey]): int =
|
results: var openArray[ReadyKey]): int =
|
||||||
var tv = Timeval()
|
var tv = Timeval()
|
||||||
var ptv = addr tv
|
var ptv = addr tv
|
||||||
var rset, wset, eset: FdSet
|
var rset, wset, eset: FdSet
|
||||||
|
|
|
||||||
|
|
@ -232,8 +232,8 @@ proc open*(filename: string, mode: FileMode = fmRead,
|
||||||
|
|
||||||
if newFileSize != -1:
|
if newFileSize != -1:
|
||||||
flags = flags or O_CREAT or O_TRUNC
|
flags = flags or O_CREAT or O_TRUNC
|
||||||
var permissions_mode = S_IRUSR or S_IWUSR
|
var permissionsMode = S_IRUSR or S_IWUSR
|
||||||
result.handle = open(filename, flags, permissions_mode)
|
result.handle = open(filename, flags, permissionsMode)
|
||||||
else:
|
else:
|
||||||
result.handle = open(filename, flags)
|
result.handle = open(filename, flags)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ proc getProtoByName*(name: string): int {.since: (1, 3, 5).} =
|
||||||
let protoent = posix.getprotobyname(name.cstring)
|
let protoent = posix.getprotobyname(name.cstring)
|
||||||
|
|
||||||
if protoent == nil:
|
if protoent == nil:
|
||||||
raise newException(OsError, "protocol not found")
|
raise newException(OSError, "protocol not found")
|
||||||
|
|
||||||
result = protoent.p_proto.int
|
result = protoent.p_proto.int
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -551,7 +551,7 @@ when defineSsl:
|
||||||
|
|
||||||
proc newContext*(protVersion = protSSLv23, verifyMode = CVerifyPeer,
|
proc newContext*(protVersion = protSSLv23, verifyMode = CVerifyPeer,
|
||||||
certFile = "", keyFile = "", cipherList = CiphersIntermediate,
|
certFile = "", keyFile = "", cipherList = CiphersIntermediate,
|
||||||
caDir = "", caFile = ""): SSLContext =
|
caDir = "", caFile = ""): SslContext =
|
||||||
## Creates an SSL context.
|
## Creates an SSL context.
|
||||||
##
|
##
|
||||||
## Protocol version specifies the protocol to use. SSLv2, SSLv3, TLSv1
|
## Protocol version specifies the protocol to use. SSLv2, SSLv3, TLSv1
|
||||||
|
|
@ -644,7 +644,7 @@ when defineSsl:
|
||||||
if not found:
|
if not found:
|
||||||
raise newException(IOError, "No SSL/TLS CA certificates found.")
|
raise newException(IOError, "No SSL/TLS CA certificates found.")
|
||||||
|
|
||||||
result = SSLContext(context: newCTX, referencedData: initHashSet[int](),
|
result = SslContext(context: newCTX, referencedData: initHashSet[int](),
|
||||||
extraInternal: new(SslContextExtraInternal))
|
extraInternal: new(SslContextExtraInternal))
|
||||||
|
|
||||||
proc getExtraInternal(ctx: SslContext): SslContextExtraInternal =
|
proc getExtraInternal(ctx: SslContext): SslContextExtraInternal =
|
||||||
|
|
@ -750,7 +750,7 @@ when defineSsl:
|
||||||
## Wildcards match only in the left-most label.
|
## Wildcards match only in the left-most label.
|
||||||
## When name starts with a dot it will be matched by a certificate valid for any subdomain
|
## When name starts with a dot it will be matched by a certificate valid for any subdomain
|
||||||
when not defined(nimDisableCertificateValidation) and not defined(windows):
|
when not defined(nimDisableCertificateValidation) and not defined(windows):
|
||||||
assert socket.isSSL
|
assert socket.isSsl
|
||||||
let certificate = socket.sslHandle.SSL_get_peer_certificate()
|
let certificate = socket.sslHandle.SSL_get_peer_certificate()
|
||||||
if certificate.isNil:
|
if certificate.isNil:
|
||||||
raiseSSLError("No SSL certificate found.")
|
raiseSSLError("No SSL certificate found.")
|
||||||
|
|
@ -763,7 +763,7 @@ when defineSsl:
|
||||||
if match != 1:
|
if match != 1:
|
||||||
raiseSSLError("SSL Certificate check failed.")
|
raiseSSLError("SSL Certificate check failed.")
|
||||||
|
|
||||||
proc wrapConnectedSocket*(ctx: SSLContext, socket: Socket,
|
proc wrapConnectedSocket*(ctx: SslContext, socket: Socket,
|
||||||
handshake: SslHandshakeType,
|
handshake: SslHandshakeType,
|
||||||
hostname: string = "") =
|
hostname: string = "") =
|
||||||
## Wraps a connected socket in an SSL context. This function effectively
|
## Wraps a connected socket in an SSL context. This function effectively
|
||||||
|
|
|
||||||
|
|
@ -161,13 +161,13 @@ proc decode*(encoded: string): string {.raises: [PunyError].} =
|
||||||
break
|
break
|
||||||
w *= Base - t
|
w *= Base - t
|
||||||
k += Base
|
k += Base
|
||||||
bias = adapt(i - oldi, runelen(result) + 1, oldi == 0)
|
bias = adapt(i - oldi, runeLen(result) + 1, oldi == 0)
|
||||||
|
|
||||||
if i div (runelen(result) + 1) > high(int32) - n:
|
if i div (runeLen(result) + 1) > high(int32) - n:
|
||||||
raise newException(PunyError, "Value too large")
|
raise newException(PunyError, "Value too large")
|
||||||
|
|
||||||
n += i div (runelen(result) + 1)
|
n += i div (runeLen(result) + 1)
|
||||||
i = i mod (runelen(result) + 1)
|
i = i mod (runeLen(result) + 1)
|
||||||
insert(result, $Rune(n), i)
|
insert(result, $Rune(n), i)
|
||||||
inc i
|
inc i
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ when defined(nimdoc):
|
||||||
## Unregisters file/socket descriptor ``fd`` from selector ``s``.
|
## Unregisters file/socket descriptor ``fd`` from selector ``s``.
|
||||||
|
|
||||||
proc selectInto*[T](s: Selector[T], timeout: int,
|
proc selectInto*[T](s: Selector[T], timeout: int,
|
||||||
results: var openarray[ReadyKey]): int =
|
results: var openArray[ReadyKey]): int =
|
||||||
## Waits for events registered in selector ``s``.
|
## Waits for events registered in selector ``s``.
|
||||||
##
|
##
|
||||||
## The ``timeout`` argument specifies the maximum number of milliseconds
|
## The ``timeout`` argument specifies the maximum number of milliseconds
|
||||||
|
|
|
||||||
|
|
@ -112,17 +112,17 @@ proc quitExcpt(smtp: Smtp, msg: string) =
|
||||||
const compiledWithSsl = defined(ssl)
|
const compiledWithSsl = defined(ssl)
|
||||||
|
|
||||||
when not defined(ssl):
|
when not defined(ssl):
|
||||||
let defaultSSLContext: SSLContext = nil
|
let defaultSSLContext: SslContext = nil
|
||||||
else:
|
else:
|
||||||
var defaultSSLContext {.threadvar.}: SSLContext
|
var defaultSSLContext {.threadvar.}: SslContext
|
||||||
|
|
||||||
proc getSSLContext(): SSLContext =
|
proc getSSLContext(): SslContext =
|
||||||
if defaultSSLContext == nil:
|
if defaultSSLContext == nil:
|
||||||
defaultSSLContext = newContext(verifyMode = CVerifyNone)
|
defaultSSLContext = newContext(verifyMode = CVerifyNone)
|
||||||
result = defaultSSLContext
|
result = defaultSSLContext
|
||||||
|
|
||||||
proc createMessage*(mSubject, mBody: string, mTo, mCc: seq[string],
|
proc createMessage*(mSubject, mBody: string, mTo, mCc: seq[string],
|
||||||
otherHeaders: openarray[tuple[name, value: string]]): Message =
|
otherHeaders: openArray[tuple[name, value: string]]): Message =
|
||||||
## Creates a new MIME compliant message.
|
## Creates a new MIME compliant message.
|
||||||
##
|
##
|
||||||
## You need to make sure that ``mSubject``, ``mTo`` and ``mCc`` don't contain
|
## You need to make sure that ``mSubject``, ``mTo`` and ``mCc`` don't contain
|
||||||
|
|
@ -172,7 +172,7 @@ proc `$`*(msg: Message): string =
|
||||||
result.add(msg.msgBody)
|
result.add(msg.msgBody)
|
||||||
|
|
||||||
proc newSmtp*(useSsl = false, debug = false,
|
proc newSmtp*(useSsl = false, debug = false,
|
||||||
sslContext: SSLContext = nil): Smtp =
|
sslContext: SslContext = nil): Smtp =
|
||||||
## Creates a new ``Smtp`` instance.
|
## Creates a new ``Smtp`` instance.
|
||||||
new result
|
new result
|
||||||
result.debug = debug
|
result.debug = debug
|
||||||
|
|
@ -187,7 +187,7 @@ proc newSmtp*(useSsl = false, debug = false,
|
||||||
{.error: "SMTP module compiled without SSL support".}
|
{.error: "SMTP module compiled without SSL support".}
|
||||||
|
|
||||||
proc newAsyncSmtp*(useSsl = false, debug = false,
|
proc newAsyncSmtp*(useSsl = false, debug = false,
|
||||||
sslContext: SSLContext = nil): AsyncSmtp =
|
sslContext: SslContext = nil): AsyncSmtp =
|
||||||
## Creates a new ``AsyncSmtp`` instance.
|
## Creates a new ``AsyncSmtp`` instance.
|
||||||
new result
|
new result
|
||||||
result.debug = debug
|
result.debug = debug
|
||||||
|
|
@ -222,7 +222,7 @@ proc checkReply*(smtp: Smtp | AsyncSmtp, reply: string) {.multisync.} =
|
||||||
## `SMTP extensions<https://en.wikipedia.org/wiki/Extended_SMTP>`_.
|
## `SMTP extensions<https://en.wikipedia.org/wiki/Extended_SMTP>`_.
|
||||||
|
|
||||||
var line = await smtp.debugRecv()
|
var line = await smtp.debugRecv()
|
||||||
if not line.startswith(reply):
|
if not line.startsWith(reply):
|
||||||
await quitExcpt(smtp, "Expected " & reply & " reply, got: " & line)
|
await quitExcpt(smtp, "Expected " & reply & " reply, got: " & line)
|
||||||
|
|
||||||
proc helo*(smtp: Smtp | AsyncSmtp) {.multisync.} =
|
proc helo*(smtp: Smtp | AsyncSmtp) {.multisync.} =
|
||||||
|
|
@ -239,7 +239,7 @@ proc connect*(smtp: Smtp | AsyncSmtp,
|
||||||
await smtp.checkReply("220")
|
await smtp.checkReply("220")
|
||||||
await smtp.helo()
|
await smtp.helo()
|
||||||
|
|
||||||
proc startTls*(smtp: Smtp | AsyncSmtp, sslContext: SSLContext = nil) {.multisync.} =
|
proc startTls*(smtp: Smtp | AsyncSmtp, sslContext: SslContext = nil) {.multisync.} =
|
||||||
## Put the SMTP connection in TLS (Transport Layer Security) mode.
|
## Put the SMTP connection in TLS (Transport Layer Security) mode.
|
||||||
## May fail with ReplyError
|
## May fail with ReplyError
|
||||||
await smtp.debugSend("STARTTLS\c\L")
|
await smtp.debugSend("STARTTLS\c\L")
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import strutils
|
||||||
|
|
||||||
# FWIW look for files before scanning entire dirs.
|
# FWIW look for files before scanning entire dirs.
|
||||||
|
|
||||||
const certificate_paths = [
|
const certificatePaths = [
|
||||||
# Debian, Ubuntu, Arch: maintained by update-ca-certificates, SUSE, Gentoo
|
# Debian, Ubuntu, Arch: maintained by update-ca-certificates, SUSE, Gentoo
|
||||||
# NetBSD (security/mozilla-rootcerts)
|
# NetBSD (security/mozilla-rootcerts)
|
||||||
# SLES10/SLES11, https://golang.org/issue/12139
|
# SLES10/SLES11, https://golang.org/issue/12139
|
||||||
|
|
@ -77,7 +77,7 @@ iterator scanSSLCertificates*(useEnvVars = false): string =
|
||||||
|
|
||||||
else:
|
else:
|
||||||
when not defined(haiku):
|
when not defined(haiku):
|
||||||
for p in certificate_paths:
|
for p in certificatePaths:
|
||||||
if p.endsWith(".pem") or p.endsWith(".crt"):
|
if p.endsWith(".pem") or p.endsWith(".crt"):
|
||||||
if fileExists(p):
|
if fileExists(p):
|
||||||
yield p
|
yield p
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ proc push*(s: var RunningStat, x: int) =
|
||||||
## and the other push operation is called.
|
## and the other push operation is called.
|
||||||
s.push(toFloat(x))
|
s.push(toFloat(x))
|
||||||
|
|
||||||
proc push*(s: var RunningStat, x: openarray[float|int]) =
|
proc push*(s: var RunningStat, x: openArray[float|int]) =
|
||||||
## pushes all values of `x` for processing.
|
## pushes all values of `x` for processing.
|
||||||
##
|
##
|
||||||
## Int values of `x` are simply converted to ``float`` and
|
## Int values of `x` are simply converted to ``float`` and
|
||||||
|
|
@ -277,7 +277,7 @@ proc push*(r: var RunningRegress, x, y: int) {.inline.} =
|
||||||
## and the other push operation is called.
|
## and the other push operation is called.
|
||||||
r.push(toFloat(x), toFloat(y))
|
r.push(toFloat(x), toFloat(y))
|
||||||
|
|
||||||
proc push*(r: var RunningRegress, x, y: openarray[float|int]) =
|
proc push*(r: var RunningRegress, x, y: openArray[float|int]) =
|
||||||
## pushes two sets of values `x` and `y` for processing.
|
## pushes two sets of values `x` and `y` for processing.
|
||||||
assert(x.len == y.len)
|
assert(x.len == y.len)
|
||||||
for i in 0..<x.len:
|
for i in 0..<x.len:
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,8 @@ type
|
||||||
region: ptr MemRegion
|
region: ptr MemRegion
|
||||||
|
|
||||||
var
|
var
|
||||||
tlRegion {.threadVar.}: MemRegion
|
tlRegion {.threadvar.}: MemRegion
|
||||||
# tempStrRegion {.threadVar.}: MemRegion # not yet used
|
# tempStrRegion {.threadvar.}: MemRegion # not yet used
|
||||||
|
|
||||||
template withRegion*(r: var MemRegion; body: untyped) =
|
template withRegion*(r: var MemRegion; body: untyped) =
|
||||||
let oldRegion = tlRegion
|
let oldRegion = tlRegion
|
||||||
|
|
@ -437,5 +437,5 @@ proc getTotalMem*(r: MemRegion): int =
|
||||||
|
|
||||||
proc nimGC_setStackBottom(theStackBottom: pointer) = discard
|
proc nimGC_setStackBottom(theStackBottom: pointer) = discard
|
||||||
|
|
||||||
proc nimGCref(x: pointer) {.compilerProc.} = discard
|
proc nimGCref(x: pointer) {.compilerproc.} = discard
|
||||||
proc nimGCunref(x: pointer) {.compilerProc.} = discard
|
proc nimGCunref(x: pointer) {.compilerproc.} = discard
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,8 @@ proc growObj(old: pointer, newsize: int): pointer =
|
||||||
|
|
||||||
proc nimGCref(p: pointer) {.compilerproc, inline.} = discard
|
proc nimGCref(p: pointer) {.compilerproc, inline.} = discard
|
||||||
proc nimGCunref(p: pointer) {.compilerproc, inline.} = discard
|
proc nimGCunref(p: pointer) {.compilerproc, inline.} = discard
|
||||||
proc nimGCunrefNoCycle(p: pointer) {.compilerProc, inline.} = discard
|
proc nimGCunrefNoCycle(p: pointer) {.compilerproc, inline.} = discard
|
||||||
proc nimGCunrefRC1(p: pointer) {.compilerProc, inline.} = discard
|
proc nimGCunrefRC1(p: pointer) {.compilerproc, inline.} = discard
|
||||||
proc nimGCvisit(d: pointer, op: int) {.compilerRtl.} = discard
|
proc nimGCvisit(d: pointer, op: int) {.compilerRtl.} = discard
|
||||||
|
|
||||||
proc unsureAsgnRef(dest: PPointer, src: pointer) {.compilerproc, inline.} =
|
proc unsureAsgnRef(dest: PPointer, src: pointer) {.compilerproc, inline.} =
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ template checkOsError =
|
||||||
template log(msg: string, body: untyped) =
|
template log(msg: string, body: untyped) =
|
||||||
if mode in {ScriptMode.Verbose, ScriptMode.Whatif}:
|
if mode in {ScriptMode.Verbose, ScriptMode.Whatif}:
|
||||||
echo "[NimScript] ", msg
|
echo "[NimScript] ", msg
|
||||||
if mode != ScriptMode.WhatIf:
|
if mode != ScriptMode.Whatif:
|
||||||
body
|
body
|
||||||
|
|
||||||
proc listDirs*(dir: string): seq[string] =
|
proc listDirs*(dir: string): seq[string] =
|
||||||
|
|
|
||||||
|
|
@ -80,22 +80,22 @@ proc signal(cv: var FastCondVar) =
|
||||||
signal(cv.slow)
|
signal(cv.slow)
|
||||||
|
|
||||||
type
|
type
|
||||||
Barrier* {.compilerProc.} = object
|
Barrier* {.compilerproc.} = object
|
||||||
counter: int
|
counter: int
|
||||||
cv: CondVar
|
cv: CondVar
|
||||||
|
|
||||||
proc barrierEnter*(b: ptr Barrier) {.compilerProc.} =
|
proc barrierEnter*(b: ptr Barrier) {.compilerproc.} =
|
||||||
atomicInc b.counter
|
atomicInc b.counter
|
||||||
|
|
||||||
proc barrierLeave*(b: ptr Barrier) {.compilerProc.} =
|
proc barrierLeave*(b: ptr Barrier) {.compilerproc.} =
|
||||||
atomicDec b.counter
|
atomicDec b.counter
|
||||||
if b.counter <= 0: signal(b.cv)
|
if b.counter <= 0: signal(b.cv)
|
||||||
|
|
||||||
proc openBarrier*(b: ptr Barrier) {.compilerProc.} =
|
proc openBarrier*(b: ptr Barrier) {.compilerproc.} =
|
||||||
b.counter = 0
|
b.counter = 0
|
||||||
b.cv = createCondVar()
|
b.cv = createCondVar()
|
||||||
|
|
||||||
proc closeBarrier*(b: ptr Barrier) {.compilerProc.} =
|
proc closeBarrier*(b: ptr Barrier) {.compilerproc.} =
|
||||||
await(b.cv)
|
await(b.cv)
|
||||||
destroyCondVar(b.cv)
|
destroyCondVar(b.cv)
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ type
|
||||||
data: pointer
|
data: pointer
|
||||||
ready: bool # put it here for correct alignment!
|
ready: bool # put it here for correct alignment!
|
||||||
|
|
||||||
proc nimArgsPassingDone(p: pointer) {.compilerProc.} =
|
proc nimArgsPassingDone(p: pointer) {.compilerproc.} =
|
||||||
let w = cast[ptr Worker](p)
|
let w = cast[ptr Worker](p)
|
||||||
signal(w.taskStarted)
|
signal(w.taskStarted)
|
||||||
|
|
||||||
|
|
@ -167,7 +167,7 @@ template spawnX*(call: typed) =
|
||||||
if preferSpawn(): spawn call
|
if preferSpawn(): spawn call
|
||||||
else: call
|
else: call
|
||||||
|
|
||||||
proc nimSpawn(fn: WorkerProc; data: pointer) {.compilerProc.} =
|
proc nimSpawn(fn: WorkerProc; data: pointer) {.compilerproc.} =
|
||||||
# implementation of 'spawn' that is used by the code generator.
|
# implementation of 'spawn' that is used by the code generator.
|
||||||
while true:
|
while true:
|
||||||
for i in 0.. high(workers):
|
for i in 0.. high(workers):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue