1
0
mirror of https://github.com/janet-lang/janet synced 2024-07-04 11:03:15 +00:00
Commit Graph

138 Commits

Author SHA1 Message Date
Calvin Rose
2dd852da54 Use ATEND macros to add fields to abstract types.
This means we can add new properties to abstract types without
breaking old code. We can also make simple abstract types without
needing to add many NULL fields to the type.
2020-01-20 13:06:50 -06:00
Calvin Rose
f4077b678a Allow calling next on abstracts.
This will allow the creation of infinte
streams, low cost generators, etc.
2020-01-18 18:09:20 -06:00
Calvin Rose
a68ee7aac6 Update Copyright 2020. 2020-01-12 10:50:37 -06:00
Calvin Rose
f361830cb2 Update feature test macro in line.c 2019-12-30 20:24:40 -05: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
d0570b55b1
Merge pull request #231 from andrewchambers/tempfile
Add file/temp.
2019-12-29 20:00:17 -05:00
Calvin Rose
a964a95c1e Fix warnings on BSDs. 2019-12-29 19:53:35 -05:00
Andrew Chambers
c2f8441572 Add file/temp. 2019-12-30 12:00:35 +13:00
Andrew Chambers
2bebace8eb Extend file api to allow creating and checking. 2019-12-30 04:02:46 +13:00
Calvin Rose
022be217a2 Remove ==, not==, and order[<,<=,>,>=].
This unifies equality and comparison checking. Before, we had
separate functions and vm opcodes for comparing general values vs.
for comparing numbers, where the numberic functions were polymorphic and
had special cases for handling NaNs. By unfiying them, abstract types
can now better integrate with other number types and behave as keys.

For now, the old functions are aliased but will eventually be removed.
2019-12-28 16:04:15 -05:00
Andrew Chambers
ddc4274314 Expand docs to explain pclose semantics. 2019-12-28 15:24:10 +13:00
Calvin Rose
b8004555ea Start cleaning up defines in janet.h 2019-12-15 15:41:58 -06:00
Calvin Rose
56784a34a1 Address #224 - Exposed file flags in janet.h
A caller can check if a file is closed with
if (flags & JANET_FILE_CLOSED) ...
2019-12-14 09:03:56 -06:00
Calvin Rose
8700a407ce Update janet_getmethod to better match new get api. 2019-12-09 18:45:05 -06:00
Andrew Chambers
57ccfb692c Abstract type getters can indicate key absence.
This change to the c api allows abstract types to indicate
to the runtime if a key was absent, or if it meant to return nil.
2019-12-09 16:50:33 +13:00
Calvin Rose
e5fbe5c557 Change printf to add trailing newlines.
Also add prinf and eprinf for old behavior. This
is consistent with the naming of print and prin.
2019-12-02 04:45:03 -06:00
Andrew Chambers
88f28773da Add missing fileno method to file, sort method list. 2019-11-28 14:47:16 +13:00
Calvin Rose
c9521e093e Fix windows issue with (file/read file :all)
When file was created with file/popen, the current optimization
of using fseek on windows fails due to windows not properly returning
and error code and just returning 0. Windows :(.
2019-11-11 20:05:00 -05:00
Calvin Rose
bb54b940c0 Don't call fwrite with size = 0 2019-10-19 10:51:11 -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
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
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
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
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
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
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
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
1753f8bc18 Added janet_getfile C API function and revert core/file AT registering 2019-03-02 15:36:34 +01:00
J.-F. Cap
d70049dbb1 Register core/file abstract type 2019-02-27 10:54:10 +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
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
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
f161002390 Address #35 2019-02-15 13:20:20 -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
6321c30cb1 Add methods for file io. 2019-02-06 17:58:27 -05:00
J.-F. Cap
960cf76eb5 Experimental getter/setter for abstract types 2019-02-05 17:14:13 +01: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
3ae6f64de5 Fix popen bug. 2019-01-08 21:42:16 -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
7b28032f5c More explicit casts to please Microsoft compiler. 2019-01-05 21:58:39 -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
e9c94598e6 Add native keyword type to replace symbols with leading ':'
character.
2019-01-02 19:41:07 -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
131ee29190 Add docs target to generate documentation. 2018-12-17 01:41:11 -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
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
98f2c6feab Add lookups for marshalling and unmarshalling.
Allow generating lookup tables from the current environment.
2018-10-21 01:35:07 -04:00
Calvin Rose
c1923c5ada Web assembly build with emscripten. 2018-10-16 23:08:26 -04:00
Calvin Rose
0389971049 No errors compiling on BU linux (CentOS). 2018-09-10 14:54:12 -04: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
510feeed7f Allow marshaling of more functions for core.
Fix indentation in some files.
2018-08-22 21:41:25 -04:00
Calvin Rose
f3480c1c1d Try to silence some appveyor warnings. 2018-08-05 21:32:32 -04:00
Calvin Rose
a1bdc3a023 Better inline for put. Better printing for named functions. 2018-07-10 20:01:39 -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
9805bfb635 Fix file.read to handle popen'ed files better (allow read with :all). 2018-06-26 09:37:34 -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
68895e27d4 Change import semantics. Fix gc bug with fibers. 2018-05-18 20:53:19 -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
70e52d91c4 Add popen function to io.c 2018-05-11 08:13:26 -04:00
Calvin Rose
f47323c915 Change convention for naming modules and functions. 2018-05-08 19:40:28 -04:00
Calvin Rose
55f0e759d9 Add extra information in repl to show state of parsing. 2018-05-06 23:25:59 -04:00
Calvin Rose
53f9c18669 More work on improving errors. 2018-04-29 20:13:04 -04:00
Calvin Rose
2a0dc5f1ad Switch to assymetric coroutines instead of symmetric. 2018-03-11 15:35:23 -04:00
Calvin Rose
3e1f031576 Self host the repl, remove linenoise, and selfhost the
main client.
2018-02-07 00:44:51 -05:00
bakpakin
7bfb3145cb Add some library functions and add newline character to reading line
from file.
2018-02-06 10:31:42 -05:00
Calvin Rose
4971ef58d2 Add fseek. 2018-02-04 12:58:40 -05:00
Calvin Rose
4b89789f69 Add all and line option to file-read 2018-02-04 00:54:38 -05:00
Calvin Rose
a673b7e326 Fix small compiler bug 2018-02-03 17:22:04 -05:00
Calvin Rose
35ddc70888 Move ast into parser. Map keywords to symbols instead of
strings.
2018-02-03 13:55:55 -05:00
Calvin Rose
278769f2bb Fix compiler warnings with GCC. 2018-02-02 17:26:20 -05:00
bakpakin
4f74d57359 Refactor stl to corelib and stl. Corelib is part of vm, stl
is part of dst language. Add bootstrapping code directly into stl.
Stl is now logically grouped with compiler.
2018-01-29 23:38:49 -05:00
bakpakin
b305a7c9bb Add macros in compiler. 2018-01-28 15:29:47 -05:00
bakpakin
30f62ca454 Major refactor and restructure. Add CMake for anticipated windows
support.
2018-01-19 16:43:19 -05:00