1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-30 00:53:15 +00:00
Commit Graph

1602 Commits

Author SHA1 Message Date
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
a1f35e21c7 Merge branch 'master' into threads-3 2019-12-03 18:11:32 -06: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
Calvin Rose
81a2af700a
Merge pull request #201 from andrewchambers/in_docs
Update documentation for in and get builtins.
2019-12-01 20:49:47 -05: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
8e31bda8f6 Fix issue #189 2019-11-30 21:54:23 -05:00
Calvin Rose
474aed8cfe Merge branch 'master' of github.com:janet-lang/janet 2019-11-30 21:34:38 -05:00
Calvin Rose
0509376aea
Merge pull request #193 from andrewchambers/truthy
Add truthy? to core.
2019-11-30 21:32:14 -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
f3c0d9115f Fix calling jpm quickbin binary with no arguments. 2019-11-30 15:11:34 -05: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
13ef2bd905
Merge pull request #185 from andrewchambers/afl
Add afl fuzzing helpers.
2019-11-29 22:36:47 -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
Andrew Chambers
4acc63e325 Add afl fuzzing helpers. 2019-11-29 16:43:14 +13: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
Calvin Rose
5b9e37e2cc
Merge pull request #181 from andrewchambers/fileno
Add missing fileno method to file, sort method list.
2019-11-27 21:06:30 -05:00
Andrew Chambers
88f28773da Add missing fileno method to file, sort method list. 2019-11-28 14:47:16 +13:00
Calvin Rose
66e6979812 Add thread flags to standalone executables. 2019-11-27 15:06:31 -06:00
Calvin Rose
8a91c52fa2 Change pthreads linking with jpm, make, and meson.
Try to add pthread deps when compiling programs with jpm.
2019-11-27 14:52:20 -06: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
6bc400eb8c Update CHANGELOG.md 2019-11-25 20:11:10 -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
a0a980e0ef Update sample debugger.
Add .break and .step.
2019-11-25 18:21:53 -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