Manual
Types
 previous   up   next 

5. PREDEFINED TYPES

In the following sub-chapters the predefined types of the standard library are introduced. The operators have, if not stated otherwise, the type described in the sub-chapter as parameter type and result type. The relations have also the type described in the sub-chapter as parameter type and a result of type boolean. In the descriptions is used to show an equivalent expression.

5.1 boolean

The type boolean consists of the two truth values TRUE and FALSE. The boolean functions are defined in the library "boolean.s7i".

    Constants:
      boolean.value  Default value of boolean (FALSE)
      boolean.first  Minimum value of boolean (FALSE)
      boolean.last   Maximum value of boolean (TRUE)
    Prefix operators:
      not       Negation
                  ( not TRUE  FALSE,
                    not FALSE  TRUE )
    Infix operators:
      and       Logical and
                  ( TRUE and TRUE  TRUE,
                    A and B  FALSE else )
      or        Inclusive logical or
                  ( FALSE or FALSE  FALSE,
                    A or B  TRUE else )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( TRUE ? a : b  a,
                    FALSE ? a : b  b )
      boolean conv A   Conversion of integer to boolean
                  ( Type of argument A: integer,
                    boolean conv 0  FALSE,
                    boolean conv 1  TRUE )
      boolean parse A   Conversion of string to boolean
                  ( Type of argument A: string,
                    boolean parse "FALSE"  FALSE,
                    boolean parse "TRUE"  TRUE,
                    boolean parse "TRUE "  EXCEPTION RANGE_ERROR,
                    boolean parse "ASDF"  EXCEPTION RANGE_ERROR )
    Relations:
      =, <>, <, <=, >, >=
                  ( A relation B 
                    ord(A) relation ord(B) )
    Functions:
      ord(A)    Ordinal number
                  ( Type of result: integer,
                    ord(FALSE)  0,
                    ord(TRUE)  1 )
      integer(A) Ordinal number
                  ( Type of result: integer,
                    integer(FALSE)  0,
                    integer(TRUE)  1 )
      succ(A)   Successor
                  ( succ(FALSE)  TRUE,
                    succ(TRUE)  EXCEPTION RANGE_ERROR )
      pred(A)   Predecessor
                  ( pred(FALSE)  EXCEPTION RANGE_ERROR )
                    pred(TRUE)  FALSE )
      boolean(A) Convert an integer to a boolean value
                  ( Type of argument A: integer,
                    boolean(0)  FALSE,
                    boolean(1)  TRUE,
                    boolean(2)  EXCEPTION RANGE_ERROR,
                    boolean(-1)  EXCEPTION RANGE_ERROR )
      boolean(A) Conversion of string to boolean
                  ( Type of argument A: string,
                    boolean("FALSE")  FALSE,
                    boolean("TRUE")  TRUE,
                    boolean("TRUE ")  EXCEPTION RANGE_ERROR,
                    boolean("true")  EXCEPTION RANGE_ERROR,
                    boolean("ASDF")  EXCEPTION RANGE_ERROR )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str(FALSE)  "FALSE",
                    str(TRUE)  "TRUE" )
      literal(A) Convert a boolean value to a boolean literal.
                  ( Type of result: string,
                    literal(FALSE)  "FALSE",
                    literal(TRUE)  "TRUE" )
      rand(A, B) Random value in the range [A, B]
                 The random values are uniform distributed.
                  ( rand(A, B) returns a random value such that
                    A <= rand(A, B) and rand(A, B) <= B holds.
                    rand(A, A)  A,
                    rand(TRUE, FALSE)  EXCEPTION RANGE_ERROR )
      compare(A, B) Compare function
                  ( Type of result: integer,
                    compare(FALSE, TRUE)  -1,
                    compare(TRUE, TRUE)  0,
                    compare(TRUE, FALSE)  1 )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      incr(A)   Increment
                  ( incr(A)  A:=succ(A) )
      decr(A)   Decrement
                  ( decr(A)  A:=pred(A) )
      ignore(A) Ignore value

The logical operators and and or work strictly left to right. First they evaluate the left operand and then the right operand. If the result of the operation can be determined after evaluation of the left operand the right operand is not evaluated. This can be used to check for a boundary in a boolean expression. Naturally side effects of the right operand of the and and or operator only take place when the operand is executed.

Table for the behavior of different boolean expressions:

Expression Result when the first operand evaluates to
FALSE TRUE
not A TRUE FALSE
A and B respectively
not((not A)or(not B))
FALSE B
A or B respectively
not((not A)and(not B))
B TRUE
A > B respectively
A and(not B)
FALSE not B
A >= B respectively
A or(not B)
not B TRUE
A < B respectively
(not A)and B
B FALSE
A <= B respectively
(not A)or B
TRUE B
not (A and B) respectively
(not A)or(not B)
TRUE not B
not (A or B) respectively
(not A)and(not B)
not B FALSE

Optimizing boolean expressions:

If the result of a boolean expression can be determined at compile time, the expression can be replaced by a constant. Additionally the following equations can be used:

    (A or  B) and (A or  C)  =  A or  (B and C)
    (A and B) or  (A and C)  =  A and (B or  C)

5.2 integer

The type integer consists of signed 64-bit integer numbers. An integer integer literal is a sequence of digits which is taken to be decimal. The sequence of digits may be followed by the letter E or e an optional + sign and a decimal exponent. Based numbers can be specified when the sequence of digits is followed by the # character and a sequence of extended digits. The decimal number in front of the # character specifies the base of the number which follows the # character. As base a number between 2 and 36 is allowed. As extended digits the letters A or a can be used for 10, B or b can be used for 11 and so on to Z or z which can be used as 35. Examples of integer literals are:

    0   2147483647   1E6   2e+9   16#c0   16#FFFF   8#177777   2#1010101010

If an integer operation overflows it raises the exception OVERFLOW_ERROR. The integer functions are defined in the library "integer.s7i".

    Constants:
      integer.value  Default value of integer (0)
      integer.first  Minimum value of integer (-9223372036854775808)
      integer.last   Maximum value of integer (9223372036854775807)
    Prefix operators:
      +         Identity
      -         Change sign
      !         Factorial
    Infix operators:
      +         Addition
      -         Subtraction
      *         Multiplication
      div       Integer division truncated towards zero
                  ( A div B  trunc(flt(A) / flt(B)),
                    A div 0  EXCEPTION NUMERIC_ERROR )
      rem       Reminder of integer division div
                  ( A rem B  A - (A div B) * B,
                    A rem 0  EXCEPTION NUMERIC_ERROR )
      mdiv      Integer division truncated towards negative infinity
                  ( A mdiv B  round(floor(flt(A) / flt(B))),
                    A mdiv 0  EXCEPTION NUMERIC_ERROR )
      mod       Reminder of integer division mdiv
                  ( A mod B  A - (A mdiv B) * B,
                    A mod 0  EXCEPTION NUMERIC_ERROR )
      **        Power
                  ( A ** B is okay for B >= 0,
                    A ** 0  1 for every A, even for A = 0,
                    1 ** B  1 for B >= 0,
                    A ** B  -(-A) ** B for A <= 0 and B >= 0 and odd(B),
                    A ** B  (-A) ** B for A <= 0 and B >= 0 and not odd(B),
                    A ** -1  EXCEPTION NUMERIC_ERROR )
      A << B    Shift left
                  ( A << B is okay for B >= 0 and B <= 63,
                    A << B  EXCEPTION OVERFLOW_ERROR for B < 0 or B >= 64,
                    A << B  A * 2 ** B,
                    A << 0  A )
      A >> B    Arithmetic shift right
                  ( A >> B is okay for B >= 0 and B <= 63,
                    A >> B  EXCEPTION OVERFLOW_ERROR for B < 0 or B >= 64,
                    A >> B  A mdiv 2 ** B  for B <= 62,
                    A >> 0  A,
                    A >> B  C for A >= 0 holds: C >= 0,
                    A >> B  C for A < 0 holds: C < 0,
                    A >> B  0 for A >= 0 and B > ord(log2(A)),
                    A >> B  -1 for A < 0 and B > ord(log2(-A)),
                    0 >> B  0 )
      !         Binomial coefficient
                  ( n ! k  0 for k < 0,
                    n ! 0  1,
                    n ! 1  n,
                    n ! k  0 for n >= 0 and k > n,
                    n ! k  !n div (!k * !(n - k)) for k >= 0 and k <= n,
                    n ! k  (-1) ** k * (n + k - 1 ! k) for n < 0 and k >= 0 )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      A radix B  Convert the integer A to a string. The conversion
                 uses the numeral system with the base B.
                  ( Type of result: string,
                    48879 radix 16  "beef",
                    -48879 radix 16  "-beef",
                    123 radix 37  EXCEPTION RANGE_ERROR )
      A RADIX B  Convert the integer A to a string. The conversion
                 uses the numeral system with the base B.
                  ( Type of result: string,
                    48879 RADIX 16  "BEEF",
                    -48879 RADIX 16  "-BEEF",
                    123 RADIX 37  EXCEPTION RANGE_ERROR )
      lpad      Left padding with spaces
                  ( 123 lpad  8  "     123",
                    123 lpad  4  " 123",
                    123 lpad  3  "123",
                    123 lpad  2  "123",
                    123 lpad -8  "123" )
                    -12 lpad  4  " -12",
                    -12 lpad  3  "-12",
                    -12 lpad  2  "-12" )
      lpad0     Left padding with zeros
                  ( 123 lpad0  8  "00000123",
                    123 lpad0  4  "0123",
                    123 lpad0  3  "123",
                    123 lpad0  2  "123",
                    123 lpad0 -8  "123",
                    -12 lpad0  4  "-012",
                    -12 lpad0  3  "-12",
                    -12 lpad0  2  "-12" )
      rpad      Right padding with spaces
                  ( 123 rpad  8  "123     ",
                    123 rpad  4  "123 ",
                    123 rpad  3  "123",
                    123 rpad  2  "123",
                    123 rpad -8  "123" )
                    -12 rpad  4  "-12 ",
                    -12 rpad  3  "-12",
                    -12 rpad  2  "-12" )
      sci       Conversion to a string in scientific notation
                  ( Type of result: string,
                    12345 sci 4  "1.2345e+4",
                    12345 sci 3  "1.235e+4",
                    12345 sci 2  "1.23e+4",
                    3141592 sci 0  "3e+6",
                    27182818 sci 0  "3e+7",
                    2**62 sci 6  "4.611686e+18",
                    -1 sci 3  "-1.000e+0",
                    -0 sci 2  "0.00e+0" )
      integer conv A   Identity
                  ( integer conv A  A )
      integer parse A   Conversion of string to integer
                  ( Type of argument A: string,
                    integer parse "123"  123,
                    integer parse "-123"  -123,
                    integer parse "+5"  5,
                    integer parse " 1"  EXCEPTION RANGE_ERROR,
                    integer parse "10 "  EXCEPTION RANGE_ERROR,
                    integer parse "ASDF"  EXCEPTION RANGE_ERROR )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      ord(A)    Identity
      succ(A)   Successor
                  ( succ(A)  A+1,
                    succ(integer.last)  EXCEPTION OVERFLOW_ERROR )
      pred(A)   Predecessor
                  ( pred(A)  A-1,
                    pred(integer.first)  EXCEPTION OVERFLOW_ERROR )
      abs(A)    Absolute value
                  ( abs(A)  A for A >= 0,
                  ( abs(A)  -A for A < 0,
                  ( abs(integer.first)  EXCEPTION OVERFLOW_ERROR )
      odd(A)    Odd value
                  ( Type of result: boolean )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str(12345)  "12345" )
      literal(A) Conversion to a literal
                  ( Type of result: string,
                    literal(A)  str(A) )
      integer(A) Conversion of string to integer
                  ( Type of argument A: string,
                    integer("123")  123,
                    integer("-123")  -123,
                    integer("+5")  5,
                    integer(" 1")  EXCEPTION RANGE_ERROR,
                    integer("10 ")  EXCEPTION RANGE_ERROR,
                    integer("ASDF")  EXCEPTION RANGE_ERROR )
      integer(A, B) Convert numeric string, with specified radix, to an integer
                  ( Type of argument A: string,
                    integer("beef", 16)  48879,
                    integer("-177", 8)  -127,
                    integer("10101010", 2)  170,
                    integer("Cafe", 16)  51966,
                    integer("0", 1)  EXCEPTION RANGE_ERROR,
                    integer("qwertyuiop", 37)  EXCEPTION RANGE_ERROR )
      bytes(A, S, E) Convert an integer into a string of bytes
                  ( Type of argument S: signedness (UNSIGNED and SIGNED),
                    Type of argument E: endianness (LE and BE),
                    Type of result: string,
                    bytes(1413829460, SIGNED, BE)  "TEST",
                    bytes(1497451343, SIGNED, LE)  "OKAY" )
      bytes(A, S, E, len) Convert an integer into a string of len bytes
                  ( Type of argument S: signedness (UNSIGNED and SIGNED),
                    Type of argument E: endianness (LE and BE),
                    Type of result: string,
                    bytes(1413829460, SIGNED, BE, 5)  "\0;TEST"
                    bytes(1413829460, SIGNED, BE, 4)  "TEST"
                    bytes(1413829460, SIGNED, BE, 3)  EXCEPTION RANGE_ERROR )
      bytes2Int(A, S, E) Convert a string of bytes to an integer
                  ( Type of argument A: string,
                    Type of argument S: signedness (UNSIGNED and SIGNED),
                    Type of argument E: endianness (LE and BE),
                    bytes2Int("\210;\2;\150;I", UNSIGNED, LE)  1234567890 )
      sqrt(A)   Integer square root
                  ( sqrt(A) is okay for A >= 0,
                    sqrt(A)  trunc(sqrt(flt(A))),
                    sqrt(-1)  EXCEPTION NUMERIC_ERROR )
      log10(A)  Truncated base 10 logarithm
                  ( log10(A) is defined for A >= 0,
                    log10(10 ** A) = A for A >= 0,
                    log10(pred(10 ** A)) = pred(A) for A >= 0,
                    log10(10)  1,
                    log10(1)  0,
                    log10(0)  -1,
                    log10(-1)  EXCEPTION NUMERIC_ERROR )
      log2(A)   Truncated base 2 logarithm
                  ( log2(A) returns the position of the
                    highest bit set. It is defined for A >= 0
                    log2(2 ** A) = A for A >= 0,
                    log2(pred(2 ** A)) = pred(A) for A >= 0,
                    log2(2)  1,
                    log2(1)  0,
                    log2(0)  -1,
                    log2(-1)  EXCEPTION NUMERIC_ERROR )
      bitLength(A) Number of bits in the minimum two's-complement
                   representation, excluding the sign bit.
                  ( bitLength(A)  succ(log2(A)) for A >= 0,
                    bitLength(A)  bitLength(pred(-A)) for A < 0,
                    bitLength(0)  0,
                    bitLength(-1)  0 )
      lowestSetBit(A) Index of the lowest-order one bit
                      For A <> 0 this is equal to the number of
                      lowest-order zero bits.
                  ( A >> B << B = A for A <> 0 and B = lowestSetBit(A),
                    lowestSetBit(0)  -1,
                    lowestSetBit(1)  0,
                    lowestSetBit(2)  1 )
      rand(A, B) Random number in the range [A, B]
                 The random values are uniform distributed.
                  ( rand(A, B) returns a random number such that
                    A <= rand(A, B) and rand(A, B) <= B holds.
                    rand(A, A)  A,
                    rand(1, 0)  EXCEPTION RANGE_ERROR )
      min(A, B) Minimum of two numbers.
                  ( min(1, 2)  1 )
      max(A, B) Maximum of two numbers.
                  ( max(1, 2)  2 )
      compare(A, B) Compare function
                  ( compare(1, 2)  -1,
                    compare(5, 5)  0,
                    compare(8, 7)  1 )
      hashCode(A) Hash function
    Statements:
      A +:= B   Increment A by B
                  ( A +:= B  A := A + B )
      A -:= B   Decrement A by B
                  ( A -:= B  A := A - B )
      A *:= B   Multiplying copy
                  ( A *:= B  A := A * B )
      A <<:= B  Shift left copy
                  ( A <<:= B  A := A << B )
      A >>:= B  Shift right copy
                  ( A >>:= B  A := A >> B )
      incr(A)   Increment with 1
                  ( incr(A)  A +:= 1,
                    incr(A)  EXCEPTION OVERFLOW_ERROR for A = integer.last )
      decr(A)   Decrement with 1
                  ( decr(A)  A -:= 1,
                    decr(A)  EXCEPTION OVERFLOW_ERROR for A = integer.first )
      ignore(A) Ignore value

For the operations div and rem holds for all A:

    (A div B) * B + A rem B = A           when B <> 0
    -A div B = -(A div B)                 when B <> 0
    -A rem B = -(A rem B)                 when B <> 0
    A rem B >= 0 and A rem B < abs(B)     when B <> 0 and A >= 0
    A rem B <= 0 and A rem B > -abs(B)    when B <> 0 and A <= 0

For the operations mdiv and mod holds for all A:

    (A mdiv B) * B + A mod B = A          when B <> 0
    -A mdiv B = A mdiv -B                 when B <> 0
    -A mod -B = -(A mod B)                when B <> 0
    A mod B >= 0 and A mod B < B          when B > 0
    A mod B <= 0 and A mod B > B          when B < 0

For the operation mdiv holds:

    A mdiv B = A div B - 1            when A and B have different
                                      signs and A rem B <> 0 holds.
    A mdiv B = A div B                when A and B have the same
                                      sign or A rem B = 0 holds.
    A mdiv B = (A - 1) div B - 1      when A > 0 and B < 0 holds.
    A mdiv B = (A + 1) div B - 1      when A < 0 and B > 0 holds.
    A mdiv 2 ** B = A >> B            when B >= 0 holds

For the operation mod holds:

    A mod B = A rem B + B      when A and B have different
                               signs and A rem B <> 0 holds.
    A mod B = A rem B          when A and B have the same
                               sign or A rem B = 0 holds.

Tables for the behavior of div, rem, mdiv and mod:

A B A div B A rem B A mdiv B A mod B
5 3 1 2 1 2
4 3 1 1 1 1
3 3 1 0 1 0
2 3 0 2 0 2
1 3 0 1 0 1
0 3 0 0 0 0
-1 3 0 -1 -1 2
-2 3 0 -2 -1 1
-3 3 -1 0 -1 0
-4 3 -1 -1 -2 2
-5 3 -1 -2 -2 1
A B A div B A rem B A mdiv B A mod B
5 -3 -1 2 -2 -1
4 -3 -1 1 -2 -2
3 -3 -1 0 -1 0
2 -3 0 2 -1 -1
1 -3 0 1 -1 -2
0 -3 0 0 0 0
-1 -3 0 -1 0 -1
-2 -3 0 -2 0 -2
-3 -3 1 0 1 0
-4 -3 1 -1 1 -1
-5 -3 1 -2 1 -2

Tables for the behavior of ! (Binomial coefficient):

n ! k k
-5 -4 -3 -2 -1 0 1 2 3 4 5
n -5 0 0 0 0 0 1 -5 15 -35 70 -126
-4 0 0 0 0 0 1 -4 10 -20 35 -56
-3 0 0 0 0 0 1 -3 6 -10 15 -21
-2 0 0 0 0 0 1 -2 3 -4 5 -6
-1 0 0 0 0 0 1 -1 -1 -1 -1 -1
0 0 0 0 0 0 1 0 0 0 0 0
1 0 0 0 0 0 1 1 0 0 0 0
2 0 0 0 0 0 1 2 1 0 0 0
3 0 0 0 0 0 1 3 3 1 0 0
4 0 0 0 0 0 1 4 6 4 1 0
5 0 0 0 0 0 1 5 10 10 5 1

For the sqrt function holds (when A >= 0):

    sqrt(A) * sqrt(A) <= A and
    (sqrt(A) + 1) * (sqrt(A) + 1) > A

5.3 bigInteger

The type bigInteger describes signed integer numbers of unlimited size. A bigInteger literal is a sequence of digits followed by an underscore character (for example 1_ ). Based numbers can be specified when the sequence of digits is followed by the # character and a sequence of extended digits. The decimal number in front of the # character specifies the base of the number which follows the # character. As base a number between 2 and 36 is allowed. As extended digits the letters A or a can be used for 10, B or b can be used for 11 and so on to Z or z which can be used as 35. Like decimal bigInteger literals the extended digits must be followed by an underscore character. Examples of bigInteger literals are:

    0_   18446744073709551616_ 16#deadbeefcafe_

Although bigInteger operations cannot overflow, it can happen that there is not enough memory to represent a bigInteger value. In this case the exception MEMORY_ERROR is raised. The bigInteger functions are defined in the library "bigint.s7i".

    Constants:
      bigInteger.value  Default value of bigInteger (0_)
    Prefix operators:
      +         Identity
      -         Change sign
      !         Factorial
    Infix operators:
      +         Addition
      -         Subtraction
      *         Multiplication
      div       Integer division truncated towards zero
                  ( A div B  trunc(A / B),
                    A div 0_  EXCEPTION NUMERIC_ERROR )
      rem       Reminder of integer division div
                  ( A rem B  A - (A div B) * B,
                    A rem 0_  EXCEPTION NUMERIC_ERROR )
      mdiv      Integer division truncated towards negative infinity
                  ( A mdiv B  floor(A / B),
                    A mdiv 0_  EXCEPTION NUMERIC_ERROR )
      mod       Reminder of integer division mdiv
                  ( A mod B  A - (A mdiv B) * B,
                    A mod 0_  EXCEPTION NUMERIC_ERROR )
      A ** B    Power
                  ( Type of argument B: integer,
                    A ** B is okay for B >= 0,
                    A ** 0  1_ for every A, even for A = 0_,
                    1_ ** B  1_ for B >= 0,
                    A ** B  -(-A) ** B for A <= 0_ and B >= 0 and odd(B),
                    A ** B  (-A) ** B for A <= 0_ and B >= 0 and not odd(B),
                    A ** -1  EXCEPTION NUMERIC_ERROR )
      A << B    Shift left
                  ( Type of argument B: integer,
                    A << B  A * 2_ ** B  for B >= 0,
                    A << B  A >> -B for B < 0,
                    A << 0  A,
                    0_ << B  0_ for every B )
      A >> B    Arithmetic shift right
                  ( Type of argument B: integer,
                    A >> B  A mdiv 2_ ** B for B >= 0,
                    A >> B  A << -B for B < 0,
                    A >> 0  A,
                    A >> B  C for A >= 0_ holds: C >= 0_,
                    A >> B  C for A < 0_ holds: C < 0_,
                    A >> B  0_ for A >= 0_ and B > ord(log2(A)),
                    A >> B  -1_ for A < 0_ and B > ord(log2(-A)),
                    0_ >> B  0_ for every B )
      !   Binomial coefficient
                  ( n ! k  0_ for k < 0_,
                    n ! 0_  1_,
                    n ! 1_  n,
                    n ! k  0_ for n >= 0_ and k > n,
                    n ! k  !n div (!k * !(n - k)) for k >= 0_ and k <= n,
                    n ! k  (-1) ** k * (n + k - 1 ! k) for n < 0_ and k >= 0_ )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      A radix B  Convert the bigInteger A to a string. The conversion
                 uses the numeral system with the base B.
                  ( Type of result: string,
                    3735928559_ radix 16  "deadbeef",
                    -3735928559_ radix 16 )  "-deadbeef",
                    123_ radix 37  EXCEPTION RANGE_ERROR )
      A RADIX B  Convert the integer A to a string. The conversion
                 uses the numeral system with the base B.
                  ( Type of result: string,
                    3735928559_ RADIX 16  "DEADBEEF",
                    -3735928559_ RADIX 16 )  "-DEADBEEF",
                    123_ RADIX 37  EXCEPTION RANGE_ERROR )
      sci       Conversion to a string in scientific notation
                  ( Type of right operand: integer,
                    Type of result: string,
                    12345_ sci 4  "1.2345e+4",
                    12345_ sci 3  "1.235e+4",
                    12345_ sci 2  "1.23e+4",
                    3141592_ sci 0  "3e+6",
                    27182818_ sci 0  "3e+7",
                    2_**62 sci 6  "4.611686e+18",
                    -1_ sci 3  "-1.000e+0",
                    -0_ sci 2  "0.00e+0" )
      bigInteger conv A   Conversion of integer to bigInteger
                  ( Type of argument A: integer,
                    bigInteger conv 1  1_ )
      bigInteger parse A   Conversion of string to integer
                  ( Type of argument A: string,
                    bigInteger parse "123"  123_,
                    bigInteger parse "-123"  -123_,
                    bigInteger parse "+5"  5_,
                    bigInteger parse " 1"  EXCEPTION RANGE_ERROR,
                    bigInteger parse "10 "  EXCEPTION RANGE_ERROR,
                    bigInteger parse "ASDF"  EXCEPTION RANGE_ERROR )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      ord(A)    Ordinal number
                  ( Type of result: integer )
                    ord(99999999999999999999_)  EXCEPTION RANGE_ERROR )
      integer(A)  Ordinal number
                  ( Type of result: integer )
                    integer(99999999999999999999_)  EXCEPTION RANGE_ERROR )
      succ(A)   Successor
                  ( succ(A)  A+1_ )
      pred(A)   Predecessor
                  ( pred(A)  A-1_ )
      abs(A)    Absolute value
      odd(A)    Odd value
                  ( Type of result: boolean )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str(9876543210_)  "9876543210" )
      literal(A) Convert a bigInteger number to a bigInteger literal.
                  ( Type of result: string,
                    literal(9876543210_)  "9876543210_" )
      bigInteger(A) Convert an integer to a bigInteger
                  ( Type of argument A: integer,
                    bigInteger(1)  1_ )
      bigInteger(A) Convert a numeric string to a bigInteger
                  ( Type of argument A: string,
                    bigInteger("123")  123_,
                    bigInteger("-123")  -123_,
                    bigInteger("+5")  5_,
                    bigInteger(" 1")  EXCEPTION RANGE_ERROR,
                    bigInteger("10 ")  EXCEPTION RANGE_ERROR,
                    bigInteger("ASDF")  EXCEPTION RANGE_ERROR )
      bigInteger(A, B) Convert numeric string, with specified radix, to a bigInteger
                  ( Type of argument A: string,
                    Type of argument B: integer,
                    bigInteger("deadbeef", 16)  3735928559_,
                    bigInteger("-77777777777", 8)  -8589934591_,
                    bigInteger("10101010", 2)  170_,
                    bigInteger("Cafe", 16)  51966_,
                    bigInteger("0", 1)  EXCEPTION RANGE_ERROR,
                    bigInteger("qwertyuiop", 37)  EXCEPTION RANGE_ERROR )
      bytes(A, S, E) Convert a bigInteger into a string of bytes
                  ( Type of argument S: signedness (UNSIGNED and SIGNED),
                    Type of argument E: endianness (LE and BE),
                    Type of result: string,
                    bytes(1413829460_, SIGNED, BE)  "TEST",
                    bytes(1497451343_, SIGNED, LE)  "OKAY" )
      bytes(A, S, E, len) Convert a bigInteger into a string of len bytes
                  ( Type of argument S: signedness (UNSIGNED and SIGNED),
                    Type of argument E: endianness (LE and BE),
                    Type of result: string,
                    bytes(1413829460_, SIGNED, BE, 5)  "\0;TEST"
                    bytes(1413829460_, SIGNED, BE, 4)  "TEST"
                    bytes(1413829460_, SIGNED, BE, 3)  EXCEPTION RANGE_ERROR )
      bytes2BigInt(A, S, E) Convert a string of bytes to a bigInteger
                  ( Type of argument A: string,
                    Type of argument S: signedness (UNSIGNED and SIGNED),
                    Type of argument E: endianness (LE and BE),
                    bytes2BigInt("\210;\2;\150;I", UNSIGNED, LE)  1234567890_ )
      sqrt(A)   Integer square root
                  ( sqrt(A) is okay for A >= 0_
                    sqrt(A)  trunc(sqrt(flt(A))),
                    sqrt(-1_)  EXCEPTION NUMERIC_ERROR )
      modInverse(A, B) Compute the modular multiplicative inverse of A modulo B
      modPow(A, B, C) Compute the modular exponentiation of A ** B
      log10(A)  Truncated base 10 logarithm
                  ( log10(A) is defined for A >= 0_
                    log10(10_ ** A) = A for A >= 0_,
                    log10(pred(10_ ** A)) = pred(A) for A >= 0_,
                    log10(10_)  1_,
                    log10(1_)  0_,
                    log10(0_)  -1_,
                    log10(-1_)  EXCEPTION NUMERIC_ERROR )
      log2(A)   Truncated base 2 logarithm
                  ( log2(A) returns the position of the
                    highest bit set. It is defined for A >= 0
                    log2(2_ ** A) = A for A >= 0,
                    log2(pred(2_ ** A)) = pred(A) for A >= 0,
                    log2(2_)  1_,
                    log2(1_)  0_,
                    log2(0_)  -1_,
                    log2(-1_)  EXCEPTION NUMERIC_ERROR )
      gcd(A, B) Greatest common divisor of A and B.
                  ( gcd(A, B) = gcd(B, A),
                    gcd(A, B) = gcd(-A, B),
                    gcd(A, 0) = abs(A) )
      bitLength(A) Number of bits in the minimum two's-complement
                   representation, excluding the sign bit.
                  ( Type of result: integer,
                    bitLength(A)  ord(succ(log2(A))) for A >= 0_,
                    bitLength(A)  bitLength(pred(-A)) for A < 0_,
                    bitLength(0_)  0,
                    bitLength(-1_)  0 )
      lowestSetBit(A) Index of the lowest-order one bit
                      For A <> 0_ this is equal to the number of
                      lowest-order zero bits.
                  ( Type of result: integer,
                    A >> B << B = A for A <> 0_ and B = lowestSetBit(A),
                    lowestSetBit(0_)  -1,
                    lowestSetBit(1_)  0,
                    lowestSetBit(2_)  1 )
      rand(A, B) Random number in the range [A, B]
                 The random values are uniform distributed.
                  ( rand(A, B) returns a random number such that
                    A <= rand(A, B) and rand(A, B) <= B holds.
                    rand(A, A)  A,
                    rand(1_, 0_)  EXCEPTION RANGE_ERROR )
      min(A, B) Minimum of two numbers.
                  ( min(1_, 2_)  1_ )
      max(A, B) Maximum of two numbers.
                  ( max(1_, 2_)  2_ )
      compare(A, B) Compare function
                  ( Type of result: integer,
                    compare(1_, 2_)  -1,
                    compare(5_, 5_)  0,
                    compare(8_, 7_)  1 )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      A +:= B   Increment A by B
                  ( A +:= B  A := A + B )
      A -:= B   Decrement A by B
                  ( A -:= B  A := A - B )
      A *:= B   Multiplying copy
                  ( A *:= B  A := A * B )
      A <<:= B  Shift left copy
                  ( A <<:= B  A := A << B )
      A >>:= B  Shift right copy
                  ( A >>:= B  A := A >> B )
      incr(A)   Increment with 1
                  ( incr(A)  A +:= 1_ )
      decr(A)   Decrement with 1
                  ( decr(A)  A -:= 1_ )
      ignore(A) Ignore value

