Language Reference/Built-in entities/Domains

any
Universal term type.

any

The values of this domain are any terms. Such a value contains the reference to the term type library and a term itself.

char
Wide character.

char

The values of this domain are UNICODE characters. Implemented as 2 unsigned bytes.

Only assignment and comparison (in the lexicographical sense) operations are applied to the values of this domain. The image of a character has the following syntax:

 : ' Char_value '  :    \  : t     n      r      \ '     "      u 

In the syntax above  correspond to 4 hexadecimal digits. Also, the backslash symbol and the single quote can be represented by an escape-sequence only.

compareResult
The compareResult is a built-in domain. It is used to define a comparison result. The built-in predicate's result is compareResult domain. domains compareResult = less; equal; greater.

string
Wide zero terminated sequence of wide characters.

string

A string is a sequence of UNICODE characters. It's implemented as a pointer to the wide zero-terminated array of wide characters. Only assignment and comparison (in the lexicographical sense) operations are applied to values of this domain.

In source code a string literal can be specified as a set of sequences of characters surrounded by the double quotes.

: -list

 : @" AnyCharacter-list-opt " " CharacterValue-list-opt "

A string literal consists of one or more  's, which are concatenated.  's starting with @ does not use escape sequences, whereas <StringLiteralPart> 's without @</vp> uses the following escape sequences:


 * \\</vp> representing \</vp>
 * \t</vp> representing Tab-character
 * \n</vp> representing newline-character
 * \r</vp> representing carriage return
 * \'</vp> representing single quote
 * \"</vp> representing double quote
 * \u</vp> followed by exactly four <HexadecimalDigit> 's representing the Unicode character corresponding to the digits.

The double quotes in the string can be represented by the escape-sequence only (the single quote can be represented both with an escape-sequence and a graphical symbol).

string8
A term of the built-in string8</vp> domain is a sequence of ASCII (one-byte) characters. It is implemented as a pointer to the zero terminated array of ASCII characters. Only assignment and comparison for equality (in the lexicographical sense) operations are applied to the values of this domain. Currently no literals are allowed for this domain.

symbol
Wide zero terminated sequence of wide characters.

symbol

Similar to a string, a symbol is also a sequence of the UNICODE characters. It's implemented as a pointer to an entry in a symbol table that contains strings. The operations that can be applied to symbols are the same as for strings.

The image of a symbol is represented with a <string_literal> (any string surrounded by the double quotes).

Symbols and strings are largely interchangeable but they are stored differently. Symbols are kept in a look-up table and their addresses, rather than the symbols themselves, are stored to represent objects. This means that symbols can be matched very quickly and, if a symbol occurs repeatedly in a program, it can be stored very compactly. Strings are not kept in a look-up table. Visual Prolog examines strings character-by-character whenever they are to be matched.

binary
Sequence of N bytes.

binary

Values of this domain are used for holding binary data. A binary value is implemented as a pointer to the sequence of bytes that represents the contents of a binary term.

The length of a binary term is situated in the 4 bytes immediately preceding this sequence of bytes. The 4 bytes contains:

TotalNumberOfBytesOccupiedByBinary = ByteLen + 4

where ByteLen</vp> - is the length of the binary term and 4 is number of bytes occupied by size field.

Only assignment and comparison operations are applied to values of binary domain.

Two binary terms are compared in the following way:


 * If they are of different sizes, the bigger is considered larger.
 * Otherwise, they are compared byte by byte, as unsigned values. Comparison stops when two differing bytes are found and the result of their comparison is the result of the comparison of the binary terms. Two binary terms are equal if they have the same sizes and all bytes are equal.

The text syntax for binary images is determined by the <Binary> rules:

<Binary> : $ [ <Byte_value>-comma-sep-list-opt ] <Byte_value> : <Expression>

Each expression should be calculate on compiling time and its value should be in the range from 0</vp> to 255</vp>.

binaryNonAtomic
Sequence of N bytes.

binaryNonAtomic

Same as binary, but can contain pointers because it is scanned by the garbage collector.

integer
32 bit signed integer.

integer

Values of this domain occupy 4 bytes. Arithmetic operations (+</vp>, -</vp>, /</vp>, <vp>*</vp>, <vp>^</vp>), comparison, assignment,, , , and operations are applied to values of this domain.

The permitted number range is from <vp>-2147483648</vp> to <vp>2147483647</vp>.

The syntax for the <vp>integer</vp> literal is determined by the <Integer> rule:

