mirror of https://github.com/janet-lang/janet
Remove pthreads from shell.c and update bsd build.
This commit is contained in:
parent
01120dfc46
commit
785757f2f6
|
@ -5,27 +5,27 @@ packages:
|
||||||
- gmake
|
- gmake
|
||||||
- meson
|
- meson
|
||||||
tasks:
|
tasks:
|
||||||
- build: |
|
- gmake: |
|
||||||
cd janet # Makefile testing on BSD.
|
cd janet
|
||||||
gmake
|
gmake
|
||||||
gmake test
|
gmake test
|
||||||
doas gmake install
|
doas gmake install
|
||||||
gmake test-install
|
gmake test-install
|
||||||
doas gmake uninstall
|
- meson_min: |
|
||||||
rm -rf build # clean up
|
cd janet
|
||||||
meson setup build --buildtype=release -Dsingle_threaded=true -Dnanbox=false -Ddynamic_modules=false -Ddocstrings=false -Dnet=false -Dsourcemaps=false -Dpeg=false -Dassembler=false -Dint_types=false -Dtyped_array=false -Dreduced_os=true # meson minimum build
|
meson setup build_meson_min --buildtype=release -Dsingle_threaded=true -Dnanbox=false -Ddynamic_modules=false -Ddocstrings=false -Dnet=false -Dsourcemaps=false -Dpeg=false -Dassembler=false -Dint_types=false -Dtyped_array=false -Dreduced_os=true
|
||||||
cd build
|
cd build_meson_min
|
||||||
ninja # will not pass tests but should build
|
ninja
|
||||||
cd ..
|
- meson_prf: |
|
||||||
rm -rf build # clean up
|
cd janet
|
||||||
meson setup build --buildtype=release -Dprf=true # meson (with prf)
|
meson setup build_meson_prf --buildtype=release -Dprf=true
|
||||||
cd build
|
cd build_meson_prf
|
||||||
ninja
|
ninja
|
||||||
ninja test
|
ninja test
|
||||||
cd ..
|
- meson_default: |
|
||||||
rm -rf build
|
cd janet
|
||||||
meson setup build --buildtype=release # meson (default build)
|
meson setup build_meson_default --buildtype=release
|
||||||
cd build
|
cd build_meson_default
|
||||||
ninja
|
ninja
|
||||||
ninja test
|
ninja test
|
||||||
doas ninja install
|
doas ninja install
|
||||||
|
|
|
@ -126,28 +126,21 @@ https://github.com/antirez/linenoise/blob/master/linenoise.c
|
||||||
#define JANET_LINE_MAX 1024
|
#define JANET_LINE_MAX 1024
|
||||||
#define JANET_MATCH_MAX 256
|
#define JANET_MATCH_MAX 256
|
||||||
#define JANET_HISTORY_MAX 100
|
#define JANET_HISTORY_MAX 100
|
||||||
static int gbl_israwmode = 0;
|
JANET_THREAD_LOCAL static int gbl_israwmode = 0;
|
||||||
static const char *gbl_prompt = "> ";
|
JANET_THREAD_LOCAL static const char *gbl_prompt = "> ";
|
||||||
static int gbl_plen = 2;
|
JANET_THREAD_LOCAL static int gbl_plen = 2;
|
||||||
static char gbl_buf[JANET_LINE_MAX];
|
JANET_THREAD_LOCAL static char gbl_buf[JANET_LINE_MAX];
|
||||||
static int gbl_len = 0;
|
JANET_THREAD_LOCAL static int gbl_len = 0;
|
||||||
static int gbl_pos = 0;
|
JANET_THREAD_LOCAL static int gbl_pos = 0;
|
||||||
static int gbl_cols = 80;
|
JANET_THREAD_LOCAL static int gbl_cols = 80;
|
||||||
static char *gbl_history[JANET_HISTORY_MAX];
|
JANET_THREAD_LOCAL static char *gbl_history[JANET_HISTORY_MAX];
|
||||||
static int gbl_history_count = 0;
|
JANET_THREAD_LOCAL static int gbl_history_count = 0;
|
||||||
static int gbl_historyi = 0;
|
JANET_THREAD_LOCAL static int gbl_historyi = 0;
|
||||||
static int gbl_sigint_flag = 0;
|
JANET_THREAD_LOCAL static int gbl_sigint_flag = 0;
|
||||||
static struct termios gbl_termios_start;
|
JANET_THREAD_LOCAL static struct termios gbl_termios_start;
|
||||||
static JanetByteView gbl_matches[JANET_MATCH_MAX];
|
JANET_THREAD_LOCAL static JanetByteView gbl_matches[JANET_MATCH_MAX];
|
||||||
static int gbl_match_count = 0;
|
JANET_THREAD_LOCAL static int gbl_match_count = 0;
|
||||||
static int gbl_lines_below = 0;
|
JANET_THREAD_LOCAL static int gbl_lines_below = 0;
|
||||||
|
|
||||||
/* Put a lock around this global state so we don't screw up
|
|
||||||
* the terminal in a multithreaded situation */
|
|
||||||
#ifndef JANET_SINGLE_THREADED
|
|
||||||
#include <pthread.h>
|
|
||||||
static pthread_mutex_t gbl_lock = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Unsupported terminal list from linenoise */
|
/* Unsupported terminal list from linenoise */
|
||||||
static const char *badterms[] = {
|
static const char *badterms[] = {
|
||||||
|
@ -169,9 +162,6 @@ static char *sdup(const char *s) {
|
||||||
/* Ansi terminal raw mode */
|
/* Ansi terminal raw mode */
|
||||||
static int rawmode(void) {
|
static int rawmode(void) {
|
||||||
struct termios t;
|
struct termios t;
|
||||||
#ifndef JANET_SINGLE_THREADED
|
|
||||||
pthread_mutex_lock(&gbl_lock);
|
|
||||||
#endif
|
|
||||||
if (!isatty(STDIN_FILENO)) goto fatal;
|
if (!isatty(STDIN_FILENO)) goto fatal;
|
||||||
if (tcgetattr(STDIN_FILENO, &gbl_termios_start) == -1) goto fatal;
|
if (tcgetattr(STDIN_FILENO, &gbl_termios_start) == -1) goto fatal;
|
||||||
t = gbl_termios_start;
|
t = gbl_termios_start;
|
||||||
|
@ -185,9 +175,6 @@ static int rawmode(void) {
|
||||||
return 0;
|
return 0;
|
||||||
fatal:
|
fatal:
|
||||||
errno = ENOTTY;
|
errno = ENOTTY;
|
||||||
#ifndef JANET_SINGLE_THREADED
|
|
||||||
pthread_mutex_unlock(&gbl_lock);
|
|
||||||
#endif
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,9 +182,6 @@ fatal:
|
||||||
static void norawmode(void) {
|
static void norawmode(void) {
|
||||||
if (gbl_israwmode && tcsetattr(STDIN_FILENO, TCSADRAIN, &gbl_termios_start) != -1)
|
if (gbl_israwmode && tcsetattr(STDIN_FILENO, TCSADRAIN, &gbl_termios_start) != -1)
|
||||||
gbl_israwmode = 0;
|
gbl_israwmode = 0;
|
||||||
#ifndef JANET_SINGLE_THREADED
|
|
||||||
pthread_mutex_unlock(&gbl_lock);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int curpos(void) {
|
static int curpos(void) {
|
||||||
|
|
Loading…
Reference in New Issue