1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-13 04:09:54 +00:00
Commit Graph

169 Commits

Author SHA1 Message Date
Calvin Rose
964a800d51 More work on windows event loop code. 2020-10-06 19:07:29 -05:00
Calvin Rose
db67538311 Work on getting ev support on windows. 2020-10-04 12:46:15 -05:00
Calvin Rose
30522bbf7d Merge branch 'master' into ev 2020-08-16 17:52:36 -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
297de01d95 Add preliminary channel implementation. 2020-08-01 13:13:58 -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
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
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
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
ec0d0ba368 Initial UDP implementation. 2020-06-02 19:47:50 -05:00
Calvin Rose
3f434f2a44 Add backpressure capability to net. 2020-05-31 15:46:01 -05:00
Calvin Rose
4c211c8dce More updates to the ev library. 2020-05-28 16:51:11 -05:00
Leaf Garland
6909d9c9c9 Fix c code for latest Janet 2020-05-24 21:30:23 +12:00
Leaf Garland
0d5d820f4f Remove cook code 2020-05-24 21:29:20 +12:00
Leaf Garland
6fbca3416a Move tests to tests dir 2020-05-24 21:28:16 +12:00
Leaf Garland
466d9b31ce Add project.janet for numarray 2020-05-24 21:25:52 +12:00
Calvin Rose
596111c988 Merge branch 'master' into net 2020-04-17 15:08:26 -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
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
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
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
8cc43ad2d1 Fix debugger example. 2019-12-17 23:06:41 -06:00
Calvin Rose
eb1c21b0da Fix some example issue and warnings under -Os. 2019-12-08 12:40:05 -06:00
Calvin Rose
131733549d Get mailbox API working. 2019-12-07 16:51:00 -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
e908029392 Work on thread/receive doubling as select. 2019-12-04 22:31:01 -06:00
Calvin Rose
de6c3d6d70 Simplify structure JanetThread and JanetChannel.
Remove JanetThreadShared.
2019-12-04 21:04:43 -06:00
Calvin Rose
474bcd50a1 Add methods to threads. 2019-12-02 04:39:13 -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
8f31a53276 Add thread example.
Also remove reference to pthread_t in the JanetThread structure.
2019-12-01 20:47:22 -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
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
Calvin Rose
02fc4ae27b Allow seeding RNG with a byte sequence. 2019-11-21 22:53:39 -06:00
Calvin Rose
11998b3913 Remove resolver element in path tuple.
Try to simplify module/paths back to how it used to be.
2019-05-25 17:27:56 -04:00
Calvin Rose
840610facf Add urlloader example.
Demonstrate loading files from URL.
2019-05-25 17:10:25 -04:00
Vedor Vidurakis
0aa2f68793 Primes example fixed
It was failing due to unknown symbol "string/pretty"; (pp (primes 100)) works properly.
2019-05-16 12:03:54 +02:00
Calvin Rose
9100794cea Drop leading and trailing newlines in longstrings.
Long, heredoc style strings can now have
a non semantic leading newline character. This makes it
easier to define large columns of text.
2019-04-21 13:34:41 -04:00
Calvin Rose
2d7df6b78e Many changes for adding dynamic (fiber-level) scope.
- Allow passing a table to fibers, which make fiber level scope easier.
- Add fiber/getenv, fiber/setenv, dyn, and setdyn
- Remove meta, *env*, and *doc-width*
- Some functions changed dignatures, and no longer take an env
2019-04-16 15:41:45 -04:00
Calvin Rose
1e299632e4 Fix example. 2019-03-21 14:32:08 -04:00
Calvin Rose
172261b89f Add a test-install target to the Makefile
This target will be used to check if an installation
of Janet is on the PATH, if native modules can be built
and used via the cook module, etc.
2019-03-03 14:48:17 -05:00
J.-F. Cap
fb5119bf43 Added some tests (suite 5) 2019-02-25 18:49:04 +01:00
J.-F. Cap
febfefa4b2 Added tarray/slice and fix buffer size 2019-02-25 02:21:10 +01:00
J.-F. Cap
0eae75a5c2 added MARSH_EOS check 2019-02-24 18:45:14 +01:00
J.-F. Cap
1d50fd9485 First exeperiments with JS style Binary Typed Arrays 2019-02-21 00:15:48 +01:00
Calvin Rose
9d4effc02e Add make format to format code.
A consistent style should help with contributors and
readability. We use astyle as the formatter as can make a pretty
good approximation of the current style and my preferred style.

