DEFINITION MODULE StrSBMN;
(*====================================================================
    Version  : 1.00  28 Apr 1989  C. Lins
    Compiler : TopSpeed Modula-2
    Component: Monolithic Structure String (Opaque version)
               Sequential Bounded Managed Non-Iterator

    REVISION HISTORY
    v1.00  29 Apr 1989  C. Lins:
	  Initial implementation.
====================================================================*)

FROM ErrorHandling IMPORT
    (*--Type*) HandlerProc;

FROM Items IMPORT
    (*--Type*) Item;

FROM Relations IMPORT
    (*--Type*) Relation;

FROM StrEnum IMPORT
    (*--Type*) Exceptions;

FROM TypeManager IMPORT
    (*--Type*) TypeID;

    (*-----------------------*)

TYPE  String;
TYPE  StringSize = [1..8100];
TYPE  Position   = StringSize;
CONST NullString = String(NIL);


    (*---------------------------------*)
    (*--          EXCEPTIONS         --*)

CONST ModuleID = 6;

PROCEDURE StringError () : Exceptions (*-- out   *);

PROCEDURE GetHandler  (    ofError   : Exceptions  (*-- in    *))
                                     : HandlerProc (*-- out   *);

PROCEDURE SetHandler  (    ofError   : Exceptions  (*-- in    *);
                           toHandler : HandlerProc (*-- in    *));


    (*---------------------------------*)
    (*--         CONSTRUCTORS        --*)

PROCEDURE Create    (    withSizeOf   : StringSize    (*-- in    *);
                         theDataType  : TypeID        (*-- in    *))
                                      : String        (*-- out   *);

PROCEDURE Destroy   (VAR theString    : String        (*-- inout *));

PROCEDURE Clear     (VAR theString    : String        (*-- inout *));

PROCEDURE Assign    (    fromString   : String        (*-- in    *);
                     VAR toString     : String        (*-- inout *));

PROCEDURE Prepend   (    theString    : String        (*-- in    *);
                     VAR toString     : String        (*-- inout *));

PROCEDURE Append    (    theString    : String        (*-- in    *);
                     VAR toString     : String        (*-- inout *));

PROCEDURE Insert    (    theString    : String        (*-- in    *);
                     VAR toString     : String        (*-- inout *);
                         theIndex     : Position      (*-- in    *));

PROCEDURE Delete    (VAR theString    : String        (*-- inout *);
                         fromIndex    : Position      (*-- in    *);
                         toIndex      : Position      (*-- in    *));

PROCEDURE Replace   (VAR theString    : String        (*-- inout *);
                         theIndex     : Position      (*-- in    *);
                         withString   : String        (*-- in    *));

PROCEDURE SetItem   (VAR theString    : String        (*-- inout *);
                         theIndex     : Position      (*-- in    *);
                         theItem      : Item          (*-- in    *));

PROCEDURE Construct (VAR theString    : String        (*-- inout *);
	            		 theDataType  : TypeID	      (*-- in    *);
                     VAR theSubstring : ARRAY OF Item (*-- in    *));


    (*---------------------------------*)
    (*--          SELECTORS          --*)

PROCEDURE IsDefined  (    theString  : String      (*-- in    *))
                                     : BOOLEAN     (*-- out   *);

PROCEDURE IsEmpty    (    theString  : String      (*-- in    *))
                                     : BOOLEAN     (*-- out   *);

PROCEDURE LengthOf   (    theString  : String      (*-- in    *))
                                     : CARDINAL    (*-- out   *);

PROCEDURE SizeOf     (    theString  : String      (*-- in    *))
                                     : CARDINAL    (*-- out   *);

PROCEDURE TypeOf     (    theString  : String      (*-- in    *))
                                     : TypeID      (*-- out   *);

PROCEDURE Compare    (    left       : String      (*-- in    *);
                          right      : String      (*-- in    *))
                                     : Relation    (*-- out   *);

PROCEDURE IsEqual    (    left       : String      (*-- in    *);
                          right      : String      (*-- in    *))
                                     : BOOLEAN     (*-- out   *);

PROCEDURE ItemOf     (    theString  : String      (*-- in    *);
                          atIndex    : Position    (*-- in    *))
                                     : Item        (*-- out   *);

PROCEDURE SliceOf    (    theString  : String        (*-- in    *);
                          fromIndex  : Position      (*-- in    *);
                          toIndex    : Position      (*-- in    *);
                      VAR theSlice   : ARRAY OF Item (*-- out   *));

PROCEDURE SubstringOf(    theString  : String        (*-- in    *);
                      VAR toSubstring: ARRAY OF Item (*-- out   *));

END StrSBMN.