# Section 8.17.1.1:
$CHAR

###### abstract class $CHAR{TP} < $IS_EQ, $IS_LT{TP}, $HASH, $IMMUTABLE, $INSTR, $ANCHORED_FMT

#### Formal Definitions

This abstract class defines a state component which is a set of all instantiations of objects of any class sub-typing from this class in addition to the vdm model types used wherever this class name is used. Note that SAME has to be an instantiated class, not an abstract one.

types
SAME = object_type ;
$CHAR_TP = set of object_type
state
multi : $CHAR_TP
inv multi_types ==
forall obj in set multi_types & sub_type($CHAR_TP,obj)

NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification.

This abstraction models the semantic notion of a character, ascribing to it all of those features which are not dependent upon any particular form of representation. One additional feature is, however, modelled - that a character is represented by one or more encodings - the class CHAR_CODE. create( code : CHAR_CODE ) : SAME ; -- This routine creates a character from a single character code - which -- must NOT be a combining code. create( code : CONTROL_CODES, lib : LIBCHARS ) : SAME ; -- This creates a 'control character' (ie a character, the code of which -- has been assigned a specific function when found by some representation -- engine in a character stream - for example, a line mark or tab function) -- from the given control code! char : CHAR ; -- This routine returns the character corresponding to self unless self contains more than one encoding when void is returned. code( lib : LIBCHARS ) : CHAR_CODE ; -- This routine returns the character code corresponding to (the first -- element of) self - which is given the indicated repertoire and encoding. code : CHAR_CODE ; -- This routine returns the character code corresponding to (the first -- element of) self - which is presumed to be in the default repertoire and -- encoding. rune( lib : LIBCHARS ) : RUNE ; -- This routine returns the rune corresponding to self which is presumed -- to be in the given repertoire and encoding. rune : RUNE ; -- This routine returns the rune corresponding to self in the default -- repertoire and encoding. is_alpha( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is defined as an -- alphabetic character in the given character repertoire. Note that this may -- be identically false for some scripts. is_alpha : BOOL ; -- This routine returns true if and only if self is defined as an -- alphabetic character by the character repertoire and script in use. Note -- that this may be identically false for some scripts. is_upper( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is defined as an upper -- case (capital) alphabetic character in the given character repertoire. -- Note that this may be identically false for some scripts. is_upper : BOOL ; -- This routine returns true if and only if self is defined as an upper -- case (capital) alphabetic character by the character repertoire and script -- in use. Note that this may be identically false for some scripts. is_lower( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is defined as a lower -- case (small) alphabetic character in the given character repertoire. Note -- that this may be identically false for some scripts. is_lower : BOOL ; -- This routine returns true if and only if self is defined as a lower -- case (small) alphabetic character by the character repertoire and script -- in use. Note that this may be identically false for some scripts. is_octal_digit( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is an octal digit -- character in the given character repertoire. is_octal_digit : BOOL ; -- This routine returns true if and only if self is an octal digit -- character. is_digit( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is a decimal digit in -- the given character repertoire. is_digit : BOOL ; -- This routine returns true if and only if self is a decimal digit. is_hex_digit( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is a hexadecimal digit -- in the given character repertoire. is_hex_digit : BOOL ; -- This routine returns true if and only if self is a hexadecimal digit. is_numeric( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is a number, whether or -- not this is also a digit. If there are digits in the given character -- repertoire and script then they are a subset of the characters for which -- this routine would return true. is_numeric : BOOL ; -- This routine returns true if and only if self is a number, whether or -- not this is also a digit. If there are digits in the character -- repertoire and script then they are a subset of the characters for which -- this routine would return true. is_alphanum( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is a character which -- represents either a letter or a digit in the given character repertoire. -- Note that this excludes characters for which is_numeric would return true -- and is_digit false! is_alphanum : BOOL ; -- This routine returns true if and only if self is a character which -- represents either a letter or a digit. Note that this excludes -- characters for which is_numeric would return true and is_digit false! is_space( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is either a white-space -- character in the given character repertoire or it is a control code -- signifying a move of the current position in the document without making -- a visible mark, otherwise false. is_space : BOOL ; -- This routine returns true if and only if self is either a white-space -- character or is a control code signifying a move of the current position -- in the document without making a visible mark, otherwise false. is_print( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if the self corresponds to -- some visible glyph in the given character repertoire, otherwise false. is_print : BOOL ; -- This routine returns true if and only if the self corresponds to -- some visible glyph, otherwise false. is_punct( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is a character which -- would be interpreted as punctuation in the given character repertoire. is_punct : BOOL ; -- This routine returns true if and only if self is a character which -- would be interpreted as punctuation in the culture repertoire in use. is_control( lib : LIBCHARS ) : BOOL ; -- This routine returns true if and only if self is a control code in -- the given character repertoire is_control : BOOL ; -- For those repertoires which include control codes, this routine will -- return true if and only if self is such a control code, otherwise false. num_codes : CARD ; -- This feature gives the number of individual encodings forming -- the character. upper( lib : LIBCHARS ) : SAME ; -- Providing that there exists an upper case version of self in the -- given repertoire and encoding then that upper case character is returned, -- otherwise self. upper : SAME ; -- Providing that there exists an upper case version of self in the -- default repertoire and encoding then that upper case character is -- returned, otherwise self. lower( lib : LIBCHARS ) : SAME ; -- Providing that there exists a lower case version of self in the given -- repertoire and encoding then that lower case character is returned, -- otherwise self. lower : SAME ; -- Providing that there exists a lower case version of self in the -- default repertoire and encoding then that lower case character is -- returned, otherwise self. octal_digit_value( lib : LIBCHARS ) : CARD ; -- This routine returns the numeric value corresponding to the -- octal digit represented by self in the given repertoire and encoding. octal_digit_value : CARD ; -- This routine returns the numeric value corresponding to the -- octal digit represented by self in the default repertoire and encoding. digit_value( lib : LIBCHARS ) : CARD ; -- This routine returns the numeric value corresponding to the -- digit character represented by self in the given repertoire and encoding. digit_value : CARD ; -- This routine returns the numeric value corresponding to the -- digit character represented by self in the default repertoire and encoding. hex_digit_value( lib : LIBCHARS ) : CARD ; -- This routine returns the numeric value corresponding to the -- hexadecimal digit character represented by self in the given repertoire -- and encoding. hex_digit_value : CARD ; -- This routine returns the numeric value corresponding to the -- hexadecimal digit character represented by self in the default repertoire -- and encoding. code!( once lib : LIBCHARS ) : CHAR_CODE ; -- This iter yields successive encodings of self (which may, of course, -- be only one!) in the given repertoire and encoding. code! : CHAR_CODE ; -- This iter yields successive encodings of self (which may, of course, -- be only one!) in the default encoding and repertoire.

| Language Index |  | Library Index |  | Text Index

Comments or enquiries should be made to Keith Hopper . Page last modified: Monday, 22 May 2000. |