<Integer> : <Add_operation>-opt 0o <Oct_number> <Add_operation>-opt <Dec_number> <Add_operation>-opt 0x <Hex_number> <Add_operation> : +     - <Oct_number> : <Oct_digit>-list <Oct_digit> : one of     0 1 2 3 4 5 6 7 <Dec_number> : <Dec_digit>-list <Dec_digit> : one of     <Oct_digit> 8 9 <Hex_number> : <Hex_digit>-list <Hex_digit> : one of     <Dec_digit> a b c d e f A B C D E F

integer64
64 bit signed integer.

integer64

Values of this domain occupy 8 bytes.

The permitted number range is from <vp>-2^63 = -9223372036854775808</vp> to <vp>2^63-1 = 9223372036854775807</vp>.

The syntax for <vp>integer64</vp> literal is the same as <Integer> rule.

The set of operations for <vp>integer64</vp> is similar to the one for <Integer>.

integerNative
Signed integer number with platform size (32 bit in a 32 bit program; 64 bit in a 64 bit program).

integerNative

unsigned
32 bit unsigned integer.

unsigned

Values of this domain occupy 4 bytes. Arithmetic operations (<vp>+</vp>, <vp>-</vp>, <vp>/</vp>, <vp>*</vp>, <vp>^</vp>), comparison, assignment,, , , and operations are applied to values of this domain.

The permitted number range is from <vp>0</vp> to <vp>4294967295</vp>.

The syntax for <vp>unsigned</vp> number images is the same as for <vp>integer</vp> numbers. The usage of minus sign ( <UnaryMinus> ) is not allowed for an image of an <vp>unsigned</vp> number.

unsigned64
64 bit unsigned integer.

unsigned64

Values of this domain occupy 8 bytes.

The permitted number range is from <vp>0</vp> to <vp>2^64-1 = 18,446,744,073,709,551,615</vp>.

The syntax for <vp>unsigned64</vp> number images is the same as for <vp>integer64</vp> numbers. The usage of minus sign ( <UnaryMinus> ) is not allowed for an image of an <vp>unsigned64</vp> number.

The set of operations for <vp>unsigned64</vp> is similar to the one for <Unsigned>.

unsignedNative
Unsigned integer number with platform size (32 bit in a 32 bit program; 64 bit in a 64 bit program).

unsignedNative

real
Float-pointing number.

real

Values of this domain occupy 8 bytes. This numerical real domain is introduced for the user's convenience only. All arithmetic, comparison, and assignment operations are applied to values of <vp>real</vp> domain.

The permitted number range is <vp>-1.7e+308</vp> to <vp>1.7e+308</vp>. Values from integral domains are automatically converted to real numbers when necessary.

The syntax for the floating-point number literal is determined by the <Real> rule:

<Real> : <Add_operation>-opt <Fraction> <Exponent>-opt <Fraction> : <Dec_number> <Fractional_part>-opt <Fractional_part> : . <Dec_number> <Exponent> : <Exp> <Add_operation>-opt <Dec_number> <Exp> : e     E <Add_operation> : +     - <Dec_number> : <Dec_digit>-list <Dec_digit> : one of     0 1 2 3 4 5 6 7 8 9

real32
Float-pointing number.

real32

Values of this domain occupy 4 bytes. This numerical <vp>real32</vp> domain is introduced for the user's convenience only. All arithmetic, comparison, and assignment operations can be applied to values of <vp>real32</vp> domain.

The permitted number range is <vp>-3.4e+38</vp> to <vp>3.4e+38</vp>.

The syntax of real32 literals is the same as <vp>real</vp> lietrals.

pointer
A pointer to a memory address.

pointer

A pointer directly corresponds to memory addresses. Only the equality operation can be applied to the values of this domain. There is a built-in null constant for this type

handle
A handle is used for Windows API function call. Values of this domain has the same size as a pointer (i.e. 4 on 32bit platfor and 8 on 64bit platform).

There are no operations for this domain and cannot be converted (except uncheckedConvert) to/from other domains.

There is a built-in nullHandle and invalidHandle constant for this type

boolean
Boolean values.

boolean

This domain is introduced for the user convenience only. It is treated as usual compound domain with the following definition:

domains boolean = false; true.

factDB
Descriptors of named internal databases.

factDB

This domain has the following hidden meta-declaration:

domains factDB = struct @factdb( named_internal_database_domain, object ).

All user-defined names of facts sections are the constants of this domain. The compiler automatically builds the corresponding compound terms from such constants whenever it's in need. At the runtime the 1st field of this structure contains the address of the corresponding domain descriptor and the 2nd field contains either zero (for class facts sections) or pointer to an object (i.e. <vp>This</vp>, for object facts sections).