For the operations div and rem holds for all A:

    (A div B) * B + A rem B = A           when B <> 0_
    -A div B = -(A div B)                 when B <> 0_
    -A rem B = -(A rem B)                 when B <> 0_
    A rem B >= 0_ and A rem B < abs(B)    when B <> 0_ and A >= 0_
    A rem B <= 0_ and A rem B > -abs(B)   when B <> 0_ and A <= 0_

For the operations mdiv and mod holds for all A:

    (A mdiv B) * B + A mod B = A          when B <> 0_
    -A mdiv B = A mdiv -B                 when B <> 0_
    -A mod -B = -(A mod B)                when B <> 0_
    A mod B >= 0_ and A mod B < B         when B > 0_
    A mod B <= 0_ and A mod B > B         when B < 0_

For the operation mdiv holds:

    A mdiv B = A div B - 1_           when A and B have different
                                      signs and A rem B <> 0_ holds.
    A mdiv B = A div B                when A and B have the same
                                      sign or A rem B = 0_ holds.
    A mdiv B = (A - 1_) div B - 1_    when A > 0_ and B < 0_ holds.
    A mdiv B = (A + 1_) div B - 1_    when A < 0_ and B > 0_ holds.
    A mdiv 2_ ** B = A >> B           when B >= 0 holds

For the operation mod holds:

    A mod B = A rem B + B      when A and B have different
                               signs and A rem B <> 0_ holds.
    A mod B = A rem B          when A and B have the same
                               sign or A rem B = 0_ holds.

Tables for the behavior of div, rem, mdiv and mod:

A B A div B A rem B A mdiv B A mod B
5_ 3_ 1_ 2_ 1_ 2_
4_ 3_ 1_ 1_ 1_ 1_
3_ 3_ 1_ 0_ 1_ 0_
2_ 3_ 0_ 2_ 0_ 2_
1_ 3_ 0_ 1_ 0_ 1_
0_ 3_ 0_ 0_ 0_ 0_
-1_ 3_ 0_ -1_ -1_ 2_
-2_ 3_ 0_ -2_ -1_ 1_
-3_ 3_ -1_ 0_ -1_ 0_
-4_ 3_ -1_ -1_ -2_ 2_
-5_ 3_ -1_ -2_ -2_ 1_
A B A div B A rem B A mdiv B A mod B
5_ -3_ -1_ 2_ -2_ -1_
4_ -3_ -1_ 1_ -2_ -2_
3_ -3_ -1_ 0_ -1_ 0_
2_ -3_ 0_ 2_ -1_ -1_
1_ -3_ 0_ 1_ -1_ -2_
0_ -3_ 0_ 0_ 0_ 0_
-1_ -3_ 0_ -1_ 0_ -1_
-2_ -3_ 0_ -2_ 0_ -2_
-3_ -3_ 1_ 0_ 1_ 0_
-4_ -3_ 1_ -1_ 1_ -1_
-5_ -3_ 1_ -2_ 1_ -2_

Tables for the behavior of ! (Binomial coefficient):

n ! k k
-5_ -4_ -3_ -2_ -1_ 0_ 1_ 2_ 3_ 4_ 5_
n -5_ 0_ 0_ 0_ 0_ 0_ 1_ -5_ 15_ -35_ 70_ -126_
-4_ 0_ 0_ 0_ 0_ 0_ 1_ -4_ 10_ -20_ 35_ -56_
-3_ 0_ 0_ 0_ 0_ 0_ 1_ -3_ 6_ -10_ 15_ -21_
-2_ 0_ 0_ 0_ 0_ 0_ 1_ -2_ 3_ -4_ 5_ -6_
-1_ 0_ 0_ 0_ 0_ 0_ 1_ -1_ -1_ -1_ -1_ -1_
0_ 0_ 0_ 0_ 0_ 0_ 1_ 0_ 0_ 0_ 0_ 0_
1_ 0_ 0_ 0_ 0_ 0_ 1_ 1_ 0_ 0_ 0_ 0_
2_ 0_ 0_ 0_ 0_ 0_ 1_ 2_ 1_ 0_ 0_ 0_
3_ 0_ 0_ 0_ 0_ 0_ 1_ 3_ 3_ 1_ 0_ 0_
4_ 0_ 0_ 0_ 0_ 0_ 1_ 4_ 6_ 4_ 1_ 0_
5_ 0_ 0_ 0_ 0_ 0_ 1_ 5_ 10_ 10_ 5_ 1_

For the sqrt function holds (when A >= 0_):

    sqrt(A) * sqrt(A) <= A and
    (sqrt(A) + 1_) * (sqrt(A) + 1_) > A

5.4 rational

The type rational consists of rational numbers represented with an integer numerator and an integer denominator. The values of the type rational are finite and periodical decimal numbers. Rational literals do not exist. If a rational operation overflows it raises the exception OVERFLOW_ERROR. In integer computations an overflow can only happen with very huge positive or negative numbers. In rational computations an overflow can happen with small numbers. Because of widening big denominators can be produced easily. E.g.: 1/1777 + 1/1999 = 3776/3552223 . The rational functions are defined in the library "rational.s7i".

    Elements:
      var integer: numerator is 0;
      var integer: denominator is 1;
    Constants:
      rational.value  Default value of rational (0/1)
    Prefix operators:
      +         Identity
      -         Change sign
    Infix operators:
      +         Addition
      -         Subtraction
      *         Multiplication
      /         Division
      /         Create rational from numerator and denominator
                  ( Type of left operand: integer,
                    Type of right operand: integer )
      **        Power
                  ( rational ** integer )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      rational conv A   Conversion of integer to rational
                  ( Type of argument A: integer,
                    rational conv 1  1 / 1 )
      digits    Conversion to string with specified precision
                  ( Type of right operand: integer,
                    Type of result: string,
                    1/64 digits 7  "0.0156250",
                    1/64 digits 4  "0.0156",
                    1/64 digits 2  "0.02",
                    355/113 digits 6  "3.141593",
                    22/7 digits 0  "3",
                    -1/2 digits 1  "-1",
                    1/0 digits 5  "Infinity",
                    -1/0 digits 6  "-Infinity",
                    0/0 digits 7  "NaN",
                    -1/2048 digits 3  "0.000" )
      sci       Conversion to a string in scientific notation
                  ( Type of right operand: integer,
                    Type of result: string,
                    1/64 sci 4  "1.5625e-2",
                    1/64 sci 3  "1.563e-2",
                    1/64 sci 2  "1.56e-2",
                    355/113 sci 6  "3.141593e+0",
                    22/7 sci 0  "3e+0",
                    -1/2 sci 1  "-5.0e-1",
                    1/0 sci 5  "Infinity",
                    -1/0 sci 6  "-Infinity",
                    0/0 sci 7  "NaN",
                    -1/2048 sci 3  "-4.883e-4",
                    -0/1 sci 2  "0.00e+0" )
      rational parse A   Conversion of string to rational
                  ( Type of argument A: string,
                    rational parse "3/5"  3 / 5,
                    rational parse "1.25"  5 / 4,
                    rational parse "0.(3)"  1 / 3,
                    rational parse "1.23(45)"  679 / 550,
                    rational parse "3.(142857)"  22 / 7,
                    rational parse "0.(846153)"  11 / 13 )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      abs(A)    Absolute value
      rat(A)    Conversion of integer to rational
                  ( Type of argument A: integer,
                    rat(1)  1 / 1 )
      rational(A)  Conversion of integer to rational
                  ( Type of argument A: integer,
                    rational(1)  1 / 1 )
      rational(A)  Conversion of string to rational
                  ( Type of argument A: string,
                    rational("3/5")  3 / 5,
                    rational("1.25")  5 / 4,
                    rational("0.(3)")  1 / 3,
                    rational("1.23(45)")  679 / 550,
                    rational("3.(142857)")  22 / 7,
                    rational("0.(846153)")  11 / 13 )
      floor(A)  Truncation towards negative infinity
                  ( Type of result: integer,
                    floor(9/5)   1, floor(1/1)   1,
                    floor(-1/1)  -1, floor(-9/5)  -2 )
      ceil(A)   Rounding up towards positive infinity
                  ( Type of result: integer,
                    ceil(6/5)   2, ceil(1/1)   1,
                    ceil(-1/1)  -1, ceil(-6/5)  -1 )
      trunc(A)  Truncation towards zero
                  ( Type of result: integer,
                    trunc(9/5)   1, trunc(1/1)   1,
                    trunc(-1/1)  -1, trunc(-9/5)  -1 )
      round(A)  Round towards zero
                  ( Type of result: integer,
                    round(1/2)  1, round(-1/2)  -1,
                    round(2/5)  0, round(-2/5)  0 )
      round10(A, B)  Round with a decimal precision towards zero
                  ( Type of B: integer,
                    round10(1/4, 1)  3/10, round10(-1/4, 1)  -3/10,
                    round10(2/5, 0)  0/1, round(-2/5, 0)  0/1 )
      str(A)    Convert to a string with a decimal representation
                  ( Type of result: string,
                    str(1/3)  "0.(3)" )
      fraction(A)  Convert to a string with a fraction
                  ( Type of result: string,
                    fraction(rational("0.(3)"))  "1/3" )
      min(A, B) Minimum of two numbers.
                  ( min(2/5, 1/2)  2/5 )
      max(A, B) Maximum of two numbers.
                  ( max(2/5, 1/2)  1/2 )
      compare(A, B) Compare function
                  ( Type of result: integer,
                    compare(19/10, 2/1)  -1,
                    compare(26/5, 26/5)  0,
                    compare(8/1, 79/10)  1 )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      A +:= B   Increment A by B
                  ( A +:= B  A := A + B )
      A -:= B   Decrement A by B
                  ( A -:= B  A := A - B )
      A *:= B   Multiplying copy
                  ( A *:= B  A := A * B )
      A /:= B   Dividing copy
                  ( A /:= B  A := A / B )
      ignore(A) Ignore value

All calculations with rational numbers are done exact. (Without any rounding)

5.5 bigRational

