Package-level declarations

Types

Link copied to clipboard

Implements ISO's at_end_of_stream/0: succeeds iff the current input stream (see IOPrimitiveUtils.currentInputChannel) is closed or exhausted.

Link copied to clipboard

Implements ISO's at_end_of_stream/1: succeeds iff the input stream identified by the first argument (an alias or a $stream(...) term, see IOPrimitiveUtils.ensuringArgumentIsInputChannel) is closed or exhausted.

Link copied to clipboard

Registered for ISO conformance, but not implemented: this implementation does not support a character conversion table, so calling char_conversion/2 always raises a it.unibo.tuprolog.solve.exception.error.SystemError.

Link copied to clipboard

Implements ISO's close/1: closes the stream identified by the first argument (an alias or $stream(...) term, see IOPrimitiveUtils.ensuringArgumentIsChannel) and drops every alias, other than the reserved "current" one, under which it was reachable.

Link copied to clipboard

Registered for ISO conformance, but not implemented: close/2 (close/1 plus an options list, e.g. force(true)) always raises a it.unibo.tuprolog.solve.exception.error.SystemError; use Close1 instead.

Link copied to clipboard

Non-ISO, tuProlog-specific predicate: consult/1 fetches the text pointed at by the atom argument (parsed into a it.unibo.tuprolog.solve.libs.io.Url via it.unibo.tuprolog.solve.libs.io.Url.Companion.of, so both proper URLs and bare filesystem paths work) and loads it as a theory, exactly as SetTheory does for an inline source string.

Link copied to clipboard

Registered for ISO conformance, but not implemented: since CharConversion is unsupported, there is never any conversion to enumerate, so current_char_conversion/2 always raises a it.unibo.tuprolog.solve.exception.error.SystemError.

Link copied to clipboard

Implements ISO's current_input/1: unifies the argument with the $stream(...) term of the current input stream (the context's current input, or its standard input if none was SetInput) if the argument is unbound; if it is already bound to a $stream(...) term, succeeds iff it already denotes that same channel.

Link copied to clipboard

Implements ISO's current_output/1: unifies the argument with the $stream(...) term of the current output stream (the context's current output, or its standard output if none was SetOutput) if the argument is unbound; if it is already bound to a $stream(...) term, succeeds iff it already denotes that same channel.

Link copied to clipboard

Implements ISO's flush_output/1: forces buffered writes on the output stream identified by the argument (an alias or $stream(...) term) to reach their destination.

Link copied to clipboard

Registered for ISO conformance, but not implemented: this implementation only supports text streams (see it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.propertiesOf, always reporting type(text)), so byte-oriented get_byte/1 always raises a it.unibo.tuprolog.solve.exception.error.SystemError. Use GetCode1/GetChar1 instead.

Link copied to clipboard

Registered for ISO conformance, but not implemented: only text streams are supported, so byte-oriented get_byte/2 always raises a it.unibo.tuprolog.solve.exception.error.SystemError. Use GetCode2/GetChar2 instead.

Link copied to clipboard

Implements ISO's get_char/1: reads (consuming it) the next character from the current input stream (see IOPrimitiveUtils.currentInputChannel) and unifies it with the argument, as the end_of_file atom at end of stream.

Link copied to clipboard

Implements ISO's get_char/2: reads (consuming it) the next character from the input stream identified by the first argument (an alias or $stream(...) term) and unifies it with the second, as end_of_file at end of stream.

Link copied to clipboard

Implements ISO's get_code/1: reads (consuming it) the next character code from the current input stream (see IOPrimitiveUtils.currentInputChannel) and unifies it with the argument, as -1 at end of stream.

Link copied to clipboard

Implements ISO's get_code/2: reads (consuming it) the next character code from the input stream identified by the first argument (an alias or $stream(...) term) and unifies it with the second, as -1 at end of stream.

Link copied to clipboard

Shared helpers backing every I/O primitive of :io-lib (Open3, Close1, Read1, Write2, ...): argument validation (raising the appropriate ISO error on mismatch), and the read/write/peek "compute, then reply" boilerplate common to most stream predicates.

Link copied to clipboard

Implements ISO's nl/1: writes a newline character to the output stream identified by the argument (an alias or $stream(...) term).

Link copied to clipboard

Implements ISO's open/3: opens the source/sink named by the first argument (parsed into a it.unibo.tuprolog.solve.libs.io.Url, both proper URLs and bare filesystem paths are accepted) in the mode named by the second (read, write, or append, see it.unibo.tuprolog.solve.libs.io.IOMode), registers the resulting channel under an auto-generated alias, and unifies the third argument with its $stream(...) term. Equivalent to open/4 with an empty options list; see Open4 for the full contract, including exceptions.

Link copied to clipboard

Implements ISO's open/4: like Open3, but with an explicit fourth argument listing stream_property/2 options (currently only alias(Name) has any effect, registering the new channel under Name in addition to an auto-generated alias; other recognized-but-fixed properties, e.g. type(text), must match this implementation's only supported value).

Link copied to clipboard

Registered for ISO conformance, but not implemented: only text streams are supported, so byte-oriented peek_byte/1 always raises a it.unibo.tuprolog.solve.exception.error.SystemError. Use PeekCode1/PeekChar1 instead.

Link copied to clipboard

Registered for ISO conformance, but not implemented: only text streams are supported, so byte-oriented peek_byte/2 always raises a it.unibo.tuprolog.solve.exception.error.SystemError. Use PeekCode2/PeekChar2 instead.

Link copied to clipboard

Implements ISO's peek_char/1: unifies the argument with the next character of the current input stream (see IOPrimitiveUtils.currentInputChannel) without consuming it (so a subsequent GetChar1/Read1 sees the same character again), as end_of_file at end of stream.

