File "charsio"

This Prolog text provides temporary input/output redirection. The approach is to cooperate with the native garbage collectio. The predicates open_input_atom_stream/2 and open_output_atom_stream/2 create memory streams, but there is no bureaucracy necessary to manually free them when they are not needed anymore.

As a convenience the predicate term_atom/[2,3] allows writing a Prolog term into a new atom. The binary predicate will use writeq/1, the ternary predicate will use write_term/2 and if quoting isn’t desired, one needs to opt-out. This module also provides a couple of simple utilities to deal with the generation of XML texts.

The following compat predicates are provided:

open_input_atom_stream(A, S):
The built-in succeeds in S with a new input stream for the atom A.
open_output_atom_stream(S):
The built-in succeeds in S with a new output stream.
close_output_atom_stream(S, A):
The built-in succeeds in A with the content of the output stream S.
term_atom(T, A):
term_atom(T, A, O):
The build-in succeeds in writing the term T into a new atom A. The ternary predicate accepts write options O.
atom_time(A, F, T):
atom_time(A, F, T, L):
If A is a variable, the built-in succeeds in A with the millisecond time T formatted by the pattern F. Otherwise the built-in succeeds in T with the millisecond time parsed from A by the pattern F. The quaternary predicate allows specifying time options. The following time field specifiers are supported:

%a: Day of week as abbreviated text.
%b: Month as abbreviated text.
%Y: Year as a 4-digit decimal number.
%m: Month as a 2-digit decimal number.
%d: Day as a 2-digit decimal number.
%H: Hour as a 2-digit decimal number.
%M: Minute as a 2-digit decimal number.
%S: Second as a 2-digit decimal number.
%%: The percent sign (‘%’) as literal text.

The following time options are available:

face(F): The zone and language F, ‘local’ or ‘utc’.

put_message(T, L):
put_message(S, T, L):
The built-in succeeds in writing the message T formatted according to the locale L to the standard output. The ternary predicate allows specifying an output stream S.

Use Privacy (c) 2005-2026 XLOG Technologies AG