cligen/sysUt

Types

CopyMemable = concept typeof(CpMem)
    supportsCopyMem(CpMem)

Procs

proc `&`[T](x: openArray[T]; y: openArray[T]): seq[T]
Allow [1] & [2] exprs; system/ has only add var seq openArray.
proc `:=`[T](x: var T; y: T): T
A assignment expression like convenience operator
proc decd[T: Ordinal | uint | uint64](x: var T; amt = 1): T {.inline.}
Similar to prefix -- in C languages: decrement then yield value
proc decSat[T: Ordinal](x: var T)
Like dec, but saturating & only -1; Never raises | panics.
proc delete(x: var string; i: Natural) {.noSideEffect, ...raises: [], tags: [],
    forbids: [].}
Just like delete(var seq[T], i) but for string.
proc delItem[T](x: var seq[T]; item: T): int
proc echoQuit130() {.noconv, ...raises: [], tags: [], forbids: [].}
Intended for setControlCHook(echoQuit130) to achieve quieter exits.
proc findUO(s: string; c: char): int {.noSideEffect, ...raises: [], tags: [],
                                       forbids: [].}
proc incd[T: Ordinal | uint | uint64](x: var T; amt = 1): T {.inline.}
Similar to prefix ++ in C languages: increment then yield value
proc incSat[T: Ordinal](x: var T)
Like inc, but saturating & only +1; Never raises | panics.
proc newSeqNoInit[T: CopyMemable](len: Natural): seq[T]
Make a new seq[T] of length len, skipping memory clear. (newSeqUninitialized overly constrains T to disallow [bool], etc.)
proc postDec[T: Ordinal | uint | uint64](x: var T; amt = 1): T {.inline.}
Similar to post-fix -- in C languages: yield initial val, then decrement
proc postInc[T: Ordinal | uint | uint64](x: var T; amt = 1): T {.inline.}
Similar to post-fix ++ in C languages: yield initial val, then increment
proc seekable(f: File): bool {....raises: [], tags: [], forbids: [].}
True if Nim File is bound to an OS file pointing at a seekable device.

Iterators

iterator maybePar(parallel: bool; a, b: int): int {....raises: [], tags: [],
    forbids: [].}
if flag is true yield ||(a,b) else countup(a,b).

Macros

macro enumerate(x: ForLoopStmt): untyped
Generic enumerate macro; E.g.: for i,e in enumerate([3,2,1]): echo i.
macro toItr(x: ForLoopStmt): untyped
Convert factory proc call for inline-iterator-like usage. E.g.: for e in toItr myFactory(parm): echo e.

Templates

template toOa[T](p: pointer; a, b: int): untyped
Make an openArray from ptr, range triple.