|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 7624 (0x1dc8) Types: TextFile Names: »B«
└─⟦85b835f43⟧ Bits:30000549 8mm tape, Rational 1000, Xlib rev 6.00 └─ ⟦0c20f784e⟧ »DATA« └─⟦1abbe589f⟧ └─⟦591c5b094⟧ └─⟦this⟧
with Arithmetic; use Arithmetic; with Vstring_Type; use Vstring_Type; package body Vstring_Compare is ------------------------------------------------------------------------------ -- VString Comparison Routines ------------------------------------------------------------------------------ -- Copyright 1988 - 1991 by Rational, Santa Clara, California. -- -- All Rights Reserved. -- -- Permission to use, copy, modify, and distribute this software and its -- documentation for any purpose and without fee is hereby granted, -- provided that the above copyright notice(s) appear in all copies and that -- both that copyright notice(s) and this permission notice appear in -- supporting documentation, and that the name of Rational not be used in -- advertising or publicity pertaining to distribution of the software -- without specific, written prior permission. -- -- Rational disclaims all warranties with regard to this software, including -- all implied warranties of merchantability and fitness, in no event shall -- Rational be liable for any special, indirect or consequential damages or -- any damages whatsoever resulting from loss of use, data or profits, whether -- in an action of contract, negligence or other tortious action, arising out -- of or in connection with the use or performance of this software. ------------------------------------------------------------------------------ --\f function Compare (Vstr1 : Vstring_Data; Vstr2 : Vstring_Data) return Result_Type is Len : S_Natural := Vstr1.Length; Result : Result_Type := -1; Diff : S_Long; begin if Len > Vstr2.Length then Len := Vstr2.Length; Result := 1; end if; for I in 1 .. Len loop Diff := Character'Pos (Vstr1.Chars (I)) - Character'Pos (Vstr2.Chars (I)); if Diff /= 0 then return Diff; end if; end loop; if Vstr1.Length = Vstr2.Length then return 0; end if; return Result; end Compare; --\f function Compare (Vstr1 : Vstring_Data; Vstr2 : Vstring) return Result_Type is Len : S_Natural := Vstr1.Length; Result : Result_Type := -1; Diff : S_Long; begin if Len > Vstr2.Length then Len := Vstr2.Length; Result := 1; end if; for I in 1 .. Len loop Diff := Character'Pos (Vstr1.Chars (I)) - Character'Pos (Vstr2.Chars (I)); if Diff /= 0 then return Diff; end if; end loop; if Vstr1.Length = Vstr2.Length then return 0; end if; return Result; end Compare; --\f function Compare (Vstr1 : Vstring; Vstr2 : Vstring_Data) return Result_Type is Len : S_Natural := Vstr1.Length; Result : Result_Type := -1; Diff : S_Long; begin if Len > Vstr2.Length then Len := Vstr2.Length; Result := 1; end if; for I in 1 .. Len loop Diff := Character'Pos (Vstr1.Chars (I)) - Character'Pos (Vstr2.Chars (I)); if Diff /= 0 then return Diff; end if; end loop; if Vstr1.Length = Vstr2.Length then return 0; end if; return Result; end Compare; --\f function Compare (Vstr1 : Vstring; Vstr2 : Vstring) return Result_Type is Len : S_Natural := Vstr1.Length; Result : Result_Type := -1; Diff : S_Long; begin if Len > Vstr2.Length then Len := Vstr2.Length; Result := 1; end if; for I in 1 .. Len loop Diff := Character'Pos (Vstr1.Chars (I)) - Character'Pos (Vstr2.Chars (I)); if Diff /= 0 then return Diff; end if; end loop; if Vstr1.Length = Vstr2.Length then return 0; end if; return Result; end Compare; --\f function Compare (Vstr1 : Vstring_Data; Vstr2 : E_String) return Result_Type is Len : S_Natural := Vstr2'Length; Result : Result_Type := 1; Diff : S_Long; begin if Len > Vstr1.Length then Len := Vstr1.Length; Result := -1; end if; for I in 0 .. Len - 1 loop Diff := Character'Pos (Vstr1.Chars (I + 1)) - Character'Pos (Vstr2 (I + Vstr2'First)); if Diff /= 0 then return Diff; end if; end loop; if Vstr1.Length = Vstr2'Length then return 0; end if; return Result; end Compare; --\f function Compare (Vstr1 : Vstring_Data; Vstr2 : Character) return Result_Type is begin if Vstr1.Length = 0 then return -1; end if; return Character'Pos (Vstr1.Chars (1)) - Character'Pos (Vstr2); end Compare; --\f function Compare (Vstr1 : Vstring_Data; Vstr2 : Character; Copies : S_Natural) return Result_Type is Len : S_Natural := Vstr1.Length; Result : Result_Type := -1; Diff : S_Long; begin if Len > Copies then Len := Copies; Result := 1; end if; for I in 1 .. Len loop Diff := Character'Pos (Vstr1.Chars (I)) - Character'Pos (Vstr2); if Diff /= 0 then return Diff; end if; end loop; if Vstr1.Length = Copies then return 0; end if; return Result; end Compare; --\f function Compare (Vstr1 : Vstring; Vstr2 : E_String) return Result_Type is Len : S_Natural := Vstr2'Length; Result : Result_Type := 1; Diff : S_Long; begin if Len > Vstr1.Length then Len := Vstr1.Length; Result := -1; end if; for I in 0 .. Len - 1 loop Diff := Character'Pos (Vstr1.Chars (I + 1)) - Character'Pos (Vstr2 (I + Vstr2'First)); if Diff /= 0 then return Diff; end if; end loop; if Vstr1.Length = Vstr2'Length then return 0; end if; return Result; end Compare; --\f function Compare (Vstr1 : Vstring; Vstr2 : Character) return Result_Type is begin if Vstr1.Length = 0 then return -1; end if; return Character'Pos (Vstr1.Chars (1)) - Character'Pos (Vstr2); end Compare; --\f function Compare (Vstr1 : Vstring; Vstr2 : Character; Copies : S_Natural) return Result_Type is Len : S_Natural := Vstr1.Length; Result : Result_Type := -1; Diff : S_Long; begin if Len > Copies then Len := Copies; Result := 1; end if; for I in 1 .. Len loop Diff := Character'Pos (Vstr1.Chars (I)) - Character'Pos (Vstr2); if Diff /= 0 then return Diff; end if; end loop; if Vstr1.Length = Copies then return 0; end if; return Result; end Compare; --\f end Vstring_Compare;