The type bigRational consists of rational numbers represented with an bigInteger numerator and an bigInteger denominator. The values of the type bigRational are finite and periodical decimal numbers. BigRational literals do not exist. Although bigRational operations cannot overflow, it can happen that there is not enough memory to represent a bigRational value. In this case the exception MEMORY_ERROR is raised. The bigRational functions are defined in the library "bigrat.s7i".

    Elements:
      var bigInteger: numerator is 0_;
      var bigInteger: denominator is 1_;
    Constants:
      bigRational.value  Default value of bigRational (0_/1_)
    Prefix operators:
      +         Identity
      -         Change sign
    Infix operators:
      +         Addition
      -         Subtraction
      *         Multiplication
      /         Division
      /         Create bigRational from numerator and denominator
                  ( Type of left argument: bigInteger,
                    Type of right argument: bigInteger )
      **        Power
                  ( bigRational ** integer )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      bigRational conv A   Conversion of integer to bigRational
                  ( Type of argument A: integer,
                    bigRational conv 1  1_ / 1_ )
      bigRational conv A   Conversion of bigInteger to bigRational
                  ( Type of argument A: bigInteger,
                    bigRational conv 1_  1_ / 1_ )
      digits    Conversion to string with specified precision
                  ( Type of right operand: integer,
                    Type of result: string,
                    1_/64_ digits 7  "0.0156250",
                    1_/64_ digits 4  "0.0156",
                    1_/64_ digits 2  "0.02",
                    355_/113_ digits 6  "3.141593",
                    22_/7_ digits 0  "3",
                    -1_/2_ digits 1  "-1",
                    1_/0_ digits 5  "Infinity",
                    -1_/0_ digits 6  "-Infinity",
                    0_/0_ digits 7  "NaN",
                    -1_/2048_ digits 3  "0.000" )
      sci       Conversion to a string in scientific notation
                  ( Type of right operand: integer,
                    Type of result: string,
                    1_/64_ sci 4  "1.5625e-2",
                    1_/64_ sci 3  "1.563e-2",
                    1_/64_ sci 2  "1.56e-2",
                    355_/113_ sci 6  "3.141593e+0",
                    22_/7_ sci 0  "3e+0",
                    -1_/2_ sci 1  "-5.0e-1",
                    1_/0_ sci 5  "Infinity",
                    -1_/0_ sci 6  "-Infinity",
                    0_/0_ sci 7  "NaN",
                    -1_/2048_ sci 3  "-4.883e-4",
                    -0_/1_ sci 2  "0.00e+0" )
      bigRational parse A   Conversion of string to bigRational
                  ( Type of argument A: string,
                    bigRational parse "3/5"⇒ 3_ / 5_,
                    bigRational parse "1.25"  5_ / 4_,
                    bigRational parse "0.(3)"  1_ / 3_,
                    bigRational parse "1.23(45)"  679_ / 550_,
                    bigRational parse "3.(142857)"  22_ / 7_,
                    bigRational parse "0.(846153)"  11_ / 13_ )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      abs(A)    Absolute value
      rat(A)    Conversion of bigInteger to bigRational
                  ( Type of argument A: bigInteger,
                    rat(1_)  1_ / 1_ )
      bigRational(A)  Conversion of integer to bigRational
                  ( Type of argument A: integer,
                    bigRational(1)  1_ / 1_ )
      bigRational(A)  Conversion of bigInteger to bigRational
                  ( Type of argument A: bigInteger,
                    bigRational(1_)  1_ / 1_ )
      bigRational(A)  Conversion of string to bigRational
                  ( Type of argument A: string,
                    bigRational("3/5")  3_ / 5_,
                    bigRational("1.25")  5_ / 4_,
                    bigRational("0.(3)")  1_ / 3_,
                    bigRational("1.23(45)")  679_ / 550_,
                    bigRational("3.(142857)")  22_ / 7_,
                    bigRational("0.(846153)")  11_ / 13_ )
      floor(A)  Truncation towards negative infinity
                  ( Type of result: bigInteger,
                    floor(9_/5_)   1_, floor(1_/1_)   1_,
                    floor(-1_/1_)  -1_, floor(-9_/5_)  -2_ )
      ceil(A)   Rounding up towards positive infinity
                  ( Type of result: bigInteger,
                    ceil(6_/5_)   2_, ceil(1_/1_)   1_,
                    ceil(-1_/1_)  -1_, ceil(-6_/5_)  -1_ )
      trunc(A)  Truncation towards zero
                  ( Type of result: bigInteger,
                    trunc(9_/5_)   1_, trunc(1_/1_)   1_,
                    trunc(-1_/1_)  -1_, trunc(-9_/5_)  -1_ )
      round(A)  Round towards zero
                  ( Type of result: bigInteger,
                    round(1_/2_)  1_, round(-1_/2_)  -1_,
                    round(2_/5_)  0_, round(-2_/5_)  0_ )
      round10(A, B)  Round with a decimal precision towards zero
                  ( Type of B: integer,
                    round10(1_/4_, 1)  3_/10_, round10(-1_/4_, 1)  -3_/10_,
                    round10(2_/5_, 0)  0_/1_, round(-2_/5_, 0)  0_/1_ )
      str(A)    Convert to a string with a decimal representation
                  ( Type of result: string,
                    str(1_/3_)  "0.(3)" )
      fraction(A)  Convert to a string with a fraction
                  ( Type of result: string,
                    fraction(bigRational("0.(3)"))  "1/3" )
      min(A, B) Minimum of two numbers.
                  ( min(2_/5_, 1_/2_)  2_/5_ )
      max(A, B) Maximum of two numbers.
                  ( max(2_/5_, 1_/2_)  1_/2_ )
      compare(A, B) Compare function
                  ( Type of result: integer,
                    compare(19_/10_, 2_/1_)  -1,
                    compare(26_/5_, 26_/5_)  0,
                    compare(8_/1_, 79_/10_)  1 )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      A +:= B   Increment A by B
                  ( A +:= B  A := A + B )
      A -:= B   Decrement A by B
                  ( A -:= B  A := A - B )
      A *:= B   Multiplying copy
                  ( A *:= B  A := A * B )
      A /:= B   Dividing copy
                  ( A /:= B  A := A / B )
      ignore(A) Ignore value

All calculations with bigRational numbers are done exact. (Without any rounding)

5.6 float

The type float consists of double precision floating point numbers. Float literals use base 10 and contain a decimal point. There must be at least one digit before and after the decimal point. An exponent part, which is introduced with E or e, is optional. The exponent can be signed, but the mantissa is not. A literal does not have a sign, + or - are unary operations. Examples of float literals are:

  3.14159265358979
  1.0E-12
  0.1234

The function str and the operators digits and parse create and accept float literals with sign. Basic float functions are defined in the library "float.s7i". Trigonometric- and other mathematical functions are defined in the library "math.s7i".

    Constants:
      float.value  Default value of float (0.0)
      Infinity     Positive infinity
      NaN          Not-a-Number
      PI           Mathematical constant π
      E            Euler's number
    Prefix operators:
      +         Identity
      -         Change sign
    Infix operators:
      +         Addition
      -         Subtraction
      *         Multiplication
      /         Division
                  ( A / 0.0   Infinity for A > 0.0,
                    A / 0.0  -Infinity for A < 0.0,
                    0.0 / 0.0  NaN )
      **        Power
                  ( A ** B is okay for A > 0.0,
                    A ** B is okay for A < 0.0 and B is integer,
                    A ** B  NaN for A < 0.0 and B is not integer,
                    A ** 0.0  1.0,
                    NaN ** 0.0  1.0,
                    NaN ** B  NaN for B <> 0.0,
                    0.0 ** B  0.0 for B > 0.0,
                    0.0 ** 0.0  1.0,
                    0.0 ** B  Infinity for B < 0.0,
                    (-0.0) ** B  -Infinity for B < 0.0 and odd(B),
                    1.0 ** B  1.0,
                    1.0 ** NaN  1.0,
                    A ** NaN  NaN for A <> 1.0 )
      **        Power
                  ( Type of right operand: integer
                    A ** B is okay for A > 0.0,
                    A ** B is okay for A < 0.0,
                    A ** 0  1.0,
                    NaN ** 0  1.0,
                    NaN ** B  NaN for B <> 0,
                    0.0 ** B  0.0 for B > 0,
                    0.0 ** 0  1.0,
                    0.0 ** B  Infinity for B < 0,
                    (-0.0) ** B  -Infinity for B < 0 and odd(B),
                    A ** B  1.0 / A ** (-B) for B < 0 )
      A << B    Shift left
                  ( Type of argument B: integer
                    A << B  A * 2.0 ** B,
                    A << 0  A,
                    0.0 << B  0.0 )
      A >> B    Arithmetic shift right
                  ( Type of argument B: integer,
                    A >> B  A / 2.0 ** B,
                    A >> 0  A,
                    0.0 >> B  0.0 )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      float conv A   Conversion of integer to float
                  ( Type of argument A: integer,
                    float conv 1  1.0 )
      digits    Conversion to string with specified precision
                  ( Type of right operand: integer,
                    Type of result: string,
                    0.012345 digits 4  "0.0123",
                    1.2468 digits 2  "1.25",
                    0.125 digits 2  "0.12",
                    0.375 digits 2  "0.38",
                    Infinity digits A  "Infinity",
                    -Infinity digits A  "-Infinity",
                    NaN digits A  "NaN" )
      sci       Conversion to a string in scientific notation
                  ( Type of right operand: integer,
                    Type of result: string,
                    0.012345 sci 4  "1.2345e-2",
                    1.2468 sci 2  "1.25e+0",
                    3.1415 sci 0  "3e+0",
                    0.125 sci 1  "1.2e-1",
                    0.375 sci 1  "3.8e-1",
                    Infinity sci 5  "Infinity",
                    -Infinity sci 6  "-Infinity",
                    NaN sci 7  "NaN",
                    -0.004 sci 2  "-4.00e-3" )
      exp       Set the number of exponent digits in a scientific float notation.
                  ( Type of left operand: string,
                    Type of right operand: integer,
                    Type of result: string,
                    0.012345 sci 4 exp 2  "1.2345e-02",
                    1.2468e15 sci 2 exp 1  "1.25e+15",
                    3.1415 sci 0 exp 3  "3e+000",
                    0.125 sci 1 exp 2  "1.2e-01",
                    0.375 sci 1 exp 2  "3.8e-01",
                    Infinity sci 5 exp 2  "Infinity",
                    -Infinity sci 6 exp 2  "-Infinity",
                    NaN sci 7 exp 2  "NaN",
                    -0.004 sci 2 exp 2  "-4.00e-03" )
      float parse A   Conversion of string to float
                  ( Type of argument A: string,
                    float parse "1.2345"      1.2345,
                    float parse "1.2345e6"    1234500.0,
                    float parse "-1.0e-308"  -1.0e-308,
                    float parse "1"           1.0,
                    float parse "2."          2.0,
                    float parse ".5"          0.5,
                    float parse "-.25"       -0.25,
                    float parse "Infinity"    Infinity,
                    float parse "-Infinity"  -Infinity,
                    float parse "NaN"         NaN,
                    float parse "3.14PI"      EXCEPTION RANGE_ERROR )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      abs(A)    Absolute value
      flt(A)    Conversion of integer to float
                  ( Type of argument A: integer,
                    flt(1)  1.0 )
      float(A)  Conversion of integer to float
                  ( Type of argument A: integer,
                    float(1)  1.0 )
      float(A)  Conversion of string to float
                  ( Type of argument A: string,
                    float("1.2345")      1.2345,
                    float("1.2345e6")    1234500.0,
                    float("-1.0e-308")  -1.0e-308,
                    float("1")           1.0,
                    float("2.")          2.0,
                    float(".5")          0.5,
                    float("-.25")       -0.25,
                    float("Infinity")    Infinity,
                    float("-Infinity")  -Infinity,
                    float("NaN")         NaN,
                    float("3.14PI")      EXCEPTION RANGE_ERROR )
      floor(A)  Truncation towards negative infinity
                  ( floor( 1.8)   1.0, floor( 1.0)   1.0,
                    floor(-1.0)  -1.0, floor(-1.2)  -2.0,
                    floor( 0.9)   0.0, floor(-0.1)  -1.0 )
      ceil(A)   Rounding up towards positive infinity
                  ( ceil( 1.2)   2.0, ceil( 1.0)   1.0,
                    ceil(-1.8)  -1.0, ceil(-1.0)  -1.0,
                    ceil( 0.1)   1.0, ceil(-0.9)   0.0 )
      trunc(A)  Truncation towards zero
                  ( Type of result: integer,
                    trunc( 1.8)   1, trunc( 1.0)   1,
                    trunc(-1.8)  -1, trunc(-1.0)  -1,
                    trunc( 0.9)   0, trunc(-0.9)   0 )
      round(A)  Round towards zero
                  ( Type of result: integer,
                    round(1.5)  2, round(-1.5)  -2,
                    round(0.5)  1, round(-0.5)  -1,
                    round(0.4)  0, round(-0.4)  0 )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str(Infinity)  "Infinity",
                    str(-Infinity)  "-Infinity",
                    str(NaN)  "NaN" )
      isNaN(A)  Check if A is Not-a-Number
      isNegativeZero(A)   Check if A is negative zero (-0.0)
      isPositiveZero(A)   Check if A is +0.0
      sin(A)    Sine
      cos(A)    Cosine
      tan(A)    Tangent
      exp(A)    Exponential function
      expm1(A)  Compute exp(x) - 1.0
      log(A)    Natural logarithm
                  ( log(A) is okay for A > 0.0,
                    log(1.0)    0.0,
                    log(0.0)   -Infinity,
                    log(-1.0)   NaN )
      log1p(A)  Compute log(1.0 + x)
                  ( log1p(A) is okay for A > -1.0,
                    log1p(0.0)    0.0,
                    log1p(-1.0)   -Infinity,
                    log1p(-2.0)   NaN )
      log10(A)  Base 10 logarithm
                  ( log10(A) is okay for A > 0.0,
                    log10(1.0)    0.0,
                    log10(0.0)   -Infinity,
                    log10(-1.0)   NaN )
      log2(A)  Base 2 logarithm
                  ( log2(A) is okay for A > 0.0,
                    log2(1.0)    0.0,
                    log2(0.0)   -Infinity,
                    log2(-1.0)   NaN )
      sqrt(A)   Square root
                  ( sqrt(A) is okay for A >= 0.0,
                    sqrt(-1.0)  NaN )
      asin(A)   Inverse sine
                  ( asin(A) is okay for A >= -1.0 and A <= 1.0,
                    asin(2.0)  NaN )
      acos(A)   Inverse cosine
                  ( acos(A) is okay for A >= -1.0 and A <= 1.0,
                    acos(2.0)  NaN )
      atan(A)   Inverse tangent
      atan2(A, B) Inverse tangent of A / B
      sinh(A)   Hyperbolic sine
      cosh(A)   Hyperbolic cosine
      tanh(A)   Hyperbolic tangent
      rand(A, B) Random number in the range [A, B)
                 The random values are uniform distributed.
                  ( rand(A, B) returns a random number such that
                    A <= rand(A, B) and rand(A, B) < B holds.
                    rand(A, A)  EXCEPTION RANGE_ERROR,
                    rand(1.0, 0.0)  EXCEPTION RANGE_ERROR )
      min(A, B) Minimum of two numbers.
                  ( min(2.5, 4.5)  2.5 )
      max(A, B) Maximum of two numbers.
                  ( max(2.5, 4.5)  4.5 )
      compare(A, B) Compare function
                  ( Type of result: integer,
                    compare(1.9, 2.1)  -1,
                    compare(5.3, 5.3)  0,
                    compare(7.8, 7.7)  1 )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      A +:= B   Increment A by B
                  ( A +:= B  A := A + B )
      A -:= B   Decrement A by B
                  ( A -:= B  A := A - B )
      A *:= B   Multiplying copy
                  ( A *:= B  A := A * B )
      A /:= B   Dividing copy
                  ( A /:= B  A := A / B )
      ignore(A) Ignore value

5.7 complex

The type complex consists of complex numbers represented with a float real part and a float imaginary part. Complex literals do not exist. The complex functions are defined in the library "complex.s7i".

    Elements:
      var float: re is 0.0;
      var float: im is 0.0;
    Constants:
      complex.value  Default value of complex (complex(0.0))
    Prefix operators:
      +         Identity
      -         Change sign
      conj      Complex conjugate
    Infix operators:
      +         Addition
      -         Subtraction
      *         Multiplication
      /         Division
                  ( A / complex(0.0)  complex(NaN, NaN) )
      **        Power
                  ( Type of right operand: integer
                    A ** B is okay for A > complex(0.0),
                    A ** B is okay for A < complex(0.0),
                    A ** 0  complex(1.0),
                    complex(0.0) ** B  complex(0.0) for B > 0,
                    complex(0.0) ** 0  complex(1.0),
                    complex(0.0) ** B  complex(Infinity, NaN) for B < 0 )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      complex conv A   Conversion of integer to complex
                  ( Type of argument A: integer,
                    complex conv A  complex(flt(A)) )
      complex conv A   Conversion of float to complex
                  ( Type of argument A: float,
                    complex conv A  complex(A) )
      digits    Conversion to string with specified precision
                  ( Type of right operand: integer,
                    Type of result: string,
                    complex(3.1415) digits 2  "3.14+0.00i" )
      sci       Conversion to a string in scientific notation
                  ( Type of right operand: integer,
                    Type of result: string,
                    complex(3.1415) sci 2  "3.14e+0+0.00e+0i" )
      complex parse A   Conversion of string to complex
                  ( Type of argument A: string )
    Relations:
      =, <>
    Functions:
      abs(A)    Absolute value
                  ( Type of result: float )
      sqrAbs(A) Square of absolute value
                  ( Type of result: float )
      arg(A)    Argument (=angle of the polar form of A)
                  ( Type of result: float )
      complex(A, B)  Return a complex number from its real and imaginary part
                  ( Type of argument A: float,
                    Type of argument B: float )
      complex(A)  Return a complex number from its real part
                  ( Type of argument A: float )
      complex(A)  Return a complex number from its real part
                  ( Type of argument A: integer )
      polar(A, B)  Return a complex number from polar coordinates
                  ( Type of argument A: float,
                    Type of argument B: float )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str(complex(1.125))  "1.125+0.0i" )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      A +:= B   Increment A by B
                  ( A +:= B  A := A + B )
      A -:= B   Decrement A by B
                  ( A -:= B  A := A - B )
      A *:= B   Multiplying copy
                  ( A *:= B  A := A * B )
      A /:= B   Dividing copy
                  ( A /:= B  A := A / B )
      ignore(A) Ignore value

5.8 char

The type char describes Unicode characters encoded with UTF-32. In the source file a character literal is written as UTF-8 encoded Unicode character enclosed in single quotes. In order to represent non-printable characters and certain printable characters the following escape sequences may be used.

audible alert BEL \a
backspace BS \b
escape ESC \e
formfeed FF \f
newline NL (LF) \n
carriage return CR \r
horizontal tab HT \t
vertical tab VT \v
backslash (\) \\
apostrophe (') \'
double quote (") \"
control-A \A
...
control-Z \Z

Additionally the following escape sequence can be used:

Examples of character literals are:

    'a'   ' '   '\n'   '!'   '\\'   '2'   '"'   '\"'   '\''   '\8;'

To use characters beyond ASCII (which is a subset of Unicode) in the source file make sure that the editor uses UTF-8 encoded characters. The char functions are defined in the library "char.s7i".

    Constants:
      char.value  Default value of char (' ')
    Infix operators:
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      char conv A   Conversion of integer to char
                  ( Type of argument A: integer,
                    char conv 65  'A' )
      char parse A   Conversion of string to char
                  ( Type of argument A: string )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      ord(A)    Ordinal number
                  ( Type of result: integer )
      integer(A)  Ordinal number
                  ( Type of result: integer )
      chr(A)    Conversion of integer to char
                  ( Type of argument: integer )
      char(A)   Conversion of integer to char
                  ( Type of argument: integer )
      char(A)   Conversion of string to char
                  ( Type of argument A: string )
      succ(A)   Successor
                  ( succ(A)  chr(succ(ord(A))) )
      pred(A)   Predecessor
                  ( pred(A)  chr(pred(ord(A))) )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str('A')  "A" )
      literal(A) Conversion to a literal
                  ( Type of result: string,
                    literal('A')  "'A'" )
      upper(A)  Conversion to upper case character
                  ( upper('A')  'A',
                    upper('z')  'Z' )
      lower(A)  Conversion to lower case character
                  ( lower('A')  'a',
                    lower('z')  'z' )
      isLetter  Is it an alphabetic Unicode character
                  ( isLetter('A')  TRUE,
                    isLetter('\16#4e2d;')  TRUE,
                    isLetter('4')  FALSE,
                    isLetter('+')  FALSE,
                    isLetter('\t')  FALSE,
                    isLetter(KEY_LEFT)  FALSE,
                    isLetter(EOF)  FALSE )
      width  Number of screen columns occupied by a Unicode character
                  ( width('\n')  0,
                    width('\t')  0,
                    width(KEY_LEFT)  0,
                    width(EOF)  0 )
                    width('A')  1,
                    width('\16#4e2d;')  2 )
      rand(A, B) Random character in the range [A, B]
                 The random values are uniform distributed.
                  ( rand(A, B) returns a random character such that
                    A <= rand(A, B) and rand(A, B) <= B holds.
                    rand(A, A)  A,
                    rand('B', 'A')  EXCEPTION RANGE_ERROR )
      compare(A, B) Compare function
                  ( Type of result: integer,
                    compare('A', 'B')  -1,
                    compare('A', 'A')  0,
                    compare('B', 'A')  1 )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      incr(A)   Increment
                  ( incr(A)  A := succ(A) )
      decr(A)   Decrement
                  ( decr(A)  A := pred(A) )
      ignore(A) Ignore value

5.9 string

The type string describes sequences of Unicode characters (including the empty string). The characters in the string use the UTF-32 encoding. Strings are not '\0;' terminated. Therefore they can also contain binary data. Although strings are allowed to grow very big, it can happen that there is not enough memory to represent a string value. In this case the exception MEMORY_ERROR is raised. In the source file a string literal is a sequence of UTF-8 encoded Unicode characters surrounded by double quotes.

To represent control characters and certain other characters in strings the same escape sequences as for character literals may be used. E.g.: Quotation characters (") inside strings can be represented by preceding them with a backslash ( \" ). Additionally there is the following possibility:

Examples of string literals are:

    ""   " "   "\""   "'"   "Gold"   "A\"B !"   "Euro: \8364;"   "CRLF\r\n"

To use characters beyond ASCII (which is a subset of Unicode) in the source file make sure that the editor uses UTF-8 encoded characters. The string functions are defined in the library "string.s7i".

    Constants:
      string.value  Default value of string ("")
    Infix operators:
      &         String concatenation
                  ( "All " & "OK"  "All OK" )
      <&        String concatenation with weak priority
                Overloaded for various types with enable_output or enable_io
                  ( write("i=" <& i digits 2 lpad 6 <& " $"); )
      mult      String multiplication
                  ( Type of right operand: integer,
                    "LA" mult 3  "LALALA",
                    "WORD" mult 0  "",
                    "ANY" mult -1  EXCEPTION RANGE_ERROR )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      lpad      Left padding with spaces
                  ( Type of right operand: integer,
                    "HELLO" lpad  8  "   HELLO",
                    "HELLO" lpad  6  " HELLO",
                    "HELLO" lpad  5  "HELLO",
                    "HELLO" lpad  4  "HELLO",
                    "HELLO" lpad  0  "HELLO",
                    "HELLO" lpad -8  "HELLO" )
      lpad0     Left padding with zeroes
                  ( Type of right operand: integer,
                    "12" lpad0  5  "00012",
                    "12" lpad0  3  "012",
                    "12" lpad0  2  "12",
                    "12" lpad0  1  "12",
                    "12" lpad0  0  "12",
                    "12" lpad0 -5  "12" )
      rpad      Right padding with spaces
                  ( Type of right operand: integer,
                    "HELLO" rpad  8  "HELLO   ",
                    "HELLO" rpad  6  "HELLO ",
                    "HELLO" rpad  5  "HELLO",
                    "HELLO" rpad  4  "HELLO",
                    "HELLO" rpad  0  "HELLO",
                    "HELLO" rpad -8  "HELLO" )
      string parse A   Identity
    Indices:
      [ A ]     Access one character
                  ( Type of argument A: integer,
                    Type of result: char,
                    "abcde"[1]  'a',
                    "abcde"[5]  'e',
                    "abcde"[0]  EXCEPTION INDEX_ERROR,
                    "abcde"[6]  EXCEPTION INDEX_ERROR )
      [ A .. B ] Access a substring from position A to B
                  ( Type of arguments A and B: integer,
                    S[A .. B] is okay for A >= 1 and B >= pred(A),
                    "abcde"[2 .. 4]  "bcd",
                    "abcde"[2 .. 7]  "bcde",
                    "abcde"[4 .. 3]  "",
                    "abcde"[4 .. 2]  EXCEPTION INDEX_ERROR,
                    "abcde"[6 .. 8]  "",
                    "abcde"[1 .. 3]  "abc",
                    "abcde"[0 .. 3]  EXCEPTION INDEX_ERROR,
                    "abcde"[1 .. 0]  "",
                    "abcde"[1 .. -1]  EXCEPTION INDEX_ERROR )
      [ A len B ] Access a substring from position A with length B
                  ( Type of arguments A and B: integer,
                    S[A len B] is okay for A >= 1 and B >= 0,
                    "abcde"[2 len 3]  "bcd",
                    "abcde"[2 len 5]  "bcde",
                    "abcde"[3 len 0]  "",
                    "abcde"[6 len 2]  "",
                    "abcde"[3 len -1]  EXCEPTION INDEX_ERROR,
                    "abcde"[1 len 2]  "ab",
                    "abcde"[0 len 2]  EXCEPTION INDEX_ERROR )
      [ A fixLen B ] Access a substring from position A with guaranteed length B
                  ( Type of arguments A and B: integer,
                    S[A fixLen B] is okay for A >= 1 and A <= length(S) and
                          B >= 0 and pred(A + B) <= length(S),
                    "abcde"[2 fixLen 3]  "bcd",
                    "abcde"[2 fixLen 5]  EXCEPTION INDEX_ERROR,
                    "abcde"[3 fixLen 0]  "",
                    "abcde"[6 fixLen 2]  EXCEPTION INDEX_ERROR,
                    "abcde"[3 fixLen -1]  EXCEPTION INDEX_ERROR,
                    "abcde"[1 fixLen 2]  "ab",
                    "abcde"[0 fixLen 2]  EXCEPTION INDEX_ERROR )
      [ A .. ]  Access a substring beginning at position A
                  ( Type of argument A: integer,
                    S[A ..] is okay for A >= 1,
                    "abcde"[3 ..]  "cde",
                    "abcde"[6 ..]  "",
                    ""[1 ..]  "",
                    "abcde"[1 ..]  "abcde",
                    "abcde"[0 ..]   EXCEPTION INDEX_ERROR )
      [ .. A ]  Access a substring ending at position A
                  ( Type of argument A: integer,
                    S[.. A] is okay for A >= 0,
                    "abcde"[.. 4]  "abcd",
                    "abcde"[.. 6]  "abcde",
                    ""[.. 5]  "",
                    "abcde"[.. 0]  "",
                    "abcde"[.. -1]  EXCEPTION INDEX_ERROR )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      length(A) Length of string
                  ( Type of result: integer,
                    length("")  0 )
      pos(A,B)  First position of char B in string A
                  ( Type of argument B: char,
                    Type of result: integer,
                    pos("ABCABC",'B')  2,
                    pos("XYZ",'A')  0 )
      pos(A,B)  First position of string B in string A
                  ( Type of result: integer,
                    pos("ABCDE ABCDE","BC")  2,
                    pos("XYZXYZ","ZYX")  0,
                    pos("123456789","")  0 )
      pos(A,B,C) First position of char B in string A
                 The search starts at position C of string A
                  ( Type of argument B: char,
                    Type of argument C: integer,
                    Type of result: integer,
                    pos("ABCABC",'B', 3)  5,
                    pos("XYZYX",'Z', 4)  0,
                    pos("12345",'3', 7)  0 )
      pos(A,B,C) First position of string B in string A
                 The search starts at position C of string A
                  ( Type of argument C: integer,
                    Type of result: integer,
                    pos("ABCDE ABCDE","BC", 3)  8,
                    pos("XYZXYZ","ZXY", 4)  0,
                    pos("12345","34", 7)  0 )
                    pos("123456789","", 2)  0 )
      rpos(A,B) Last position of char B in string A
                  ( Type of argument B: char,
                    Type of result: integer,
                    rpos("ABCABC",'B')  5,
                    rpos("XYZ",'A')  0 )
      rpos(A,B) Last position of string B in string A
                  ( Type of result: integer,
                    rpos("ABCDE ABCDE","BC")  8,
                    rpos("XYZXYZ","ZYX")  0,
                    rpos("123456789","")  0 )
      rpos(A,B,C) Last position of char B in string A
                  The search starts at position C of string A
                  ( Type of argument B: char,
                    Type of argument C: integer,
                    Type of result: integer,
                    rpos("ABCABC",'B', 4)  2,
                    rpos("XYZYX",'Z', 2)  0,
                    rpos("12345",'3', 5)  3 )
      rpos(A,B,C) Last position of char B in string A
                  The search starts at position C of string A
                  ( Type of argument C: integer,
                    Type of result: integer,
                    rpos("ABCABC","BC", 4)  2,
                    rpos("XYZYX","ZY", 2)  0,
                    rpos("12345","34", 5)  3 )
      startsWith(A,B) Determine if a string starts with a prefix.
                  ( Type of result: boolean,
                    startsWith("tmp_s7c.c", "tmp_")  TRUE,
                    startsWith("example", "E")  FALSE )
      endsWith(A,B) Determine if a string ends with a suffix.
                  ( Type of result: boolean,
                    endsWith("hello.sd7", ".sd7")  TRUE,
                    endsWith("A string", "\0;")  FALSE )
      equalAtIndex(A,B,C) Check if A has the searched characters B starting from C.
                  ( Type of result: boolean,
                    equalAtIndex("The quick brown fox", "quick", 5)  TRUE,
                    equalAtIndex("axis", "xi", 3)  FALSE )
      replace(A,B,C) Search A for occurrences of B and replace them with C
                  ( replace("old gold", "old", "one")  "one gone" )
      replace2(A,B,C,D) Search A for occurrences of B followed by C and
                replace them with D.
                  ( replace2("x := (*ord*) y;", "(*", "*)", "")  "x :=  y;" )
      split(A,B) Split A into strings delimited by B
                  ( Type of argument B: char,
                    Type of result: array string,
                    split("", ':')  [](""),
                    split(":", ':')  []("", ""),
                    split("15:30", ':')  []("15", "30") )
      split(A,B) Split A into strings delimited by B
                  ( Type of result: array string,
                    split("", "")  [](""),
                    split("ABC", "")  []("ABC"),
                    split("", "; ")  [](""),
                    split("writeln; readln;", "; ")  []("writeln", "readln;") )
      join(A,B) Join the elements of A together with B's between them
                  ( Type of argument A: array string,
                    Type of argument B: char,
                    join([]("This", "is", "a", "test"), ' ')  "This is a test" )
      join(A,B) Join the elements of A together with B's between them
                  ( Type of argument A: array string,
                    Type of argument B: string,
                    join([]("pro", "gram"), "")  "program" )
      trim(A)   Removes leading and trailing spaces and control chars
                  ( trim(" /n xyz /r")  "xyz" )
      ltrim(A)   Removes leading spaces and control chars
                  ( ltrim(" /n xyz /r")  "xyz /r" )
      rtrim(A)   Removes trailing spaces and control chars
                  ( rtrim(" /n xyz /r")  " /n xyz" )
      str(A)    Conversion to string
                  ( str(A)  A )
      literal(A) Conversion to a literal
                  ( literal("ABC")  "\"ABC\"",
                    literal("O' \"X\"")  "\"O\' \\\"X\\\"\"" )
      upper(A)  Conversion to upper case characters
                  ( upper("Upper")  "UPPER" )
      lower(A)  Conversion to lower case characters
                  ( lower("Lower")  "lower" )
      compare(A, B) Compare function
                  ( Type of result: integer,
                    compare("ABC", "ABCD")  -1,
                    compare("ABC", "ABC")  0,
                    compare("ABCD", "ABCC")  1 )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      A &:= B   Append B to A
                  ( A &:= B  A := A & B )
      A &:= B   Append B to A
                  ( Type of argument B: char,
                    A &:= B  A := A & str(B) )
      A @:= [B] C  Assign C to element B of string A
                  ( Type of argument B: integer,
                    Type of argument C: char,
                    A @:= [B] C 
                        A := A[..pred(B)] & str(C) & A[succ(B)..],
                    A @:= [0] 'x'  EXCEPTION INDEX_ERROR,
                    A @:= [succ(length(A))] 'x'  EXCEPTION INDEX_ERROR )
      A @:= [B] C  Assign C to the position B of string A
                  ( Type of argument B: integer,
                    A @:= [B] C 
                        A := A[..pred(B)] & C & A[B+length(C)..],
                    A @:= [0] "xyz"  EXCEPTION INDEX_ERROR,
                    A @:= [pred(length(A))] "xyz"  EXCEPTION INDEX_ERROR )
      ignore(A) Ignore value
      for forVar range aString do
        statements
      end for   Loop over all elements of a string
                  ( Type of argument forVar: char,
                    Type of argument statements: proc )
      for key keyVar range aString do
        statements
      end for   Loop over all indices of a string
                  ( Type of argument keyVar: integer,
                    Type of argument statements: proc )
      for forVar key keyVar range aString do
        statements
      end for   Loop over all elements and indices of a string
                  ( Type of argument forVar: char,
                    Type of argument keyVar: integer,
                    Type of argument statements: proc )
      for forVar range aString until condition do
        statements
      end for   Loop over all elements of a string until condition is TRUE
                Check the condition before the statements in the loop body are executed.
                  ( Type of argument forVar: char,
                    Type of argument condition: boolean,
                    Type of argument statements: proc )
      for key keyVar range aString until condition do
        statements
      end for   Loop over all indices of a string until condition is TRUE
                Check the condition before the statements in the loop body are executed.
                  ( Type of argument keyVar: integer,
                    Type of argument condition: boolean,
                    Type of argument statements: proc )
      for forVar key keyVar range aString until condition do
        statements
      end for   Loop over all elements and indices of a string until condition is TRUE
                Check the condition before the statements in the loop body are executed.
                  ( Type of argument forVar: char,
                    Type of argument keyVar: integer,
                    Type of argument condition: boolean,
                    Type of argument statements: proc )

5.10 array

The type array baseType describes sequences of baseType elements (including the empty sequence). Examples of array type declarations are:

const type: striArrayType is array string;
const type: structArrayType is array aStructType;

This defines striArrayType as an array type with string elements. The second line defines structArrayType as an array type with aStructType elements. Variables of these types are declared with:

var striArrayType: striArr1 is striArrayType.value; # Empty array with starting index 1.
var striArrayType: striArr2 is 0 times "";          # Empty array with starting index 1.
var striArrayType: striArr4 is [0 .. -1] times "";  # Empty array with starting index 0.
var striArrayType: striArr3 is [0 len 0] times "";  # Empty array with starting index 0.
var striArrayType: striArr5 is [] ("one", "two");   # Array with two string elements and starting index 1.
var striArrayType: striArr6 is [0] ("zero", "one"); # Array with two string elements and starting index 0.
var structArrayType: structArr1 is structArrayType.value;
var structArrayType: structArr2 is 10 times aStructType.value;
var structArrayType: structArr3 is [42 .. 365] times aStructType.value;

An element of an array can be accessed with an integer index. The minimum and maximum indices of an array are part of the value and can be obtained with the functions minIdx and maxIdx. There are functions which generate arrays with the default minimum index of 1 and other functions which generate arrays with the minimum index taken from a parameter. The array functions are defined in the library "array.s7i".

Arrays with non-integer index are defined in the library "idxarray.s7i". An array type with char index and bigInteger elements is defined as:

const type: charIndexArray is array [char] bigInteger;

Variables of this type are declared with:

var charIndexArray: bigArr1 is charIndexArray.value;
var charIndexArray: bigArr2 is char times 42_;
var charIndexArray: bigArr3 is [char] (0_, 1_, 2_);
var charIndexArray: bigArr4 is [' '] (32_, 33_, 34_);

The definition of charIndexArray defines also the special times operator from above and the special possibilities to define literals of charIndexArray.

    Literal:
      [] (elem1, elem2)      Create an array with the given elements.
                             Index type is integer and starting index is 1.
      [0] (elem1, elem2)     Create an array with the given elements.
                             Index type is integer and starting index is 0.
      [char] (elem1, elem2)  Create an array with the given elements.
                             Index type is char and starting index is char.value (' ').
      ['A'] (elem1, elem2)   Create an array with the given elements.
                             Index type is char and starting index is 'A'.
    Infix operators:
      &         Array concatenation
      times     Array generation
                  ( Left operand: integer,
                    Right operand: baseType,
                    A times B Generates an array baseType with A elements of B,
                    3 times B  [] (B, B, B),
                    0 times B  empty array with starting index 1,
                    (1 times B)[1]  B,
                    (0 times B)[1]  EXCEPTION INDEX_ERROR,
                    -1 times B  EXCEPTION RANGE_ERROR )
      [ A .. B ] times C    Array generation
                  ( Type of arguments A and B: integer,
                    Type of argument C: baseType,
                    [ A .. B ] times C Generates an array baseType
                    with pred(B - A) elements of C,
                    [ -1 .. -2 ] times B  empty array with starting index -1,
                    [ -1 .. -3 ] times B  EXCEPTION RANGE_ERROR )
      [ A len L ] times C    Array generation
                  ( Type of arguments A and L: integer,
                    Type of argument C: baseType,
                    [ A len L ] times C Generates an array baseType
                    with L elements of C,
                    [ -1 len 0 ] times B  empty array with starting index -1,
                    [ -1 len -1 ] times B  EXCEPTION RANGE_ERROR )
      indexType times A   Array generation for indices from indexType.first
                          to indexType.last.
                  ( Type of argument A: baseType,
                    boolean times 5  [FALSE] (5, 5) )
    Indices:
      [ A ]     Access one array element
                  ( Type of argument A: integer,
                    Type of result: baseType,
                    A[minIdx(A)]  First element,
                    A[maxIdx(A)]  Last element,
                    A[pred(minIdx(A))]  EXCEPTION INDEX_ERROR,
                    A[succ(maxIdx(A))]  EXCEPTION INDEX_ERROR )
      [ A .. B ]  Get a sub array from the position A to the position B
                  ( Type of arguments A and B: integer,
                    X[A .. B] is okay for A >= minIdx(X) and B >= pred(A),
                    anArray[pred(minIdx(anArray)) .. n]  EXCEPTION INDEX_ERROR,
                    anArray[n .. n - 2]  EXCEPTION INDEX_ERROR )
      [ A len B ]  Get a sub array from the position A with maximum length B
                  ( Type of arguments A and B: integer,
                    X[A len B] is okay for A >= minIdx(X) and B >= 0,
                    anArray[pred(minIdx(anArray)) len n]  EXCEPTION INDEX_ERROR,
                    anArray[n len -1]  EXCEPTION INDEX_ERROR )
      [ A .. ]  Get a sub array beginning at position A
                  ( Type of argument A: integer,
                    X[A ..] is okay for A >= minIdx(X),
                    anArray[pred(minIdx(anArray)) ..]  EXCEPTION INDEX_ERROR )
      [ .. A ]  Get a sub array ending at position A
                  ( Type of argument A: integer,
                    X[.. A] is okay for A >= pred(minIdx(X)),
                    anArray[.. minIdx(anArray) - 2]  EXCEPTION INDEX_ERROR )
    Relations:
      =, <>
    Functions:
      length(A) Length of array
                  ( Type of result: integer,
                    length(A) = succ(maxIdx(A) - minIdx(A)),
                    length([] (2, 3, 5))   3,
                    length([0] (2, 3, 5))  3,
                    length([2] (2, 3, 5))  3,
                    length(['a'] (1, 2, 3))  3
                    length(0 times TRUE)  0,
                    length(5 times TRUE)  5 )
      minIdx(A) Minimum index of array
                  ( Type of result: integer,
                    minIdx([] (2, 3, 5))   1,
                    minIdx([0] (2, 3, 5))  0,
                    minIdx([2] (2, 3, 5))  2,
                    minIdx(['a'] (1, 2, 3))  'a',
                    minIdx(3 times TRUE)  1,
                    minIdx([-1 .. 4] times TRUE)  -1 )
      maxIdx(A) Maximum index of array
                  ( Type of result: integer,
                    maxIdx([] (2, 3, 5))   3,
                    maxIdx([0] (2, 3, 5))  2,
                    maxIdx([2] (2, 3, 5))  4,
                    maxIdx(['a'] (1, 2, 3))  'c',
                    maxIdx(3 times TRUE)  3,
                    maxIdx([-1 .. 4] times TRUE)  4 )
      rand(A)   Random element from an array
                The random elements are uniform distributed.
                  ( Type of result:  baseType )
      remove(A,B) Remove element with index B from array A and
                  return the removed element
                  ( Type of argument B: integer,
                    Type of result: baseType,
                    remove(A,B) is okay for B >= minIdx(A) and B <= maxIdx(A),
                    remove(anArray, 0)  EXCEPTION INDEX_ERROR for minIdx(anArray) = 1,
                    remove(anArray, 5)  EXCEPTION INDEX_ERROR for maxIdx(anArray) = 4 )
      remove(A,B,C) Remove the sub-array with with index B and length C from array A and
                    return the removed sub-array
                  ( Type of argument B: integer,
                    Type of argument C: integer,
                    remove(A,B,C) is okay for B >= minIdx(A) and B <= maxIdx(A) and C >= 0,
                    remove(anArray, 0, 1)  EXCEPTION INDEX_ERROR for minIdx(anArray) = 1,
                    remove(anArray, 6, 1)  EXCEPTION INDEX_ERROR for maxIdx(anArray) = 4,
                    remove(anArray, 1, -1)  EXCEPTION INDEX_ERROR )
      sort(A)   Sort array using the compare(baseType, baseType) function
    Statements:
      A &:= B   Append B to A
                  ( A &:= B  A := A & B )
      A &:= B   Append element B to A
                  ( Type of argument B: baseType,
                    A &:= B  A := A & [] (B) )
      insert(A,B,C) Insert element C into array A at index B
                  ( Type of argument B: integer,
                    Type of argument C: baseType,
                    insert(A,B,C) is okay for B >= minIdx(A) and B <= succ(maxIdx(A)),
                    insert(anArray, 0, anElement)  EXCEPTION INDEX_ERROR for minIdx(anArray) = 1,
                    insert(anArray, 6, anElement)  EXCEPTION INDEX_ERROR for maxIdx(anArray) = 4 )
      insert(A,B,C) Insert array C into array A at index B
                  ( Type of argument B: integer,
                    insert(A,B,C) is okay for B >= minIdx(A) and B <= succ(maxIdx(A)),
                    insert(anArray, 0, anotherAnarry)  EXCEPTION INDEX_ERROR for minIdx(anArray) = 1,
                    insert(anArray, 6, anotherAnarry)  EXCEPTION INDEX_ERROR for maxIdx(anArray) = 4 )
      insert(A, B) Insert B into the sorted array A
                  ( Type of argument B: baseType )
      ignore(A) Ignore value
      for forVar range anArray do
        statements
      end for   Loop over all elements of an array
                  ( Type of argument forVar: baseType,
                    Type of argument statements: proc )
      for key keyVar range anArray do
        statements
      end for   Loop over all indices of an array
                  ( Type of argument keyVar: indexType,
                    Type of argument statements: proc )
      for forVar key keyVar range anArray do
        statements
      end for   Loop over all elements and indices of an array
                  ( Type of argument forVar: baseType,
                    Type of argument keyVar: indexType,
                    Type of argument statements: proc )
      for forVar range anArray until condition do
        statements
      end for   Loop over all elements of an array until condition is TRUE
                Check the condition before the statements in the loop body are executed.
                  ( Type of argument forVar: baseType,
                    Type of argument condition: boolean,
                    Type of argument statements: proc )
      for key keyVar range anArray until condition do
        statements
      end for   Loop over all indices of an array until condition is TRUE
                Check the condition before the statements in the loop body are executed.
                  ( Type of argument keyVar: indexType,
                    Type of argument condition: boolean,
                    Type of argument statements: proc )
      for forVar key keyVar range anArray until condition do
        statements
      end for   Loop over all elements and indices of an array until condition is TRUE
                Check the condition before the statements in the loop body are executed.
                  ( Type of argument forVar: baseType,
                    Type of argument keyVar: indexType,
                    Type of argument condition: boolean,
                    Type of argument statements: proc )

5.11 hash

The type hash [keyType] baseType describes hash tables with elements of baseType. The elements can be accessed with an index of keyType. An example of a hash type declaration is:

const type: aHashType is hash [string] integer;

This defines aHashType as a hash type with integer elements and string keys. Variables of this type are declared with:

var aHashType: aHashTable is aHashType.value;

The expressions aHashType.value and aHashType.EMPTY_HASH describe empty hash tables. Beside them there are no hash table literals. The keyType of a hash needs to provide the functions hashCode and compare. Besides this the keyType can be any type. The hash functions are defined in the library "hash.s7i".

    Constants:
      hashType.EMPTY_HASH  Empty hash table
    Infix operators:
      in        Element
                  ( Left argument: baseType,
                    Type of result: boolean )
      not in    Is not Element
                  ( Left argument: baseType,
                    Type of result: boolean )
    Indices:
      [ A ]     Access one hash table element
                  ( Type of argument A: keyType,
                    Type of result: baseType )
    Functions:
      length(A) Number of elements in hash table A
                  ( Type of result: integer,
                    length(hashType.EMPTY_HASH)  0 )
      keys(A)   Unsorted array of keys from hash table A
                  ( Type of result: array keyType )
      values(A) Unsorted array of values from hash table A
                  ( Type of result: array baseType )
      flip(A)   Deliver a hash with keys and values flipped
                  ( Type of result: hash [baseType] array keyType )
    Statements:
      incl(A,B,C) Include element B to hash table A
                  ( Type of argument B: keyType,
                    Type of argument C: baseType )
      excl(A,B) Exclude element B from hash table A
                  ( Type of argument B: keyType )
      A @:= [B] C  Assign C to element B of hash table A
                  ( Type of argument B: keyType,
                    Type of argument C: baseType )
      ignore(A) Ignore value
      for forVar range aHash do
        statements
      end for   Unsorted loop over all values of a hash
                  ( Type of argument forVar: baseType,
                    Type of argument statements: proc )
      for key keyVar range aHash do
        statements
      end for   Unsorted loop over all keys of a hash
                  ( Type of argument keyVar: keyType,
                    Type of argument statements: proc )
      for forVar key keyVar range aHash do
        statements
      end for   Unsorted loop over all values and keys of a hash
                  ( Type of argument forVar: baseType,
                    Type of argument keyVar: keyType,
                    Type of argument statements: proc )

5.12 set

The type set of baseType describes a set of elements of a baseType. (including the empty set). An example of a set type declaration is:

const type: aSetType is set of integer;

This defines aSetType as a set type with integer elements. Variables of this type are declared with:

var aSetType: aSet is aSetType.value;
var aSetType: aSet is {1, 2, 3};
var aSetType: aSet is {1 .. 5};

The type set of baseType is defined in the library "set.s7i". This abstract data type decides about the implementation of the set. When baseType values can be mapped to integer with the ord function and ord does never raise an exception the set is implemented as bitset(baseType) (defined in the library "bitsetof.s7i"), otherwise the set is implemented as hashset(baseType) (defined in the library "hashsetof.s7i"). The type set of integer is an alternate name for bitset, which is defined in the library "bitset.s7i".

    Constants:
      {}                 Empty set of the type bitset
      EMPTY_SET          Empty set of the type bitset
      {1, 2}             Set with 1 and 2 (type: bitset)
      {'a', 'b', 'c'}    Set with three characters.
      {"black", "white"} Set with two strings.
      bitset.value       Default value of bitset ({})
      setType.EMPTY_SET  Empty set of the type setType
      setType.value      Default value of setType (setType.EMPTY_SET)
    Infix operators:
      |         Union
                  ( {1, 2} | {1, 3}  {1, 2, 3},
                    {'a', 'b'} | {'a', 'c'}  {'a', 'b', 'c'},
                    {"one", "two"} | {"one", "three"}  {"one", "two", "three"} )
      &         Intersection
                  ( {1, 2} & {1, 3}  {1},
                    {'a', 'b'} & {'a', 'c'}  {'a'},
                    {"one", "two"} & {"one", "three"}  {"one"} )
      -         Difference
                  ( {1, 2} - {1, 3}  {2},
                    {'a', 'b'} - {'a', 'c'}  {'b'},
                    {"one", "two"} - {"one", "three"}  {"two"} )
      ><        Symmetric Difference
                  ( {1, 2} >< {1, 3}  {2, 3},
                    {'a', 'b'} >< {'a', 'c'}  {'b', 'c'},
                    {"one", "two"} >< {"one", "three"}  {"two", "three"} )
      in        Element
                  ( Left argument: baseType,
                    Type of result: boolean,
                    2 in {2, 3, 5, 7}  TRUE,
                    4 in {2, 3, 5, 7}  FALSE,
                    'a' in {'a', 'c', 'd'}   TRUE,
                    'b' in {'a', 'c', 'd'}  FALSE,
                    "one" in {"one", "three"})  TRUE,
                    "two" in {"one", "three"})  FALSE )
      not in    Is not Element
                  ( Left argument: baseType,
                    Type of result: boolean,
                    2 not in {2, 3, 5, 7}  FALSE,
                    4 not in {2, 3, 5, 7}  TRUE,
                    'a' not in {'a', 'c', 'd'}  FALSE,
                    'b' not in {'a', 'c', 'd'}  TRUE,
                    "one" not in {"one", "three"})  FALSE,
                    "two" not in {"one", "three"})  TRUE )
    Relations:
      =, <>     Equal and not equal
                  ( Type of result: boolean )
      <=        Subset
                  ( Type of result: boolean,
                    A <= B  TRUE when no element X exists for which
                       X in A and X not in B
                    holds.
                    A <= B  FALSE when an element X exists for which
                       X in A and X not in B
                    holds.
                    setType.EMPTY_SET <= A  TRUE,
                    A <= setType.EMPTY_SET  FALSE for A <> EMPTY_SET,
                    A <= B  B >= A )
      <         Proper subset
                  ( Type of result: boolean,
                    A < B  A <= B and A <> B,
                    setType.EMPTY_SET < A  TRUE for A <> EMPTY_SET,
                    A < setType.EMPTY_SET  FALSE,
                    A < B  B > A )
      >=        Superset
                  ( Type of result: boolean,
                    A >= B  TRUE when no element X exists for which
                       X in B and X not in A
                    holds.
                    A >= B  FALSE when an element X exists for which
                       X in B and X not in A
                    holds.
                    A >= setType.EMPTY_SET  TRUE,
                    setType.EMPTY_SET >= A  FALSE for A <> EMPTY_SET,
                    A >= B  B <= A )
      >         Proper superset
                  ( Type of result: boolean,
                    A > B  A >= B and A <> B,
                    A > setType.EMPTY_SET  TRUE for A <> EMPTY_SET,
                    setType.EMPTY_SET > A  FALSE,
                    A > B  B < A )
    Functions:
      bitset(A) Convert an integer number to a bitset
                  ( Type of argument A: integer,
                    bitset(2220)  {2, 3, 5, 7, 11} )
      bitset(A) Convert a string to a bitset
                  ( Type of argumant A: string,
                    bitset("{}")  {},
                    bitset("{2, 3, 5, 7}")  {2, 3, 5, 7} )
      integer(A) Convert a bitset to an integer
                  ( Type of result: integer,
                    integer({2, 3, 5, 7, 11})  2220 )
      card(A)   Cardinality of a set
                  ( Type of result: integer,
                    card({2, 3, 5, 7, 11})  5,
                    card({'a', 'b', 'c'})  3,
                    card({"one", "two", "three"})  3
                    card(setType.EMPTY_SET)  0 )
      min(A)    Minimum element
                  ( Type of result: baseType,
                    Delivers the element from the set for
                    which the following condition holds:
                       Element <= X
                    for all X which are in the set.
                    min({2, 3, 5, 7, 11})  2,
                    min({'a', 'b', 'c'})  'a',
                    min(setType.EMPTY_SET)  EXCEPTION RANGE_ERROR )
      max(A)    Maximum element
                  ( Type of result: baseType,
                    Delivers the element from the set for
                    which the following condition holds:
                       Element >= X
                    for all X which are in the set.
                    max({2, 3, 5, 7, 11})  11,
                    max({'a', 'b', 'c'})  'c',
                    max(setType.EMPTY_SET)  EXCEPTION RANGE_ERROR )
      next(A, B) Minimum element of set A that is larger than B
                  ( Type of argument B: baseType,
                    Type of result: baseType,
                    next({2, 3, 5, 7, 11}, 2)  3,
                    next({2, 3, 5, 7, 11}, 3)  5,
                    next({2, 3, 5, 7, 11}, 7)  11,
                    next({2, 3, 5, 7, 11}, 11)  EXCEPTION RANGE_ERROR,
                    next({}, 1)  EXCEPTION RANGE_ERROR,
                    next(A, max(A))  EXCEPTION RANGE_ERROR )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str(setType.EMPTY_SET)  "{}",
                    str({})  "{}",
                    str({1, 2})  "{1, 2}" )
      rand(A)   Random element from a set
                The random elements are uniform distributed.
                  ( Type of result: baseType,
                    rand(setType.EMPTY_SET)  EXCEPTION RANGE_ERROR )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
      toArray(A)  Obtain an array containing all the values in A
                  ( Type of result: array baseType,
                    toArray({2, 3, 5})  [](2, 3, 5),
                    toArray({'a', 'b', 'c'})  []('a', 'b', 'c') )
    Statements:
      A |:= B   Assign the union of A and B to A
      A &:= B   Assign the intersection of A and B to A
      A -:= B   Assign the difference of A and B to A
      A @:= [B] C  Add or remove B to respectively from A
                  ( Type of argument B: baseType,
                    Type of argument C: boolean,
                    A @:= [B] TRUE  incl(A,B),
                    A @:= [B] FALSE  excl(A,B) )
      incl(A,B) Include element B to set A
                  ( Type of argument B: baseType )
      excl(A,B) Exclude element B from set A
                  ( Type of argument B: baseType )
      ignore(A) Ignore value
      for forVar range aSet do
        statements
      end for   Loop over all elements of a set
                  ( Type of argument forVar: baseType,
                    Type of argument statements: proc )

5.13 struct

The type struct describes all structured types. An example of a struct type declaration is:

const type: aStructType is new struct
    var string: name is "";
  end struct

Variables of this type are declared with:

var aStructType: aStructVariable is aStructType.value;

In aStructType.value all elements have the initialisation values from the struct declaration of aStructType. Besides aStructType.value there are no struct literals.

    Type generators:
      new struct
        var aType: name is value;
        ...
      end struct
                Create new structure type

      new metaType struct
        var aType: name is value;
        ...
      end struct
                Create new structure type as subtype of metaType,
                which is not a structure

      sub metaType struct
        var aType: name is value;
        ...
      end struct
                Create new structure type as subtype of metaType,
                which is a structure type. The new structure type inherits all
                elements of the structure type metaType.

      var aType: name is value
                Declare structure element 'name' with 'value'

    Infix operators:
      .         Access Element of STRUCT
                  ( example.element )
      ->        Access Element of ptr STRUCT
                  ( example->element )
    Relations:
      =, <>
    Statements:
      ignore(A) Ignore value

5.14 enumeration

With

const type: anEnumType is new enum
    enum_literal1, enum_literal2
  end enum;

a new enumeration type is declared. The values of this type are:

    enum_literal1 and enum_literal2

For an enumeration type only few operations are predefined. Additional operations must be defined separately. So it is necessary to define the functions str and parse in order to do I/O for a new enumeration type. E.g.:

const func string: str (in anEnumType: enumValue) is
    return literal(enumValue);

enable_output(anEnumType);

The need to define str opens the oportunity to convert to strings, that differ from the original literals.

    Constants:
      anEnumType.value  Default value of anEnumType (enum_literal1)
      anEnumType.first  Minimum value of anEnumType (enum_literal1)
      anEnumType.last   Maximum value of anEnumType (enum_literal2)
    Infix operators:
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      anEnumType conv A  Conversion from integer A to anEnumType
                  ( Type of argument A: integer,
                    anEnumType conv 0  enum_literal1,
                    anEnumType conv 1  enum_literal2,
                    anEnumType conv 2  EXCEPTION RANGE_ERROR,
                    anEnumType conv (-1)  EXCEPTION RANGE_ERROR )
      integer conv A   Conversion from anEnumType A to integer
                  ( Type of result: integer,
                    integer conv enum_literal1  0,
                    integer conv enum_literal2  1 )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      ord(A)    Ordinal number
                  ( Type of result: integer,
                    ord(enum_literal1)  0,
                    ord(enum_literal2)  1 )
      integer(A) Ordinal number
                  ( Type of result: integer,
                    integer(enum_literal1)  0,
                    integer(enum_literal2)  1 )
      succ(A)   Successor
                  ( succ(A)  enumType conv succ(ord(A)),
                    succ(enum_literal1)  enum_literal2,
                    succ(anEnumType.last)  EXCEPTION RANGE_ERROR )
      pred(A)   Predecessor
                  ( pred(A)  enumType conv pred(ord(A)),
                    pred(enum_literal2)  enum_literal1,
                    pred(anEnumType.first)  EXCEPTION RANGE_ERROR )
      literal(A) Conversion to a literal
                  ( Type of result: string,
                    literal(enum_literal1)  "enum_literal1",
                    literal(enum_literal2)  "enum_literal2" )
      rand(A, B) Random value in the range [A, B]
                 The random values are uniform distributed.
                  ( rand(A, B) returns a random enumeration value such that
                    A <= rand(A, B) and rand(A, B) <= B holds.
                    rand(A, A)  A,
                    rand(enum_literal2, enum_literal1)  EXCEPTION RANGE_ERROR )
      compare(A, B) Compare function
                  ( Type of result: integer,
                    compare(enum_literal1, enum_literal2)  -1,
                    compare(enum_literal1, enum_literal1)  0,
                    compare(enum_literal2, enum_literal1)  1 )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      incr(A)   Increment
                  ( incr(A)  A:=succ(A) )
      decr(A)   Decrement
                  ( decr(A)  A:=pred(A) )
      ignore(A) Ignore value

5.15 bin64

The type bin64 describes bit-patterns with 64 bits. It uses the same representation as an integer. There is a division of responsibility. The type bin64 is for bitwise operations and the type integer is for arithmetic operations. In compiled programs conversions between bin64 and integer have no overhead.

    Constants:
      bin64.value  Default value of bin64 (bin64(0))
    Prefix operators:
      ~         Bitwise not
    Infix operators:
      &         Bitwise and
      |         Bitwise inclusive or
      ><        Bitwise exclusive or (xor)
      A << B    Shift left
                  ( Type of argument B: integer,
                    A << B is okay for B >= 0 and B <= 63,
                    A << B  EXCEPTION OVERFLOW_ERROR for B < 0 or B >= 64,
                    A << 0  A,
                    bin64(16#1234567890abcde0) << 4  bin64(16#234567890abcde00) )
      A >> B    Shift right
                  ( Type of argument B: integer,
                    A >> B is okay for B >= 0 and B <= 63,
                    A >> B  EXCEPTION OVERFLOW_ERROR for B < 0 or B >= 64,
                    A >> 0  A,
                    bin64(16#1234567890abcde0) >> 4  bin64(16#1234567890abcde) )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      A radix B Convert to a string using a radix
                  ( Type of result: string,
                    Type of argument B: integer )
      A RADIX B Convert to a string using a radix
                  ( Type of result: string,
                    Type of argument B: integer )
      integer conv A  Convert to integer
                  ( Type of result: integer )
      bin64 conv A  Convert to bin64
                  ( Type of argument A: integer )
    Relations:
      =, <>
    Functions:
      bin64(A)  Conversion of integer to bin64
                  ( Type of argument: integer )
      bin64(A)  Conversion of bigInteger to bin64
                  ( Type of argument: bigInteger )
      bin64(A)  Conversion of char to bin64
                  ( Type of argument: char )
      bin64(A)  Get bits in IEEE 754 double-precision representation from a float
                  ( Type of argument: float,
                    bin64(1.0)  bin64(16#3ff0000000000000) )
      ord(A)    Ordinal number
                  ( Type of result: integer )
      integer(A) Ordinal number
                  ( Type of result: integer )
      big(A)    Conversion to bigInteger
                  ( Type of result: bigInteger )
      bigInteger(A) Conversion to bigInteger
                  ( Type of result: bigInteger )
      float(A)  Get float from bits in IEEE 754 double-precision representation
                  ( Type of result: float,
                    float(bin64(16#3ff0000000000000))  1.0 )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
      bitLength(A) Number of bits in the minimum binary representation.
                  ( Type of result: integer,
                    bitLength(bin64(0))  0,
                    bitLength(bin64(1))  1,
                    bitLength(bin64(4))  3 )
      lowestSetBit(A) Number of lowest-order zero bits in the binary representation.
                  ( Type of result: integer,
                    A >> B << B = A for A <> bin64(0) and B = lowestSetBit(A),
                    lowestSetBit(bin64(0))  -1,
                    lowestSetBit(bin64(1))  0,
                    lowestSetBit(bin64(2))  1 )
      rand(bin64) Random bin64 value
                 The random values are uniform distributed.
                  ( rand(bin64)  bin64(rand(integer.first, integer.last)) )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str(bin64(18446744073709551615_))  "18446744073709551615" )
      bytes(aBin64, BE, len) Convert into a string of bytes with big-endian encoding
                  ( Type of result: string )
      bytes(aBin64, LE, len) Convert into a string of bytes with little-endian encoding
                  ( Type of result: string )
      rotLeft(A, B)  Rotate the bits of a A left by B bits
                  ( rotLeft(bin64(16#76543210fedcba98), 12)  bin64(16#43210fedcba98765) )
      rotRight(A, B)  Rotate the bits of a A right by B bits
                  ( rotRight(bin64(16#76543210fedcba98), 40)  bin64(16#10fedcba98765432) )
      getBinary(aBitset, lowestBitNum)  Get 64 bits from aBitset starting with lowestBitNum
                  ( Type of argument aBitset: bitset,
                    Type of argument lowestBitNum: integer )
      float2MbfBits(aFloat, DOUBLE) Get bits in MBF double-precision representation from aFloat
                 Microsoft Binary Format (MBF) is a format for floating point numbers.
                  ( Type of argument aFloat: float,
                    float2MbfBits(1.0, DOUBLE)  bin64(16#8100000000000000_) )
      mbfBits2Float(bits) Get a float from bits in MBF double-precision representation
                 Microsoft Binary Format (MBF) is a format for floating point numbers.
                  ( Type of result: float,
                    mbfBits2Float(bin64(16#8100000000000000_))  1.0 )
      bin64(bytes, LE) Convert string of little-endian bytes to bin64
                  ( Type of argument bytes: string )
      bin64(bytes, BE) Convert string of big-endian bytes to bin64
                  ( Type of argument bytes: string )
    Statements:
      A &:= B   Bitwise and copy
                  ( A &:= B ⇒ A := A & B )
      A |:= B   Bitwise inclusive or copy
                  ( A |:= B ⇒ A := A | B )
      A ><:= B  Bitwise exclusive or (xor) copy
                  ( A ><:= B ⇒ A := A >< B )
      A <<:= B  Shift left copy
                  ( A <<:= B ⇒ A := A << B )
      A >>:= B  Shift right copy
                  ( A >>:= B ⇒ A := A >> B )
      ignore(A) Ignore value

5.16 bin32

The type bin32 describes bit-patterns with 32 bits. It uses the same representation as an integer. There is a division of responsibility. The type bin32 is for bitwise operations and the type integer is for arithmetic operations. In compiled programs conversions between bin32 and integer have no overhead.

    Constants:
      bin32.value  Default value of bin32 (bin32(0))
    Prefix operators:
      ~         Bitwise not
    Infix operators:
      &         Bitwise and
      |         Bitwise inclusive or
      ><        Bitwise exclusive or (xor)
      A << B    Shift left
                  ( Type of argument B: integer,
                    A << B is okay for B >= 0 and B <= 63,
                    A << B  EXCEPTION OVERFLOW_ERROR for B < 0 or B >= 64,
                    A << 0  A,
                    bin32(16#abcdef) << 4  bin32(16#abcdef0) )
      A >> B    Shift right
                  ( Type of argument B: integer,
                    A >> B is okay for B >= 0 and B <= 63,
                    A >> B  EXCEPTION OVERFLOW_ERROR for B < 0 or B >= 64,
                    A >> 0  A,
                    bin32(16#abcdef) >> 4  bin32(16#abcde) )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      A radix B Convert to a string using a radix
                  ( Type of result: string,
                    Type of argument B: integer )
      A RADIX B Convert to a string using a radix
                  ( Type of result: string,
                    Type of argument B: integer )
      integer conv A  Convert to integer
                  ( Type of result: integer )
      bin32 conv A  Convert to bin32
                  ( Type of argument A: integer )
    Relations:
      =, <>
    Functions:
      bin32(A)  Conversion of integer to bin32
                  ( Type of argument: integer )
      bin32(A)  Conversion of char to bin32
                  ( Type of argument: char )
      bin32(A)  Get bits in IEEE 754 single-precision representation from a float
                  ( Type of argument: float,
                    bin32(1.0)  bin32(16#3f800000) )
      ord(A)    Ordinal number
                  ( Type of result: integer )
      integer(A) Ordinal number
                  ( Type of result: integer )
      float(A)  Get float from bits in IEEE 754 single-precision representation
                  ( Type of result: float,
                    float(bin32(16#3f800000))  1.0 )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
      bitLength(A) Number of bits in the minimum binary representation.
                  ( Type of result: integer,
                    bitLength(bin32(0))  0,
                    bitLength(bin32(1))  1,
                    bitLength(bin32(4))  3 )
      lowestSetBit(A) Number of lowest-order zero bits in the binary representation.
                  ( Type of result: integer,
                    A >> B << B = A for A <> bin32(0) and B = lowestSetBit(A),
                    lowestSetBit(bin32(0))  -1,
                    lowestSetBit(bin32(1))  0,
                    lowestSetBit(bin32(2))  1 )
      rand(bin32) Random bin32 value
                 The random values are uniform distributed.
                  ( rand(bin32)  bin32(rand(0, 4294967295)) )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str(bin32(4294967295))  "4294967295" )
      bytes(aBin32, BE, len) Convert into a string of bytes with big-endian encoding
                  ( Type of result: string )
      bytes(aBin32, LE, len) Convert into a string of bytes with little-endian encoding
                  ( Type of result: string )
      rotLeft(A, B)  Rotate the bits of a A left by B bits
                  ( rotLeft(bin32(16#12345678), 8)  bin32(16#34567812) )
      rotRight(A, B)  Rotate the bits of a A right by B bits
                  ( rotRight(bin32(16#12345678), 8)  bin32(16#78123456) )
      float2MbfBits(aFloat, SINGLE) Get bits in MBF single-precision representation from aFloat
                 Microsoft Binary Format (MBF) is a format for floating point numbers.
                  ( Type of argument aFloat: float,
                    float2MbfBits(1.0, SINGLE)  bin32(16#81000000) )
      mbfBits2Float(bits) Get a float from bits in MBF single-precision representation
                 Microsoft Binary Format (MBF) is a format for floating point numbers.
                  ( Type of result: float
                    mbfBits2Float(bin32(16#81000000))  1.0 )
      bin32(bytes, LE) Convert string of little-endian bytes to bin32
                  ( Type of argument bytes: string )
      bin32(bytes, BE) Convert string of big-endian bytes to bin32
                  ( Type of argument bytes: string )
    Statements:
      A &:= B   Bitwise and copy
                  ( A &:= B ⇒ A := A & B )
      A |:= B   Bitwise inclusive or copy
                  ( A |:= B ⇒ A := A | B )
      A ><:= B  Bitwise exclusive or (xor) copy
                  ( A ><:= B ⇒ A := A >< B )
      A <<:= B  Shift left copy
                  ( A <<:= B ⇒ A := A << B )
      A >>:= B  Shift right copy
                  ( A >>:= B ⇒ A := A >> B )
      ignore(A) Ignore value

5.17 bstring

The type bstring describes strings of bytes. It is used to store binary data.

    Constants:
      bstring.value  Default value of bstring (bstring(""))
    Infix operators:
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      bstring parse A   Conversion of string to bstring
                  ( Type of argument A: string )
    Indices:
      [ A ]     Access one character
                  ( Type of argument A: integer,
                    Type of result: char )
    Functions:
      str(A)    Conversion to string
                  ( Type of result: string )
      literal(A) Conversion to a literal
                  ( Type of result: string )
      string(A) Conversion to string
                  ( Type of result: string )
      bstring(A) Conversion to bstring
                  ( Type of argument A: string )
      length(A) Length of bstring
                  ( Type of result: integer )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
      bStriBe2BigInt(A, isSigned) Convert a bstring (interpreted as big-endian) to a bigInteger
                  ( Type of argument isSigned: boolean,
                    Type of result: bigInteger )
      bStriLe2BigInt(A, isSigned) Convert a bstring (interpreted as little-endian) to a bigInteger
                  ( Type of argument isSigned: boolean,
                    Type of result: bigInteger )
      bStriBe(A, isSigned) Convert a bigInteger into a big-endian bstring
                  ( Type of argument A: bigInteger,
                    Type of argument isSigned: boolean )
      bStriLe(A, isSigned) Convert a bigInteger into a little-endian bstring
                  ( Type of argument A: bigInteger,
                    Type of argument isSigned: boolean )
    Relations:
      =, <>
    Statements:
      ignore(A) Ignore value
      for forVar range bstri do
        statements
      end for   Loop over all elements of a bstring
                  ( Type of argument forVar: char,
                    Type of argument statements: proc )

5.18 color

The type color describes colors. It uses the additive color model with red, green and blue lights. The red, green and blue lights are specified with integer values in the range 0 .. 65535. The color functions are defined in the library "color.s7i".

    Elements:
      var integer: redLight is 0;
      var integer: greenLight is 0;
      var integer: blueLight is 0;
    Constants:
      color.value    Default value of color (black)
      black          color(0, 0, 0);
      dark_red       color(32768, 0, 0);
      dark_green     color(0, 32768, 0);
      brown          color(32768, 16384, 0);
      dark_blue      color(0, 0, 32768);
      dark_magenta   color(32768, 0, 32768);
      dark_cyan      color(0, 65535, 65535);
      light_gray     color(49152, 49152, 49152);
      dark_gray      color(16384, 16384, 16384);
      light_red      color(65535, 0, 0);
      light_green    color(0, 65535, 0);
      yellow         color(65535, 65535, 0);
      light_blue     color(0, 0, 65535);
      light_magenta  color(65535, 0, 65535);
      light_cyan     color(32768, 65535, 65535);
      white          color(65535, 65535, 65535);
      orange         color(65535, 32768, 0);
      amber          color(49152, 32768, 16384);
      pink           color(65535, 32768, 32768);
    Infix operators:
      +         Add two colors in an additive color system
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
    Relations:
      =, <>
    Functions:
      color(R,G,B) Creates a color from Red, Green and Blue
                  ( Type of argument R: integer,
                    Type of argument G: integer,
                    Type of argument B: integer )
      gray(BR)  Create a gray color value from BR
                  ( Type of argument BR: integer )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      clear(A)  Clear current window
      ignore(A) Ignore value

5.19 time

The type time describes times and dates. For dates the proleptic Gregorian calendar is used (which assumes that the Gregorian calendar was even in effect at dates preceding its official introduction). This convention is used according to ISO 8601 which also defines that positive and negative years exist and that the year preceding 1 is 0. Time is measured in hours, minutes, seconds and micro seconds. Additionally information about the difference to UTC and a flag indicating daylight saving time is maintained also. The time functions are defined in the library "time.s7i".

    Elements:
      var integer: year is 0;
      var integer: month is 1;
      var integer: day is 1;
      var integer: hour is 0;
      var integer: minute is 0;
      var integer: second is 0;
      var integer: micro_second is 0;
    Constants:
      time.value  Default value of time (time(0, 1, 1, 0, 0, 0))
    Infix operators:
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      time parse A   Conversion of string to time
                  ( Type of argument A: string,
                    time parse "2005-02-28 12:00:01"  2005-02-28 12:00:01,
                    time parse "2005-02-29 12:00:01"  EXCEPTION RANGE_ERROR )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      time(NOW)  Gets the current time
      time(A)  Conversion of string to time
                  ( Type of argument A: string,
                    time("2005-02-28 12:00:01")  2005-02-28 12:00:01,
                    time("2005-02-29 12:00:01")  EXCEPTION RANGE_ERROR )
      str(A)    Conversion to string
                  ( Type of result: string )
      strDate(A)  Conversion of the date to string
                    with ISO 8601 YYYY-MM-DD date format
                  ( Type of result: string )
      strTime(A)  Conversion of the daytime to string
                    with ISO 8601 hh:mm:ss time format
                  ( Type of result: string )
      strDateTime(A)  Conversion of date and time to string
                    with ISO 8601 YYYY-MM-DD hh:mm:ss format
                  ( Type of result: string )
      strTimeZone(A)  Conversion of the time zone to string
                  ( Type of result: string )
      truncToSecond(A)  Truncate a time to a second
      truncToMinute(A)  Truncate a time to a minute
      truncToHour(A)  Truncate a time to a hour
      truncToDay(A)  Truncate a time to a day
      truncToMonth(A)  Truncate a time to a month
      truncToYear(A)  Truncate a time to a year
      isLeapYear(A)  Determine if a given year is a leap year
                  ( Type of argument A: integer )
                  ( Type of result: boolean )
      daysInYear(Y)  Calculate the number of days in a year
                  ( Type of argument Y: integer,
                    Type of result: integer )
      daysInMonth(Y, M)  Calculate the number of days in a month
                  ( Type of argument Y: integer,
                    Type of argument M: integer,
                    Type of result: integer )
      daysInMonth(A)  Calculate the number of days in a month
                  ( Type of result: integer )
      dayOfWeek(A)  Day of the week with Monday as 1
                  ( Type of result: integer )
      dayOfYear(A)  Day of the year with 1 January as 1
                  ( Type of result: integer )
      weekOfYear(Y, D)  Compute the week number of a year (0 to 53).
                    According to ISO 8601: Week number 1 of
                    every year contains the 4. of january.
                  ( Type of argument Y: integer,
                    Type of argument D: integer,
                    Type of result: integer )
      weekOfYear(A)  Compute the week number of a year (0 to 53).
                    According to ISO 8601: Week number 1 of
                    every year contains the 4. of january.
                  ( Type of result: integer )
      weekDateYear(A)  Compute the year of the ISO 8601 week date
                  ( Type of result: integer )
      weekDateWeek(A)  Compute the week of the ISO 8601 week date
                  ( Type of result: integer )
      toUTC(A)  Conversion to Coordinated Universal Time (UTC)
      toLocalTZ  Convert given time to a time in the local time zone.
      setLocalTZ  Sets timeZone and daylightSavingTime for a given time.
      julianDayNumber(A)  Number of days that have elapsed since
                January 1, 4713 BC in the proleptic Julian calendar
                  ( Type of result: integer )
      julianDayNumToTime(A)  Convert julian day number to time
                  ( Type of argument A: integer )
      timestamp1970(A)  Time expressed in seconds since the
                Unix epoch (1970-01-01 00:00:00 UTC)
                  ( Type of result: integer )
      timestamp1970ToTime(A)  Convert a Unix timestamp into a time from
                the local time zone
                  ( Type of argument A: integer )
      timestamp1601(A)  100-nanosecond intervals since the
                Windows epoch (1601-01-01 00:00:00 UTC)
                  ( Type of result: integer )
      timestamp1601ToTime(A)  Convert a FILETIME into a time from
                the local time zone
                  ( Type of argument A: integer )
      compare(A, B)  Compare function
                  ( Type of result: integer )
      hashCode(A)  Hash function
                  ( Type of result: integer )
    Statements:
      await(A)  Wait until the given time
      ignore(A) Ignore value

5.20 duration

The type duration describes time and date durations. The duration functions are defined in the library "duration.s7i".

    Constants:
      duration.value  Default value of duration (duration("P0D"))
    Prefix operators:
      +         Identity
      -         Change sign
    Infix operators:
      +         Add two durations
      -         Subtract two durations
      *         Multiply a duration by an integer
                  ( Type of left operand: integer )
      *         Multiply a duration by an integer
                  ( Type of right operand: integer )
      +         Add a duration to a time
                  ( Type of left operand: time,
                    Type of result: time )
      -         Subtract a duration from a time
                  ( Type of left operand: time,
                    Type of result: time )
      -         Subtract two times
                  ( Type of left operand: time,
                    Type of right operand: time )
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( Type of argument A: boolean,
                    TRUE ? a : b  a,
                    FALSE ? a : b  b )
      duration parse A   Conversion of string to duration
                  ( Type of argument A: string,
                    duration parse "P2M28DT12H1S"  P2M28DT12H1S,
                    duration parse "P13M28DT12H1S"  EXCEPTION RANGE_ERROR )
    Relations:
      =, <>, <, <=, >, >=
    Functions:
      duration(A)  Conversion of string to duration
                  ( Type of argument A: string,
                    duration("P2M28DT12H1S")  P2M28DT12H1S,
                    duration("P13M28DT12H1S")  EXCEPTION RANGE_ERROR )
      getYears(A)  Obtains the years of a duration
                  ( Type of result: integer )
      getMonths(A) Obtains the months of a duration
                  ( Type of result: integer )
      getDays(A)   Obtains the days of a duration
                  ( Type of result: integer )
      getHours(A)  Obtains the hours of a duration
                  ( Type of result: integer )
      getMinutes(A) Obtains the minutes of a duration
                  ( Type of result: integer )
      getSeconds(A) Obtains the seconds of a duration
                  ( Type of result: integer )
      getMicroSeconds(A)  Obtains the micro seconds of a duration
                  ( Type of result: integer )
      toYears(A)  Return the duration in years
                  ( Type of result: integer )
      toMonths(A) Return the duration in months
                  ( Type of result: integer )
      toDays(A)   Return the duration in days
                  ( Type of result: integer )
      toHours(A)  Return the duration in hours
                  ( Type of result: integer )
      toMinutes(A) Return the duration in minutes
                  ( Type of result: integer )
      toSeconds(A) Return the duration in seconds
                  ( Type of result: integer )
      toMicroSeconds(A)  Return the duration in micro seconds
                  ( Type of result: integer )
      str(A)    Conversion to string
                  ( Type of result: string )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      A +:= B   Increment A by B
                  ( A +:= B  A := A + B )
      A -:= B   Decrement A by B
                  ( A -:= B  A := A - B )
      A +:= B   Increment time A by B
                  ( Type of argument A: time,
                    A +:= B  A := A + B )
      A -:= B   Decrement time A by B
                  ( Type of argument A: time,
                    A -:= B  A := A - B )
      wait(A)   Wait for given duration
      ignore(A) Ignore value

For the operations - (negate a duration) and - (subtract two time values) holds:

    (tim1 - tim2) = - (tim2 - tim1)

For the operations + (add a duration to a time) and - (subtract two time values) holds:

    tim2 + (tim1 - tim2) = tim1

For the operations - (subtract a duration from a time) and - (subtract two time values) holds:

    tim1 - (tim1 - tim2) = tim2

5.21 file

The type file is the interface type for sequential files. The file functions are defined in the library "file.s7i".

    Constants:
      file.value  Default value of file (STD_NULL)
    Variables:
      STD_NULL  Standard null file
      STD_IN    Standard input of the operating system
      STD_OUT   Standard output of the operating system
      STD_ERR   Standard error output of the operating system
      IN        Standard input file used for file input
                  operations when no file is specified
                  ( IN is initialized with STD_IN )
      OUT       Standard output file used for file output
                  operations when no file is specified
                  ( OUT is initialized with STD_OUT )
      CONSOLE_KEYBOARD  Keyboard file describing the console keyboard.
      GRAPH_KEYBOARD    Keyboard file describing the graphic keyboard.
      KEYBOARD  Variable describing the keyboard.
                  ( KEYBOARD is initialized with CONSOLE_KEYBOARD )
    Implementation types of the file interface:
      null_file      Base implementation type for the file interface
      external_file  Files of the operating system
      utf8File       UTF-8 encoded files of the operating system
      utf16File      UTF-16 encoded files of the operating system
      utf16leFile    UTF-16LE encoded files of the operating system
      utf16beFile    UTF-16BE encoded files of the operating system
      dirFile        Read the contents of a directory
      echoFile       Generate an echo of the input
      lineFile       Read a baseFile line-wise
      editLineFile   Support line-wise editing with history
      gzipFile       Read decompressed data from a GZIP file
      gzipWriteFile  Write compressed data into a GZIP file
      bufferFile     Buffer (cache) data based on the given base file
      lzmaFile       Read decompressed data from a LZMA file
      popenFile      Operating system pipes
      popen8File     UTF-8 encoded operating system pipes
      socket         Sockets of the operation system
      tlsFile        Transport Layer Security (TLS/SSL) sockets
      striFile       Files stored in a string
      teeFile        File that writes to several destination files at once
      moreFile       Filter file which shows another file screenwise
      lowerFile      Filter file which turns characters to lower case
      upperFile      Filter file which turns characters to upper case
      subFile        Read access to the sub segment of a base file
      xzFile         Read decompressed data from a XZ file
      zstdFile       Read decompressed data from a Zstandard file
    Relations:
      =, <>
    Functions to open a file:
      open(path, mode) Open external file
                  ( Type of argument path: string,
                    Type of argument mode: string,
                    Type of result: file,
                    Returns STD_NULL if open was not possible )
      openUtf8(path, mode) Open external UTF-8 encoded file
                  ( Type of argument path: string,
                    Type of argument mode: string,
                    Type of result: file,
                    Returns STD_NULL if open was not possible )
      openUtf16(path, mode) Open existing UTF-16LE or UTF-16BE encoded file
                  ( Type of argument path: string,
                    Type of argument mode: string,
                    Type of result: file,
                    Returns STD_NULL if open was not possible )
      openUtf16le(path, mode) Open UTF-16LE encoded file
                  ( Type of argument path: string,
                    Type of argument mode: string,
                    Type of result: file,
                    Returns STD_NULL if open was not possible )
      openUtf16be(path, mode) Open UTF-16BE encoded file
                  ( Type of argument path: string,
                    Type of argument mode: string,
                    Type of result: file,
                    Returns STD_NULL if open was not possible )
      openStriFile(content) Open a striFile with the given string content
                  ( Type of argument content: string )
      openStriFile Open a striFile with an empty string content
      openTee(destFiles) Open a tee file to write to the given destination files
                  ( Type of argument destFiles: array string )
      openTee(dest1, dest2) Open a tee file to write to the two destination files
      openMore(dest, cmds, pageSize) Open a more filter file for viewing a file page by page
                  ( Type of argument pageSize: integer )
      openLower(dest) Open a filter file which turns characters to lower case
      openUpper(dest) Open a filter file which turns characters to upper case
      openGzipFile(compressed, READ) Open a GZIP file for reading (decompression)
                  ( Returns STD_NULL if the file is not in GZIP format )
      openGzipFile(destFile, WRITE) Open a GZIP file for writing (compression)
           The data written to this file is compressed with GZIP and written to destFile.
      openLzmaFile(compressed) Open a LZMA file for reading (decompression)
                  ( Returns STD_NULL if the file is not in LZMA format )
      openXzFile(compressed)  Open a XZ file for reading (decompression)
                  ( Returns STD_NULL if the file is not in XZ format )
      openZstdFile(compressed) Open a Zstandard file for reading (decompression)
                  ( Returns STD_NULL if the file is not in Zstandard format )
      popen(A, B) Open a pipe to a process
                  ( Type of argument A: string,
                    Type of argument B: string,
                    Type of result: file,
                    Returns STD_NULL if popen was not possible )
      popen8(A, B) Open a UTF-8 pipe to a process
                  ( Type of argument A: string,
                    Type of argument B: string,
                    Type of result: file,
                    Returns STD_NULL if popen8 was not possible )
      openInetSocket(port) Open local Internet client socket
                  ( Type of argument port: integer,
                    Type of result: file,
                    Returns STD_NULL if open was not possible )
      openInetSocket(addr, port) Open Internet client socket
                  ( Type of argument addr: string,
                    Type of argument port: integer,
                    Type of result: file,
                    Returns STD_NULL if open was not possible )
      openTlsSocket(addr, port) Open TLS socket
                  ( Type of argument addr: string,
                    Type of argument port: integer,
                    Type of result: file,
                    Returns STD_NULL if open was not possible )
      openDir(directoryPath)  Open a directory file
                  ( Type of argument directoryPath: string )
      openEcho(inFile, outFile) Open an echo file
      openLine(aFile) Open a lineFile to filter aFile line-wise
      openEditLine(inFile, outFile) Open a Unicode filter file
                    for line-wise editing with history
      openEditLineLatin1(inFile, outFile) Open a Latin-1 filter file
                    for line-wise editing with history
    Functions:
      length(A) Length of file A
                  ( Type of result: integer )
      tell(A)   Return the actual file position
                  ( Type of argument: file,
                    The first position in the file is 1 )
      seekable(A) Determine if file A is seekable
      getc(A)   Get one character from file A
                  ( Type of result: char )
      gets(A, B) Get string with maximum length B from file A
                  ( Type of argument A: integer,
                    Type of argument B: file,
                    Type of result: string,
                    gets(A, -1)  EXCEPTION RANGE_ERROR )
      getwd(A)  Get one word from file A
                  ( Type of result: string )
      getln(A)  Get one line from file A
                  ( Type of result: string )
      eoln(A)   End of line
                  ( Type of result: boolean )
      eof(A)    End of file
                  ( Type of result: boolean )
      hasNext(A) A call of getc would not return the EOF character
                  ( Type of result: boolean )
      inputReady(A) At least one character can be read without blocking.
                  ( Type of result: boolean )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      write(A, B) Write string B to file A
                  ( Type of argument B: string )
      writeln(A) Write a new line to file A
      writeln(A, B) Write string B and new line to file A
                  ( Type of argument B: string )
      read(A, B) Read a word from file A into string B
                  ( Type of argument B: string )
      read(A, B, C) Read a word from file A into B or use default value C
                  ( Type of argument B: string,
                    Type of argument C: string )
      readln(A)  Read a line from file A
      readln(A, B) Read a line from file A into the string B
                  ( Type of right operand: string )
      readln(A, B, C)  Read a line from file A into B or use default value C
                  ( Type of argument B: string,
                    Type of argument C: string )
      skip(A, B) Skip B characters from file A
      backSpace(A) Write backspace to file A
      close(A)  Close file A
      flush(A)  Flush file A
      seek(A, B) Set actual file position of file A to B
                  ( Type of argument B: integer,
                    seek(A, 1)  Set to file begin,
                    seek(A, length(A))  Set to last position,
                    seek(A, length(A) + 1)  Set to end of file,
                    seek(A, 0)  EXCEPTION RANGE_ERROR )
      truncate(A, B) Truncate file A to length B
                  ( Type of argument B: integer )
      ignore(A) Ignore value

5.22 text

The type text is the interface type for two dimensional files. These files consist of lines with columns in them. The text functions are defined in the library "text.s7i".

    Variables:
      STD_CONSOLE  Standard console file of the current process.
    Implementation types of the text interface:
      console_file    Write to the text console/window
      graph_file      Write to a graphic window with the system font
      window_file     Write to a rectangular area in another text
      pixmapFontFile  Write to a graphic window with a pixmap font
      striText        Text file stored in an array of strings
    Relations:
      =, <>
    Functions to open a text:
      open(CONSOLE)  Creates console_file at the upper left corner of the console/window.
      open(graphWin)  Creates a graph_file at the upper left corner of graphWin
                  ( Type of argument graphWin: PRIMITIVE_WINDOW )
      open(graphWin, minX, minY)  Creates a graph_file at (minX, minY) in graphWin
                  ( Type of argument graphWin: PRIMITIVE_WINDOW,
                    Type of argument minX: integer,
                    Type of argument minY: integer )
      open(graphWin, minX, minY, width, height)  Creates a graph_file at (minX, minY) in graphWin
                  ( Type of argument graphWin: PRIMITIVE_WINDOW,
                    Type of argument minX: integer,
                    Type of argument minY: integer,
                    Type of argument width: integer,
                    Type of argument height: integer )
      openWindow(outText, upper, left, height, width)  Creates a window_file at (left, upper) in outText
                  ( Type of argument upper: integer,
                    Type of argument left: integer,
                    Type of argument height: integer,
                    Type of argument width: integer )
      openPixmapFontFile(win)  Creates a pixmapFontFile at the upper left corner of win
                  ( Type of argument win: PRIMITIVE_WINDOW )
      openPixmapFontFile(win, minX, minY)  Creates a pixmapFontFile at (minX, minY) in win
                  ( Type of argument win: PRIMITIVE_WINDOW,
                    Type of argument minX: integer,
                    Type of argument minY: integer )
      openStriText(content)  Open a striText with the given content
                  ( Type of argument content: array string )
    Functions:
      height(A) Height of the text
                  ( Type of result: integer )
      width(A)  Width of the text
                  ( Type of result: integer )
      line(A)   Current line of the text
                  ( Type of result: integer )
      column(A) Current column of the text
                  ( Type of result: integer )
    Statements:
      write(A, B) Write string B to text A
                  ( Type of argument B: string )
      writeln(A) Write a new line to text A
      writeln(A, B) Write string B and new line to text A
                  ( Type of argument B: string )
      read(A, B) Read a word from text A into string B
                  ( Type of right operand: string )
      readln(A)  Read a line from text A
      readln(A, B) Read a line from text A into the string B
                  ( Type of right operand: string )
      backSpace(A) Write backspace to text A
      close(A)  Close text A
      flush(A)  Flush text A
      clear(A)  Clear the window
      clear(A, UP, LO, LE, RI)  Clear an area of the window
                  ( Type of argument UP: integer
                    Type of argument LO: integer
                    Type of argument LE: integer
                    Type of argument RI: integer )
      v_scroll(A) Scroll the window vertical
      h_scroll(A) Scroll the window horizontal
      color(A, B) Set foreground color of the text A
                  ( Type of argument B: color )
      color(A, B, C) Set foreground and background color of the text A
                  ( Type of argument B: color,
                    Type of argument C: color )
      setPos(A, B, C) Set the current position of the text A
                  ( Type of argument B: integer
                    Type of argument C: integer )
      setLine(A, B) Set the current line of the text A
                  ( Type of argument B: integer )
      setColumn(A, B) Set the current column of the text A
                  ( Type of argument B: integer )
      box(A)    Write a box around the window
      clear_box(A) Clear the box around the window
      cursor_on(A) Make the cursor visible
      cursor_off(A) Make the cursor invisible
      ignore(A) Ignore value

5.23 fileSys

The type fileSys is the interface type for file systems. The files of the operating system and the contents of an archive file are both organized as file systems. The connection to files stored at a remote computer can also use the fileSys interface.

    Constants:
      fileSys.value  Default value of fileSys (emptyFileSys.value)
    Variables:
      osFiles        File system of the operating system files
    Implementation types of the fileSys interface:
      emptyFileSys   Empty file system (used as default value)
      osFileSys      File system to access operating system files
      arArchive      Access to an AR archive
      cpioArchive    Access to a CPIO archive
      rpmArchive     Access to a RPM archive
      tarArchive     Access to a TAR archive
      zipArchive     Access to a ZIP archive
      ftpConnection  Connection to a FTP server
    Functions to open a fileSys:
      openAr(arFile)  Open a AR archive with the given arFile
                  ( Type of argument arFile: file,
                    Returns fileSys.value if open was not possible )
      openAr(arFileName)  Open a AR archive with the given arFileName
                  ( Type of argument arFileName: string,
                    Returns fileSys.value if open was not possible )
      openCpio(cpioFile)  Open a CPIO archive with the given cpioFile
                  ( Type of argument cpioFile: file,
                    Returns fileSys.value if open was not possible )
      openCpio(cpioFileName)  Open a CPIO archive with the given cpioFileName
                  ( Type of argument cpioFileName: string,
                    Returns fileSys.value if open was not possible )
      openRpm(rpmFile)  Open a RPM archive with the given rpmFile
                  ( Type of argument rpmFile: file,
                    Returns fileSys.value if open was not possible )
      openRpm(rpmFileName)  Open a RPM archive with the given rpmFileName
                  ( Type of argument rpmFileName: string,
                    Returns fileSys.value if open was not possible )
      openTar(tarFile)  Open a TAR archive with the given tarFile
                  ( Type of argument tarFile: file,
                    Returns fileSys.value if open was not possible )
      openTar(tarFileName)  Open a TAR archive with the given tarFileName
                  ( Type of argument tarFileName: string,
                    Returns fileSys.value if open was not possible )
      openZip(zipFile)  Open a ZIP archive with the given zipFile
                  ( Type of argument zipFile: file,
                    Returns fileSys.value if open was not possible )
      openZip(zipFileName)  Open a ZIP archive with the given zipFileName
                  ( Type of argument zipFileName: string,
                    Returns fileSys.value if open was not possible )
      openFtp(hostName, user, password, ftpControlPort)  Open a FTP file system
                  ( Type of argument hostName: string,
                    Type of argument user: string,
                    Type of argument password: string,
                    Type of argument ftpControlPort: integer )
      openFtp(hostName, user, password)  Open a FTP file system
                  ( Type of argument hostName: string,
                    Type of argument user: string,
                    Type of argument password: string )
      openFtp(connectStri, ftpControlPort)  Open a FTP file system
                  ( Type of argument connectStri: string,
                    Type of argument ftpControlPort: integer )
      openFtp(connectStri)  Open a FTP file system
                  ( Type of argument connectStri: string )
    Functions:
      close(aFileSys)  Close a file system
      readDir(aFileSys, dirPath)  Read the file names of a directory
                  ( Type of argument dirPath: string,
                    Type of result: array string )
      readDir(aFileSys, dirPath, RECURSIVE)  Read the file paths of a directory recursively
                  ( Type of argument dirPath: string,
                    Type of result: array string )
      readDir(aFileSys)  Read the file names of the root directory
                  ( Type of result: array string )
      readDir(aFileSys, RECURSIVE)  Read the file paths of the root directory recursively
                  ( Type of result: array string )
      fileType(aFileSys, path)  Get the type of a file
                  ( Type of argument path: string,
                    Type of result: fileType )
      fileTypeSL(aFileSys, path)  Get the type of a file (do not follow symbolic links)
                  ( Type of argument path: string,
                    Type of result: fileType )
      getFileMode(aFileSys, path)  Get the file mode (permissions) of a file
                  ( Type of argument path: string,
                    Type of result: fileMode )
      fileSize(aFileSys, path)  Get the size of a file
                  ( Type of argument path: string,
                    Type of result: integer )
      bigFileSize(aFileSys, path)  Get the size of a file
                  ( Type of argument path: string,
                    Type of result: bigInteger )
      getMTime(aFileSys, path)  Get the modification time of a file
                  ( Type of argument path: string,
                    Type of result: time )
      getOwner(aFileSys, path)  Get the name of the owner (UID) of a file
                  ( Type of argument path: string,
                    Type of result: string )
      getGroup(aFileSys, path)  Get the name of the group (GID) to which a file belongs
                  ( Type of argument path: string,
                    Type of result: string )
      open(aFileSys, filePath, mode)  Open a file with filePath and mode
                  ( Type of argument filePath: string,
                    Type of argument mode: string,
                    Type of result: file )
      getFile(aFileSys, filePath)  Get the contents of file filePath
                  ( Type of argument filePath: string,
                    Type of result: string )
      readLink(aFileSys, path)  Reads the destination of a symbolic link
                  ( Type of argument path: string,
                    Type of result: string )
    Statements:
      setFileMode(aFileSys, path, mode)  Change the file mode (permissions) of a file
                  ( Type of argument path: string,
                    Type of argument mode: fileMode )
      setMTime(aFileSys, path, modificationTime)
                  ( Type of argument path: string,
                    Type of argument modificationTime: time )
      setOwner(aFileSys, path, owner)  Set the owner of a file
                  ( Type of argument path: string,
                    Type of argument owner: string )
      setGroup(aFileSys, path, group)  Set the group of a file
                  ( Type of argument path: string,
                    Type of argument group: string )
      putFile(aFileSys, filePath, stri)  Write stri to the file filePath using the file system
                  ( Type of argument filePath: string,
                    Type of argument stri: string )
      removeFile(aFileSys, path)  Remove a file (except a nonempty directory)
                  ( Type of argument path: string )
      removeTree(aFileSys, path)  Remove a file of any type inclusive a directory tree
                  ( Type of argument path: string )
      moveFile(aFileSys, sourcePath, destPath)  Move and rename a file or directory tree
                  ( Type of argument sourcePath: string,
                    Type of argument destPath: string )
      mkdir(aFileSys, dirPath)  Create a directory
                  ( Type of argument dirPath: string )
      rmdir(aFileSys, dirPath)  Delete an empty directory
                  ( Type of argument dirPath: string )
      getcwd(aFileSys)  Determine the current working directory
      chdir(aFileSys, dirPath)  Change the current working directory
                  ( Type of argument dirPath: string )
      ignore(A) Ignore value

5.24 database

The type database describes database connections. The library "sql_base.s7i" defines functions to manage database connections.

    Constants:
      database.value  Default value of database (empty database)
    Relations:
      =, <>
    Functions:
      openDatabase(driver, host, port, dbName, user, password)  Open database
                  ( Type of argument driver: dbCategory,
                    Type of argument host: string,
                    Type of argument port: integer,
                    Type of argument dbName: string,
                    Type of argument user: string,
                    Type of argument password: string )
      openDatabase(DB_ODBC, odbcDriver, server, dbName, user, password)  Open ODBC database
                  ( Type of argument odbcDriver: string,
                    Type of argument server: string,
                    Type of argument dbName: string,
                    Type of argument user: string,
                    Type of argument password: string )
      openDatabase(DB_INFORMIX, host, port, server, dbName, user, password)  Open Informix database
                  ( Type of argument host: string,
                    Type of argument port: integer,
                    Type of argument server: string,
                    Type of argument dbName: string,
                    Type of argument user: string,
                    Type of argument password: string )
      openDatabase(driver, dbPath, user, password)  Open the database dbPath with the specified user and password
                  ( Type of argument driver: dbCategory,
                    Type of argument dbPath: string,
                    Type of argument user: string,
                    Type of argument password: string )
      openDatabase(driver, connectStri)  Open a database with the specified driver and connectStri
                  ( Type of argument driver: dbCategory,
                    Type of argument connectStri: string )
      close(db)  Close the specified database db
      getAutoCommit(db)  Get the current auto-commit mode of db
                  ( Type of result: boolean )
    Statements:
      setAutoCommit(db, autoCommit)  Set the auto-commit mode for db.
                  ( Type of argument autoCommit: boolean )
      commit(db)  Execute a commit statement for db
      rollback (db)  Execute a rollback statement for db

5.25 sqlStatement

The type sqlStatement describes prepared sql statements.

    Constants:
      sqlStatement.value  Default value of sqlStatement
    Relations:
      =, <>
    Functions:
      prepare(db, sqlStatementStri)  Create a prepared statement for db
                  ( Type of argument db: database
                    Type of argument sqlStatementStri: string )
      fetch(statement)  Fetch a row from the result data of an executed statement
                  ( Type of result: boolean )
      column(statement, column, bigInteger)  Get the specified column of fetched data as bigInteger
                  ( Type of argument column: integer,
                    Type of result: bigInteger )
      column(statement, column, bigRational)  Get the specified column of fetched data as bigRational
                  ( Type of argument column: integer,
                    Type of result: bigRational )
      column(statement, column, boolean)  Get the specified column of fetched data as booleaninteger,
                    Type of result: boolean )
      column(statement, column, bstring)  Get the specified column of fetched data as bstring
                  ( Type of argument column: integer,
                    Type of result: bstring )
      column(statement, column, duration)  Get the specified column of fetched data as duration
                  ( Type of argument column: integer,
                    Type of result: duration )
      column(statement, column, float)  Get the specified column of fetched data as float
                  ( Type of argument column: integer,
                    Type of result: float )
      column(statement, column, integer)  Get the specified column of fetched data as integer
                  ( Type of argument column: integer,
                    Type of result: integer )
      column(statement, column, string)  Get the specified column of fetched data as string
                  ( Type of argument column: integer,
                    Type of result: string )
      column(statement, column, time)  Get the specified column of fetched data as time
                  ( Type of argument column: integer,
                    Type of result: time )
      isNull(statement, column)  Determine if the specified column of fetched data is NULL
                  ( Type of argument column: integer,
                    Type of result: boolean )
      columnCount(statement)  Return the number of columns in the result data of a statement
                  ( Type of result: integer )
      columnName(statement, column)  Return the name of a column in the result data of a statement
                  ( Type of argument column: integer,
                    Type of result: string )
    Statements:
      bind(statement, pos, num)  Bind a bigInteger parameter to a prepared SQL statement
                  ( Type of argument pos: integer,
                    Type of argument num: bigInteger )
      bind(statement, pos, bigRatData)  Bind a bigRational parameter to a prepared SQL statement
                  ( Type of argument pos: integer,
                    Type of argument bigRatData: bigRational )
      bind(statement, pos, flag)  Bind a boolean parameter to a prepared SQL statement
                  ( Type of argument pos: integer,
                    Type of argument flag: boolean )
      bind(statement, pos, bstri)  Bind a bstring parameter to a prepared SQL statement
                  ( Type of argument pos: integer,
                    Type of argument bstri: bstring )
      bind(statement, pos, number)  Bind a float parameter to a prepared SQL statement
                  ( Type of argument pos: integer,
                    Type of argument number: float )
      bind(statement, pos, number)  Bind an integer parameter to a prepared SQL statement
                  ( Type of argument pos: integer,
                    Type of argument number: integer )
      bind(statement, pos, NULL)  Bind a NULL parameter to a prepared SQL statement.
                  ( Type of argument pos: integer )
      bind(statement, pos, stri)  Bind a string parameter to a prepared SQL statement
                  ( Type of argument pos: integer,
                    Type of argument : string )
      bind(statement, pos, timeData)  Bind a time parameter to a prepared SQL statement
                  ( Type of argument pos: integer,
                    Type of argument timeData: time )
      bind(statement, pos, durationData)  Bind a duration parameter to a prepared SQL statement
                  ( Type of argument pos: integer,
                    Type of argument durationData: duration )
      execute(statement)  Execute the specified prepared SQL statement

5.26 process

The type process describes processes of the operating system. The library "process.s7i" defines functions to create and manage processes.

    Constants:
      process.value  Default value of process (process.EMPTY)
    Relations:
      =, <>
    Functions:
      startProcess(command, parameters)  Start a new process
                  ( Type of argument command: string,
                    Type of argument parameters: array string )
      startProcess(cmdAndParams)  Start a new process
                  ( Type of argument cmdAndParams: string )
      pipe2(command, parameters, childStdin, childStdout)  Start a process
           Connect pipes to its standard I/O files.
                  ( Type of argument command: string,
                    Type of argument parameters: array string,
                    Type of argument childStdin: file,
                    Type of argument childStdout: file )
      childStdIn(process)  The standard input file of process
                  ( Type of result: file )
      childStdOut(process)  The standard output file of process
                  ( Type of result: file )
      childStdErr(process)  The standard error file of process
                  ( Type of result: file )
      isAlive(process)  Test whether the specified process is alive
                  ( Type of result: boolean )
      exitValue(process)  The exit value of process
                  ( Type of result: integer )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
      str(process)  Get the process identifier (PID)
      getSearchPath  The search path of the operating system
                  ( Type of result: array string )
      commandPath(command)  Search for an executable in the directories of the search path
                  ( Type of argument command: string,
                    Type of result: string )
      commandDir(command)  Search for the directory of an executable in the search path
                  ( Type of argument command: string,
                    Type of result: string )
    Statements:
      kill(process)  Kill process
      waitFor(process)  Wait until process has terminated
      setSearchPath(searchPath)  Set the search path of the current process
                  ( Type of argument searchPath: array string )
      ignore(A) Ignore value

5.27 category

The type category describes the category of a reference. The category functions are defined in the library "category.s7i".

    Literals:
      SYMBOLOBJECT, DECLAREDOBJECT, FORWARDOBJECT, FWDREFOBJECT, BLOCKOBJECT,
      CALLOBJECT,MATCHOBJECT, TYPEOBJECT, FORMPARAMOBJECT, INTOBJECT,
      BIGINTOBJECT, CHAROBJECT, STRIOBJECT, BSTRIOBJECT, ARRAYOBJECT,
      HASHOBJECT, STRUCTOBJECT, CLASSOBJECT, INTERFACEOBJECT, SETOBJECT,
      FILEOBJECT, SOCKETOBJECT, LISTOBJECT, FLOATOBJECT, WINOBJECT,
      ENUMLITERALOBJECT, CONSTENUMOBJECT, VARENUMOBJECT, REFOBJECT,
      REFLISTOBJECT, EXPROBJECT, ACTOBJECT, VALUEPARAMOBJECT, REFPARAMOBJECT,
      RESULTOBJECT, LOCALVOBJECT, PROGOBJECT
    Constants:
      category.value  Default value of category (SYMBOLOBJECT)
    Infix operators:
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( TRUE ? a : b  a,
                    FALSE ? a : b  b )
      category conv A   Conversion of integer to category
                  ( Type of argument A: integer,
                    category conv ord(INTOBJECT)  INTOBJECT )
      category parse A   Conversion of string to category
                  ( Type of argument A: string,
                    category parse "FLOATOBJECT"  FLOATOBJECT,
                    category parse "does not exist"  EXCEPTION RANGE_ERROR )
    Relations:
      =, <>
    Functions:
      ord(A)    Ordinal number
                  ( Type of result: integer )
      category(A)  Conversion of integer to category
                  ( Type of argument A: integer,
                    category(ord(INTOBJECT))  INTOBJECT )
      str(A)    Conversion to string
                  ( Type of result: string,
                    str(CHAROBJECT)  "CHAROBJECT" )
      category(A)  Conversion of string to category
                  ( Type of argument A: string,
                    category("FLOATOBJECT")  FLOATOBJECT,
                    category("does not exist")  EXCEPTION RANGE_ERROR )
    Statements:
      ignore(A) Ignore value
      for A range B to C do
        D
      end for   Loop over all categories from B to C
                  ( Type of argument D: proc )
      for A range B downto C do
        D
      end for   Loop over all categories from B down to C
                  ( Type of argument D: proc )

5.28 reference

The type reference describes a reference to an object in the abstract syntax tree (AST) of a program. You cannot access the AST of the program that currently runs. Instead you can parse a program and access its AST. The reference functions are defined in the library "reference.s7i".

    Constants:
      NIL              Reference to no element.
      reference.value  Default value of reference (NIL)
    Relations:
      =, <>
    Functions:
      category(A) Get the category of the referenced object
                  ( Type of result: category,
                    category(NIL)  EXCEPTION RANGE_ERROR )
      str(A)    Conversion to string
                  ( Type of result: string )
      getType(A) Get the type of the referenced object
                  ( Type of result: type,
                    getType(NIL)  EXCEPTION RANGE_ERROR )
      objNumber(A) Delivers an unique number for each object
                  ( Type of result: integer,
                    objNumber(NIL)  0 )
      isVar(A)  Reference to a variable object
                  ( Type of result: boolean,
                    isVar(NIL)  EXCEPTION RANGE_ERROR )
      formalParams(A) Gets the formal parameters of a function
                  ( Type of result: ref_list,
                    formalParams(NIL)  EXCEPTION RANGE_ERROR )
      localVars(A) Gets the local variables of a function
                  ( Type of result: ref_list,
                    localVars(NIL)  EXCEPTION RANGE_ERROR,
                    localVars(A)  EXCEPTION RANGE_ERROR for category(A) <> BLOCKOBJECT )
      localConsts(A) Gets the local constants of a function
                  ( Type of result: ref_list,
                    localConsts(NIL)  EXCEPTION RANGE_ERROR,
                    localConsts(A)  EXCEPTION RANGE_ERROR for category(A) <> BLOCKOBJECT )
      body(A)   Gets the body of a function
                  ( body(NIL)  EXCEPTION RANGE_ERROR,
                    body(A)  EXCEPTION RANGE_ERROR for category(A) <> BLOCKOBJECT )
      resultVar(A) Gets the result variable of a function
                  ( resultVar(NIL)  EXCEPTION RANGE_ERROR,
                    resultVar(A)  EXCEPTION RANGE_ERROR for category(A) <> BLOCKOBJECT )
      resultInitValue(A) Gets the initialization value of the result
                         object of a function
                  ( resultInitValue(NIL)  EXCEPTION RANGE_ERROR,
                    resultInitValue(A)  EXCEPTION RANGE_ERROR for category(A) <> BLOCKOBJECT )
      arrayToList(A) Return the array elements as list
                  ( Type of result: ref_list,
                    arrayToList(NIL)  EXCEPTION RANGE_ERROR,
                    arrayToList(A)  EXCEPTION RANGE_ERROR for category(A) <> ARRAYOBJECT )
      arrayMinIdx(A) Return the minimum index of an array
                  ( Type of result: integer,
                    arrayMinIdx(NIL)  EXCEPTION RANGE_ERROR,
                    arrayMinIdx(A)  EXCEPTION RANGE_ERROR for category(A) <> ARRAYOBJECT )
      arrayMaxIdx(A) Return the maximum index of an array
                  ( Type of result: integer,
                    arrayMaxIdx(NIL)  EXCEPTION RANGE_ERROR,
                    arrayMaxIdx(A)  EXCEPTION RANGE_ERROR for category(A) <> ARRAYOBJECT )
      structToList(A) Return the struct elements as list
                  ( Type of result: ref_list,
                    structToList(NIL)  EXCEPTION RANGE_ERROR,
                    structToList(A)  EXCEPTION RANGE_ERROR for category(A) <> STRUCTOBJECT )
      interfaceToStruct(A) Return the struct to which the interface object points.
                  ( interfaceToStruct(NIL)  EXCEPTION RANGE_ERROR,
                    interfaceToStruct(A)  EXCEPTION RANGE_ERROR for category(A) <> INTERFACEOBJECT )
      file(A)   File name of the referenced object
                  ( Type of result: string,
                    file(NIL)  EXCEPTION RANGE_ERROR )
      line(A)   Line number of the referenced object
                  ( Type of result: integer,
                    line(NIL)  EXCEPTION RANGE_ERROR )
      alloc(A)  Create a copy of the object referenced by A
                The object value of the copy is set to NULL
      getValue(A, reference) Dereference as reference
                  ( Type of result: reference,
                    getValue(NIL, reference)  EXCEPTION RANGE_ERROR,
                    getValue(A, reference)  EXCEPTION RANGE_ERROR for
                        category(A) not in {FWDREFOBJECT, REFOBJECT, REFPARAMOBJECT, RESULTOBJECT,
                        LOCALVOBJECT, ENUMLITERALOBJECT, CONSTENUMOBJECT, VARENUMOBJECT} )
      getValue(A, ref_list) Dereference as ref_list
                  ( Type of result: ref_list,
                    getValue(NIL, ref_list)  EXCEPTION RANGE_ERROR,
                    getValue(A, ref_list)  EXCEPTION RANGE_ERROR for
                        category(A) not in {MATCHOBJECT, CALLOBJECT, REFLISTOBJECT} )
      getValue(A, boolean) Dereference as boolean
                  ( Type of result: boolean,
                    getValue(NIL, boolean)  EXCEPTION RANGE_ERROR,
                    getValue(A, boolean)  EXCEPTION RANGE_ERROR if A does not refer to FALSE or TRUE )
      getValue(A, integer) Dereference as integer
                  ( Type of result: integer,
                    getValue(NIL, integer)  EXCEPTION RANGE_ERROR,
                    getValue(A, integer)  EXCEPTION RANGE_ERROR for category(A) <> INTOBJECT )
      getValue(A, bigInteger) Dereference as bigInteger
                  ( Type of result: bigInteger,
                    getValue(NIL, bigInteger)  EXCEPTION RANGE_ERROR,
                    getValue(A, bigInteger)  EXCEPTION RANGE_ERROR for category(A) <> BIGINTOBJECT )
      getValue(A, float) Dereference as float
                  ( Type of result: float,
                    getValue(NIL, float)  EXCEPTION RANGE_ERROR,
                    getValue(A, float)  EXCEPTION RANGE_ERROR for category(A) <> FLOATOBJECT )
      getValue(A, char) Dereference as char
                  ( Type of result: char,
                    getValue(NIL, char)  EXCEPTION RANGE_ERROR,
                    getValue(A, char)  EXCEPTION RANGE_ERROR for category(A) <> CHAROBJECT )
      getValue(A, string) Dereference as string
                  ( Type of result: string,
                    getValue(NIL, string)  EXCEPTION RANGE_ERROR,
                    getValue(A, string)  EXCEPTION RANGE_ERROR for category(A) <> STRIOBJECT )
      getValue(A, bstring) Dereference as bstring
                  ( Type of result: bstring,
                    getValue(NIL, bstring)  EXCEPTION RANGE_ERROR,
                    getValue(A, bstring)  EXCEPTION RANGE_ERROR for category(A) <> BSTRIOBJECT )
      getValue(A, bitset) Dereference as bitset
                  ( Type of result: bitset,
                    getValue(NIL, bitset)  EXCEPTION RANGE_ERROR,
                    getValue(A, bitset)  EXCEPTION RANGE_ERROR for category(A) <> SETOBJECT )
      getValue(A, clib_file) Dereference as clib_file
                  ( Type of result: clib_file,
                    getValue(NIL, clib_file)  EXCEPTION RANGE_ERROR,
                    getValue(A, clib_file)  EXCEPTION RANGE_ERROR for category(A) <> FILEOBJECT )
      getValue(A, program) Dereference as program
                  ( Type of result: program,
                    getValue(NIL, program)  EXCEPTION RANGE_ERROR,
                    getValue(A, program)  EXCEPTION RANGE_ERROR for category(A) <> PROGOBJECT )
      getValue(A, ACTION) Dereference as ACTION
                  ( Type of result: ACTION,
                    getValue(NIL, ACTION)  EXCEPTION RANGE_ERROR,
                    getValue(A, ACTION)  EXCEPTION RANGE_ERROR for category(A) <> ACTOBJECT )
      getValue(A, type) Dereference as type
                  ( Type of result: type,
                    getValue(NIL, type)  EXCEPTION RANGE_ERROR,
                    getValue(A, type)  EXCEPTION RANGE_ERROR for category(A) <> TYPEOBJECT )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      setVar(A, B) Set var flag of referenced object A to B
                  ( Type of argument B: boolean,
                    setVar(NIL, B)  EXCEPTION RANGE_ERROR )
      setCategory(A, B) Set the category of the referenced object A to B
                  ( Type of argument B: category,
                    setCategory(NIL, B)  EXCEPTION RANGE_ERROR )
      setType(A, B) Set the type of the referenced object A to B
                  ( Type of argument B: type,
                    setType(NIL, B)  EXCEPTION RANGE_ERROR )
      setValue(A, B) Set the value of the referenced object A to B
                  ( Type of argument B: ref_list )
      setFormalParams(A, B) Set the formal parameters of a function
                  ( Type of argument B: ref_list,
                    setFormalParams(NIL, B)  EXCEPTION RANGE_ERROR )
      ignore(A) Ignore value

5.29 ref_list

The type ref_list describes a list of reference objects. The ref_list functions are defined in the library "ref_list.s7i".

    Constants:
      ref_list.EMPTY  Empty reference list.
      ref_list.value  Default value of ref_list (ref_list.EMPTY)
    Infix operators:
      &         Ref_list list concatenation
      A in B    Is element in ref_list
                  ( Type of argument A: reference,
                    Type of result: boolean )
      A not in B  Is element not in ref_list
                  ( Type of argument A: reference,
                    Type of result: boolean )
    Indices:
      [ A ]     Access one ref_list element
                  ( Type of argument A: integer,
                    Type of result: reference,
                    A[1]  First element,
                    A[length(A)]  Last element,
                    A[0]  EXCEPTION INDEX_ERROR,
                    A[succ(length(A))]  EXCEPTION INDEX_ERROR )
      [ A .. B ]  Access a sub list
                  ( Type of arguments A and B: integer )
      [ A .. ]  Access a sub list beginning at position A
                  ( Type of argument A: integer )
      [ .. A ]  Access a sub list ending at position A
                  ( Type of argument A: integer )
    Relations:
      =, <>
    Functions:
      length(A) Length of ref_list
                  ( Type of result: integer,
                    length(ref_list.EMPTY)  0 )
      make_list(A) Create ref_list with element A
                  ( Type of argument A: reference )
      pos(A,B)  First position of reference B in ref_list A
                  ( Type of argument B: reference,
                    Type of result: integer )
      pos(A,B,C) First position of reference B in ref_list A
                 The search starts at position C of ref_list A
                  ( Type of argument B: reference,
                    Type of argument C: integer,
                    Type of result: integer )
      incl(A, B) Include element in list
                  ( Type of argument B: reference )
      excl(A, B) Exclude element from list
                  ( Type of argument B: reference )
    Statements:
      A &:= B   Append B to A
                  ( A &:= B  A := A & B )
      A @:= [B] C  Assign C to element B of ref_list A
                  ( Type of argument B: integer,
                    Type of argument C: reference,
                    A @:= [B] C 
                        A := A[..pred(B)] & make_list(C) & A[succ(B)..],
                    A @:= [0] C  EXCEPTION INDEX_ERROR,
                    A @:= [succ(length(A))] C  EXCEPTION INDEX_ERROR )
      ignore(A) Ignore value
      for forVar range aRefList do
        statements
      end for   Loop over all elements of a ref_list
                  ( Type of argument forVar: reference,
                    Type of argument statements: proc )
      for forVar range aRefList until condition do
        statements
      end for   Loop over all elements of a ref_list until condition is TRUE
                Check the condition before the statements in the loop body are executed.
                  ( Type of argument forVar: reference,
                    Type of argument condition: boolean,
                    Type of argument statements: proc )

5.30 program

The type program describes a Seed7 program. You cannot access the program that currently runs. Instead you can parse a program and access its data. The program functions are defined in the library "progs.s7i".

    Constants:
      program.EMPTY  Empty program.
      program.value  Default value of program (program.EMPTY)
    Relations:
      =, <>
    Functions:
      name(A)   Name of program A without path and extension
      path(A)   Absolute path of program A
      parseFile(A)  Parse the file with the name A
                  ( Type of argument A: string )
      parseStri(A)  Parse the string A
                  ( Type of argument A: string )
      evaluate(A, B)  Evaluate the expression B which is part of program A
                  ( Type of result: reference,
                    Type of argument B: reference )
      sysVar(A, B)  Return a reference of the system var B of program A
                  ( Type of result: reference,
                    Type of argument B: string )
      errorCount(A)  Number of errors in the program A
                  ( Type of result: integer )
      globalObjects(A)  List of global defined objects in the program A
                  ( Type of result: ref_list )
      syobject(A, B)  Return object with name B in program A
                  ( Type of result: reference,
                    Type of argument B: string )
      match(A, B)  Return object from program A which matches B
                  ( Type of result: reference,
                    Type of argument B: ref_list )
    Statements:
      execute(A) Execute the program referred by A
      ignore(A) Ignore value

5.31 ptr

The type ptr baseType describes a pointer to an object of a baseType. With

const type: ptrType is ptr baseType;

a new pointer type ptrType is declared.

    Constants:
      ptrType.NIL   Reference to no element
    Prefix operators:
      &         Address of
                  ( Type of operand: baseType )
    Postfix operators:
      ^         Dereference
                  ( Type of result: baseType )
    Infix operators:
      ptrType conv A  Conversion from reference A to ptrType
      reference conv A  Conversion from ptrType A to reference
    Relations:
      =, <>
    Functions:
      base_type(ptrType)  Gets the baseType of a ptrType
                  ( Type of argument ptrType: type )

5.32 func

The type func baseType describes functions which return a baseType. For example: func integer describes an integer function.

    Values:
      ord, str, abs, sqrt, rand, A + B, A * B, A ** B,
      trunc, round, sin, cos, compare, hashCode, pos,
      replace, trim, length, keys, color, dayOfWeek,
      ...
                Every function declared with const func ... is a value

    Prefix operators:
      func
      result
        var baseType: resultVariable is baseType.value;
      begin
        statements
      end func
                Create a baseType function
                  ( Type of 'statements': proc,
                    Type of result: func baseType )

      func
      result
        var baseType: resultVariable is baseType.value;
      local
        declarations
      begin
        statements
      end func
                Create a baseType function with local variables
                  ( Type of 'declarations': proc,
                    Type of 'statements': proc,
                    Type of result: func baseType )

      return value
                Create a function with the result type of value
                  ( Type of value: anyType - which means: any type,
                    Type of result: func anyType )

Functions are declared as constants with a func type and are initialized with a func result ... or return ... operator. For example:

const func integer: tak (in integer: x, in integer: y, in integer: z) is func
  result
    var integer: tak is 0;
  begin
    if y >= x then
      tak := z;
    else
      tak := tak(tak(pred(x), y, z),
                 tak(pred(y), z, x),
                 tak(pred(z), x, y));
    end if;
  end func

Another example using the return function:

const func float: convertRadianToDegree (in float: x) is
  return x * 57.295779513082320876798154814114;

This return function should not be confused with a return statement. It is important to note that no return statement exists. The declaration for the return function is as follows:

const func func aType: return (ref func aType param)  is action "PRC_RETURN";
const func func aType: return (ref aType param)       is action "PRC_RETURN";

The func types can also be used for parameters. Functions which use a func parameter do not evaluate this parameter before the function call. Instead this parameter can be evaluated zero or more times inside the function. For example:

const func boolean: (in boolean: first) and (in func boolean: second) is func
  result
    var boolean: conjunction is FALSE;
  begin
    if first then
      conjunction := second;
    end if;
  end func;

Here the second parameter is only evaluated if the first parameter is TRUE.

5.33 varfunc

The type varfunc baseType describes functions which return a baseType variable. For example: A function which returns an integer variable is described with varfunc integer. A call of a varfunc can be used at the left side of an assignment. Generally a varfunc can be used at places where an inout parameter requests a variable.

    Prefix operators:
      return var value;
                Create a varfunc which returns the variable 'value'
                  ( Type of value: anyType - which means: any type,
                    Accessright of value: var = A variable, an inout parameter or a varfunc
                    Type of result: varfunc anyType )

Varfunctions are used to express array, hash and struct accesses which can be used at the left and right side of an assignment. The access function for a hash is defined as:

const func baseType: (in hashType: aHash) [ (in keyType: aKey) ] is
  return INDEX(aHash, aKey, hashCode(aKey), hashType.keyCompare);

const varfunc baseType: (inout hashType: aHash) [ (in keyType: aKey) ] is
  return var INDEX(aHash, aKey, hashCode(aKey), hashType.keyCompare);

The example above shows that functions with in and inout parameters can be overloaded. At the right side of an assignment the func is called, while at the left side the varfunc is called. That way the access functions of arrays, hashes and structs can be used in the usual way.

5.34 void

The type void describes the empty type.

    Value:
      empty     This is the only value of the type void.
    Constants:
      void.value  Default value of void (empty)

5.35 proc

The type proc describes procedures. The type proc is defined as func void.

    Values:
      noop;
      while ... do ... end while;
      repeat ... until ... ;
      writeln( ... );
      A := B;
      incr(A);
      ...
                Every procedure declared with const proc: ... is a value
                The procedure 'noop' does nothing and is used as empty procedure.

    Prefix operators:
      func
      begin
        statements
      end func
                Create a procedure
                  ( Type of 'statements': proc,
                    Type of result: proc )

      func
      local
        declarations
      begin
        statements
      end func
                Create a procedure with local variables
                  ( Type of 'declarations': proc,
                    Type of 'statements': proc,
                    Type of result: proc )

5.36 type

The type type describes all types. Examples of type declarations are:

const type: intArrayType is array integer;
const type: arrayIndexChar is array [char] string;
const type: hashType is hash [string] intArrayType;
const type: setType is set of char;

Note that type declarations should always be made at the top level. E.g.:

$ include "seed7_05.s7i";

const type: intArrayType is array integer;

const proc: main is func
  local
    var intArrayType: arr is [](1, 2);
  begin
    writeln(length(arr));
  end func;

If the type declaration of intArrayType would be inside of the local declaration block you would receive a parsing error:

*** tst249.sd7(6):52: Match for {var intArrayType : {arr } is {[ ] {1 , 2 } } } failed
    var intArrayType: arr is [](1, 2);

A local declaration block is parsed completely before it is executed. This causes that intArrayType is not defined during the parsing.

    Values:
      void, boolean, integer, rational, float, char,
      string, reference, ref_list, color, time, duration
      file, proc, type, ...
                Every type declared with const type: ... is a value
                The type void is used as empty type.
    Constants:
      type.value  Default value of type (void)
    Prefix operators:
      func      Function type
                  ( func char  Function which returns a char )
      varfunc   Varfunc type
                  ( varfunc char  Function which returns a char variable )
      ptr       Pointer type
                  ( ptr bitset  Pointer to bitset )
      array     Array type
                  ( array string  Array of strings )
      set of    Set type
                  ( set of integer  Set of integer )
      subtype   Create subtype of existing type
                  ( subtype char  Subtype of char )
    Infix operators:
      A ? B : C  Ternary operator condition ? thenValue : elseValue
                  ( TRUE ? a : b  a,
                    FALSE ? a : b  b )
    Relations:
      =, <>
    Functions:
      str(A)    Conversion to string
                  ( Type of result: string )
      newtype   Create a new type
      gentype   Generate a type
      gensub(A) Generate a subtype
      typeof(A) Get the type of an expression
                  ( Type of argument A: Defined for all types,
                    typeof(1)  integer,
                    typeof("asdf")  string )
      isFunc(A)  Is this type a func type
                  ( Type of result: boolean,
                    isFunc(func char)  TRUE,
                    isFunc(varfunc char)  FALSE )
                    isFunc(char)  FALSE )
      isVarfunc(A)  Is this type a varfunc type
                  ( Type of result: boolean,
                    isVarfunc(func char)  FALSE,
                    isVarfunc(varfunc char)  TRUE,
                    isVarfunc(char)  FALSE )
      resultType(A)  Get the result type of a func or varfunc type
                  ( resultType(func char)  char,
                    resultType(proc)  void,
                    resultType(integer)  EXCEPTION RANGE_ERROR )
      isDerived(A)  Is this type derived from another type
                  ( Type of result: boolean,
                    isDerived(subtype char)  TRUE )
      meta(A)       Get the type from which type A is derived
                  ( meta(subtype char)  char )
      base_type(A)  Get the base type of an array, pointer or
                    set type
                  ( base_type(array char)  char,
                    base_type(ptr string)  string,
                    base_type(set of integer)  integer )
      typeNumber(A)  Get an unique number for a type
                  ( Type of result: integer )
      typeObject(A)  Get a unique object (match object) of a type
                  ( Type of result: reference )
      compare(A, B) Compare function
                  ( Type of result: integer )
      hashCode(A) Hash function
                  ( Type of result: integer )
    Statements:
      addInterface(A, B)  Adds the interface type B to the implementation type A
      const aType: name is value
                Declare constant 'name' with 'value'
      var aType: name is value
                Declare variable 'name' with 'value'
      ignore(A) Ignore value

5.37 object

The type object is used as meta type for various types. This allows defining common operations for all this types. The type object is not used as element type for container classes since this can be done much better and type safe with abstract data types like array, set, hash and others.

    Functions:
      TRACE_OBJ(A)  Write internal information

5.38 expr

The type expr is used to describe unmatched expressions. These are expressions where the recognizing of the functions and the type check is not done yet. This is used for example in the definition of function bodies.

    Functions:
      WRITE_EXPR(A)
                Write expr A to FILE OUT


 previous   up   next