term.tal works
This commit is contained in:
parent
a0a0eecfc4
commit
99337665f6
|
@ -83,7 +83,8 @@ static void
|
||||||
start_fork_pty(UxnSubprocess *child, int mode)
|
start_fork_pty(UxnSubprocess *child, int mode)
|
||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
pid_t pid = forkpty(&fd, NULL, NULL, NULL);
|
struct winsize ws = {23, 80, 8, 12}; // rows, cols, xps, ypx
|
||||||
|
pid_t pid = forkpty(&fd, NULL, NULL, &ws);
|
||||||
if(pid < 0) { /* failure */
|
if(pid < 0) { /* failure */
|
||||||
fprintf(stderr, "parent fork failure\n");
|
fprintf(stderr, "parent fork failure\n");
|
||||||
} else if(pid == 0) { /* child */
|
} else if(pid == 0) { /* child */
|
||||||
|
|
|
@ -273,7 +273,10 @@ emu_run(Uxn *u, char *rom)
|
||||||
|
|
||||||
/* main loop */
|
/* main loop */
|
||||||
while(!u->dev[0x0f]) {
|
while(!u->dev[0x0f]) {
|
||||||
if(poll(fds, 3, 1000) <= 0)
|
for(i = 0; i < 4; i++) {
|
||||||
|
fds[i + 3].fd = get_child(i)->fd_out;
|
||||||
|
}
|
||||||
|
if(poll(fds, 7, 1000) <= 0)
|
||||||
continue;
|
continue;
|
||||||
while(XPending(display))
|
while(XPending(display))
|
||||||
emu_event(u);
|
emu_event(u);
|
||||||
|
|
|
@ -175,24 +175,32 @@
|
||||||
;on-mouse .Mouse/vect DEO2 ( set up mouse callback )
|
;on-mouse .Mouse/vect DEO2 ( set up mouse callback )
|
||||||
;on-read .Console/vect DEO2 ( set up stdin callback )
|
;on-read .Console/vect DEO2 ( set up stdin callback )
|
||||||
|
|
||||||
setup-subprocess ( set up experimental subprocess support )
|
setup-shell ( set up experimental subprocess support )
|
||||||
reset-terminal ( initialize terminal state and settings )
|
reset-terminal ( initialize terminal state and settings )
|
||||||
setup-debugging ( set up debugging if requested )
|
setup-debugging ( set up debugging if requested )
|
||||||
draw-banner ( draw banner if requested )
|
draw-banner ( draw banner if requested )
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
@env "TERM=ansi 00
|
||||||
|
|
||||||
( these only work with a patched uxnemu )
|
( these only work with a patched uxnemu )
|
||||||
( on other emulators they should be no-ops )
|
( on other emulators they should be no-ops )
|
||||||
@setup-subprocess ( -> )
|
@setup-shell ( -> )
|
||||||
#80 .Console/opts DEO
|
( setenv 'TERM=ansi' )
|
||||||
|
;env .Console/param DEO2
|
||||||
|
#11 .Console/host-put DEO
|
||||||
|
|
||||||
|
( exec 'bash -i' )
|
||||||
|
#81 .Console/opts DEO
|
||||||
;shell .Console/param DEO2
|
;shell .Console/param DEO2
|
||||||
#01 .Console/host-put DEO
|
#01 .Console/host-put DEO
|
||||||
|
|
||||||
|
( TODO: run stty to communicate terminal size? )
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@setup-debugging ( -> )
|
@setup-debugging ( -> )
|
||||||
.debug LDZ ?&continue JMP2r &continue
|
.debug LDZ ?&continue JMP2r &continue
|
||||||
( #99 #010e DEO ) ( put 99 in wst so #010e DEO reliably logs )
|
|
||||||
;debug-log .File1/name DEO2
|
;debug-log .File1/name DEO2
|
||||||
#01 .File1/append DEO
|
#01 .File1/append DEO
|
||||||
JMP2r
|
JMP2r
|
||||||
|
@ -244,7 +252,7 @@
|
||||||
.rows LDZ2 #000c MUL2 ADD2 .Screen/h DEO2
|
.rows LDZ2 #000c MUL2 ADD2 .Screen/h DEO2
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@shell "bash 20 "-i 00
|
@shell "bash 20 "-l 20 "-i 00
|
||||||
|
|
||||||
@load-theme ( -> )
|
@load-theme ( -> )
|
||||||
;&path .File1/name DEO2
|
;&path .File1/name DEO2
|
||||||
|
@ -681,6 +689,7 @@
|
||||||
&done .Console/proc-put DEO BRK
|
&done .Console/proc-put DEO BRK
|
||||||
|
|
||||||
@on-read-priv ( -> BRK )
|
@on-read-priv ( -> BRK )
|
||||||
|
.Console/type DEI #21 EQU ?{ BRK }
|
||||||
.Console/stdin DEI
|
.Console/stdin DEI
|
||||||
DUP LIT "; EQU ?next-arg
|
DUP LIT "; EQU ?next-arg
|
||||||
DUP LIT "0 LTH ?end-arg-priv
|
DUP LIT "0 LTH ?end-arg-priv
|
||||||
|
@ -691,6 +700,7 @@
|
||||||
POP ;on-read-priv .Console/vect DEO2 BRK
|
POP ;on-read-priv .Console/vect DEO2 BRK
|
||||||
|
|
||||||
@on-read-csi ( -> BRK )
|
@on-read-csi ( -> BRK )
|
||||||
|
.Console/type DEI #21 EQU ?{ BRK }
|
||||||
.Console/stdin DEI
|
.Console/stdin DEI
|
||||||
DUP LIT "? EQU ?start-priv
|
DUP LIT "? EQU ?start-priv
|
||||||
DUP LIT "; EQU ?next-arg
|
DUP LIT "; EQU ?next-arg
|
||||||
|
@ -699,6 +709,7 @@
|
||||||
!add-to-arg
|
!add-to-arg
|
||||||
|
|
||||||
@on-read-osc ( -> BRK )
|
@on-read-osc ( -> BRK )
|
||||||
|
.Console/type DEI #21 EQU ?{ BRK }
|
||||||
.Console/stdin DEI
|
.Console/stdin DEI
|
||||||
DUP #07 ( bell ) EQU ?&end-osc
|
DUP #07 ( bell ) EQU ?&end-osc
|
||||||
#9c ( esc-\ ) EQU ?&end-osc BRK
|
#9c ( esc-\ ) EQU ?&end-osc BRK
|
||||||
|
@ -979,6 +990,7 @@
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@on-read-esc ( -> BRK )
|
@on-read-esc ( -> BRK )
|
||||||
|
.Console/type DEI #21 EQU ?{ BRK }
|
||||||
.Console/stdin DEI
|
.Console/stdin DEI
|
||||||
DUP debug-esc
|
DUP debug-esc
|
||||||
DUP LIT "D EQU ?exec-ind
|
DUP LIT "D EQU ?exec-ind
|
||||||
|
@ -1026,6 +1038,7 @@
|
||||||
POP reset-args ;on-read-osc .Console/vect DEO2 BRK
|
POP reset-args ;on-read-osc .Console/vect DEO2 BRK
|
||||||
|
|
||||||
@on-read ( -> BRK )
|
@on-read ( -> BRK )
|
||||||
|
.Console/type DEI #21 EQU ?{ BRK }
|
||||||
.Console/stdin DEI read BRK
|
.Console/stdin DEI read BRK
|
||||||
|
|
||||||
@read ( c^ -> )
|
@read ( c^ -> )
|
||||||
|
|
Loading…
Reference in New Issue