PLOGHELP CHARTYPE                               Simon Nichols  Feb 1987

Library CHARTYPE defines two predicates, chartype/2 and chartype/3,
which enable the character class tables of the Prolog itemiser to be
examined and updated.


CONTENTS - (Use <ENTER> g to access sections)

 -- USAGE
 -- EXAMPLES
 -- RELATED DOCUMENTATION


-- USAGE --------------------------------------------------------------

    ?- library(chartype).
           ;;; to load the library
    ?- chartype(CharSpec, Type).
           ;;; to examine a character class
    ?- chartype(CharSpec, OldType, NewType).
           ;;; to change a character class

CharSpec must be instantiated, and denotes either a single character or
a list of characters. It can be one of:
    - a single character atom;
    - an integer ASCII code;
    - a list of the above (N.B. a list of ASCII codes can be written as
      a string).

In chartype/2, Type is unified with the current class number of the
character(s).

In chartype/3, OldType is first unified with the current class number of
the character(s). If NewType is instantiated, the class number of the
character(s) is then updated to the value of NewType; if NewType is
uninstantiated it is unified with OldType.

Note that if more than one character is specified, the predicates will
only succeed if all characters belong the same class.

-- EXAMPLES -----------------------------------------------------------

To find the class number of the character 'A':

    ?- chartype('A', Type).
    Type = 1 ?
    yes

To determine whether 'A' has the same class number as '_':

    ?- chartype("A_", _).
    yes

To make '#' a separator character (i.e. class 5):

    ?- chartype(#, OldType, 5).
    OldType = 3 ?
    yes

A useful idiom for temporarily changing the class of a character (for
example the character '#' for the duration of some predicate foo) is the
following:

    ?- chartype(#, OldType, 5), foo(X), chartype(#, _, OldType).


-- RELATED DOCUMENTATION ----------------------------------------------

PLOGHELP * STRINGS
    - Prolog strings and ASCII codes

REF *ITEMISE
    - explains itemisation in POPLOG

-----<Copyright University of Sussex 1987.  All rights reserved.>-------
