1
0
mirror of https://github.com/janet-lang/janet synced 2024-09-28 23:10:40 +00:00
Commit Graph

787 Commits

Author SHA1 Message Date
Calvin Rose
75f1bb6a7c Fix up webclient. 2019-06-24 17:27:03 -04:00
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
a29e717fd7 Start working to a full meson build.
One build system instead of three for Make + Meson + build_win.bat.
2019-06-20 16:33:28 -04:00
Calvin Rose
522545287e Add janet_abstract_begin and janet_abstract_end
This will allow some one constructing an abstract to
only make it visible to the garbage collector after it
is in a valid state. If code in the constructing cfunction
panics before janet_abstract_end is called, the GC will not try
to mark the incomplete abstract type. This is often not needed through
careful programming, but should work well.
2019-06-20 12:37:57 -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
300124961f Change -c option to use dofile instead of require 2019-06-19 22:05:13 -04:00
Calvin Rose
7eb78c8028 Load jimage files before janet source files.
This should allow precompiled files to be placed
right next to the source files in the file system with
the expected behavior.
2019-06-19 20:18:44 -04:00
Calvin Rose
1a7691dade Flatten environment binding tables.
For some reason, these tables used prototypes. There
seems to be no need for this.
2019-06-19 20:07:40 -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
19a0444f41 Appease MSVC 2019-06-19 09:45:56 -04:00
Calvin Rose
0102a72538 Update module/paths for saner defaults.
Relative imports will only check the paths
directly concerning relative imports.
2019-06-19 09:01:21 -04:00
Calvin Rose
264c5bc02b Change default module/path.
Disallow loading directly with extension to be more
consistent and keep things simpler.
2019-06-19 00:34:15 -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
a5e50a0f65 Fix windows getline. 2019-06-18 00:04:29 -04:00
Calvin Rose
7c35acca75 One more MSVC warning. 2019-06-17 23:53:38 -04:00
Calvin Rose
4bb57550c8 Silence some windows build warnings. 2019-06-17 23:50:39 -04:00
Calvin Rose
446ab037b0 Allow marshaling pegs. 2019-06-17 23:40:02 -04:00
Calvin Rose
4adfb9f2d3 Update changelog. 2019-06-17 22:46:38 -04:00
Calvin Rose
9c89d1c658 Inline yield when called with no arguments.
It was already inline when called with one argument.
2019-06-15 12:21:08 -04:00
Calvin Rose
3598f056bb Reformat capi.c 2019-06-15 11:04:24 -04:00
Calvin Rose
779fcf2d54
Merge pull request #124 from ALSchwalm/parse-state
Add support for getting more detailed parser state
2019-06-15 11:00:06 -04:00
Adam Schwalm
3bbc121c6a Add support for getting more detailed parser state 2019-06-15 07:37:01 -05:00
Calvin Rose
82edc19137 Update cook to take headers for natives.
This should help incremental building.
2019-06-13 00:41:20 -04:00
Calvin Rose
5689ef1af1 Add keyword flag utility for modules. 2019-06-12 12:05:48 -04:00
Calvin Rose
647139cdf9 Fix string/check-set.
Also change external unification identifier in match macro
to @. This means we can more easily match symbol literals.
2019-06-10 14:00:51 -04:00
Calvin Rose
6225f8d334 Fix defn docstring typo. 2019-06-09 09:18:16 -04:00
Calvin Rose
43520ac67d Add parser/clone. (#120) 2019-06-08 17:16:36 -04:00
Calvin Rose
802a2d6b71 Add more dynamic bindings for printing. 2019-06-08 15:27:13 -04:00
Calvin Rose
d9a4ef05ac Update docstring format.
Also add :p flag to fiber/new, change implemntation of with-dyns, and
make meson build install static library by default.
2019-06-08 10:30:43 -04:00
Andrew Chambers
2b7428ed2b Add file/{fdopen,fileno} functions. 2019-06-08 10:33:29 +12:00
Calvin Rose
64a80c57e3 Tables created via table_init cannot leak memory.
Before, if Janet paniced without calling table_deinit
on a table created via table_init, Janet leaked memory.
This changes tables so that tables created via table_init
us scratch memory for auto cleanup instead of normal
malloc/free.
2019-06-05 17:08:49 -04:00
Calvin Rose
efb2ab06cb Remove array_init and array_deinit
These functions made it very easy to create memory
leaks, and are better replaced with functions in vector.h or
simply using non-stack allocated arrays.
2019-06-05 16:19:51 -04:00
Calvin Rose
6e8beff0a0 Add optional argument to parser/where to set index.
DSLs that use the parser API can use this to more accurately
report source location.
2019-06-03 10:48:16 -04:00
Calvin Rose
c21eaa5474 Fix redefinition. 2019-06-02 20:09:16 -04:00
Calvin Rose
13667292c6 Expose signal, type, and status name arrays.
Makes it easier to print status stuff.
2019-06-02 20:05:17 -04:00
Adam Schwalm
64bf52372a Allow all-bindings and dynamics to search specific env 2019-06-02 10:12:46 -05:00
Calvin Rose
0a9715a94c Bump version to 1.0.0 2019-06-01 23:52:01 -04:00
Calvin Rose
c82aac1365 Refer to @ as atsign not ampersand. 2019-06-01 23:40:59 -04:00
Calvin Rose
e697cc3811 Make os/execute not leak memory on panics.
Since many calls can panic, it's best
to only use scratch memory for temporary values.
2019-06-01 23:38:10 -04:00
Calvin Rose
c150f2f2c1 Add scratch memory API.
This should make it easier to write
code that does not leak memory on panics.
2019-06-01 23:31:39 -04:00
Calvin Rose
3d76d988c3 More work on installation and moving files around.
Move all installed libraries into auxlib.
Move all installed executable scripts into auxbin.
2019-06-01 10:38:28 -04:00
Calvin Rose
bea6dbbf3d Hint utf8 output on windows console. 2019-05-31 15:30:23 -04:00
Calvin Rose
e1bd24c2ab Make os/execute on windows closer to posix version 2019-05-31 15:02:44 -04:00
Calvin Rose
1f30ea66e9 Windows quick fix. 2019-05-31 13:45:39 -04:00
Calvin Rose
c43aaf8986 More work to os/execute.
Use environ when eflag not given. Also try to escape windows
command line strings correctly.
2019-05-31 13:44:14 -04:00
Calvin Rose
2acc81d1c5 Add noreturn attribute to panic functions. 2019-05-31 10:10:20 -04:00
Calvin Rose
d005ac6888 Appease MSVC. 2019-05-30 19:21:11 -04:00
Calvin Rose
7fdb098a20 Add process.h. 2019-05-30 19:14:54 -04:00
Calvin Rose
a4a200e037 Spawn.h not found in windows. 2019-05-30 19:13:13 -04:00
Calvin Rose
15d95d8803 Windows include issue. 2019-05-30 18:50:52 -04:00
Calvin Rose
46950a8cb3 Convert os/execute to use posix_spawn. 2019-05-30 18:40:10 -04:00
Calvin Rose
c8cf7c2445 Appease MSVC. 2019-05-29 22:12:24 -04:00
Calvin Rose
1b63215aad Remove extra functions. 2019-05-29 22:00:47 -04:00
Calvin Rose
bcbe42ab23 Add API version checking for modules.
Checking now actively implemented for dynamic modules
in a fully backwards compatible way.
2019-05-29 21:58:20 -04:00
Calvin Rose
31f502b508 Add more to util.h to help with amalg build. 2019-05-29 12:07:53 -04:00
Calvin Rose
4d47d92a4a Windows WEXITSTATUS fix? 2019-05-29 11:53:57 -04:00
Calvin Rose
b39ad97a87 Fix up close to return proper exit code. 2019-05-29 11:50:46 -04:00
Calvin Rose
af23040d9c file/close returns an integer.
If opened with popen, returns the exit code. Otherwise
returns nil.
2019-05-29 11:40:58 -04:00
Calvin Rose
fd2d706e33 Add os/remove. 2019-05-29 11:31:19 -04:00
Calvin Rose
7a7f586094 Merge branch 'master' of github.com:janet-lang/janet 2019-05-28 23:03:08 -04:00
Calvin Rose
db55277b58 Work on windows installer.
We will probably shift to NSIS as the default
installation method for windows. Shipping around a
single binary just doesn't cut it if we want to be able
to reliably use tools like `jpm` to build things.
2019-05-28 20:45:39 -04:00
Calvin Rose
486b80fa7b Update changelog, change version to 0.6.0 2019-05-28 13:59:12 -04:00
Andrew Chambers
3c304ddc35 Add api for checking build compatibilty. 2019-05-28 13:51:40 +12:00
Calvin Rose
1696de233c Add jpm tool, based on cook.
Modify cook as well.
2019-05-27 16:50:57 -04:00
Calvin Rose
ce9cd4fcef Issue #113 Color console support for windows 10
Use SetConsoleMode winapi function to enable ANSI
escape codes if we can.
2019-05-26 22:31:30 -04:00
Calvin Rose
698e89aba4 Fix comment macro arity #110 2019-05-25 22:50:15 -04:00
Calvin Rose
4c8dd4b96c Fix shell like scripts. 2019-05-25 19:28:00 -04: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
Calvin Rose
0280deccae Allow filters on templates in module/paths
This lets us make loaders depend on file suffixes, which
lets us more efficiently use full paths.
2019-05-25 16:13:02 -04:00
Calvin Rose
5deb13d73e Update version 1.0.0 instead of 1.0.0-dev 2019-05-24 17:49:33 -04:00
Calvin Rose
010e2e4652 Add keyword arguments via &keys.
This makes it easier to document functions that
take keyword arguments and also prevents some allocations
with these functions. Before, this was possible via normal
variadic functions but created an intermediate tuple, and
the generated docstrings did not document the keys.
2019-05-24 17:03:22 -04:00
Calvin Rose
ddedae6831 Reenable computed gotos - they were disabled. 2019-05-24 13:54:23 -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
b5e6c0b8fc Address #109
Make repl work when default chunks not supplied.
2019-05-22 23:56:59 -04:00
Calvin Rose
98c46fcfb1 Update 2019-05-21 15:35:39 -04:00
Calvin Rose
409da697dd Update JANET_TFLAG_CALLABLE.
Most datatypes in Janet are callable.
2019-05-21 15:33:35 -04:00
Calvin Rose
91c3685705 Remove JANET_WALIGN
It was not used anywhere in the source after some
refactoring to make better use of structs and unions for automatic
alignment.
2019-05-21 11:12:56 -04:00
Calvin Rose
411fc77ecf Make env optional for compile. 2019-05-20 11:34:07 -04:00
Calvin Rose
55d8e8b56b Fix issue with compilation with source name.
Also add tuple/sourcemap and tuple/setmap.
2019-05-20 04:02:38 -04:00
Calvin Rose
97ad4c4f89 Update manpage and make -k mode not exit on error. 2019-05-19 15:20:59 -04:00
Adam Schwalm
f444bd25ef Add a 'compile-only' flag to the command line
This allows syntax checkers like the emacs 'flycheck-mode' to check
the source without side effects.
2019-05-19 12:55:28 -05:00
Andrew Chambers
ec43afb426 Minor documentation fixes. 2019-05-17 20:58:06 +12:00
Calvin Rose
56d903d75b Remove extra closing paren. 2019-05-16 12:12:55 -04:00
Calvin Rose
7054e878fb Add module/loaders for custom file types.
This will allow other languages/DSLs to very easily
integrate with Janet.
2019-05-16 12:05:40 -04:00
Calvin Rose
dde5351d11 Small changes to some doc strings. 2019-05-16 11:43:21 -04:00
Calvin Rose
7d49e3e6f1 Add unification to match macro.
Using a quote on a symbol prevents the match
macro from trying to create a binding to it, and
instead tells it that we are binding to a symbol
that is already in scope.
2019-05-16 10:05:54 -04:00
Calvin Rose
f35b5765d6 Set module/*headerpath* during bootstrap
Cook also uses module/*headerpath* for finding headers
rather than using module/*syspath*.
2019-05-15 10:49:16 -04:00
Calvin Rose
ad0f7d9b0d Merge branch 'master' of github.com:janet-lang/janet 2019-05-15 00:05:00 -04:00
Calvin Rose
f647ac5631 Address #95
A very minimal code change made partition take strings.
2019-05-15 00:04:25 -04:00
Calvin Rose
e4c5eb4c76
Merge pull request #97 from Crestwave/haiku
Add support for Haiku
2019-05-14 21:53:40 -04:00
Crestwave
3b6a51df24 Add support for Haiku 2019-05-15 01:03:17 +00:00
Calvin Rose
f2313b9959 file/read on eof will return nil.
Also add documentation for :exit in import.
Address issue #91
Partially adress issue #93
2019-05-14 11:05:19 -04:00
Calvin Rose
805b3bbb88 Numbers require at least 1 significant digit.
Address issue #96
2019-05-14 08:44:38 -04:00
Calvin Rose
232ea22dc5 Add string/triml, string/trimr, and string/trim. 2019-05-10 16:09:49 -04:00
Calvin Rose
3388acd2db Add dofile function.
Abstracts the actually running of a file from
the require function, so a file can be easily
evaluated without being cached.
2019-05-10 10:19:51 -04:00
Calvin Rose
52ab9fb475 Update cook tool and headers. 2019-05-09 17:37:46 -04:00
Calvin Rose
7a313f6038 Update CHANGELOG, string/has-suffix?|prefix?
string/has-suffix? and string/has-prefix? can now accept
all byte data types for both arguments.
2019-05-09 13:42:14 -04:00