Astyle can be found at http://astyle.sourceforge.net/astyle.html
2019-02-19 20:51:34 -05:00
Calvin Rose
ed72dcf82d Rename the header <janet/janet.h> to <janet.h>
Makes it easier to use and remember, and makes the
variable `module/*headerpath*` make more sense.
2019-02-18 20:13:35 -05:00
Calvin Rose
33087fe9de Update game of life example. 2019-02-17 11:20:24 -05:00
Calvin Rose
8343c9edd1 Update example to use API. 2019-02-05 19:49:10 -05:00
Calvin Rose
74e1a3273f Add method syntax to parser. 2019-02-05 19:43:41 -05:00
Calvin Rose
1394dbbd57 Update license to include contributors.
Use 4 spaces for indentation.
2019-02-05 19:11:43 -05:00
J.-F. Cap
49465f71f3 Added a simple C module to test getter/setter. 2019-02-05 18:45:04 +01:00
Calvin Rose
d64a57297d Update examples, add method like semantics to calling keywords. 2019-01-07 14:47:47 -05:00
Calvin Rose
eae4e0dede Add functionality that allows the set macro to
take a tuple as an l-value. Remove the old
multi-sym report in anticipation of a different
mechanism.
2019-01-06 19:33:27 -05:00
Calvin Rose
6b95326d7c First commit removing the integer number type. This should
remove some complexity and unexpected behavior around numbers in
general as all numbers are the same number type, IEEE 754 double
precision numbers. Also update examples and tests, some of which were
out of date.

