diff --git a/.builds/meson.yml b/.builds/meson.yml index 889decd7..a3a6324f 100644 --- a/.builds/meson.yml +++ b/.builds/meson.yml @@ -10,5 +10,5 @@ tasks: cd build ninja ninja test - mkdir modpath - jpm --verbose --modpath=./modpath install https://github.com/bakpakin/x43bot.git + doas ninja install + doas jpm --verbose install circlet diff --git a/CHANGELOG.md b/CHANGELOG.md index ece21574..184e826b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog All notable changes to this project will be documented in this file. +## ??? - Unreleased +- Fix jpm and git with multiple git installs on Windows +- Fix importing a .so file in the current directory +- Allow passing byte sequence types directly to typed-array constructors. +- Fix bug sending files between threads. + ## 1.11.0 - 2020-07-18 - Add `forever` macro. - Add `any?` predicate to core. diff --git a/Makefile b/Makefile index 11c2bd27..8fb212ba 100644 --- a/Makefile +++ b/Makefile @@ -156,7 +156,7 @@ build/janet.c: build/janet_boot src/boot/boot.janet ##### Amalgamation ##### ######################## -SONAME=libjanet.so.1.10 +SONAME=libjanet.so.1.11 build/shell.c: src/mainclient/shell.c cp $< $@ diff --git a/README.md b/README.md index 5be52330..55b4fe71 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@   [![Appveyor Status](https://ci.appveyor.com/api/projects/status/bjraxrxexmt3sxyv/branch/master?svg=true)](https://ci.appveyor.com/project/bakpakin/janet/branch/master) [![Build Status](https://travis-ci.org/janet-lang/janet.svg?branch=master)](https://travis-ci.org/janet-lang/janet) -[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/freebsd.yml.svg)](https://builds.sr.ht/~bakpakin/janet/freebsd.yml?) -[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/openbsd.yml.svg)](https://builds.sr.ht/~bakpakin/janet/openbsd.yml?) -[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/meson.yml.svg)](https://builds.sr.ht/~bakpakin/janet/meson.yml?) -[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/meson_min.yml.svg)](https://builds.sr.ht/~bakpakin/janet/meson_min.yml?) +[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/freebsd.yml.svg)](https://builds.sr.ht/~bakpakin/janet/commits/freebsd.yml?) +[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/openbsd.yml.svg)](https://builds.sr.ht/~bakpakin/janet/commits/openbsd.yml?) +[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/meson.yml.svg)](https://builds.sr.ht/~bakpakin/janet/commits/meson.yml?) +[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/meson_min.yml.svg)](https://builds.sr.ht/~bakpakin/janet/commits/meson_min.yml?) Janet logo diff --git a/jpm b/jpm index 9dcb66c7..219f4019 100755 --- a/jpm +++ b/jpm @@ -688,7 +688,7 @@ int main(int argc, const char **argv) { (if stored-git-path (break stored-git-path)) (set stored-git-path (if is-win - (or (os/getenv "JANET_GIT") (pslurp "where git")) + (or (os/getenv "JANET_GIT") (first (string/split "\n" (pslurp "where git")))) (os/getenv "JANET_GIT" "git")))) (defn uninstall diff --git a/meson.build b/meson.build index 7577f749..9bc2bfe9 100644 --- a/meson.build +++ b/meson.build @@ -20,7 +20,7 @@ project('janet', 'c', default_options : ['c_std=c99', 'b_lundef=false', 'default_library=both'], - version : '1.11.0') + version : '1.11.1') # Global settings janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet') diff --git a/src/conf/janetconf.h b/src/conf/janetconf.h index 5dddeb99..b96ec231 100644 --- a/src/conf/janetconf.h +++ b/src/conf/janetconf.h @@ -28,9 +28,9 @@ #define JANET_VERSION_MAJOR 1 #define JANET_VERSION_MINOR 11 -#define JANET_VERSION_PATCH 0 -#define JANET_VERSION_EXTRA "" -#define JANET_VERSION "1.11.0" +#define JANET_VERSION_PATCH 1 +#define JANET_VERSION_EXTRA "-dev" +#define JANET_VERSION "1.11.1-dev" /* #define JANET_BUILD "local" */ diff --git a/src/core/corelib.c b/src/core/corelib.c index b8b58747..157ff028 100644 --- a/src/core/corelib.c +++ b/src/core/corelib.c @@ -63,10 +63,29 @@ typedef void *Clib; #define error_clib() dlerror() #endif +static char *get_processed_name(const char *name) { + if (name[0] == '.') return (char *) name; + const char *c; + for (c = name; *c; c++) { + if (*c == '/') return (char *) name; + } + size_t l = (size_t)(c - name); + char *ret = malloc(l + 3); + if (NULL == ret) { + JANET_OUT_OF_MEMORY; + } + ret[0] = '.'; + ret[1] = '/'; + memcpy(ret + 2, name, l + 1); + return ret; +} + JanetModule janet_native(const char *name, const uint8_t **error) { - Clib lib = load_clib(name); + char *processed_name = get_processed_name(name); + Clib lib = load_clib(processed_name); JanetModule init; JanetModconf getter; + if (name != processed_name) free(processed_name); if (!lib) { *error = janet_cstring(error_clib()); return NULL; diff --git a/src/core/io.c b/src/core/io.c index 4dbcee58..2b2c1c1b 100644 --- a/src/core/io.c +++ b/src/core/io.c @@ -339,6 +339,7 @@ static int io_file_get(void *p, Janet key, Janet *out) { static void io_file_marshal(void *p, JanetMarshalContext *ctx) { JanetFile *iof = (JanetFile *)p; if (ctx->flags & JANET_MARSHAL_UNSAFE) { + janet_marshal_abstract(ctx, p); #ifdef JANET_WINDOWS janet_marshal_int(ctx, _fileno(iof->file)); #else diff --git a/src/core/typedarray.c b/src/core/typedarray.c index 0e29ed09..649e3397 100644 --- a/src/core/typedarray.c +++ b/src/core/typedarray.c @@ -376,21 +376,29 @@ static Janet cfun_typed_array_new(int32_t argc, Janet *argv) { if (argc > 3) offset = janet_getsize(argv, 3); if (argc > 4) { - if (!janet_checktype(argv[4], JANET_ABSTRACT)) { - janet_panicf("bad slot #%d, expected ta/view|ta/buffer, got %v", - 4, argv[4]); - } - void *p = janet_unwrap_abstract(argv[4]); - if (janet_abstract_type(p) == &janet_ta_view_type) { - JanetTArrayView *view = (JanetTArrayView *)p; - offset = (view->buffer->data - view->as.u8) + offset * ta_type_sizes[view->type]; - stride *= view->stride; - buffer = view->buffer; - } else if (janet_abstract_type(p) == &janet_ta_buffer_type) { - buffer = p; + int32_t blen; + const uint8_t *bytes; + if (janet_bytes_view(argv[4], &bytes, &blen)) { + buffer = janet_abstract(&janet_ta_buffer_type, sizeof(JanetTArrayBuffer)); + ta_buffer_init(buffer, (size_t) blen); + memcpy(buffer->data, bytes, blen); } else { - janet_panicf("bad slot #%d, expected ta/view|ta/buffer, got %v", - 4, argv[4]); + if (!janet_checktype(argv[4], JANET_ABSTRACT)) { + janet_panicf("bad slot #%d, expected ta/view|ta/buffer, got %v", + 4, argv[4]); + } + void *p = janet_unwrap_abstract(argv[4]); + if (janet_abstract_type(p) == &janet_ta_view_type) { + JanetTArrayView *view = (JanetTArrayView *)p; + offset = (view->buffer->data - view->as.u8) + offset * ta_type_sizes[view->type]; + stride *= view->stride; + buffer = view->buffer; + } else if (janet_abstract_type(p) == &janet_ta_buffer_type) { + buffer = p; + } else { + janet_panicf("bad slot #%d, expected ta/view|ta/buffer, got %v", + 4, argv[4]); + } } } JanetTArrayView *view = janet_tarray_view(type, size, stride, offset, buffer);