Calvin Rose
04805d106e
Simpler overflow check.
2021-01-29 20:11:38 -06:00
Calvin Rose
9aed578466
Address #616 Buffer extra overflow bug.
...
We should have a normal error instead of undefined behavior, wrap
around, or wait for realloc to fail.
2021-01-29 18:32:54 -06:00
Calvin Rose
7b709d4c68
Prevent buffer/trim from shrinking buffer to 0 bytes as well.
2020-12-13 09:38:35 -06:00
Calvin Rose
eab5f67c5c
Fix buffer with NULL data pointer issue.
...
Simply prevent buffers from ever having a NULL data pointer.
2020-12-13 09:33:57 -06:00
Calvin Rose
c4a4916055
Address #500 - update docs and add buffer/push
...
This updates the documentation and adds a function buffer/push, which
is a more useful function than buffer/push-string or buffer/push-byte by
combining both.
2020-12-04 17:56:47 -06:00
Calvin Rose
79f5751375
Add array/trim and buffer/trim.
2020-06-14 17:40:48 -05:00
Calvin Rose
a3d4ecddba
Address #301
...
Incorrect bounds checking and offset calculation in buffer/blit.
2020-03-08 20:44:03 -05:00
Calvin Rose
2349ea9405
Update docs for buffer/push-word
...
Should be little endian, not big endian.
2020-03-01 12:05:24 -06:00
Calvin Rose
333ae7c4f8
Make amalgamtion the default when building.
...
This way we can support fewer build configurations. Also, remove
all undefined behavior due to use of memcpy with NULL pointers. GCC
was exploiting this to remove NULL checks in some builds.
2020-01-28 23:38:52 -06:00
Calvin Rose
4fad0714e7
Add janet_gcpressure. Address #269 .
2020-01-22 20:52:35 -06:00
Calvin Rose
a68ee7aac6
Update Copyright 2020.
2020-01-12 10:50:37 -06:00
Calvin Rose
6c7f376410
Try to remove potential overflow bugs.
...
Also make integer to size_t casts explicit rather than relying on
int32_t * sizeof(x) = size_t. This is kind of a personal preference for
this problem.
2020-01-02 22:08:17 -06:00
Calvin Rose
9dd152dc28
Add features.h for feature test macros.
...
Because we use an amalgated build, feature
test macros should be set in a single file that
is included before any other headers, and is placed
at the top of the amalgamated build.
2019-12-30 19:06:15 -05:00
Calvin Rose
76342540dc
Add buffer/fill. Address #221
2019-12-14 10:54:29 -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
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
b18f1e8127
Keep count fo allocated memory via malloc.
...
We normally only track memory allocated with janet_gcalloc, but
if only a few very large normal memory blocks are allocated, the GC
will never run. Se simply need to increment a count when we allocate
memory so that the next time we enter the VM, we will be able to
run a collection if needed.
2019-07-31 00:24:13 -05: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
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
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
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
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
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
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
97a42ea17b
Address some windows issues in buffer.c
2019-01-14 00:12:25 -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
6f3bc3d577
Update copyright date, fix types, remove trailing whitespace.
2019-01-06 03:23:03 -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
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
28331ad6ab
Update buffer/push-integer to buffer/push-word.
2018-12-29 13:07:18 -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
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
b2a1a4ec9b
Add classes to core library.
2018-11-25 15:58:50 -05:00
Calvin Rose
fcbd24cedc
Add lots of documentation for all functions.
2018-11-16 16:24:10 -05:00
Calvin Rose
945b72468c
Add a lot of documentation for functions.
2018-11-16 02:09:38 -05:00
Calvin Rose
4d119e4e03
Begin adding more complete documentation.
2018-11-15 15:45:41 -05:00
Calvin Rose
2a127af1ca
A few fixes to things like macro expand, etc.
2018-11-07 22:27:06 -05:00
Calvin Rose
c8ef2a0d88
Rename to janet
2018-09-05 22:18:42 -04:00
Calvin Rose
75c66ea6dd
Refactor native module declarations. marshal can now
...
serialize entire environment.
2018-08-26 14:35:01 -04:00
Calvin Rose
a018f9f54a
Major refactor. Move files around, merge compiler into
...
core and other changes, work on inlining many c functions.
2018-07-03 23:07:35 -04:00
Calvin Rose
fb409201b4
Strip trailing whitespace from many files.
...
Add native modules to import with module.native-path.
2018-05-19 21:16:00 -04:00
Calvin Rose
f295692b50
Update copyright to 2018. Add string methods.
2018-05-17 23:41:20 -04:00
Calvin Rose
dafc121f4d
Change c function macros to be explicitly non functional by
...
capitalizing them.
2018-05-12 20:31:28 -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