Calvin Rose
adc3066dc8
Update doc-format and boot.janet docstrings.
...
Make doc-format respect leading indents, increase the default format
width to better accommodate markdown formatted documentation. We still
need to support single line style doc strings, such as those used
for most c functions which can be a single line of much longer than
80 or 120 characters.
Consecutive whitespace internal to lines is not preserved, though.
2020-11-26 14:58:36 -06:00
Calvin Rose
7fd2da1096
Add code in parser to automatically indent long strings.
...
Leading spaces are stripped based on the column index of the first
backtick character in the first delimiter. If there are
characters that are not newline or space before that column in the
string, then the behavior is the same as the old behvaior - no
re-indentation is performed.
2020-11-26 13:20:58 -06:00
Calvin Rose
451340e4c0
Update docstrings in boot.janet ( #506 )
...
Elaborate on usage of reduce and accumulate.
2020-11-26 10:34:51 -06:00
Calvin Rose
a3e812b86d
Fix #505 - bat int64 parsing.
...
Fixes an off-by-1 error.
Also makes windows testing hopefully a bit less flaky.
2020-11-25 09:45:46 -06:00
Calvin Rose
a3f98091c4
Fix #509
...
janet_fiber returns NULL if there is a bad arity, check that before
continuing.
2020-11-23 15:28:28 -06:00
Calvin Rose
781ed0dc67
Merge branch 'master' of github.com:janet-lang/janet
2020-11-18 19:36:12 -06:00
Calvin Rose
8f00848c7b
Fix build issues on windows by using a size_t instead of int.
2020-11-18 19:31:20 -06:00
Calvin Rose
53aa19a916
Several changes to move pipe creation back into ev.c
2020-11-18 10:53:36 -06:00
Calvin Rose
2dc04d2957
On install, merge janetconf.h into janet.h
...
This results in a cleaner amalgmated build
2020-11-17 09:53:12 -06:00
Calvin Rose
306bdee673
Merge branch 'master' of github.com:janet-lang/janet
2020-11-16 18:47:28 -06:00
Calvin Rose
cff52ded58
Add JANET_ASYNC_EVENT_CANCEL
...
also fix bug that could cause event loop to hang.
2020-11-16 18:46:59 -06:00
Calvin Rose
fbe658a724
Merge pull request #503 from sogaiu/boot-janet-docstring-tweaks
...
Tweak docstrings in boot.janet
2020-11-16 17:03:54 -06:00
Calvin Rose
078f50d45a
When reading from a stream, EPIPE is considered EOS.
...
Before, EPIPE caused an error, but in most cases it is better
to consider it an end of stream. In the future, we may want to allow
cusomtization of this behavior with flags on the stream but for now
let's keep it simpler.
2020-11-16 16:49:27 -06:00
Calvin Rose
760e4e3d68
Add upscope special form.
...
Upscope is similar to do, but does not introduce a new lexical scope.
2020-11-16 16:41:27 -06:00
Calvin Rose
9ec5689d6b
Don't use gcroot/unroot for tracking IO operations.
...
This could have bad effects in higher load situations, and
duplicates code. It is better to keep a dedicated list of
scheduled IO operations which can be efficiently added and
removed from. It also provides and easy way to enumerate
scheduled IO operations.
2020-11-16 09:30:04 -06:00
sogaiu
c8b72431a3
Some more
2020-11-16 16:13:28 +09:00
sogaiu
0eb913fb9a
A couple more tweaks
2020-11-16 14:14:51 +09:00
sogaiu
fce27cb2e8
Tweak docstrings in boot.janet
2020-11-16 14:03:26 +09:00
Calvin Rose
1b6272db2e
Fix windows ifdef.
2020-11-15 19:55:58 -06:00
Calvin Rose
a25b030e36
Fix EPOLL implementation.
2020-11-15 19:40:47 -06:00
Calvin Rose
717fac02d1
Update janet.h for janet_thread_current
2020-11-15 16:12:02 -06:00
Calvin Rose
dcf8ba0edb
Update CHANGELOG.md
2020-11-15 15:35:50 -06:00
Calvin Rose
3ab2ae130b
Address #495 Add :read and :parser to run-context.
2020-11-15 15:26:16 -06:00
Calvin Rose
6e6900fa3a
os/execute and os/spawn can take streams.
2020-11-15 12:17:29 -06:00
Calvin Rose
d7af4596e1
Move math.h include out of windows ifdef
2020-11-15 10:21:37 -06:00
Calvin Rose
a7ed3dea4b
Remove some flags in os/open.
2020-11-15 10:06:20 -06:00
Calvin Rose
cdcb774dc8
Add os/pipe and os/open.
...
ev/pipe -> os/pipe, and os/open is a wrapper
around the open system call.
2020-11-15 09:57:29 -06:00
Calvin Rose
d199c817dc
Broken Pipe error on windows should just be end of stream.
2020-11-14 16:03:51 -06:00
Calvin Rose
139e3fab25
Invert status check for (Read/Write)File
2020-11-14 15:52:01 -06:00
Calvin Rose
7a98f9aa02
Improve windows error messages on write failures.
2020-11-14 15:48:21 -06:00
Calvin Rose
b53dd67e74
Use custom pipe implementation for overlapped io.
2020-11-14 15:44:19 -06:00
Calvin Rose
e546731093
ev_lasterr -> janet_ev_lasterr
2020-11-14 15:24:13 -06:00
Calvin Rose
d50c4ef6da
Try again for windows build.
2020-11-14 15:01:52 -06:00
Calvin Rose
7d0b1955a2
typo
2020-11-14 14:55:26 -06:00
Calvin Rose
16cf7681f0
Fix some windows issues.
2020-11-14 14:40:39 -06:00
Calvin Rose
12f09ad2d7
Add ev/pipe and move stream code into ev.c
...
Also adds a lot to the C API and changes things up.
2020-11-14 14:29:11 -06:00
Calvin Rose
b3e88a8d80
Move read/write functions into ev.c from net.c
...
This code can also be used for non-network streams.
2020-11-14 11:48:23 -06:00
Calvin Rose
761273bcc4
Add janet_thread_current() to C api.
2020-11-12 18:42:41 -06:00
Calvin Rose
1a75f68cb2
Fix windows build.
2020-11-12 14:52:02 -06:00
Calvin Rose
1b0edf54f1
Fix gc leak.
...
Rather than trying to be clever with pinning/unpinning, always
mark the root fiber and that should serve as thei singular common root in almost
all cases.
2020-11-12 14:29:38 -06:00
Calvin Rose
caa6576719
Fix formatting.
2020-11-11 15:35:44 -06:00
Josef Pospíšil
2be09790a9
Change fix with ev/call
2020-11-10 10:39:33 +01:00
Josef Pospíšil
bf6eae711a
Fix adding handler to loop with fiber
2020-11-10 10:32:47 +01:00
Calvin Rose
6f1d5d3b73
Add net/listen and net/accept-loop.
...
These are the elements that make up net/server, which has been moved
into pure Janet instead.
2020-11-09 11:18:09 -06:00
Calvin Rose
099a912992
Fix posix regression.
2020-11-08 19:48:44 -06:00
Calvin Rose
56b1ea3726
Include math.h to fix some bugs on 32 bit windows.
2020-11-08 19:06:35 -06:00
Calvin Rose
d6391f2d70
Get windows IOCP working for accept.
...
This also changes the api of servers slightly -
in light of having support for ev tasks, it is probably better
to remove the "simple" server code and replace it with some Janet
or remove it all together. While convenient, it has issues with error
handling and rigidity.
2020-11-08 18:56:13 -06:00
Calvin Rose
07910272e2
Get socket reads and writes working with IOCP.
2020-11-08 10:38:28 -06:00
Calvin Rose
1092013c2b
Merge branch 'master' into ev
2020-11-07 14:36:25 -06:00
Calvin Rose
f55316eabc
Merge pull request #494 from harryvederci/patch-1
...
Fix typo
2020-11-07 14:34:43 -06:00
Calvin Rose
840f59934e
Merge pull request #497 from ahungry/bugfix/Adjust-popen-doc
...
Fix function doc to match that of C POPEN
2020-11-07 14:34:11 -06:00
sogaiu
adfccd33ae
Tweak disasm doc
2020-11-05 13:56:42 +09:00
Matthew Carter
4dffd662f0
Fix function doc to match that of C POPEN
...
It may be misleading to some user to believe it is taking a path to a
file, when it is executing an arbitrary shell command for the first argument.
2020-11-03 20:52:02 -05:00
Calvin Rose
5064d579d4
Add net header instead of ifdef check.
2020-11-03 17:49:09 -06:00
Calvin Rose
540425a41b
Make docstring less confusing - Fix #493 .
2020-11-02 09:09:22 -06:00
Calvin Rose
4d21b582c7
Improve reading and writing from streams.
...
Handle errors earlier, and allow 0 length packets from UDP
but not from TCP. This should more closely follow the exact specs
of send and recv calls.
2020-11-02 09:06:31 -06:00
Calvin Rose
8942e348bd
Small change to windows ev.
2020-11-02 08:27:45 -06:00
Calvin Rose
9f27336827
Update windows ev code.
2020-11-02 08:19:53 -06:00
Calvin Rose
f517cccf7b
Fix unix domain sockets.
...
Also allow abstract unix domain sockets on Linux
(prefixed with '@' as is customary).
2020-11-02 08:16:28 -06:00
Harry Prins
3a937ace51
Fix typo
2020-10-29 08:45:04 +00:00
Yanis Zafirópulos
51828ab5f8
Copy editing :)
2020-10-26 14:46:31 +01:00
Calvin Rose
2891d2b260
Address #489
...
Add gc pressure when resizing fiber stack.
2020-10-18 18:41:18 -05:00
Calvin Rose
edfb861a5f
Disable epoll by default for evloop.
2020-10-11 15:05:27 -05:00
Calvin Rose
88c1cf3ee7
Reformat files.
2020-10-11 09:33:07 -05:00
Calvin Rose
813e3fdcfd
Merge branch 'windows-ev' into ev
2020-10-11 09:32:17 -05:00
Calvin Rose
cb4903fa86
Overhaul of poll loop, redo ev/select.
2020-10-11 09:14:14 -05:00
Calvin Rose
ea45165db8
Merge branch 'master' into ev
2020-10-10 09:04:05 -05:00
Calvin Rose
1fba699ed4
Merge branch 'master' of github.com:janet-lang/janet into master
2020-10-08 12:35:16 -05:00
Calvin Rose
ce3d574c41
Update docstring.
2020-10-08 12:34:08 -05:00
sogaiu
9ec66ab826
Use "module" instead of "namespace" in docstring
2020-10-07 18:18:28 +09:00
Calvin Rose
ebfa07f8ce
Registering an abstract type is idemptotent.
2020-10-06 19:11:29 -05:00
Calvin Rose
964a800d51
More work on windows event loop code.
2020-10-06 19:07:29 -05:00
Calvin Rose
2e944931b3
Update timestamp function to work on windows.
2020-10-04 15:18:31 -05:00
Calvin Rose
db67538311
Work on getting ev support on windows.
2020-10-04 12:46:15 -05:00
Calvin Rose
307c7e00e2
Merge branch 'master' into ev
2020-10-03 11:09:21 -05:00
Calvin Rose
45feb55483
Add integer parsing to pegs.
2020-09-27 12:19:00 -05:00
Calvin Rose
0a1d902f46
Fix #477
...
Make the walk function preserve bracket type, which should fix
threading macro behavior when threading into bracketed expressions.
2020-09-26 13:28:29 -05:00
Calvin Rose
959a577b5f
Merge branch 'master' into ev
2020-09-26 11:50:13 -05:00
Calvin Rose
d1f0a13ddc
janet_try macro and janet_restore function.
...
This allows catching panics without using pcall.
2020-09-19 18:47:47 -05:00
Calvin Rose
c455bdad11
Get ready for 1.12.2 release.
2020-09-19 16:54:56 -05:00
Calvin Rose
603791c0ba
Add more help text to doc macro and default repl.
2020-09-19 16:40:07 -05:00
Calvin Rose
cc0035b1d7
Add help text to repl line.
2020-09-19 16:35:32 -05:00
Calvin Rose
32bf70571a
Fix os/spawn piping on windows and free handles on errors.
2020-09-13 20:49:38 -05:00
Calvin Rose
95f4bd8e23
Merge branch 'master' into ev
2020-09-13 11:24:27 -05:00
Calvin Rose
2cbf4d8ad1
Update documentation for thread/send and thread/receive.
2020-09-13 08:38:37 -05:00
Calvin Rose
524c9b50d4
Add windows implementation for piping.
2020-09-12 19:56:48 -05:00
Calvin Rose
d3147b661b
Add :pipe to os/spawn for piping to subprocess.
...
Similar to Python's subprocess.PIPE, this creates and manages pipes
automatically for the caller.
2020-09-12 19:48:12 -05:00
Calvin Rose
d3182dce51
Merge branch 'master' into ev
2020-09-12 10:02:01 -05:00
Calvin Rose
8763df1cd0
Fix some typos.
2020-09-12 09:38:29 -05:00
Calvin Rose
2bf5e341d3
Update for 1.12.1
2020-09-07 16:10:33 -05:00
Calvin Rose
b53890ddae
Make some changes for WASM build.
2020-09-07 16:08:43 -05:00
Calvin Rose
93602ad9ea
Prepare 1.12.0 Release.
2020-09-07 15:28:46 -05:00
Calvin Rose
191d0001f4
Add header on BSDs.
2020-09-07 15:22:18 -05:00
Calvin Rose
1a04ce33f1
Conditionally include epoll headers.
2020-09-07 13:13:28 -05:00
Calvin Rose
babfe50550
Merge branch 'master' into ev
...
Also add poll implementation for ev.
2020-09-07 12:52:50 -05:00
Calvin Rose
ff57b3eb72
Make zero?, one?, neg? and pos? polymorphic.
2020-09-06 19:05:58 -05:00
Calvin Rose
24b8b0e382
Fix NaNboxing bug that cause flaky builds.
...
The macro janet_checktype(x, JANET_NUMBER) was incorrect when
x was NaN. This caused the initial unmarshalling dictionary to be missing
entries in certain cases.
2020-09-06 14:59:29 -05:00
Calvin Rose
321a758ab9
Change hash implementation for pointers.
2020-09-06 11:41:45 -05:00
Calvin Rose
e8734c77b4
Fix bug by casting to unsigned char.
...
Higher unciode codepoints where being read as negative char values.
We need to cast to unsigned char before comparing to 0x20 to check
for unprintable characters.
2020-09-06 10:47:05 -05:00
Calvin Rose
1eb00a9f74
Remove restriction on bytes being input to getline.
2020-09-06 10:36:38 -05:00
Calvin Rose
922a21d359
Run make format.
2020-09-05 21:26:21 -05:00
Calvin Rose
3c64596ea1
Add %t formatter to janet.
...
Was not present in printf and family.
2020-09-05 20:21:49 -05:00
Calvin Rose
2f89bdc672
Conditional compilation on some c99 syntax in header.
...
If the header is in a C++11 compilation unit, use C++11
aggregate initialization syntax instead.
2020-09-05 09:45:34 -05:00
Calvin Rose
25156eb83e
For #469 - Add support for C++ and mixed C/C++
...
WIP and for native modules. Required a few changes to headers and
some changes to JPM.
2020-09-04 17:41:36 -05:00
Calvin Rose
39032b45c9
Remove extra file.
2020-09-04 14:55:47 -05:00
Calvin Rose
821a8dca3b
Fix os/spawn - os/execute switch.
2020-09-04 14:54:58 -05:00
Calvin Rose
0145b133a1
Add os/spawn instead of os/execute with :a
2020-09-04 08:09:05 -05:00
Calvin Rose
b0b137d7f0
Apply formatting to windows changes.
2020-09-02 19:12:27 -05:00
Calvin Rose
b0c09153c2
Allow IO redirection on windows.
2020-09-02 19:07:45 -05:00
Calvin Rose
0485078c6c
Fix some issues on BSD and Windows.
2020-09-01 21:47:08 -05:00
Calvin Rose
7079cc43c9
Make some improvements and add os/proc-kill as well.
2020-09-01 21:36:49 -05:00
Calvin Rose
e7fca0051e
Add :a option to os/execute, and allow redirecting stdio.
...
This should help cover a number of common cases for
use of subprocesses. This should also eventually work well
with the ev branch via
2020-09-01 20:06:35 -05:00
Calvin Rose
6273e56886
Add janet_getjfile to C API.
2020-08-29 17:36:14 -05:00
Calvin Rose
8b9ad2dce8
Add :x flag to os/execute.
2020-08-29 10:27:32 -05:00
Calvin Rose
5313963baf
Don't run main when flychecking.
2020-08-29 09:05:18 -05:00
Calvin Rose
a31e079f93
Fix import macro to not coerce everything to string.
2020-08-27 08:19:41 -05:00
Calvin Rose
17d0b7a985
Improve import's handling of non constant args.
...
Be much more conservative about which arguments are cast to strings.
2020-08-27 07:40:51 -05:00
Calvin Rose
86e00e865e
Merge branch 'master' into ev
2020-08-23 11:25:04 -05:00
Calvin Rose
5dda83dc73
Add second argument to disasm.
2020-08-22 16:18:10 -05:00
Calvin Rose
28439d822a
Add cancel function.
...
This should allow better stack unwinding on a fiber that
no longer needs to complete.
2020-08-22 15:35:37 -05:00
Calvin Rose
b1d8ee19ca
Enable mutliline paste in shell.c with TCSADRAIN.
...
Replaces TCSAFLUSH.
2020-08-22 11:39:57 -05:00
Calvin Rose
f7c556ed8d
Add curenv to core.
2020-08-22 10:16:14 -05:00
Calvin Rose
5377e10532
Address #466 ?
...
Do not restore pc when returning from top most fiber frame.
Also add JANET_DEBUG config define for various debugging related
configurations. In fiber.c, when debug is enabled we reallocate the
entire stack everytime we push a frame to help uncover use after free
errors.
2020-08-17 07:01:58 -05:00
Calvin Rose
30522bbf7d
Merge branch 'master' into ev
2020-08-16 17:52:36 -05:00
Calvin Rose
58374623b7
Add a vm_commit before JOP_NEXT.
2020-08-13 22:28:50 -05:00
Calvin Rose
7e7498350f
Fix #463
...
Fix outdated code in macex1, such as checking for unquote-splicing,
which no longer exists. Also fix macex1 for quasiquoted tables and
structs. macex1 is not the macro expander used by the compiler, so
these bugs only affected code which called macex manually, such as
the short-fn macro.
2020-08-12 06:10:42 -05:00
Calvin Rose
06c268c274
Start working on throwing errors from async functions.
2020-08-11 08:33:24 -05:00
Calvin Rose
9b36e2b145
Be aggressive with setting SO_NOSIGPIPE on BSD/Apple.
2020-08-10 18:59:53 -05:00
Calvin Rose
ca75f8dc20
Address #463 - prevent sigpipe on client connections.
...
We erroneously did not set SO_NOSIGPIPE on connections aquired with
net/connect, only those quired thorugh net/server. This meant that
failed writes by a client could send sigpipe.
2020-08-10 18:45:44 -05:00
Calvin Rose
6f2f3fdb68
Return an error message if writes fail. Address #462 .
2020-08-10 11:06:31 -05:00
Calvin Rose
c903e49a4f
Change feature flags for BSD.
2020-08-10 10:42:56 -05:00
Calvin Rose
7b42ed66f2
Add xprint, xprin, xprintf, and xprinf.
2020-08-09 09:30:58 -05:00
Calvin Rose
fb26c9b2c4
Add ev/select and ev/rselect initial implementation.
...
Getting closer to a CSP implmententation. Probably
useful to move scheduling fields outside of fibers
and into an external table.
2020-08-09 00:20:27 -05:00
Calvin Rose
78ffb63429
Disallow mutlitple state machines waiting for a single fiber.
...
A 'select' operator will be channel based, not state machine based.
2020-08-08 07:51:46 -05:00
Calvin Rose
1213990b7d
Merge branch 'master' into ev
2020-08-07 19:51:37 -05:00
Calvin Rose
c3af30d520
Fix broken links in README.md
2020-08-07 19:48:06 -05:00
Andrew Chambers
38dc844e85
Add missing JANET_API to janet_cryptorand.
2020-08-07 14:02:26 +12:00
Calvin Rose
9afcec77f6
Disable PRF by default.
2020-08-03 21:52:57 -05:00
Calvin Rose
70ad98cc6f
Fix arc4random_buf implementation.
2020-08-03 21:49:49 -05:00
Calvin Rose
76cfbde933
Add JANET_HASHSEED environment variable.
2020-08-03 20:56:11 -05:00
Andrew Chambers
4d4ca7bb36
Initialize PRF with random data when it is enabled.
2020-08-04 12:13:36 +12:00
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
Calvin Rose
7a84fc4742
Fix infinite loop in some cases.
...
Problem - reusing a tainted variable without reinitializing.
2020-05-16 08:28:50 -05:00
Calvin Rose
cf670153f9
Add :fresh option to import.
2020-05-15 17:19:37 -05:00
Calvin Rose
4ae372262b
1.9.1 release.
2020-05-12 09:19:09 -05:00
Calvin Rose
c947bda604
Remove .breakall and .clearall conditionally.
...
If disasm not available, these functions cannot be implemented.
2020-05-12 08:52:36 -05:00
Calvin Rose
00451777fe
Add meson builds to sourcehut CI.
2020-05-12 08:46:26 -05:00
Calvin Rose
3100080a50
Add NO_UMASK and NO_REALPATH config options.
2020-05-10 23:07:54 -05:00
Calvin Rose
e013381e72
Conditionally ignore pclose as well as popen.
2020-05-10 21:06:52 -05:00
Calvin Rose
d05bb1c125
Fix nanboxing issue.
2020-05-10 20:14:47 -05:00
Calvin Rose
235605bfa4
1.9.0 Release.
...
Fix up some documentation as well.
2020-05-10 16:45:33 -05:00
Calvin Rose
e8b3587946
Silence clang warnings about missing initializers.
2020-05-10 16:00:55 -05:00
Calvin Rose
9040ac6a0c
Silence some warnings about pointer signedness.
2020-05-09 23:58:45 -05:00
Calvin Rose
73dba691b1
Re-disable processes on emscripten build.
2020-05-09 12:04:47 -05:00
Calvin Rose
b1f76139a7
Add several configurable options - #379
2020-05-09 12:00:01 -05:00
Calvin Rose
6b986fecb0
Merge branch 'master' of github.com:janet-lang/janet
2020-05-09 11:07:15 -05:00
Calvin Rose
535ab8302b
Add errorf to core.
2020-05-09 11:06:20 -05:00
Calvin Rose
7125b3430c
Merge pull request #383 from andrewchambers/rngdoc
...
Improve rng doc string accuracy.
2020-05-09 11:35:01 -04:00
Andrew Chambers
057486cf56
Avoid setting O_CLOEXEC on stdin/stdout/stderr.
2020-05-09 22:26:50 +12:00
Andrew Chambers
f94e726271
Improve rng doc string accuracy.
2020-05-09 12:11:08 +12:00
Calvin Rose
95660002e1
fix include sys/fcntl.h to fcntl.h
2020-05-07 14:54:03 -05:00
Calvin Rose
95c669389b
Merge pull request #378 from andrewchambers/tweak
...
Tweak comment, remove extra include.
2020-05-07 10:33:19 -04:00
Calvin Rose
084fc9776d
Use SOCK_CLOEXEC correctly.
2020-05-07 07:55:08 -05:00
Andrew Chambers
1498fdb7b0
Tweak comment, remove extra include.
2020-05-07 20:44:04 +12:00
Calvin Rose
79c3139748
Check for SOCK_CLOEXEC.
...
Not available on all platforms.
2020-05-06 23:44:01 -05:00
Calvin Rose
bdd64f5656
Merge branch 'master' of github.com:janet-lang/janet
2020-05-06 18:52:57 -05:00
Calvin Rose
dc3e9fb77c
Add CLOEXECs when getting file descriptors ( #374 )
...
This should help address leaking file descriptors in multithreaded
programs. There are a few cases where a race can occur though, as
some apis (fopen and mktemp).
2020-05-06 18:33:25 -05:00
Andrew Chambers
06c28f3a4d
Set the CLOEXEC flag on file/temp files.
2020-05-06 11:16:08 +12:00
Calvin Rose
688fe6db5e
Merge pull request #370 from andrewchambers/spawnrace
...
Fix (mostly nonsensible) race condition in multi threaded processes
2020-05-05 10:33:41 -04:00
Calvin Rose
e3862b86b5
Use spork indent on boot.janet.
2020-05-05 09:17:09 -05:00
Calvin Rose
125cd222bb
Pretty print tab characters as \t.
2020-05-05 00:03:12 -05:00
Andrew Chambers
a0f351c9fa
Fix (mostly nonsensible) race condition in multi threaded processes using os/execute with os/setenv.
2020-05-05 16:03:13 +12:00
Calvin Rose
f7b49a2c91
Improve use of @
in match.
2020-05-04 18:28:20 -05:00
Calvin Rose
fd70b47768
Merge branch 'master' of github.com:janet-lang/janet
2020-05-02 23:40:11 -05:00
Calvin Rose
5d1fd390a6
Fix debugger regression.
2020-05-02 23:40:00 -05:00
Calvin Rose
8b5663e385
Merge pull request #363 from uasi/fix-typo-in-doc
...
Fix typo in doc
2020-05-02 12:11:18 -04:00
Calvin Rose
8b5bcaee3c
Add lenprefix combinator to pegs.
...
This lets peg match n repeitions of a pattern, where
n is supplied from other parsed input and is not a constant.
2020-05-02 10:39:35 -05:00
Tomoki Aonuma
ca845aa256
Fix typo in doc
2020-05-02 02:36:55 +09:00
Calvin Rose
761ea65d81
Add fiber/roor and allow net/server to take
...
a numeric port.
2020-04-30 23:21:26 -05:00
Calvin Rose
1dc32d5e3d
Revert inclusion of dedent.
...
Dedent has been moved to spork as misc function.
There are two many different, incompatible ways to 'dedent'
as string, and it seems rather specific to add to the core like it is.
2020-04-30 21:35:22 -05:00
Calvin Rose
1c0a015cc8
s/WSALastError/WSAGetLastError()/g
2020-04-30 13:26:14 -05:00
Calvin Rose
bee415217d
Fix extra bindings.
2020-04-29 21:57:19 -05:00
Calvin Rose
73989f5cc7
Consolidate windows and posix socket code.
...
Also remove code that ignored sigpipe and instead try
our best to ignore through various platform specific mechanisms.
2020-04-29 21:07:21 -05:00
Calvin Rose
dd458c8ab5
Make JANET_NO_ASSEMBLER not break build.
2020-04-28 23:04:24 -05:00
Calvin Rose
63e9790123
Fix flag check in pretty print.
2020-04-28 10:00:24 -05:00
Calvin Rose
70e1f3ac81
Fix regression in repl.
2020-04-28 08:20:07 -05:00
Calvin Rose
67f1872f4a
Expose debugger-env
...
This makes it easier/possible to use the debugging
functionality in a more flexible way.
2020-04-27 23:32:21 -05:00
Calvin Rose
8bbb7907d6
Run parser error handler in the correct env in run-context.
2020-04-27 20:29:16 -05:00
Calvin Rose
c98e1f3cae
Update documentation for net/read and net/chunk.
2020-04-27 19:26:05 -05:00
Calvin Rose
6b0f93ce8a
Update documentation for the -q flag.
2020-04-27 18:57:53 -05:00
Calvin Rose
80f19a0ab7
Fix behavior of -q flag.
...
Don't surpress errors at the repl.
2020-04-27 18:12:22 -05:00
Calvin Rose
41894eb285
Add docstrings to net.c
2020-04-26 14:11:47 -05:00
Calvin Rose
3535efd977
Remove %u format specifiers.
2020-04-26 13:47:36 -05:00
Calvin Rose
f6bd41ada7
Add %M, %m, %N, and %n formatters.
...
These will not truncate long values.
2020-04-26 13:17:28 -05:00
Calvin Rose
7b5f40772f
Disable networking for emscripten build.
2020-04-26 12:37:27 -05:00
Calvin Rose
d2ebf4b52d
Merge branch 'net'
2020-04-26 12:27:37 -05:00
Calvin Rose
ce7d51f9be
Add dedent to core.
...
Makes longstrings easier to use - can be combined with comptime
for overhead free long strings.
2020-04-26 11:53:26 -05:00
Calvin Rose
da4d8254fa
Silence warning in MSVC about VLAs.
...
When janet.h is included as a C++ header in
MSVC, shows warnings.
2020-04-25 17:13:25 -04:00
Calvin Rose
57332c5ccf
Change order of declarations for MSVC C++ support.
2020-04-25 15:42:44 -05:00
Calvin Rose
9bc5ac05c4
Add the parse function.
2020-04-25 12:46:32 -04:00
Calvin Rose
84974d6c56
Make repl printing work from current environment.
...
Although this "unprotects" output in the repl, people
in a repl usually want control, not protection.
2020-04-24 22:29:02 -05:00
Calvin Rose
da438a93e0
Restore lexicographic comparison of tuples.
2020-04-24 16:51:04 -05:00
Calvin Rose
a87015598c
Make janet_equals and janet_compare non recursive
...
This makes these operatios use constant stack space rather
than linear stackspace given the size of the inputs. This is important
to prevent certain parser input from causing a stack overflow - in
general, we try to avoid unbounded recursion.
2020-04-24 16:18:31 -05:00
Calvin Rose
c335bf5dc5
Update doc doc.
2020-04-23 12:15:12 -05:00
Calvin Rose
c876e63010
Fix overflow in exponent estimation in strtod.c.
...
Found by OSS-Fuzz.
2020-04-21 18:32:59 -05:00
sogaiu
5c162ce588
Add flags to fiber/new error message
2020-04-21 13:47:56 +01:00
Calvin Rose
ea46f096c2
Remove placeholder config variables.
2020-04-20 20:10:24 -05:00
Calvin Rose
9b5c6112e5
The -q option no longer disables repl output.
2020-04-20 19:28:30 -05:00
Calvin Rose
d8617514f8
Add jpm rule-tree.
...
Useful for debugging jpm project.janet files.
This tree printing logic can also be reused for
showing dependency information in the future.
2020-04-20 18:32:25 -05:00
Calvin Rose
e579d1d89f
Add jpm rule-tree.
...
Useful for debugging jpm. This funtionality also maybe reused for
for showing a dependency tree as well.
2020-04-20 18:31:14 -05:00
Calvin Rose
42c257d0fc
Merge branch 'master' into net
2020-04-19 13:38:51 -05:00
Calvin Rose
d5e5c98dc8
Merge branch 'net' of github.com:janet-lang/janet into net
2020-04-19 13:37:54 -05:00
Calvin Rose
5054eb4276
Add JANET_MARSH_UNSAFE flag.
...
This allows unmarshal to optional marshal raw
pointers and cfunctions and send them across threads.
This flag is only exposed in the C API as it is very easy
to misuse and cause segfaults.
2020-04-19 10:56:39 -05:00
Calvin Rose
122c77dbf6
Merge pull request #353 from andrewchambers/require
...
Fix outdated require docstring.
2020-04-19 10:44:37 -04:00
Calvin Rose
3c66cab4e7
Remove extra binding in require.
2020-04-19 09:44:02 -05:00
Calvin Rose
738fd479b3
Merge branch 'master' of github.com:janet-lang/janet
2020-04-19 09:41:49 -05:00
Calvin Rose
5c612095a1
Address #352 , #351 , Use :source argument in dofile
...
Also re-add circular dependency detection.
2020-04-19 09:38:18 -05:00
Calvin Rose
3e60e82529
Add circular dependency detection.
...
This detection will not stop compilation, as errors
in general do not stop compilation unless exit on error
is passed inside an import, but should notify the user something
is going on.
2020-04-19 09:35:14 -05:00
Calvin Rose
60f8dd0bfc
Renable :source argument to dofile.
...
Allows for some more interesting usage of
loaders.
2020-04-19 08:54:24 -05:00
Andrew Chambers
2a7008a82c
Fix outdated require docstring.
2020-04-19 23:02:35 +12:00
Calvin Rose
0d3c6abee8
POLLER -> POLLERR
2020-04-18 19:15:59 -04:00
Calvin Rose
4a693222b4
Port net code to windows.
...
Use winsock2 and WSAPoll. Not the most high performance
solution but should work well.
2020-04-18 19:14:38 -04:00
Calvin Rose
0745c15d7b
Fix return value from shell.c
2020-04-18 15:31:46 -05:00
Calvin Rose
2904c19ed9
Switch to poll from select.
...
Simpler and more flexible interface, and also lets
us use epoll more easily on linux, which is the most important
plantform to optimize for network performance.
2020-04-18 15:22:20 -05:00
sogaiu
aebb8010d4
Tweak unknown signal handling
2020-04-18 08:26:16 +01:00
Calvin Rose
4ac382e553
Add alias JANET_SIGNAL_EVENT.
2020-04-17 16:27:02 -05:00
Calvin Rose
596111c988
Merge branch 'master' into net
2020-04-17 15:08:26 -05:00
Calvin Rose
fbe903b277
Add janet_cfuns_prefix to janet.h
...
Makes adding functions to the current environment easier.
2020-04-17 13:37:52 -05:00
Calvin Rose
8a89e50c13
:octal-permissions -> :int-permissions ( #347 )
2020-04-16 19:05:00 -05:00
Calvin Rose
a147ea3e80
Use JANET_PRETTY_DICT_LIMIT.
2020-04-16 19:01:49 -05:00
Calvin Rose
67fb2c212f
Address #348
...
Remove extreneous data from lockfile.
2020-04-16 18:44:21 -05:00
Calvin Rose
3765b08cca
Merge branch 'master' of github.com:janet-lang/janet
2020-04-16 12:11:59 -05:00
Calvin Rose
3eb84fcb13
Fix some typos, make jpm repl work without a project.janet.
2020-04-16 12:11:17 -05:00
Calvin Rose
bea76e8e08
Merge pull request #345 from sogaiu/checks-after-allocs
...
Check some *alloc return values
2020-04-15 19:45:39 -05:00
Calvin Rose
f5433dcaa4
Fix core getline that doesn't use replacement.
2020-04-15 19:45:17 -05:00
Calvin Rose
ef3b953a42
Fix docstrings.
2020-04-14 21:32:50 -05:00
Calvin Rose
605a205008
Range errors for slice
-likes include negatives.
...
Makes for less confusing errors when calling something
like `(slice [] 0 -10)`.
2020-04-14 21:27:48 -05:00
Calvin Rose
71882475d6
janet_formatb -> janet_formatbv, new janet_formatb
...
The old function was not very useable. In the likely
case that there is no external code using this
(not well documented/janet_formatc is more convenient), we
can change this.
2020-04-14 07:38:41 -05:00
sogaiu
a3d29a15df
Check some *alloc return values
2020-04-14 10:22:45 +01:00
Calvin Rose
a09112404d
Add better error message on unexpected eos.
...
Show innermost open delimiter
2020-04-13 23:18:27 -05:00
Calvin Rose
93fc11ea21
Add edefer.
...
Also improve error messages from vm internal errors.
(Show bad value, not its type).
2020-04-13 20:24:11 -05:00
Calvin Rose
6c4ed0409d
Add emscripten check to features.h.
2020-04-12 14:13:55 -05:00
Calvin Rose
ea2811f14f
Merge branch 'master' of github.com:janet-lang/janet
2020-04-11 13:42:34 -05:00
Calvin Rose
8bc2987a71
(struct ...) with duped keys will use last value.
2020-04-11 13:42:25 -05:00
Calvin Rose
1d13095d19
Merge pull request #340 from pepe/get-vs-in-last
...
Fix last for empty collection, add tests
2020-04-10 19:03:21 -05:00
Calvin Rose
5ed76f197a
Differentiate error from resume and error from resumed fiber.
2020-04-10 18:29:10 -05:00
Calvin Rose
e1f4cadf41
Add debugger to the core repl.
...
Debugger functions are prefixed by periods.
2020-04-10 17:20:23 -05:00
Calvin Rose
3b0e6357ad
Make Ctrl-G in repl show docstring for symbol.
...
Can be used to browse docs without poluting your repl session.
2020-04-10 11:36:23 -05:00
Calvin Rose
02f17bd4e4
Add sort-by and sorted-by.
2020-04-09 20:43:51 -05:00
Josef Pospíšil
b63a0796fd
Fix last for empty collection, add tests
2020-04-09 14:35:57 +02:00
Calvin Rose
b75a22b753
Make JANET_FRAME_SIZE consistent across architectures.
...
This means unmarshalling fibers should work across arches.
2020-04-06 12:41:56 -05:00
Calvin Rose
72beeeeaaa
Move funcenv verification to runtime.
...
Lazy verification makes it easier to not leave funcenvs
in an invalid state, as well as be more precise with the validation.
We needed to verify the FuncEnvs actually pointed to a stack frame if
they were of the "on-stack" variant. There was some minor checking
before, but it was not enough to prevent func envs from pointing to
memory that was off of the fiber stack, overlapping stack frames, etc.
2020-04-06 10:58:47 -05:00
Calvin Rose
c3c42ef56f
Fix case for #336 .
...
Also consider ascii 127 (delete) non-printable for string escapes.
2020-04-06 00:11:22 -05:00
Calvin Rose
a3c55681b2
Address #336 case 6
2020-04-05 21:39:39 -05:00
Calvin Rose
fcc610f539
Address #336 case 4
...
Set funcenv fields to NULL before any possible panics.
2020-04-05 19:18:59 -05:00
Calvin Rose
5bbd507858
Address #336 case 3
...
Fix error condition for bad abstract types - don't return NULL, panic.
2020-04-05 17:38:14 -05:00
Calvin Rose
c4ca0490ee
Prevent unmarsal DOS in arrays,buffers,tables,and structs.
2020-04-05 08:16:40 -05:00
Calvin Rose
b145d47863
Address cases 1 and 2 of #336 .
...
Mainly related to not checking ints < 0.
2020-04-05 08:01:18 -05:00
Calvin Rose
87ecdb8112
Change \UXXXXXXXX -> \UXXXXXX and check codepoint max.
...
No need to add two extra leading zeros, as the max unicode
codepoint is 0x10FFFF.
2020-04-05 07:09:53 -05:00
Calvin Rose
810ef7401c
Update changelog and bump version to dev version.
2020-04-04 21:50:27 -05:00
Calvin Rose
ae70a03383
Address #306 - Add unicode escapes.
...
Unicode escapes have the same syntax as go - \uXXXX or \UXXXXXXXX.
2020-04-04 21:46:08 -05:00
Calvin Rose
081d132538
Address #321
...
Also improve docs for dofile and related functions.
2020-04-04 21:17:15 -05:00
Calvin Rose
5b82b9e101
Address compiler warning on macos.
2020-04-04 13:34:16 -05:00
Calvin Rose
f089b2001f
Add several math functions to the math module.
2020-04-04 12:52:34 -05:00
Calvin Rose
8275da63fb
Address #331 - Add :octal-permissions
2020-04-03 18:29:45 -05:00
Calvin Rose
1aeb317863
Revise, revise, revise, and proofread.
2020-04-03 17:04:05 -05:00
Calvin Rose
b49b510732
Update os/link docstring.
2020-04-03 16:58:45 -05:00
Calvin Rose
a0d61e45d5
Change os/perm-str to os/perm-string.
2020-04-03 15:23:29 -05:00
Calvin Rose
95f1ef7561
Add umask support for windows, and allow parsing mode strings.
2020-04-03 15:14:11 -05:00
Calvin Rose
edb2fab64c
Merge branch 'master' of github.com:janet-lang/janet
2020-04-03 15:04:39 -05:00
Calvin Rose
464fb73d83
Add os/perm-int and os/perm-str.
...
This helps address #331 . While we could also
make os/stat return an integer, we don't do that yet
for api breakage reasons.
This also lets us use this logic on other functions
that take permission strings.
2020-04-03 15:02:12 -05:00
Calvin Rose
6a4e63a17d
Merge pull request #333 from andrewchambers/umask
...
Add os/umask.
2020-04-03 14:48:52 -05:00
Andrew Chambers
3c2b1baff2
Add os/umask.
2020-04-02 23:33:50 +13:00
Calvin Rose
789ef3608b
Make format.
2020-04-01 08:54:01 -05:00
DEADB17
57b08a57a0
Corret typo and match wording for consistency
2020-03-31 23:32:17 -04:00
Calvin Rose
5b6b9f1597
Prepare for 1.8.1 release.
2020-03-31 09:49:09 -05:00
Josef Pospíšil
b6b70d54ef
Fix typo flie
2020-03-31 15:31:27 +02:00
Calvin Rose
244566ccd4
Remove manual feature definitions in boot.
...
Instead, reuse features as defined in features.h
2020-03-31 07:52:20 -05:00
Calvin Rose
e4ea8bc867
Fix features for bsd.
...
Don't define XOPEN_SOURCE unless we actually need it.
2020-03-30 15:38:03 -05:00
q66
5d840b944b
Fix wrong check on big endian systems
...
We can't randomly type pun random-sized types on big endian
systems.
2020-03-30 13:38:49 -05:00
q66
1e28876494
Fix typo in big endian unmarshalling code
...
This was subtly breaking everything.
2020-03-30 13:38:49 -05:00
q66
a40b2767c5
Fix endian check for little endian PowerPC and maybe others
...
This fixes various subtle breakage on ppc64le at very least.
2020-03-30 13:38:49 -05:00
Calvin Rose
279b536646
Prepare for 1.8.0 release.
2020-03-29 14:18:28 -05:00
Calvin Rose
ff163a5ae4
Use modulo instead of remainder for even?/odd?.
...
Works better for negative and fractional numbers.
2020-03-28 10:23:28 -05:00
Calvin Rose
65379741f7
Address edge case of reduce2 when ind is empty.
...
Same for accumulate 2.
2020-03-27 12:45:40 -05:00
Calvin Rose
3eb0927a2b
Add accumulate(2) and reduce2
...
These functions are variations on reduce and can be quite useful.
Improve error message for jpm as well.
2020-03-26 21:35:11 -05:00
Calvin Rose
655633ef34
Tweak docstring.
2020-03-25 18:00:15 -05:00
Calvin Rose
3d1de237f6
Several changes to the os module.
...
- Add os/symlink
- Add os/realpath
2020-03-24 19:47:21 -05:00
Calvin Rose
6a63b13d69
Fix os/link docstring - Address #323
2020-03-21 16:18:58 -05:00
Calvin Rose
3aca5502dc
Allow :dst to be nil to set tm_isdst to be -1.
2020-03-18 22:23:27 -05:00
Calvin Rose
665f4bf248
Remove windows MSVC warnings about _stat.
2020-03-18 21:37:55 -05:00
Calvin Rose
b76ff3bdfc
Fix omission of daylight savings time in mktime
...
Since with daylight savings times, certain times
are ambiguous (the hours before and after the switch), mktime
needs to allow reading a dst flag.
2020-03-18 21:23:35 -05:00
Calvin Rose
00450cd9db
try and remove warnings on windows, format os.c.
2020-03-18 21:15:50 -05:00
Calvin Rose
c344a543b0
Merge pull request #318 from leahneukirchen/mktime
...
os/date fixes and os/mktime
2020-03-18 20:59:08 -05:00
Calvin Rose
eee8338064
Merge pull request #319 from leahneukirchen/lstat
...
os/lstat and os/readlink
2020-03-18 17:58:32 -05:00
Calvin Rose
3b5183a74e
Fixes #316 : os/execute should return non-zero on signals
...
Behave more like shells, and catch segfaults.
2020-03-18 17:49:20 -05:00
Leah Neukirchen
3ee43c3abb
add os/mktime, an inverse to os/date.
2020-03-18 23:45:02 +01:00
Leah Neukirchen
efdb13f0c7
os/date: allow negative timestamps.
...
Why not? Even on 32-bit time_t systems this lasts until late 1901.
2020-03-18 23:45:02 +01:00
Leah Neukirchen
f013c6e48d
os/date: check the second argument truthy, not the third.
2020-03-18 23:45:02 +01:00
Leah Neukirchen
6e67899401
Add os/readlink.
2020-03-18 20:05:48 +01:00
Leah Neukirchen
381dd1ce98
Add os/lstat.
2020-03-18 20:05:48 +01:00
Calvin Rose
b0d8369534
Increase reference accuracy of on-stack close envs.
...
Using a bitset to indicate which stack values are upvalues, we
can more accurately track when a reference to a stack value
persists after the stack frame exits.
2020-03-18 09:30:10 -05:00
Calvin Rose
de4f8f9aaf
Marshal alive fibers in func envs as detached.
...
This will help with marshaling fibers.
2020-03-17 20:53:11 -05:00
Calvin Rose
6554cc4a8d
Merge branch 'master' of github.com:janet-lang/janet
2020-03-17 18:58:33 -05:00
Calvin Rose
fac47e8ecb
When marshalling a closure, try to detach funcenvs
...
If possible, this will reduce the need to marshal fibers
in many cases. Also add this logic to the GC so holding a closure
that originally came from a fiber that crashed does not cause that fiber
to hang around forever.
2020-03-17 18:55:32 -05:00
Andrew Chambers
635ae3a523
Properly export u64_type
2020-03-17 11:02:57 +13:00
Calvin Rose
4a05b4556e
Fix MSVC build warning.
2020-03-14 12:02:31 -05:00
Calvin Rose
c074615550
Revert to 9 char permission strings on windows.
2020-03-14 12:00:11 -05:00
Calvin Rose
bac2b74b3d
Add os/chmod.
2020-03-14 11:57:04 -05:00
Calvin Rose
a3aaa6634d
Use separate registry table for abstract types.
...
This avoids overloading the registry table, which is intended
for names of c functions.
2020-03-14 10:25:39 -05:00
Calvin Rose
6a3a983f43
Expose abstract type definitions in janet.h
...
This makes certain operations easier, and allows
more access to built in APIs.
2020-03-14 10:12:47 -05:00
Calvin Rose
0600b32908
Fix docstring for os/cd - Fixes #307
2020-03-13 15:01:48 -05:00
Calvin Rose
77343e02e9
Fixes #304
...
Add chr macro.
2020-03-10 22:46:50 -05:00
Calvin Rose
a3d4ecddba
Address #301
...
Incorrect bounds checking and offset calculation in buffer/blit.
2020-03-08 20:44:03 -05:00
Calvin Rose
65403ec9fe
Merge branch 'master' into net
2020-03-07 14:06:51 -06:00
Calvin Rose
3d3d314fb7
Remove warning about math.h on aarch64 ubuntu gcc.
2020-03-07 14:05:28 -06:00
Calvin Rose
90b3730a0a
Merge branch 'master' into net
2020-03-07 13:34:13 -06:00
Calvin Rose
3f3b756b61
Merge pull request #298 from leahneukirchen/m-del
...
Make alt-backspace behave like ctrl-w.
2020-03-07 10:14:14 -06:00
Calvin Rose
d3b9b8d452
For #293 , correct wildcards in dictinoaries.
2020-03-07 10:13:10 -06:00
Calvin Rose
c864828735
Address #293 - wildcard to match macro.
...
The _ symbol will match any value without creating a binding.
2020-03-07 09:40:02 -06:00
Calvin Rose
e0c9910d85
Add :range-to and :down-to to loop.
...
Fully inclusive ranges are generally useful and
do not complicate implementation much.
2020-03-07 09:34:11 -06:00
Calvin Rose
e351dde651
Update CHANGELOG.md and docs for loop and pp.
2020-03-06 17:12:06 -06:00
Calvin Rose
714bd61d56
Address #300
...
Check for empty capture stack in replace rule.
2020-03-06 10:05:20 -06:00
Calvin Rose
6123c41f13
Harden semantics for and and or macros.
...
There was perviously a bit of fuzziness on returning false/nil
from these macros that has been removed.
2020-03-06 08:37:59 -06:00
Leah Neukirchen
1aaa5618de
Make alt-backspace behave like ctrl-w.
...
Another common binding in readline and its clones.
2020-03-06 10:55:45 +01:00
Calvin Rose
16202216b2
Address #291
...
When resuming a fiber with a child, the root fiber was set incorrectly.
2020-03-05 19:18:45 -06:00
Calvin Rose
8f1527712e
Merge branch 'master' into net
2020-03-05 18:08:35 -06:00
Calvin Rose
fbe8998ca8
Merge branch 'master' of github.com:janet-lang/janet
2020-03-05 09:35:04 -06:00
Calvin Rose
47e8f669f5
Fix match behavior for lone nil.
2020-03-05 09:35:00 -06:00
Leah Neukirchen
bc2ebce086
Make ctrl-d behave like delete, but exit on an empty line.
...
This is the default readline behavior.
2020-03-04 14:56:04 +01:00
Calvin Rose
6bc67b70a6
Address #294
...
Correct invalid format string, which masked a panic
with another, less useful panic.
2020-03-03 22:26:26 -06:00
Calvin Rose
2349ea9405
Update docs for buffer/push-word
...
Should be little endian, not big endian.
2020-03-01 12:05:24 -06:00
Calvin Rose
b17bf259f7
Fix typo: destory -> destroy
2020-02-28 09:04:28 -06:00
Calvin Rose
6b093bdcca
Address #288 and partially #287
...
The %q formatter for janet_formatc now expects a Janet, not a JanetString or
JanetSymbol or JanetKeyword.
Also fix some reference counting issues with threads when destroying
threads, which should fix #287 's
SIGSEGV. Still fails to send messages sometimes, though.
2020-02-27 17:58:17 -06:00
Calvin Rose
10ec319c32
Add better debug info to amalgamated source.
2020-02-27 00:16:54 -06:00
Calvin Rose
8262290bff
Improve C string format (janet_formatc, janet_panicf)
...
The supported formatters here now match up more with
the string/format, buffer/format, printf, eprintf, etc.
2020-02-25 20:05:45 -06:00
Calvin Rose
734c85d7ef
Properly handle recursion with labels.
...
Use an empty buffer, which has pointer equality semantics, for
tag from a label.
2020-02-23 17:35:01 -06:00
Calvin Rose
05bd5767de
Add label macro.
...
A lexically scoped version of prompt is often useful.
2020-02-23 17:15:04 -06:00
Calvin Rose
59d288c429
Add prompt
and return
.
...
User friendly delimited continuations. While this was doable with
signals before, this does not require C and will play nicely with
existing error handling, defers, and with statements.
2020-02-23 16:46:54 -06:00
Calvin Rose
8c41c0b6a7
Address MSVC warning.
2020-02-23 15:27:57 -06:00
Calvin Rose
738490e674
Allow function that takes 1 argument to fiber/new.
...
This allows reuse of closures when creating many fibers.
2020-02-23 14:47:29 -06:00
Calvin Rose
6a13703e32
Add signal
and fiber/can-resume?
.
...
These additions, along with the change that user signals 0-4 cannot
be resumed, allow delimited continuation semantics, while repsecting
existing forms like `defer`, `with`, `with-vars`, etc.
2020-02-23 13:31:27 -06:00
Calvin Rose
aaabca6fc7
Make flychecker handle more kinds of defs.
...
This should help when redefining certain forms. Will also
not do functional arity checking against nil forms, as that
is the default value when a def doesn't evaluate.
2020-02-21 21:20:40 -06:00
Calvin Rose
4b440618d6
Correct docs for type form.
2020-02-21 20:22:43 -06:00
Calvin Rose
01a79dc965
Remove extra functionality.
2020-02-20 20:10:03 -06:00
Calvin Rose
0df220780a
Fix issues with #282
...
Bad handling of write errors, as well as janet_root_fiber().
2020-02-20 19:54:31 -06:00
Calvin Rose
a360cb7922
Update marshal to take 3 arguments.
2020-02-15 10:04:44 -06:00
Calvin Rose
b9a2bb8104
Fix documentation for defer.
2020-02-12 09:34:23 -06:00
Calvin Rose
f4a46ba6ea
Add methods to streams.
...
This makes streams polymorphic with files in many cases.
printf family functions still need porting.
2020-02-12 09:32:41 -06:00
Calvin Rose
79bb9e54d5
Remove direct references to file descriptors.
...
If a descriptor is freed by the Janet code, other
uses of that descriptor, say in the event loop, need
to know that it has been closed.
2020-02-11 08:57:44 -06:00
Calvin Rose
8ae6ae65a1
Merge branch 'master' into net
2020-02-09 20:00:58 -06:00
Calvin Rose
f4d7fd97f6
Working TCP echo server and client.
...
Required a few changes to APIs, namely janet_root_fiber()
to get topmost fiber that is active in the current scheduler.
This is distinct from janet_current_fiber(), which gets the bottom
most fiber in the fiber stack - it might have a parent, and so cannot
be reliably resumed.
This is the kind of situation that makes symmetric coroutines more
attractive.
2020-02-09 20:00:50 -06:00
Calvin Rose
031a9894b0
Update inlining options for next
and resume
.
2020-02-08 13:03:03 -06:00
Calvin Rose
fcc09d7ea9
Clarify docs for some
and all
.
2020-02-05 21:06:39 -06:00
Calvin Rose
7f1f684b21
Merge branch 'master' into net
2020-02-03 20:46:32 -06:00
Calvin Rose
d8d482e433
Merge branch 'master' of github.com:janet-lang/janet
2020-02-03 18:18:29 -06:00
Calvin Rose
3fdc053d6c
Add flush and eflush ( #278 )
...
These functions interact with Janet's dynamically scoped
IO functions in a manner that is more useful the file/flush.
We can still redirect to a buffer without changing our code.
2020-02-03 18:14:32 -06:00
Calvin Rose
eda61455d3
Work on tcp server code.
2020-02-03 09:29:51 -06:00
Josef Pospíšil
00107c092c
Fix next function arity
2020-02-03 15:36:42 +01:00
Calvin Rose
c5907258c3
Merge branch 'master' into net
2020-02-02 13:16:47 -06:00
Calvin Rose
64e1961193
Update version strings to 1.7.1-dev.
2020-02-02 09:38:44 -06:00
Calvin Rose
f7ee8bd30d
Update to version 1.7.0.
2020-02-01 23:35:17 -06:00
Calvin Rose
c0d2140d14
Begin net/ module in core.
...
Humble beginnings.
2020-02-01 20:39:54 -06:00
Calvin Rose
1bdde9c4f7
Fix warnings.
2020-01-28 23:46:14 -06:00
Calvin Rose
333ae7c4f8
Make amalgamtion the default when building.
...
This way we can support fewer build configurations. Also, remove
all undefined behavior due to use of memcpy with NULL pointers. GCC
was exploiting this to remove NULL checks in some builds.
2020-01-28 23:38:52 -06:00
Calvin Rose
f7b7c83264
Address #276
2020-01-25 12:08:43 -06:00
Calvin Rose
6f9c9879ca
Add var-
...
We had defn-, def-, defmacro-, but no var-.
2020-01-24 22:52:28 -06:00
Calvin Rose
b8df47e063
Fix regression in take/drop.
2020-01-24 17:39:25 -06:00
Calvin Rose
9dad8bf56d
Remove min-order and max-order.
...
Also address #275 by exposing lflags and cflags
to declare-executable
2020-01-24 17:35:21 -06:00
Calvin Rose
689f2dcbb4
Change default import prefix.
...
Changed from `(string path "/")` to
`(string (last (string/split "/" path)) "/)`.
2020-01-24 16:54:06 -06:00
Calvin Rose
163e2a5b22
Add string support to %j format.
2020-01-24 08:52:27 -06:00
Calvin Rose
e36334e14b
Revert issue with removing buffer self print check.
2020-01-23 23:39:49 -06:00
Calvin Rose
28d41039b8
Add mod function to core.
...
The `mod` function is a pair function with `%`, or te remainder
function and is distinct from it. This is taken from common lisp.
2020-01-23 18:54:30 -06:00
Calvin Rose
b8d530da36
Remove file/fileno and file/fdopen.
...
Also fully add call function pointer to
abstract types, including in methods, etc.
2020-01-23 09:01:33 -06:00
Calvin Rose
4fad0714e7
Add janet_gcpressure. Address #269 .
2020-01-22 20:52:35 -06:00
Calvin Rose
ca17eb4a2b
Address #273
2020-01-22 19:01:49 -06:00
Calvin Rose
4fe005e3c3
Add righthand operator overloading.
...
This is like python. Now, we just need to readd fuzzy
comparisons to have what python needs. Overloading
math functions would be neat, too.
2020-01-22 18:59:41 -06:00
Calvin Rose
2f9ed8a572
Use memmove instead of copying.
...
Also some comment things, and re-add old code from linenoise.
It seems to have a purpose for some keyboard layouts, so I will leave
it.
2020-01-21 23:11:00 -06:00
Calvin Rose
688e18a891
Merge pull request #268 from crocket/master
...
Make REPL key bindings more similar to those on GNU readline.
2020-01-21 23:09:45 -06:00
crocket
8162c64ca3
Make REPL key bindings more similar to those on GNU readline.
...
* I deleted Alt-H and Alt-L because Ctrl-F and Ctrl-B serve the same
roles.
* Ctrl-W, Alt-D, Alt-F, and Alt-B behave more similarly to the same
key bindings on GNU readline.
* Improved documentation of REPL keybindings on man page.
* Home and End keys now work on more terminal environments.
* Removed bindings for `Esc OH` and `Esc OF` because andrewchambers
doesn't need those bindings and the bindings don't seem to make much
sense for Home and End. `Esc O` is Single Shift Select of G3 Character
Set in xterm. https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
2020-01-22 13:55:44 +09:00
Calvin Rose
e179f26d50
Add call function pointer to abstract types.
...
This will allow better JITs, FFIs, DSLs, etc.
2020-01-21 18:22:24 -06:00
Calvin Rose
8db68c04c4
Merge branch 'master' of github.com:janet-lang/janet
2020-01-21 17:48:54 -06:00
Calvin Rose
7c92c64730
Remove mutable operators on inttypes.
...
Mutations break hash table invariants, are a rather
silly performance optimization for a language like Janet.
2020-01-21 17:47:34 -06:00
Andrew Chambers
46f57f5c38
Make file/close idempotent.
...
It is easier to use constructs like defer
with complex control flow if it is safe to close
a file twice.
2020-01-21 22:03:57 +13:00
Calvin Rose
1ec2e08f21
Add manpage docs for repl keybindings.
2020-01-20 17:29:29 -06:00
Calvin Rose
77742dec11
Add source file info on macro compiler error.
2020-01-20 16:45:57 -06:00
Calvin Rose
3cb947b37e
Fix macro errors.
...
debug/stacktrace was being called incorrectly.
2020-01-20 16:05:08 -06:00
Calvin Rose
2dd852da54
Use ATEND macros to add fields to abstract types.
...
This means we can add new properties to abstract types without
breaking old code. We can also make simple abstract types without
needing to add many NULL fields to the type.
2020-01-20 13:06:50 -06:00
Calvin Rose
f4ad627b54
Fix regression in while loops inside each macros.
...
There was a specialization for `(while (not= nil _) ...)` that
was incorrect when the while loop regresses to a thunk.
2020-01-19 16:25:10 -06:00
Calvin Rose
68a5667a1a
Add history first and history last shortcuts.
...
Alt-, and Alt-.
2020-01-19 15:45:04 -06:00
Calvin Rose
693c6d63d4
Add alt-d binding to repl.
2020-01-19 11:39:10 -06:00
Calvin Rose
f18c3323ea
Clear completion list if fully complete.
2020-01-19 11:31:42 -06:00
Calvin Rose
f74e19e673
Improve alt keys and at alt-f and alt-b to repl
2020-01-19 11:16:41 -06:00
Calvin Rose
da70807292
Make autocompletion more zsh like
...
Also add a few ctrl sequences from readline, and
ignore unknown ctrl sequences.
Address #264
Adds Ctrl-n, Ctrl-p, and Ctrl-w
Ignores unknown ctrl sequences
No alt-* sequences yet.
2020-01-19 10:38:35 -06:00
Calvin Rose
64b9482602
Make history not duplicate itself in getline.
2020-01-18 20:56:35 -06:00
Calvin Rose
064475cb8d
Add eachk and eachp.
...
These should make iterating over datastructures easier
without needing the loop macro.
2020-01-18 18:46:49 -06:00
Calvin Rose
f4077b678a
Allow calling next on abstracts.
...
This will allow the creation of infinte
streams, low cost generators, etc.
2020-01-18 18:09:20 -06:00
Calvin Rose
51678c1aba
Extend power of the each form
...
This changes the implementation of the `next` function which
is now used to implement each. This let's us iterate over
more types, not just tables and structs.
2020-01-18 17:55:07 -06:00
Calvin Rose
65d7c3eed1
Use stderr for getline output instead of stdout.
2020-01-18 14:34:29 -06:00
Calvin Rose
41bb8c543b
Merge branch 'master' of github.com:janet-lang/janet
2020-01-18 09:46:37 -06:00
Calvin Rose
bbd7355313
Merge pull request #259 from andrewchambers/futureproofhash
...
Make hash api more future proof.
2020-01-18 09:45:47 -06:00
Calvin Rose
772916593b
Address #262
...
Pressing tab only does one thing at a time.
2020-01-18 09:44:59 -06:00
Calvin Rose
9d8af7355f
Improve getline.
2020-01-18 00:30:46 -06:00
Calvin Rose
521a29446f
Don't rely on obscure printf features.
...
They may not work on all platforms.
2020-01-18 00:27:40 -06:00
Calvin Rose
a8e4c4bed0
Add special forms and sort completions.
...
Also fix case when no completion is needed.
2020-01-18 00:17:08 -06:00
Calvin Rose
6471b4d100
Add preliminary repl completion via tab.
2020-01-17 23:03:50 -06:00
Calvin Rose
7f9b2b34d1
Clarify import docs for dynamic bindings.
2020-01-17 18:06:00 -06:00
Calvin Rose
789c5f135a
Add ctrl-a and ctrl-e to control line in repl
...
Emacs to start of line and to end of line key bindings.
2020-01-17 09:33:30 -06:00
Andrew Chambers
344f0b743d
Make hash api more future proof.
2020-01-17 17:25:40 +13:00
Calvin Rose
23c7c3bf1c
Allow disabling keyed hash function (prf) in conf
...
In some cases, one might want to disable what is currently
SipHash for speed / better security mechansims. For example, using
red black trees for caches rather than hash tables.
2020-01-16 21:06:03 -06:00
Calvin Rose
3d117804dd
Merge branch 'master' into HEAD
2020-01-16 20:08:34 -06:00
Calvin Rose
77bb0ebe3f
Add limits to format to discourage huge prints.
...
This should make system crashing prints happen less often in repl.
Instead, display a ...
2020-01-16 18:57:01 -06:00
Calvin Rose
6d9e51e4be
Fix documentation for if-with.
...
It was the same as when-with.
2020-01-16 18:12:05 -06:00
Calvin Rose
174ff87946
Change printing of abstracts with tostring in pp
...
This change makes pretty printing not hide "abstractness".
2020-01-16 18:10:17 -06:00
Andrew Chambers
ea02b2fde9
Use siphash for string hashing.
...
The hash key still needs to randomly initialized
for the security advantage, but this patch is a
step closer to avoiding hash based DOS.
Further work may including exposing the raw hash
function for use by abstract types who also choose to
implement hash.
2020-01-17 12:06:55 +13:00
Calvin Rose
962cd7e5f5
Add when-with and if-with
...
This is useful for reading from files.
2020-01-15 22:56:40 -06:00
Calvin Rose
65be9ae095
Add defer and assert to the core.
2020-01-15 22:39:14 -06:00
Calvin Rose
bc2bac8cd3
Fix memory issue in allocating decode buffer.
...
Since the decode table is currently a single table
per thread, we just make it a thread local to avoid
issues.
2020-01-15 19:58:14 -06:00
Calvin Rose
b567ece401
Address #252
...
Add repeat form (instead of exactly).
2020-01-14 19:58:03 -06:00
Calvin Rose
04579664fd
update parse.c
2020-01-12 22:43:39 -06:00
Calvin Rose
f709d7eb40
Add module/add-paths
...
This should make it much easier to make custom DSLs work
well with the import system. No need to mess about with import paths,
things will just work.
2020-01-12 20:59:45 -06:00
Calvin Rose
2df8660f8b
Avoid buffer overrun
...
On very long binding names > 256 characters, a buffer overrun would be
trigger in janet_cfuns. Not a huge issue, since this is not really code
that would ever be user facing, but we can fix this.
2020-01-12 11:31:41 -06:00
Calvin Rose
a68ee7aac6
Update Copyright 2020.
2020-01-12 10:50:37 -06:00
Calvin Rose
0e7cf51890
Fix MSVC warnings.
2020-01-12 10:19:51 -06:00
Calvin Rose
b54d9725d8
Fix MSVC errors.
2020-01-12 10:18:03 -06:00
Calvin Rose
2f0570aad6
Address #249
...
If JANET_ENTRY_NAME is defined, we are compiling into a single binary.
In this case, we don't want to define the config symbol multiple times
with same name, as this causes the linker error.
2020-01-12 10:13:06 -06:00
Calvin Rose
3d40c95e80
Add ability to Janet signal from C functions.
...
While C functions are not re-entrant, signaling from a C function
can be used to implement async returns. When resuming a fiber that
signalled from within a C function, the fiber is started after the
instruction that emitted the signal. The resume argument is used
as the return result from the c function.
2020-01-10 20:44:16 -06:00
Calvin Rose
ed5027db5d
Address #242
...
Synchronize critical sections in setenv/getenv/environ.
2020-01-06 22:41:18 -06:00
Andrew Chambers
ec1a06cfaf
Optional default value for os/getenv.
2020-01-07 11:21:05 +13:00
Calvin Rose
212aceedc6
Fix useless type conversion.
2020-01-02 22:12:07 -06:00
Calvin Rose
e6f897f4ef
Merge branch 'master' of github.com:janet-lang/janet
2020-01-02 22:10:13 -06:00
Calvin Rose
6c7f376410
Try to remove potential overflow bugs.
...
Also make integer to size_t casts explicit rather than relying on
int32_t * sizeof(x) = size_t. This is kind of a personal preference for
this problem.
2020-01-02 22:08:17 -06:00
Calvin Rose
e93e237c67
Merge pull request #236 from andrewchambers/scratch_calloc
...
Add scratch calloc.
2020-01-02 20:29:10 -06:00
Calvin Rose
a2c45a697b
Address #234 in array.c
2020-01-02 20:27:38 -06:00
Andrew Chambers
acdbf8911c
Add scratch calloc.
2020-01-03 12:10:17 +13:00
Calvin Rose
a15d841b5b
Address #232
...
Fix segfault on macro arity mismatch in compile.c by adding missing return statements.
2019-12-31 11:33:03 -05:00
Calvin Rose
75bb8fbcd1
Amalg script included janet.h before test macros.
2019-12-30 22:08:12 -05:00
Calvin Rose
9cb25ad7b1
Remove some feature test macros.
...
_BSD_SOURCE is deprecated and not needed.
2019-12-30 21:30:13 -05:00
Calvin Rose
f361830cb2
Update feature test macro in line.c
2019-12-30 20:24:40 -05:00
Calvin Rose
9dd152dc28
Add features.h for feature test macros.
...
Because we use an amalgated build, feature
test macros should be set in a single file that
is included before any other headers, and is placed
at the top of the amalgamated build.
2019-12-30 19:06:15 -05:00
Calvin Rose
2ba4337e6f
Remove all feature test macros from janet.h
...
This should help improve compatibility with other C code.
2019-12-30 15:12:17 -05:00
Calvin Rose
48fcd927ab
Merge branch 'master' of github.com:janet-lang/janet
2019-12-30 14:26:38 -05:00
Calvin Rose
407d8af026
Address #233
...
Move _POSIX_C_SOURCE to internal header.
2019-12-30 12:31:26 -05:00
Calvin Rose
d0570b55b1
Merge pull request #231 from andrewchambers/tempfile
...
Add file/temp.
2019-12-29 20:00:17 -05:00
Calvin Rose
a964a95c1e
Fix warnings on BSDs.
2019-12-29 19:53:35 -05:00
Andrew Chambers
c2f8441572
Add file/temp.
2019-12-30 12:00:35 +13:00
Calvin Rose
099a957e6c
Update macex1 to properly handle break
...
Things mostly worked fine, but technically
break should be handled as a special form not a function call.
2019-12-29 16:44:53 -05:00
Andrew Chambers
2bebace8eb
Extend file api to allow creating and checking.
2019-12-30 04:02:46 +13:00
Calvin Rose
5142722da3
Remove aliases for deprectaed functions.
2019-12-28 17:51:05 -05:00
Calvin Rose
52dd0f132a
Remove emscripten build.
...
Prefer using custom toolchain with amalgmated build.
2019-12-28 16:11:15 -05:00
Calvin Rose
022be217a2
Remove ==, not==, and order[<,<=,>,>=].
...
This unifies equality and comparison checking. Before, we had
separate functions and vm opcodes for comparing general values vs.
for comparing numbers, where the numberic functions were polymorphic and
had special cases for handling NaNs. By unfiying them, abstract types
can now better integrate with other number types and behave as keys.
For now, the old functions are aliased but will eventually be removed.
2019-12-28 16:04:15 -05:00
Calvin Rose
5528bca7a9
Version bump to dev version.
2019-12-28 11:58:40 -05:00
Andrew Chambers
ddc4274314
Expand docs to explain pclose semantics.
2019-12-28 15:24:10 +13:00
Calvin Rose
da93a73dbd
Version bump to 1.6.0.
2019-12-22 12:09:56 -05:00
Calvin Rose
3492ed6d88
Windows installer pulls version from interpreter.
...
This should make version updates simpler. Also
try an make installer write to ProgramFiles instead
of ProgramFiles (x86) for 64 bit build.
2019-12-19 13:18:46 -05:00
Calvin Rose
e28262f5ab
Add array/fill
...
This function has similar semantics to buffer/fill.
2019-12-19 12:58:11 -05:00
Calvin Rose
94246f7574
Use infinite timeout to indicate non-blocking.
...
Makes more sense than negative numbers.
2019-12-18 16:07:06 -05:00
Calvin Rose
07b0ef1648
Throw error on bad thread creation.
2019-12-18 15:49:57 -05:00
Calvin Rose
6a39c4b91d
Pass thread body explicitly in thread/new.
...
Doing it via thread/send make sense, but is a bit
strange. Passing the body explicitly will make more
sense to API users.
2019-12-18 15:07:46 -05:00
Calvin Rose
b9f0f14e31
Add array/new-filled
...
Similar function signature to buffer/new-filled.
2019-12-18 13:02:50 -05:00
Calvin Rose
4238379552
Use _setjmp/_longjmp on BSDs.
...
This doesn't save the signal mask so should be a bit faster.
2019-12-18 12:18:31 -05:00
Calvin Rose
2b2c1ff917
Get rid of warning on BSDs.
2019-12-15 16:04:43 -06:00
Calvin Rose
c7912249b2
Typo in #ifdef.
2019-12-15 15:56:26 -06:00
Calvin Rose
b8004555ea
Start cleaning up defines in janet.h
2019-12-15 15:41:58 -06:00
Calvin Rose
58ff7f0788
BSD os.c fix with arc4random.
2019-12-15 12:47:12 -06:00
Calvin Rose
f1afc5b0b4
Address #214
...
This adds several common patterns, which are defined in
boot.janet. This essentially gives more primitive patterns
to work with out of the box.
Fix build when JANET_REDUCED_OS is defined.
2019-12-14 20:39:14 -06:00
Calvin Rose
bc8ee207d5
Address #219 .
...
Adds several shorthands to the C API.
2019-12-14 11:31:46 -06:00
Calvin Rose
76342540dc
Add buffer/fill. Address #221
2019-12-14 10:54:29 -06:00
Calvin Rose
56784a34a1
Address #224 - Exposed file flags in janet.h
...
A caller can check if a file is closed with
if (flags & JANET_FILE_CLOSED) ...
2019-12-14 09:03:56 -06:00
Calvin Rose
c3f1b54171
Update jpm path settings.
...
This will make it easier to use jpm as a per-project
management tool, as well as easier to set up individual
module trees.
2019-12-12 19:35:40 -06:00
Calvin Rose
9b7d642c38
Window x86 needs isnan.
2019-12-12 19:04:13 -06:00
Calvin Rose
aa7f3411f5
Use JANET_SINGLE_THREADED to disable threads.
2019-12-12 17:39:22 -06:00
Calvin Rose
5b9eda5e87
Add root-env
...
This makes images smaller without needing to make sure
that no references to the root environment occur in the final
image.
2019-12-12 17:25:04 -06:00
Calvin Rose
7c2ae45809
Fix some merge issues.
...
Make everything compile, and test-install pass.
2019-12-12 17:14:36 -06:00
Calvin Rose
36b2f27873
Merge branch 'master' into threads-3
2019-12-12 17:07:03 -06:00
Calvin Rose
b8e02afd1a
Improve error messages in os.c and jpm
...
In os/* functions, show failed path name. In jpm, indicate
a permission issue if we can't stat the file.
2019-12-12 03:20:20 -06:00
Calvin Rose
0fc36aa5d0
Signal to pending threads more often.
2019-12-12 02:19:56 -06:00
Calvin Rose
38f7e256d0
Port threads code to Windows API
...
Can run demo in examples/threads.janet
2019-12-10 20:32:41 -05:00
Calvin Rose
4187c972a3
Switch to multiple buffers per mailbox.
...
Needs less copying.
2019-12-10 13:26:00 -06:00
Calvin Rose
2d5af32660
Refine typedefs.
2019-12-09 20:12:10 -06:00
Calvin Rose
e592b24333
Added some type aliases to janet.h
...
This should make it clearer if a pointer is really just a
plain pointer, or a pointer with a header.
2019-12-09 20:05:53 -06:00
Calvin Rose
8700a407ce
Update janet_getmethod to better match new get api.
2019-12-09 18:45:05 -06:00
Calvin Rose
8ecf359bbe
Merge pull request #226 from andrewchambers/abstractget
...
Abstract type getters can indicate key absence.
2019-12-09 18:39:40 -06:00
Calvin Rose
5b6dffe93d
Version bump.
2019-12-09 18:04:38 -06:00
Calvin Rose
1a6eb52f11
Add protect macro.
...
A more functional version of try catch.
2019-12-09 17:32:02 -06:00
Andrew Chambers
57ccfb692c
Abstract type getters can indicate key absence.
...
This change to the c api allows abstract types to indicate
to the runtime if a key was absent, or if it meant to return nil.
2019-12-09 16:50:33 +13:00
Calvin Rose
eb1c21b0da
Fix some example issue and warnings under -Os.
2019-12-08 12:40:05 -06:00
Calvin Rose
66d82c4513
Add mailbox capacity for back pressure.
...
(thread/send thread msg &opt timeout) can now timeout. Also
changed thread/self to thread/current for better consistency with
fibers, and all blocking operations will by default timeout after 1
second. I think its bad to make things block forerver by default.
2019-12-08 12:30:30 -06:00
Calvin Rose
c9c4424261
Add thread/self.
2019-12-07 17:54:08 -06:00
Calvin Rose
131733549d
Get mailbox API working.
2019-12-07 16:51:00 -06:00
Calvin Rose
ee646dadf2
Merge branch 'master' into threads-3
2019-12-07 12:14:44 -06:00
Calvin Rose
73f5314141
Work on moving to mailbox abstraction.
...
Should be more efficient in the common case.
2019-12-07 12:14:16 -06:00
Calvin Rose
546669082f
New unmarshal proposal.
...
Gives more control over unmarshalling
abstract types. This should also
make it possible/easy to write abstract types that cannot
cause unmarshal to segfault.
2019-12-06 22:12:18 -06:00
Calvin Rose
4a0ee5df7d
Address #215
...
Also update docs for module/expand-path.
2019-12-06 19:54:11 -06:00
Calvin Rose
4de6c2ad61
Address #211
...
Scripts run from the command line will automatically
call a main function if it exists.
2019-12-06 19:14:12 -06:00
Calvin Rose
0e690b4fa0
Add timeout to thread/receive.
...
If provided, throws an error if no message is received before
timeout. Perhaps should return nil?.
2019-12-06 09:21:36 -06:00
Calvin Rose
c804ae9f7c
Update threads.c to avoid a deadlock.
2019-12-06 01:46:23 -06:00
Calvin Rose
dbcceefc20
Fix bad merge.
2019-12-04 22:41:30 -06:00
Calvin Rose
1a4035b02c
Merge branch 'master' into threads-3
2019-12-04 22:39:30 -06:00
Calvin Rose
e908029392
Work on thread/receive doubling as select.
2019-12-04 22:31:01 -06:00
Calvin Rose
fd4220f254
Keep single global pthread_cond_t per thread.
...
This will allow thread/select to be implemented.
Also add thread/close and close method to threads.
2019-12-04 21:44:53 -06:00
Calvin Rose
de6c3d6d70
Simplify structure JanetThread and JanetChannel.
...
Remove JanetThreadShared.
2019-12-04 21:04:43 -06:00
Calvin Rose
49954c7a30
Remove top-level unquote for comptime macro
...
True top level unquote currently requires basically double compilation
as it currently stands. Also, implementing such double compilation
looses all source mapping information. This is a compromise
implementation that makes it clear that this works differently than
a true top-level unquote.
2019-12-04 19:53:13 -06:00
Calvin Rose
2487162ccf
Add top level unquote and macro envs.
...
This improves macros that eval their arguments and
makes them easier to write.
2019-12-04 18:39:13 -06:00
Calvin Rose
4199c42fe2
Add support for nested quasiquotation.
...
This brings Janet more in line with Scheme,
Common Lisp, and Clojure.
2019-12-04 16:40:53 -06:00
Calvin Rose
f39cf702db
Address #212 - don't include janet args in script args.
2019-12-04 08:30:36 -06:00
Calvin Rose
db9e431bf7
Address #213 - disallow non-indexed ds for loop range.
2019-12-04 08:18:54 -06:00
Calvin Rose
328454729e
Add nan?
2019-12-03 21:24:22 -06:00
Calvin Rose
70328437f1
Add math/rng-buffer.
...
Allow math/seedrandom to use buffer as seed.
2019-12-03 20:33:21 -06:00
Calvin Rose
600bed9f6d
Merge pull request #209 from andrewchambers/cryptorand2
...
Add os/cryptorand.
2019-12-03 19:12:32 -06:00
Andrew Chambers
0ac5b243c7
Add os/cryptorand.
2019-12-04 14:02:37 +13:00
Andrew Chambers
9911c90b1d
Handle missing get case.
2019-12-04 13:58:21 +13:00
Calvin Rose
a1f35e21c7
Merge branch 'master' into threads-3
2019-12-03 18:11:32 -06:00
Calvin Rose
9ccdab0bc7
Merge pull request #208 from andrewchambers/explain_why
...
Explain the logic behind negative slice indices.
2019-12-03 10:42:46 -05:00
Andrew Chambers
a20e956f6d
Explain the logic behind negative slice indices.
2019-12-03 22:05:43 +13:00
Calvin Rose
59668133a2
Merge pull request #206 from andrewchambers/unkown
...
Fix typo.
2019-12-03 03:34:46 -05:00
Andrew Chambers
73db8584e0
Fix typo.
2019-12-03 21:14:00 +13:00
Calvin Rose
cecc7e6b9d
Rename 'get' opcode to 'in', add new 'get' opcode.
...
This makes the names of the opcodes match their implied functionality.
We also rename the C functions to match the opcodes and source level
functionality.
2019-12-02 21:26:28 -06:00
Calvin Rose
3a14aad615
Address issue #205 .
2019-12-02 18:34:08 -06:00
Calvin Rose
8368e55151
Merge branch 'master' into threads-3
2019-12-02 17:49:39 -06:00
Calvin Rose
ac85fca8a1
Fix warnings for appveyor.
2019-12-02 09:07:49 -06:00
Calvin Rose
e5fbe5c557
Change printf to add trailing newlines.
...
Also add prinf and eprinf for old behavior. This
is consistent with the naming of print and prin.
2019-12-02 04:45:03 -06:00
Calvin Rose
474bcd50a1
Add methods to threads.
2019-12-02 04:39:13 -06:00
Calvin Rose
70c8b6838d
Use make-image-dict and load-image-dict in thread/new
...
Rather than messing with janet_core_dictionary, we
instead cache the core enevironment, and pull out the
needed tables from there. This is more flexible, more correct, and
also exposes janet_resolve_core, which can be easily used from the C
API.
2019-12-02 04:15:22 -06:00
Calvin Rose
212479188a
Have separate encode and decode dicts for threads
...
This is more correct and mirrors the way marshal -> unmarshal works.
2019-12-01 21:53:39 -06:00
Calvin Rose
5b1e59b535
Merge branch 'master' of github.com:janet-lang/janet into threads-3
2019-12-01 21:26:22 -06:00
Calvin Rose
779d788efa
Merge pull request #204 from andrewchambers/get_permissive
...
New capi janet_get_permissive
2019-12-01 22:06:44 -05:00
Andrew Chambers
6233d804c8
New capi janet_get_permissive
...
The janet_get_permissive function implements the core semantics
of the 'get' function. The original janet_get implements the semantics of
the 'in' function and also the OP_GET opcode. This slight oddity is
to avoid a backwards incompatible change.
2019-12-02 15:49:51 +13:00
Calvin Rose
8f31a53276
Add thread example.
...
Also remove reference to pthread_t in the JanetThread structure.
2019-12-01 20:47:22 -06:00
Calvin Rose
6a763aac95
Work on threads.
...
Add send and receive.
2019-12-01 20:28:12 -06:00
Calvin Rose
5cd6580c2d
Merge branch 'threads-3' of github.com:janet-lang/janet into threads-3
2019-12-01 20:25:57 -06:00
Andrew Chambers
8a58be81ba
Update documentation for in and get builtins.
...
Try to clarify documentation and teach users the correct
way to read the 'in' so it is less likely to be confused
with python's usage of the keyword.
2019-12-02 12:35:54 +13:00
Calvin Rose
fc53445d08
Merge pull request #198 from andrewchambers/intprint
...
Integers convert to plain number strings.
2019-12-01 13:00:09 -05:00
Calvin Rose
db261aabf4
Fix bad integer printing range.
2019-12-01 09:46:20 -05:00
Calvin Rose
36ef1c4749
Print proper integers as integers.
2019-12-01 09:40:34 -05:00
Andrew Chambers
5ae520a2c9
Integers convert to plain number strings.
...
A user can use (type n) to find the true type, the old behavior did not
seem useful for most uses of the string function.
2019-12-01 23:10:52 +13:00
Calvin Rose
474aed8cfe
Merge branch 'master' of github.com:janet-lang/janet
2019-11-30 21:34:38 -05:00
Calvin Rose
570f04ca05
Fix typo.
2019-11-30 21:27:36 -05:00
Andrew Chambers
ded08b6e1e
Add truthy? to core.
2019-12-01 14:34:41 +13:00
Calvin Rose
bf609445c1
Merge pull request #186 from quexxon/fix-array-ensure-documentation
...
Add missing documentation for array/ensure's growth parameter
2019-11-29 22:39:04 -05:00
Calvin Rose
4e4cdb6356
Run formatter.
2019-11-28 23:26:11 -05:00
Calvin Rose
688d297a18
Address Issue #184 .
...
Fix strtod.c with better range checking to prevent DOS.
2019-11-28 23:23:37 -05:00
Will Clardy
9e1c3e0f41
Add missing documentation for array/ensure's growth parameter
2019-11-28 23:16:32 -05:00
Calvin Rose
967a8b5a70
Merge pull request #183 from andrewchambers/environ
...
Add os/environ.
2019-11-28 21:33:43 -05:00
Calvin Rose
92b7d91697
Merge pull request #182 from andrewchambers/scratch_finalizer
...
Add an optional finalizer to scratch resources.
2019-11-28 21:07:42 -05:00
Andrew Chambers
07db4c530e
Add os/environ.
2019-11-28 19:00:52 +13:00
Andrew Chambers
a3fb2d6e0a
Add an optional finalizer to scratch resources.
...
A finalizer can be attached to scratch allocations efficiently at any point in
it's lifecycle via janet_sfinalizer. Care was taken to keep allocations aligned
with platform alignment requirements.
A big drawbacks to this approach is the waste of up to 16 bytes per scratch
allocation in the case the scratch memory does not require a finalizer.
2019-11-28 17:32:12 +13:00
Andrew Chambers
88f28773da
Add missing fileno method to file, sort method list.
2019-11-28 14:47:16 +13:00
Calvin Rose
e542ba7e4d
Fix amalg build.
2019-11-27 12:43:45 -06:00
Calvin Rose
bca0392738
First work on threading.
...
Posix only, needs to be disabled on windows. Also
the Makefile needs to be configurable, and meson.build
needs to take pthreads into account.
2019-11-26 23:13:53 -06:00
Calvin Rose
74d51ab08b
Address issue #180 - string/check-set
...
Fix the function and add test to further clarify that
implementation is correct. Also fix empty string case.
2019-11-25 20:33:16 -06:00
Calvin Rose
7df0ec6aed
Fix up debug/step and janet_step.
...
Also allow debugging on all signals, including errors.
This is gated behind (setdyn :debug true) in the repl.
2019-11-25 20:00:13 -06:00
Calvin Rose
6988fd3cab
Add debug/step to single step a fiber.
...
Very useful for implementing debuggers.
2019-11-25 18:14:34 -06:00
Calvin Rose
c3273e8751
Merge branch 'master' of github.com:janet-lang/janet
2019-11-24 17:54:14 -06:00
Calvin Rose
d37c43716a
Lots of work on improving debugging.
...
doc macro can take no arguments and print out
all bindings. Fix an issues with the vm skipping
over a breakpoint in some situations.
Add examples/debugger.janet for proof of concept
debugger.
2019-11-24 17:45:53 -06:00
Andrew Chambers
976dfc7195
Minor fixes for parser
...
Check length before dereferencing buffer in tokenchar.
Check keywords are valid utf-8.
Fix minor typos.
2019-11-24 08:19:04 +13:00
Calvin Rose
8372d1e499
uint32_t -> uint8_t
2019-11-21 23:31:35 -06:00
Calvin Rose
e65716f6ee
Add janet_rng_longseed to janet.h
2019-11-21 23:26:31 -06:00
Calvin Rose
4b24d77b2c
Switch back to well tested RNG.
2019-11-21 23:22:21 -06:00
Calvin Rose
02fc4ae27b
Allow seeding RNG with a byte sequence.
2019-11-21 22:53:39 -06:00
Calvin Rose
624f5f428e
Add a number of math functions.
...
Most of these functions are wrappers around math.h.
2019-11-17 10:54:44 -06:00
Calvin Rose
5171dfd2a8
Fix docstring.
2019-11-16 20:43:21 -06:00
Jon Staab
134163708a
Fix formatting
2019-11-16 16:07:15 -08:00
Jon Staab
40e6616df0
Add support for delete key in repl
2019-11-16 16:01:52 -08:00
Calvin Rose
bcd2089f71
Version 1.5.1
2019-11-16 17:17:13 -06:00
Calvin Rose
7553b277db
Fix return value of update.
2019-11-16 15:50:21 -06:00
Calvin Rose
c9521e093e
Fix windows issue with (file/read file :all)
...
When file was created with file/popen, the current optimization
of using fseek on windows fails due to windows not properly returning
and error code and just returning 0. Windows :(.
2019-11-11 20:05:00 -05:00
Calvin Rose
16f6261b44
Improve randomness of numbers from new rng.
...
First few numbers are very biased.
2019-11-10 17:44:59 -06:00
Calvin Rose
6b76ac3d18
Fix bug when appending buffer to self.
...
janet_to_string_b had a bug when printing buffers.
2019-11-10 14:57:09 -06:00
Calvin Rose
0d2844b7c9
Update to 1.5.0
2019-11-10 10:57:18 -06:00
Calvin Rose
719f7ba0c4
Default to UTC for date.
2019-11-09 16:57:21 -06:00
Calvin Rose
c9292ef648
Use /MD on windows.
...
Just makes things easier. Assume machines have msvcrt.dll
on them. If not, we can add msvcrt.dll to the dist folder and add to
installer.
2019-11-09 16:05:07 -05:00
Calvin Rose
dca247f01d
Fix MSVC build warnings.
2019-11-09 10:12:40 -06:00
Calvin Rose
63e7ca4623
Fix warning on travis CI with Clang.
2019-11-09 10:10:07 -06:00
Calvin Rose
1f55d40a10
Fix janet_opt* api.
...
Inverted conditional made behavior incorrect. These
were not used in the core library, so were not tested.
2019-11-09 09:39:14 -06:00
Calvin Rose
aee1687215
Add RNG functionality to the math/ module.
...
The new RNG wraps up state for random number generation, so
one can have many rngs and even marshal and unmarshal them.
Adds math/rng, math/rng-uniform, and math/rng-int.
Also introduce `in` and change semantics for
indexing out of range. This commit enforces stricter
invariants on keys when indexing via a function call
on the data structure, or the new `in` function.
The `get` function is now more lax about keys, and will
not throw an error when a bad key is used for a data structure, instead
returning the default value.
2019-11-08 17:40:04 -06:00
Calvin Rose
9b605b27bd
Address #174 - fix string/trim
2019-11-08 08:47:37 -06:00
Calvin Rose
c5010dffb4
Print error message on bad CLI usage.
...
This was a small regression when bundling cli-main
into boot.janet.
2019-11-05 12:51:15 -06:00
Calvin Rose
026f26f05f
Improve error message in slice functions.
...
Check the first argument before trying to do range
checks.
2019-11-05 09:41:30 -06:00
Calvin Rose
cf2d3861d6
Make slice a c function.
...
This will allow future integration into the compiler
for more general destructuring.
2019-11-05 09:29:32 -06:00
Calvin Rose
6ceaf9d28d
Add with-vars
...
This helps for temporarily setting vars in a safe
manner that is guaranteed not to leave vars in a bad state
(assuming that a fiber does not emit debug or use signal and
is never resumed).
2019-10-31 21:58:43 -05:00
Calvin Rose
280dca3998
Add shell.c to the amalgamation.
...
This allows easy builds of the full interpreter with no
build system.
1. Get janet.c, janet.h, janetconf.h, and shell.c in a directory. Edit
janetconf.h as desired.
2. gcc shell.c janet.c -lm -ldl -O2 -o janet (on GNU-Linux for example)
3. ./janet -h (Yay!)
2019-10-29 19:18:44 -05:00
Calvin Rose
427b2638e0
Fix startup environment.
2019-10-29 18:47:54 -05:00
Calvin Rose
2541806dc1
Fix suite7 failing when run with no docstrings.
2019-10-29 18:28:41 -05:00
Calvin Rose
0d16b9e1a1
Move init.janet into cli-main in boot.janet
...
This makes it easier to get the CLI functionality when
embedding Janet, although the main reason is the init script
is now pre-compiled to bytecode when generating the boot image.
2019-10-29 18:16:32 -05:00
Calvin Rose
45c2819068
Improve flychecking.
...
Flychecking will now work correctly with arity checking, and
will better handle imports. Well structured modules should interact
cleanly with the flychecker in a mostly safe manner, but maliciously
crafted modules can execute arbitrary code. As such, the flychecker is
not a good way to validate completely untrusted modules.
We also extend run-context with an :evaluator option to replace
:compile-only. This is more flexible and allows users to create their
own flychecker like functionality.
2019-10-27 16:15:41 -05:00
Calvin Rose
d28925fdab
Relax type checking when fuction position is nil
...
This lets the flychecker work as expected.
2019-10-24 15:17:19 -05:00
Calvin Rose
9097e36ea0
[] should evaluate to ()
...
This is consistent with most bracket tuples.
2019-10-20 14:06:28 -05:00
Calvin Rose
423b6db855
Fix memory leak with some string/ functions.
...
kmp_init leaked memory when called with an empty string.
2019-10-19 15:14:19 -05:00
Calvin Rose
bb54b940c0
Don't call fwrite with size = 0
2019-10-19 10:51:11 -05:00
Calvin Rose
8dd8af742a
Add eprintf and make printf a C function.
...
This allows some more optimizations when printing to
buffers or when output is disabled. It also makes printf
more consistent with print and prin (Same with eprintf).
2019-10-19 10:30:29 -05:00
Calvin Rose
d47804d222
Add prin, eprint, and eprin functions.
...
The print family of functions now writes output
to an optional buffer instead of a file bound to :out.
This means output can be more easily captured an redirected.
2019-10-19 09:44:27 -05:00
Calvin Rose
8dd322c0be
Fix webclient.
2019-10-14 20:55:04 -05:00
Calvin Rose
7fd0748c19
Update to 1.4.0
2019-10-14 20:35:13 -05:00
Calvin Rose
5f51476526
Remove a git attribute for linguist.
2019-10-12 22:03:34 -05:00
Calvin Rose
a18a251d16
Address some issues found in lgtm
...
Caught a few potentially issues with overflows, as well as use of
unsafe function localtime.
2019-10-10 22:59:43 -05:00
Calvin Rose
54b66a4199
Add shorthand package name support in jpm.
...
Package installation checks in the package listing if
the package name is not a url. The package listsing can be specified
via switch or env variable.
2019-10-10 18:11:45 -05:00
Calvin Rose
f9d57103f4
Improve peg error on unknown rule.
...
This helps a lot when debugging large, failing grammars.
2019-10-09 17:59:48 -05:00
Calvin Rose
f780df0aa6
Fix single threaded build option with meson.
...
By default, was building with the opposite of what was provided.
2019-10-05 20:35:11 -05:00
Calvin Rose
fede40f279
Relax requirement minimum arity of fn
...
A valid `fn` special could have only a parameter list, as
recommended by R. DuPlain.
2019-10-05 11:53:30 -05:00
Calvin Rose
e9f3dc7d5c
Add varfn.
2019-10-03 20:20:42 -05:00
Calvin Rose
944347e828
Fix formatting.
...
Run make format.
2019-09-30 20:00:29 -05:00
Calvin Rose
7910a5feef
Add compile time arity checking.
...
This should help catch a number of errors, but it
is a very shallow implementation of type checking. It will
catch some common misuses of functions at compile time
rather than runtime.
2019-09-30 19:50:42 -05:00
Calvin Rose
70ffe3b6bd
Add slice function to core.
...
Returns immutable slices.
2019-09-24 19:44:36 -05:00
Calvin Rose
339dea9390
Add optional argument functions to c api.
...
These are just helpers to make parameters than can be nil with a
default value easier to handle in a consitent way.
2019-09-24 19:40:49 -05:00
Calvin Rose
b26a7bb22a
Disallow the empty string for some string fns.
...
This will prevent these functions from being run
with empty strings, which usually produces useless
output, as the internal string search algorithm will
never "find" empty strings. This is by design, as it is
not always obvious which empty strings should be found in
the search text.
2019-09-24 13:23:18 -05:00
Calvin Rose
45dfc7cc96
Fix debug/break search algorithm.
2019-09-22 18:08:38 -05:00
Calvin Rose
8cda06b995
GCC seemed to not fill array of computed gotos.
...
This is expected as per the C standard, but segfaulted
unless all 255 labels were added.
2019-09-22 17:56:33 -05:00
Calvin Rose
a8afc5b81f
Sourcemapping uses line, column instead of offsets.
...
This should be friendlier to most users. It does, however, mean
we lose range information. However, range information could be
recovered by re-parsing, as janet's grammar is simple enough to do this.
2019-09-22 17:18:28 -05:00
Calvin Rose
228d045a06
Fix formatting.
2019-09-22 15:17:06 -05:00
Calvin Rose
803c3fc235
Add line, col to error messages when available.
2019-09-22 15:13:21 -05:00
Calvin Rose
7bee204390
Fix installer.
2019-09-22 13:29:34 -04:00
Calvin Rose
7809f89dfc
1.3.1 Release
...
Small changes, mostly just fixing minor bugs.
2019-09-21 19:15:02 -05:00
Calvin Rose
8e427317cd
Add mean function to boot.janet
...
Update changelog.
2019-09-19 21:21:14 -05:00
Calvin Rose
16127fc55c
Remove printf in regalloc.c
...
This should never be hit unless there is a
bug in the compiler, but should be removed.
2019-09-15 18:17:43 -05:00
Calvin Rose
97d874f16b
Fix small compiler bug (not freeing temp register).
2019-09-15 13:27:49 -05:00
Calvin Rose
39f1d81fd4
Use :length method for (length abstract)
...
Also adds the janet_lengthv API call. This is
needed because janet_length returns a 32 bit integer, where
as lengthv lets us return larger values (useful for typed arrays).
janet_mcall is an api function that should make it easier to call
a janet method from C code. It shares a similar signature with
janet_call.
2019-09-08 19:26:16 -05:00
Calvin Rose
99f147219a
Add put-in.
2019-09-05 13:19:25 -05:00
Calvin Rose
7a13d24e6f
Add get-in, update-in, and freeze to core.
2019-09-05 13:11:53 -05:00
Calvin Rose
96a3104fe2
Update to 1.3.0, add jpm.1
2019-09-04 23:44:23 -05:00
Calvin Rose
98eaadf2d1
Simplify peg caching further.
...
Remove the multiple caching tables we were using
and use the grammar table for caching. This works
well because we can use raw_get for checking the local cache, and normal
get fro checking the global cache.
2019-08-30 08:57:45 -05:00
Calvin Rose
54a04b5894
Fix some more recursion issues with pegs.
...
A keyword reference only counts as visited if we have
it as cached in the memoized->table, and we know it was
originally referenced from the same grammar table. If these
two conditions are true, then compilation must work correctly.
Also add janet_table_get_ex.
2019-08-29 19:56:04 -05:00
Calvin Rose
8bc8709d0e
Try to address memoization problem in pegs.
2019-08-29 19:09:43 -05:00
Calvin Rose
060d11e4c2
Add Q and q formatters to buffer/format.
...
These are similar to P and p, but print values
on a single line for a much more compact version.
2019-08-24 22:53:45 -04:00
Calvin Rose
711fe64a51
Add backmatch operator to pegs.
...
(backmatch [tag?]) is similar to a back reference in regular expressions
(NOT to backwards capture in a peg). It only matches a pattern if
it exactly matches the text of the last capture. It does not consume
or push any captures to the capture stack.
2019-08-24 18:57:01 -04:00
Calvin Rose
292be33b9d
Fix some stack overflow bugs.
2019-08-19 01:19:51 -04:00
Calvin Rose
81789a6930
Add wasm to architectures returned by os/arch.
2019-08-18 10:08:52 -05:00
Calvin Rose
28fb2403d9
Add os/arch to core.
...
Also allow setting custom keywords for compiled
os name and architecture name.
2019-08-18 10:00:04 -05:00
Calvin Rose
54170d92db
Add some color to stacktraces in repl.
2019-08-12 19:20:01 -05:00
Calvin Rose
ec62e871dd
Update to version 1.2.0.
2019-08-08 18:51:24 -05:00
Calvin Rose
ab782d8896
Add optional default value to get.
...
Also update CHANGELOG.md
2019-08-06 18:12:00 -05:00
Calvin Rose
c84ddefc53
Merge pull request #156 from curist/take-and-drop
...
Take and drop
2019-08-06 17:35:55 -05:00
curist
5802155882
Update take/drop - while/until.
...
to be more consistent with take/drop
2019-08-06 15:33:55 +08:00
curist
ee8a68f7b2
Fix take/drop comments.
2019-08-06 14:25:09 +08:00
curist
61bbeebfba
Update take/drop implementation.
...
No more preserves input type.
2019-08-06 14:19:22 +08:00
curist
18da183ef7
Add take/drop.
2019-08-06 14:00:05 +08:00
Calvin Rose
19c6714f06
Fix MSVC warnings and errors.
2019-08-05 20:19:46 -05:00
Calvin Rose
2193193b12
Improve error message on bad method calls.
2019-08-05 19:06:58 -05:00
Calvin Rose
850a2d7f79
Allow method calls on typed arrays.
2019-08-05 18:51:53 -05:00
Calvin Rose
ca5dce5d9f
Address #155 .
...
Fix bug in janet_table_clone that leaked memory.
2019-08-05 17:52:05 -05:00
curist
d334f070a3
Update several docstrings.
2019-08-05 19:58:51 +08:00
Calvin Rose
44e752d737
Add shorthand function literals to janet.
...
These are similar to the function literals from Clojure
(also Fennel), and should make short functions for maps, filters, etc.
easier to write.
2019-08-04 12:25:52 -05:00
Calvin Rose
02ce3031e9
Fix comp case with arity of exactly 5.
2019-08-03 14:53:14 -05:00
Calvin Rose
6caf8d3d56
Make comp
create variadic functions.
2019-08-03 13:57:11 -05:00
Calvin Rose
b18f1e8127
Keep count fo allocated memory via malloc.
...
We normally only track memory allocated with janet_gcalloc, but
if only a few very large normal memory blocks are allocated, the GC
will never run. Se simply need to increment a count when we allocate
memory so that the next time we enter the VM, we will be able to
run a collection if needed.
2019-07-31 00:24:13 -05:00
Calvin Rose
3e67916971
Fix MSVC warning.
2019-07-28 18:44:00 -05:00
Calvin Rose
8bbe518696
Executables linking to natives working on linux.
...
This involves a bunch of machinery in cook.janet
and even a little bit in the janet C API.
2019-07-28 13:27:20 -05:00
curist
c2ef58d880
Update math/log docstring
2019-07-28 22:18:36 +08:00
Calvin Rose
7e97687c9e
Update windows installation and automation.
2019-07-27 21:44:44 -04:00
Calvin Rose
d6a1faa380
Typos.
2019-07-27 11:36:48 -05:00
Calvin Rose
3c133bd677
Add more values for (os/which)
...
Some bsd flavors.
2019-07-27 11:29:40 -05:00