* fixes #21393 and misc style changes * progress --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
parent
7dc80a7fef
commit
8a19ac2070
11 changed files with 70 additions and 61 deletions
|
|
@ -33,26 +33,27 @@ template high*(t: typedesc[Int128]): Int128 = Max
|
||||||
proc `$`*(a: Int128): string
|
proc `$`*(a: Int128): string
|
||||||
|
|
||||||
proc toInt128*[T: SomeInteger | bool](arg: T): Int128 =
|
proc toInt128*[T: SomeInteger | bool](arg: T): Int128 =
|
||||||
when T is bool: result.sdata(0) = int32(arg)
|
{.noSideEffect.}:
|
||||||
elif T is SomeUnsignedInt:
|
when T is bool: result.sdata(0) = int32(arg)
|
||||||
when sizeof(arg) <= 4:
|
elif T is SomeUnsignedInt:
|
||||||
result.udata[0] = uint32(arg)
|
when sizeof(arg) <= 4:
|
||||||
|
result.udata[0] = uint32(arg)
|
||||||
|
else:
|
||||||
|
result.udata[0] = uint32(arg and T(0xffffffff))
|
||||||
|
result.udata[1] = uint32(arg shr 32)
|
||||||
|
elif sizeof(arg) <= 4:
|
||||||
|
result.sdata(0) = int32(arg)
|
||||||
|
if arg < 0: # sign extend
|
||||||
|
result.sdata(1) = -1
|
||||||
|
result.sdata(2) = -1
|
||||||
|
result.sdata(3) = -1
|
||||||
else:
|
else:
|
||||||
result.udata[0] = uint32(arg and T(0xffffffff))
|
let tmp = int64(arg)
|
||||||
result.udata[1] = uint32(arg shr 32)
|
result.udata[0] = uint32(tmp and 0xffffffff)
|
||||||
elif sizeof(arg) <= 4:
|
result.sdata(1) = int32(tmp shr 32)
|
||||||
result.sdata(0) = int32(arg)
|
if arg < 0: # sign extend
|
||||||
if arg < 0: # sign extend
|
result.sdata(2) = -1
|
||||||
result.sdata(1) = -1
|
result.sdata(3) = -1
|
||||||
result.sdata(2) = -1
|
|
||||||
result.sdata(3) = -1
|
|
||||||
else:
|
|
||||||
let tmp = int64(arg)
|
|
||||||
result.udata[0] = uint32(tmp and 0xffffffff)
|
|
||||||
result.sdata(1) = int32(tmp shr 32)
|
|
||||||
if arg < 0: # sign extend
|
|
||||||
result.sdata(2) = -1
|
|
||||||
result.sdata(3) = -1
|
|
||||||
|
|
||||||
template isNegative(arg: Int128): bool =
|
template isNegative(arg: Int128): bool =
|
||||||
arg.sdata(3) < 0
|
arg.sdata(3) < 0
|
||||||
|
|
|
||||||
|
|
@ -822,9 +822,6 @@ proc checkForSink(tracked: PEffects; n: PNode) =
|
||||||
if tracked.inIfStmt == 0 and optSinkInference in tracked.config.options:
|
if tracked.inIfStmt == 0 and optSinkInference in tracked.config.options:
|
||||||
checkForSink(tracked.config, tracked.c.idgen, tracked.owner, n)
|
checkForSink(tracked.config, tracked.c.idgen, tracked.owner, n)
|
||||||
|
|
||||||
proc strictFuncsActive(tracked: PEffects): bool {.inline.} =
|
|
||||||
sfNoSideEffect in tracked.owner.flags and strictFuncs in tracked.c.features and not tracked.inEnforcedNoSideEffects
|
|
||||||
|
|
||||||
proc trackCall(tracked: PEffects; n: PNode) =
|
proc trackCall(tracked: PEffects; n: PNode) =
|
||||||
template gcsafeAndSideeffectCheck() =
|
template gcsafeAndSideeffectCheck() =
|
||||||
if notGcSafe(op) and not importedFromC(a):
|
if notGcSafe(op) and not importedFromC(a):
|
||||||
|
|
@ -934,9 +931,11 @@ proc trackCall(tracked: PEffects; n: PNode) =
|
||||||
# initialized until after the call. Since we do this after we analysed the
|
# initialized until after the call. Since we do this after we analysed the
|
||||||
# call, this is fine.
|
# call, this is fine.
|
||||||
initVar(tracked, n[i].skipAddr, false)
|
initVar(tracked, n[i].skipAddr, false)
|
||||||
if tracked.strictFuncsActive and isDangerousLocation(n[i].skipAddr, tracked.owner):
|
if strictFuncs in tracked.c.features and not tracked.inEnforcedNoSideEffects and
|
||||||
localError(tracked.config, n[i].info,
|
isDangerousLocation(n[i].skipAddr, tracked.owner):
|
||||||
"cannot pass $1 to `var T` parameter within a strict func" % renderTree(n[i]))
|
if sfNoSideEffect in tracked.owner.flags:
|
||||||
|
localError(tracked.config, n[i].info,
|
||||||
|
"cannot pass $1 to `var T` parameter within a strict func" % renderTree(n[i]))
|
||||||
tracked.hasSideEffect = true
|
tracked.hasSideEffect = true
|
||||||
else: discard
|
else: discard
|
||||||
|
|
||||||
|
|
@ -1090,10 +1089,12 @@ proc track(tracked: PEffects, n: PNode) =
|
||||||
createTypeBoundOps(tracked, n[0].typ, n.info)
|
createTypeBoundOps(tracked, n[0].typ, n.info)
|
||||||
if n[0].kind != nkSym or not isLocalSym(tracked, n[0].sym):
|
if n[0].kind != nkSym or not isLocalSym(tracked, n[0].sym):
|
||||||
checkForSink(tracked, n[1])
|
checkForSink(tracked, n[1])
|
||||||
if tracked.strictFuncsActive and isDangerousLocation(n[0], tracked.owner):
|
if strictFuncs in tracked.c.features and not tracked.inEnforcedNoSideEffects and
|
||||||
|
isDangerousLocation(n[0], tracked.owner):
|
||||||
tracked.hasSideEffect = true
|
tracked.hasSideEffect = true
|
||||||
localError(tracked.config, n[0].info,
|
if sfNoSideEffect in tracked.owner.flags:
|
||||||
"cannot mutate location $1 within a strict func" % renderTree(n[0]))
|
localError(tracked.config, n[0].info,
|
||||||
|
"cannot mutate location $1 within a strict func" % renderTree(n[0]))
|
||||||
of nkVarSection, nkLetSection:
|
of nkVarSection, nkLetSection:
|
||||||
for child in n:
|
for child in n:
|
||||||
let last = lastSon(child)
|
let last = lastSon(child)
|
||||||
|
|
|
||||||
|
|
@ -447,7 +447,7 @@ proc mgetOrPut*[A, B](t: var Table[A, B], key: A, val: B): var B =
|
||||||
##
|
##
|
||||||
##
|
##
|
||||||
## Note that while the value returned is of type `var B`,
|
## Note that while the value returned is of type `var B`,
|
||||||
## it is easy to accidentally create an copy of the value at `t[key]`.
|
## it is easy to accidentally create a copy of the value at `t[key]`.
|
||||||
## Remember that seqs and strings are value types, and therefore
|
## Remember that seqs and strings are value types, and therefore
|
||||||
## cannot be copied into a separate variable for modification.
|
## cannot be copied into a separate variable for modification.
|
||||||
## See the example below.
|
## See the example below.
|
||||||
|
|
@ -828,7 +828,8 @@ proc newTable*[A, B](initialSize = defaultInitialSize): TableRef[A, B] =
|
||||||
b = newTable[char, seq[int]]()
|
b = newTable[char, seq[int]]()
|
||||||
|
|
||||||
new(result)
|
new(result)
|
||||||
result[] = initTable[A, B](initialSize)
|
{.noSideEffect.}:
|
||||||
|
result[] = initTable[A, B](initialSize)
|
||||||
|
|
||||||
proc newTable*[A, B](pairs: openArray[(A, B)]): TableRef[A, B] =
|
proc newTable*[A, B](pairs: openArray[(A, B)]): TableRef[A, B] =
|
||||||
## Creates a new ref hash table that contains the given `pairs`.
|
## Creates a new ref hash table that contains the given `pairs`.
|
||||||
|
|
@ -844,14 +845,16 @@ proc newTable*[A, B](pairs: openArray[(A, B)]): TableRef[A, B] =
|
||||||
assert b == {'a': 5, 'b': 9}.newTable
|
assert b == {'a': 5, 'b': 9}.newTable
|
||||||
|
|
||||||
new(result)
|
new(result)
|
||||||
result[] = toTable[A, B](pairs)
|
{.noSideEffect.}:
|
||||||
|
result[] = toTable[A, B](pairs)
|
||||||
|
|
||||||
proc newTableFrom*[A, B, C](collection: A, index: proc(x: B): C): TableRef[C, B] =
|
proc newTableFrom*[A, B, C](collection: A, index: proc(x: B): C): TableRef[C, B] =
|
||||||
## Index the collection with the proc provided.
|
## Index the collection with the proc provided.
|
||||||
# TODO: As soon as supported, change collection: A to collection: A[B]
|
# TODO: As soon as supported, change collection: A to collection: A[B]
|
||||||
result = newTable[C, B]()
|
result = newTable[C, B]()
|
||||||
for item in collection:
|
{.noSideEffect.}:
|
||||||
result[index(item)] = item
|
for item in collection:
|
||||||
|
result[index(item)] = item
|
||||||
|
|
||||||
proc `[]`*[A, B](t: TableRef[A, B], key: A): var B =
|
proc `[]`*[A, B](t: TableRef[A, B], key: A): var B =
|
||||||
## Retrieves the value at `t[key]`.
|
## Retrieves the value at `t[key]`.
|
||||||
|
|
@ -1825,7 +1828,8 @@ proc newOrderedTable*[A, B](initialSize = defaultInitialSize): OrderedTableRef[A
|
||||||
a = newOrderedTable[int, string]()
|
a = newOrderedTable[int, string]()
|
||||||
b = newOrderedTable[char, seq[int]]()
|
b = newOrderedTable[char, seq[int]]()
|
||||||
new(result)
|
new(result)
|
||||||
result[] = initOrderedTable[A, B](initialSize)
|
{.noSideEffect.}:
|
||||||
|
result[] = initOrderedTable[A, B](initialSize)
|
||||||
|
|
||||||
proc newOrderedTable*[A, B](pairs: openArray[(A, B)]): OrderedTableRef[A, B] =
|
proc newOrderedTable*[A, B](pairs: openArray[(A, B)]): OrderedTableRef[A, B] =
|
||||||
## Creates a new ordered ref hash table that contains the given `pairs`.
|
## Creates a new ordered ref hash table that contains the given `pairs`.
|
||||||
|
|
@ -1842,7 +1846,8 @@ proc newOrderedTable*[A, B](pairs: openArray[(A, B)]): OrderedTableRef[A, B] =
|
||||||
assert b == {'a': 5, 'b': 9}.newOrderedTable
|
assert b == {'a': 5, 'b': 9}.newOrderedTable
|
||||||
|
|
||||||
result = newOrderedTable[A, B](pairs.len)
|
result = newOrderedTable[A, B](pairs.len)
|
||||||
for key, val in items(pairs): result[key] = val
|
{.noSideEffect.}:
|
||||||
|
for key, val in items(pairs): result[key] = val
|
||||||
|
|
||||||
|
|
||||||
proc `[]`*[A, B](t: OrderedTableRef[A, B], key: A): var B =
|
proc `[]`*[A, B](t: OrderedTableRef[A, B], key: A): var B =
|
||||||
|
|
@ -2641,13 +2646,15 @@ proc newCountTable*[A](initialSize = defaultInitialSize): CountTableRef[A] =
|
||||||
## * `initCountTable proc<#initCountTable>`_ for creating a
|
## * `initCountTable proc<#initCountTable>`_ for creating a
|
||||||
## `CountTable`
|
## `CountTable`
|
||||||
new(result)
|
new(result)
|
||||||
result[] = initCountTable[A](initialSize)
|
{.noSideEffect.}:
|
||||||
|
result[] = initCountTable[A](initialSize)
|
||||||
|
|
||||||
proc newCountTable*[A](keys: openArray[A]): CountTableRef[A] =
|
proc newCountTable*[A](keys: openArray[A]): CountTableRef[A] =
|
||||||
## Creates a new ref count table with every member of a container `keys`
|
## Creates a new ref count table with every member of a container `keys`
|
||||||
## having a count of how many times it occurs in that container.
|
## having a count of how many times it occurs in that container.
|
||||||
result = newCountTable[A](keys.len)
|
result = newCountTable[A](keys.len)
|
||||||
for key in items(keys): result.inc(key)
|
{.noSideEffect.}:
|
||||||
|
for key in items(keys): result.inc(key)
|
||||||
|
|
||||||
proc `[]`*[A](t: CountTableRef[A], key: A): int =
|
proc `[]`*[A](t: CountTableRef[A], key: A): int =
|
||||||
## Retrieves the value at `t[key]` if `key` is in `t`.
|
## Retrieves the value at `t[key]` if `key` is in `t`.
|
||||||
|
|
@ -2671,7 +2678,8 @@ proc `[]=`*[A](t: CountTableRef[A], key: A, val: int) =
|
||||||
## * `inc proc<#inc,CountTableRef[A],A,int>`_ for incrementing a
|
## * `inc proc<#inc,CountTableRef[A],A,int>`_ for incrementing a
|
||||||
## value of a key
|
## value of a key
|
||||||
assert val > 0
|
assert val > 0
|
||||||
t[][key] = val
|
{.noSideEffect.}:
|
||||||
|
t[][key] = val
|
||||||
|
|
||||||
proc inc*[A](t: CountTableRef[A], key: A, val = 1) =
|
proc inc*[A](t: CountTableRef[A], key: A, val = 1) =
|
||||||
## Increments `t[key]` by `val` (default: 1).
|
## Increments `t[key]` by `val` (default: 1).
|
||||||
|
|
@ -2680,7 +2688,8 @@ proc inc*[A](t: CountTableRef[A], key: A, val = 1) =
|
||||||
a.inc('a')
|
a.inc('a')
|
||||||
a.inc('b', 10)
|
a.inc('b', 10)
|
||||||
doAssert a == newCountTable("aaabbbbbbbbbbb")
|
doAssert a == newCountTable("aaabbbbbbbbbbb")
|
||||||
t[].inc(key, val)
|
{.noSideEffect.}:
|
||||||
|
t[].inc(key, val)
|
||||||
|
|
||||||
proc smallest*[A](t: CountTableRef[A]): tuple[key: A, val: int] =
|
proc smallest*[A](t: CountTableRef[A]): tuple[key: A, val: int] =
|
||||||
## Returns the `(key, value)` pair with the smallest `val`. Efficiency: O(n)
|
## Returns the `(key, value)` pair with the smallest `val`. Efficiency: O(n)
|
||||||
|
|
|
||||||
|
|
@ -536,6 +536,7 @@ proc hash*[T: tuple | object | proc](x: T): Hash =
|
||||||
elif T is (proc):
|
elif T is (proc):
|
||||||
result = hash(pointer(x))
|
result = hash(pointer(x))
|
||||||
else:
|
else:
|
||||||
|
result = 0
|
||||||
for f in fields(x):
|
for f in fields(x):
|
||||||
result = result !& hash(f)
|
result = result !& hash(f)
|
||||||
result = !$result
|
result = !$result
|
||||||
|
|
@ -551,6 +552,7 @@ proc hash*[A](x: openArray[A]): Hash =
|
||||||
else:
|
else:
|
||||||
result = murmurHash(toOpenArrayByte(x, 0, x.high))
|
result = murmurHash(toOpenArrayByte(x, 0, x.high))
|
||||||
else:
|
else:
|
||||||
|
result = 0
|
||||||
for a in x:
|
for a in x:
|
||||||
result = result !& hash(a)
|
result = result !& hash(a)
|
||||||
result = !$result
|
result = !$result
|
||||||
|
|
@ -583,6 +585,7 @@ proc hash*[A](aBuf: openArray[A], sPos, ePos: int): Hash =
|
||||||
proc hash*[A](x: set[A]): Hash =
|
proc hash*[A](x: set[A]): Hash =
|
||||||
## Efficient hashing of sets.
|
## Efficient hashing of sets.
|
||||||
## There must be a `hash` proc defined for the element type `A`.
|
## There must be a `hash` proc defined for the element type `A`.
|
||||||
|
result = 0
|
||||||
for it in items(x):
|
for it in items(x):
|
||||||
result = result !& hash(it)
|
result = result !& hash(it)
|
||||||
result = !$result
|
result = !$result
|
||||||
|
|
|
||||||
|
|
@ -570,12 +570,8 @@ when defined(windows) and not defined(useNimRtl):
|
||||||
if a == 0: raiseOSError(osLastError())
|
if a == 0: raiseOSError(osLastError())
|
||||||
|
|
||||||
proc newFileHandleStream(handle: Handle): owned FileHandleStream =
|
proc newFileHandleStream(handle: Handle): owned FileHandleStream =
|
||||||
new(result)
|
result = FileHandleStream(handle: handle, closeImpl: hsClose, atEndImpl: hsAtEnd,
|
||||||
result.handle = handle
|
readDataImpl: hsReadData, writeDataImpl: hsWriteData)
|
||||||
result.closeImpl = hsClose
|
|
||||||
result.atEndImpl = hsAtEnd
|
|
||||||
result.readDataImpl = hsReadData
|
|
||||||
result.writeDataImpl = hsWriteData
|
|
||||||
|
|
||||||
proc buildCommandLine(a: string, args: openArray[string]): string =
|
proc buildCommandLine(a: string, args: openArray[string]): string =
|
||||||
result = quoteShell(a)
|
result = quoteShell(a)
|
||||||
|
|
|
||||||
|
|
@ -101,9 +101,7 @@ proc addInt*(result: var string; x: int64) {.enforceNoRaises.} =
|
||||||
num = cast[uint64](x)
|
num = cast[uint64](x)
|
||||||
else:
|
else:
|
||||||
num = uint64(-x)
|
num = uint64(-x)
|
||||||
let base = result.len
|
result.add '-'
|
||||||
setLen(result, base + 1)
|
|
||||||
result[base] = '-'
|
|
||||||
else:
|
else:
|
||||||
num = uint64(x)
|
num = uint64(x)
|
||||||
addInt(result, num)
|
addInt(result, num)
|
||||||
|
|
|
||||||
|
|
@ -571,7 +571,7 @@ proc normExt(ext: string): string =
|
||||||
|
|
||||||
proc searchExtPos*(path: string): int =
|
proc searchExtPos*(path: string): int =
|
||||||
## Returns index of the `'.'` char in `path` if it signifies the beginning
|
## Returns index of the `'.'` char in `path` if it signifies the beginning
|
||||||
## of extension. Returns -1 otherwise.
|
## of the file extension. Returns -1 otherwise.
|
||||||
##
|
##
|
||||||
## See also:
|
## See also:
|
||||||
## * `splitFile proc`_
|
## * `splitFile proc`_
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,8 @@ proc shrink*[T](x: var seq[T]; newLen: Natural) {.tags: [], raises: [].} =
|
||||||
for i in countdown(x.len - 1, newLen):
|
for i in countdown(x.len - 1, newLen):
|
||||||
reset x[i]
|
reset x[i]
|
||||||
# XXX This is wrong for const seqs that were moved into 'x'!
|
# XXX This is wrong for const seqs that were moved into 'x'!
|
||||||
cast[ptr NimSeqV2[T]](addr x).len = newLen
|
{.noSideEffect.}:
|
||||||
|
cast[ptr NimSeqV2[T]](addr x).len = newLen
|
||||||
|
|
||||||
proc grow*[T](x: var seq[T]; newLen: Natural; value: T) =
|
proc grow*[T](x: var seq[T]; newLen: Natural; value: T) =
|
||||||
let oldLen = x.len
|
let oldLen = x.len
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ proc eqStrings(a, b: string): bool {.inline, compilerproc.} =
|
||||||
proc hashString(s: string): int {.compilerproc.} =
|
proc hashString(s: string): int {.compilerproc.} =
|
||||||
# the compiler needs exactly the same hash function!
|
# the compiler needs exactly the same hash function!
|
||||||
# this used to be used for efficient generation of string case statements
|
# this used to be used for efficient generation of string case statements
|
||||||
var h : uint = 0
|
var h = 0'u
|
||||||
for i in 0..len(s)-1:
|
for i in 0..len(s)-1:
|
||||||
h = h + uint(s[i])
|
h = h + uint(s[i])
|
||||||
h = h + h shl 10
|
h = h + h shl 10
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,12 @@ type
|
||||||
HGLRC* = Handle
|
HGLRC* = Handle
|
||||||
BYTE* = uint8
|
BYTE* = uint8
|
||||||
|
|
||||||
SECURITY_ATTRIBUTES* {.final, pure.} = object
|
SECURITY_ATTRIBUTES* = object
|
||||||
nLength*: int32
|
nLength*: int32
|
||||||
lpSecurityDescriptor*: pointer
|
lpSecurityDescriptor*: pointer
|
||||||
bInheritHandle*: WINBOOL
|
bInheritHandle*: WINBOOL
|
||||||
|
|
||||||
STARTUPINFO* {.final, pure.} = object
|
STARTUPINFO* = object
|
||||||
cb*: int32
|
cb*: int32
|
||||||
lpReserved*: cstring
|
lpReserved*: cstring
|
||||||
lpDesktop*: cstring
|
lpDesktop*: cstring
|
||||||
|
|
@ -73,17 +73,17 @@ type
|
||||||
hStdOutput*: Handle
|
hStdOutput*: Handle
|
||||||
hStdError*: Handle
|
hStdError*: Handle
|
||||||
|
|
||||||
PROCESS_INFORMATION* {.final, pure.} = object
|
PROCESS_INFORMATION* = object
|
||||||
hProcess*: Handle
|
hProcess*: Handle
|
||||||
hThread*: Handle
|
hThread*: Handle
|
||||||
dwProcessId*: int32
|
dwProcessId*: int32
|
||||||
dwThreadId*: int32
|
dwThreadId*: int32
|
||||||
|
|
||||||
FILETIME* {.final, pure.} = object ## CANNOT BE int64 BECAUSE OF ALIGNMENT
|
FILETIME* = object ## CANNOT BE int64 BECAUSE OF ALIGNMENT
|
||||||
dwLowDateTime*: DWORD
|
dwLowDateTime*: DWORD
|
||||||
dwHighDateTime*: DWORD
|
dwHighDateTime*: DWORD
|
||||||
|
|
||||||
BY_HANDLE_FILE_INFORMATION* {.final, pure.} = object
|
BY_HANDLE_FILE_INFORMATION* = object
|
||||||
dwFileAttributes*: DWORD
|
dwFileAttributes*: DWORD
|
||||||
ftCreationTime*: FILETIME
|
ftCreationTime*: FILETIME
|
||||||
ftLastAccessTime*: FILETIME
|
ftLastAccessTime*: FILETIME
|
||||||
|
|
@ -95,7 +95,7 @@ type
|
||||||
nFileIndexHigh*: DWORD
|
nFileIndexHigh*: DWORD
|
||||||
nFileIndexLow*: DWORD
|
nFileIndexLow*: DWORD
|
||||||
|
|
||||||
OSVERSIONINFO* {.final, pure.} = object
|
OSVERSIONINFO* = object
|
||||||
dwOSVersionInfoSize*: DWORD
|
dwOSVersionInfoSize*: DWORD
|
||||||
dwMajorVersion*: DWORD
|
dwMajorVersion*: DWORD
|
||||||
dwMinorVersion*: DWORD
|
dwMinorVersion*: DWORD
|
||||||
|
|
@ -820,7 +820,7 @@ type
|
||||||
POVERLAPPED_COMPLETION_ROUTINE* = proc (para1: DWORD, para2: DWORD,
|
POVERLAPPED_COMPLETION_ROUTINE* = proc (para1: DWORD, para2: DWORD,
|
||||||
para3: POVERLAPPED){.stdcall.}
|
para3: POVERLAPPED){.stdcall.}
|
||||||
|
|
||||||
GUID* {.final, pure.} = object
|
GUID* = object
|
||||||
D1*: int32
|
D1*: int32
|
||||||
D2*: int16
|
D2*: int16
|
||||||
D3*: int16
|
D3*: int16
|
||||||
|
|
@ -1101,7 +1101,7 @@ proc wsaResetEvent*(hEvent: Handle): bool
|
||||||
{.stdcall, importc: "WSAResetEvent", dynlib: "ws2_32.dll".}
|
{.stdcall, importc: "WSAResetEvent", dynlib: "ws2_32.dll".}
|
||||||
|
|
||||||
type
|
type
|
||||||
KEY_EVENT_RECORD* {.final, pure.} = object
|
KEY_EVENT_RECORD* = object
|
||||||
eventType*: int16
|
eventType*: int16
|
||||||
bKeyDown*: WINBOOL
|
bKeyDown*: WINBOOL
|
||||||
wRepeatCount*: int16
|
wRepeatCount*: int16
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ type
|
||||||
JsonNode3 = ref object
|
JsonNode3 = ref object
|
||||||
fields: MyTable
|
fields: MyTable
|
||||||
|
|
||||||
proc `[]`(t: var MyTable, key: string): var int =
|
proc `[]`(t: MyTable, key: string): int =
|
||||||
result = t.data[0]
|
result = t.data[0]
|
||||||
|
|
||||||
proc `[]`(x: JsonNode3, key: string): int =
|
proc `[]`(x: JsonNode3, key: string): int =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue