use isatty as a default for notui

This commit is contained in:
dzaima 2023-05-25 00:16:16 +03:00
parent 650be21129
commit 227dfa20c7
4 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DIR="$(dirname $0)" DIR="$(dirname $0)"
PREV_BQN="$DIR/obj2/for_build2" PREV_BQN="$DIR/obj2/for_build3"
if [ ! -f "$PREV_BQN" ]; then if [ ! -f "$PREV_BQN" ]; then
TMP_BQN="$DIR/obj2/for_build_tmp" TMP_BQN="$DIR/obj2/for_build_tmp"
if make -C "$DIR/.." for-build OUTPUT="$TMP_BQN"; then if make -C "$DIR/.." for-build OUTPUT="$TMP_BQN"; then

View File

@ -22,7 +22,7 @@ opts ← ⟨
1, "verbose", 0, "Log more things" 1, "verbose", 0, "Log more things"
1, "rebuild", 0, "Forcibly rebuild everything" 1, "rebuild", 0, "Forcibly rebuild everything"
1, "quiet", 0, "Don't output final status line (or any, combined with notui)" 1, "quiet", 0, "Don't output final status line (or any, combined with notui)"
1, "notui", 0, "disable live-updating status display"@+10 1, "notui", @, "disable live-updating status display"@+10
1, "rebuild-singeli", 0, @ 1, "rebuild-singeli", 0, @
0, "CC", @, "The used C compiler" 0, "CC", @, "The used C compiler"
@ -165,7 +165,7 @@ po ← { # parsed options
J {𝕊: vGetOpt "j" v@? •ParseFloat v; •ParseFloat4 "4" TrySH "nproc"} J {𝕊: vGetOpt "j" v@? •ParseFloat v; •ParseFloat4 "4" TrySH "nproc"}
rebuildAll GetOpt "rebuild" rebuildAll GetOpt "rebuild"
rebuildSingeli GetOpt "rebuild-singeli" rebuildSingeli GetOpt "rebuild-singeli"
tui ¬GetOpt "notui" tui @¬{𝕊: f@•FFI"i32""isatty"">i32" F 1} GetOpt "notui"
loud ¬GetOpt "quiet" loud ¬GetOpt "quiet"
{𝕊: _verboseLog {Log𝕨𝔽𝕩𝕩}} verboseGetOpt "verbose" {𝕊: _verboseLog {Log𝕨𝔽𝕩𝕩}} verboseGetOpt "verbose"

View File

@ -6,7 +6,7 @@ default: o3
# targets that only use the makefile # targets that only use the makefile
for-build: # for running the build system & Singeli for-build: # for running the build system & Singeli
@"${MAKE}" i_t=forbuild i_CC=cc REPLXX=0 i_f="-O2 -DFOR_BUILD" i_FFI=0 i_SHARED=0 i_PIE= i_CC_PIE= i_EXPORT=0 i_OUTPUT_DEF=build/obj2/for_build2 run_incremental_0 @"${MAKE}" i_t=forbuild i_CC=cc REPLXX=0 i_f="-O2 -DFOR_BUILD" i_FFI=0 i_SHARED=0 i_PIE= i_CC_PIE= i_EXPORT=0 i_OUTPUT_DEF=build/obj2/for_build3 run_incremental_0
for-bootstrap: # for bootstrapping bytecode for-bootstrap: # for bootstrapping bytecode
@"${MAKE}" i_t=for_bootstrap REPLXX=0 i_FFI=0 i_SHARED=0 i_PIE= i_CC_PIE= i_EXPORT=0 i_f='-DNATIVE_COMPILER -DONLY_NATIVE_COMP -DFORMATTER=0 -DNO_RT -DNO_EXPLAIN' run_incremental_0 i_USE_BC_SUBMODULE=0 BYTECODE_DIR=bytecodeNone @"${MAKE}" i_t=for_bootstrap REPLXX=0 i_FFI=0 i_SHARED=0 i_PIE= i_CC_PIE= i_EXPORT=0 i_f='-DNATIVE_COMPILER -DONLY_NATIVE_COMP -DFORMATTER=0 -DNO_RT -DNO_EXPLAIN' run_incremental_0 i_USE_BC_SUBMODULE=0 BYTECODE_DIR=bytecodeNone
o3-makeonly: o3-makeonly:

View File

@ -982,7 +982,7 @@ void ffi_init(void) {
NFnDesc* forbuildDesc; NFnDesc* forbuildDesc;
B forbuild_c1(B t, B x) { B forbuild_c1(B t, B x) {
i32 id = o2i(nfn_objU(t)); i32 id = o2i(nfn_objU(t));
switch (id) { default: fatal("bad id"); switch (id) { default: thrM("bad id");
case 0: { case 0: {
char* s = toCStr(x); char* s = toCStr(x);
decG(x); decG(x);
@ -1038,20 +1038,23 @@ void ffi_init(void) {
return m_vec2(m_f64(res), taga(buf)); return m_vec2(m_f64(res), taga(buf));
} }
case 7: {
return m_f64(isatty(o2i(x)));
}
} }
} }
B names; static B ffi_names;
B ffiload_c2(B t, B w, B x) { B ffiload_c2(B t, B w, B x) {
B name = IGetU(x, 1); B name = IGetU(x, 1);
i32 id = 0; i32 id = 0;
while (id<IA(names) && !equal(IGetU(names, id), name)) id++; while (id<IA(ffi_names) && !equal(IGetU(ffi_names, id), name)) id++;
B r = m_nfn(forbuildDesc, m_f64(id)); B r = m_nfn(forbuildDesc, m_f64(id));
decG(x); decG(x);
return r; return r;
} }
void ffi_init(void) { void ffi_init(void) {
HArr_p a = m_harrUv(7); HArr_p a = m_harrUv(8);
a.a[0] = m_c8vec_0("chdir"); a.a[0] = m_c8vec_0("chdir");
a.a[1] = m_c8vec_0("fork"); a.a[1] = m_c8vec_0("fork");
a.a[2] = m_c8vec_0("pipe"); a.a[2] = m_c8vec_0("pipe");
@ -1059,8 +1062,9 @@ void ffi_init(void) {
a.a[4] = m_c8vec_0("write"); a.a[4] = m_c8vec_0("write");
a.a[5] = m_c8vec_0("close"); a.a[5] = m_c8vec_0("close");
a.a[6] = m_c8vec_0("poll"); a.a[6] = m_c8vec_0("poll");
a.a[7] = m_c8vec_0("isatty");
NOGC_E; NOGC_E;
names = a.b; gc_add(names); ffi_names = a.b; gc_add(ffi_names);
forbuildDesc = registerNFn(m_c8vec_0("(function for build)"), forbuild_c1, c2_bad); forbuildDesc = registerNFn(m_c8vec_0("(function for build)"), forbuild_c1, c2_bad);
} }
#endif #endif