(************************************************************************)
(*                                                                      *)
(*       Strlib:                                                        *)
(*               Library module to handle strings.  Included is         *)
(*               terminal I/O, string length, assignment, conc-         *)
(*               atention, insertion, deletion, alteration and          *)
(*               the ability to select portions of a string.            *)
(*                                                                      *)
(*       Verson :                                                       *)
(*               1.0 ; November 16, 83 ;   Namir C. Shammas             *)
(*               1.1 ; November 21, 84 ;   Walter Maner                 *)
(*               Extracts for LSI May 30, 1986 Jerry LaPeer             *)
(*                                                                      *)
(************************************************************************)


DEFINITION MODULE LSISTR;

FROM SYSTEM IMPORT ADDRESS;

CONST eos = 0C;       (*  End Of String  *)

PROCEDURE BlockComp(Aop,Bop : ADDRESS; Length : CARDINAL) : INTEGER;
PROCEDURE BlockMove(Aop,Bop : ADDRESS; Length : CARDINAL);

PROCEDURE LenStr(VAR Str : ARRAY OF CHAR):CARDINAL;
(*    Obtain the number of characters in a string.  *)

PROCEDURE MoveStr(VAR Str1,Str2 : ARRAY OF CHAR);
(*    Assign an array of characters appended by an eos.  *)
(*    Str1 := Str2;               *)

PROCEDURE ConCatStr(VAR Str1 : ARRAY OF CHAR;
                    VAR Str2,Str3: ARRAY OF CHAR);
(*    Str1 := Str2 + Str3;        *)

PROCEDURE AppendStr(VAR Str1 : ARRAY OF CHAR;
                    VAR Str2 : ARRAY OF CHAR );
(*    Append string Str2 to Str1  *)

PROCEDURE DeleteStr(VAR Str : ARRAY OF CHAR ; First,Last : CARDINAL);
(*    Delete a portion of a string STARTING at 'Fisrt' and ENDING at
      'Last' (included)  *)

PROCEDURE PosStr(VAR Str1,Str2 : ARRAY OF CHAR;
                     Start : CARDINAL):CARDINAL;
(*    Function that returns the position of 'sub-string' Str2 in string 
      Str1. The search begins at position 'Start'.   *)

PROCEDURE CopyStr(VAR Str1,Str2 : ARRAY OF CHAR ;
                      Start, Count : CARDINAL);
(*    Pick 'Count' characters starting at position 'Start' in string 
      Str2 and store it in string Str1.   *)

PROCEDURE InsertStr(VAR Str1,Str2 : ARRAY OF CHAR;
                        Start : CARDINAL);
(*    Insert sub-string Str2 in string Str1 at position 'Start'.  The
      characters at position 'Start' and above are moved.   *) 

END LSISTR.
