Merge branch 'devel' of github.com:Araq/Nimrod into devel
This commit is contained in:
commit
eadf648767
5 changed files with 105 additions and 3 deletions
|
|
@ -814,7 +814,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
leValueConv(regs[ra].regToNode, regs[rc].regToNode)):
|
leValueConv(regs[ra].regToNode, regs[rc].regToNode)):
|
||||||
stackTrace(c, tos, pc, errGenerated,
|
stackTrace(c, tos, pc, errGenerated,
|
||||||
msgKindToString(errIllegalConvFromXtoY) % [
|
msgKindToString(errIllegalConvFromXtoY) % [
|
||||||
"unknown type" , "unknown type"])
|
$regs[ra].regToNode, "[" & $regs[rb].regToNode & ".." & $regs[rc].regToNode & "]"])
|
||||||
of opcIndCall, opcIndCallAsgn:
|
of opcIndCall, opcIndCallAsgn:
|
||||||
# dest = call regStart, n; where regStart = fn, arg1, ...
|
# dest = call regStart, n; where regStart = fn, arg1, ...
|
||||||
let rb = instr.regB
|
let rb = instr.regB
|
||||||
|
|
|
||||||
|
|
@ -101,3 +101,81 @@ proc feupdateenv*(envp: ptr Tfenv): cint {.importc, header: "<fenv.h>".}
|
||||||
## Save current exceptions in temporary storage, install environment
|
## Save current exceptions in temporary storage, install environment
|
||||||
## represented by object pointed to by `envp` and raise exceptions
|
## represented by object pointed to by `envp` and raise exceptions
|
||||||
## according to saved exceptions.
|
## according to saved exceptions.
|
||||||
|
|
||||||
|
var FP_RADIX_INTERNAL {. importc: "FLT_RADIX" header: "<float.h>" .} : int
|
||||||
|
|
||||||
|
template fpRadix* : int = FLT_RADIX_INTERNAL
|
||||||
|
## The (integer) value of the radix used to represent any floating
|
||||||
|
## point type on the architecture used to build the program.
|
||||||
|
|
||||||
|
var FLT_MANT_DIG {. importc: "FLT_MANT_DIG" header: "<float.h>" .} : int
|
||||||
|
var FLT_DIG {. importc: "FLT_DIG" header: "<float.h>" .} : int
|
||||||
|
var FLT_MIN_EXP {. importc: "FLT_MIN_EXP" header: "<float.h>" .} : int
|
||||||
|
var FLT_MAX_EXP {. importc: "FLT_MAX_EXP" header: "<float.h>" .} : int
|
||||||
|
var FLT_MIN_10_EXP {. importc: "FLT_MIN_10_EXP" header: "<float.h>" .} : int
|
||||||
|
var FLT_MAX_10_EXP {. importc: "FLT_MAX_10_EXP" header: "<float.h>" .} : int
|
||||||
|
var FLT_MIN {. importc: "FLT_MIN" header: "<float.h>" .} : cfloat
|
||||||
|
var FLT_MAX {. importc: "FLT_MAX" header: "<float.h>" .} : cfloat
|
||||||
|
var FLT_EPSILON {. importc: "FLT_EPSILON" header: "<float.h>" .} : cfloat
|
||||||
|
|
||||||
|
var DBL_MANT_DIG {. importc: "DBL_MANT_DIG" header: "<float.h>" .} : int
|
||||||
|
var DBL_DIG {. importc: "DBL_DIG" header: "<float.h>" .} : int
|
||||||
|
var DBL_MIN_EXP {. importc: "DBL_MIN_EXP" header: "<float.h>" .} : int
|
||||||
|
var DBL_MAX_EXP {. importc: "DBL_MAX_EXP" header: "<float.h>" .} : int
|
||||||
|
var DBL_MIN_10_EXP {. importc: "DBL_MIN_10_EXP" header: "<float.h>" .} : int
|
||||||
|
var DBL_MAX_10_EXP {. importc: "DBL_MAX_10_EXP" header: "<float.h>" .} : int
|
||||||
|
var DBL_MIN {. importc: "DBL_MIN" header: "<float.h>" .} : cdouble
|
||||||
|
var DBL_MAX {. importc: "DBL_MAX" header: "<float.h>" .} : cdouble
|
||||||
|
var DBL_EPSILON {. importc: "DBL_EPSILON" header: "<float.h>" .} : cdouble
|
||||||
|
|
||||||
|
template mantissaDigits*(T : typedesc[float32]) : int = FLT_MANT_DIG
|
||||||
|
## Number of digits (in base ``floatingPointRadix``) in the mantissa
|
||||||
|
## of 32-bit floating-point numbers.
|
||||||
|
template digits*(T : typedesc[float32]) : int = FLT_DIG
|
||||||
|
## Number of decimal digits that can be represented in a
|
||||||
|
## 32-bit floating-point type without losing precision.
|
||||||
|
template minExponent*(T : typedesc[float32]) : int = FLT_MIN_EXP
|
||||||
|
## Minimum (negative) exponent for 32-bit floating-point numbers.
|
||||||
|
template maxExponent*(T : typedesc[float32]) : int = FLT_MAX_EXP
|
||||||
|
## Maximum (positive) exponent for 32-bit floating-point numbers.
|
||||||
|
template min10Exponent*(T : typedesc[float32]) : int = FLT_MIN_10_EXP
|
||||||
|
## Minimum (negative) exponent in base 10 for 32-bit floating-point
|
||||||
|
## numbers.
|
||||||
|
template max10Exponent*(T : typedesc[float32]) : int = FLT_MAX_10_EXP
|
||||||
|
## Maximum (positive) exponent in base 10 for 32-bit floating-point
|
||||||
|
## numbers.
|
||||||
|
template minimumPositiveValue*(T : typedesc[float32]) : float32 = FLT_MIN
|
||||||
|
## The smallest positive (nonzero) number that can be represented in a
|
||||||
|
## 32-bit floating-point type.
|
||||||
|
template maximumPositiveValue*(T : typedesc[float32]) : float32 = FLT_MAX
|
||||||
|
## The largest positive number that can be represented in a 32-bit
|
||||||
|
## floating-point type.
|
||||||
|
template epsilon*(T : typedesc[float32]): float32 = FLT_EPSILON
|
||||||
|
## The difference between 1.0 and the smallest number greater than
|
||||||
|
## 1.0 that can be represented in a 32-bit floating-point type.
|
||||||
|
|
||||||
|
template mantissaDigits*(T : typedesc[float64]) : int = DBL_MANT_DIG
|
||||||
|
## Number of digits (in base ``floatingPointRadix``) in the mantissa
|
||||||
|
## of 64-bit floating-point numbers.
|
||||||
|
template digits*(T : typedesc[float64]) : int = DBL_DIG
|
||||||
|
## Number of decimal digits that can be represented in a
|
||||||
|
## 64-bit floating-point type without losing precision.
|
||||||
|
template minExponent*(T : typedesc[float64]) : int = DBL_MIN_EXP
|
||||||
|
## Minimum (negative) exponent for 64-bit floating-point numbers.
|
||||||
|
template maxExponent*(T : typedesc[float64]) : int = DBL_MAX_EXP
|
||||||
|
## Maximum (positive) exponent for 64-bit floating-point numbers.
|
||||||
|
template min10Exponent*(T : typedesc[float64]) : int = DBL_MIN_10_EXP
|
||||||
|
## Minimum (negative) exponent in base 10 for 64-bit floating-point
|
||||||
|
## numbers.
|
||||||
|
template max10Exponent*(T : typedesc[float64]) : int = DBL_MAX_10_EXP
|
||||||
|
## Maximum (positive) exponent in base 10 for 64-bit floating-point
|
||||||
|
## numbers.
|
||||||
|
template minimumPositiveValue*(T : typedesc[float64]) : float64 = DBL_MIN
|
||||||
|
## The smallest positive (nonzero) number that can be represented in a
|
||||||
|
## 64-bit floating-point type.
|
||||||
|
template maximumPositiveValue*(T : typedesc[float64]) : float64 = DBL_MAX
|
||||||
|
## The largest positive number that can be represented in a 64-bit
|
||||||
|
## floating-point type.
|
||||||
|
template epsilon*(T : typedesc[float64]): float64 = DBL_EPSILON
|
||||||
|
## The difference between 1.0 and the smallest number greater than
|
||||||
|
## 1.0 that can be represented in a 64-bit floating-point type.
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ method log*(logger: RollingFileLogger, level: Level,
|
||||||
logger.curLine = 0
|
logger.curLine = 0
|
||||||
logger.f = open(logger.baseName, logger.baseMode)
|
logger.f = open(logger.baseName, logger.baseMode)
|
||||||
|
|
||||||
writeln(logger.f, LevelNames[level], " ", frmt % args)
|
writeln(logger.f, LevelNames[level], " ",substituteLog(logger.fmtStr), frmt % args)
|
||||||
logger.curLine.inc
|
logger.curLine.inc
|
||||||
|
|
||||||
# --------
|
# --------
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,30 @@ proc keys*(r: Redis, pattern: string): RedisList =
|
||||||
r.sendCommand("KEYS", pattern)
|
r.sendCommand("KEYS", pattern)
|
||||||
return r.readArray()
|
return r.readArray()
|
||||||
|
|
||||||
|
proc scan*(r: Redis, cursor: var BiggestInt): RedisList =
|
||||||
|
## Find all keys matching the given pattern and yield it to client in portions
|
||||||
|
## using default Redis values for MATCH and COUNT parameters
|
||||||
|
r.sendCommand("SCAN", $cursor)
|
||||||
|
let reply = r.readArray()
|
||||||
|
cursor = strutils.parseBiggestInt(reply[0])
|
||||||
|
return reply[1..high(reply)]
|
||||||
|
|
||||||
|
proc scan*(r: Redis, cursor: var BiggestInt, pattern: string): RedisList =
|
||||||
|
## Find all keys matching the given pattern and yield it to client in portions
|
||||||
|
## using cursor as a client query identifier. Using default Redis value for COUNT argument
|
||||||
|
r.sendCommand("SCAN", $cursor, ["MATCH", pattern])
|
||||||
|
let reply = r.readArray()
|
||||||
|
cursor = strutils.parseBiggestInt(reply[0])
|
||||||
|
return reply[1..high(reply)]
|
||||||
|
|
||||||
|
proc scan*(r: Redis, cursor: var BiggestInt, pattern: string, count: int): RedisList =
|
||||||
|
## Find all keys matching the given pattern and yield it to client in portions
|
||||||
|
## using cursor as a client query identifier.
|
||||||
|
r.sendCommand("SCAN", $cursor, ["MATCH", pattern, "COUNT", $count])
|
||||||
|
let reply = r.readArray()
|
||||||
|
cursor = strutils.parseBiggestInt(reply[0])
|
||||||
|
return reply[1..high(reply)]
|
||||||
|
|
||||||
proc move*(r: Redis, key: string, db: int): bool =
|
proc move*(r: Redis, key: string, db: int): bool =
|
||||||
## Move a key to another database. Returns `true` on a successful move.
|
## Move a key to another database. Returns `true` on a successful move.
|
||||||
r.sendCommand("MOVE", key, $db)
|
r.sendCommand("MOVE", key, $db)
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ proc readAll(file: File): TaintedString =
|
||||||
proc readFile(filename: string): TaintedString =
|
proc readFile(filename: string): TaintedString =
|
||||||
var f = open(filename)
|
var f = open(filename)
|
||||||
try:
|
try:
|
||||||
result = readAllFile(f).TaintedString
|
result = readAll(f).TaintedString
|
||||||
finally:
|
finally:
|
||||||
close(f)
|
close(f)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue