gm2-libs-log/BlockOps (The GNU Modula-2 Compiler)

#### 4.2.4 gm2-libs-log/BlockOps ¶

    DEFINITION MODULE BlockOps ;

    FROM SYSTEM IMPORT ADDRESS ;

    (*
       MoveBlockForward - moves, n, bytes from, src, to, dest.
                          Starts copying from src and keep copying
                          until, n, bytes have been copied.
    *)

    PROCEDURE BlockMoveForward (dest, src: ADDRESS; n: CARDINAL) ;

    (*
       MoveBlockBackward - moves, n, bytes from, src, to, dest.
                           Starts copying from src+n and keeps copying
                           until, n, bytes have been copied.
                           The last datum to be copied will be the byte
                           at address, src.
    *)

    PROCEDURE BlockMoveBackward (dest, src: ADDRESS; n: CARDINAL) ;

    (*
       BlockClear - fills, block..block+n-1, with zeros.
    *)

    PROCEDURE BlockClear (block: ADDRESS; n: CARDINAL) ;

    (*
       BlockSet - fills, n, bytes starting at, block, with a pattern
                  defined at address pattern..pattern+patternSize-1.
    *)

    PROCEDURE BlockSet (block: ADDRESS; n: CARDINAL;
                        pattern: ADDRESS; patternSize: CARDINAL) ;

    (*
       BlockEqual - returns TRUE if the blocks defined, a..a+n-1, and,
                    b..b+n-1 contain the same bytes.
    *)

    PROCEDURE BlockEqual (a, b: ADDRESS; n: CARDINAL) : BOOLEAN ;

    (*
       BlockPosition - searches for a pattern as defined by
                       pattern..patternSize-1 in the block,
                       block..block+blockSize-1.  It returns
                       the offset from block indicating the
                       first occurence of, pattern.
                       MAX(CARDINAL) is returned if no match
                       is detected.
    *)

    PROCEDURE BlockPosition (block: ADDRESS; blockSize: CARDINAL;
                             pattern: ADDRESS; patternSize: CARDINAL) : CARDINAL ;

    END BlockOps.