Sather Home Page

Section 8.17.3.4:
RUNE

class RUNE < $CHAR{SAME}

Inheritance map $CHAR

Formal Types

types

SAME = RUNE ;

RUNE = seq1 of CHAR_CODE

This class implements the notion of a logical character which has the semantics associated with such a token in the cultural environment concerned. It is required to satisfy Level 3 conformance to ISO/IEC 10646-1:2000 as defined therein.

External specifications

The following feature is required to be implemented for this class in accordance with the specification given in $IS_EQ of which $CHAR{RUNE} is a sub-type :-


The following feature is required to be implemented for this class in accordance with the specification given in $IS_LT{RUNE} of which $CHAR{RUNE} is a sub-type :-


The following features are required to be implemented for this class in accordance with the specifications given by inheritance in $STR of which $CHAR{RUNE} is a sub-type :-


The following feature is required to be implemented for this class in accordance with the specification given in $HASH of which $CHAR{RUNE} is a sub-type :-


The following features are required to be implemented for this class in accordance with the specifications given in $BINARY of which $CHAR{RUNE} is a sub-type :-


The following features are required to be implemented for this class in accordance with the specifications given in $INSTR of which $CHAR{RUNE} is a sub-type :-


The following features are required to be implemented for this class in accordance with the specifications given in $ANCHORED_FMT of which $CHAR{RUNE} is a sub-type :-


The following features are required to be implemented for this class in accordance with the specifications given in $CHAR{RUNE} :-


Reader Routine

This class has a single reader routine -


valid

This predicate is provided in order that the validity of the 'number' as a bit-pattern for a code may be ascertained - in respect to the given encoding and repertoire.

valid (
num : CARD,
lib : LIBCHARS
) : BOOL
Formal Signature
valid(num : CARD, lib : LIBCHARS) res : BOOL
Pre-condition
pre true
Post-condition

Note that where the code is to occupy eight bits only then all values are valid, but that for sixteen bit codes all values except the one with all bits set is valid - and for thirty-two bit codes only 31 bits are used and then the value with 31 bits set is not valid.

post res =
cases LIBCHARS.my_size(lib) :
1 -> num <= OCTET.Octet_Max,
2 -> num < HEXTET.Hextet_Max,
4 -> num <= QUADBITS.Quad_Max div 2
end

This routine returns true if and only if the value of num may be interpreted as a character bit-pattern valid in the given encoding and repertoire, otherwise false.


valid

This predicate is provided in order that the validity of the 'number' as a bit-pattern for a code may be ascertained - in respect to the default encoding and repertoire.

valid (
num : CARD
) : BOOL
Formal Signature
valid(num : CARD) res : BOOL
Pre-condition
pre true
Post-condition

Note that where the code is to occupy eight bits only then all values are valid, but that for sixteen bit codes all values except the one with all bits set is valid - and for thirty-two bit codes only 31 bits are used and then the value with 31 bits set is not valid.

post res =
cases LIBCHARS.my_size(LIBCHARS.default()) :
1 -> num <= OCTET.Octet_Max,
2 -> num < HEXTET.Hextet_Max,
4 -> num <= QUADBITS.Quad_Max div 2
end

This routine returns true if and only if the value of num may be interpreted as a character bit-pattern valid in the default execution environment encoding and repertoire, otherwise false.


convert

This routine attempts to convert self into the encoding specified by the argument if this is possible, otherwise void is returned.

convert (
lib : LIBCHARS
) : SAME
Formal Signature
convert(self : SAME, lib : LIBCHARS) res : [SAME]
Pre-condition
pre true
Post-condition
post convert(res,lib(self)) = self
or res = nil

This routine converts self into the encoding specified by lib - if this is possible, otherwise returning void.


copy

Since this 'kind' of character is not an immutable class, this copy routine is provided to aid in providing immutable semantics if desired.

copy : SAME
Formal Signature
copy(self : SAME) res : SAME
Pre-condition
pre true
Post-condition
post res = self

This routine returns an exact copy of self.


size

This routine has the same semantics as num_codes - returning the number of codes in self.

size : CARD
Formal Signature
size(self : SAME) res : CARD
Pre-condition
pre true
Post-condition
post res = len self

This routine returns the number of codes in self.


plus

This routine is provided for building a rune from a number of individual codes which must all be combining codes except the first.

plus (
code : CHAR_CODE
) : SAME
Formal Signature
plus(self : SAME, code : CHAR_CODE) res : SAME
Pre-condition
pre CHAR_CODE.lib = lib(self)
and CHAR_CODE.is_combining(code)
Post-condition
post res = self ^ code

This routine appends code to self returning the new rune formed.


Language Index Library Index Text Index
Comments or enquiries should be made to Keith Hopper.
Page last modified: Thursday, 23 November 2000.
Produced with Amaya