Difference: MicroSdBlocks (77 vs. 78)

Revision 782021-05-09 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner"
Line: 155 to 155
  From utils.fs
Changed:
<
<
>file ( addr c-addr -- addr ) redirect to a file (emit, type, ...)
>term ( addr -- ) terminate to-file redirection
<file ( addr c-addr -- addr ) redirect from a file (key, accept, ...) <term ( addr -- ) terminate from-file redirection
>
>
>f_open ( addr c-addr -- n ) open a file to redirect to (emit, type, ...)
>>f_open ( addr c-addr -- n ) open a file to redirect to (emit, type, ...). Append to file
>file ( -- addr1 addr2 ) redirect to a file (emit, type, ...)
>term ( addr1 addr2 -- ) terminate to-file redirection
>f_close ( -- n ) close redirection to file
<f_open ( addr1 c-addr -- n ) open a file to redirect from (key, accept, ...) <file ( -- addr2 addr3) redirection from a file (key, accept, ...) <term ( addr1 addr2 -- ) terminate from-file redirection <f_close ( -- n ) close redirection from file
 
Line: 290 to 295
  Some helper words
Changed:
<
<
: >file ( addr c-addr -- addr ) \ redirect to a file (emit, type, ...)
>
>
: >f_open ( addr c-addr -- n ) \ open a file to redirect to (emit, type, ...)
  swap dup stdout ! swap
Changed:
<
<
FA_WRITE FA_OPEN_ALWAYS + f_open drop
>
>
FA_WRITE FA_OPEN_ALWAYS + f_open ;

: >>f_open ( addr c-addr -- n ) \ open a file to redirect to (emit, type, ...). Append to file swap dup stdout ! swap FA_WRITE FA_OPEN_APPEND + f_open ;

: >file ( -- addr1 addr2 ) \ redirect to a file (emit, type, ...)

  hook-emit @
Added:
>
>
hook-emit? @
  ['] fs-emit hook-emit !
Added:
>
>
['] fs-emit? hook-emit? !
 ;
Changed:
<
<
: >term ( addr -- ) \ terminate redirection
>
>
: >term ( addr1 addr2 -- ) \ terminate to-file redirection hook-emit? !
  hook-emit !
Changed:
<
<
stdout @ f_close drop
>
>
; : >f_close ( -- n ) stdout @ f_close 0 stdout !
 ;
Changed:
<
<
: <file ( addr c-addr -- addr ) \ redirection for a file (key, accept, ...)
>
>
: <f_open ( addr1 c-addr -- n ) \ open a file to redirect from (key, accept, ...)
  swap dup stdin ! swap
Changed:
<
<
FA_READ f_open drop
>
>
FA_READ f_open ;

: <file ( -- addr2 addr3) \ redirection from a file (key, accept, ...)

  hook-key @
Added:
>
>
hook-key? @
  ['] fs-key hook-key !
Added:
>
>
['] fs-key? hook-key? !
 ;
Changed:
<
<
: <term ( addr -- )
>
>
: <term ( addr1 addr2 -- ) \ terminate from-file redirection hook-key? !
  hook-key !
Changed:
<
<
stdin @ f_close drop
>
>
;

: <f_close ( -- n ) stdin @ f_close 0 stdin !

 ;
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback