Add NetBSD support (#177)
This commit is contained in:
parent
7542b14c5b
commit
9de152667f
4 changed files with 26 additions and 3 deletions
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
|
@ -403,3 +403,18 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
gmake
|
gmake
|
||||||
gmake stats
|
gmake stats
|
||||||
|
|
||||||
|
netbsd:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: build + test
|
||||||
|
uses: vmactions/netbsd-vm@v1
|
||||||
|
with:
|
||||||
|
usesh: true
|
||||||
|
prepare: |
|
||||||
|
/usr/sbin/pkg_add cmake gmake
|
||||||
|
run: |
|
||||||
|
gmake
|
||||||
|
gmake stats
|
||||||
|
gmake test
|
||||||
|
|
6
cutils.h
6
cutils.h
|
@ -225,17 +225,22 @@ static inline void put_u8(uint8_t *tab, uint8_t val)
|
||||||
*tab = val;
|
*tab = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef bswap16
|
||||||
static inline uint16_t bswap16(uint16_t x)
|
static inline uint16_t bswap16(uint16_t x)
|
||||||
{
|
{
|
||||||
return (x >> 8) | (x << 8);
|
return (x >> 8) | (x << 8);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef bswap32
|
||||||
static inline uint32_t bswap32(uint32_t v)
|
static inline uint32_t bswap32(uint32_t v)
|
||||||
{
|
{
|
||||||
return ((v & 0xff000000) >> 24) | ((v & 0x00ff0000) >> 8) |
|
return ((v & 0xff000000) >> 24) | ((v & 0x00ff0000) >> 8) |
|
||||||
((v & 0x0000ff00) << 8) | ((v & 0x000000ff) << 24);
|
((v & 0x0000ff00) << 8) | ((v & 0x000000ff) << 24);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef bswap64
|
||||||
static inline uint64_t bswap64(uint64_t v)
|
static inline uint64_t bswap64(uint64_t v)
|
||||||
{
|
{
|
||||||
return ((v & ((uint64_t)0xff << (7 * 8))) >> (7 * 8)) |
|
return ((v & ((uint64_t)0xff << (7 * 8))) >> (7 * 8)) |
|
||||||
|
@ -247,6 +252,7 @@ static inline uint64_t bswap64(uint64_t v)
|
||||||
((v & ((uint64_t)0xff << (1 * 8))) << (5 * 8)) |
|
((v & ((uint64_t)0xff << (1 * 8))) << (5 * 8)) |
|
||||||
((v & ((uint64_t)0xff << (0 * 8))) << (7 * 8));
|
((v & ((uint64_t)0xff << (0 * 8))) << (7 * 8));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void inplace_bswap16(uint8_t *tab) {
|
static inline void inplace_bswap16(uint8_t *tab) {
|
||||||
put_u16(tab, bswap16(get_u16(tab)));
|
put_u16(tab, bswap16(get_u16(tab)));
|
||||||
|
|
|
@ -947,8 +947,8 @@ int unicode_script(CharRange *cr,
|
||||||
int script_idx;
|
int script_idx;
|
||||||
const uint8_t *p, *p_end;
|
const uint8_t *p, *p_end;
|
||||||
uint32_t c, c1, b, n, v, v_len, i, type;
|
uint32_t c, c1, b, n, v, v_len, i, type;
|
||||||
CharRange cr1_s, *cr1;
|
CharRange cr1_s = { 0 }, *cr1 = NULL;
|
||||||
CharRange cr2_s, *cr2 = &cr2_s;
|
CharRange cr2_s = { 0 }, *cr2 = &cr2_s;
|
||||||
BOOL is_common;
|
BOOL is_common;
|
||||||
|
|
||||||
script_idx = unicode_find_name(unicode_script_name_table, script_name);
|
script_idx = unicode_find_name(unicode_script_name_table, script_name);
|
||||||
|
|
|
@ -71,7 +71,7 @@ typedef sig_t sighandler_t;
|
||||||
#define environ (*_NSGetEnviron())
|
#define environ (*_NSGetEnviron())
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__OpenBSD__) || defined(__FreeBSD__)
|
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
|
||||||
typedef sig_t sighandler_t;
|
typedef sig_t sighandler_t;
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
#endif
|
#endif
|
||||||
|
@ -3589,6 +3589,8 @@ void js_std_set_worker_new_context_func(JSContext *(*func)(JSRuntime *rt))
|
||||||
#define OS_PLATFORM "linux"
|
#define OS_PLATFORM "linux"
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined(__OpenBSD__)
|
||||||
#define OS_PLATFORM "openbsd"
|
#define OS_PLATFORM "openbsd"
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
#define OS_PLATFORM "netbsd"
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
#define OS_PLATFORM "freebsd"
|
#define OS_PLATFORM "freebsd"
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue