1
0
mirror of https://github.com/janet-lang/janet synced 2026-05-30 17:22:15 +00:00
Commit Graph

157 Commits

Author SHA1 Message Date
Calvin Rose b8032ec61d Add propagate function and opcode
This allows better stacktraces when manually intercepting
signals to clean up resources. Also allows functionality
from Common Lisp's unwind-protect, such as calling cleanup code
while unwindinding the stack, restarting on certain signals, and
just in general having more control over signal and signal propagation.

Also fix a bug encountered while implementing with-resource in the
compiler. Desturcturing arguments that were not the last argument
would often result in bad code generation, as slots used to destructure
the earlier arguments would invalidate the later parameters. This is
fixed by allocating all named parameters before doing any destructuring.
2019-06-24 12:44:13 -04:00
Calvin Rose 4b4fe80404 Be more complete with JANET_NO_SOURCEMAPS
This actually removed sourcemaps, not just
the top level annotation in bindings.
2019-06-20 11:55:52 -04:00
Calvin Rose cf05ff610f Add some fixes for serializing complex grammars. 2019-06-19 23:23:27 -04:00
Calvin Rose fc46030e7d Add options to not include docstrings in binary.
This lets us build a smaller binary. The minimal tested
binary on x86-64 (with -Os, -s, and all options that shrink binary size
        turned on) is about 240 kB.
