kinds.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
-------------------------> GNU Sather - sourcefile <-------------------------
-- Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute and/or modify it under the terms of the GNU Library General --
-- Public License (LGPL) as published by the Free Software Foundation; --
-- either version 2 of the license, or (at your option) any later version. --
-- This library is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details. --
-- The license text is also available from: Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
--------------> Please email comments to <bug-sather@gnu.org> <--------------
abstract class $IS_EQ
abstract class $IS_EQ is
-- Subtypes of this abstract class must define "is_eq : BOOL". Typically
-- used in typecases to use instead of "=". Examples:
-- INT < $IS_EQ,
-- STR < $IS_EQ.
-- NOTE This equality should be an IMMUTABLE equality that is valid over the
-- lifetime of the whole object. It should be possible to use this
-- equality (and an associated hash value) to place an object in a hash
-- table and then later retrieve it.
-- Version 1.0 Dec 96. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 16 Dec 96 kh Original from Sather dist abstract.sa
is_eq(elem : $OB) : BOOL ; -- test
-- This yields true if and only if self is equal to elem for this element type.
end ; -- $IS_EQ
abstract class $IS_LT{TYP} < $IS_EQ
abstract class $IS_LT{TYP} < $IS_EQ is
-- Subtypes of this abstract class define "is_lt(T) : BOOL and
-- is_eq($OB)". These are typically used in typecases -
--
-- Examples: INT < $IS_LT{INT}, STR < $IS_LT{STR}.
--
-- Design Note: $IS_LT has a type parameter since objects are almost always
-- comparable only with the same type. With the new rules, if is_lt were
-- defined on elem : $OB, then there would have to be some meaning for < with
-- arbitrary objects. (merely returning false makes ">" true!). Hence,
-- objects will only define comparisons with themselves while the container
-- classes can switch on $IS_LT{T} and then use the SYS::is_lt when the
-- contained objects are not directly comparable
-- Version 1.0 Dec 96. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 16 Dec 96 kh Original from Sather dist abstract.sa
is_lt(
other : TYP
) : BOOL ;
-- This returns true if and only if self is less than other for this
-- element type.
end ; -- $IS_LT{T}
abstract class $IS_NIL
abstract class $IS_NIL is
-- Subtypes of this abstract class must define "is_nil : BOOL".
-- Typically used in typecases.
--
-- Example: INT < $IS_NIL.
-- Version 1.0 Dec 96. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 16 Dec 96 kh Original from Sather dist abstract.sa
is_nil : BOOL ;
-- This routine tests whether a value is nil. This is necessary for
-- types with unusual is_eq behaviour (such as IEEE floats).
end ; -- $IS_NIL
abstract class $NIL < $IS_NIL
abstract class $NIL < $IS_NIL is
-- This abstract class is used to indicate that a subtype provides
-- a nil value.
--
-- Designer's Note : The advantage of T over SAME is that in parametrized
-- classes
--
-- typecase elem
-- when $NIL then
-- .... e.nil e.nil
--
-- is now known to be of type T, whereas if it were SAME, there would need to
-- be at least one extra level of typecase.
-- Version 1.0 Dec 96. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 16 Dec 96 kh Original from Sather dist abstract.sa
nil : SAME ;
-- This routine returns a distinguished value 'NIL' for an object
-- of the type which is sub-typing from this abstract class.
end ; -- $NIL
abstract class $ELT
abstract class $ELT is
-- Subtypes of this abstract class must provide an elt! iterator that
-- returns at least a $OB (it could be more specific). Most structured
-- classes will actually subtype from $ELT{T}.
-- Version 1.0 Dec 96. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 16 Dec 96 kh Original from Sather dist abstract.sa
size : CARD ;
-- This routine returns the number of elements which are contained
-- - ie the number of times that elt! will yield.
elt! : $OB ;
-- This iterator yields the values of each component of self in turn.
end ; -- $ELT
abstract class $ELT{ETP} < $ELT
abstract class $ELT{ETP} < $ELT is
-- Subtypes of this abstract class must define "elt! : T". This is
-- a stronger version of the generic $ELT class routine.
-- Version 1.0 Dec 96. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 16 Dec 96 kh Original from Sather dist abstract.sa
elt! : ETP ;
-- This yields all of the components of the object in turn.
end ; -- $ELT{ETP}
abstract class $STR
abstract class $STR is
-- This abstraction models the text string representation of an object
-- of the implementation class deriving from this. Any such representation
-- should, for portability purposes, be in accordance with the forms given
-- for the required library in the section Represent classes.
-- Version 1.1 Mar 98. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 16 Dec 96 kh Original from Sather dist
-- 3 Mar 98 kh Added library version of str for portability
str(
lib : LIBCHARS
) : STR ;
-- This returns a value which is a textual representation of the value
-- of an object using the given character repertoire and encoding.
str : STR ;
-- This returns a value which is a textual representation of the value
-- of an object using the default character repertoire and encoding.
end ; -- $STR
abstract class $TEXT < $STR
abstract class $TEXT < $STR is
-- This abstraction models the process of conversion from a literal
-- string to an internal Sather value representation.
-- Version 1.0 Dec 2000. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 7 Dec 00 kh Original during inheritance simplification
build(
cursor : STR_CURSOR
) : SAME ;
-- This returns a new object which has been converted from the given
-- textual representation using the default repertoire and encoding.
create(
str : STR
) : SAME ;
-- This returns a new object which has been converted from the given
-- textual representation string using the default repertoire and encoding.
end ; -- $TEXT
abstract class $IMMUTABLE < $BINARY, $STR
abstract class $IMMUTABLE < $BINARY, $STR is
-- This abstraction models the representation forms for objects of
-- immutable classes. There are special cases where an immutable class
-- cannot be derived from this for reasons of efficient implementation,
-- but they are rare. It is also, of course, possible to implement a class
-- deriving from this abstraction which is NOT immutable - but has been
-- implemented with immutable semantics.
--
-- Other uses of this abstraction are possible, but will be unusual
-- rather than common.
-- Version 1.0 Sep 98. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 28 Sep 98 kh Added to provide for 'dual' inheritance
end ; -- $IMMUTABLE
abstract class $VALUE{TYP} < $IS_EQ, $NIL
abstract class $VALUE{TYP} < $IS_EQ, $NIL is
-- This abstraction models the concept of any value class
-- which is an immutable class but the values of which are not necessarily ordered.
-- Version 1.0 May 2001. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 31 May 01 kh Original for uniformity in streams.
end ; -- $VALUE
abstract class $ORDERED{TYP} < $VALUE{TYP}, $IS_LT{TYP}
abstract class $ORDERED{TYP} < $VALUE{TYP}, $IS_LT{TYP} is
-- This abstraction models the concept of an ordered value class - which is an immutable class.
-- Version 1.0 May 2001. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 31 May 01 kh Original for uniformity in streams.
end ; -- $ORDERED{TYP}