uxn11/test/make.tal

39 lines
1.3 KiB
Tal
Raw Normal View History

2023-12-01 12:19:26 -05:00
|10 @Console [
&vector $2 &stdin $1 &pad1 $1 &proc-get $1 &host-get $1 &pad2 $1 &type $1
&stdout $1 &stderr $1 &proc-put $1 &pad3 $1 &param $2 &opts $1 &host-put $1
]
|0100 ( -- BRK )
;on-console .Console/vector DEO2 ( ; set up console vector callback )
BRK ( ; do other initialization )
@on-console ( -- BRK )
LIT "? .Console/stdout DEO
.Console/type DEI #81 EQU ?on-exit ( ; 0x41 signals child 1's exit )
.Console/type DEI #01 EQU ?on-stdin ( ; handle stdin )
BRK ( ; handle other console input )
@on-stdin
.Console/stdin DEI #0a NEQ
?{ run-make } BRK
@on-exit ( -- BRK )
.Console/host-get DEI ( ; read child 1's exit code )
?{ display-success-msg BRK } ( ; zero exit code means success )
display-failure-msg BRK ( ; non-zero exit code means failure )
@run-make ( -- )
;make-cmd .Console/param DEO2 ( ; set up make to run )
#01 .Console/opts DEO ( ; use child without pipelines )
#01 .Console/host-put DEO JMP2r ( ; run the command now and return )
@make-cmd "pwd 00 ( ; buffer containing cmd to run )
@display-success-msg
LIT ". .Console/stdout DEO
#0a .Console/stdout DEO JMP2r
@display-failure-msg
LIT "! .Console/stdout DEO
#0a .Console/stdout DEO JMP2r