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
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
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
60214dc659
Update for windows compiler warning.
2021-05-30 16:42:58 -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
1f4f69a5b6
Fix windows syntax issue.
2021-05-29 20:40:26 -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
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
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
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
Chris Jones
29797b9eb0
Use _NSGetEnviron() on Apple
2021-04-27 11:54:24 +01: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
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
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
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
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
f1819c916a
Fix build error for 1.15.2
2021-02-15 10:27:19 -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
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
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
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
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
a2801fbef9
Fix #610 - POLLHUP should cause us to continue reading.
2021-01-23 14:26:24 -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
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
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
49dcc816ae
Update os/shell to be non-blocking as well.
2021-01-18 16:44:22 -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
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
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
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
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
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
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
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
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
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
c357af02c2
Allow iterating over fibers with each and similar.
2021-01-03 16:17:36 -06: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
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
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
0d46352ff4
Revert to better performing number hash.
2020-12-27 14:05:40 +00: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
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
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
12f470ed10
Use :_name instead of :name for printing tagged tables.
2020-12-11 18:28:09 -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
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