summary refs log tree commit diff stats
path: root/tests/coroutines
Commit message (Expand)AuthorAgeFilesLines
* stdlib tests now check refc too (#21664)ringabout2023-04-212-2/+2
* fix #15628 (#16387)flywind2021-01-212-25/+36
* testament: error instead of silently ignore invalid targets; remove pointless...Timothee Cour2020-12-144-4/+4
* Close#5586 (#14682)Dylan Modesitt2020-06-162-3/+0
* #12103 - CI for OpenBSD (#12105)Euan2020-04-212-0/+2
* intVal works now on enum field symbols (#11403)Arne Döring2019-06-051-0/+3
* disable flaky coroutines testAndreas Rumpf2019-02-131-0/+1
* fix coro testArne Döring2018-11-231-1/+1
* updated tests to be executedArne Döring2018-11-231-1/+2
* disable some tests for the C++ target; refs #7870Araq2018-11-154-0/+13
* attempt to make travis OSX tests green and mandatoryAndreas Rumpf2017-03-291-0/+1
* Fix waiting on coroutines (#5463)Rokas Kupstys2017-03-022-0/+20
* Proper use of sequences in coroutine testsRokas Kupstys2017-02-242-11/+8
* Removed test code from coro.nim and created three real tests for coroutinesRokas Kupstys2017-02-206-0/+68
ght: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
{.push stack_trace: off.}

const useLibC = not defined(nimNoLibc)

when not defined(nimHasHotCodeReloading):
  {.pragma: nonReloadable.}

when useLibC:
  import ansi_c

proc nimCopyMem*(dest, source: pointer, size: Natural) {.nonReloadable, compilerproc, inline.} =
  when useLibC:
    c_memcpy(dest, source, size)
  else:
    let d = cast[ptr UncheckedArray[byte]](dest)
    let s = cast[ptr UncheckedArray[byte]](source)
    var i = 0
    while i < size:
      d[i] = s[i]
      inc i

proc nimSetMem*(a: pointer, v: cint, size: Natural) {.nonReloadable, inline.} =
  when useLibC:
    c_memset(a, v, size)
  else:
    let a = cast[ptr UncheckedArray[byte]](a)
    var i = 0
    let v = cast[byte](v)
    while i < size:
      a[i] = v
      inc i

proc nimZeroMem*(p: pointer, size: Natural) {.compilerproc, nonReloadable, inline.} =
  nimSetMem(p, 0, size)

proc nimCmpMem*(a, b: pointer, size: Natural): cint {.compilerproc, nonReloadable, inline.} =
  when useLibC:
    c_memcmp(a, b, size)
  else:
    let a = cast[ptr UncheckedArray[byte]](a)
    let b = cast[ptr UncheckedArray[byte]](b)
    var i = 0
    while i < size:
      let d = a[i].cint - b[i].cint
      if d != 0: return d
      inc i

proc nimCStrLen*(a: cstring): csize {.compilerproc, nonReloadable, inline.} =
  when useLibC:
    c_strlen(a)
  else:
    var a = cast[ptr byte](a)
    while a[] != 0:
      a = cast[ptr byte](cast[uint](a) + 1)
      inc result

{.pop.}