2019-06-19 19:43:38 -04:00
Calvin Rose ff3bb66272 Add some test cases for module/expand-path 2019-06-19 12:48:29 -04:00
Calvin Rose 9ba8728176 Update module system.
Add relative imports and path normalization. This should
help towards a more composable build/dependency system.
2019-06-18 22:10:13 -04:00
Calvin Rose e88a9af2f6 Add bytecode verification for peg unmarshaling. 2019-06-18 13:01:49 -04:00
Calvin Rose 446ab037b0 Allow marshaling pegs. 2019-06-17 23:40:02 -04:00
Calvin Rose b4e25e5597 Add some string/check-set tests. 2019-06-10 14:11:07 -04:00
Calvin Rose 43520ac67d Add parser/clone. (#120) 2019-06-08 17:16:36 -04:00
Calvin Rose f12f896020 Change test-install 2019-05-28 12:59:21 -04:00
Calvin Rose 698e89aba4 Fix comment macro arity #110 2019-05-25 22:50:15 -04:00
Calvin Rose 3f137ed0b1 Add keyword argument tests 2019-05-24 17:53:34 -04:00
Calvin Rose a303704a7d Add some tests for the amalgamated source/
Adds tests to Makefile and CI on Poisx platforms.
2019-05-23 10:34:01 -04:00
Calvin Rose 0378ba78cc Add regression test. 2019-05-20 09:20:50 -04:00
Calvin Rose 232ea22dc5 Add string/triml, string/trimr, and string/trim. 2019-05-10 16:09:49 -04:00
Calvin Rose bbcfaf1289 Fix use after free bug in buffer/format when printing self. 2019-05-08 15:25:25 -04:00
Andrew Chambers 1759252071 Fix use after free in buffer/push-string. 2019-05-08 10:49:25 -04:00
Calvin Rose 65ac17986a Address similar issue to #86
buffer/blit could trigger a use after free if a buffer is
blitted with itself and modifies its length.
2019-05-08 08:55:43 -04:00
Andrew Chambers c70d59edee Add string/has-prefix? and string/has-suffix?. 2019-05-04 10:05:58 -04:00
Calvin Rose 7918add47d Allow dynamically setting output for printers
Some functions like print and debug/stacktrace print
to a file, usually stdout. This file can now be optionally set
via a dynamic variable.
2019-04-16 21:44:19 -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 1596511175 Fix undefined behavior bug with errors.
janet_vm_return_reg should only be set when janet_continue
is called. Otherwise, a panic may dump it's error message in
the wrong place, resulting in undefined behavior (often showing
the last return value or worse, segfaulting).
2019-04-10 23:29:40 -04:00
Calvin Rose d514eab627 Add regression test for #78 2019-04-09 09:14:40 -04:00
Calvin Rose e239980da7 Quasiquoting bracketed tuples. 2019-03-31 14:15:26 -04:00
Calvin Rose 2c9195b507 More updates to meson
Redo amalg script so we can more easily run
it from Meson.
2019-03-23 13:50:50 -04:00
Calvin Rose bad040665f Renamed bigint -> inttypes / int
A lot of refactoring larger integer types. Fix a number
of casting errors, but mostly rename things. Also try to
limit use of template-like macros as they bloat the binary
if not used in moderation. We were able to reduce the size of
typed array code as well by using a single view types.
2019-03-18 18:36:53 -07:00
J.-F. Cap a07d76b264 use custom string to bigint reader in place of strtol
for better compatibility with default janet number reader
2019-03-18 18:36:53 -07:00
J.-F. Cap 1db6d0e0bc Trap INT64_MIN / -1 exception 2019-03-18 18:36:53 -07:00
J.-F. Cap 319575c864 bigint operators and some tests 2019-03-18 18:36:53 -07:00
Quan Nguyen 75dc08ff21 Fix nil error on drop-until fn 2019-03-10 12:39:55 -04:00
Calvin Rose 8ba1121161 Add early returns via break.
Inside a while loop, the argument to
break does nothing as while loops always
return nil.
2019-03-09 22:01:10 -05:00
Calvin Rose 4a111b38b1 Add break special.
The break special form can break out of both loops
and functions with an early (nil) return. Mainly useful
for generated code in macros, and should probably be discouraged
in user written code.
2019-03-09 17:15:50 -05:00
Calvin Rose 687a3c91f5 Add array/remove and update CHANGELOG. 2019-03-08 10:24:21 -05:00
Calvin Rose 0382dc976b More code to better integrate with size_t
Typed arrays use proper size_t support in more
places now.
2019-03-08 00:44:26 -05:00
Calvin Rose 69dcab2b55 Silence some casting size_t to double errors. 2019-03-07 22:44:17 -05:00
Calvin Rose 624be87c97 Add test for :down verb. 2019-03-03 23:55:38 -05: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
Calvin Rose 340a6c4d8d Update marsh.c to use janet_panic for errors.
Before, we used a local setjmp/longjmp for error handling.
Using janet_panic means errors can be more easily expressive and
code can be smaller.

However, we still need to make vector memory get gc collected, as
panics can cause the runtime to skip janet_v_frees.
2019-02-22 10:12:25 -05:00
Calvin Rose f4908ebc41 Update issue 53 regression test.
Some tests did not call assert so did not show up on report.
2019-02-21 19:19:47 -05:00
Calvin Rose 1147482e62 Address #53 - marshalling fiber strangeness
The unmarshaller was not tracking fibers in references.
2019-02-21 19:11:28 -05:00
Calvin Rose 811b1825cb Remove tuple/append and tuple/prepend.
Use the splice special instead.
2019-02-20 21:08:54 -05:00
Calvin Rose a982f351d7 Address #50
Issues with range when called with 3 arguments.
2019-02-20 12:07:20 -05:00
Calvin Rose 029394db31 Add buffer/format as well as string/format.
buffer/format uses the old string/format behavior. `string/format` no
longer requires a buffer, and returns a string.
2019-02-16 13:59:38 -05:00
J.-F. Cap 0f0c415bcf Adde some tests for string/format 2019-02-16 16:28:10 +01:00
Calvin Rose bdf03b4706 Fix unmarshalling integers directly, not through readint. 2019-02-15 14:01:32 -05:00
Calvin Rose c6edf03ae8 Fix some code style, add tuple/type function.
We need to be able to detect tuple type from janet code, otherwise
tuples will contain hidden state. The tuple/type function is able
to detect the flags in the tuple so the programmer can access them
if needed.
2019-02-09 12:21:11 -05:00
Calvin Rose f284776490 Address #24 2019-01-28 20:30:45 -05:00
Calvin Rose 38a7e4faf1 Disallow NaN as table/struct key.
Fix bugs and add tests for denormalized tables
and structs.
2019-01-28 11:50:33 -05:00