the test suite is mostly green again

This commit is contained in:
Zahary Karadjov 2012-03-16 05:33:21 +02:00
commit 72f2a6e275
19 changed files with 46 additions and 67 deletions

View file

@ -50,7 +50,7 @@ proc filter*[T](seq1: seq[T], pred: proc(item: T): bool): seq[T] =
## Returns all items in a sequence that fulfilled the predicate.
accumulateResult(filter(seq1, pred))
template filterIt*(seq1, pred: expr): expr =
template filterIt*(seq1, pred: expr): expr {.immediate.} =
## Finds a specific item in a sequence as long as the
## predicate returns true. The predicate needs to be an expression
## containing ``it``: ``filterIt("abcxyz", it == 'x')``.

View file

@ -17,15 +17,15 @@ type
proc `==` *(a, b: TColor): bool {.borrow.}
## compares two colors.
template extract(a: TColor, r, g, b: expr) =
template extract(a: TColor, r, g, b: expr) {.immediate.}=
var r = a.int shr 16 and 0xff
var g = a.int shr 8 and 0xff
var b = a.int and 0xff
template rawRGB(r, g, b: expr): expr =
template rawRGB(r, g, b: int): expr =
TColor(r shl 16 or g shl 8 or b)
template colorOp(op: expr) =
template colorOp(op: expr) {.immediate.} =
extract(a, ar, ag, ab)
extract(b, br, bg, bb)
result = rawRGB(op(ar, br), op(ag, bg), op(ab, bb))

View file

@ -242,12 +242,12 @@ proc UnixToNativePath*(path: string): string {.
inc(i)
when defined(windows):
template wrapUnary(varname, winApiProc, arg: expr) =
template wrapUnary(varname, winApiProc, arg: expr) {.immediate.} =
var tmp = allocWideCString(arg)
var varname = winApiProc(tmp)
dealloc tmp
template wrapBinary(varname, winApiProc, arg, arg2: expr) =
template wrapBinary(varname, winApiProc, arg, arg2: expr) {.immediate.} =
var tmp2 = allocWideCString(arg)
var varname = winApiProc(tmp2, arg2)
dealloc tmp2

View file

@ -1284,9 +1284,9 @@ type # This is the system-independent thread info struc
TProcedure* = proc ()
type TEventSeq = set[TEventKind]
template evconv(procName: expr, ptrName: typeDesc, assertions: TEventSeq): stmt =
template evconv(procName: expr, ptrName: typeDesc, assertions: TEventSeq): stmt {.immediate.} =
proc `procName`*(event: PEvent): ptrName =
assert(assertions.contains(event.kind))
assert(contains(assertions, event.kind))
result = cast[ptrName](event)
evconv(EvActive, PActiveEvent, {ACTIVEEVENT})