Calvin Rose
3563e7e1aa
Add -fPIC to default cflags when building boot image.
2020-08-03 17:32:41 -05:00
Calvin Rose
cb898fabf4
Set default channel size to 0.
2020-08-03 07:57:02 -05:00
Calvin Rose
5899671d96
Merge branch 'master' into ev
2020-08-03 07:54:53 -05:00
Calvin Rose
b564087db0
Add index-of to core library.
2020-08-02 13:47:56 -05:00
Calvin Rose
1748e8510e
Fix typo in docstring.
2020-08-02 13:27:49 -05:00
Calvin Rose
742c5bb639
Use a common queue implementation.
...
Queues occur in three places, so we use a single
implementation rather than three separate ones. This also
has the result that janet_vm_spawn will not overflow in the case
of channel-heavy, IO-light operation.
2020-08-01 14:20:58 -05:00
Calvin Rose
297de01d95
Add preliminary channel implementation.
2020-08-01 13:13:58 -05:00
Andre Alves Garzia
ba2beffcd8
Make sure JANET_NO_NANBOX is defined for ARM targets
2020-07-28 16:51:19 +01:00
Calvin Rose
2eb2dddb59
Begin work on channels.
2020-07-26 23:45:25 -05:00
nia
b731f6ab03
Fix build on NetBSD.
...
The NetBSD C library's headers do not expose extensions when
compiling with -std=c99 (as opposed to -std=gnu99 or no -std=
option), so define _NETBSD_SOURCE to get timegm, and functions
that would otherwise require an _XOPEN_SOURCE definition, e.g.
realpath.
Note that, as with FreeBSD, you need gmake to compile janet
on NetBSD, and can also install it from packages.
2020-07-27 00:21:15 +01:00
Calvin Rose
0403e306ed
Silence warnings from some compilers.
2020-07-26 08:48:22 -05:00
Calvin Rose
d393fbf360
Merge branch 'master' into ev
2020-07-25 14:07:47 -05:00
Calvin Rose
4cc680965c
Prepare for 1.11.1 release.
2020-07-25 13:48:43 -05:00
Calvin Rose
ba08e487cb
Disable PRF by default.
...
Since it is not any better by default without initializing the key, we
disable it by default. It can be turned on with JANET_PRF in
janetconf.h.
2020-07-25 13:34:40 -05:00
Calvin Rose
3960d0f6de
Merge branch 'master' into ev
2020-07-25 13:17:05 -05:00
Calvin Rose
409a8a3a43
Fix #452 - Bad file marshal
...
We forgot a call to janet_marshal_abstract, which corrupted the output.
2020-07-25 08:09:22 -05:00
Calvin Rose
02e5e49de2
Fix buffer overflow.
2020-07-24 07:04:32 -05:00
Calvin Rose
43438d3824
Allow getting typed arrays from byte sequences.
...
Fix native importing for .so files in current directory.
2020-07-24 07:01:34 -05:00
Calvin Rose
553b4d9428
Add timeouts to net functions.
...
Further debugging of the general timeout system, as well
as having a single fiber wait on multiple state machines (select).
2020-07-19 19:41:12 -05:00
Calvin Rose
df145f4bc9
Merge branch 'master' into ev
2020-07-19 17:20:43 -05:00
Calvin Rose
3ba2c7e7e8
Address #394 and #451 - Prepare for 1.11.0
...
Prefix MANPATH and PKG_CONFIG_PATH variables
with JANET_ to disassociate with standard env variables
that have a different format.
2020-07-18 13:09:53 -05:00
Calvin Rose
b4f5e5bc00
Update docs for -l option.
2020-07-06 21:25:41 -05:00
Calvin Rose
f580d2e41a
Add forever macro and add names to anon fns.
...
Adding names to anon functions that may error improves
stack traces, especially for user visible traces.
2020-07-06 19:26:37 -05:00
Calvin Rose
cd197e8be3
Add ev/call.
...
This is a common operation, and making fibers manually can be tedious.
2020-07-06 19:13:32 -05:00
Calvin Rose
51cf6465ff
Merge branch 'master' into ev
2020-07-06 17:22:38 -05:00
Calvin Rose
7478ad115f
Add any?
predicate to core.
...
This is the contrapositive to `every?`, and is analagous to `or` as
`every?` is to `and`.
2020-07-06 09:19:10 -05:00
Calvin Rose
9d8e338a11
Update default repl prompt to match errors.
2020-07-05 23:32:59 -05:00
Calvin Rose
ed4163cfde
Replace copyright on boot with system information.
2020-07-05 23:24:07 -05:00
Calvin Rose
bd95f742c0
Merge branch 'master' into ev
2020-07-05 23:14:49 -05:00
Calvin Rose
463e6d9316
Merge pull request #448 from GrayJack/fix-table-remove
...
Fix janet_table_remove returning the key instead of the value
2020-07-05 18:36:54 -05:00
Calvin Rose
a45509d28e
Add list-pkgs and list-installed to jpm.
2020-07-05 17:43:39 -05:00
Calvin Rose
9ba94d2c6b
More work on timeouts and racing listeners.
...
When two listeners are racing to resume the same fiber, the
first should cancel out the other.
2020-07-05 17:26:17 -05:00
Calvin Rose
a4de83b3a3
Merge branch 'master' into ev
2020-07-05 10:11:23 -05:00
Calvin Rose
68a12d1d17
Minor fixes for meson minimum build.
...
Also, fix regression that looses function name information.
2020-07-03 20:41:55 -05:00
Calvin Rose
c97d3cf359
Fix minimum meson build.
2020-07-03 20:30:09 -05:00
Calvin Rose
4721337c7c
issues with gettime on mach kernel.
2020-07-03 20:19:36 -05:00
Calvin Rose
2b36ed967c
Address some windows issues.
2020-07-03 20:13:49 -05:00
Calvin Rose
3bb8f1ac8d
Don't use CLOCK_MONOTONIC for pthread stuff.
...
Also fix marshalling functions without full
sourcemapping information, as well as thread/receive
ignoring bad messages. Instead, thread/receive will error
on bad messages.
2020-07-03 19:54:58 -05:00
Calvin Rose
617ec7f565
Threading improvements.
...
- Add thread/exit to kill the current thread.
- Add global lock aroung custom getline and add atexit handler
- to prevent any possible issues when exiting program.
- Allow sending stderr, stdout, and stdin over thread.
2020-07-03 16:28:07 -05:00
Calvin Rose
dc259b9f8e
Set fiber env for heavyweight threads.
...
Since you already incur the cost of creating the
core environment, this is probably what you want anyways.
This will make eval and other reflective code work as expected.
2020-07-03 15:20:19 -05:00
Calvin Rose
7b31a87b3c
Update integer limits and printing.
2020-07-03 14:14:59 -05:00
Calvin Rose
37a430c97c
Move declarations around.
2020-07-03 13:47:48 -05:00
Calvin Rose
f264cb0b18
Merge branch 'master' into ev
2020-07-03 12:26:01 -05:00
Calvin Rose
6ea530cc48
Address compilation warnings and errors.
2020-07-03 12:25:24 -05:00
Calvin Rose
a0abf307b4
Merge branch 'master' into ev
2020-07-03 12:14:48 -05:00
Calvin Rose
55cf9f5e1c
Don't break reverse backwards compat.
...
Breaking backwards compatibiliy here is not worth it.
Also update changelog.
2020-07-03 10:17:50 -05:00
Calvin Rose
b89f0fac7b
Move clock shims to util (Helps #430 ).
...
The thread module should also use these clock shims rather
than clock_gettime, which is not available on older mac systems.
2020-07-03 09:54:58 -05:00
GrayJack
8b3b3182bd
Add tests to check janet_table_remove behaviour
2020-07-02 11:03:08 -03:00
Calvin Rose
97c64f27ff
Remove duplicate code in loop macro.
...
Also evaluate for loop and range step exactly once.
Multiple evaluations can be inefficent and make infinite loop
detection impossible.
2020-07-01 22:37:04 -05:00
Calvin Rose
e548e1f6e0
Add peg/replace and peg/replace-all
2020-07-01 21:29:24 -05:00
GrayJack
7ea1c7d85a
Fix janet_table_remove returning the key instead of the value
2020-07-01 20:05:07 -03:00
Calvin Rose
e08235b575
Merge pull request #436 from cellularmitosis/no_arc4random_buf
...
Add support for systems which are missing arc4random_buf
2020-07-01 15:54:15 -05:00
Jason Pepas
a110b103e8
math/nan
2020-07-01 15:35:36 -05:00
Jason Pepas
f06e9ae30c
Switch to using /dev/urandom for OS X prior to 10.7
2020-06-30 04:18:08 -05:00
Jason Pepas
f5d208d5d6
eliminate large stack allocation from arc4random_buf bodge
2020-06-30 04:06:20 -05:00
Calvin Rose
7fb8c4a68d
Merge branch 'master' of github.com:janet-lang/janet
2020-06-29 22:57:46 -05:00
Calvin Rose
647fc56d47
Replace for with forv in most places in boot.janet
...
Generates slightly better bytecode with current compiler
(gets rid of a single extra move instruction per loop iteration).
2020-06-29 22:56:16 -05:00
Jason Pepas
597d84e263
Add support for systems missing arc4random_buf
2020-06-29 21:06:13 -05:00
Calvin Rose
977b0c3c0c
Merge pull request #429 from pepe/fix-reverse-doc
...
Tune reverse[d] docstrings
2020-06-29 20:55:04 -05:00
Calvin Rose
1b0d6de735
Merge pull request #432 from cellularmitosis/no_cloexec
...
Support for systems missing O_CLOEXEC
2020-06-29 20:54:41 -05:00
Jason Pepas
5565f02dbd
Simplifying workaround for missing O_CLOEXEC
2020-06-29 19:36:18 -05:00
Calvin Rose
17a131ac21
Add peg/find and peg/find-all.
...
These peg functions should make pegs a bit easier to use
and more efficient in some common cases.
2020-06-29 19:13:06 -05:00
Calvin Rose
aefde67aa2
And lots of optimization functionality.
2020-06-28 18:16:57 -05:00
Calvin Rose
a1ea62a923
Fix optimization of do_get.
...
When the target slot (register) is the same as the default
register, do not clobber it.
2020-06-28 15:52:59 -05:00
Calvin Rose
db63d352a2
Add specialization for 3 argument get.
...
This can be inlined with jmpnn instruction (jump if not nil) to
skip over the default value.
(get a b c)
can be exanded statically to
asm start:
(get $0 $1 $2)
(jmpnn $0 :label)
... Instructions to load default value to $0 - often a load.
:label
asm end.
2020-06-28 15:03:01 -05:00
Josef Pospíšil
289de840fd
Specify input types actions
2020-06-28 20:49:44 +02:00
Calvin Rose
95c633914f
Add auto-resizing of gc interval.
...
This should prevent over use of GC and O(n^2)
behavior.
2020-06-27 16:51:20 -05:00
Calvin Rose
d033412b1f
Add symbol/slice and keyword/slice
2020-06-27 15:22:15 -05:00
Calvin Rose
9c5e97144d
More small changes to help with cross compilation
...
via makefile. Add option to turn off built in
getline via janetconf.
2020-06-27 12:39:16 -05:00
Calvin Rose
8b96289e2f
Merge branch 'master' of github.com:janet-lang/janet
2020-06-27 11:24:03 -05:00
Calvin Rose
51ff43e2f2
Update range checks for 64 bit integers.
2020-06-27 11:23:47 -05:00
Calvin Rose
1e30f4f973
Merge pull request #427 from pyrmont/nil-empty-string
...
Change default string representation of nil to empty string
2020-06-26 22:47:16 -05:00
Jason Pepas
f9f90ba1d6
Support for systems missing O_CLOEXEC
2020-06-26 14:44:57 -05:00
Jason Pepas
51bf8a3538
Add ppc to os/arch
2020-06-26 04:11:21 -05:00
Josef Pospíšil
7b033a48a3
Wrap both reverse and reversed docstring to 80 chr
2020-06-25 09:43:10 +02:00
Josef Pospíšil
1b420f69aa
Fix reverse docstring
2020-06-25 09:35:03 +02:00
Calvin Rose
6a187a384b
Make zipcoll more generic.
...
Work with any iterable (next) type.
2020-06-24 16:10:57 -05:00
Calvin Rose
ac5de1f96e
Change compare-primitive to cmp.
...
cmp is implemented as a VM instruction rather than
a function.
2020-06-24 16:00:00 -05:00
Calvin Rose
6c917f686a
Add :h default peg class, as well as ad \v to whitespace.
2020-06-24 08:40:23 -05:00
Calvin Rose
328ee94412
Merge branch 'master' into ev
2020-06-22 22:25:44 -05:00
Calvin Rose
de9951594e
Allow setting dynamic bindings at C top level.
...
Before, these bindings we just ignored. However, it useful for
controlling janet_printf and janet_eprintf, for example. These can
be called from C code without being inside a call to janet_continue.
2020-06-22 08:56:04 -05:00
Calvin Rose
561fc15ae9
Address #426 parse errors in *out janet_dostring
...
This should make its use a little more robust for
simple usage. To avoid printing to stderr, use
janet_table_put(env, janet_ckeywordv("err"), janet_wrap_false());
2020-06-22 08:34:17 -05:00
Calvin Rose
803f17aa90
Add eachy and repeat to make looping easier.
...
Like eachk and eachp, use eachy and repeat to bring loop
verbs outside of the loop macro. These new macros are very simple
and easy to understand, in contrast to the loop macro which is of
medium complexity.
2020-06-21 18:48:06 -05:00
Calvin Rose
08a3687eb5
Fix #428
...
Add binding check for generate verb in loops. The check is present
in other loop verbs.
2020-06-21 15:57:55 -05:00
Michael Camilleri
c4035b2273
Change string representation of nil to empty string
2020-06-21 17:54:06 +09:00
Calvin Rose
5c364e0f7c
Better roundtrip jdn.
...
Use the most precise format specifier, such that output jdn numbers
are more accurate.
2020-06-18 21:54:34 -05:00
Calvin Rose
9cfc3d9d37
Update to 1.10.1
2020-06-18 19:24:17 -05:00
Calvin Rose
b5e32a9ce5
Expose janet_table_clear.
2020-06-15 15:33:41 -05:00
Calvin Rose
79f5751375
Add array/trim and buffer/trim.
2020-06-14 17:40:48 -05:00
Calvin Rose
106437bd45
Fixes #423
...
Re-add ifdef for realpath config option.
2020-06-14 15:50:09 -05:00
Calvin Rose
1bddb87a0c
Fix MSVC Warnings.
2020-06-14 14:20:38 -05:00
Calvin Rose
19f3568e18
Update for 1.10.0.
2020-06-14 12:15:56 -05:00
Calvin Rose
17bdfbb08b
Fix broken trace functionality.
...
This was an older regression that caused trace to emit
garbage output in most cases.
2020-06-14 11:58:20 -05:00
Calvin Rose
c87a0910d0
Add some flags to creating threads for more control.
...
Allow lightweight/heavyweight threads, and make default lightweight.
This means multithreaded programs can save lots of memory by default.
2020-06-13 09:42:16 -05:00
Calvin Rose
b1a4f05b5a
Explicitly disallow handler for datagram server.
2020-06-13 08:29:48 -05:00
Calvin Rose
ce2079104a
Merge branch 'master' into ev
2020-06-11 19:20:51 -05:00
Calvin Rose
86e12369b6
Add alias for PEG repeat.
...
A tuple where the first element is an integer is
a shortand for this.
2020-06-11 11:23:43 -05:00
Calvin Rose
6d096551f0
Add Peg combinators 'to' and 'thru'.
...
Inpsired by the REBOL operators of the same name, these
combinators match bytes up to or inculding a given pattern.
(to patt) is (almost) equalivalent to (any (if-not patt 1)), and
(thru patt) is equivalent to (* (to patt) patt). The one difference
is that if the end of the input is reached and patt is not
matched, the entire pattern does not match.
2020-06-10 21:18:50 -05:00
Calvin Rose
2595c8a853
Properly hide private functions in boot.janet
2020-06-10 00:02:07 -05:00
Mike Beller
9824a34d76
Remove dead code.
2020-06-06 08:55:20 -04:00
Mike Beller
76c3436377
Remove vestigial comparison methods from int types
2020-06-05 11:07:48 -04:00
Mike Beller
a4178d4b3c
All tests pass for compare.
2020-06-05 10:51:35 -04:00
Mike Beller
3e423722c6
Actually got the comparisons working for s64 (still need to fix u64)
2020-06-04 18:27:48 -04:00
Mike Beller
01837f2bb6
All tests pass.
2020-06-04 15:27:36 -04:00
Mike Beller
411c5da6d3
compare functions now work for built ins and 'objects'
2020-06-04 13:49:09 -04:00
Mike Beller
7658ea8335
primitive tests working. issues remain with polymorphic.
2020-06-04 12:46:58 -04:00
Mike Beller
81d301a42b
Initial commit of base functionality for compare
2020-06-04 12:23:54 -04:00
Calvin Rose
123710078d
Add unix domain socket support to net.
...
Code is a bit messy, as getaddrinfo does not support
unix domain sockets directly. We require a keyword :unix
instead of the usual hostname string, and the port is the
path to unix domain socket. The UDS should support both stream
and datagram sockets.
2020-06-03 00:53:17 -05:00
Calvin Rose
ec0d0ba368
Initial UDP implementation.
2020-06-02 19:47:50 -05:00
Leaf
bed02c2f95
Remove unused flags
2020-06-02 09:14:31 +00:00
Leaf
75bc69ba2f
Implement os/realpath on Window with _fullpath
...
This is similar to realpath but differs in that realpath will complain
if the path does not exist. We could add our own exists check if we
really wanted to match that behaviour.
2020-06-02 09:05:41 +00:00
Calvin Rose
3f434f2a44
Add backpressure capability to net.
2020-05-31 15:46:01 -05:00
Calvin Rose
71d8e6b4cd
Merge branch 'master' into ev
2020-05-30 11:35:19 -05:00
Calvin Rose
a78af0a7fb
Do not explicitly free state machines, instead return a status.
...
This makes it harder to have some kind of use after free issue.
2020-05-30 11:31:05 -05:00
Calvin Rose
eb9f74a273
Silence MSVC warning.
2020-05-30 10:06:39 -04:00
Calvin Rose
117ae196fd
Add net/flush.
...
Useful for simple TCP protocols (netrepl), which benefit from being able
to immediately send a message.
2020-05-28 19:22:38 -05:00
Calvin Rose
4c211c8dce
More updates to the ev library.
2020-05-28 16:51:11 -05:00
Matthew Carter
ee94828355
Fix for double free on fclose due to GC not knowing it failed
2020-05-28 15:35:09 -04:00
Calvin Rose
c10d9b9d9d
Merge branch 'master' into asyncio
2020-05-28 10:57:10 -05:00
Calvin Rose
fff66649aa
Fix issue #416 .
...
Be really sure we don't pass too large of a size to memcpy.
There seem to be some situations where the slotcount and the ua.count
do not match at all, so use the mimimum for copying.
2020-05-28 10:47:22 -05:00
Calvin Rose
b68b0a256e
Start with ev module.
2020-05-28 10:39:40 -05:00
Calvin Rose
c19bbfce78
Make style consistent.
2020-05-23 11:07:57 -05:00
Calvin Rose
e9fdbe0c89
Merge pull request #411 from LouisJackman/make-ctrl-c-interrupt-current-form
...
Make Ctrl-C Cancel the Current Form; Only Exit if Column 0 Outside of Form
2020-05-23 11:33:19 -04:00
LouisJackman
e220f44953
Simplify and don't replace history for cancelled forms
2020-05-23 08:36:40 +01:00
Calvin Rose
41f8be2c53
Fix flycheck when using the use
macro.
...
Flycheck originally expected `use` to have
the same arguments as `import`, but this is not the case.
2020-05-21 18:51:17 -05:00
LouisJackman
c3e4cbe950
Address compilation warning about modifier order
2020-05-21 18:51:25 +01:00
LouisJackman
50df5000c2
Update older run-context code
2020-05-21 18:47:47 +01:00
LouisJackman
3c8930b72b
Get tests passing again by returning keyword rather than nil from chunks
2020-05-21 18:37:15 +01:00
LouisJackman
f0572c4d5f
Remove REPL-within-form thread-local bool
2020-05-21 18:31:21 +01:00
Calvin Rose
057ba8a4e1
Fixes #409
...
Use the correct count in a memcpy.
2020-05-21 01:35:37 -05:00
Calvin Rose
677737d345
Fixes #412 Lookahead does not move cursor.
2020-05-21 01:22:08 -05:00
LouisJackman
164ed0b325
Get expected behaviour; cleanup after confirming behaviour is desired
2020-05-20 22:40:05 +01:00
Mike Beller
8263789602
Fix issue #408 -- make "next" work for typed arrays, and also fix
...
bug where tarray/new failed to fully check the type of it's last
argument.
2020-05-20 13:30:48 -04:00
Calvin Rose
b72845609f
Add JANET_GIT to jpm.
...
This should allow work arounds for some windows installs.
Also, be clever about finding the location of te current git
executable on windows to avoid some path issues that seem to
occur on some windows installations.
2020-05-19 18:36:58 -04:00
Calvin Rose
e623690295
Use keywords in the assembly interface.
...
This is simply more idiomatic, removes some unused and undocumented
features of the assembly interface, and simplifies it somewhat.
2020-05-19 13:51:39 -05:00
Calvin Rose
0e828792ae
Fix segfault on bad loop. Fixes #407 .
2020-05-19 09:45:45 -05:00
Calvin Rose
b7cfc08fc5
Improve line and col tracking in parser.
...
Unconditionally add line and column information if
a parsed value is a tuple - before, some parsed tuples
had line and col information omitted.
2020-05-18 19:05:27 -05:00
Calvin Rose
92f0e1719b
Be less eager to set macro-form in macex1.
2020-05-18 18:37:41 -05:00
Calvin Rose
9e5f203302
Expose line, col in macros via (dyn :macro-form)
...
This exposes line and column indirectly via
tuple/sourcemap and allows interesting debug macros.
2020-05-18 18:27:35 -05:00
Calvin Rose
df32cd0aca
Update tracev macro to be simpler and single arity.
...
Reference #401
2020-05-18 17:43:41 -05:00
Calvin Rose
ae5dc8c45b
Merge pull request #401 from LouisJackman/add-dbg-core-macro
...
Add a dbg macro for easy var dumping
2020-05-18 18:30:14 -04:00
LouisJackman
b1ed5b0707
Add "trace " prefix missed out from previous commit
2020-05-18 22:02:56 +01:00
LouisJackman
e9a5cfaddd
Adopt Andrew Chamber's suggestions
2020-05-18 21:55:21 +01:00
LouisJackman
e0130e7fd7
"Literal" -> "Expression" for trace-pp msg
2020-05-17 08:18:44 +01:00
LouisJackman
fb491f0d7c
Put back erroneously deleted "Literal"
2020-05-17 08:12:54 +01:00
LouisJackman
9109e369ff
Incorporate suggestions from PR
2020-05-16 20:18:00 +01:00
Calvin Rose
1bb9a9368b
Make sure winsock2.h is included before windows.h
...
This should be true in the normal build, and especially in the
amalgamated build.
2020-05-16 12:41:26 -05:00
LouisJackman
ca3dac7e87
Return an immutable tuple instead
2020-05-16 15:50:47 +01:00
LouisJackman
59302d4f42
Return dbg values to work inside complex exprs
2020-05-16 15:42:16 +01:00
LouisJackman
fabb722c8d
Add a dbg macro for easy var dumping
2020-05-16 15:15:57 +01:00