By Andrew Owen
Released under the MIT license


Some File I/O bits

import ( file-path -- )

Loads the PISC file at the given path

ESC ( -- ESC-char )

Emits the terminal escape char, for use in terminal escape codes

import-asset ( file-path -- ? )

Load the packed script (mostly used for the standard library)

get-str-at-path ( path -- contents )

Load the contents at path into a string

save-str-to-path ( str path -- )

Save the value in str to the file at path

open-file-writer ( path -- file-writer )

Opens a file-writer that that writes to the supplied path, if can be made
A file-writer supports 3 calls:
`"str" $writer .write-line`, which writes "str\n" to the file
- `"str" $writer .write-string`, which writes "str" to the file
- `"str" $writer .write-string`, which writes "str" to the file

open-file-reader ( path -- file-reader )

Opens a file-readr that reads from the file at the supplied path, if a file exists at the given path
Support the standard @reader calls, as well as `.close`
See also @readers

priv_puts ( str -- )

Prints str to STDOUT

with-output ( path quot -- .. )

with-input ( path quot -- .. )

write-iolist ( content:arr|str writer:dict [ .write .write-line ] -- )

Take an array of arrays and strings, and write it to the supplied writer

Loosely modeled after Erlang's notion of iolists, though not likely to be nearly as efficient yet