The IO module provides simple ascii-io rendering options. It is modeled after the tuple formats, but does not attempt to outline the results. Instead, it is geared at speed, which also means that some functionality regarding the built-in types is duplicated from the atoms definitions.

IO module


COMMAND io.export(X_0:bat[:any_2], X_1:str):void;
COMMENT "Export a BAT as ASCII to a file. If the 'filepath' is not absolute, it\nis put into the $DBPATH directory. Success of failure is indicated.";

COMMAND io.import(X_0:bat[:any_2], X_1:str):void;
COMMENT "Import a BAT from an ASCII dump. The tuples are appended to the\nfirst argument. Its signature must match the dump,\nelse parsing errors will occur as an exception.";

PATTERN io.print(X_0:any_1):void;
COMMENT "Print a MAL value.";

PATTERN io.print(X_0:any_1, X_1:any...):void;
COMMENT "Print a MAL value tuple .";

PATTERN io.print(X_0:bat[:any_1]):void;
COMMENT "Print a MAL value column .";

PATTERN io.print(X_0:bat[:any]...):void;
COMMENT "BATs are printed with '#' for legend \nlines, and the BUNs on seperate lines \nbetween brackets, containing each to \ncomma separated values (head and tail). \nIf multiple BATs are passed for printing, \nprint() performs an implicit natural \njoin on the void head, producing a multi attribute table.";

PATTERN io.printf(X_0:str):void;
COMMENT "Select default format";

PATTERN io.printf(X_0:str, X_1:any...):void;
COMMENT "Select default format";

PATTERN io.printf(X_0:streams, X_1:str):void;
COMMENT "Select default format";

PATTERN io.printf(X_0:streams, X_1:str, X_2:any...):void;
COMMENT "Select default format";

COMMAND io.setmallocsuccesscount(X_0:lng):void;
COMMENT "Set number of mallocs that are allowed to succeed.";

PATTERN io.stdin():bstream;
COMMENT "return the input stream to the database client";

PATTERN io.stdout():streams;
COMMENT "return the output stream for the database client";

Streams module

MODULE streams;

UNSAFE COMMAND streams.blocked(X_0:streams):streams;
COMMENT "open a block based stream";

UNSAFE COMMAND streams.close(X_0:streams):void;
COMMENT "close and destroy the stream s";

UNSAFE COMMAND streams.create(X_0:streams, X_1:int):bstream;
COMMENT "create a buffered stream";

UNSAFE COMMAND streams.destroy(X_0:bstream):void;
COMMENT "destroy bstream";

UNSAFE COMMAND streams.flush(X_0:streams):void;
COMMENT "flush the stream";

UNSAFE COMMAND streams.openRead(X_0:str):streams;
COMMENT "open ascii file stream for reading";

UNSAFE COMMAND streams.openReadBytes(X_0:str):streams;
COMMENT "open a file stream for reading";

UNSAFE COMMAND streams.openWrite(X_0:str):streams;
COMMENT "open ascii file stream for writing";

UNSAFE COMMAND streams.openWriteBytes(X_0:str):streams;
COMMENT "open a file stream for writing";

UNSAFE COMMAND, X_1:int):int;
COMMENT "read at least size bytes into the buffer of s";

UNSAFE COMMAND streams.readInt(X_0:streams):int;
COMMENT "read integer data from the stream";

UNSAFE COMMAND streams.readStr(X_0:streams):str;
COMMENT "read string data from the stream";

UNSAFE COMMAND streams.writeInt(X_0:streams, X_1:int):void;
COMMENT "write data on the stream";

UNSAFE COMMAND streams.writeStr(X_0:streams, X_1:str):void;
COMMENT "write data on the stream";