\ 2007-01-16 EW adv4_redir.fs \ poor mans redirection \ (stdout, lcd, uart0) Variable 'type \ pointer to correct "type" Variable 'emit \ pointer to correct "emit" Variable 'cr \ pointer to correct "cr" : >type ( -- ) 'type @ execute ; : >emit ( -- ) 'emit @ execute ; : >cr ( -- ) 'cr @ execute ; : +redir ( -- ) ['] >type is type ['] >emit is emit ; : -redir ( -- ) ['] (type) is type ['] (emit) is emit ; : to-stdout ( -- ) ['] (type) 'type ! ['] (emit) 'emit ! ['] cr 'cr ! ; to-stdout \ default : to-lcd ( -- ) ['] lcdtype 'type ! ['] lcdemit 'emit ! ['] lcdcr 'cr ! ; \ : to-uart0 ( -- ) \ ['] uart0type 'type ! \ ['] uart0emit 'emit ! \ ['] uart0cr 'cr ! \ ;