Commit Graph

4720 Commits

Author SHA1 Message Date
Miran
11c377c114 add enumerate macro (#15297)
* add `enumerate` macro

* address the comments

* put `enumerate` in its own module
2020-09-22 13:08:36 +02:00
flywind
ab05e141c0 deinitLock (#15383)
* deinitLock

* minor
2020-09-22 13:07:31 +02:00
Andreas Rumpf
1fae66e4df better nativestacktrace support; refs #15284; backport [1.2] (#15384)
* nimStackTraceOverride: enable stack traces in exceptions

This is a two-step stack trace collection scheme, because re-raised
exceptions will collect multiple stack traces but use them rarely, when
printing info about an uncaught exception, so it makes sense to only do
the cheap stack unwinding all the time and the relatively expensive
debugging information collection on-demand.

`asyncfutures` implements its own `$` proc for printing
`seq[StackTraceEntry]`, so we have to add the debugging info there, just
like we do for the private `$` proc in `system/excpt`.

* cleaned up PR #15284

Co-authored-by: Ștefan Talpalaru <stefantalpalaru@yahoo.com>
2020-09-22 13:03:24 +02:00
Clyybber
d67c5cb751 Add strutils.indentation and make unindent use it (#15264)
* Add strutils.indentation and make unindent use it

* Code style

* Fix bootstrapping

* Improve wording

* Fix test

* Introduce without breaking change

* Fix

* Reduce diff

* Fix docs link

* Add since annotation

* Update changelog
2020-09-22 10:43:12 +02:00
alaviss
aca9c5fb30 os: make getApplFreebsd available for NetBSD (#15381)
NetBSD was switched to getApplFreebsd() in #15359, however the proc was
not made available for the said target.

This commit exposes `getApplFreebsd()` to NetBSD.
2020-09-21 19:52:44 +02:00
Andreas Rumpf
04cecdf9c2 async: removed the 'unown' references, async never worked with --newruntime anyway and --newruntime is dead (#15374) 2020-09-20 18:01:07 +02:00
Andreas Rumpf
ebb632ccba fixes #15369 (#15371) 2020-09-20 01:07:13 +02:00
Andreas Rumpf
a15d77df7e ORC/ARC async progress (#15370)
* ARC/ORC: fixes memory leak for empty seqs that have a non-zero capacity

* async: minor refactorings

* it helps to finish a refactoring
2020-09-20 00:27:32 +02:00
Andreas Rumpf
cbdda631db base64: fixes the error message for an invalid base64 input character [backport:1.2] 2020-09-20 00:05:41 +02:00
Andreas Rumpf
9a34009f00 ORC and stdlib optimizations (#15362) 2020-09-19 00:27:43 +02:00
Timothee Cour
8ae4a774b7 doc fix typo in lib/pure/httpclient.nim (#15364) 2020-09-19 00:20:41 +02:00
Euan
ae1f5c1559 Use sysctl on NetBSD to get exe name (#15359) 2020-09-18 22:26:53 +02:00
yatsen1
341cd844b2 fix coro proc crash for stack problem when run long enough than a GC cycle (#7612) (#11410)
Co-authored-by: drswinghead <drswinghead@gmail.com>
Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-09-18 17:17:09 +02:00
Andreas Rumpf
2671efab78 async: minor refactorings (#15354) 2020-09-18 11:22:34 +02:00
flywind
c57023f324 string is not nil anymore (#15352) 2020-09-18 10:02:31 +02:00
Yuriy Glukhov
28a64869f0 Fixed undeclared nimIdentNormalize compilation error in parseEnum (#15343) 2020-09-16 19:41:57 +02:00
flywind
de7f2372be docs minor and #15335 (#15337) 2020-09-16 14:58:50 +02:00
Andreas Rumpf
fd31e8ff6f allow old styled RTTI for arc/orc (#15331) 2020-09-16 14:57:01 +02:00
flywind
366216da64 fix cookie with comma (#15319) 2020-09-14 09:00:29 +02:00
Jaremy Creechley
6c49767a6c Fixing issue #15302 -- lwip doesn't support signals (#15303)
* Fixing issue #15302 -- lwip doesn't support signals

* Adding test to catch issue #15302 -- lwip/freertos net library
don't try to build / run on windows, it'll compile only but not run

Fixing issue #15302 -- reworking test to compile on other platforms
2020-09-14 08:57:49 +02:00
flywind
a41b243fea remove annoying messages when creating orderedTables (#15309)
* nativesockets docs minor [backport: 1.2]

* remove annoying messages
2020-09-12 10:34:11 +02:00
Araq
9e4920c068 fixes #15021 2020-09-11 14:21:09 +02:00
Ivan Bobev
ccd77b42af Add some enhancements to jsonutils.nim (#15133)
* 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>
2020-09-09 14:18:59 +02:00
flywind
8c82144ba5 add getprotobyname (#15273)
* add getprotobyname

* tests, docs, changelog

* add since
2020-09-09 12:47:22 +02:00
flywind
a81610230d nativesockets docs minor [backport: 1.2] (#15285) 2020-09-08 11:27:43 +02:00
flywind
e08b802d79 more Protocol supports in windows (#15274) [backport:1.2] 2020-09-07 12:10:20 +02:00
IDF
70d6238756 Add SSL_CTX_set_session_id_context (#15233)
* Added SSL_CTX_set_session_id_context()

* Added basic nimdoc

* Raise an error if sessionIdContext is longer than the maximum length

* Update nimdocs
2020-09-04 22:27:51 +01:00
Miran
4fb17bc03b fix #15257, toHex couldn't handle large uint64 (#15261) [backport:1.2] 2020-09-04 09:23:27 +02:00
Jaremy Creechley
a76ae8f795 Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) (#15250)
* 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
2020-08-31 11:48:54 +02:00
Andy Davidoff
b5424b826e template hygiene (#15240) 2020-08-29 08:06:11 -04:00
Andreas Rumpf
ccccd30cf6 fixes #15221 (#15230) 2020-08-27 11:25:20 +02:00
Scott Wadden
a9a9860b0b Raise KeyError if passed an invalid row entry (#15227) 2020-08-26 20:00:54 +02:00
Araq
40969296e9 fixes #15207 [backport:1.2] 2020-08-26 15:27:15 +02:00
Miran
5163fe7d87 remove deprecation from math.round (#15224) 2020-08-25 15:59:42 +02:00
Miran
15ff89cec1 [backport] fix #15064, strscans.scanf edge case for '$+' (#15223) 2020-08-25 09:57:15 +02:00
Jon
8321617a78 fix in doc: incomplete output (#15222) [ci skip] 2020-08-24 08:33:51 +02:00
Mamy Ratsimbazafy
07d82b5cc4 Use more lent in options (#15208) 2020-08-24 08:05:17 +02:00
John Dupuy
66eba3388a Added more SSL documentation to net module. (#15206)
* 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>
2020-08-22 11:00:38 +01:00
Elijah Shaw-Rutschman
8a004e2fc0 Add test coverage for atomics (#15193)
* 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>
2020-08-18 18:02:10 +02:00
Andreas Rumpf
ddff13f01b better strict funcs, WIP (#15199)
* better strict funcs, WIP

* progress
2020-08-18 12:45:22 +02:00
Andreas Rumpf
6feb3900b1 fixes #15177, the error message is now what it should have been (#15195) 2020-08-17 14:32:52 +02:00
slangmgh
ba042af9cc std/with support field assign (#14484)
* 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>
2020-08-15 01:33:21 +02:00
alaviss
957bf15a08 asyncnet: don't try to close the socket again [backport] (#15174)
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.
2020-08-12 08:04:54 +02:00
Cléber Zavadniak
ce2da87eca Fix typo on CoroutineRef* doc (#15179)
Just a small fix for a typo ("for for").
2020-08-12 04:46:16 +02:00
Silvio
963db9e7da docs: dlimport -> dynlib (#15175) 2020-08-11 14:49:57 +02:00
haxscramper
e5dbdc1d37 [FIX] strtabs interpolation in nimscript (#15172)
* [FIX] strtabs interpolation in nimscript

* [TEST] Use `static` in strtabs test
2020-08-09 14:12:53 +02:00
flywind
eee3b189ff fix #15148 (#15149)
* fix #15148

Co-authored-by: alaviss <leorize+oss@disroot.org>
2020-08-08 07:24:54 +02:00
ee7
6f482ab934 deques.nim: Refactor the toDeque functionality (#15166)
This commit polishes the new proc introduced by d9ed816b10.

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.
2020-08-07 22:54:34 +02:00
archnim
d9ed816b10 Added the ability to initialize a deque with an openArray (#15138)
* 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
2020-08-05 12:41:42 -04:00
Andreas Rumpf
64aec6eb85 fixes a collect() bug reported on the forum (#15156) [backport:1.2] 2020-08-04 12:45:15 +02:00