Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
%DASHBOARD{ section="banner" | ||||||||
Line: 138 to 138 | ||||||||
Forth source files. I propose .fs extension for Forth source files the same as GForth does. But anyway you can use what you want (.f , .4th , .fth , etc).
| ||||||||
Changed: | ||||||||
< < | include ( any "name" -- any ) Interprets the content of the file <name>. included ( any c-addr u -- any ) Interprets the content of the file. | |||||||
> > | include ( i*x "name" -- j*x ) Interprets the content of the file <name>. included ( i*x c-addr u -- j*x ) Interprets the content of the file. | |||||||
coredump ( "name" -- ) Dumps the flash memory (core) into the file <name>. | ||||||||
Line: 147 to 147 | ||||||||
stdout ( -- addr ) user variable contains file desciptor (pointer to file object structure) for fs-key and fs-key? stderr ( -- addr ) user variable, not used yet | ||||||||
Changed: | ||||||||
< < | fs-emit ( Char -- ) Emits a character to a file (stdout) fs-emit? ( -- Flag ) Ready to send a character to a file? (stdout) fs-key ( -- Char ) Waits for and fetches a character from file. <0 for EOF or error. (stdin) fs-key? ( -- Flag ) Checks if a character is remaining (stdin) | |||||||
> > | fs-emit ( char -- ) Emits a character to a file (stdout) fs-emit? ( -- flag ) Ready to send a character to a file? (stdout) fs-key ( -- char ) Waits for and fetches a character from file. <0 for EOF or error. (stdin) fs-key? ( -- flag ) Checks if a character is remaining (stdin) | |||||||
From utils.fs | ||||||||
Changed: | ||||||||
< < | >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 | |||||||
> > | >f_open ( addr c-addr -- ior ) open a file to redirect to (emit, type, ...) >>f_open ( addr c-addr -- ior ) 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 | ||||||||
Changed: | ||||||||
< < | >f_close ( -- n ) close redirection to file <f_open ( addr1 c-addr -- n ) open a file to redirect from (key, accept, ...) | |||||||
> > | >f_close ( -- ior ) close redirection to file <f_open ( addr1 c-addr -- ior ) open a file to redirect from (key, accept, ...) | |||||||
<file ( -- addr2 addr3) redirection from a file (key, accept, ...) <term ( addr1 addr2 -- ) terminate from-file redirection | ||||||||
Changed: | ||||||||
< < | <f_close ( -- n ) close redirection from file | |||||||
> > | <f_close ( -- ior ) close redirection from file | |||||||
Line: 186 to 186 | ||||||||
The parameter order for the Forth Word is the same: addr1 is address of the file object data structure FIL, addr2 is the address of the filename array (0 terminated string).
| ||||||||
Changed: | ||||||||
< < | f_open ( addr1 addr2 b -- n ) opens a file. | |||||||
> > | f_open ( addr1 addr2 u -- ior ) opens a file. | |||||||
The FIL data structure can be created as follows: | ||||||||
Line: 295 to 295 | ||||||||
Some helper words | ||||||||
Changed: | ||||||||
< < | : >f_open ( addr c-addr -- n ) \ open a file to redirect to (emit, type, ...) | |||||||
> > | : >f_open ( addr c-addr -- ior ) \ open a file to redirect to (emit, type, ...) | |||||||
swap dup stdout ! swap FA_WRITE FA_OPEN_ALWAYS + f_open ; | ||||||||
Changed: | ||||||||
< < | : >>f_open ( addr c-addr -- n ) \ open a file to redirect to (emit, type, ...). Append to file | |||||||
> > | : >>f_open ( addr c-addr -- ior ) \ open a file to redirect to (emit, type, ...). Append to file | |||||||
swap dup stdout ! swap FA_WRITE FA_OPEN_APPEND + f_open ; | ||||||||
Line: 316 to 316 | ||||||||
hook-emit? ! hook-emit ! ; | ||||||||
Changed: | ||||||||
< < | : >f_close ( -- n ) | |||||||
> > | : >f_close ( -- ior ) | |||||||
stdout @ f_close 0 stdout ! ; | ||||||||
Changed: | ||||||||
< < | : <f_open ( addr1 c-addr -- n ) \ open a file to redirect from (key, accept, ...) | |||||||
> > | : <f_open ( addr1 c-addr -- ior ) \ open a file to redirect from (key, accept, ...) | |||||||
swap dup stdin ! swap FA_READ f_open ; | ||||||||
Line: 338 to 338 | ||||||||
hook-key ! ; | ||||||||
Changed: | ||||||||
< < | : <f_close ( -- n ) | |||||||
> > | : <f_close ( -- ior ) | |||||||
stdin @ f_close 0 stdin ! ; | ||||||||
Line: 449 to 449 | ||||||||
Changed: | ||||||||
< < | Do not expect real UNIX commands not even comparable to the Busybox commands. The UNIX like shell commands are parsing words. The parameters are parsed from the input stream till the end of line. These commands are not intended to use in other words, they are used in the interpreter mode, use f_ words in compiler mode. Spaces in path und file names are not allowed. Verly limited wildcards (only * and ?) for ls . No standard input/ouptut/err redirection. | |||||||
> > | Do not expect real UNIX commands not even comparable to the Busybox commands. The UNIX like shell commands are parsing words. The parameters are parsed from the input stream till the end of line. These commands are not intended to use in other words, they are used in the interpreter mode (run-time), use f_ words in compiler mode. Spaces in path und file names are not allowed. Verly limited wildcards (only * and ?) for ls . No standard input/ouptut/err redirection. | |||||||
Shell Prompt | ||||||||
Line: 628 to 628 | ||||||||
strlen ( c-addr -- c-addr len ) calculate the length of a C string, Forth string compatible .str" ( c-addr "text" -- ) copy string into buffer. String is null-terminated s0" ( "text" -- c-addr len ) Compiles a 0-terminated string and gives back its address and length when executed | ||||||||
Added: | ||||||||
> > | similar to s" but with 0-termination | |||||||
.( ( "text) -- ) Mecrisp's ." is working only in compile mode |