Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- dBsee 4.6 - The Library - <b>dfpaircmp()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
dfPairCmp()
Performs a PAIR compression on strings of text
------------------------------------------------------------------------------
Syntax:

     dfPairCmp(<cBuffer>) --> cBufferRet

Parameters:

     <cBuffer>  Buffer to compress

Returns:

     <cBufferRet> compressed Buffer <16kb

Description:

     This function serves to compress of the buffers of text and for
     instance occupy less space in the memo.
     
     If this function is not able to compress the buffer the it returns
     (the previous buffer) , therefore iss sufficient to compare the length
     of the previous buffer with that of the buffer returned to verify if
     the compression was completed corectly
     
     N.B. NEVER  pass a buffer that hs not been compressed to the de
     compression function in order to avoid an incorrect de compression
     
     N.B. Do not execde the 16kb buffer size  for de compression.

Example:

     * ______________________
     FUNCTION Main(cBuffer)
     * ______________________
     LOCAL cBufferRead, cBufferCmp
     
     cBufferRead:= MEMOREAD(cBuffer)
     IF LEN(cBufferRead) <16000
        cBufferCmp:= dfPairCmp(cBufferRead)
     
        IF LEN(cBufferCmp) <LEN(cBufferRead)
      ?  "implement Compression"
           IF LEN(dfPairDeCmp(cBufferCmp) ) ==;
              LEN(cBufferRead)
         ?  "correct De Compression"
           ELSE
         ?  "invalid De Compression"
           ENDIF
        ELSE
      ?  "impossible Compression"
        ENDIF
     ENDIF
     
     RETURN NIL

See also:

     dfPairDeCmp(), dfRLCmp()

See Also: dfPairDeCmp() dfRLCmp()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson