The Iso Byte Char module

Author(s): The CLIP Group, Daniel Cabeza, Edison Mera (documentation), Manuel Hermenegildo (minor mods).

This module provides some basic predicates according to the ISO specification of byte and char manipulation.

Usage and interface

Documentation on exports

PREDICATE
char_code(Char,Code)

Succeeds iff the character code of the one char atom Char is Code.

Usage 1: ISO

  • Call and exit should be compatible with:
    (basic_props:character_code/1)Code is an integer which is a character code.
  • The following properties should hold at call time:
    (basic_props:atm/1)Char is an atom.
  • The following properties should hold upon exit:
    (basic_props:character_code/1)Code is an integer which is a character code.

Usage 2: ISO

  • The following properties should hold at call time:
    (term_typing:var/1)Char is a free variable.
    (basic_props:character_code/1)Code is an integer which is a character code.
  • The following properties should hold upon exit:
    (basic_props:atm/1)Char is an atom.

PREDICATE
atom_chars(Atom,Chars)

Succeeds iff Chars is a list whose elements are the one-char atoms whose names are the successive characters of the name of atom Atom

Usage 1: ISO

  • Call and exit should be compatible with:
    (basic_props:list/2)Chars is a list of atms.
  • The following properties should hold at call time:
    (basic_props:atm/1)Atom is an atom.
  • The following properties should hold upon exit:
    (basic_props:list/2)Chars is a list of atms.

Usage 2: ISO

  • The following properties should hold at call time:
    (term_typing:var/1)Atom is a free variable.
    (basic_props:list/2)Chars is a list of atms.
  • The following properties should hold upon exit:
    (basic_props:atm/1)Atom is an atom.

PREDICATE
number_chars(Number,Chars)

Success iff Chars is a list whose elements are the one-char atoms corresponding to a character sequence of Number which could be output

Usage 1: ISO

  • Call and exit should be compatible with:
    (basic_props:list/2)Chars is a list of atms.
  • The following properties should hold at call time:
    (basic_props:num/1)Number is a number.
  • The following properties should hold upon exit:
    (basic_props:list/2)Chars is a list of atms.

Usage 2: ISO

  • The following properties should hold at call time:
    (term_typing:var/1)Number is a free variable.
    (basic_props:list/2)Chars is a list of atms.
  • The following properties should hold upon exit:
    (basic_props:num/1)Number is a number.

PREDICATE

Usage 1:

  • Call and exit should be compatible with:
    (basic_props:list/2)Arg2 is a list of character_codes.
  • The following properties should hold at call time:
    (basic_props:list/2)Arg1 is a list of atms.
  • The following properties should hold upon exit:
    (basic_props:list/2)Arg2 is a list of character_codes.

Usage 2:

  • The following properties should hold at call time:
    (term_typing:var/1)Arg1 is a free variable.
    (basic_props:list/2)Arg2 is a list of character_codes.
  • The following properties should hold upon exit:
    (basic_props:list/2)Arg1 is a list of atms.

PREDICATE

Usage: ISO

  • Description: Same as get_byte/2, but use the current input.
  • Call and exit should be compatible with:
    (basic_props:int/1)Arg1 is an integer.
  • The following properties should hold upon exit:
    (basic_props:int/1)Arg1 is an integer.

PREDICATE
get_byte(Stream,Byte)

Is true iff Byte unifies with the next byte to be input from the target Stream.

Usage: ISO

  • Call and exit should be compatible with:
    (basic_props:int/1)Byte is an integer.
  • The following properties should hold at call time:
    (streams_basic:stream/1)Stream is an open stream.
  • The following properties should hold upon exit:
    (streams_basic:stream/1)Stream is an open stream.
    (basic_props:int/1)Byte is an integer.
  • The following properties should hold globally:
    (basic_props:not_further_inst/2)Stream is not further instantiated.

PREDICATE

