summary refs log tree commit diff stats
path: root/lib
Commit message (Expand)AuthorAgeFilesLines
* getCustomPragmaVal priority/override fixes (#17725)Clyybber2021-04-211-38/+40
* close #9372 add std/tempfiles (#17361)flywind2021-04-211-0/+139
* Fix Httpclient headers from being modified accidentally (#17808)Joey2021-04-211-2/+5
* CIs: attempt to use csources_v1 (#16282)Andreas Rumpf2021-04-2129-62/+61
* [std/tasks]add gcsafe pragmas (#17799)flywind2021-04-211-4/+4
* [std/deques] move data instead of copy + destroy (#17800)flywind2021-04-201-4/+2
* followup #16714: add -d:nimLegacyUnarySlice + changelog (#17794)Timothee Cour2021-04-201-0/+10
* fix https://github.com/nim-lang/RFCs/issues/311 remove unary slice (#16714)Timothee Cour2021-04-191-8/+0
* Small privateAccess improvement (#17786)Clyybber2021-04-191-1/+1
* Rename `=` to `=copy` in stdlib (#17781)Clyybber2021-04-195-4/+5
* [std/locks]close #7998(complete condition variables) (#17711)flywind2021-04-195-45/+60
* [std/locks]remove workaround for withLock (#17772)flywind2021-04-191-4/+3
* Documentation only, dom (#17770)Juan Carlos2021-04-191-1/+3
* [std/rlocks]add inline pragma (#17773)flywind2021-04-191-3/+3
* privateAccess now works with ref | ptr (#17760)Timothee Cour2021-04-191-1/+1
* Fix #17755 (#17766)Dankr4d2021-04-181-2/+11
* fix #17749 ignore SIGPIPE signals, fix nim CI #17748 (#17752)Timothee Cour2021-04-181-3/+13
* IC exposes typedesc implementation shenanigans (#17759)Andreas Rumpf2021-04-181-1/+1
* make cuchar alias uint8 instead of char (#17738)shirleyquirk2021-04-171-1/+1
* replace defer with try ... finally (#17753)flywind2021-04-171-5/+5
* cString => cSourceString; tyCString => tyCstring so that error msgs show cstr...Timothee Cour2021-04-175-8/+8
* Fix buffer-overrun bug in net (#17728) [backport:1.0]shirleyquirk2021-04-161-4/+3
* std/hashes: hash(ref|ptr|pointer) + other improvements (#17731)Timothee Cour2021-04-161-23/+49
* start using import {.all.} (#17736)Timothee Cour2021-04-161-22/+0
* `import foo {.all.}` reboot (#17706)Timothee Cour2021-04-161-0/+34
* make the copy operation of Thread an error (#17734)flywind2021-04-161-0/+2
* Fix array's high & low return type for empty arrays (#17705)Tanguy Cizain2021-04-151-0/+8
* Fix getCustomPragmaVal for some multi arg pragmas (#17723)Clyybber2021-04-151-41/+45
* rst indentation fixes (ref #17340) (#17715)Andrey Makarov2021-04-152-39/+74
* simplify asyncfutures, asyncmacro (#17633)Timothee Cour2021-04-142-72/+31
* getCustomPragma is split up in more usable chunks (#11526)Arne Döring2021-04-141-93/+165
* callback cannot be nil (#17718)flywind2021-04-141-0/+1
* Update channels.nim (#17717)flywind2021-04-141-4/+4
* Remove the use of usrToCell in gcMark [backport:1.2] (#17709)zah2021-04-142-6/+5
* add number literal jsbigints.big (#17707)Timothee Cour2021-04-131-7/+13
* remove unnecessary assignment (#17702)flywind2021-04-121-1/+0
* followup strformat PR. backslash escapes, tests, docs (#17700)shirleyquirk2021-04-121-4/+29
* macrocache.nim: removed trailing whitespaceAraq2021-04-111-23/+23
* iterable[T] (#17196)Timothee Cour2021-04-111-0/+4
* [feature] add arbitrary code execution to strformat (#17694)shirleyquirk2021-04-111-9/+28
* restyle RST option lists (#17637)Andrey Makarov2021-04-103-8/+16
* Genode platform fixes (#17521)Emery Hemingway2021-04-094-24/+48
* hashes: Made the runnableExample easier to understand (#17689)Andreas Rumpf2021-04-091-1/+1
* add std/tasks (#17447)flywind2021-04-091-0/+272
* Fix small typos (#17680)konsumlamm2021-04-091-0/+1
* Fix rst typo (#17671)konsumlamm2021-04-081-1/+1
* Update `sysrand` documentation (#17676)konsumlamm2021-04-081-16/+16
* further progress on rst roles & directives (fix #17646) (#17659)Andrey Makarov2021-04-0810-50/+92
* Improve endians module (#17674)konsumlamm2021-04-081-7/+42
* use strstr for a faster find implementation (#17672)Andreas Rumpf2021-04-081-3/+26
>PIdent # for hash-table chaining h*: int # hash value of s var flip: int proc newCaseNode(data: string): PCaseNode = new(result) if flip == 0: result.kind = nkStr result.data = data else: result.kind = nkWhole result.unused = @["", "abc", "abdc"] flip = 1 - flip proc newCaseNode(a, b: PCaseNode): PCaseNode = new(result) result.kind = nkList result.sons = @[a, b] proc caseTree(lvl: int = 0): PCaseNode = if lvl == 3: result = newCaseNode("data item") else: result = newCaseNode(caseTree(lvl+1), caseTree(lvl+1)) proc finalizeNode(n: PNode) = assert(n != nil) write(stdout, "finalizing: ") if isNil(n.data): writeLine(stdout, "nil!") else: writeLine(stdout, "not nil") var id: int = 1 proc buildTree(depth = 1): PNode = if depth == 7: return nil new(result, finalizeNode) result.le = buildTree(depth+1) result.ri = buildTree(depth+1) result.data = $id inc(id) proc returnTree(): PNode = writeLine(stdout, "creating id: " & $id) new(result, finalizeNode) result.data = $id new(result.le, finalizeNode) result.le.data = $id & ".1" new(result.ri, finalizeNode) result.ri.data = $id & ".2" inc(id) # now create a cycle: writeLine(stdout, "creating id (cyclic): " & $id) var cycle: PNode new(cycle, finalizeNode) cycle.data = $id cycle.le = cycle cycle.ri = cycle inc(id) #writeLine(stdout, "refcount: " & $refcount(cycle)) #writeLine(stdout, "refcount le: " & $refcount(cycle.le)) #writeLine(stdout, "refcount ri: " & $refcount(cycle.ri)) proc printTree(t: PNode) = if t == nil: return writeLine(stdout, "printing") writeLine(stdout, t.data) printTree(t.le) printTree(t.ri) proc unsureNew(result: var PNode) = writeLine(stdout, "creating unsure id: " & $id) new(result, finalizeNode) result.data = $id new(result.le, finalizeNode) result.le.data = $id & ".a" new(result.ri, finalizeNode) result.ri.data = $id & ".b" inc(id) proc setSons(n: var TBNode) = n.sons = @[] # free memory of the sons n.t.data = @[] var m: seq[string] m = @[] setLen(m, len(n.t.data) * 2) for i in 0..high(m): m[i] = "..." n.t.data = m proc buildBTree(father: var TBNode) = father.data = "father" father.other = nil father.sons = @[] for i in 1..10: write(stdout, "next iteration!\n") var n: TBNode n.other = returnTree() n.data = "B node: " & $i if i mod 2 == 0: n.sons = @[] # nil and [] need to be handled correctly! add father.sons, n father.t.counter = 0 father.t.max = 3 father.t.data = @["ha", "lets", "stress", "it"] setSons(father) proc getIdent(identifier: cstring, length: int, h: int): PIdent = new(result) result.h = h result.s = newString(length) proc main() = discard getIdent("addr", 4, 0) discard getIdent("hall", 4, 0) discard getIdent("echo", 4, 0) discard getIdent("huch", 4, 0) var father: TBNode for i in 1..1_00: buildBTree(father) for i in 1..1_00: var t = returnTree() var t2: PNode unsureNew(t2) write(stdout, "now building bigger trees: ") var t2: PNode for i in 1..100: t2 = buildTree() printTree(t2) write(stdout, "now test sequences of strings:") var s: seq[string] = @[] for i in 1..100: add s, "hohoho" # test reallocation writeLine(stdout, s[89]) write(stdout, "done!\n") var father: TBNode s: string s = "" s = "" writeLine(stdout, repr(caseTree())) father.t.data = @["ha", "lets", "stress", "it"] father.t.data = @["ha", "lets", "stress", "it"] var t = buildTree() write(stdout, repr(t[])) buildBTree(father) write(stdout, repr(father)) write(stdout, "starting main...\n") main() GC_fullCollect() # the M&S GC fails with this call and it's unclear why. Definitely something # we need to fix! GC_fullCollect() writeLine(stdout, GC_getStatistics()) write(stdout, "finished\n")