1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-12 03:39:56 +00:00
Commit Graph

3215 Commits

Author SHA1 Message Date
Calvin Rose
0e464ded3d Fix meson.build typo. 2019-11-08 18:26:43 -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
58e3e63a89 Add jpm to release bundle. 2019-11-08 11:00:12 -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
25a9804d91 Fix build_win test-install 2019-10-29 20:40:09 -05:00
Calvin Rose
cf19cd5292 Add the quickbin command to jpm.
This is useful for making one off executable scripts
without needing to set up a project.janet file.
2019-10-29 20:33:18 -05:00
Calvin Rose
03824dd9f7 Update CHANGELOG.md 2019-10-29 19:41:48 -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
46e09e4c71 Fix tools/removecr.janet 2019-10-29 18:56:32 -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
b2263ed5b5 Update CHANGELOG.md 2019-10-29 17:52:41 -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
99ef4c7510 Fix an issue with the removecr script 2019-10-19 19:11:13 -04:00
Calvin Rose
b9e05d06fe Update amalg step. 2019-10-19 18:00:29 -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
4149df1fca Update CHANGELOG.md 2019-10-19 10:35:56 -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
655d4b3aad Fix test. 2019-10-13 08:00:43 -05:00
Calvin Rose
5f51476526 Remove a git attribute for linguist. 2019-10-12 22:03:34 -05:00
Calvin Rose
d47b5f8c6a Update CHANGELOG.md 2019-10-11 00:11:19 -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
8ee54e887f Update changelog. 2019-10-10 19:06:16 -05:00
Calvin Rose
088c926196 Add update-pkgs to jpm.
This allows for periodically updating the package listing.
2019-10-10 18:46:24 -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
6ae5a9be60 Add -fvisibility in Makefile, provide meson example commands.
Shaves off 10 kb in binary. Also -fpic -> -fPIC in Makefile and jpm.
2019-10-05 10:38:58 -05:00
Calvin Rose
e9f3dc7d5c Add varfn. 2019-10-03 20:20:42 -05:00
Calvin Rose
841b58042f
Merge pull request #168 from Crestwave/haiku
Fix installation on Haiku
2019-10-02 13:54:03 -04:00
Crestwave
63e3e02a39 Fix installation on Haiku 2019-10-02 05:52:55 +00: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
2becd196dd Fix incomplete error message. 2019-09-25 09:29:29 -05:00
Calvin Rose
bcb45157a8 Update CHANGELOG.md 2019-09-24 21:25:21 -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