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
Calvin Rose
bbcfaf1289
Fix use after free bug in buffer/format when printing self.
2019-05-08 15:25:25 -04:00
Calvin Rose
bfb0cb331e
No temporary buffer in PR #87
2019-05-08 10:53:23 -04:00
Andrew Chambers
1759252071
Fix use after free in buffer/push-string.
2019-05-08 10:49:25 -04:00
Calvin Rose
fff60b053b
Use memmove in buffer/blit when needed.
2019-05-08 09:29:21 -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
Calvin Rose
ff720f1320
Expose current fiber via janet_current_fiber().
2019-05-04 19:07:04 -04:00
Calvin Rose
88b8418253
Add simple tracing functionality to VM.
...
Also disable debugger for normal errors.
2019-05-04 15:05:00 -04:00
Calvin Rose
4fa1b28cad
Update changelog (string module)
...
Also run `make format` on code.
2019-05-04 10:11:52 -04:00
Andrew Chambers
c70d59edee
Add string/has-prefix? and string/has-suffix?.
2019-05-04 10:05:58 -04:00
Calvin Rose
1cfc7b3b0d
Add preliminary debugger to default repl.
...
Also upddate colors, and fix formatting.
2019-05-02 17:11:30 -04:00
Calvin Rose
bfb354b469
Fix 32 bit platforms.
2019-04-28 16:22:24 -04:00
Calvin Rose
25a93ac4a6
Fix loop :iterate.
2019-04-28 00:34:32 -04:00
Calvin Rose
0bad523913
Fix wrap functions.
2019-04-27 19:47:32 -04:00
Calvin Rose
5b36199aea
Fix MSVC warning.
2019-04-27 16:50:40 -04:00
Calvin Rose
f10028d41a
Add function versions of macro API bindings.
...
This should help address #81 . Also hide janet_exit
and janet_assert, as they are really meant for internal usage.
I have not verified that this yet actually works with Rust's
bindgen.
2019-04-27 15:47:12 -04:00
Calvin Rose
73b81e0253
Fix os/date doc typo.
2019-04-23 22:43:51 -04:00
Calvin Rose
20e94adb61
Update documentation for update function.
2019-04-21 15:44:03 -04: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
4ddf90e301
Make nanboxing on 64 bit platforms not the default.
...
64 bit nanboxing is kind of sketchy on non x86 architectures.
32 bit architectures seem to work better as the 32 implementation
doesn't rely on the format of the address space and layout of
double's in memory.
2019-04-18 12:52:28 -04:00
Calvin Rose
d1eca1cf52
Add all-dynamics to list current dynamic bindings.
2019-04-17 09:47:33 -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
513d551df6
Move print in source code to io module.
...
print now reads the dynamic binding for :out
when choosing where to write to.
2019-04-16 19:10:01 -04:00
Calvin Rose
ddaa5e34e6
Fix web versinon repl colors.
2019-04-16 16:06:52 -04:00
Calvin Rose
208eb7520a
Update CHANGELOG.md and bump version.
2019-04-16 15:48:53 -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
7527142549
Prepare for 0.4.1 release
2019-04-14 11:42:41 -04:00
Calvin Rose
4e6193b67e
Fix parse insert bug.
2019-04-13 14:38:30 -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
5287007cd6
Fix typo in comment.
2019-04-09 09:05:47 -04:00
Calvin Rose
e5a56174e2
Switch fexists to use os/stat when available.
...
When os/stat is not available, we first
try to read one byte from the file before
saying it is good. If that fails, it is not
a file that we can read from so it counts as not found.
2019-04-09 09:01:52 -04:00
Calvin Rose
6c68c7a35f
Address issue #78
...
(file/open path :r+) should help. On windows, result
is unknown as of now.
2019-04-09 08:38:56 -04:00
Calvin Rose
675c1030fd
Fix error message on an arity mismatch.
...
janet_call had a bad janet_printf.
2019-04-07 23:53:50 -04:00
Calvin Rose
ed65d04b81
Fix peg bug with arguments.
...
By holding on a reference to argv for a long time, we
may trigger a use after free bug if the stack is resized. In
janet c function, argv is only vvalid up until the next stack operation
on the fiber. We could say that this is the dynamic lifetime of
argv.
To fix this, we copy extra arguments into a tuple, which is properly
garbage collected.
2019-04-07 15:14:54 -04:00
Calvin Rose
fa1c5c85b5
Remove no-capture mode in pegs.
...
Some peg grammars could not capture values based on their position in a
larger grammar. This is a design limitation inheritted from LPeg, but no
longer needed as the replace mode is superseded by the accumulator mode,
which is more general if slightly harder to use.
2019-04-06 11:38:00 -04:00
Calvin Rose
ee35786c8f
semicolon
2019-04-05 14:45:45 -04:00
Calvin Rose
ec6e2cfd62
os/stat returns nil if file does not exist.
2019-04-05 14:45:04 -04:00
Calvin Rose
7d48e7fd1f
Remove some extra search paths.
2019-04-01 14:07:13 -04:00
Calvin Rose
0063e3a69d
Fix module path typo.
2019-04-01 13:48:30 -04:00
Calvin Rose
cd6c009c03
Reformat and use new os/stat capabilities.
2019-04-01 11:21:45 -04:00
Calvin Rose
b15cf193a0
Update os/stat
...
os/stat can now take a keyword as the second argument
to avoid creating a table if one only wants on value
from stat.
2019-04-01 11:11:15 -04:00
Calvin Rose
e239980da7
Quasiquoting bracketed tuples.
2019-03-31 14:15:26 -04:00
Calvin Rose
1709bce77e
Add os/rm and os/rmdir
2019-03-30 15:39:24 -04:00
Calvin Rose
d6ba2de888
Fix os/dir on windows.
2019-03-30 13:46:52 -04:00
Calvin Rose
61c0a4bc87
Windows has different defines for file modes.
2019-03-30 13:09:35 -04:00
Calvin Rose
8af28d3fa5
Windows bump.
2019-03-30 13:06:24 -04:00
Calvin Rose
970923d0e5
Update os/dir for windows.
2019-03-30 13:01:57 -04:00
Calvin Rose
5d7dc0a57c
Add os/dir support for linux/posix.
2019-03-30 12:36:27 -04:00
Calvin Rose
c5090606a4
Add os/stat function.
...
Allows getting more information about files. This
is really useful for writing software that needs to inspect
the file system (like a static site generator). We still need
a way to iterate directories though.
2019-03-30 12:06:14 -04:00
Calvin Rose
bf2d9ae634
Mess with includes for os.c
2019-03-28 23:34:24 -04:00
Calvin Rose
53c7f2eedd
Add more os module functions.
2019-03-28 23:23:58 -04:00
Calvin Rose
bfd3845218
Fix cfunction debugging issue
...
Cfunction were not describing themselves very well, as
their names were not be added to the registry.
2019-03-27 00:14:51 -04:00
J.-F. Cap
22d75d017f
fix AbstractType get/set error message
2019-03-26 21:47:12 -04:00
Calvin Rose
082639319e
Add colors to repl and string/format.
...
This makes the repl look nicer using ANSI
color codes, which are widely supported. The codes
can also be turned off via the -m flag.
2019-03-24 15:00:22 -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
7f1b5d4d70
Merge core.janet into boot.janet
...
This simplifies the build machinery a bit.
core.janet is never actually included in the final
binary, it is just used to generate an image file.
2019-03-22 18:34:50 -04:00
Calvin Rose
25aa7a26c5
Add experimental meson build.
...
Should help with IDE integration.
2019-03-22 18:07:10 -04:00
Calvin Rose
cb2caecbb3
Add janetconf.h for configuring builds.
...
Rather than edit the Makefile or the janet.h header yourself, use
janetconf.h to configure builds. This has the benefit of making it
easier to configure janet in a persitent but easy way.
2019-03-22 14:33:30 -04:00
Calvin Rose
94a2084723
Add tostring method for abstract types.
...
This lets abstract types customize how they
print for debugging.
2019-03-19 13:36:26 -04:00
Calvin Rose
22e24fb47b
Remove some dead code in bigint.
2019-03-19 12:30:44 -04:00
Calvin Rose
93f0d5f626
Quiet appveyor warnings.
2019-03-18 22:00:20 -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
34849ea7b3
added (u)int64 typed arrays back
2019-03-18 18:36:53 -07:00
J.-F. Cap
5a9f7c3a85
added in place op! operators
2019-03-18 18:36:53 -07:00
J.-F. Cap
15c6300608
added bitwise operators and guard for division by zero
2019-03-18 18:36:53 -07:00
J.-F. Cap
c6a4485623
code cleanup
2019-03-18 18:36:53 -07:00
J.-F. Cap
090c6ac975
added marshal/unmarshal
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
J.-F. Cap
42a0af3b1b
bigint pretty printing
2019-03-18 18:36:53 -07:00
J.-F. Cap
9bc899ccf2
added core/bigint.c
2019-03-18 18:36:53 -07:00
J.-F. Cap
d29e3a1199
first experiment with bigint
2019-03-18 18:36:53 -07:00
rncar
41bb6a9833
Added a getter to the new pointer type.
2019-03-14 14:21:44 -04:00
Calvin Rose
95e54c66b6
Use one tag type true and false
...
We moved the literals true and false into one tag
type, so we an extra tag for raw pointer types
(light userdata). These can be used from the C API via
janet_wrap_pointer and janet_unwrap_pointer.
2019-03-13 14:50:25 -04:00
Calvin Rose
31e2415bbb
Fix some indentation problems.
2019-03-12 20:56:16 -04:00
Calvin Rose
2a5234b390
Properly bail on parse and compile errors
...
If -p flag is not set, we should bail on all three kinds
of errors, not just runtime errors. This includes
parse and compile errors. Before, parse and compile errors
were not properly affected by the :exit parameter to require, which
in turn caused scripts to not bail on parse or compile errors.
2019-03-12 20:41:17 -04:00
Calvin Rose
d42bdf2443
Add proper optional arguments.
...
Use &opt in the parameter list to get optional arguments.
2019-03-12 00:23:14 -04:00
Calvin Rose
a246877c1e
Remove iterate-template from exported core symbols.
2019-03-11 01:01:59 -04:00
Calvin Rose
e12aace02c
Update web build.
2019-03-10 23:06:10 -04:00
Calvin Rose
51a9c7104d
Hide each-template
2019-03-10 13:31:42 -04:00
Quan Nguyen
75dc08ff21
Fix nil error on drop-until fn
2019-03-10 12:39:55 -04:00
Quan Nguyen
609a9621af
Correct doc for drop-until fn
2019-03-10 11:36:27 +07: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
9a080197e7
Switch some instances of loop in core
...
Several instances of loop in the core library are
switched over to the simpler each and for macros.
2019-03-09 21:01:47 -05:00
Calvin Rose
e65375277a
Update the loop macro.
...
Using the new break special form, the loop
macro was cleaned up. Loop bindings are also
able to be used immediately after declaration, so
forms like (loop [x :range [0 10] :while (< x 5)] (print x)) will
now compile correctly.
2019-03-09 20:47:07 -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
a363dce943
Allow proper overriding of cfunctions in the core.
...
Allow overriding functions in the core libray to provide better
functionality on startup. Used to include our getline function in
the repl but use a simpler version in the core library.
2019-03-08 11:39:18 -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
c4f6f1d256
janet_marshal_bytes, janet_unmarshal_bytes size_t
...
Instead of a int32_t as the length argument, use
size_t to match up better with typearray.c and probably
most idiomatic C libraries.
Janet uses int32_t for length internally for consistency, space
efficiency, ability to fit int32_t in double, and various
other reasons.
2019-03-07 22:23:46 -05:00
Calvin Rose
b57e530553
Some more small changes to typedarray.c.
...
We want to compile janet with MSVC warning free.
2019-03-07 22:12:06 -05:00
Calvin Rose
021b71ad62
Allow proper serialization of size_t in marsh.c
...
Typed arrays used size_t in serialization: C APIs will
also often use it, so it makes sense to add first class support
for it rather than assume it will will fint into an integer.
These changes should quiet some visual studio warnings.
Also make some spacing more consistent.
2019-03-07 22:08:44 -05:00
Calvin Rose
0ee2ff1b05
Add :fiber-flags options to run-context.
...
This also improves eval-string error behavior.
2019-03-07 18:55:19 -05:00
Calvin Rose
adaa014d7c
No div by 0 - will fix later.
2019-03-07 16:20:36 -05:00
Calvin Rose
dc9dc98e80
Update for issue #62
2019-03-07 16:17:18 -05:00
Calvin Rose
4a2d4f52b5
Allow inverted ranges with negative steps.
2019-03-04 15:44:56 -05:00
Calvin Rose
8d37e544ab
Fix BSD builds.
...
Try to silence some more undefined C warnings
with -fsanitize=undefined.
2019-03-04 12:16:49 -05:00
Calvin Rose
b07adce2b9
Fix some issues found with -fsanitize=undefined
...
Leave in issues with calling memcpy with size=0. If these
become a problem, will probably add a janet_memcpy as memcpy
is used so much in the code without 0 checks.
2019-03-04 11:17:34 -05:00
Calvin Rose
1b9591b5e3
Add :down verb to loop macro.
...
Also remove with-idemp from core, which was both confusing
(to the author) and not generally useful.
2019-03-03 23:52:20 -05:00
Calvin Rose
8cc2c964c1
Add :export option to import
...
Also allow NULL ptr to janet_getfile for flags.
2019-03-02 11:46:31 -05:00
J.-F. Cap
7fef5be3af
Merge remote-tracking branch 'upstream/master' into register-corefile
2019-03-02 15:38:31 +01:00
J.-F. Cap
1753f8bc18
Added janet_getfile C API function and revert core/file AT registering
2019-03-02 15:36:34 +01:00
Calvin Rose
7d17159ae4
Make JANET_STACK_MAX configurable option.
...
Also double default value from 8192 to 16384
2019-02-27 16:28:43 -05:00
Calvin Rose
3014a59c3e
Fix parse error with comment on last line.
...
If a comment is not followed by a newline character, then
we got a false parse error. This is because the comment
state is left on the parse stack when we finished parsing, and
since the parse stack was not emtpy, we assumed an error.
This commit adds the parser/eof function, which lets the parser know
that an eof was reached. Before, we simply added a fake newline
character in some cases, and in the case of reading a file, we did
nothing, hence the bug.
2019-02-27 13:59:25 -05:00
J.-F. Cap
d70049dbb1
Register core/file abstract type
2019-02-27 10:54:10 +01:00
Calvin Rose
4713219317
Update whitespace and some doc strings.
2019-02-25 23:48:04 -05:00
J.-F. Cap
59393fc73b
Added some guards in ta_view unmarshalling
...
to protect against bad marshalled data.
2019-02-26 02:28:24 +01:00
J.-F. Cap
3eb44f1f79
Fix buffer allocation
2019-02-26 00:21:03 +01: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
632b920e97
fix C format
2019-02-24 22:36:35 +01:00
J.-F. Cap
c81bf42f6b
Merge remote-tracking branch 'upstream/master' into typed-array-work
2019-02-24 22:25:33 +01:00
J.-F. Cap
4147c0ce1f
Added typed array C API
2019-02-24 22:24:18 +01:00
Calvin Rose
602e30a421
Add "\v" string esca[e sequence.
2019-02-24 14:46:16 -05:00
Calvin Rose
9495be328c
Be more careful about data alignment
...
Alingment issues can happen anywhere we do casting
on pointer types. Be more careful in the peg module about
ensuring that pointers are aligned well.
2019-02-24 13:43:38 -05:00
J.-F. Cap
0eae75a5c2
added MARSH_EOS check
2019-02-24 18:45:14 +01:00
J.-F. Cap
8e0d7f2539
Merge remote-tracking branch 'upstream/master' into typed-array
2019-02-24 03:06:26 +01:00
J.-F. Cap
9c1c7fb384
Remove AT id use name as tag
2019-02-24 02:51:34 +01:00
J.-F. Cap
af48912f11
Simplify Abstract type introspection
2019-02-24 02:02:54 +01:00
Calvin Rose
327d2ed849
Remove extra "compile error: " string.
2019-02-23 15:38:49 -05:00
J.-F. Cap
db64a682be
fix incompatibilities with upstream/master changes in marsh.c
2019-02-23 17:54:09 +01:00
J.-F. Cap
4d3c655058
Merge remote-tracking branch 'upstream/master' into typed-array
2019-02-23 17:36:38 +01:00
J.-F. Cap
2becebce92
fix C source format
2019-02-23 17:13:43 +01:00
J.-F. Cap
0cc6c6ff33
implement typed array marshal/unmarshal and
...
generic marshaling capabilities to abstract types.
2019-02-23 16:58:47 +01:00
Calvin Rose
115bc6140b
Fix NULL ptr issue.
2019-02-22 17:12:34 -05:00
Calvin Rose
b14fcb068b
Update janet_pcall interface
...
The programmer can now not only get the used fiber, but
provide a fiber to reuse if many calls are made in succession.
2019-02-22 17:10:24 -05:00
Calvin Rose
2ea28f29b0
Shut up some warnings from clang's static analyzer.
...
Not particularly useful actually, by and large false positives.
2019-02-22 12:10:27 -05:00
J.-F. Cap
7cb1c7cef2
added ta marshalling
2019-02-22 17:41:27 +01:00
Calvin Rose
9d60e8b343
Address issue #54
...
Bug when marshalling function environments that were still on a fiber
stack.
2019-02-22 10:16:32 -05: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
J.-F. Cap
e5a4c6fc2b
Merge remote-tracking branch 'upstream/master' into ta-with-marshal
2019-02-22 15:58:47 +01:00
J.-F. Cap
db9ac6dba5
marshal buffer ok
2019-02-22 15:57:48 +01:00
J.-F. Cap
d570aae817
Merge branch 'ta-marshal' into ta-with-marshal
2019-02-22 11:13:12 +01:00
J.-F. Cap
59e4b15fad
added some abstract type instrospection capabilities
...
registering abstract type in vm_register table
2019-02-22 10:54:22 +01:00
Calvin Rose
beed839d12
Remove the callable? predicate.
...
Many times are callable now in some circumstances, so
the predicate is not that useful.
2019-02-21 20:38:22 -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
J.-F. Cap
4d07176f1c
work in progress
2019-02-21 20:52:39 +01:00
Calvin Rose
8cff3dd2c3
Fix one more warning.
2019-02-21 11:46:39 -05:00
Calvin Rose
df550efb6b
Fix MSVC compiler warnings.
2019-02-21 11:34:04 -05:00
Calvin Rose
00a47dc0cb
Begin work on new memory layout for all objects and GC.
...
The layout should actually be very similar to the old layout, but
the code will be much easier to change and should be more portable.
2019-02-21 11:22:29 -05:00
Calvin Rose
811b1825cb
Remove tuple/append and tuple/prepend.
...
Use the splice special instead.
2019-02-20 21:08:54 -05:00
J.-F. Cap
2ca252bc0e
Merge remote-tracking branch 'upstream/master' into typed-array
2019-02-21 01:43:22 +01:00
J.-F. Cap
6054858359
fix C format
2019-02-21 00:20:54 +01:00
J.-F. Cap
1d50fd9485
First exeperiments with JS style Binary Typed Arrays
2019-02-21 00:15:48 +01:00
Calvin Rose
a982f351d7
Address #50
...
Issues with range when called with 3 arguments.
2019-02-20 12:07:20 -05:00
Calvin Rose
27a274b686
Update some corelib functions.
...
Some corelib functions that were created via janet_quickasm
were missing some flags for arity checking, so they were marked as
accepting any arity.
2019-02-19 23:41:16 -05:00
Calvin Rose
cb002e7b84
Update generating tools to produce stylish code.
...
Really small whitespace changes in generated code.
2019-02-19 21:28:22 -05: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
Dan Skorupski
ef5f80ad38
Fix indentation, converting some tabs to spaces.
2019-02-19 17:54:13 -06:00
Calvin Rose
dbcbb4466d
We don't need to add module/\*headerpath\*.
...
We can just dump janet.h into the lib folder as well.
2019-02-18 22:25:40 -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
8d9a88e759
Add JANET_PATH back in.
2019-02-18 15:31:15 -05:00
Calvin Rose
6af5800d21
Add -m option to command line
...
The -m option set the default system path for finding libraries
for that invocation of Janet.
2019-02-18 15:11:59 -05:00
Calvin Rose
540b326c54
Simpler way to set JANET_PATH at compile time.
2019-02-18 14:48:29 -05:00
Calvin Rose
660a2b41ae
Set module/*syspath*
to JANET_PATH at build time
...
The takes out the hardcoded reference to /usr/local/
2019-02-18 14:31:23 -05:00
Calvin Rose
07912f5ab2
Update comments in strtod.c
2019-02-17 21:44:58 -05:00
Calvin Rose
ffc14f6019
Oops, peg option issue fixed.
2019-02-17 21:25:30 -05:00
Calvin Rose
1e70c97ef0
Allow enabling/disabling of peg module.
...
Use compiler define -DJANET_NO_PEG to turn off the peg module.
2019-02-17 21:22:03 -05:00
Calvin Rose
6d5ff43de7
Make amalg build cleaner.
...
Don't pull in a global header <janet/janet.h> unless we need to.
2019-02-16 23:33:24 -05:00
Calvin Rose
3b6ff3c09a
Add -c option to main client
...
This allows compile janet source modules to images.
2019-02-16 21:55:53 -05:00
Calvin Rose
0ce5acec89
Begin cleaning up string API.
...
Remove string/pretty in favor of buffer/format and string/format. Also
drop string/number, which is more verbose and less flexible than
string/format.
2019-02-16 15:12:34 -05:00
Calvin Rose
44e31cac5d
Merge pull request #40 from jfcap/string-format
...
string/format
2019-02-16 15:02:47 -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
Calvin Rose
00020ba8ab
Whitspace and style changes.
2019-02-16 13:40:51 -05:00
Calvin Rose
1f91ee30fe
Make require simpler and module/find more useful.
...
This replaces a lot of the functionality in require by moving
it to module/find. module/native-paths and module/image-paths are also
merged into the one module/paths to make it easier to extend. This of
course breaks some of the less important API - module/native-paths no
longer exists.
2019-02-16 13:21:29 -05:00
J.-F. Cap
a6f022a73d
Added string/format function (snprintf like)
2019-02-16 03:29:04 +01:00
Calvin Rose
2e1ec3700d
Fix compilier warning on -Os, gcc.
2019-02-15 19:01:47 -05:00
Calvin Rose
9e6b1d1b16
Add images.
...
Images are precompiled libraries. They can be created programmatically
via the `write-image` function and then loaded with `require` or
`import`. They can also be run by the command line tool - you must
specify the path to the image without the .jimage extension.
2019-02-15 18:56:41 -05:00
Calvin Rose
bdf03b4706
Fix unmarshalling integers directly, not through readint.
2019-02-15 14:01:32 -05:00
Calvin Rose
4d96ba3ba9
Merge branch 'master' of github.com:janet-lang/janet
2019-02-15 13:21:00 -05:00
Calvin Rose
f161002390
Address #35
2019-02-15 13:20:20 -05:00
J.-F. Cap
e0d26629e0
Fix buffer (and string) used as callee for indexing.
2019-02-12 23:40:59 +01:00
Calvin Rose
17783c3c3e
Add tuple/brackets
...
Fix macro expansion via macex for bracketed tuples.
2019-02-11 18:37:59 -05:00
Calvin Rose
c64e92a5de
Add some unused math functions.
...
Several functions from the C math library were
forgotten in the math module. These have been
added to the core library.
2019-02-10 12:03:22 -05:00
J.-F. Cap
c6672e62ac
Added math/abs binding
2019-02-10 14:06:10 +01: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
J.-F. Cap
5020a1bae9
Added marshalling code to save tuple_flag
2019-02-09 17:00:35 +01:00
J.-F. Cap
86ba69c16b
Merge remote-tracking branch 'upstream/master' into crazy-brackets
2019-02-08 23:45:55 +01:00
J.-F. Cap
5f70024f87
Experimental stuffs with bracket syntax
2019-02-08 21:49:28 +01:00
Calvin Rose
114a45306d
Add more specialization for marshaling integers.
...
This decreases the core image size by about 16.5k.
2019-02-08 10:14:36 -05:00
Calvin Rose
fe27df528c
Boot core library from image rather than source
...
This should speed up start time and reduce malloc/free
usage to about 15% of what is what previously for startup.
The current cost is slightly larger binary as the representaion
of the image is currently less compact than source code.
2019-02-08 00:44:30 -05:00
J.-F. Cap
8ab60e475a
typo in janet_indexed_view
...
(no consequence but look strange)
2019-02-08 01:10:07 +01:00
Calvin Rose
6321c30cb1
Add methods for file io.
2019-02-06 17:58:27 -05:00
Calvin Rose
74e1a3273f
Add method syntax to parser.
2019-02-05 19:43:41 -05:00
Calvin Rose
f6a3853131
Merge pull request #30 from jfcap/get-set-abstract
...
Get set abstract
2019-02-05 19:09:56 -05:00
J.-F. Cap
960cf76eb5
Experimental getter/setter for abstract types
2019-02-05 17:14:13 +01:00
Calvin Rose
1b735564fa
Update copyright.
2019-02-03 15:34:41 -05:00
Calvin Rose
cb5263d2d8
Remove extra comment.
2019-02-03 15:32:39 -05:00
Calvin Rose
8a3f512746
Experimental changes to janet_call to make it faster.
...
Remove setjmp and fiber creationg from janet_call. This
adds the constraint to janet_call can only be called when there
is already a current fiber.
2019-02-01 11:56:25 -05:00
Calvin Rose
19e59705b9
Main rule in peg is always 0
...
After we changed peg bytecode emission to
preallocate space for an instruction before
emitting sub rules, the rules are numbered
in the order that they are compiled. This means
that the main rule is always 0.
We can remove the explicitly stored main rule in
the peg structure.
2019-01-31 23:39:33 -05:00
Calvin Rose
367c9da856
Fix some typos and update style.
...
Add bars.janet tool for templating arbitrary
strings, especially HTML.
2019-01-31 22:38:59 -05:00
Calvin Rose
4bcf6565cd
Add parser/insert and bump to 0.4.0
2019-01-31 14:48:28 -05:00
Calvin Rose
0c950d0846
Fix emscripten build.
2019-01-31 13:02:09 -05:00
Calvin Rose
7ba925c50a
Make getline more useful.
2019-01-31 12:34:22 -05:00
Calvin Rose
cb3b9dd76f
Update changelog an fix typos.
2019-01-31 10:09:34 -05:00
Calvin Rose
c76f4e89d8
Remove redundancies in stacktraces.
...
There was an implementation for stacktraces in both
run.c and in core.janet, status-pp. The commit removes
the one in core.janet in favor of the C based stacktrace, which
is exposed via debug/stacktrace. Lots of reshuffling of run-context
ensued as well, which resulted in an api that is a bit cleaner.
2019-01-30 23:11:12 -05:00
Calvin Rose
85a211b26b
Remove extra vector function.
2019-01-30 21:22:40 -05:00
Calvin Rose
46c540b93e
Add math headers for emscripten
...
We now check for NaN in table.c and struct.c
as we disallow NaN keys.
2019-01-29 18:18:14 -05:00
Calvin Rose
32c209ede9
Address #25
2019-01-29 13:59:08 -05:00
Calvin Rose
0d293cd3f5
Update require to use real path name rather than module name.
2019-01-28 21:48:13 -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
Calvin Rose
c333cbfa55
0.3.0
2019-01-26 21:40:04 -05:00
Calvin Rose
d85892edc8
0.3.1
2019-01-26 21:34:08 -05:00
Calvin Rose
68e00cdb7a
Update slurp and spit error handler.
2019-01-26 17:27:05 -05:00
Calvin Rose
e755f98300
Address #23
2019-01-25 20:31:08 -05:00
Calvin Rose
611543c48b
Add source amalgamation
...
The amalgamated source concatenates all sources
to a file janet.c which can be used for
embedding janet, much in the same way as sqlite
or mongoose.
2019-01-24 00:15:58 -05:00
Calvin Rose
795e7a9de8
Make os/date results more consistent.
2019-01-20 16:49:39 -05:00
Calvin Rose
090a6a8c5c
Add optional env arguments to eval functions.
2019-01-20 16:06:30 -05:00
Calvin Rose
2bbf9fdcc5
Add os/date to core library.
2019-01-20 14:34:33 -05:00
Calvin Rose
737b2449f0
Update highlight and the mainclient.
2019-01-20 10:05:51 -05:00
Calvin Rose
48b179d67e
Add slurp and spit to the core library.
2019-01-19 22:00:33 -05:00
Calvin Rose
bf8d5da3dc
Fix possible memory leak on buffer overflow.
...
(All buffer push functions can panic (longjmp), skipping
deinit. Instead, we should use the garbage collected api).
2019-01-19 12:32:52 -05:00
Calvin Rose
5ba969f91d
Make match macro prettier.
2019-01-18 15:24:58 -05:00
Calvin Rose
26818a5e5c
Fix doc generation.
2019-01-18 12:26:04 -05:00
Calvin Rose
b84b0e4828
Expose more of the module system.
...
The system path can more easily modified at runtime,
and the module/cache and module/loading tables are now exposed.
Properly cache native modules as well.
2019-01-18 12:04:34 -05:00
Calvin Rose
b4934ceddc
Make parser errors a bit better for files with no closing
...
delimiters.
2019-01-17 23:43:46 -05:00
Calvin Rose
c4114fbcdb
Add quote special to peg syntax to make captures terser.
2019-01-17 19:28:42 -05:00
Calvin Rose
95f2bbe0a0
Add highlight.janet tool which can highlight
...
janet source code and output html or terminal escaped code.
Also made re entrant calls into the vm provide better
error messages.
2019-01-17 18:12:26 -05:00
Calvin Rose
63137b8107
Fix parsing bug for numbers.
2019-01-17 12:32:51 -05:00
Calvin Rose
2c1b506213
Add tagged captures for a better (more correct) form of look behind.
2019-01-16 22:38:11 -05:00
Calvin Rose
612a245961
More work on peg. Disable indexed backrefs and replace substitution
...
with accumulation.
2019-01-16 21:11:55 -05:00
Calvin Rose
82cddef5bb
Update man page and add early exit to number scanning for parser.
2019-01-16 12:32:33 -05:00
Calvin Rose
d0fc29338c
Add error special form in Peg to allow construction of grammar errors
...
for more useful grammars that could eventually be used in a compiler.
2019-01-15 16:04:47 -05:00
Calvin Rose
4eeadd7463
Add optional form to peg (shorthand for (between 0 1 patt)).
2019-01-15 14:08:03 -05:00
Calvin Rose
3a9b50ea4a
Update peg doc and remame some peg specials.
2019-01-14 22:17:13 -05:00
Calvin Rose
1304f9263b
Update peg docs and make bad backrefs not error the whole pattern, but just cause the current match attempt to fail.
2019-01-14 21:47:55 -05:00
Calvin Rose
90313afd40
Update PEG documentation and peg syntax.
...
Disable tail calls in the root scope for better
stacktraces, as the root scope may contain a single call
to a failing function, as in the case of the test suite.
2019-01-14 20:41:32 -05:00
Calvin Rose
99f176f37b
Fix windows build warnings.
2019-01-14 17:48:32 -05:00
Calvin Rose
d0ec89c7c1
Update Matchtime captures to not include all of the
...
matched text automatically, and fix pattern recursion
in grammars.
2019-01-14 17:44:21 -05:00
Calvin Rose
170e785b72
Fix recursion in grammars.
2019-01-14 15:06:35 -05:00
Calvin Rose
e53778d5d8
Remove annoying (fiber) text from stacktrace.
2019-01-14 12:08:36 -05:00
Calvin Rose
192705113e
Add Matchtime captures to peg (Equivalent to LPegs lpeg.Cmt).
...
This allows that pattern to call an external function to
check if some text should match or not. This allows for
matching any possible language a computer can recognize.
2019-01-14 11:45:45 -05:00
Calvin Rose
97a42ea17b
Address some windows issues in buffer.c
2019-01-14 00:12:25 -05:00
Calvin Rose
2cd489b9d4
Address windows build warnings.
2019-01-14 00:09:27 -05:00
Calvin Rose
ff0d3a0081
Compile pegs to bytecode with (peg/compile). Peg
...
performance is improved, and peg syntax has been expanded with a few
more keywords.
2019-01-13 23:54:41 -05:00
Calvin Rose
282c02c475
Update comments and text.
2019-01-12 20:22:03 -05:00
Calvin Rose
798c88b4c8
Update peg to allow functions over captures. Update C API
...
to make janet function calls easier and faster from C (still
needs an object pool for fibers, though). Fix bug in scan-number
and add many more peg tests.
2019-01-12 17:31:15 -05:00
Calvin Rose
83f4a11bf3
Add some more tests, add parameterized captures to patterns,
...
and fix some bugs.
2019-01-12 11:04:47 -05:00
Calvin Rose
d7626f8c57
Add more capturing capabilities including substitutions, as well
...
as back references for PEGs. More documentation is needed for PEG
syntax, but the amount required will need an external document, not
just a docstring.
2019-01-12 10:16:25 -05:00
Calvin Rose
1efca2ebe7
Add some preliminary capturing ability to PEGs.
2019-01-11 21:09:49 -05:00
Calvin Rose
40845b5c1b
Initial peg implementation. Tree walk interpretted with
...
no captures, so not yet ready.
2019-01-11 19:22:24 -05:00
Calvin Rose
84fb07dd5a
Add quiet option to main client.
2019-01-10 17:10:12 -05:00
Calvin Rose
62cb3f81fe
Fix sorting in asm.c. Add README text.
2019-01-09 17:09:16 -05:00
Calvin Rose
16ebb11181
Add buffer/bit functions and buffer/blit. Expose janet_gethalfrange
...
in the C api for less duplicated range checking code.
2019-01-09 13:25:51 -05:00
Calvin Rose
115ed9cbb9
Move pretty printing to separate file pp.c
...
Simplify string.c and remove janet_puts.
2019-01-09 11:47:29 -05:00
Calvin Rose
3ae6f64de5
Fix popen bug.
2019-01-08 21:42:16 -05:00
Calvin Rose
5b1a3b8208
Make grammar tool completely generate grammar from scratch.
...
Remove grammar from source tree.
2019-01-08 19:59:54 -05:00
Calvin Rose
b1e0849a2f
Restore old status logic - (status checks in run_vm should be using
...
the previous status, not the current which is always JANET_STATUS_ALIVE)
2019-01-08 13:42:29 -05:00
Calvin Rose
67f26b7d72
Fix = should have been ==. Add some tests for vm type asserts.
2019-01-08 12:26:01 -05:00
Calvin Rose
aa079e3145
Fix parser regression.
2019-01-07 14:49:38 -05:00
Calvin Rose
d64a57297d
Update examples, add method like semantics to calling keywords.
2019-01-07 14:47:47 -05:00
Calvin Rose
be85196de8
Add callgrind task to Makefile.
...
Unify some parser states.
2019-01-06 21:49:24 -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
63dd6d03f4
Fix english
2019-01-06 12:05:40 -05:00
Calvin Rose
2a79d2e749
Remove check for function calls to enable all types,
...
even nil. Now any value can be called as a function, usually
looking itself up in an associative data structure.
2019-01-06 11:56:40 -05:00
Calvin Rose
6f3bc3d577
Update copyright date, fix types, remove trailing whitespace.
2019-01-06 03:23:03 -05:00
Calvin Rose
ef5eed2c21
Add source location to doc macro.
2019-01-06 02:10:56 -05:00
Calvin Rose
5865692401
Surround embedded documentation with a macro so it
...
can be disabled in a future build.
2019-01-06 01:49:56 -05:00
Calvin Rose
b626e73d19
Add extra argument to (native) to allow for passing
...
in custom environment to add stuff to.
2019-01-05 23:37:10 -05:00
Calvin Rose
b535c91ee1
Fix native module issue.
2019-01-05 22:52:28 -05:00
Calvin Rose
7b28032f5c
More explicit casts to please Microsoft compiler.
2019-01-05 21:58:39 -05:00
Calvin Rose
0fdd404a71
Remove duplicate functionality in string.c
2019-01-05 21:23:44 -05:00
Calvin Rose
1f98eff33a
Fix compiler warnings on emscripten.
2019-01-05 20:52:32 -05:00
Calvin Rose
338b31f5a2
Add janet_fixarity. Update emscripten source.
2019-01-05 20:45:24 -05:00
Calvin Rose
b60e3e302a
Update C API to use friendlier functions rather than macros.
...
Error handling is implemented with setjmp/longjmp so code
can be more concise. This required a very large but straight forward refactor for all
of the libraries.
2019-01-05 20:09:03 -05:00
Calvin Rose
5b62c8e6db
Better working panic implementation and more cleanup in main vm loop.
2019-01-05 00:33:20 -05:00
Calvin Rose
cd6a7793e8
WIP panic functionality.
2019-01-04 23:20:34 -05:00
Calvin Rose
5afb00859a
More cleanup in vm.c
2019-01-04 21:15:37 -05:00
Calvin Rose
001917f8d9
Begin clean up of vm.c
...
Replace the oparg macro with 5 named virtual registers, combine
pc++ with vm_next() macro to be more terse, and move setup and
teardown logic of janet_continue into a separate function.
These changes are preparation for using setjmp/longjmp to do
error handling in the VM. Introducing longjmp for error handling in
the VM would allow it to be used in the C API, which could result in
simpler, more compact code.
2019-01-04 20:08:43 -05:00
Calvin Rose
b9c0fc8201
Allow calling keywords and symbols as functions to look
...
themselves up in a data structure. Allow calling a data
structure to look up the argument.
2019-01-03 22:48:43 -05:00
Calvin Rose
d8b0a5ed01
Make parser API more robust - the value queue is now
...
distinct from the parse state, and is queried separately.
2019-01-03 20:48:54 -05:00
Calvin Rose
dd3fc24a1e
Make number syntax a bit stricter - no leading underscores
...
and no underscores in exponent.
2019-01-03 12:13:14 -05:00
Calvin Rose
337a498edb
Fix some keyword related issues.
2019-01-02 22:08:51 -05:00
Calvin Rose
5fff36d047
Remove janet_symbol_from_string api function.
2019-01-02 20:50:31 -05:00
Calvin Rose
58d480539c
Fix assembler labels after keyword update.
2019-01-02 19:55:42 -05:00
Calvin Rose
e9c94598e6
Add native keyword type to replace symbols with leading ':'
...
character.
2019-01-02 19:41:07 -05:00
Calvin Rose
29ec30c79f
Fix number parsing for bases between 2 and 9.
...
Allow multisyms to have number keys.
2019-01-02 16:39:24 -05:00
Calvin Rose
122312dbf6
Fix some typos and update comments.
2019-01-02 12:21:59 -05:00
Calvin Rose
618f8d6818
Add with-syms and combine bignat_add and bignatr mul
...
into a single operation for strtod.c
2019-01-02 10:23:11 -05:00
Calvin Rose
6b4824c2ab
Fix error behavior when calling functions with incorrect arities.
2018-12-30 18:41:44 -05:00
Calvin Rose
8dde89126e
Fix -s flag in janet binary.
2018-12-30 18:23:29 -05:00
Calvin Rose
56927e1b81
Fix -e option.
2018-12-30 17:51:15 -05:00
Calvin Rose
9e6254bf56
Rename pre-walk and post-walk to prewalk and postwalk.
2018-12-30 15:34:01 -05:00
Calvin Rose
fe22a8db39
Fix 32 bit platforms janet number handling.
2018-12-30 14:23:52 -05:00
Calvin Rose
d724c5b959
Update number representation so that wrapping numbers isn't
...
doesn't need to check for NaNs. Change ordering of types.
2018-12-30 12:37:50 -05:00
Calvin Rose
ca9c017ec4
Remove some unnecessary bounds checks.
2018-12-29 20:07:56 -05:00
Calvin Rose
7880d73201
Add some documentation for looping and the loop macro.
...
Also add :pairs verb to the loop macro and some more tests.
2018-12-29 17:23:31 -05:00
Calvin Rose
28331ad6ab
Update buffer/push-integer to buffer/push-word.
2018-12-29 13:07:18 -05:00
Calvin Rose
129ec1e3c5
Don't use initialization syntax {0}.
2018-12-29 12:02:51 -05:00
Calvin Rose
bdcd3a3dbf
Update strtod.c, cleaning up code.
...
Rename Mant -> BigNat, fix multiply code
so we can use 31 bits per digit.
2018-12-29 11:29:20 -05:00
Calvin Rose
b06f7226c4
Add number test.
2018-12-29 01:16:54 -05:00
Calvin Rose
2bcedd5920
Remove indexing with numeric constants from janet.
2018-12-28 23:44:39 -05:00
Calvin Rose
5c84f0f5d9
Work on number code for more expected behavior and better rounding.
...
Still needs work and testing.
2018-12-28 23:32:09 -05:00
Calvin Rose
e9a80d4e4a
Bump version, fix doc and typos, update grammar.
2018-12-27 13:36:27 -05:00
Calvin Rose
1ec7f04642
Avoid warning in asm.c on windows.
2018-12-27 13:19:16 -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
6c8da9fe5c
Install cook tool when installing janet.
2018-12-25 15:39:24 -05:00
Calvin Rose
17283241ab
Fix bug in compiler with if form under certain conditions.
...
Begin bundled 'cook' tool for managing janet projects.
2018-12-25 15:32:42 -05:00
Calvin Rose
2c94aa1a6a
Update min fiber size.
2018-12-23 23:38:49 -05:00
Calvin Rose
70b4c8ae84
Add some forms ported from clojure/walk
...
Add as-> and as?-> macros.
2018-12-23 19:00:16 -05:00
Calvin Rose
6c91e5fae0
Merge branch 'master' of github.com:bakpakin/janet
2018-12-23 14:13:38 -05:00
Calvin Rose
55c091e898
Update core.janet
2018-12-23 14:13:27 -05:00
Calvin Rose
9723ddb96b
Fix string/number issue.
2018-12-22 16:24:08 -05:00
Calvin Rose
cc5b4eac0a
Update documentation, fix life example.
2018-12-17 21:28:45 -05:00
Calvin Rose
77ea11c603
Update documentation to include source
...
location of bindings.
2018-12-17 12:06:50 -05:00
Calvin Rose
131ee29190
Add docs target to generate documentation.
2018-12-17 01:41:11 -05:00
Calvin Rose
99e14a9b70
Rename bitwise operators.
2018-12-16 22:13:48 -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
8333c22e8a
Update gendoc and fix issue with run-context.
2018-12-16 13:17:30 -05:00
Calvin Rose
e286e82144
Add docstring for make-env
2018-12-15 23:22:51 -05:00
Calvin Rose
8a5ede21f7
Fix some documentation and add beginning of a document
...
generating script.
2018-12-15 23:19:28 -05:00
Calvin Rose
fb6dd2c83f
Add debug functions to janet.h
...
Update version to 0.2.0 for next release.
Fix whitespace in build_win.bat
2018-12-15 13:52:07 -05:00
Calvin Rose
b2146a4c1d
Update web client.
2018-12-13 21:36:19 -05:00
Calvin Rose
df13a8b967
Fix typo.
2018-12-13 21:16:04 -05:00
Calvin Rose
56e5c19aa9
Add debug/arg-stack, and add slots debug/stack.
...
These features should help implementing a debugger.
2018-12-13 19:23:07 -05:00
Calvin Rose
e8c0dcd14e
Make source mapping use byte offset instead of line and col
...
for better debugging support in repl. Add debug module for better
debugging support.
2018-12-13 18:46:53 -05:00
Calvin Rose
21d4b8fe1f
Move tools out of src (src should be
...
only code that goes into final binary).
2018-12-09 17:49:00 -05:00
Calvin Rose
bb918d0fda
Update README.md. Prepare for 0.1.0 release.
2018-12-08 18:10:17 -05:00
Calvin Rose
997d5cf2c6
Strip whitespace
2018-12-08 17:56:31 -05:00
Calvin Rose
64d842d2ef
Update build script, remove windows build issues.
2018-12-08 17:40:05 -05:00
Calvin Rose
6185af7227
Try to remove build issues on windows.
2018-12-08 17:20:24 -05:00
Calvin Rose
16e514b351
Update version schema - now have version number
...
and build number.
2018-12-08 14:17:03 -05:00
Calvin Rose
bc8be266f5
Update match macro to test for array/tuples and table/structs.
2018-12-08 11:04:19 -05:00
Calvin Rose
b250679789
Move match into core library.
2018-12-08 10:53:22 -05:00
Calvin Rose
b7d44ba742
Fix compiler optimization for if.
...
Add pattern matching library.
2018-12-07 23:57:19 -05:00
Calvin Rose
f2743aca36
Improve pretty printing for table and struct
...
entry values.
2018-12-06 17:26:59 -05:00
Calvin Rose
7668cd5772
Don't use generated headers for embedded janet
...
code, use object files.
2018-12-06 14:30:11 -05:00
Calvin Rose
97fade8197
Make eval not the same as eval string.
2018-12-05 20:48:29 -05:00
Calvin Rose
89bd38890e
Replace unquote-splicing with a more general splce special form.
...
This allows splicing behavior in normal function calls.
2018-12-05 15:10:04 -05:00
Calvin Rose
484597eaae
Remove outer form from loop.
2018-12-05 11:25:36 -05:00
Calvin Rose
bf4dd0da99
Remove some extra commented out code.
2018-12-03 23:23:14 -05:00
Calvin Rose
11cd1279d7
Update Makefile and fix fiber issues. When
...
creating an invalid fiber with the C api, the
program could segfault. This protects against this kind
of segafault.
2018-12-02 15:29:21 -05:00
Calvin Rose
06733cc48d
Update webrepl.
2018-11-30 22:54:17 -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
25c50f5026
Fix repl default chunks.
2018-11-30 14:17:10 -05:00
Calvin Rose
464edf729b
Re-implement and and or macros to use simple
...
imperative loop.
2018-11-30 13:05:28 -05:00
Calvin Rose
523d909cca
Fix bug in pretty printing.
2018-11-30 11:46:05 -05:00
Calvin Rose
f8ab60f487
Add some more array combinators and built in functions.
2018-11-30 11:42:13 -05:00