collate.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> <--------------
partial class COLLATE
partial class COLLATE is
-- This partial class provides the equality and order testing operations
-- on text strings in accordance with ISO/IEC 14651 string collating standard.
-- It is designed to be included in STR, FSTR, RUNES and FRUNES.
-- Version 1.1 Apr 99. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 5 Mar 97 kh Original from the ISO draft.
-- 12 Apr 99 kh Minor changes for Version 8 of text classes.
private is_eq_helper(
other : SAME
) : BOOL is
-- This routine returns true if and only if all characters of other
-- are the same as the corresponding character of self.
loop
if elt! /= other.elt! then
return false
end
end ;
return true
end ;
is_eq(
other : SAME
) : BOOL is
-- This equality routine is included here for use in the ordering
-- routines. It returns true if and only if the two strings self and
-- other consist of an identical character sequence. Their encodings
-- do NOT have to be the same.
if size = 0 then
return other.size = 0
elsif (other.size = 0)
or size /= other.size then
return false
else
return is_eq_helper(other)
end
end ;
is_lt(
other : SAME
) : BOOL is
-- This routine returns true if and only if self is earlier in the
-- collating sequence (according to the international collating standard),
-- irrespective of encoding.
if size = 0 then
return other.size /= 0
elsif other.size = 0 then
return false
else
return CULTURE::default.collating.earlier(str,other.str)
end
end ;
end ; -- COLLATE