Alberto González Palomo
fe8e718183
Add ppc64 to os/arch
...
Same as #431 (Add ppc to os/arch) but for the 64-bit version.
This is tested on a Power9 CPU in Little-Endian mode, on Linux.
2022-01-21 23:08:57 +01:00
Michael Camilleri
1eb34989d4
Support looking up missing symbols during compilation
2022-01-21 13:07:11 +09:00
Ian Shehadeh
6412768000
Add match documentation for & rest pattern
2022-01-20 09:19:21 -05:00
Ian Shehadeh
82688b9a44
add checks to & _ pattern in match macro
...
This commit adds 2 checks for & rest pattern in the match macro:
- & is followed by exactly 1 item
- & is followed by a symbol
2022-01-20 09:16:02 -05:00
Ian Shehadeh
4118d581af
error if '& is followed by 2+ items in destructure
...
The current destructure pattern ends when '& is encountered.
This commit adds an error if it is followed by more than
a symbol to bind the array to.
Although its not critical since the extra items can be ignored,
they're a sign of some kind of mistake so its best to complain.
2022-01-20 08:52:37 -05:00
Ian Shehadeh
62608bec03
use janet_checktype over janet_type and ==
...
In destructure janet_type(_) == JANET_SYMBOL was used to check if a
value was a symbol.
This commit replaces that with the janet_checktype function,
because that function is used for the same purpose in other places.
2022-01-20 08:12:05 -05:00
Ian Shehadeh
a8e49d084b
add checks for & _ destructuring pattern
...
This commit adds three checks to ensure & rest patterns are valid:
1. When checking for '& ensure the value is a symbol before unwrapping
2. Make sure '& is followed by a value
3. Make sure the value following '& is a symbol
2022-01-19 13:55:05 -05:00
Ian Shehadeh
db631097b1
add support for & _ to match macro
...
This commit adds support for using & _ syntax to bind the remaining
values in an array in the match macro.
The commit also adds a few tests for the new syntax in suite0008
2022-01-19 13:29:34 -05:00
Ian Shehadeh
cb5af974a4
POC "rest" pattern in destructuring
...
Add support for using [& rest] to match the remaining values
in an array or tuple when destructuring.
the rest pattern is implemented by pushing remaining values in the
rhs to the stack once & is found on the lhs.
Then tuple is called and the result is assigned
to the next symbol on the lhs.
This commit DOES NOT implement handling for malformed patterns.
2022-01-15 14:51:44 -05:00
Michael Camilleri
413c46e2ee
Fix redefinable macros
2022-01-14 17:15:42 +09:00
Ian Shehadeh
4931e2aee2
correct stack frame table keys in debug/stack doc
...
doc for debug/stack listed :column and :line as keys in the frame table.
But doframe actually sets :source-column and :source-line.
2022-01-08 16:25:43 -05:00
Calvin Rose
ffadf673cf
Merge branch 'master' of github.com:janet-lang/janet
2022-01-08 11:27:48 -06:00
Calvin Rose
5b5a7e5a24
Make top level vars reuse ref cell when redefined at the top level.
...
This improves the repl experience while not messing with existing code
very much, if at all.
2022-01-08 11:27:08 -06:00
Ian Shehadeh
60378ff941
windows: fix ev/read hang when called on fs stream
...
handles returned by CreateFileA and FILE_FLAG_OVERLAPPED
support reading from arbitrary offsets.
The offset is passed to ReadFile in through the OVERLAPPED structure.
Since state->overlapped is zeroed ev_machine_read
ReadFile would always read from the start of the file and never finish
This commit changes ev_machine_read to update the offset to
the number of bytes read before calling ReadFile.
2022-01-07 16:32:39 -05:00
Calvin Rose
a37dc1af9d
Merge branch 'redefs-work'
...
- Change the global binding name from :redefs to :redef
- Simplify internal representation of "redefinable bindings"
- Store "redefinable bindings in :ref rather than :value inside the
environment entries. This makes such bindings more like vars that
can't be set rather than defs.
2022-01-06 20:45:20 -06:00
Calvin Rose
03458df140
Merge pull request #898 from pyrmont/feature.redefs
...
Support redefinable `def` and `defmacro` bindings using `:redef`
2022-01-06 20:44:18 -06:00
Calvin Rose
99cfbaa63b
Tweaks on redef feature branch.
2022-01-06 20:38:15 -06:00
Ian Shehadeh
938c5013c9
fix typo in janet_epoll_sync_callback
...
JANET_ASYNC_LISTEN_WRITE was checked instead of JANET_ASYNC_EVENT_READ.
This caused ev/read to hang if it was called on a normal fd.
2022-01-06 19:33:34 -05:00
Michael Camilleri
ea9d5ec793
Change metadata keyword back to :redef
2022-01-02 12:35:22 +09:00
Michael Camilleri
ec65f038a8
Support :dynamic-defs dynamic binding
2021-12-29 16:39:00 +09:00
sogaiu
1326ded048
Tweak match docstring
2021-12-25 16:56:10 +09:00
Michael Camilleri
8347439644
Support redefinable bindings
2021-12-18 13:05:16 +09:00
Michael Camilleri
97a8938407
Ensure value is of specified type or panic
2021-12-15 12:17:35 +09:00
Michael Camilleri
939d1dcae9
Only set :current-file in run-context if source is a path
2021-12-13 12:06:58 +09:00
Calvin Rose
9d5cc5c11f
Proper locking on select.
2021-12-09 18:59:59 -06:00
Calvin Rose
d998f24d26
Merge branch 'master' of github.com:janet-lang/janet
2021-12-09 18:47:36 -06:00
Calvin Rose
d543f8857b
Fix #892 - Remove racy ref counts for channels
...
Rather than manual reference counting for suspended fibers, we
automate the process by incrementing "extra_listeners" every time
we suspend a fiber in the event loop, and decrement when that fiber
is resumed. In this manner, we keep track of the number of suspending
fibers in a simpler, more correct way.
2021-12-09 18:44:55 -06:00
Michael Camilleri
bf29a54272
Clarify nested loop behaviour in loop macro
2021-12-09 10:41:56 +09:00
Calvin Rose
6d9286a202
Add some more changes to hashing to improve pointer hashing.
2021-12-07 08:36:08 -06:00
Calvin Rose
92fdd07ca3
Address #889 - Switch high and low bits of part of number hash (Knuth's multiplicative hash)
...
Also make sure we weren't throwing away 3 bits of entropy.
2021-12-07 08:24:04 -06:00
Calvin Rose
1c937ad960
Prepare for 1.19.2 release. Update CHANGELOG.md
2021-12-06 17:27:09 -06:00
Calvin Rose
f9891a5c04
More improvements to hashing for #889
2021-12-06 17:23:00 -06:00
Calvin Rose
e8ad311d84
Don't use janet_stacktrace anymore.
...
Behavior of janet_stacktrace_ext is more consistent.
2021-12-06 08:51:40 -06:00
Calvin Rose
545c09e202
Update hash mixing behavior - address #889
...
Try to have better behavior when mixing sub-hashes that are not uniform and
randomly distributed. Premultiply by a large prime before mixing to
"spread entropy" if it is concentrated in a certain subset of bits.
2021-12-05 16:34:26 -06:00
Calvin Rose
4dc281a05f
Prepare for 1.19.1 release.
2021-12-04 13:34:41 -06:00
Calvin Rose
d4c6643311
Merge branch 'master' of github.com:janet-lang/janet
2021-12-04 13:03:33 -06:00
Calvin Rose
e8c738002b
Add extra "prefix" parameter to debug/stacktrace.
2021-12-04 13:03:05 -06:00
Calvin Rose
309c3aaeb8
Merge pull request #867 from pyrmont/feature.custom-out-functions
...
Support sending output to a function
2021-12-04 11:17:58 -06:00
Calvin Rose
6f4af5fef8
Merge branch 'master' of github.com:janet-lang/janet
2021-12-04 10:28:16 -06:00
Calvin Rose
868cdb9f8b
Fix channel packing bug.
2021-12-04 10:28:00 -06:00
Grazfather
139bef2142
map: Fix indexing for 3+ data structures
2021-12-03 16:15:43 -05:00
Calvin Rose
8ba142bcf4
Merge branch 'master' of github.com:janet-lang/janet
2021-11-30 14:19:10 -06:00
Calvin Rose
c49e4966f6
Update to dev versions.
2021-11-30 14:19:03 -06:00
Michael Camilleri
6bf9f89429
Update location of current file in run-context
2021-11-29 10:05:04 +09:00
Calvin Rose
a0ddfcb109
Prepare for 1.19.0 release.
2021-11-27 10:00:36 -06:00
Calvin Rose
3df7921fdc
Don't call wait twice when closing or gcing.
2021-11-27 09:05:43 -06:00
Calvin Rose
6172a9ca2d
Merge branch 'master' of github.com:janet-lang/janet
2021-11-26 18:44:33 -06:00
Calvin Rose
4a40e57cf0
Fix leaking file descriptors to subprocess causing hangs.
2021-11-26 18:44:11 -06:00
Josef Pospíšil
e6babd84f7
Fix math/gamma and add math/log-gamma
2021-11-24 10:55:32 +01:00
Calvin Rose
e08394c870
Fix struct proto missing when making a struct with a nil value.
2021-11-23 23:16:06 -06:00
Calvin Rose
9e0f36e5a7
Fix unused variable warnings.
2021-11-18 20:35:41 -06:00
Calvin Rose
d481d079ba
Try bsd fix.
2021-11-18 20:30:06 -06:00
Calvin Rose
bc9ec7ac4a
Fix unitialized memory access in net/ module.
2021-11-18 20:10:10 -06:00
Calvin Rose
6f7e81067c
Address #876 Don't allow scheduling a fiber once it has been canceled already.
...
We were effectively cancelling the cancellation.
2021-11-18 20:06:29 -06:00
Calvin Rose
af946f398e
Turn off raw mode in shell on ctrl-C.
2021-11-18 19:58:52 -06:00
Calvin Rose
c7ca26e9c7
Merge branch 'master' of github.com:janet-lang/janet
2021-11-18 19:04:43 -06:00
Calvin Rose
ef7129f45d
Address #874 - Call waitpid on waiter thread with WNOWAIT.
...
This doesn't destory the pid until the original thread decides to
call waitpid again. Since the pid is exposed in the C API and now
in the Janet API, we don't want to destroy it until we are ready.
2021-11-18 19:03:08 -06:00
Andrew Chambers
2ef49a92cc
Use kill instead of raise for SIGINT.
...
Raise signals can only be handled by the current thread while
kill signals can be handled by background threads.
2021-11-15 20:38:23 +13:00
Michael Camilleri
4e263b8c39
Support using functions with :out dynamic binding
2021-11-13 01:42:44 +09:00
Calvin Rose
3cb604df02
Merge pull request #870 from andrewchambers/exposepid
...
Expose process :pid on unix like platforms.
2021-11-12 08:20:39 -06:00
Calvin Rose
af9dc7a69e
Merge pull request #869 from andrewchambers/typo2
...
Fix os/proc-kill doc typo.
2021-11-12 08:20:00 -06:00
Andrew Chambers
aab0e4315d
Expose process :pid on unix like platforms.
...
This at least means users can use something like jsys
or the kill command to signal processes when they want
to send unsupported signals (like SIGTERM).
2021-11-12 23:43:36 +13:00
Andrew Chambers
14f6517733
Fix os/proc-kill doc typo.
2021-11-12 23:29:13 +13:00
Andrew Chambers
5d75effb37
Allow C code to block SIGINT.
...
Previously the repl always exits on SIGINT, this change
means the repl will only exit on SIGINT if the SIGINT handler
causes it to exit.
2021-11-12 23:24:33 +13:00
Calvin Rose
425a0fcf07
Add quoted literal support in the match macro.
2021-11-08 15:33:11 -06:00
bakpakin
3067f4be3a
Address #815 - gc mark issue in windows accept state machine.
...
We were casting a pointer to the wrong type, which caused all sorts of
wonderful chaos, but only on windows and only when the garbage collector
ran after setting up a server in a specific configuration. We were
casting a closure pointer to an abstract type during the mark phase,
which resulted in memory corruption.
2021-11-06 17:50:54 -05:00
Calvin Rose
2833a983d8
Merge pull request #860 from sogaiu/short-fn-docstring-tweak
...
Tweak short-fn docstring
2021-11-04 19:39:55 -05:00
Calvin Rose
39c6be7cb7
Fix #861 - parser/produce caused state to be invalid for parser/state.
...
parser/produce was leaving a counter in the root state undecremented.
2021-11-04 19:38:37 -05:00
sogaiu
fdc94c1353
Tweak short-fn docstring
2021-11-04 18:11:53 +09:00
Calvin Rose
9cc4e48124
Update changelog and allow evaluating streams with dofile.
2021-10-30 14:43:06 -05:00
Calvin Rose
34c7f15d6d
Always return port in peername and localname
2021-10-30 10:56:40 -05:00
Calvin Rose
899a9b025e
Merge branch 'struct-proto'
2021-10-30 09:31:22 -05:00
Calvin Rose
deb4315383
Fix parse.c parser/state :args
2021-10-30 09:30:56 -05:00
Calvin Rose
9a06660fdb
fix call to table/proto-flatten
2021-10-30 09:15:23 -05:00
Calvin Rose
5c35d24e13
Fix nil check issue.
2021-10-29 19:29:54 -05:00
Calvin Rose
03f99752a7
Merge branch 'master' into struct-proto
2021-10-29 16:42:34 -05:00
Calvin Rose
fd37567c18
Docstring fix.
2021-10-29 11:13:07 -05:00
Calvin Rose
6e38bf1578
Use more inclusive check for the %j formatter for valid symbols.
...
We did not allow arbitrary utf8 to be printed with %j, even though the parser
allows. Thos changes uses the existing built in utf8 detectiotion to
exclude only unprintable symbols from the docstring.
2021-10-29 11:08:53 -05:00
Calvin Rose
8b2d278840
Add min-of and max-of.
2021-10-26 17:46:24 -05:00
Calvin Rose
06aa0a124d
Add math/gcd
and math/lcm
to the core.
2021-10-24 11:43:07 -05:00
Calvin Rose
eb4595158d
Allow compiling tables as peg grammars.
2021-10-23 09:59:36 -05:00
Michael Camilleri
7ed0aa6630
Use named union in JanetGCObject
2021-10-22 09:52:57 +09:00
Calvin Rose
545d9e85e9
Update CHANGELOG.md
2021-10-20 19:57:02 -05:00
Calvin Rose
21a4ab4ec7
Hang forever instead of exit early on channel deadlock.
...
While not technically needed, the behavior is more intuitive and will
prevent people from writing bad scripts.
2021-10-20 19:53:29 -05:00
Calvin Rose
66fbbeb5ec
Why is the copyright gone...
2021-10-20 18:05:32 -05:00
Calvin Rose
55879c7b6d
Fix checked for fiber being dead.
2021-10-19 09:03:24 -05:00
Calvin Rose
66c4e5a5e2
Prepare for patch release.
2021-10-16 15:05:48 -05:00
Calvin Rose
c3d7b1541e
Merge branch 'master' into jgarte-patch-typo
2021-10-16 12:51:38 -05:00
jgart
e3a5d52c5e
Fix typo in docstring
2021-10-16 11:48:59 -04:00
Calvin Rose
74c9cf03d0
Fix -r switch in repl
2021-10-14 17:25:12 -05:00
Calvin Rose
0774e79e4f
Pass non-blocking pipes to subprocesses on non-windows platform.
2021-10-14 13:57:51 -05:00
MorganPeterson
9bf5cd83c3
updated string/bytes docs to reflect return value as tuple
2021-10-11 13:45:31 -04:00
Calvin Rose
f0da793f99
Prepare for 1.18.0 release
2021-10-10 09:27:31 -05:00
Calvin Rose
684f3ac172
Add optional base to scan-number.
2021-10-10 09:07:56 -05:00
Calvin Rose
3e5bd460a5
Add line/col info to parse error in janet_[dobytes, dostring]
2021-10-08 09:25:00 -05:00
Calvin Rose
3b1d787fbe
Address #829 - Set state->event inside linked list traversal for epoll.
2021-10-08 08:35:47 -05:00
sogaiu
52ed68bfeb
Add argument to janet_panicf call (2)
2021-10-07 20:58:50 +09:00
sogaiu
be0d4c28e4
Add argument to janet_panicf call
2021-10-07 16:38:40 +09:00
Calvin Rose
79807bf2ab
Merge pull request #827 from sogaiu/tweak-format-strings
...
Tweak format strings
2021-10-06 17:48:53 -05:00
sogaiu
eae18ce973
Tweak format strings
2021-10-06 20:34:33 +09:00
rick2600
591344ca9d
fix issue #825
2021-10-05 01:45:59 -03:00
Calvin Rose
fbe067823e
Merge pull request #824 from GrayJack/rnd-double-capi
...
Expose `janet_rng_double` to the C API
2021-10-04 13:54:10 -05:00
GrayJack
ffece911e6
Expose janet_rng_double
to the C API
2021-10-03 00:52:34 -03:00
llmII
6b3037106a
Fix #822 - kqueue hang in suite 9.
...
Priorly we only checked exactly one state when an event was received.
This was incorrect. A state may have a next state, an action to take
after the first in the list of states has been taken. This change
acknowledges that and makes the code work with the state list vs just
the head of the list.
2021-09-30 06:56:09 -05:00
Calvin Rose
1bf22288ee
Merge pull request #821 from llmII/fix-kqueue
...
Fix #819 timeouts under kqueue on FreeBSD broken
2021-09-29 15:51:46 -05:00
llmII
3cec470f25
Change the way timeouts work in kqueue.
...
Don't use a timer filter, just set the timeout on each call to kevent.
Should hopefully work around the 1ms minimum on NetBSD and be possibly
more performant.
2021-09-29 15:19:30 -05:00
llmII
e1ec0d13ae
Fixing kqueue under the BSDs.
...
FreeBSD is the only BSD supporting ABSTIME timers, whereas the rest
demand intervals. Janet operates on timestamps, which are absolute
times, as per ABSTIME. The idea was to use that under FreeBSD but not
the other BSDs. This commit changes that since ABSTIME breaks when the
timeout supplied is for a time prior to whatever the time is
now (invalid argument). We now utilize the same logic we use on the
other BSDs with FreeBSD to effect interval timeouts since intervals are
absolutely sometime beyond now, be it now and less than a millisecond,
or more than a millisecond. This will hopefully unbreak BSD builds when
running the test suite.
2021-09-28 17:40:38 -05:00
bakpakin
924fe97fc3
Address #820 - ev/cancel to work on already scheduled fibers.
2021-09-28 15:42:16 -05:00
Calvin Rose
544b192f8c
Fix bad docstring change.
2021-09-25 14:32:23 -05:00
Calvin Rose
7748ccdb8e
Fix network byte order port.
2021-09-25 14:31:19 -05:00
Calvin Rose
64e29c6fce
More simplification and removal of macros.
2021-09-25 13:53:27 -05:00
Calvin Rose
acdf097998
Refactor of peername and localname to be much more direct.
...
Also remove a lot of overly general code from cqueues. Janet has more
opinionated error handling so we can avoid a lot error propagation code.
2021-09-25 13:38:36 -05:00
Calvin Rose
ba3107c1fa
Merge branch 'master' of github.com:janet-lang/janet
2021-09-21 18:03:25 -05:00
Calvin Rose
9985f787eb
Add custom base option to number peg combinator.
...
Allows parsing custom bases without needed Janet specific prefixes.
2021-09-21 18:02:42 -05:00
Calvin Rose
50bced49ad
Merge branch 'master' into use-deprecation-mechanism-for-file-popen
2021-09-21 15:15:36 -05:00
Calvin Rose
4fd7470bbf
Remove accidental limit on max read size.
2021-09-21 09:55:40 -05:00
Calvin Rose
033c6f1fdb
Add -i flag to run .jimage files as scripts.
2021-09-19 19:47:57 -05:00
Calvin Rose
6c58347916
Remove thread module.
...
Instead, use the more general and non-blocing `ev/` module.
2021-09-19 14:19:32 -05:00
Calvin Rose
cccbdc164c
Add (number combinator to peg).
...
This allows using Janet's number parser without creating
intermediate strings.
2021-09-19 13:02:16 -05:00
Calvin Rose
9b4b24edf7
Prepare for 1.17.2 release.
2021-09-18 13:42:26 -05:00
Calvin Rose
8b10a5fb7c
Format and update CHANGELOG.md
2021-09-18 13:40:32 -05:00
Calvin Rose
b0d0d9cad2
Address #809 - treat first docstring line different from others.
...
Only do this if the docstring starts with an open parentheses.
2021-09-18 12:41:11 -05:00
sogaiu
d5c8eb048a
Apply deprecation machinery to file/popen
2021-09-18 17:08:56 +09:00
Calvin Rose
9abee3f29a
Add semi-colon.
2021-09-17 19:20:59 -05:00
Calvin Rose
bf9b6b1301
Avoid including windows.h in janet.h for JanetOSMutex.
2021-09-17 16:59:50 -05:00
Calvin Rose
da2c1be49c
Fix #801 threaded abstract cyclic references in marshalling.
...
We forgot to mark threaded abstract types as "seen" when marshalling so
we would mistakenly marshal them twice. This messed up unmarshalling.
2021-09-14 21:12:02 -05:00
Jonathan Marler
e381622a9a
add NULL check in gc.c to avoid UB
...
After the UB was fixed in value.c, I tried running the build again and encoutered another instance of UB in gc.c. With this fixed I can now build janet with ubsan enabled, meaning there's no more UB encountered in janet_boot during the build.
2021-09-11 19:50:52 -06:00
sogaiu
e6ee867f72
Tweak math/nan docstring
2021-09-11 16:54:35 +09:00
bakpakin
468a31f515
Address #795 - add NULL check to avoid UB
2021-09-09 07:20:26 -05:00
bakpakin
02d2a66ef2
Merge branch 'master' of github.com:janet-lang/janet
2021-09-07 22:44:59 -05:00
Calvin Rose
4638baf545
Merge pull request #790 from llmII/feature-getsockname-getpeername
...
Work in progress - more socket functions
2021-09-07 22:44:40 -05:00
bakpakin
b39b1746ba
Support bindport.
2021-09-07 21:59:17 -05:00
bakpakin
24f97510b0
Fix incorrect code that created socket twice.
2021-09-07 20:51:33 -05:00
llmII
325d5399fa
Code cleanup and attribution set.
...
All that is left is to test unix sockets.
2021-09-07 20:00:00 -05:00
Calvin Rose
d8f6fbf594
Merge pull request #789 from llmII/feature-bind-connect
...
Add bind option to net/connect
2021-09-07 18:47:17 -05:00
llmII
bf2928805e
Had an extra plen definition, removed.
2021-09-07 17:03:34 -05:00
llmII
7d2bf334c8
Fix incorrect error when argv[3] is null
...
The `janet_get_addrinfo` function retained code that was meant for
compliance with 3 separate function signatures under a single function
name. Changing things to be a single function signature was broken until
the code pertaining to the aforementioned was stripped out.
2021-09-07 16:11:37 -05:00
llmII
7446802a70
Quit trying to make it 3 different functions
...
Prior commits was an attempt to make this one function adhere to 3
different function signatures! This puts an end to that and makes it
where it's a single function signature and if one wants to use the 4th
argument they'll need to explicitly set the 3rd argument (to nil for
default).
2021-09-07 14:56:13 -05:00
llmII
c9bef39f96
Make net/connect special
...
Keeps net/listen from being affected by changes necessary to make bind
on connect work (while keeping from breaking the API).
2021-09-07 05:40:48 -05:00
llmII
3740eadb7d
Seeing if this fixes the last warnings for Windows
2021-09-06 19:57:56 -05:00
llmII
e29fa66a74
More Windows fixes
2021-09-06 19:42:45 -05:00
llmII
ca5406c8e4
More windows fixes
...
MSVC's output via appveyor is a little lacking in indication of all
issues so I'm hitting them as I can find them.
2021-09-06 19:31:16 -05:00
llmII
7217caacd1
Attempting some more windows related fixes.
2021-09-06 19:26:33 -05:00
Calvin Rose
8081082251
Merge pull request #785 from llmII/feature-kqueue
...
Add kqueue support to Janet
2021-09-06 18:42:05 -05:00
llmII
1597ca0de5
Cleanup code a bit
...
Inconsistent indentation and such fixed, superfluous newlines removed,
documentation of new functions.
2021-09-06 18:32:23 -05:00
llmII
8c938ceff9
Fix for Windows (possibly)
...
Windows does not have <arpa/inet.h> so only include it when not Windows.
2021-09-06 17:48:17 -05:00
llmII
65a6945ea5
Finalize peername and localname
...
Both now do the right thing and give back all information (host and
port) when possible as a tuple of (host port).
2021-09-06 17:35:49 -05:00
llmII
02640812af
Add getsockname (net/localname)
2021-09-06 17:01:09 -05:00
llmII
ba761d5c35
Work in progress - more socket functions
...
When this is complete we'll have getpeername, getsockname and possibly
getpeerid in the net/* API.
2021-09-06 16:15:01 -05:00
llmII
48a3b1f07f
Enable kqueue on MacOS
...
Make sure JANET_EV_KQUEUE is defined when JANET_APPLE is defined unless
disabled by configuration.
2021-09-06 16:01:06 -05:00
llmII
4370cb77e7
Update documentation.
...
Documenting the new bindhost parameter to net/connect.
2021-09-06 10:54:11 -05:00
llmII
470e8f6fc7
Reused address info struct incorrectly
...
Wrongly assumed that `ai` was done being used before binding, it's not,
so create a separate address info for binding...
2021-09-06 10:44:23 -05:00
llmII
b270d88427
More off by one error fixes
2021-09-06 10:12:36 -05:00
llmII
66ce247129
Fixing off by one indexing errors...
2021-09-06 10:01:16 -05:00
llmII
6ad016c587
Check type when getting socket type
...
janet_get_sockettype expects a keyword but we're making it optional that
the call to the functions that use it with arity >=3 will be guaranteed
to have it as a keyword value! If it's not a keyword then it's the same
as NULL.
2021-09-06 09:53:53 -05:00
llmII
532dac1b95
Check type instead of value
...
Primarily because trying to check the value results in a panic when the
value is not the type of value requested from the API. Also probably
cheaper and the previous idea of just getting the value then comparing
was pretty stupid (needed a string comparison... and was going to do
pointer comparison).
2021-09-06 09:48:29 -05:00
llmII
2a4bcc262f
Don't bind when address info doesn't exist
...
Simple logic issue, something overlooked.
2021-09-06 09:06:40 -05:00
llmII
1ce2361daf
Better error message in connect
...
Quick thing to help check when failing tests.
2021-09-06 09:02:56 -05:00
llmII
6e8584e8e0
Add bind option to net/connect
...
This will allow us to set the address we use for outgoing connections.
Builds, haven't checked it passes current tests, haven't checked it
actually works either.
2021-09-06 08:54:24 -05:00
llmII
121aa91139
Fixes for NetBSD (again)
...
Minimum interval for a timer must be 1 or more (or we get EINVAL) and
Janet fails tests and halts events that the programmer may still be
interested in.
2021-09-05 21:48:53 -05:00
llmII
bbc07c72d3
More NetBSD fixes
...
A comptime known value of 0 for data in EV_SET with EVFILT_TIMER causes
a complete compilation failure (fails to link). This fixes it by making
it a 1 instead of a 0 for amount of milliseconds in the interval to wait
under NetBSD.
2021-09-05 21:17:41 -05:00
llmII
43b48fdbea
More fixes for NetBSD
...
Kills compiler warnings with regards to implicit conversion of intptr_t
to void*
2021-09-05 21:01:24 -05:00
llmII
604f97aba1
Fixes for BSD where BSD != FreeBSD
...
NetBSD and OpenBSD lack NOTE_ABSTIME and NOTE_MSECONDS, so we define
those and create a macro that we use for all timeout values in EV_TIMER
events that will on all BSD excepting FreeBSD change an absolute time
into an interval.
2021-09-05 20:48:42 -05:00
Calvin Rose
dc980081cd
Fix #783 - change docstring for x86-64 to x64.
2021-09-05 12:32:33 -05:00
llmII
981f03fef3
Remove comments regarding NetBSD breakage
...
Since those no longer should apply, don't keep them around.
2021-09-05 10:45:45 -05:00
llmII
d40133dc72
NetBSD support
...
Checking throught NetBSD's man pages, excepting for NetBSD-current,
NetBSD uses `intptr_t` as the type for `.udata`. This change allows for
`.udata` to match whatever type (by cast) the underlying system uses.
2021-09-05 07:30:22 -05:00
llmII
c9fa586fce
Code style fixes (pt 2).
...
Missed some.
2021-09-04 09:37:07 -05:00
llmII
b847a7d90b
Code style fixes.
...
Pretty obvious I thought control statements were glued to their opening
parenthesis at first and then I realized not and voila, a bundle of
mixed style. Hopefully this fixes all of it.
2021-09-04 09:34:47 -05:00
llmII
8b67108dc8
Complete kqueue feature
...
From this point things should be bug fixes or code formatting most
likely.
Updated commentary (removed superfluous comments, and commented out
code). Refined commentary where it seemed important and may help whoever
comes behind me keep from making bad assumptions similar to the ones I
made.
All tests ran with `gmake test` now pass. `valgrind` with FreeBSD does
not support forking so `gmake valtest` fails once child processes are
started. Determined not an issue, can't fix valgrind.
2021-09-04 08:23:03 -05:00
llmII
b559f9625a
Timeout is an absolute time, not an interval.
...
Fixes the wrong assumption, passing all tests at that point.
2021-09-04 08:02:50 -05:00
llmII
1736c9b0f8
Handle null state, don't read/write on error
...
Need to guard against errors when reading/writing probably, if there is
an error, forgo those events.
Guard against null state (and the byproduct, a segfault), check if the
state is null before utilizing it.
2021-09-03 23:22:07 -05:00
llmII
4fb2d8d318
Logical error regarding length fixed.
2021-09-03 22:41:59 -05:00
llmII
95891eb0a5
Fix incorrect use of EV_SET on pipes (part 2)
...
Forgot that we use nearly the same routine for adding and deletion...
can't go around deleting things we haven't put into the changeset!
2021-09-03 22:33:28 -05:00
llmII
c133443eb7
Fix incorrect use of EV_SET on pipes.
...
It would seem adding a read and a write event filter on a pipe which is
unidirectional might just be a bad idea.
2021-09-03 19:44:27 -05:00
llmII
8f0641f36c
Disabling superfluous code
...
The code in question may be checking things in an erroneous manner?
2021-09-03 17:18:40 -05:00
llmII
f48dbde736
Better exit (error?) message
...
The prior calls to exit(-1) were wrong anyway and they may at this point
be hindering figuring out what's going on in suite 9.
2021-09-03 17:13:54 -05:00
llmII
f2e4c1ae9a
Forgot a semicolon...
2021-09-03 16:31:20 -05:00
llmII
a4aef38cc0
More typo and syntax fixes.
2021-09-03 16:29:39 -05:00
llmII
b445ecde51
Add kqueue option to meson, janetconf, fix typoes
2021-09-03 16:23:15 -05:00
llmII
a209a01284
Add kqueue support to Janet
...
Note that this is a work in progress and simply a first attempt at
getting some code into place before being able to test it. This code
follows of sorts both the poll and epoll sections of the codebase hoping
to achieve the exact same.
2021-09-03 14:33:47 -05:00
Calvin Rose
7037532943
Errored threads always emit stacktrace or supervisor event.
...
That way, it is much harder to swallow errors. Error swallowing behavior
would have to be done explicitly by wrapping fibers with `protect` or
`try`.
2021-09-01 21:05:05 -05:00
Calvin Rose
bb405ee1aa
Address #778
...
Relax check that number of closure environments in a function matches
that of the def.
The def could be partially constructed, and so there may be a false
negative. The runtime will check that this is consistent, and the
garbage collector should handle when this constraint is not kept.
2021-08-31 22:58:44 -05:00
Calvin Rose
ef23356309
Threaded supervisors return fiber->last_value instead
...
of the fiber itself.
2021-08-31 14:50:27 -05:00
Calvin Rose
5464a7a379
Allow passing a function to directly to ev/go.
...
Makes ev/call less useful but ev/go more useful. No need
to construct as many identical intermediate fibers.
2021-08-30 22:22:22 -05:00
Calvin Rose
acbebc5631
Allow passing function to ev/thread.
...
Convenient when there is no need to create an entire fiber.
2021-08-30 22:04:15 -05:00
Calvin Rose
e1c4fc29de
Prepare for 1.17.1 release.
2021-08-29 11:29:41 -05:00
Calvin Rose
b903433284
Merge branch 'master' of github.com:janet-lang/janet
2021-08-29 11:15:43 -05:00
Calvin Rose
9909adb665
Remove JANER_HEADERPATH from boot process.
...
That is a jpm thing.
2021-08-29 10:43:58 -05:00
Josef Pospíšil
29ea408980
Fix spawn-thread doc about its return
2021-08-28 15:39:49 +02:00
Josef Pospíšil
0bb7ca7441
Fix typos in ev/go ev/select
2021-08-28 15:35:55 +02:00
Calvin Rose
a992644c62
Merge branch 'master' of github.com:janet-lang/janet
2021-08-27 11:52:19 -05:00
Calvin Rose
1c15926e6f
Fix #773 - fix docstring.
2021-08-27 11:52:03 -05:00
Calvin Rose
ab740f92db
Fix ev thread swallowing error in some case.
2021-08-27 11:46:42 -05:00
sogaiu
1d7390fa7c
Tweak fiber/last-value docstring
2021-08-27 17:29:20 +09:00
Calvin Rose
0ab96b8e47
Fix #771
2021-08-26 22:23:21 -05:00
bakpakin
7734e77dfc
Readd the janet_register function.
2021-08-22 10:38:15 -05:00
Calvin Rose
257c8b65c2
Fix destruction order.
2021-08-21 13:30:09 -05:00
Calvin Rose
846c9e5e12
Fix #759 - Add -E flag for one-liners.
...
Use the `short-fn` DSL here for argument passing.
2021-08-21 13:16:41 -05:00
Calvin Rose
685d2b460c
Address #765 . Make assert
into a macro.
2021-08-21 12:27:58 -05:00
Calvin Rose
bd71e1cd02
Silence clang warning about comparing function pointers.
...
The comparison is used to create a set of function pointers.
2021-08-21 12:10:19 -05:00
Calvin Rose
49142fa385
Update for windows compiler warning.
2021-08-20 19:48:48 -05:00
Calvin Rose
d631d29cb4
Fix typo in header.
2021-08-20 18:53:22 -05:00
Calvin Rose
01b7891347
Windows header issues.
2021-08-20 18:49:13 -05:00
Calvin Rose
c786a4cbeb
Expose JanetOSMutex to make abstract types easier to write.
2021-08-20 17:57:23 -05:00
Calvin Rose
1920ecd668
Decrement thread channel pointer during cleanup without adding to heap.
2021-08-20 16:41:19 -05:00
Calvin Rose
c8827424e7
Fix memory leak and use after free
...
Use after free was caused by missing janet_gcroot call when
setting up thread.
2021-08-19 21:51:53 -05:00
Calvin Rose
cc066dd6a1
Add basic runtime support for threaded abstracts.
...
A threaded abstract is an abstract type that can be freely shared
between threads. While no synchronization is provided, refcounting
and transport between threads is. This will let implementers more easily
exploit OS-level parallelism in C library code. The caveat with these
types is that they need to be careful in how they interact with objects
on other heaps.
2021-08-19 21:16:20 -05:00
Calvin Rose
eb0b37f729
Initial threaded abstract types.
2021-08-19 20:56:48 -05:00
Calvin Rose
e552757edc
Fix threaded supervisor channels - Fix #766
...
Some pointer casting with abstract types was incorrect, resulting
in strange behavior when trying to use supervisor channels that were
threaded. This fix also adds the ability to supply a supervisor channel
directly when creating a thread.
2021-08-16 21:14:06 -05:00
Calvin Rose
87b8dffe23
Deprecate the thread module.
2021-08-15 17:36:47 -05:00
Calvin Rose
81b5904188
Add marshal/unmarshal to items pushed to threaded channel.
2021-08-15 16:12:40 -05:00
Calvin Rose
894a3b2fe2
Fix memory leak with threaded channels.
2021-08-15 15:33:26 -05:00
Calvin Rose
b75b3e3984
Working example for threaded channels.
...
Still no marshalling more complex values.
2021-08-15 15:25:07 -05:00
Calvin Rose
dea4906144
Merge branch 'master' of github.com:janet-lang/janet
2021-08-15 13:15:41 -05:00
Calvin Rose
97e5117a3f
Fix some issues and improve channel closing.
...
Still not fully working, seems to be deadlock/channel issue when
sending events between threads.
2021-08-15 13:14:33 -05:00
Calvin Rose
037215f7c4
Initial working draft of threaded channels.
...
Introduces close semtantics to channels as well, but otherwise
threaded channels behave much like non-threaded channels. They have
different marshalling behavior though, and can only send values over by
packing and unpacking them. For now, this means only primitive values
although this will be expanded.
Also missing some implementation for closing threaded channels, and a
whole lot of testing. Achtung!, Caveat emptor, here be dragons and bugs.
2021-08-15 11:48:13 -05:00
Calvin Rose
0277187fde
Merge pull request #763 from sogaiu/rng-uniform-doc-tweak
...
Tweak docstring for math/rng-uniform
2021-08-14 19:10:45 -05:00
sogaiu
c80a3c1401
Fix error
2021-08-15 06:57:46 +09:00
sogaiu
1a3c8692e6
Tweak docstring for math/rng-uniform
2021-08-10 20:09:24 +09:00
Andrew Chambers
f2e8691ad5
Fix init race for environ lock.
2021-08-09 14:47:41 +12:00
Calvin Rose
c94d7574bc
Merge pull request #754 from harryvederci/patch-1
...
Improve docstring for the invert function.
2021-08-08 12:51:24 -05:00
Calvin Rose
a38cb5df18
Merge pull request #757 from subsetpark/document-match
...
Add documentation of @ pattern in match
2021-08-08 12:51:00 -05:00
Zach Smith
5407868620
Add documentation of @ pattern in match
2021-08-07 15:09:37 -04:00
Harry Prins
7edf77561b
Refer to argument. Change past tense to present.
2021-08-07 18:03:10 +02:00
Calvin Rose
a78cbd91da
Address #753 - fix gensym regression.
2021-08-06 16:25:53 -05:00
Calvin Rose
bb5c3773f1
Fix fiber aware combinators to use general iteration instead of fiber
...
specifics.
2021-08-06 16:17:47 -05:00
Calvin Rose
2e641a266d
Merge pull request #752 from sogaiu/get-in-tweak
...
Tweak get-in behavior
2021-08-06 15:14:33 -05:00
Zach Smith
34019222c2
Make take/take-while/take-until fiber-aware
2021-08-06 15:40:29 -04:00
Harry Prins
5f3378213b
Improve docstring for the invert function.
2021-08-06 18:33:49 +02:00
sogaiu
2080ac3bda
Tweak get-in behavior
2021-08-06 08:24:26 +09:00
Damien Ready
934e091410
Note "int" vs "double" representation of seconds
2021-07-31 11:02:48 -05:00
Calvin Rose
7f7ee75954
Patch util.c
2021-07-31 10:00:43 -05:00
Calvin Rose
e76b8da269
Add semantics for closing channels.
...
This makes certain algorithms simpler as channels
now have an explicit lifetime - multiple readers can coordinate
closing without needing to ensure the same number of reads as writes.
2021-07-30 19:26:42 -05:00
Calvin Rose
7e5f226480
Put source mapping info in stack traces.
2021-07-29 21:29:08 -05:00
Calvin Rose
2f634184f0
Merge branch 'master' of github.com:janet-lang/janet
2021-07-28 21:41:34 -05:00
Calvin Rose
e3e01466ee
Merge pull request #741 from sogaiu/remove-duplicate-method
...
Remove duplicate of method recv-from
2021-07-28 20:35:33 -05:00
sogaiu
025918cfcc
Remove duplicate of method recv-from
2021-07-28 14:44:49 +09:00
Calvin Rose
28fb76e602
Merge pull request #740 from yumaikas/hotfix-new-style-math-bindings
...
Fix macro stringification for one-arg math functions
2021-07-27 23:56:16 -05:00
Andrew Owen
b0f97393a3
Fix macro stringification for one-arg math functions
2021-07-27 21:40:25 -06:00
Calvin Rose
2a7041e751
Merge pull request #739 from sogaiu/new-style-core-fn-decl-for-array
...
Update array.c with new style core function declarations
2021-07-27 22:37:35 -05:00
sogaiu
eed158afdd
Merge branch 'janet-lang:master' into new-style-core-fn-decl-for-array
2021-07-28 10:24:11 +09:00
Andrew Owen
1c7505e04a
Merge branch 'master' into new-style-math-bindings
2021-07-27 19:19:39 -06:00
Calvin Rose
617da24942
Merge pull request #726 from yumaikas/new-style-ev-bindings
...
Update ev.c to use the new binding style that provides source information
2021-07-27 20:17:19 -05:00
Andrew Owen
98bdbfd3d5
Add JANET_DEF and co, use in math.c
2021-07-27 19:13:09 -06:00
Andrew Owen
b289f253c7
Remove static function from the JANET_FN family of macros
2021-07-27 18:43:32 -06:00
Andrew Owen
aabae03305
Add rselect bindings
2021-07-27 00:48:28 -06:00
sogaiu
194d645551
Update array.c with new style core function declarations.
2021-07-27 15:34:12 +09:00
Calvin Rose
889d6f9e43
Merge pull request #737 from sogaiu/new-style-core-fn-decl-for-corelib
...
Update corelib.c with new style core function declarations.
2021-07-26 22:07:17 -05:00
Calvin Rose
151de093d0
Merge pull request #736 from sogaiu/new-style-core-fn-decl-for-debug
...
Update debug.c with new style core function declarations.
2021-07-26 22:06:17 -05:00
sogaiu
7492a4c871
Update buffer.c with new style core function declarations.
2021-07-27 11:34:03 +09:00
sogaiu
d20543b92c
Update corelib.c with new style core function declarations.
2021-07-27 11:18:54 +09:00
sogaiu
59aab2ebbd
Update debug.c with new style core function declarations.
2021-07-27 08:01:56 +09:00
Calvin Rose
08f7b1b9e5
Run the formatter.
2021-07-26 17:54:26 -05:00
Calvin Rose
f2ac1c15e6
Merge pull request #735 from sogaiu/new-style-core-fn-decl-for-fiber
...
Update fiber.c with new style core function declarations.
2021-07-26 17:36:54 -05:00
Calvin Rose
eaf8f198c1
Merge pull request #733 from sogaiu/new-style-core-fn-decl-for-io
...
Update io.c with new style core function declarations.
2021-07-26 17:36:37 -05:00
sogaiu
2955286606
Update fiber.c with new style core function declarations.
2021-07-27 07:00:59 +09:00
Calvin Rose
40561340a8
Merge pull request #721 from uvtc/patch-1
...
docs for doc, searching for strings
2021-07-26 15:21:39 -05:00
Calvin Rose
4f00a7db88
Merge pull request #729 from sogaiu/new-style-core-fn-decl-for-os
...
Update os.c with new style core function declarations.
2021-07-26 15:21:15 -05:00
Calvin Rose
acc21d0b76
Merge pull request #724 from sogaiu/new-style-core-fn-decl-for-thread
...
Update thread.c with new style core function declarations.
2021-07-26 15:19:19 -05:00
Calvin Rose
db5df70d0c
Merge pull request #727 from sogaiu/new-style-core-fn-decl-for-string
...
Update string.c with new style core function declarations.
2021-07-26 15:19:07 -05:00
sogaiu
92c132381e
Update inttypes.c with new style core function declarations.
2021-07-26 21:52:02 +09:00
sogaiu
d0575e4087
Update io.c with new style core function declarations.
2021-07-26 21:39:13 +09:00
Calvin Rose
5ca48b96af
Merge pull request #728 from sogaiu/new-style-core-fn-decl-for-parse
...
Update parse.c with new style core function declarations.
2021-07-26 07:22:46 -05:00
Calvin Rose
2a9f30fc8a
Merge pull request #725 from sogaiu/new-style-core-fn-decl-for-table
...
Update table.c with new style core function declarations.
2021-07-26 07:16:28 -05:00
Calvin Rose
ba89a81a3e
Merge pull request #731 from sogaiu/new-style-core-fn-decl-for-net
...
Update net.c with new style core function declarations.
2021-07-26 07:11:15 -05:00
sogaiu
15b4d9363b
Update marsh.c with new style core function declarations.
2021-07-26 18:29:59 +09:00
sogaiu
ceca0e7f0e
Update net.c with new style core function declarations.
2021-07-26 18:20:06 +09:00
Andrew Owen
700770b883
Update math.c for the new style
2021-07-26 01:51:13 -06:00
sogaiu
8365037be5
Update os.c with new style core function declarations.
2021-07-26 16:48:04 +09:00
sogaiu
dfaba7daa6
Update parse.c with new style core function declarations.
2021-07-26 15:42:33 +09:00
sogaiu
5756934144
Update string.c with new style core function declarations.
2021-07-26 15:23:04 +09:00
Andrew Owen
7b3ab2727f
Fix copy/paste mistake in ev/take docs
2021-07-26 00:11:05 -06:00
Andrew Owen
714ba808dd
Update ev.c to use the new binding style that provides source information
2021-07-25 23:25:38 -06:00
sogaiu
6e94e03baa
Update table.c with new style core function declarations.
2021-07-26 14:03:01 +09:00
sogaiu
ac98dbccb8
Update thread.c with new style core function declarations.
2021-07-26 13:46:31 +09:00
Calvin Rose
6e3355d7f2
Merge pull request #723 from sogaiu/new-style-core-fn-decl-for-tuple
...
Update tuple.c with new style core function declarations.
2021-07-25 22:41:42 -05:00
Calvin Rose
97907906c5
Merge pull request #722 from sogaiu/new-style-core-fn-decl-for-compile
...
Update compile.c with new style core function declarations.
2021-07-25 22:41:11 -05:00
Calvin Rose
eb84200f28
Fix linux issues with epoll on normal files.
...
We use the selfpipe trick if epoll fails with EPERM when trying to
register a file descriptor.
2021-07-25 21:47:52 -05:00
sogaiu
caaa26e153
Update tuple.c with new style core function declarations.
2021-07-26 11:33:46 +09:00
Calvin Rose
030dd747e9
Merge branch 'master' of github.com:janet-lang/janet
2021-07-25 20:21:59 -05:00
sogaiu
dccb98bb92
Update compile.c with new style core function declarations.
2021-07-26 09:07:53 +09:00
John Gabriele
e356b7141c
Update boot.janet
2021-07-25 17:26:31 -04:00
bakpakin
4cae7e6d5d
When building amalgamated build on windows, patch source-map.
...
We don't want any backslahes cropping up in the offical distribution of
janet.c.
2021-07-25 15:53:38 -05:00
bakpakin
cc07b4a89a
Merge branch 'master' of github.com:janet-lang/janet
2021-07-25 14:54:45 -05:00
bakpakin
7e8154e648
Update peg.c with new style core function declarations.
2021-07-25 14:54:25 -05:00
Calvin Rose
dfee997e45
Merge pull request #718 from uvtc/patch-1
...
Add some clarifying backticks to docs
2021-07-25 14:10:44 -05:00
Calvin Rose
f6b7cb9c49
Merge pull request #719 from uvtc/patch-2
...
Clarify docs on take and drop functions
2021-07-25 14:10:01 -05:00
bakpakin
7fba44ccce
Add macro mechanism for defining C source information for functions.
...
This wil let us track source code for C functions more easily.
2021-07-25 13:03:01 -05:00
bakpakin
6f1695ecd4
Add utitities for interrupting the event loop.
...
janet_loop1_interrupt makes the event loop compatible
with safe interruptions for custom scheduling. Does this by exposing
custom events on the event loop. A custom event schedules a function pointer
to run in a way that can interrupt
epoll_wait/poll/GetQueuedCompletionStatus.
2021-07-25 09:08:46 -05:00
John Gabriele
76acbf9bb6
Clarify docs on take and drop functions
...
Pass in indexed and bytes, return tuples and strings, respectively.
2021-07-24 18:44:49 -04:00
John Gabriele
2769a62bb3
Add some clarifying backticks to docs
2021-07-24 16:58:21 -04:00
bakpakin
160dd830a0
Add janet_interpreter_interrupt for custom scheduling.
...
This would allow an embedder to suspend the current Janet fiber
via an external event like a signal, other thread, or really anything.
This is a useful primitive for custom schedulers that would call
janet_interpreter_interupt periodically (say, in an interval with SIG_ALRM),
do some work, and then use janet_continue on the janet_root_fiber, or
for embedding into other soft-realtime applications like a game. To say,
only allow about 5ms per frame of interpreter time.
2021-07-24 15:14:37 -05:00
bakpakin
aafc595e3a
Fix typo.
2021-07-24 12:47:51 -05:00
bakpakin
202783c67a
Add :d switch to os/spawn.
...
This allows for starting processes that can be turned into zombies.
2021-07-24 11:55:04 -05:00
Calvin Rose
f11b2c5a0d
Merge pull request #717 from yumaikas/fix-os-open-write-windows
...
Fix os open write windows, and add TerminateProcess calls
2021-07-24 07:52:40 -05:00
Andrew Owen
e8a86013da
Add fixes for :write on filestreams that come from os/open
2021-07-24 02:30:00 -06:00
Calvin Rose
a89c377c92
Add the fiber-fn
macro which slightly generalizes coro
.
2021-07-22 17:59:01 -05:00
Calvin Rose
54d73f6722
Make epoll the default on Linux for event loop implementations.
2021-07-21 21:46:26 -05:00
Calvin Rose
2e58f5f0d4
Add table/clear.
2021-07-21 19:58:42 -05:00
Calvin Rose
e7ea39f410
Prevent possible bad garbage collection when finalizing streams.
...
The GC finalizer for streams would sometimes try and use other objects
after they had already been freed.
2021-07-20 19:42:35 -05:00
Calvin Rose
a125218d03
Move some defines.
2021-07-20 18:24:56 -05:00
Calvin Rose
55b8563c08
Add janet_loop_fiber C function to run a fiber to completion from C.
...
This is mainly meant for use as the entry point to a C wrapper for a
janet program. This maeans the programmer doesn't need to use an ifdef
to handle if the event loop is enabled.
2021-07-18 09:39:37 -05:00
Calvin Rose
aea1f59f6e
Add option to build janet without thread library.
2021-07-17 15:13:28 -05:00
Calvin Rose
ab27b789e4
Fix minimal build.
2021-07-17 13:10:55 -05:00
Calvin Rose
3a1a59f1eb
Address windows build issue.
2021-07-16 21:10:02 -05:00
Calvin Rose
c20a76cddb
Update CHANGELOG and indicate next release will be 1.17.0
2021-07-16 21:05:42 -05:00
Calvin Rose
1ef6db16ed
Add janet_vm_save and janet_vm_load.
...
This lets a user multiplex multiple Janet VMs on a single
thread or process if they are willing to implement context switching
themselves.
2021-07-16 20:59:03 -05:00
Calvin Rose
dc414f1239
Merge pull request #713 from yumaikas/fix-process-terminate-windows
...
Add TerminateProcess to janet_proc_gc and os_proc_kill on Windows
2021-07-11 09:30:07 -04:00
Andrew Owen
12cfda1f58
Add TerminateProcess to janet_proc_gc and os_proc_kill on Windows
2021-07-11 04:05:11 -06:00
Andrew Owen
96b4e71704
Add TerminateProcess to janet_proc_gc and os_proc_kill on Windows
2021-07-11 03:56:08 -06:00
sogaiu
edb415d1a8
Tweak function name
2021-07-11 12:27:15 +09:00
Calvin Rose
72c1d1c484
Fix some error condiditions to have the right number of arguments.
2021-07-10 14:09:59 -04:00
Calvin Rose
04a248dc37
Update CHANGELOG.md
2021-06-27 10:54:03 -05:00
Calvin Rose
5defc3b914
Fix bug with ev/go when passing supervisor and value.
...
value was incorrectly set to nil in these cases. Also
fix some typos in core docstrings.
2021-06-25 18:58:19 -05:00
Calvin Rose
04ca945ecf
Address #711 - don't persist (dyn :exit)
2021-06-24 14:51:08 -05:00
Calvin Rose
87f8fe14dd
Prepare for 1.16.1 release.
2021-06-09 19:08:24 -05:00
Calvin Rose
2eadb21eb7
Update changelog.
2021-05-31 16:51:53 -05:00
Calvin Rose
69afa2a7a3
Merge branch 'master' into fix-shadow
2021-05-31 16:05:29 -05:00
Josef Pospíšil
a4325372e2
Rename level const to not to shadow line in eval1
2021-05-31 21:51:31 +02:00
Calvin Rose
4b96b73858
Add -w and -x flags to janet for linting.
2021-05-31 14:36:25 -05:00
Calvin Rose
bbae43f259
Update copyright dates.
2021-05-31 13:46:02 -05:00
Calvin Rose
ab974c409d
Remove externeous typedarray defines in janet.h
2021-05-31 09:23:45 -05:00
Calvin Rose
60214dc659
Update for windows compiler warning.
2021-05-30 16:42:58 -05:00
Calvin Rose
b990d77f16
Prepare for 1.16.0 release.
2021-05-30 12:15:56 -05:00
Calvin Rose
d204e06e11
Use lint information in run-context.
2021-05-30 10:33:46 -05:00
Calvin Rose
f6b37dbc77
Merge branch 'master' into linting
2021-05-30 09:34:32 -05:00
Calvin Rose
fab65d6c40
Merge branch 'master' into struct-proto
2021-05-30 09:33:59 -05:00
Calvin Rose
1f4f69a5b6
Fix windows syntax issue.
2021-05-29 20:40:26 -05:00
Calvin Rose
84f82f5465
Remove code delimtiers from defn and defmacro.
2021-05-29 20:37:30 -05:00
Calvin Rose
c911f7c47e
Address #694 - Update doc-format with more features.
...
Also allows having doc-format print in color with
(dyn :doc-color).
2021-05-29 20:34:22 -05:00
Calvin Rose
4d983e54b5
Initial struct prototype code.
...
Also add a number of cfunctions for manipulating structs
with prototypes.
2021-05-29 11:43:18 -05:00
Calvin Rose
33c000daea
Expose linting array to macros.
...
This has a lot of possible uses, and would let users add a macro-based
type system on top of Janet that would integrate with the usual linting
and warning system.
2021-05-28 15:15:34 -05:00
Calvin Rose
7ff204ec44
Work on system for adding compiler warnings.
...
This is the beginning of a system for compiler warnings. This includes
linting, deprecation notices, and other compiler warnings that are best
detected by the `compile` function and don't require the partial
evalutaion of the flychecker.
2021-05-28 15:12:05 -05:00
Calvin Rose
7c757ef3bf
Make jpm configurable for environments like MinGW.
2021-05-26 10:07:11 -05:00
Calvin Rose
2db7945d6f
Fix peg bug when there is no default grammar set.
...
This could result in a segfault when we attempt to
read from a NULL pointer.
2021-05-20 21:57:22 -05:00
Calvin Rose
81186bf262
Merge branch 'master' of github.com:janet-lang/janet
2021-05-19 18:43:50 -05:00
Calvin Rose
eeef5b0896
Add as-macro
and module/add-syspath
2021-05-19 18:18:00 -05:00
sogaiu
e5a2df93ab
Make doc work for special forms
2021-05-07 08:47:33 +09:00
Calvin Rose
49f66a936c
Merge commit 'f4c9064b79d5b32fd74e5ddf25266356c22dd53b'
2021-04-29 15:58:41 -05:00
Calvin Rose
cbe92bb985
Merge branch 'master' of github.com:janet-lang/janet
2021-04-29 13:13:55 -05:00
Calvin Rose
1baab5eb61
Remove typed arrays from the core.
...
Typed arrays will instead live in an external jpm nodule.
Also, changes have been made to `jpm` to allow other natives to use the
typedarray headers.
2021-04-29 12:33:49 -05:00
Calvin Rose
8fc8974b60
Add from-pairs
to core. #683
...
This always creates a table, use `table/to-struct` to
create a struct.
2021-04-29 12:06:24 -05:00
Chris Jones
29797b9eb0
Use _NSGetEnviron() on Apple
2021-04-27 11:54:24 +01:00
Calvin Rose
e181ee586b
Prepare for 1.15.5 release.
2021-04-25 14:00:16 -05:00
Calvin Rose
7b7d742bec
Add declare-headers to jpm.
2021-04-25 13:38:24 -05:00
Calvin Rose
612eaff9ff
Fix #682 - Don't hardcode size of sun_path.
2021-04-15 14:57:40 -05:00
Calvin Rose
cde4a505cf
Fix #673 - check typed array index bounds as well as buffer count.
2021-03-30 21:14:42 -05:00
Calvin Rose
3a3003029a
Merge branch 'master' of github.com:janet-lang/janet
2021-03-26 15:44:43 -05:00
Calvin Rose
7c7ff802fa
Add net/shutdown to allow better networking with streams.
2021-03-26 15:36:25 -05:00
Michael Camilleri
ec2d7bf349
Support adding arbitrary metadata to bindings
2021-03-24 09:38:12 +09:00
Andrew Chambers
f4c9064b79
Add config support for custom allocators.
2021-03-23 23:00:48 +13:00
Calvin Rose
100a82feb2
Version bump (development version).
2021-03-19 15:41:34 -05:00
Calvin Rose
90e5828d5d
Update printing when entering debugger.
2021-03-19 15:38:46 -05:00
Calvin Rose
b3e80308d4
Change inheritance rule.
2021-03-19 15:18:19 -05:00
Calvin Rose
3c63a48df4
( #667 ) Add constant inlining for tuples and structs.
...
Structs and tuples composed entirely out of constant values
will themselves be considered constant values during compilation.
This reduces the amount of generated code.
2021-03-16 20:52:55 -05:00
Calvin Rose
a467b34de4
Prepare for 1.15.4 release.
2021-03-16 20:12:33 -05:00
Calvin Rose
e70f64e23d
Sort keys initial.
2021-03-13 19:17:07 -06:00
Calvin Rose
6f605f8141
Update pretty printing default depth.
2021-03-13 17:43:19 -06:00
John Gabriele
0f05aec563
Update os.c
...
Doc typo
2021-03-09 14:39:09 -05:00
Calvin Rose
c9097623d6
Add group-by and partition-by to the core.
...
Semantics are mostly emulated from Clojure.
2021-03-04 19:34:36 -06:00
Calvin Rose
6392b37c47
Merge branch 'master' of github.com:janet-lang/janet
2021-02-28 13:05:05 -06:00
Calvin Rose
4fcc8075d4
Release 1.15.3
2021-02-28 13:04:24 -06:00
Michael Camilleri
1fea5f8fe7
Fix call to match in run-context
2021-02-28 14:23:17 +09:00
Calvin Rose
d6ea1989cc
Merge branch 'master' of github.com:janet-lang/janet
2021-02-26 17:29:25 -06:00
Calvin Rose
96513665d6
Address #641 - add undef combinator.
...
The (undef rule :tag) combinator lets a user "scope" tagged captures.
After the rule has matched, all captures with tag :tag can no longer be
refered to by their tag. However, such captures from outside
rule are kept as is. If no tag is given, all tagged captures from rule
are unreferenced. Note that this doesn't `drop` the captures, merely
removes their association with the tag. This means subsequent calls to
`backref` and `backmatch` will no longer "see" these tagged captures.
2021-02-26 17:25:09 -06:00
Calvin Rose
b795d13f61
Merge pull request #642 from pyrmont/feature.run-context-location
...
Allow source location in run-context to be updated
2021-02-26 16:36:03 -06:00
John Gabriele
be7dab4d17
Update boot.janet
2021-02-23 22:30:42 -05:00
John Gabriele
0e44ce5cba
Update boot.janet
2021-02-23 22:26:53 -05:00
John Gabriele
1f8c2781dd
sort
doc
...
Clarify doc for `sort` and `sorted`. Also in `sort`, changed arg name.
2021-02-23 22:24:59 -05:00
Michael Camilleri
f381a9c773
Check that new source location is a string
2021-02-22 12:50:44 +09:00
Michael Camilleri
855a9a01fc
Allow source location in run-context to be updated
2021-02-22 12:38:56 +09:00
Calvin Rose
c68264802a
Fix #638 - update fiber status in certain cases.
...
This fixes a regression from changes to janet_try. In some cases, we
would not update the status of a fiber when signaling, which left the
fiber's status as whatever it had previously. This could lead to strange
control flow issues.
2021-02-20 10:55:16 -06:00
Calvin Rose
742469a8bc
Address #640 .
...
Allow for a zero length match at the end of a string when using the
to or thru combinators.
2021-02-19 16:10:03 -06:00
Calvin Rose
92928d5c4f
Update definition of or
.
2021-02-16 17:00:27 -06:00
Leah Neukirchen
c16a9d8463
Fix or with zero arguments.
...
The value is nil to be consistent for and/or and all/some.
Also add some tests for and/or.
2021-02-16 19:59:03 +01:00
Calvin Rose
f1819c916a
Fix build error for 1.15.2
2021-02-15 10:27:19 -06:00
Calvin Rose
050d7c12a3
Prepare for 1.15.1 release.
2021-02-15 10:19:24 -06:00
Calvin Rose
7e2c433abc
Fix #636
2021-02-14 14:34:52 -06:00
Calvin Rose
6713b23a65
Change behavior of empty env table passed to os/execute on windows.
2021-02-14 11:22:20 -06:00
Calvin Rose
60078e7950
Change os/execute implementation for windows.
2021-02-14 11:04:59 -06:00
Calvin Rose
771b0d0ab1
Version bump.
2021-02-09 20:32:09 -06:00
sogaiu
60e2992158
Tweak spec_readint
2021-02-10 08:33:46 +09:00
Calvin Rose
bdf14170a4
Get ready for 1.15.0 release.
2021-02-08 18:10:46 -06:00
Calvin Rose
10dcbc639a
Immediate instuctions will now call :compare method.
2021-02-08 11:53:25 -06:00
Calvin Rose
6a9bb0f4e4
Define immediate comparison instructions for non-integers.
...
Previous, the instructions were defined only for values that
fit into 32 bit integers for legacy reasons.
2021-02-08 11:41:48 -06:00
Calvin Rose
c941e5a8f4
Merge pull request #628 from yumaikas/master
...
Switch out `by` to `before?` in sort functions.
2021-02-05 18:17:52 -06:00
Calvin Rose
be91414c7a
Improve error message from janet_call.
...
List expected arity in error messages.
2021-02-05 18:01:52 -06:00
Calvin Rose
6839b603c8
x86 32 bit on windows.
2021-02-04 23:31:04 -06:00
Andrew Owen
926b68d62e
Switch out by
to before?
in sort functions.
...
Makes docstrings easier to read, and reduces confusion with sorted-by
and sort-by.
2021-02-04 22:28:46 -07:00
Calvin Rose
d374e90033
Update sort documentation.
2021-02-04 20:11:24 -06:00
Calvin Rose
b168b0758a
Fix #625 - no fancy mixing in number hasing
...
Just hash upper 32 bits with lower 32 bits. Trying to get too fancy
was causing slowdowns in very trivial cases. Assuming that all
combinations of 64 bits in a double are equally likely (suspect but
probably not that incorrect), the obvious method of xoring the top
32 bits with the lower 32 bits gives a uniform distribution.
2021-02-04 19:37:11 -06:00
sogaiu
1c158bd4ff
Tweak module/add-paths docstring
2021-02-03 21:11:16 +09:00
Calvin Rose
ff24143f54
Merge pull request #620 from sogaiu/marshal-doc
...
Tweak marshal docstring
2021-02-02 21:29:54 -06:00
Calvin Rose
dd117e81c2
Fix parser/insert.
...
We need to add the tuple wrapping code there as well.
2021-02-02 18:55:24 -06:00
sogaiu
f4744a18c6
Tweak marshal docstring
2021-02-02 15:00:57 +09:00
Calvin Rose
259d5fabd9
Update Makefile and build_win for better builds.
...
Use build/c/janet.c in both to prevent accidental inclusion
of build/janet.h (which may be stale) instead of the source headers.
2021-01-31 09:59:53 -06:00
Calvin Rose
d122a75efd
Cleanup boot.janet to be more like normal source code.
...
Don't use `undef`, just use private defines.
2021-01-31 09:08:39 -06:00
Calvin Rose
c9ea3ac304
Address #618 - clarify file/open docs.
2021-01-31 08:39:57 -06:00
Calvin Rose
c63fe6ef8a
Make flycheck follow GNU standards for errors.
2021-01-30 12:51:38 -06:00
Calvin Rose
72ec89dfe9
Change output format for line+col.
2021-01-30 11:33:15 -06:00
Calvin Rose
04805d106e
Simpler overflow check.
2021-01-29 20:11:38 -06:00
Calvin Rose
9aed578466
Address #616 Buffer extra overflow bug.
...
We should have a normal error instead of undefined behavior, wrap
around, or wait for realloc to fail.
2021-01-29 18:32:54 -06:00
Calvin Rose
af75bf3b64
Update for sending streams to new threads.
2021-01-24 16:48:46 -06:00
Calvin Rose
f22472a644
Begin work on allowing small binaries.
2021-01-23 17:08:11 -06:00
Calvin Rose
5cac8bcf9f
Prepare for patch release.
2021-01-23 14:48:36 -06:00
Calvin Rose
a2801fbef9
Fix #610 - POLLHUP should cause us to continue reading.
2021-01-23 14:26:24 -06:00
Calvin Rose
0b14e913da
Merge branch 'master' of github.com:janet-lang/janet
2021-01-23 13:54:36 -06:00
Calvin Rose
85155bb2b4
Reference #478 Update peg/compile to use dyn for default grammar.
2021-01-23 13:54:02 -06:00
Calvin Rose
dd8de1e9ac
Merge pull request #609 from yumaikas/master
...
Change tracev to upscope instead of using let
2021-01-22 19:02:27 -06:00
Calvin Rose
c909835b0a
Update CHANGELOG.
2021-01-22 12:55:38 -06:00
Calvin Rose
a18aafedfd
Merge branch 'master' of github.com:janet-lang/janet
2021-01-22 12:53:28 -06:00
Calvin Rose
317ab6df6b
Add ev/thread and ev/do-thread.
...
- Also fix setting supervisor with net/accept-loop.
2021-01-22 12:52:45 -06:00
Andrew Owen
1fcaffe6b0
Change tracev to upscope, add test
2021-01-21 23:40:28 -07:00
Sunil Nimmagadda
381128364e
Replace malloc + memset with calloc.
...
Fixes an overflow warning from gcc with '-Wstringop-overflow' on
NetBSD-current.
2021-01-21 19:35:57 +05:30
Calvin Rose
0acf167e84
Merge pull request #602 from pyrmont/feature.module-docstrings
...
Display module-level docstrings with (doc)
2021-01-20 22:11:38 -06:00
Josef Pospíšil
251486e4aa
Fix ev/call doc
2021-01-20 20:31:41 +01:00
Michael Camilleri
c6467be60d
Conform display of path with existing display of source map info
2021-01-20 10:47:55 +09:00
Michael Camilleri
4dd512ad28
Use print-module-entry function to display docstring
2021-01-20 10:16:59 +09:00
Michael Camilleri
28076b9385
Display module-level docstrings with (doc)
2021-01-20 10:01:31 +09:00
Calvin Rose
49dcc816ae
Update os/shell to be non-blocking as well.
2021-01-18 16:44:22 -06:00
Calvin Rose
fa61c70103
Release 1.14.1
2021-01-18 11:51:42 -06:00
Calvin Rose
5ee6dbcdf4
Prepare for 1.14.1 release.
2021-01-18 11:43:53 -06:00
Calvin Rose
634219da2c
Fix windows swallowing IOCP events in many cases.
...
This fixes windows hanging on "failed" IO operations.
2021-01-17 20:41:59 -06:00
Calvin Rose
fbe3849b4b
Revert change to propagate op code.
2021-01-17 15:33:42 -06:00
Calvin Rose
bd2e335063
Allow 1 argument call of debug/stacktrace
...
Since fibers now track the last value signaled.
2021-01-17 13:55:40 -06:00
Calvin Rose
96262e7d87
Fix integer limit docs.
2021-01-17 13:44:53 -06:00
Calvin Rose
c5da87b860
Fix broken doc format.
...
Many assumptions in the parsing code that could cause infinite
loops, as well as assuming things were non-nil.
2021-01-17 11:36:48 -06:00
Calvin Rose
70e23df6f8
Merge branch 'master' of github.com:janet-lang/janet
2021-01-16 18:29:41 -06:00
Calvin Rose
95af205681
Merge pull request #589 from yumaikas/master
...
Add support for a profile.janet
2021-01-16 18:29:00 -06:00
Calvin Rose
6dfb689d1f
Update versions to indicate 14.1
2021-01-16 15:54:27 -06:00
Calvin Rose
462e74ef87
Add os/proc-close to close all pipes associated with a subprocess.
...
This will not leak handles until the GC runs in most use cases.
2021-01-16 15:11:07 -06:00
Andrew Owen
c6aa536590
Clean up env dance
2021-01-16 12:47:50 -07:00
Calvin Rose
c79480342b
Remove unused defines.
2021-01-16 07:19:28 -06:00
Calvin Rose
a1cc5ca045
Fix #593 .
...
Also add ev/give-supervisor to the core.
2021-01-16 07:18:07 -06:00
Andrew Owen
7f74ff3dd7
Restore :source property to keep import* working at REPL
2021-01-15 02:59:17 -07:00
Andrew Owen
c4a95e9a1e
Update error handling, kill a bikeshed argument
2021-01-15 01:53:14 -07:00
Andrew Owen
71f9e2b1d7
Add support for a profile.janet
...
Add support for a profile.janet, along with a flag for disabling it's use.
2021-01-15 01:31:23 -07:00
Calvin Rose
16fe32215b
Merge pull request #584 from sogaiu/tweak-file-docs
...
Tweak file docs
2021-01-13 21:41:33 -06:00
Calvin Rose
dd7342a6cf
Merge pull request #583 from sogaiu/tweak-debug-docs
...
Tweak debug/stack docs
2021-01-13 21:41:26 -06:00
Calvin Rose
35c88d10cd
Merge pull request #582 from sogaiu/tweak-parser-docs
...
Tweak parser docs
2021-01-13 21:41:09 -06:00
sogaiu
122e2a9378
Tweak os docs
2021-01-14 08:44:56 +09:00
sogaiu
33c9395d79
Tweak file docs
2021-01-14 08:33:04 +09:00
sogaiu
fc49aa359c
Tweak debug/stack docs
2021-01-14 07:47:50 +09:00
sogaiu
fcf37942a7
Tweak parser docs
2021-01-14 07:31:20 +09:00
Calvin Rose
9b42d5a5e9
Merge pull request #579 from sogaiu/tweak-type-docs
...
Tweak type docs
2021-01-13 12:26:30 -06:00
Calvin Rose
ba92dfcbe9
Merge pull request #580 from sogaiu/tweak-update-docs
...
Tweak update docs
2021-01-13 12:26:10 -06:00
Calvin Rose
fd03603adb
Merge pull request #577 from sogaiu/tweak-expand-path-docs
...
Tweak module/expand-path docs
2021-01-13 12:25:55 -06:00
sogaiu
c56b876bfe
Tweak update docs
2021-01-13 23:04:06 +09:00
sogaiu
c4957d5dfb
Tweak type docs
2021-01-13 22:59:43 +09:00
sogaiu
068bd33afb
Tweak disasm docs
2021-01-13 22:27:03 +09:00
sogaiu
e9bd108be9
Tweak module/expand-path docs
2021-01-13 22:16:54 +09:00
Calvin Rose
4f2d1cdc00
Go back to a single supervisor channel per fiber.
...
We now also use the fiber mask to figure out which flags to wait for.
2021-01-12 21:35:28 -06:00
Calvin Rose
61cca10cf6
Allow iterating through the properties of core abstract types.
2021-01-11 23:14:07 -06:00
Calvin Rose
dfbdd17dce
Add doc-of
function to core for reverse documentation lookup.
2021-01-11 20:32:26 -06:00
Calvin Rose
5e1a8c86f9
Add more network and subprocess testing with redirection.
2021-01-11 18:32:56 -06:00
Calvin Rose
bf01bf631d
More work on windows networking code.
...
Remove use of WSARecv and WSASend since for whatever reason
they seem suspect. We may want to revisit this later.
2021-01-11 18:00:31 -06:00
Calvin Rose
874cc79443
Fix #571 - fiber/status and fiber/new docstrings.
2021-01-11 15:44:46 -06:00
Calvin Rose
3883460202
Remove length checks to a number of core functions.
...
This lets them be more generic and implemented over a wider range of
data types, such as fibers.
2021-01-11 15:01:41 -06:00
Calvin Rose
f0dbc2e404
Fix subprocess spawning on windows.
...
Also fix (:read stream :all)
2021-01-11 11:10:23 -06:00
Calvin Rose
4df1ac5b23
Fix some issues in os.c to diagnose improve windows subprocess code.
2021-01-11 09:06:39 -06:00
Calvin Rose
1f6d0d342b
Fix #566 - bad docstring and bad arity for net/flush.
2021-01-10 12:02:28 -06:00
Calvin Rose
4625c28e6a
Merge branch 'master' of github.com:janet-lang/janet
2021-01-10 11:59:41 -06:00
Calvin Rose
5536ba20a8
Move socket setup code from ev.c to net.c
2021-01-10 11:58:47 -06:00
Thomas Dendale
0c73c3f1cd
Minor typo in ev/rselect docstring
...
`ev/choice` is actually called `ev/select`
2021-01-10 16:42:52 +01:00
Calvin Rose
7ae7984f3c
Allow yielding from root fiber to ev loop.
2021-01-09 23:35:34 -06:00
Calvin Rose
8286b33c52
Add event-chan argument to ev/go.
...
The event-chan is the final piece of the puzzle for fibers, and
will be pushed to when a fiber yields to the event loop.
2021-01-09 23:33:23 -06:00
Calvin Rose
475775cc9d
Add a "new_channel" for root fibers.
...
When new fibers are scheduled on the event loop, this new_channel
receives the newly created fibers. This lets a fiber track which fibers
have been added and let's a user implement a supervisor.
Fix formatting.
2021-01-09 18:33:40 -06:00
Calvin Rose
11067d7a56
Update module and rem operator for int types.
2021-01-09 14:47:43 -06:00
Calvin Rose
5b05da65f0
Allow wrap around on u64.
...
This lets some math work as expected.
2021-01-09 12:43:33 -06:00
Calvin Rose
444e630783
Fix formatting.
2021-01-09 10:14:20 -06:00
Calvin Rose
8951b8de7a
Inherit the supervisor channel from the root fiber if not given.
2021-01-08 16:32:23 -06:00
Calvin Rose
2abb87eb63
Add space in docstring.
2021-01-07 18:57:13 -06:00
Calvin Rose
32e8ac912d
Merge branch 'master' of github.com:janet-lang/janet
2021-01-07 18:08:08 -06:00
Calvin Rose
e403fb4652
Do not try and preload imports that are relative.
2021-01-07 18:07:47 -06:00
Josef Pospíšil
5a2a134c95
Remove redundant do
2021-01-07 14:38:58 +01:00
Calvin Rose
4e7ad3c7ce
Add initial implementation for supervisor channels.
...
Supervisor channels are a simple concept to more efficiently
enable dynamic, structure concurrency. When a top-level fiber
completes (or errors), it will push itself to it's supervisor
channel if it has one (instead of printing a stacktrace). This
let's another fiber poll a channel and "supervise" a set of fibers.
2021-01-06 23:19:22 -06:00
Calvin Rose
f206b476d1
Fix #550 - add varfn to safe forms for flycheck.
2021-01-06 17:31:08 -06:00
Calvin Rose
dd2595c53f
Merge branch 'master' of github.com:janet-lang/janet
2021-01-06 17:27:50 -06:00
Calvin Rose
545df28d71
Add flycheck function to core.
...
Also make flychecking work with stdin out of the box.
2021-01-06 17:27:17 -06:00
Calvin Rose
16f80b78cf
Merge pull request #546 from pepe/doc-thread-new-loop
...
Update doc for thread/new and remove ws in loop's
2021-01-05 20:31:46 -06:00
Calvin Rose
147bcce01b
Merge pull request #549 from pyrmont/docs.string-find-all-typo
...
Fix typos in string/find-all documentation
2021-01-05 20:31:12 -06:00
Calvin Rose
adc41e31f4
Address #547 - don't drop references.
...
Keep a separate stack for tagged references. May cause pegs to
use more memory but makes the backref and backmatch features much more
powerful.
Also disables the second stack if backref and backmatch are not used in the peg.
2021-01-05 20:27:15 -06:00
Michael Camilleri
2e555a930f
Fix typos in string/find-all documentation
2021-01-06 10:14:49 +09:00
Calvin Rose
bcba0c0279
Fix #548 - string/split bug.
...
Also update docstrings for string/find. The 'skipping'
behavior that was documented only applies to to string/replace-all.
2021-01-05 18:54:51 -06:00
Josef Pospíšil
c7f382add6
Update doc for thread/new and remove ws in loop's
2021-01-04 18:29:00 +01:00
Calvin Rose
665b1e68d5
Pluralize arity compile warning.
2021-01-03 20:15:51 -06:00
Calvin Rose
81f62b246c
Merge pull request #545 from felixr/master
...
Revert my buggy hybrid sort
2021-01-03 16:39:23 -06:00
Calvin Rose
87badc71d2
Remove :generate verb from loop.
...
Instead, one case use `:in` as with otehr data structures.
2021-01-03 16:38:38 -06:00
Calvin Rose
e5242c67ff
Update changelog and documentation.
2021-01-03 16:30:43 -06:00
Calvin Rose
4355420994
Remove function eachy
.
...
Instead use `each`.
2021-01-03 16:19:23 -06:00
Calvin Rose
c357af02c2
Allow iterating over fibers with each and similar.
2021-01-03 16:17:36 -06:00
Felix Riedel
19576effbe
Revert "Tweak sort: use insertion sort for small arrays"
...
This reverts commit 0ea77cabfb
.
2021-01-03 20:09:50 +00:00
Calvin Rose
7b030fe70d
Fix some return issues.
2021-01-03 11:54:31 -06:00
Calvin Rose
115556fcf2
Merge branch 'ev_execute'
2021-01-03 11:48:00 -06:00
Calvin Rose
9760cf1f4e
Fix MSVC warning.
2021-01-03 11:47:29 -06:00
Calvin Rose
47bb7fd21b
Begin implementing async subproccesses for windows.
2021-01-03 11:21:44 -06:00
Calvin Rose
1c7ed8ca48
Use PostQueuedCompletionStatus for threaded calls on windows.
...
Ore efficient than using a self pipe.
2021-01-03 11:08:12 -06:00
Calvin Rose
6b268c5df4
find-index
now takes optional default.
2021-01-03 09:33:52 -06:00
Calvin Rose
62f783f1dc
Merge branch 'master' of github.com:janet-lang/janet
2021-01-03 09:26:31 -06:00
Calvin Rose
61c65f3df1
Fix valgrind warning.
2020-12-31 16:30:54 -06:00
Calvin Rose
05166b3673
Fix proc getter bug.
2020-12-31 16:23:20 -06:00
Calvin Rose
0a1c93b869
Add ev api for making threaded calls.
...
Easy way to make arbitrary functions in C async.
2020-12-31 16:12:42 -06:00
Calvin Rose
788f91a36f
Remove unneeded book keeping for sub processes.
...
Since we are not using signals we no longer need some bookkeeping.
2020-12-31 11:52:12 -06:00
Calvin Rose
c831ecf5d2
Working implementation of process waiting with threads.
...
Does not require all sorts of signal handling code
that is not thread-safe and can "steal processes".
However, there is a much simpler way to add this functionality
by creating a new stream and thread for each subprocess when it is
waited on. This is perhaps _slightly_ less efficient but oh so much
simpler, since we can reuse all of our concepts from streams and there
is no need to implement a whole system around the selfpipe.
2020-12-31 11:22:18 -06:00
Calvin Rose
9e42ee153c
Merge branch 'master' into HEAD
2020-12-30 12:19:13 -06:00
Calvin Rose
d457aa5951
Deprecate file/popen.
...
os/spawn is the prefered way of creating a subprocess and
communicating with it.
2020-12-30 10:22:45 -06:00
Calvin Rose
ab37ee6ebb
Add :all option to ev/read.
...
Brings ev/read more in line with file/read.
2020-12-29 20:37:59 -06:00
Calvin Rose
8655530b19
Rename predicates in module/paths
2020-12-29 19:52:26 -06:00
Calvin Rose
27b1f59aa9
Change Ctrl-C and move old behavior to Ctrl-Q
...
This lets Janet be a better unix citizen and lets Ctrl-C
raise an interrupt. Trying to make Janet behave superficially
like a shell by overriding Ctrl-C is not helpful.
2020-12-29 16:20:37 -06:00
Calvin Rose
cc2cc4db43
Merge pull request #541 from sogaiu/match-doc-formatting
...
Tweak match docstring
2020-12-29 13:10:35 -06:00
Calvin Rose
20bcd95279
Merge commit '0ea77cabfb30afc15433581f5888171c1f65aafd'
2020-12-28 12:20:21 -06:00
Calvin Rose
d7954be5e5
Update docstring for os/open.
2020-12-28 11:00:15 -06:00
Felix Riedel
0ea77cabfb
Tweak sort: use insertion sort for small arrays
2020-12-28 16:06:48 +00:00
Felix Riedel
0d46352ff4
Revert to better performing number hash.
2020-12-27 14:05:40 +00:00
sogaiu
ffa0d5fe45
Tweak match docstring
2020-12-27 13:42:22 +09:00
Calvin Rose
a2c837a99c
Merge remote-tracking branch 'felixr/master' into master
2020-12-26 20:06:34 -06:00
Calvin Rose
13d8d11011
Try new number hashing with frexp.
...
This may be a bit slower in some cases but generally should
have much better hashing for numbers.
2020-12-26 16:54:14 -06:00
Calvin Rose
b4f242193d
Improve hash function for numbers.
2020-12-26 15:38:04 -06:00
Felix Riedel
3e742ffc4c
Improve quicksort to avoid worst case performance.
...
The current implementation will have quadratic behaviour for already
sorted arrays because it picks the last element as pivot. In an sorted
array this splits the array repeatedly into the biggest value and all
other values.
The implementation in this commit uses the *median of three* as pivot.
`janet -e "(sort (range 10000))"` to reproduce quadratic behaviour.
2020-12-26 19:18:17 +00:00
Felix Riedel
2ec12fe06f
Improve hashing of numbers
...
Using an integer hash (https://stackoverflow.com/a/12996028/60617 ) on
the number casted to int32 combined with lower bits of the number.
2020-12-26 13:09:11 +00:00
Felix Riedel
c76e0ae685
Use boost's way of combining hash values for arrays and kv pairs.
...
`seed ^= hash_value(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);`
from https://www.boost.org/doc/libs/1_35_0/doc/html/boost/hash_combine_id241013.html
The current way of combining hashes peforms poorly on hash values of
numbers. Changing the way hashes are combined canlead to a significant speed up:
```
time janet_new -e '(def tbl @{}) (loop [x :in (range 1000) y :in (range 1000)] (put tbl {0 x 1 y} true))'
3.77s user 0.08s system 99% cpu 3.843 total
time janet_orig -e '(def tbl @{}) (loop [x :in (range 1000) y :in (range 1000)] (put tbl {0 x 1 y} true))'
48.98s user 0.15s system 99% cpu 49.136 total
```
2020-12-26 13:05:03 +00:00
Calvin Rose
25ded775ad
Add array/clear.
...
Also improve map, find-index, and find to work on data structures
which do not defined length.
2020-12-18 12:37:58 -06:00
Michael Camilleri
04f6c7b156
Clarify docstring of parser/where
2020-12-15 16:41:45 +09:00
Michael Camilleri
77b79e9899
Update (parser/where) to support optional line and column
2020-12-15 14:12:33 +09:00
Calvin Rose
a55354357c
Make dofile error if source file errors.
...
This should make dofile a bit easier to use.
It also means that import properly raises errors when
things go bad.
2020-12-14 08:23:06 -06:00
Calvin Rose
392d5d51df
Fix build info for 1.13.1
2020-12-13 11:59:52 -06:00
Calvin Rose
7b709d4c68
Prevent buffer/trim from shrinking buffer to 0 bytes as well.
2020-12-13 09:38:35 -06:00
Calvin Rose
eab5f67c5c
Fix buffer with NULL data pointer issue.
...
Simply prevent buffers from ever having a NULL data pointer.
2020-12-13 09:33:57 -06:00
Calvin Rose
6020106000
Address #529
2020-12-11 19:21:54 -06:00
Calvin Rose
12f470ed10
Use :_name instead of :name for printing tagged tables.
2020-12-11 18:28:09 -06:00
Calvin Rose
945cbcfad6
Tail recursive match implementation.
...
This implementation uses multiple passes on patterns
to remove the need for a sentinel value to check if there was a match.
This also re-uses extracted subpatterns for complicated patterns.
2020-12-10 08:35:34 -06:00
Calvin Rose
d53007739e
Invert read/write bits on pipe in os/execute.
...
It was backwards, breaking this functionality.
2020-12-09 19:04:05 -06:00
Calvin Rose
6eaf8272e1
Merge pull request #525 from uvtc/patch-1
...
light markup in some docs in corelib
2020-12-07 15:57:09 -06:00
John Gabriele
52addc877d
Use xs
2020-12-07 14:07:13 -05:00
sogaiu
53a5f3d2dc
Tweak comment for janet_fiber_popframe
2020-12-07 12:23:27 +09:00
Calvin Rose
cd09b696b5
Add :preload loader.
2020-12-06 21:06:17 -06:00
John Gabriele
df1ca255a9
parts/xs --> pieces
2020-12-06 21:29:30 -05:00
John Gabriele
adbe361b9b
light markup in some docs in corelib
2020-12-06 17:51:48 -05:00
Calvin Rose
0f16f21677
Make builds deterministic again.
...
Also prevent marshal from creating multiple copies of
a function - (marshal function pointer before function def pointer).
2020-12-06 16:32:23 -06:00
Calvin Rose
aa0de01e5f
Fix some formatting and undefined behavior.
2020-12-06 14:33:08 -06:00
Calvin Rose
785757f2f6
Remove pthreads from shell.c and update bsd build.
2020-12-06 13:51:06 -06:00
Calvin Rose
7e1d095996
Merge pull request #522 from pyrmont/docs.keep-docstring
...
Clarify description of keep
2020-12-05 14:31:58 -06:00
Calvin Rose
9d23192614
Add ev/deadline and ev/with-deadline.
...
This should be more useful than timeouts in real-world
use cases. The deadline system is based on fibers and is target
to much more coarse-grained (and therfor reliable) timeouts than things
like ev/sleep and timeout arguments.
2020-12-05 10:32:34 -06:00
Michael Camilleri
7c1a52ae65
Use 'different from' in preference to 'different to'
2020-12-05 16:43:44 +09:00
Michael Camilleri
9aa1b9c740
Clarify description of keep
2020-12-05 16:02:36 +09:00
Calvin Rose
c4a4916055
Address #500 - update docs and add buffer/push
...
This updates the documentation and adds a function buffer/push, which
is a more useful function than buffer/push-string or buffer/push-byte by
combining both.
2020-12-04 17:56:47 -06:00
Calvin Rose
b402e0671a
Merge pull request #514 from uvtc/patch-2
...
boot.janet, fix possible typo
2020-12-04 17:40:46 -06:00
Calvin Rose
8144f83b66
Merge pull request #516 from uvtc/patch-4
...
doc for identity
2020-12-04 17:40:31 -06:00
Calvin Rose
cd2a55e268
Merge pull request #513 from uvtc/patch-1
...
boot.janet, cond doc
2020-12-04 17:38:02 -06:00
Calvin Rose
f92b5d69c8
Merge pull request #515 from uvtc/patch-3
...
C-style (hyphenate)
2020-12-04 17:37:24 -06:00