Usage: ISO

  • Description: Same as peek_byte/2, but use the current input.
  • Call and exit should be compatible with:
    (basic_props:int/1)Arg1 is an integer.
  • The following properties should hold upon exit:
    (basic_props:int/1)Arg1 is an integer.

PREDICATE

Usage: ISO

  • Description: Is true iff Byte unifies with the next byte to be input from the target Stream.
  • Call and exit should be compatible with:
    (basic_props:int/1)Arg2 is an integer.
  • The following properties should hold at call time:
    (streams_basic:stream/1)Arg1 is an open stream.
  • The following properties should hold upon exit:
    (streams_basic:stream/1)Arg1 is an open stream.
    (basic_props:int/1)Arg2 is an integer.
  • The following properties should hold globally:
    (basic_props:not_further_inst/2)Arg1 is not further instantiated.

PREDICATE

Usage: ISO

  • Description: Same as put_byte/2, but use the current input.
  • The following properties should hold at call time:
    (basic_props:int/1)Arg1 is an integer.

PREDICATE
put_byte(Stream,Byte)

Is true. Procedurally, putbyte/2 is executed as follows:

a) Outputs the byte Byte to the target stream.

b) Changes the stream position of the target stream to take account of the byte which has been output.

c) The goal succeeds.

Usage: ISO

  • The following properties should hold at call time:
    (streams_basic:stream/1)Stream is an open stream.
    (basic_props:int/1)Byte is an integer.
  • The following properties should hold upon exit:
    (streams_basic:stream/1)Stream is an open stream.
  • The following properties should hold globally:
    (basic_props:not_further_inst/2)Stream is not further instantiated.

PREDICATE

Usage: ISO

  • Description: Same as get_char/2, but use the current input.
  • Call and exit should be compatible with:
    (basic_props:atm/1)Arg1 is an atom.
  • The following properties should hold upon exit:
    (basic_props:atm/1)Arg1 is an atom.

PREDICATE
get_char(Stream,Char)

Is true iif Char unifies with the next character to be input from the target Stream.

Usage: ISO

  • Call and exit should be compatible with:
    (basic_props:atm/1)Char is an atom.
  • The following properties should hold at call time:
    (streams_basic:stream/1)Stream is an open stream.
  • The following properties should hold upon exit:
    (streams_basic:stream/1)Stream is an open stream.
    (basic_props:atm/1)Char is an atom.
  • The following properties should hold globally:
    (basic_props:not_further_inst/2)Stream is not further instantiated.

PREDICATE

Usage: ISO

  • Description: Similar to peek_code/1, but using char instead of code.
  • Call and exit should be compatible with:
    (basic_props:atm/1)Arg1 is an atom.
  • The following properties should hold upon exit:
    (basic_props:atm/1)Arg1 is an atom.

PREDICATE

Usage: ISO

  • Description: Similar to peek_code/2, but using char instead of code.
  • Call and exit should be compatible with:
    (basic_props:atm/1)Arg2 is an atom.
  • The following properties should hold at call time:
    (streams_basic:stream/1)Arg1 is an open stream.
  • The following properties should hold upon exit:
    (streams_basic:stream/1)Arg1 is an open stream.
    (basic_props:atm/1)Arg2 is an atom.
  • The following properties should hold globally:
    (basic_props:not_further_inst/2)Arg1 is not further instantiated.

PREDICATE

Usage: ISO

  • Description: Similar to put_code/1, but using char instead of code.
  • The following properties should hold at call time:
    (basic_props:atm/1)Arg1 is an atom.

PREDICATE

Usage: ISO

  • Description: Similar to put_code/2, but using char instead of code.
  • The following properties should hold at call time:
    (streams_basic:stream/1)Arg1 is an open stream.
    (basic_props:atm/1)Arg2 is an atom.
  • The following properties should hold upon exit:
    (streams_basic:stream/1)Arg1 is an open stream.
  • The following properties should hold globally:
    (basic_props:not_further_inst/2)Arg1 is not further instantiated.