1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-16 13:44:48 +00:00

Merge branch 'master' into ev

This commit is contained in:
Calvin Rose 2020-08-03 07:54:53 -05:00
commit 5899671d96
6 changed files with 33 additions and 3 deletions

View File

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
## Unreleased - ??? ## Unreleased - ???
- Silence warnings in some compilers. - Silence warnings in some compilers.
- Add `index-of` to core library.
## 1.11.1 - 2020-07-25 ## 1.11.1 - 2020-07-25
- Fix jpm and git with multiple git installs on Windows - Fix jpm and git with multiple git installs on Windows

View File

@ -41,10 +41,10 @@ SONAME_SETTER=-Wl,-soname,
# For cross compilation # For cross compilation
HOSTCC?=$(CC) HOSTCC?=$(CC)
HOSTAR?=$(AR) HOSTAR?=$(AR)
CFLAGS?=-fPIC -O2 CFLAGS?=-O2
LDFLAGS?=-rdynamic LDFLAGS?=-rdynamic
COMMON_CFLAGS:=-std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden COMMON_CFLAGS:=-std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC
BOOT_CFLAGS:=-DJANET_BOOTSTRAP -DJANET_BUILD=$(JANET_BUILD) -O0 -g $(COMMON_CFLAGS) BOOT_CFLAGS:=-DJANET_BOOTSTRAP -DJANET_BUILD=$(JANET_BUILD) -O0 -g $(COMMON_CFLAGS)
BUILD_CFLAGS:=$(CFLAGS) $(COMMON_CFLAGS) BUILD_CFLAGS:=$(CFLAGS) $(COMMON_CFLAGS)

View File

@ -115,6 +115,11 @@ gmake test
gmake repl gmake repl
``` ```
### NetBSD
NetBSD build instructions are the same as the FreeBSD build instuctions.
Alternatively, install directly from packages, using `pkgin install janet`.
### Windows ### Windows
1. Install [Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15#) or [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15#) 1. Install [Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15#) or [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15#)

View File

@ -957,6 +957,18 @@
(def i (find-index pred ind)) (def i (find-index pred ind))
(if (= i nil) nil (in ind i))) (if (= i nil) nil (in ind i)))
(defn index-of
"Find the first key associated with a value x in a data structure, acting like a reverse lookup.
Will not look at table prototypes.
Returns dflt if not found."
[x ind &opt dflt]
(var k (next ind nil))
(var ret dflt)
(while (not= nil k)
(when (= (in ind k) x) (set ret k) (break))
(set k (next ind k)))
ret)
(defn take (defn take
"Take first n elements in an indexed type. Returns new indexed instance." "Take first n elements in an indexed type. Returns new indexed instance."
[n ind] [n ind]
@ -1212,7 +1224,7 @@
res) res)
(defn any? (defn any?
"Returns the first truthy valye in ind, otherwise nil. "Returns the first truthy value in ind, otherwise nil.
falsey value." falsey value."
[ind] [ind]
(var res nil) (var res nil)

View File

@ -38,4 +38,11 @@
#define _XOPEN_SOURCE 500 #define _XOPEN_SOURCE 500
#endif #endif
/* Needed for timegm and other extensions when building with -std=c99.
* It also defines realpath, etc, which would normally require
* _XOPEN_SOURCE >= 500. */
#if !defined(_NETBSD_SOURCE) && defined(__NetBSD__)
#define _NETBSD_SOURCE
#endif
#endif #endif

View File

@ -230,6 +230,11 @@ extern "C" {
* To turn of nanboxing, for debugging purposes or for certain * To turn of nanboxing, for debugging purposes or for certain
* architectures (Nanboxing only tested on x86 and x64), comment out * architectures (Nanboxing only tested on x86 and x64), comment out
* the JANET_NANBOX define.*/ * the JANET_NANBOX define.*/
#if defined(_M_ARM64) || defined(_M_ARM) || defined(__aarch64__)
#define JANET_NO_NANBOX
#endif
#ifndef JANET_NO_NANBOX #ifndef JANET_NO_NANBOX
#ifdef JANET_32 #ifdef JANET_32
#define JANET_NANBOX_32 #define JANET_NANBOX_32