Make terminal ui binaries work well everywhere
Here's some screenshots of an emulator tui program that was compiled on Linux, then scp'd it to Windows, Mac, and FreeBSD. https://justine.storage.googleapis.com/blinkenlights-cmdexe.png https://justine.storage.googleapis.com/blinkenlights-imac.png https://justine.storage.googleapis.com/blinkenlights-freebsd.png https://justine.storage.googleapis.com/blinkenlights-lisp.png How is this even possible that we have a nontrivial ui binary that just works on Mac, Windows, Linux, and BSD? Surely a first ever achievement. Fixed many bugs. Bootstrapped John McCarthy's metacircular evaluator on bare metal in half the size of Altair BASIC (about 2.5kb) and ran it in emulator for fun and profit.
This commit is contained in:
@ -85,7 +85,7 @@ long GetIntegerCoefficients(long N[static 6], const double C[static 6], long M,
|
||||
N[i] = 0;
|
||||
}
|
||||
}
|
||||
if (!IsTiny() && least > 1) {
|
||||
if (!NoDebug() && least > 1) {
|
||||
for (j[0] = 0; j[0] < J[0]; ++j[0]) {
|
||||
for (j[1] = 0; j[1] < J[1]; ++j[1]) {
|
||||
for (j[2] = 0; j[2] < J[2]; ++j[2]) {
|
||||
|
||||
@ -75,7 +75,6 @@ static struct SamplingSolution *NewSamplingSolution(long n, long s) {
|
||||
ss->indices = xcalloc(n * s, sizeof(short));
|
||||
return ss;
|
||||
}
|
||||
|
||||
static bool IsNormalized(int n, double A[n]) {
|
||||
int i;
|
||||
double x;
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
#include "libc/nt/console.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
#include "libc/nt/struct/consolecursorinfo.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
|
||||
/* TODO(jart): DELETE */
|
||||
|
||||
static int ttysetcursor(int fd, bool visible) {
|
||||
struct NtConsoleCursorInfo ntcursor;
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
#include "libc/sysv/consts/poll.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
/* TODO(jart): DELETE */
|
||||
|
||||
static int ttyident_probe(struct TtyIdent *ti, int ttyinfd, int ttyoutfd,
|
||||
const char *msg) {
|
||||
ssize_t rc;
|
||||
|
||||
@ -20,6 +20,8 @@
|
||||
#include "dsp/tty/tty.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
/* TODO(jart): DELETE */
|
||||
|
||||
/**
|
||||
* Sends data to teletypewriter.
|
||||
*
|
||||
@ -27,4 +29,6 @@
|
||||
*
|
||||
* @return 0 on success, or -1 w/ errno
|
||||
*/
|
||||
int ttysend(int fd, const char *str) { return ttywrite(fd, str, strlen(str)); }
|
||||
int ttysend(int fd, const char *str) {
|
||||
return ttywrite(fd, str, strlen(str));
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
/* TODO(jart): DELETE */
|
||||
|
||||
/**
|
||||
* Changes text in title bar of pseudo-teletypewriter window.
|
||||
*
|
||||
|
||||
@ -38,6 +38,8 @@
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
/* TODO(jart): DELETE */
|
||||
|
||||
#define FD STDOUT_FILENO
|
||||
|
||||
static struct TtyRaw {
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
#include "libc/sysv/consts/poll.h"
|
||||
#include "libc/sysv/consts/termios.h"
|
||||
|
||||
/* TODO(jart): DELETE */
|
||||
|
||||
/**
|
||||
* Sends data to teletypewriter the pain-free way.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user