Some more testing may be needed for new changes to numbers.
2018-12-27 13:05:29 -05:00
Calvin Rose
cc5b4eac0a Update documentation, fix life example. 2018-12-17 21:28:45 -05:00
Calvin Rose
03dbd79165 Rename the := special form to set so it does not look like a keyword. 2018-12-16 21:57:32 -05:00
Calvin Rose
696866ae51 Add textmate syntax highlighting file. 2018-12-16 17:59:16 -05:00
Calvin Rose
34a69d0318 Add janet logo,mMove some lib files to example. 2018-12-11 18:06:10 -05:00
Calvin Rose
4e4dd31164 Change syntax for namespaces.
Add quasiquote, unquote, and unquote-splicing
as specials rather than a macro.
2018-11-30 22:49:21 -05:00
Calvin Rose
7dbad20150 Update core and some examples to use the new
syntax.
2018-11-29 14:03:45 -05:00
Calvin Rose
b0c45fd15e Multisyms for easier access into structures. 2018-11-29 13:30:59 -05:00
Calvin Rose
86d2785d5e Add example of new iteration macro
that may replace or complement the loop macro.
The loop macro is still useful though and not
nearly as complicated as the common lisp loop macro.
2018-11-28 16:30:53 -05:00
Calvin Rose
ea4465f58e Updare examples. Delete ugly iterator example. 2018-11-26 22:09:12 -05:00
Calvin Rose
915b87ba53 Remove classes from example code. 2018-11-25 15:59:20 -05:00
Calvin Rose
b2a1a4ec9b Add classes to core library. 2018-11-25 15:58:50 -05:00
Calvin Rose
d4ee760b3e Change format for declaring flexible arity functions. 2018-11-25 14:03:00 -05:00
Calvin Rose
184fe31e0c Add generator expressions for easier iteration.
Similar to python generator, but with the same
syntax as the loop macro.
2018-11-20 21:48:06 -05:00
Calvin Rose
71e1584e72 Update loop macro and replace pretty printer
with C implementation.
2018-11-19 02:15:21 -05:00
Calvin Rose
c8ef2a0d88 Rename to janet 2018-09-05 22:18:42 -04:00
Calvin Rose
73b397f7de Add json native instead of hello. Remove metabuild
code.
2018-08-26 11:28:51 -04:00
Calvin Rose
510feeed7f Allow marshaling of more functions for core.
Fix indentation in some files.
2018-08-22 21:41:25 -04:00
Calvin Rose
f28172a996 Replace switch with case. 2018-07-04 01:28:31 -04:00
Calvin Rose
5e2de33ae7 Remove some c functions in favor of bytecode. 2018-07-02 00:12:36 -04:00
Calvin Rose
f4fc4a0bcc Modularize compiler. 2018-07-01 11:52:15 -04:00
Calvin Rose
fde9751eab Move asm into core and rename to asm/disasm (no prefix) 2018-06-29 22:52:55 -04:00
Calvin Rose
1ea9ebf04f Fix sourcemapping bug with closures, add some library functions
to boot.dst
2018-06-29 19:44:33 -04:00
Calvin Rose
2e472ec9a3 Version 2 of new source mapping. 2018-06-29 01:16:46 -04:00
Calvin Rose
6d1ab414e4 Add frequencies to core library. 2018-06-03 14:21:24 -04:00
Calvin Rose
b09bf72490 Change primary looping macro to 'loop' instead of 'for'. 2018-05-23 22:08:36 -04:00
Calvin Rose
68895e27d4 Change import semantics. Fix gc bug with fibers. 2018-05-18 20:53:19 -04:00
Calvin Rose
932a0324ee More work on renaming functions. Change long string syntax to use
backticks. Allow custom masks in fibers for custom error and debug
handling.
2018-05-09 17:01:58 -04:00
Calvin Rose
f47323c915 Change convention for naming modules and functions. 2018-05-08 19:40:28 -04:00
Calvin Rose
06b80e56eb Merge branch 'master' of github.com:bakpakin/dst 2018-05-05 14:42:28 -04:00
Calvin Rose
238cec8f32 Add each. 2018-05-05 14:41:47 -04:00
bakpakin
d9e5019a71 Add -e option to dst for executing inline scripts from the shell. 2018-05-05 14:05:56 -04:00
Calvin Rose
256aba199f Remove foreach. 2018-05-01 23:38:53 -04:00
Calvin Rose
1110267c9d Update maxtriangle example, extend map function, and
add extremes functions (max, min, order-max, order-min, extreme)
2018-04-01 15:08:51 -04:00
Calvin Rose
9dabc6bee3 Update assembly doc. 2018-03-30 12:17:03 -04:00
Calvin Rose
73ead5c2de Update core namespace. Clean up some code,
and put more emphasis on indexed data-structure combinators
instead of iterators.
2018-03-28 13:58:56 -04:00
Calvin Rose
6ace978ab8 Merge branch 'master' of github.com:bakpakin/dst 2018-03-25 21:12:43 -04:00
Calvin Rose
44d2049c94 Update lazyseqs.dst and boot.dst 2018-03-25 20:39:38 -04:00
bakpakin
080caf31a7 Add triangles examples. 2018-03-25 18:51:31 -04:00
Gavlooth
5ff0367d0f Fix if-let when-let and add put-in (assoc-in) 2018-03-25 21:33:03 +03:00
Calvin Rose
a3ed7327c9 Make array literals require preceding @ character. 2018-03-24 12:48:42 -04:00
Gavlooth
0ebc95aa2b Improve lazy2iter and fix a typo in specials.c 2018-03-24 07:46:05 +02:00
Calvin Rose
89ecd43115 Move functions in util.dst to boot.dst. 2018-03-23 18:36:56 -04:00
Gavlooth
68bf4d460b Replicate segmentation fault 2018-03-23 05:39:16 +02:00