Calvin Rose
eabb215391
Use janet_gettime instead of clock_gettime in ev.c
...
We made the wrapper, let's use it. Also switch poll implementation to a
monotonic clock instead of realtime to be more inline with epoll and
kqueue.
2025-08-21 19:10:08 -05:00
Calvin Rose
697fdcff6d
Merge pull request #1627 from nlordell/fix/system-monotonic-clock
...
Read System Clock for Monotonic Time
2025-08-18 07:53:26 -05:00
Calvin Rose
99abada2c2
Merge pull request #1626 from nlordell/fix/clocks-per-sec
...
Use `CLOCKS_PER_SEC` instead of `CLOCKS_PER_SECOND`
2025-08-18 07:35:20 -05:00
Calvin Rose
f764788b36
Merge pull request #1624 from nlordell/fix/libjanet-ldflags
...
Fix `LDFLAGS` Usage in Makefile
2025-08-17 20:58:40 -05:00
Calvin Rose
4701bc6543
Add test patch for #1625
2025-08-17 20:55:52 -05:00
Calvin Rose
bf34340737
Merge pull request #1623 from tttuuu888/work-issue-1622
...
Add `net/socket` for unbound socket creation for #1622
2025-08-16 06:48:43 -05:00
Calvin Rose
1ead670e33
Merge pull request #1621 from tttuuu888/work-issue-1620
...
Fix: Correctly flag UDP streams in net/connect #1620
2025-08-12 16:04:52 -05:00
Calvin Rose
0aee7765cf
Windows quirk fix
2025-08-02 20:04:55 -05:00
Calvin Rose
4894a4673a
Fix abstract unix sockets for issue #1618 - address #1618
2025-08-02 19:00:47 -05:00
Calvin Rose
f00d3199c3
Fix #1609 Remove sigaction if JANET_NO_EV defined.
2025-08-02 18:19:39 -05:00
Calvin Rose
e34a8545e6
Merge pull request #1615 from ifreund/net-server-datagram
...
net/server: improve error for truthy handler and type :datagram
2025-08-02 18:06:24 -05:00
Calvin Rose
ddc122958b
Merge pull request #1607 from sarna/master
...
Clarify :fresh usage in import
2025-07-13 18:35:56 -05:00
Calvin Rose
2e363bf29c
Remove extra call to filewatcher - address #1608
2025-07-13 18:34:12 -05:00
Calvin Rose
312f9faae8
Address #1609 - compile with JANET_NO_PROCESSES
2025-07-13 18:24:23 -05:00
Calvin Rose
91b7bcad3d
Merge pull request #1606 from pyrmont/bugfix.bundle-install
...
Support complex dependency coordinates in `bundle/install`
2025-07-06 10:32:54 -05:00
Calvin Rose
58b1491592
Merge pull request #1605 from iacore/patch-2
...
Patch try to accept (try body ([] catch-body))
2025-06-29 10:01:32 -05:00
Calvin Rose
21a6ed3bd3
Revert order change from f4ecb5a
...
janet_interpreter_interrupt should always be called before janet_interpreter_interrupt_handled, and the original code ensured that.
2025-06-26 19:20:07 -05:00
Calvin Rose
d96e584869
Remove windows-2019 from github CI
2025-06-19 17:29:48 -05:00
Calvin Rose
f4ecb5a90f
Reorder post event / interrupt sequence in deadline.
...
The interrupt message should come _after_ the post event is made.
2025-06-18 22:13:14 -05:00
Calvin Rose
f181948aa9
Merge pull request #1601 from edsrzf/limit-buffer-read
...
Use strnlen when checking for null byte
2025-06-14 12:25:18 -05:00
Calvin Rose
27f01e2664
Merge pull request #1597 from sogaiu/remove-more-underline-bits
...
Remove some underline bits from doc-format
2025-05-21 21:39:16 -05:00
Calvin Rose
56c5a0ca09
Address #1591 - remove _ behavior of docstring format
2025-05-20 19:17:32 -05:00
Calvin Rose
f3ad13c2d4
Always cancel thread on windows.
2025-05-18 14:02:32 -05:00
Calvin Rose
8ac4eec370
Change ifdef structure.
2025-05-18 13:20:19 -05:00
Calvin Rose
92e91259c3
Don't call pthread cancel on normal exits.
...
Calling pthread_cancel on threads that can exit normally is not needed.
Instead, we immediately call pthread_join if a thread can exit normally.
2025-05-18 09:52:11 -05:00
Calvin Rose
e355cb07e0
Reorder declarations.
2025-05-18 09:27:01 -05:00
Calvin Rose
5bbfcdacd5
Work on #1596 - No detached threads, make sure to call pthread_join
...
Call pthread_join on all worker threads for timeouts. Previously, we
were leaking some threads, as well as creating a timeout and leaving
has_worker unset on certain timeouts.
2025-05-18 08:36:53 -05:00
Calvin Rose
790a4f2636
Make tests pass with clang sanitizers.
...
Fix some issue with clang sanitizers, name -fsanitize=thread and
-fsanitize=undefined. The threading issue arose from the implementation
of ev/deadlock when allowing for interpreter intrerrupts, as this is
implemented by racing a timeout thread with a worker thread.
The undefined behavior issue arose in some very old code in corelib.c that will
actually work as expected for most compilers, but was both undefined and
unecessary as we have a correct implemenation in util.c.
2025-05-17 21:28:41 -05:00
Calvin Rose
84bb84b0b7
OpenBSD 7.7 -> 7.6 rollback
2025-05-16 18:58:07 -05:00
Calvin Rose
29f2b5c345
Update openbsd package for srht
2025-05-16 18:57:29 -05:00
Calvin Rose
4643c8fa35
Squashed commit of the following:
...
commit c5b3da1ffe
Author: Calvin Rose <calsrose@gmail.com >
Date: Fri May 16 18:35:33 2025 -0500
Inter
2025-05-16 18:49:45 -05:00
Calvin Rose
a8e2c8e5b8
Address #1596 - Use atomic intrinsics to check allow_interrupt flag.
...
Use a relaxed memory order if possible to mitigate performance issues as
much as possible. relaxed memory order should be sufficient.
2025-05-16 18:26:43 -05:00
Calvin Rose
3d3e880f52
Allow configuration of JANET_THREAD_LOCAL. Address #1595
...
This is to better allow configuration on various, unknown compilers.
Previously, we hardcoded how thread local storage was specified for a
few different compilers, but we were not following and C standard. In
C11, there is a standardized storage specifier _Thread_local for this
storage class, however this is now deprecated in various C++ compilers
for a new keyword, confusingly. Janet also does not claim to require the
C11 standard, so for maximum flexibilty, the storage specifier must be
specified at configure time.
2025-05-11 08:37:15 -05:00
Calvin Rose
bef8ba5e06
Merge pull request #1594 from sogaiu/tweak-docstrings
...
Tweak docstrings for better handling
2025-05-08 17:00:32 -05:00
Calvin Rose
523639362c
Merge pull request #1593 from agent-kilo/thread-message-size-check
...
Try to fix cfun registry size check for cross-thread messages
2025-05-08 17:00:22 -05:00
Calvin Rose
f2eaa5dee8
Remove ev/to-stream.
...
The function has more problems than initially expected, both on Posix
systems and on Windows. Given all the caveats, it is probably best not
to include. Any function that can obtain files can use os/open instead.
The standard FILE objects also will not work anyway, and different
operating systems have different work arounds.
2025-04-18 18:20:27 -07:00
Calvin Rose
b27c830d90
Use win32 DuplicatHandle instead of _dup
...
There are constraints when using the posix API on win32
that aren't present with normal win32.
2025-04-11 21:36:08 -05:00
Calvin Rose
92a852f2df
Add ev/to-stream.
...
This function is symmetrical to ev/to-file and can convert a blocking
file to a stream (with caveats).
2025-04-11 21:10:49 -05:00
Calvin Rose
647e218bed
make format
2025-04-09 20:39:23 -05:00
Calvin Rose
5ebe945ffd
Merge pull request #1582 from pyrmont/bugfix.termux-pthread_cancel
...
Fix absence of pthread_cancel in Android
2025-04-09 20:16:57 -05:00
Calvin Rose
90a33bc88a
Add some systems that support addchdir.
2025-04-07 21:12:28 -05:00
Calvin Rose
1ba077c87d
Add ifdefs for various platforms to check for the support of addchdir.
...
This will need to be expanded but should support most modern systems.
2025-04-07 21:12:28 -05:00
Calvin Rose
34629ae314
Fix signature on windows.
2025-04-07 21:12:28 -05:00
Calvin Rose
3edc4f35b2
Add :cd argument to os/execute and os/spawn.
2025-04-07 21:12:28 -05:00
Calvin Rose
06d01c099f
Merge pull request #1581 from sogaiu/fix-mapcat-and-keep-docstrings
...
Fix mapcat and keep docstrings
2025-04-07 21:11:14 -05:00
Calvin Rose
332f123abe
Replace if not errorlevel 0 with if errorlevel 1
...
The former is just bad syntax.
2025-04-05 20:59:45 -05:00
Calvin Rose
38e841fc5c
Get rid of test error.
2025-04-05 20:52:47 -05:00
Calvin Rose
e8187fdee5
Fix windows build
2025-04-05 20:26:57 -05:00
Calvin Rose
2fedb67cb3
formatting
2025-04-05 17:32:07 -05:00
Calvin Rose
bdab93c999
Add {:err :out} option to os/spawn.
...
This special case in the os/spawn interface allows easily
redirecting both stderr and stdout to the same pipe.
2025-04-05 17:30:46 -05:00
Calvin Rose
a9ff8b388f
Add os/getpid
2025-04-05 16:20:17 -05:00
Calvin Rose
b12dfd784e
Merge pull request #1578 from sogaiu/tweak-some-docstrings
...
Tweak doc for mapcat, count, keep, all, some
2025-04-04 21:45:09 -05:00
Calvin Rose
17524d2ed3
Merge pull request #1577 from sogaiu/cleanup-unix-domain-socket
...
Remove unix domain socket after test
2025-04-04 07:11:42 -05:00
Calvin Rose
363e32d455
Adopt docstring from #1574
2025-04-03 20:52:40 -05:00
Calvin Rose
31920e574d
Add explicit Alpine Linux directions.
...
Statically linking Janet is quite useful, especially for users who want
to use jpm and janet-pm to build standalone binaries.
2025-04-01 19:47:03 -05:00
Calvin Rose
cf714ed591
Notify user when script is installed during a bundle installation.
...
Lets user know what to add to PATH.
2025-04-01 18:52:23 -05:00
Calvin Rose
b458404b41
Update ffi/write to append to a buffer by default.
2025-03-28 10:00:40 -05:00
Calvin Rose
707463a645
Merge pull request #1575 from pyrmont/feature.ev-interrupt2
...
Expand scope of code that works with `ev/deadline` again
2025-03-26 09:42:51 -05:00
Calvin Rose
73334f3485
Prepare for 1.38.0 release.
2025-03-18 21:14:45 -05:00
Calvin Rose
a5b8da8d67
Merge pull request #1572 from tsujamin/janet-ffi-define-fix
...
Remove janet_lib_ffi() dependency on JANET_EV
2025-03-18 19:12:44 -07:00
Calvin Rose
88984f7ffb
Add bundle/replace
...
Slight generalization of bundle/reinstall to allow inplace upgrades
of a bundle without reinstalling all dependent bundles as well.
2025-03-17 17:58:40 -05:00
Calvin Rose
182170b3be
Make installed manifests nicer to work with.
2025-03-16 20:39:16 -05:00
Calvin Rose
f92412841b
Merge pull request #1569 from sogaiu/vm-bug-1566
2025-03-12 21:13:49 -07:00
Calvin Rose
7c38a55a9a
Merge pull request #1568 from rwtolbert/msys2_mingw_build_fix
...
Update Makefile and meson to build with msys2 gcc and clang
2025-03-10 17:56:00 -07:00
Calvin Rose
3583d4c92f
Fix defdyn in flychecking.
2025-03-08 20:03:02 -06:00
Calvin Rose
a456c67a7b
Merge pull request #1564 from pyrmont/bugfix.qemu-segfault
...
Use Alpine Linux as base image for s390x testing
2025-03-05 05:52:20 -08:00
Calvin Rose
9538b8a77c
Merge pull request #1562 from pyrmont/bugfix.subprocess-cleanup
...
Improve subprocess-related docstrings and functions
2025-03-03 18:47:59 -08:00
Calvin Rose
36d3804dd2
Merge pull request #1563 from pyrmont/bugfix.copyright-dates
...
Add script to update copyright dates
2025-03-03 18:47:38 -08:00
Calvin Rose
aa9efee868
Expose bundle operations in the CLI.
...
Bundle installation is a fairly natural command on the command line.
2025-03-03 08:14:09 -06:00
Calvin Rose
e0a0e2ed42
Prevent multi-scheduling with os/proc-wait. (address #1562 )
2025-03-02 10:44:15 -06:00
Calvin Rose
3441bcbd69
Add more cases for checking coerce error.
...
Channel operations inside a janet_call could wreak more
havoc later, when scheduled fibers are shooting off when they shouldn't
be. The easiest way to prevent this is simply check that we are not
inside janet_call before doing channel operations. We also get nicer
error messages this way.
2025-02-16 10:40:38 -06:00
Calvin Rose
2e6001316a
Work on bug #1556
2025-02-16 09:09:33 -06:00
Calvin Rose
53bcc15207
Merge pull request #1557 from sogaiu/update-changelog-2025-02
...
Update CHANGELOG.md
2025-02-09 23:22:45 -08:00
Calvin Rose
5c56c7fa91
Formatting in peg.c
2025-02-07 21:05:28 -06:00
Calvin Rose
9a892363a3
Address issue #1558
...
Don't attempt SO_REUSEPORT on unix domain sockets since it doesn't make
sense and may cause a failure to bind without extra effort by the
programmer.
2025-02-07 21:05:07 -06:00
Calvin Rose
5f550ea5d4
Merge pull request #1555 from sogaiu/tweak-apply-short-fn-docstrings
...
Tweak apply and short-fn docstrings
2025-02-06 16:44:45 -08:00
Calvin Rose
410f8d69bc
Merge pull request #1528 from ianthehenry/til-peg-special
...
add (til) PEG special
2025-02-03 19:07:08 -08:00
Calvin Rose
6da44bdb6a
Get rid of early termination rule in all finite loops.
2025-02-03 07:36:00 -06:00
Calvin Rose
d30fd27575
Address #1554 - capture first 0-width match in repeating rules and
...
optionals.
This fixes some undesirable interplay between lookaheads and looping
(repeating) rules where lookaheads caused the loop to immediately
terminate _and_ discard any captures. This change adds an exception if
there is a 0-width match at the first iteration of the loop, in which
case captures will be kept, although the loop will still be terminated
(any further iteration of the loop would possibly cause an infinite
loop).
This allows optionals to work as expected when combined with lookahead.
There is also a question of whether or not optional should be
implemented as separate rule rather than as `(between 0 1 subrule)`.
2025-02-02 20:34:36 -06:00
Calvin Rose
1b278fc657
Update reduce2 documentation to fix issue #1545
2025-02-01 17:31:55 -06:00
Calvin Rose
eecffe01a5
Add some more test cases for hex floats.
2025-02-01 08:09:57 -06:00
Calvin Rose
f63a33884f
Add hexfloats - Address #1550
2025-01-30 07:36:18 -06:00
Calvin Rose
fa75a395cb
Add support for buffer peg literals - address #1549
2025-01-26 09:48:48 -06:00
Calvin Rose
1f34ec9902
Merge pull request #1547 from pyrmont/bugfix.codeql-upgrade
...
Update CodeQL actions to latest version
2025-01-25 09:24:40 -08:00
Calvin Rose
49f151e265
Allocate parser with GC.
...
This fixes janet_dobytes, which manually allocated a parser on the
stack, and then possibly ran garbage collection before it was
deallocated.
2025-01-22 09:21:56 -06:00
Calvin Rose
06d581dde3
Fix #1546 - large ranges.
...
Raise an error for very large ranges instead of internal assert.
2025-01-20 09:02:22 -06:00
Calvin Rose
2b49903c82
Merge pull request #1544 from cideM/docstring-fixes
...
Fix docstrings for int/u64, int/s64 and int/to-number
2025-01-14 06:30:08 -08:00
Calvin Rose
60d9f97750
Address issue #1539 - infinite loop in peg split
...
Other looping rules ensure forward progress by terminating if an
iteration is at the same location as the previous iteration. Do the same
for split.
2025-01-01 11:28:10 -06:00
Calvin Rose
f252933f62
Merge pull request #1541 from rwtolbert/feature/win_arm64_dist
...
Brief: Add Arm64 .msi support on Windows
2025-01-01 09:19:57 -08:00
Calvin Rose
6dbd7b476c
Merge pull request #1538 from sogaiu/tweak-exit-value-doc
...
Tweak *exit-value* doc - address #1537
2024-12-31 10:28:03 -08:00
Calvin Rose
ba5990ef21
Add switch to turn off "reuse" behavior for server sockets.
2024-12-31 09:05:54 -06:00
Calvin Rose
746ced5501
Revert behavior of deep= on mutable keys.
...
Mutable keys are a minefield for comparisons, as resolving
equality require re-implementing a lot of the internal structures, as
well as dealing with multiple mutable keys that are in the same
equivalency class by deep=.
Simplifying the implementation to not resole mutable keys is much
simpler, faster, and has the benefit that deep= and deep-not= do not
need to allocate.
2024-12-21 09:03:01 -06:00
Calvin Rose
1b49934e4f
Allow table/to-struct to take a prototype.
...
Use this prototype struct in freeze.
2024-12-19 19:41:19 -06:00
Calvin Rose
682f0f584f
freeze with mutable keys should be determinsic help address #1535
2024-12-19 19:31:01 -06:00
Calvin Rose
611b2a6c3a
Add more test cases for #1535
2024-12-19 18:37:51 -06:00
Calvin Rose
8043caf581
Update CHANGELOG.
2024-12-19 18:31:05 -06:00
Calvin Rose
b2d2690eb9
Merge pull request #1534 from pyrmont/bugfix.windows-longstrings
...
Support dedenting long-strings with Windows EOLs
2024-12-19 16:24:21 -08:00
Calvin Rose
7f745a34c3
Allow for mutable keys correctly in deep=
2024-12-19 18:20:05 -06:00
Calvin Rose
b16cf17246
Merge pull request #1533 from pyrmont/feature.file-socket
...
Add `ev/to-file` for synchronous resource operations
2024-12-17 20:50:47 -08:00
Calvin Rose
4daecc9a41
Prevent await inside janet_call - address #1531
...
This was partially implemented before, but not in the case where the
await or other signal itself was created by a C function. We have to
separate code paths for generating signals - one via normal returns in
janet_vm_continue, and the other via longjump. This adds handling for
the longjump case, as well as improved messaging.
2024-12-14 10:34:36 -06:00