Commit Graph

9214 Commits

Author SHA1 Message Date
gecko
7af484da94 Add client.close() in httpclient examples. (#20118)
Without this, the httpclient examples are essentially setting you up for failure. I was bitten by this when my app became unable to open any more sockets.

I'm not entirely sure how long this will relevant, as I hope destructors will be added to an upcoming version of the stdlib. But figured it was worth submitting anyways!
2022-08-04 06:46:08 +02:00
ringabout
59befed8ee prevent cache thrashing (#20129)
* prevent cache thrash

Co-authored-by: Charles Blake <cb@cblake.net>

* Update lib/pure/random.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: Charles Blake <cb@cblake.net>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-08-02 00:06:27 +08:00
Clay Sweetser
77891cedae Fix "Add Wider Ascii Chars sets and func for string formatting" (#20120) 2022-07-31 23:24:14 -04:00
Sultan Al Isaiee
3987a3bf97 Add Wider Ascii Chars sets and func for string formatting (#19994)
* Add more Ascii Chars sets

- add UpperCaseLetters set
- add LowerCaseLetters set
- add Punctuations set
- add PrintablesNoWhiteSpace set
- add Printables set
- add isPunctuationAscii func
- add isPrintableAscii func

* Omit isPunctuationAscii and isPrintableAscii procs

* Apply suggestions for adding Wider Ascii Chars sets

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>

* Update strutils.nim

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
2022-07-31 20:20:25 -04:00
ringabout
a8590d6707 [ORC] replace threadpool with createThread in the runnableExamples (#20106)
replace threadpool with createThreads in the runnableExamples
2022-07-31 20:02:23 -04:00
ringabout
86fc78a9c0 replace the broken link for ORC implementation with a working one (#20105) 2022-07-31 20:01:36 -04:00
Andrey Makarov
40e0048a50 Highlight Nim default in Markdown code in .nim (#20110)
Highlight Nim by default in Markdown code in .nim
2022-07-31 15:38:00 +02:00
ringabout
4c46358db1 remove shallowCopy for ARC/ORC (#20070)
* remove shallowCopy for ARC/ORC

* use move

* fix

* more fixes

* typo

* Update lib/system.nim

* follow

* add nodestroy

* move

* copy string

* add a changelog entry

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2022-07-26 16:51:01 +02:00
ringabout
1c39af3389 fixes #20089; remove setPointer since strings/seqs are not pointers with ORC (#20090)
fixes #20089; remove setPointer since strings/seqs are not pointers anymore
2022-07-26 16:48:01 +02:00
Lancer11211
efd5c571bf .forbids pragma: defining forbidden tags (#20050)
* .forbids pragma: defining illegal effects for proc types

This patch intends to define the opposite of the .tags pragma: a way to define effects which are not allowed in a proc.

* updated documentation and changelogs for the forbids pragma

* renamed notTagEffects to forbiddenEffects

* corrected issues of forbids pragma

the forbids pragma didn't handle simple restrictions properly and it also had issues with subtyping

* removed incorrect character from changelog

* added test to cover the interaction of methods and the forbids pragma

* covering the interaction of the tags and forbids pragmas

* updated manual about the forbids pragma

* removed useless statement

* corrected the subtyping of proc types using the forbids pragma

* updated manual for the forbids pragma

* updated documentations for forbids pragma

* updated nim docs

* updated docs with rsttester.nim

* regenerated documentation

* updated rst docs

* Update changelog.md

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>

* updated changelog

* corrected typo

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
2022-07-26 07:40:49 +02:00
Andrey Makarov
62b81d7f10 Markdown code blocks part 2; migrate Nim Manual (#20080)
* Change headings underscored by `~~~` to `###`

* Markdown code blocks part 2; migrate Nim Manual
2022-07-25 18:29:52 +02:00
metagn
685bf944aa fix #20067, fix #18976 [backport] (#20069) 2022-07-22 15:04:07 +08:00
flywind
d934ba9326 replace shallowcopy with move in ARC/ORC (#20061) 2022-07-18 21:23:39 +02:00
Antonis Geralis
f34734ffb4 Improve rand(bool) (#20045)
* Improve rand(bool)

* Use sign test instead of mod 2

* Use mod 2 again, as it works for js

* Use right shift as suggested by the authors of xoroshiro

* Update random.nim

* General case doesn't need any right shift it was correct to begin with

* Update random.nim

* add comment

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
2022-07-18 21:18:12 +02:00
Jacek Sieka
f2e4407306 epoll: correct mapping [backport] (#20058)
* epoll: correct mapping

`epoll_data` is a union and `epoll_event` is packed on `amd64`

* names
2022-07-18 21:03:25 +02:00
LetThereBeLemons
f443bece06 Fixed typo in std/os doc (#20054)
Fixed typo
2022-07-18 14:20:30 +08:00
Jacek Sieka
c6264ed847 fix pthread_mutex_t size (#20055) 2022-07-18 06:44:47 +02:00
kraptor
8679464e49 Display protocol name in exceptions raised by getProtoByName() (#19808) 2022-07-16 17:44:14 -04:00
Amjad Ben Hedhili
cf78c02b70 Make random.rand work with Ordinal (#20043)
* Make `random.rand` work with `Ordinal`

* Add changelog entry

* It's fine to cast to char
2022-07-16 16:51:27 -04:00
David Krause
60dd38c502 make AsyncSocket.getPeerAddr work ; fix #15022 (#20038)
Signed-off-by: David Krause <enthus1ast@users.noreply.github.com>
2022-07-16 10:59:58 +01:00
Andrey Makarov
417b90a7e5 Improve Markdown code blocks & start moving docs to Markdown style (#19954)
- add additional parameters parsing (other implementations will just
  ignore them). E.g. if in RST we have:

  .. code:: nim
     :test: "nim c $1"

     ...

  then in Markdown that will be:

  ```nim test="nim c $1"
  ...
  ```

- implement Markdown interpretation of additional indentation which is
  less than 4 spaces (>=4 spaces is a code block but it's not
implemented yet). RST interpretes it as quoted block, for Markdown it's
just normal paragraphs.
- add separate `md2html` and `md2tex` commands. This is to separate
  Markdown behavior in cases when it diverges w.r.t. RST significantly —
most conspicously like in the case of additional indentation above, and
also currently the contradicting inline rule of Markdown is also turned
on only in `md2html` and `md2tex`. **Rationale:** mixing Markdown and
RST arbitrarily is a way to nowhere, we need to provide a way to fix the
particular behavior. Note that still all commands have **both** Markdown
and RST features **enabled**. In this PR `*.nim` files can be processed
only in Markdown mode, while `md2html` is for `*.md` files and
`rst2html` for `*.rst` files.
- rename `*.rst` files to `.*md` as our current default behavior is
  already Markdown-ish
- convert code blocks in `docgen.rst` to Markdown style as an example.
  Other code blocks will be converted in the follow-up PRs
- fix indentation inside Markdown code blocks — additional indentation
  is preserved there
- allow more than 3 backticks open/close blocks (tildas \~ are still not
  allowed to avoid conflict with RST adornment headings) see also
https://github.com/nim-lang/RFCs/issues/355
- better error messages
- (other) fix a bug that admonitions cannot be used in sandbox mode; fix
  annoying warning on line 2711
2022-07-15 19:27:54 +02:00
flywind
286fcef68e [Orc] fixes "streams.readDataStr segafaults" when accepting a string literal (#20019) [backport]
fixes streams.readDataStr accept a string literal
2022-07-15 09:42:54 +02:00
flywind
10c8e2037d fixes #20015; document shallowCopy does a deep copy with ARC/ORC (#20025) 2022-07-14 18:42:56 +08:00
silent-observer
93211a2bdd Add sink and lent annotations to the critbits module (#20021)
* Add sink and lent to critbits

* Remove lent for pairs
I guess lent doesn't work well inside tuples

* Remove lent from template in critbits
Apparently this also doesn't work, because some checks failed
2022-07-14 12:03:16 +02:00
Juan M Gómez
a90763ebd7 Fixes Compilation error with --app:lib (#19965)
Fixes Compilation error with --app:lib  when a module tries to pull os.paramStr on posix by throwing a runtime exception instead. 
More details here: #19964
2022-07-10 15:40:26 +02:00
Jacek Sieka
ad0aee5354 sysrand: fix syscall signature [backport] (#19982)
sysrand: fix syscall signature

`syscall` is a `C` varags function
2022-07-07 21:26:58 +08:00
Daniel Clarke
01b40dc1d7 Fixes return values of execCmd on macos (#19963)
* Fixes return values of execCmd on macos

* update tests to use existing structure

Co-authored-by: daniel <danielclarke@wearepopgun.com>
2022-07-05 22:29:05 +02:00
rockcavera
d2d8f1342b Fixing nimRawSetJmp for vcc and clangcl on Windows (#19959)
* fix vcc rawsetjmp

* changing `_longjmp()` to `longjmp()` and

`_setjmp()` to `setjmp()`

* fix

* fix setjmp to clangcl on Windows

* fix genTrySetjmp() to clangcl on Windows
2022-07-04 13:52:44 +02:00
Juan Carlos
2c0aaac304 jsffi add missing braces (#19948)
js codegen add missing whitespaces and braces
2022-06-30 23:18:11 +02:00
Juan Carlos
7c31b6a47b Fix jsre (#19917)
* Fixes for jsre to make it more safe at runtime on some edge cases

* https://github.com/nim-lang/Nim/pull/19917#issuecomment-1162692893
2022-06-28 08:13:17 +02:00
flintforge
0ae44e562f fix typo in nre.nim (#19915)
Update nre.nim

typo in proc replace description
2022-06-21 09:53:46 +08:00
Tanguy
40464fa762 Fix nimRawSetjmp for VCC [backport: 1.2] (#19899) 2022-06-20 08:21:20 +02:00
Tanguy
d33e112766 Better range error messages (#19867)
* Better range error messages

* Revert to old behavior for arrays

* Small corrections
2022-06-15 16:38:12 +02:00
Tanguy
251bdc1d5a Windows: enable nimRawSetjmp by default [backport] (#19891)
* Windows: enable nimRawSetjmp by default

See #19197. The default setjmp can randomly segfault on windows

* Attempt to disable the flag for bootstraping

* Disable styleCheck for c_setjmp
2022-06-14 12:37:31 +02:00
Ardek Romak
a4fdaa88cc Correctly import libcrypto functions using dynlib (#19881) 2022-06-13 09:22:20 +02:00
Jake Leahy
8fa2c0b532 Pass headers and body correctly to FetchOptions (#19884) [backport]
* Pass headers to FetchOptions

Don't pass body if method is HttpGet or HttpHead

* Syntax fixes

* Restart CI
2022-06-13 08:03:40 +02:00
Carlo Capocasa
e2e663a143 Friendlier error message with solution (#19880)
* Add helpful suggestion, should always apply

* mention var param limitation in async docs

* Update compiler/lambdalifting.nim

whoops thanks

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
2022-06-11 18:23:31 +02:00
flywind
1e5dd9022b [js] add testcase for array indexDefect and remove todo (#19838)
* remove unused opcSubstr

* [js] add testcase for array indexDefect

* Revert "remove unused opcSubstr"

This reverts commit cb461f2545.
2022-06-10 20:33:44 +02:00
flywind
8cde6ba6bc remove noop option gc:v2 (#19810)
* remove noop option gc:v2

* changelog
2022-06-10 20:32:27 +02:00
flywind
1972005439 fix #19862; make widestrs consistent between refc and orc (#19874) [backport]
fix #19862; make widestrs consistent in refc and orc
2022-06-09 16:51:17 +02:00
Antonis Geralis
836b95c896 Deprecate std/sums (#18439)
* Deprecate sums

* Update changelog.md

* Update lib/std/sums.nim

* log

* format

* remove

* Update changelog.md

Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com>
2022-06-09 08:27:31 +02:00
Juan Carlos
f2b16c490d Add Microtasks docs (#19870)
* Add Microtasks

* Add Microtasks

* Workaround to build js docs in older NodeJS versions
2022-06-08 16:10:52 +02:00
Zoom
b024a45163 Fix find routines' api to default to last=-1 (#19761)
This changes the default for the `last` parameter of various `find`
routines from `0` to `-1`. Previous default prevents limiting the search
to the first character. This is a logic error, as full text search was
performed for 2 *valid* values of `last`: `0` and `last.high()`.

Adds an overload for `initSkipTable` which returns a newly initialized
table. This encapsulates every single usage of a `var`-acting original
func in this module.

Co-authored-by: flywind <xzsflywind@gmail.com>
2022-06-07 10:35:06 +02:00
Juan Carlos
d0232f0e5b Add Microtasks (#19860)
* Add Microtasks

* Add Microtasks
2022-06-04 07:03:25 +02:00
Andrey Makarov
4341b06f65 RST: improve simple tables (#19859)
* RST: improve simple tables

* nim 1.0 gotchas

* Still allow legacy boundaries like `----`
2022-06-04 07:03:03 +02:00
flywind
68aeb4c1a6 change the type of mangleJsName; fixes CStringConv warnings (#19852)
change the type of mangleJsName

since mangleJsName is used in macros, there is no need to use cstring. Using cstring may increase conversions and cause warnings.
2022-06-01 15:01:17 +02:00
flywind
4e3eb7414c [Minor] remove unused and unnecessary local variable (#19853) 2022-06-01 14:44:26 +02:00
Alfred Morgan
15f0b48676 Zectbumo fixes 19824 (#19825)
* borrowed `$` to make Time string friendly

* added sep character parameter

* Revert "added sep character parameter"

This reverts commit 45f4b019a4.

* added sep character parameter

* Revert "borrowed `$` to make Time string friendly"

This reverts commit 10e2e44c9a.

* added uri tests and made changelong entry

* Update lib/pure/uri.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update lib/pure/uri.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update tests/stdlib/turi.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update tests/stdlib/turi.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-05-30 12:09:18 +02:00
tandy1000
ec0cec3170 Add document.hidden and document.visibilityState properties (#19817) 2022-05-24 17:37:39 +02:00
Juan Carlos
b1b5e3ab10 Add Array.shift (#19811)
* Add Array.shift for JavaScript targets

* Add Array.shift for JavaScript targets
2022-05-24 17:37:19 +02:00