mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
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:
parent
680daf1210
commit
9e3e985ae5
276 changed files with 7026 additions and 3790 deletions
|
@ -2,19 +2,31 @@
|
|||
#define COSMOPOLITAN_TOOL_BUILD_LIB_PTY_H_
|
||||
#include "tool/build/lib/buffer.h"
|
||||
|
||||
#define kMachinePtyFg 0x01
|
||||
#define kMachinePtyBg 0x02
|
||||
#define kMachinePtyTrue 0x04
|
||||
#define kMachinePtyBold 0x08
|
||||
#define kMachinePtyFaint 0x10
|
||||
#define kMachinePtyFlip 0x20
|
||||
#define kMachinePtyBlink 0x40
|
||||
#define kMachinePtyFg 0x0001
|
||||
#define kMachinePtyBg 0x0002
|
||||
#define kMachinePtyBold 0x0004
|
||||
#define kMachinePtyFlip 0x0008
|
||||
#define kMachinePtyFaint 0x0010
|
||||
#define kMachinePtyUnder 0x0020
|
||||
#define kMachinePtyDunder 0x0040
|
||||
#define kMachinePtyTrue 0x0080
|
||||
#define kMachinePtyBlink 0x0100
|
||||
#define kMachinePtyItalic 0x0200
|
||||
#define kMachinePtyFraktur 0x0400
|
||||
#define kMachinePtyStrike 0x0800
|
||||
#define kMachinePtyConceal 0x1000
|
||||
|
||||
#define kMachinePtyNocursor 0x01
|
||||
#define kMachinePtyBlinkcursor 0x02
|
||||
#define kMachinePtyNocanon 0x04
|
||||
#define kMachinePtyNoecho 0x08
|
||||
#define kMachinePtyNoopost 0x10
|
||||
#define kMachinePtyBell 0x001
|
||||
#define kMachinePtyRedzone 0x002
|
||||
#define kMachinePtyNocursor 0x004
|
||||
#define kMachinePtyBlinkcursor 0x008
|
||||
#define kMachinePtyNocanon 0x010
|
||||
#define kMachinePtyNoecho 0x020
|
||||
#define kMachinePtyNoopost 0x040
|
||||
#define kMachinePtyLed1 0x080
|
||||
#define kMachinePtyLed2 0x100
|
||||
#define kMachinePtyLed3 0x200
|
||||
#define kMachinePtyLed4 0x400
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
@ -24,16 +36,18 @@ struct MachinePty {
|
|||
int x;
|
||||
int yn;
|
||||
int xn;
|
||||
uint32_t u8;
|
||||
uint32_t n8;
|
||||
uint32_t pr;
|
||||
uint32_t fg;
|
||||
uint32_t bg;
|
||||
uint32_t u8;
|
||||
uint32_t n8;
|
||||
uint32_t conf;
|
||||
uint32_t save;
|
||||
uint32_t *wcs;
|
||||
uint32_t *prs;
|
||||
uint32_t *fgs;
|
||||
uint32_t *bgs;
|
||||
uint32_t *prs;
|
||||
uint32_t conf;
|
||||
wchar_t *xlat;
|
||||
enum MachinePtyState {
|
||||
kMachinePtyAscii,
|
||||
kMachinePtyUtf8,
|
||||
|
@ -57,6 +71,11 @@ ssize_t MachinePtyRead(struct MachinePty *, void *, size_t);
|
|||
ssize_t MachinePtyWrite(struct MachinePty *, const void *, size_t);
|
||||
ssize_t MachinePtyWriteInput(struct MachinePty *, const void *, size_t);
|
||||
void MachinePtyAppendLine(struct MachinePty *, struct Buffer *, unsigned);
|
||||
void MachinePtyFullReset(struct MachinePty *);
|
||||
void MachinePtyMemmove(struct MachinePty *, long, long, long);
|
||||
void MachinePtyErase(struct MachinePty *, long, long);
|
||||
void MachinePtySetY(struct MachinePty *, int);
|
||||
void MachinePtySetX(struct MachinePty *, int);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue