summary refs log tree commit diff stats
path: root/lib/pure
Commit message (Collapse)AuthorAgeFilesLines
* remove annoying messages when creating orderedTables (#15309)flywind2020-09-121-11/+11
| | | | | * nativesockets docs minor [backport: 1.2] * remove annoying messages
* fixes #15021Araq2020-09-111-2/+2
|
* Add some enhancements to `jsonutils.nim` (#15133)Ivan Bobev2020-09-094-26/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add some enhancements to `jsonutils.nim` * Use `jsonutils.nim` hookable API to add a possibility to deserialize JSON arrays directly to `HashSet` and `OrderedSet` types and respectively to serialize those types to JSON arrays. * Also add a possibility to deserialize JSON `null` objects to Nim option objects and respectively to serialize Nim option object to JSON object if some or to JSON `null` object if none. * Move serialization/deserialization functionality for `Table` and `OrderedTable` types from `jsonutils.nim` to `tables.nim` via the hookable API. * Add object `jsonutils.Joptions` and parameter from its type to `jsonutils.fromJson` procedure to control whether to allow deserializing JSON objects to Nim objects when the JSON has some extra or missing keys. * Add unit tests for the added functionalities to `tjsonutils.nim`. * improve fromJsonFields * Add changelog entry for the jsonutils enhancements * Add TODO in `jsonutils.nim` * Added an entry to "Future directions" section in `jsonutils.nim` as suggestion for future support of serialization and de-serialization of nested variant objects. * Added currently disabled test case in `tjsonutils.nim` for testing serialization and de-serialization of nested variant objects. * Move JSON hooks to `jsonutils.nim` Move `fromJsonHook` and `toJsonHook` procedures for different types to `jsonutils.nim` module to avoid a dependency of collections modules to the `json.nim` module. The hooks are removed from the following modules: * `tables.nim` * `sets.nim` * `options.nim` * `strtabs.nim` * Add some tests about `StringTableRef` Add tests for `StringTableRef`'s `fromJsonHook` and `toJsonHook` to `tjsonutils.nim`. * Disable a warning in `jsonutils.nim` Mark `fun` template in `jsonutils` module with `{.used.}` pragma in order to disable `[XDeclaredButNotUsed]` hint. The template is actually used by the `initCaseObject` macro in the same module. Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* add getprotobyname (#15273)flywind2020-09-091-0/+14
| | | | | | | * add getprotobyname * tests, docs, changelog * add since
* nativesockets docs minor [backport: 1.2] (#15285)flywind2020-09-081-9/+9
|
* more Protocol supports in windows (#15274) [backport:1.2]flywind2020-09-071-5/+19
|
* Add SSL_CTX_set_session_id_context (#15233)IDF2020-09-041-0/+16
| | | | | | | | | * Added SSL_CTX_set_session_id_context() * Added basic nimdoc * Raise an error if sessionIdContext is longer than the maximum length * Update nimdocs
* fix #15257, `toHex` couldn't handle large uint64 (#15261) [backport:1.2]Miran2020-09-041-12/+31
|
* Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) (#15250)Jaremy Creechley2020-08-313-2/+4
| | | | | | | | | | | | | | | | | | | * Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) Adding FreeRTOS/LwIP to compiler: * adding freertos option * dyncalls for freertos * add freertos to posix os list * adding lwip option Setting up networking FreeRTOS/LwIP Port: * setting up lwip network for freertos * fixing posix / networking for freertos * disable setInheritable for freerots * using lwip for net control items * Fix builds by ignoring lib/posix/posix_freertos_consts.nim similar to lib/posix/posix_other_consts.nim
* template hygiene (#15240)Andy Davidoff2020-08-291-10/+13
|
* fixes #15221 (#15230)Andreas Rumpf2020-08-271-46/+44
|
* Raise KeyError if passed an invalid row entry (#15227)Scott Wadden2020-08-261-2/+7
|
* fixes #15207 [backport:1.2]Araq2020-08-261-19/+14
|
* remove deprecation from `math.round` (#15224)Miran2020-08-251-2/+1
|
* [backport] fix #15064, strscans.scanf edge case for '$+' (#15223)Miran2020-08-251-1/+1
|
* fix in doc: incomplete output (#15222) [ci skip]Jon2020-08-241-1/+1
|
* Use more `lent` in options (#15208)Mamy Ratsimbazafy2020-08-241-2/+2
|
* Added more SSL documentation to `net` module. (#15206)John Dupuy2020-08-221-3/+17
| | | | | | | | | | | | | | | | | | | | | | * Added more SSL documentation to `net` module. * Changed two of the net.nim doc refs to links. * Update lib/pure/net.nim doc wording. Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com> * Update lib/pure/net.nim - added space to doc URI Co-authored-by: alaviss <leorize+oss@disroot.org> * Fixed another doc URI in net module. * For net module doc added warning to connect procedure. * Update net.nim Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com> Co-authored-by: alaviss <leorize+oss@disroot.org>
* Add test coverage for atomics (#15193)Elijah Shaw-Rutschman2020-08-181-7/+7
| | | | | | | | | | | | | | | * Add test coverage for atomics Signed-off-by: Elijah Shaw-Rutschman <elijahr@gmail.com> * Fix compareExchange bugs for non-trivial objects Bugs fixed: 1. compareExchange would not set the desired value in the success case. 2. compareExchange would not set var expected to the found value in the failure case. 3. withLock would spin forever running the unit tests. try..body..finally prevents this. Not sure why this makes a difference, since an exception wasn’t being raised, but clearing the guard in a finally block seems correct anyways. Signed-off-by: Elijah Shaw-Rutschman <elijahr@gmail.com>
* better strict funcs, WIP (#15199)Andreas Rumpf2020-08-182-6/+10
| | | | | * better strict funcs, WIP * progress
* fixes #15177, the error message is now what it should have been (#15195)Andreas Rumpf2020-08-172-4/+3
|
* std/with support field assign (#14484)slangmgh2020-08-151-0/+26
| | | | | | | | | | | | | | | | | | | | | * std/with support filed assign * add changelog * add support x.dup.with * add example * revert support x.dup.with; add example * update changelog; fix assignment in parameter * Update changelog.md * add example for assignment in parameter * Remove colon style assign Co-authored-by: Clyybber <darkmine956@gmail.com>
* asyncnet: don't try to close the socket again [backport] (#15174)alaviss2020-08-121-17/+20
| | | | | The closed flag isn't a good design by any means, but let's have this working first before I get rid of the flag and potentially create a non-backportable commit.
* Fix typo on CoroutineRef* doc (#15179)Cléber Zavadniak2020-08-121-1/+1
| | | Just a small fix for a typo ("for for").
* docs: dlimport -> dynlib (#15175)Silvio2020-08-111-1/+1
|
* [FIX] strtabs interpolation in nimscript (#15172)haxscramper2020-08-091-1/+1
| | | | | * [FIX] strtabs interpolation in nimscript * [TEST] Use `static` in strtabs test
* fix #15148 (#15149)flywind2020-08-081-4/+11
| | | | | * fix #15148 Co-authored-by: alaviss <leorize+oss@disroot.org>
* deques.nim: Refactor the `toDeque` functionality (#15166)ee72020-08-071-5/+18
| | | | | | | | | | | | | | | | | | | | This commit polishes the new proc introduced by d9ed816b10a6. Changes: - Rename to `toDeque` for more consistency with well-known procs like `toHashSet` and `toTable`. - Rename the `openArray` parameter. The name `arr` was potentially less clear given that the proc can be used with a seq (or string). - Add a `since` annotation. - Reword the doc comment, and clarify that ordering is preserved. - Add runnableExamples. - Add "see also" cross linking between `initDeque` and `toDeque`. - Remove duplicate `nextPowerOfTwo`. The `initImpl` template already includes it. - Implement the proc using the `items` iterator, rather than indexing. This matches the implementation of `sets.toHashSet` and `tables.toTable`. - Add a test within `when isMainModule`. - Add a changelog entry.
* Added the ability to initialize a deque with an openArray (#15138)archnim2020-08-051-0/+6
| | | | | | | | | | | | * Add ability to initialize a deque with a sequence Example: var dq = initDeque[char](@['a', 'b', 'c']) * Update deques.nim * Optimized deque initialization * Sequence replaced by open array in deque initialization
* fixes a collect() bug reported on the forum (#15156) [backport:1.2]Andreas Rumpf2020-08-041-0/+10
|
* minor improvement (#15155)flywind2020-08-041-1/+1
|
* Remove `noSideEffect` pragmas (#15143)sschwarzer2020-08-012-2/+2
| | | | | | These don't seem to make sense for the purpose of the procs and lead to errors when the `--experimental:strictFuncs` feature is enabled. See also https://github.com/nim-lang/Nim/issues/15142
* net: allow close() to ignore SSL failures due to disconnections (#15120)alaviss2020-08-011-8/+98
| | | | | | | | | | | | | | * net: allow close() to ignore SSL failures due to disconnections Comes with this PR is also a SIGPIPE handling contraption. * net: don't do selectSigpipe() on macOS macOS sockets have SO_NOSIGPIPE set, so an EPIPE doesn't necessary mean that a SIGPIPE happened. * net: fix alreadyBlocked logic * net: WSAESHUTDOWN is also a disconnection error
* export asyncdispatch handles (#15140)flywind2020-08-011-1/+1
| | | | | | | * improve epoll docs * export handles * add comments and changelog
* Revert "Small typo (#15132)" (#15134)Andreas Rumpf2020-07-311-1/+1
| | | This reverts commit 4bf8d38248f40cc0bf5323843a9ea38c5bcc20a8.
* Small typo (#15132)Oliver Daniel2020-07-311-1/+1
| | | The expected output necessarily cannot match the formatted string.
* Fix tables.CountTable largest and smallest (#15115)treeform2020-07-291-4/+4
| | | It needs to have len defined first because of the assert .len > 0. I just moved it up a bit to make them work.
* asyncnet, net: don't attempt SSL_shutdown if a fatal error occurred (#15066)alaviss2020-07-302-34/+52
| | | | | | | | | | | | | | | | | | | | | | | | | * asyncnet, net: don't attempt SSL_shutdown if a fatal error occurred Per TLS standard and SSL_shutdown(3ssl). This should prevent errors coming from a close() after a bad event (ie. the other end of the pipe is closed before shutdown can be negotiated). Ref #9867 * tssl: try sending until an error occur * tssl: cleanup * tssl: actually run the test I forgot to make the test run :P * tssl: run the test on ARC, maybe then it'll be happy * tssl: turns off ARC, switch tlsEmulation on for freebsd * tssl: document why tlsEmulation is employed * net: move SafeDisconn handling logic to socketError
* fixes #14139 (#15107)flywind2020-07-291-3/+3
| | | | | | | * fix #14139 * Update lib/pure/collections/heapqueue.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Clyybber <darkmine956@gmail.com>
* Attempt to explain better why delImplIdx is the way it is. Maybe this can ↵c-blake2020-07-291-0/+30
| | | | | | | (#15108) avoid future implementation mischief. (Maybe not. Sometimes, general distrust of theory leads people to distrust simple reasoning over times from CPUs trying as hard as possible to mask DRAM latency via pre-fetch.)
* Fulfill https://github.com/nim-lang/Nim/pull/14995#issuecomment-664914391 ↵c-blake2020-07-283-42/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#15104) request. This can be conceived as an alternate, more capable resolution of https://github.com/nim-lang/Nim/issues/12200 than https://github.com/nim-lang/Nim/pull/12208 The code re-org idea here is to upgrade tablimpl.nim:`delImpl`/`delImplIdx` to abstract client code conventions for cell emptiness & cell hashing via three new template arguments - `makeEmpty`, `cellEmpty`, `cellHash` which all take a single integer argument and clear a cell, test if clear or produce the hash of the key stored at that index in `.data[]`. Then we update the 3 call sites (`Table`, `CountTable`, `SharedTable`) of `delImpl`/`delImplIdx` by defining define those arguments just before the first invocation as non-exported templates. Because `CountTable` does not save hash() outputs as `.hcode`, it needs a new tableimpl.nim:`delImplNoHCode` which simply in-lines the hash search when no `.hcode` field is available for "prefix compare" acceleration. It is conceivable this new template could be used by future variants, such as one optimized for integer keys where `hash()` and `==` are fast and `.hcode` is both wasted space & time (though a small change to interfaces there for a sentinel key meaning "empty" is needed for maximum efficiency). We also eliminate the old O(n) `proc remove(CountTable...)` in favor of simply invoking the new `delImpl*` templates and take care to correctly handle the case where `val` is either zero for non-existent keys in `inc` or evolves to zero over time in `[]=` or `inc`. The only user-visible changes from the +-42 delta here are speed, iteration order post deletes, and relaxing the `Positive` constraint on `val` in `proc inc` again, as indicated in the `changelog.md` entry.
* Fix #11352 strutil.insertSep() fails on negative numbers (#15087)Bung2020-07-281-6/+17
| | | | | | | | | | | | | | | | | | | * fix #11352 strutil.insertSep handle negtive number * test for #11352 * optimize * not parts string var * Update lib/pure/strutils.nim Thanks! Co-authored-by: alaviss <leorize+oss@disroot.org> * need to be countdown Co-authored-by: alaviss <leorize+oss@disroot.org>
* deprecate tables.allValues; continuation of #15047 (#15092)Miran2020-07-281-1/+2
|
* parsecsv: fix '\0' being displayed as '0' in docs (#15086) [backport]Jjp1372020-07-271-2/+2
|
* deprecate tables.add (#15047)Miran2020-07-251-4/+8
|
* json.nim: smaller init size (#15048)Miran2020-07-231-2/+2
| | | | There was a recent `rightSize` change in tables.nim, so the existing value (4) was creating too large tables.
* enforce browsers.nim only handles URLs [backport] (#15045)Andreas Rumpf2020-07-231-4/+10
|
* fix #15033 (#15034)Hugo Granström2020-07-221-1/+1
|
* smtp: Fix STARTTLS, request HELO once TLS is established (#15032)Mildred Ki'Lya2020-07-221-3/+9
|
* fix several newline problems (#15028) [backend]Miran2020-07-213-2/+37
| | | | * prevent newlines where they shouldn't be * 'contentLength' shouldn't be negative