Link copied to clipboard

Implements ISO's peek_char/2: unifies the second argument with the next character of the input stream identified by the first (an alias or $stream(...) term) without consuming it, as end_of_file at end of stream.

Link copied to clipboard

Implements ISO's peek_code/1: unifies the argument with the code of the next character of the current input stream (see IOPrimitiveUtils.currentInputChannel) without consuming it, as -1 at end of stream.

Link copied to clipboard

Implements ISO's peek_code/2: unifies the second argument with the code of the next character of the input stream identified by the first (an alias or $stream(...) term) without consuming it, as -1 at end of stream.

Link copied to clipboard

Registered for ISO conformance, but not implemented: only text streams are supported, so byte-oriented put_byte/1 always raises a it.unibo.tuprolog.solve.exception.error.SystemError. Use PutCode1/PutChar1 instead.

Link copied to clipboard

Registered for ISO conformance, but not implemented: only text streams are supported, so byte-oriented put_byte/2 always raises a it.unibo.tuprolog.solve.exception.error.SystemError. Use PutCode2/PutChar2 instead.

Link copied to clipboard

Implements ISO's put_char/1: writes the one-character atom argument to the current output stream (see IOPrimitiveUtils.currentOutputChannel).

Link copied to clipboard

Implements ISO's put_char/2: writes the one-character atom second argument to the output stream identified by the first (an alias or $stream(...) term).

Link copied to clipboard

Implements ISO's put_code/1: writes the character coded by the integer argument to the current output stream (see IOPrimitiveUtils.currentOutputChannel).

Link copied to clipboard

Implements ISO's put_code/2: writes the character coded by the integer second argument to the output stream identified by the first (an alias or $stream(...) term).

Link copied to clipboard

Implements ISO's read/1: parses the next term from the current input stream (see IOPrimitiveUtils.currentInputChannel) and unifies it with the argument. See IOPrimitiveUtils.readTermAndReply for the shared implementation and its exceptions.

Link copied to clipboard

Implements ISO's read/2: parses the next term from the input stream identified by the first argument (an alias or $stream(...) term) and unifies it with the second. See IOPrimitiveUtils.readTermAndReply for the shared implementation (including the same end-of-stream-fails deviation from ISO documented on Read1).

Link copied to clipboard

Implements ISO's read_term/2: like Read1, but the second argument is a list of options requesting term metadata back (variables(Vars), variable_names(Pairs), singletons(Pairs)); if the list is unbound instead, a [Vars, Pairs, Singletons] list is unified with it, reporting all three at once. See IOPrimitiveUtils.readTermAndReply for the shared implementation.

Link copied to clipboard

Implements ISO's read_term/3: like ReadTerm2, but reading from the stream identified by the first argument (an alias or $stream(...) term) instead of the current input.

Link copied to clipboard

Implements ISO's set_input/1: makes the stream identified by the argument (an alias or $stream(...) term) the current input stream, i.e. the one implicitly used by unary predicates like Read1 and GetChar1 (see IOPrimitiveUtils.currentInputChannel).

Link copied to clipboard

Implements ISO's set_output/1: makes the stream identified by the argument (an alias or $stream(...) term) the current output stream, i.e. the one implicitly used by unary predicates like write/1-family and PutChar1 (see IOPrimitiveUtils.currentOutputChannel).

Link copied to clipboard

Non-ISO, tuProlog-specific predicate: set_theory/1 parses the atom argument as Prolog source text (using it.unibo.tuprolog.theory.parsing.ClausesParser with the context's current operators) and replaces the solver's static and dynamic knowledge base, operators and flags with what that text defines. See setTheory for the shared implementation (also used, with append = true, by Consult to load a theory fetched from a it.unibo.tuprolog.solve.libs.io.Url).

Link copied to clipboard

Implements ISO's stream_property/2: enumerates, backtracking over every open channel (input and output alike), the pairs of $stream(...) term and stream_property/2 property that hold for it, unifying them respectively with the first and second argument. Reported properties are input/output, one alias(_) per non-reserved alias, and always type(text) (see IOPrimitiveUtils.propertiesOf, since only text streams are supported).

Link copied to clipboard

Implements ISO's write/2: formats the second argument (unquoted, with operator notation, and expanding '$VAR'(N) terms as variable names, i.e. TermFormatter.default) and writes it to the output stream identified by the first argument (an alias or $stream(...) term).

Link copied to clipboard

Implements ISO's write_canonical/1: formats the argument in canonical form (quoted, ignoring operator notation, i.e. TermFormatter.canonical) and writes it to the current output stream (see IOPrimitiveUtils.currentOutputChannel).

Link copied to clipboard

Implements ISO's write_canonical/2: like WriteCanonical1, but writing to the output stream identified by the first argument (an alias or $stream(...) term) instead of the current output.

Link copied to clipboard

Implements ISO's writeq/1: formats the argument quoting atoms/functors where needed to remain re-readable (i.e. TermFormatter.readable) and writes it to the current output stream (see IOPrimitiveUtils.currentOutputChannel).

Link copied to clipboard

Implements ISO's writeq/2: like WriteEq1, but writing to the output stream identified by the first argument (an alias or $stream(...) term) instead of the current output.

Link copied to clipboard

Implements ISO's write_term/2: formats the first argument according to the options listed in the second (quoted(Bool), ignore_ops(Bool), numbervars(Bool), each defaulting to false, see IOPrimitiveUtils.ensuringArgumentIsFormatter) and writes it to the current output stream (see IOPrimitiveUtils.currentOutputChannel).

Link copied to clipboard

Implements ISO's write_term/3: like WriteTerm2, but writing to the output stream identified by the first argument (an alias or $stream(...) term) instead of the current output, with the term and options shifted to the second and third arguments respectively.