# FixIO Documentation

Back to summary

## Global functions

`import "io/process";`

`function print(s: String);
function println(s: String);
function print_err(s: String);
function println_err(s: String);
`
  Prints given string to standard output/error stream. Optionally with added newline.

### Asynchronous I/O

`import "io/async";`

`function async_process()
function async_process(timeout: Integer)
`
  Start processing asynchronous I/O. You can provide a timeout: negative value means infinite waiting (the default) and zero means no blocking. The timeout is in milliseconds. The return value is zero unless `async_quit` function is used to pass another return value.
`function async_run_later(delay: Integer, callback, data)`
  Schedules running a callback at a later time. When the delay is zero, the callback is run immediatelly on the next processing of events. The callback must have this signature:
  `function callback(data)`
`function async_quit()
function async_quit(ret_value)
`
  Requests aborting current processing of asynchronous I/O. Optionally you can provide a return value that is then returned form the `async_process` function. Does nothing when not inside the processing.

### Compression

`import "io/gzip";`

`function zcompress(arr: Byte[]): Byte[]
function zcompress(arr: Byte[], off: Integer, len: Integer): Byte[]
`
  Compresses the buffer.
`function zuncompress(arr: Byte[]): Byte[]
function zuncompress(arr: Byte[], off: Integer, len: Integer): Byte[]
`
  Decompresses the buffer.
`function gzip_compress(arr: Byte[]): Byte[]
function gzip_compress(arr: Byte[], off: Integer, len: Integer): Byte[]
`
  Compresses the buffer.
`function gzip_uncompress(arr: Byte[]): Byte[]
function gzip_uncompress(arr: Byte[], off: Integer, len: Integer): Byte[]
`
  Decompresses the buffer.

### Array views

`function array_create_view(shared_array, off: Integer, len: Integer[, elem_size: Integer]): Dynamic`
  Creates a new shared array as a view into subset of given shared array. The offset and length are given as indicies in the original shared array. Optionally you can change element size (non-aligned access is not permitted).
  Note: changing the element size exposes native endianess of the CPU. While most CPUs use little endian (as it's the more natural choice with regard to addressing), some special CPUs use big endian (however you will most likely know when you would be using these and thus you can generally assume little endian, having a runtime check is a good idea though).