From 72f2a6e2755cdeaf1db85a9b119b694b9a2cb472 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Fri, 16 Mar 2012 05:33:21 +0200 Subject: the test suite is mostly green again --- lib/pure/collections/sequtils.nim | 2 +- lib/pure/colors.nim | 6 +++--- lib/pure/os.nim | 4 ++-- lib/wrappers/sdl/sdl.nim | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim index b7a57ac0c..e3034d635 100644 --- a/lib/pure/collections/sequtils.nim +++ b/lib/pure/collections/sequtils.nim @@ -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')``. diff --git a/lib/pure/colors.nim b/lib/pure/colors.nim index 6a86a43c4..00edaad9c 100755 --- a/lib/pure/colors.nim +++ b/lib/pure/colors.nim @@ -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)) diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 76f934c04..5ea93eb06 100755 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -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 diff --git a/lib/wrappers/sdl/sdl.nim b/lib/wrappers/sdl/sdl.nim index 8ddab49dd..cf4eb452d 100755 --- a/lib/wrappers/sdl/sdl.nim +++ b/lib/wrappers/sdl/sdl.nim @@ -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}) -- cgit 1.4.1-2-gfad0