Commit Graph

1652 Commits

Author SHA1 Message Date
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 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
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
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
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 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
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 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 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 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 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 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 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
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 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 4fd7470bbf Remove accidental limit on max read size. 2021-09-21 09:55:40 -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 8b10a5fb7c Format and update CHANGELOG.md 2021-09-18 13:40:32 -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 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
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
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 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 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 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 a78cbd91da Address #753 - fix gensym regression. 2021-08-06 16:25:53 -05: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 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 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
sogaiu dccb98bb92 Update compile.c with new style core function declarations. 2021-07-26 09:07:53 +09: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
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 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 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