Module description

a32 -- Adler32 Algorithm
The a32 module implements the Adler32 algorithm.

Adler32 Structure

a32% ( -- n )
Get the required space for an Adler32 variable

Adler32 variable creation, initialisation and destruction

a32-init ( a32 -- )
Initialise the Adler32 variable
a32-create ( "<spaces>name" -- ; -- a32 )
Create a named Adler32 variable in the dictionary
a32-new ( -- a32 )
Create a new Adler32 variable on the heap
a32-free ( a32 -- )
Free the Adler32 variable from the heap

Member word

a32-length@ ( a32 -- u )
Get the length of the sum

Adler32 words

a32-reset ( a32 -- )
Reset the Adler32 state
a32-update ( c-addr u a32 -- )
Update the Adler32 with more data c-addr u
a32-finish ( a32 -- u )
Finish the Adler32 calculation, return the result u
a32^combine ( a32 a32 -- u )
Combine the twee Addler32 sums and return the combined sum u
a32+to-string ( u -- c-addr u )
Convert the Adler32 result to a string, using the pictured output area

Inspection

a32-dump ( a32 -- )
Dump the Adler32 variable

Examples

\ ==============================================================================
\
\              a32_expl - the Adler32 example in the ffl
\
\               Copyright (C) 2008  Dick van Oudheusden
\  
\ This library is free software; you can redistribute it and/or
\ modify it under the terms of the GNU General Public
\ License as published by the Free Software Foundation; either
\ version 2 of the License, or (at your option) any later version.
\
\ This library is distributed in the hope that it will be useful,
\ but WITHOUT ANY WARRANTY; without even the implied warranty of
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
\ General Public License for more details.
\
\ You should have received a copy of the GNU General Public
\ License along with this library; if not, write to the Free
\ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
\
\ ==============================================================================
\ 
\  $Date: 2008-04-05 08:05:28 $ $Revision: 1.1 $
\
\ ==============================================================================

include ffl/a32.fs


\ Create an Adler32 variable ad1 in the dictionary

a32-create ad1

\ Update the variable with data

s" The quick brown fox jumps over the lazy dog" ad1 a32-update

\ Finish the Adler32 calculation resulting in unsigned 32 bit word
\ on the stack representing the value

ad1 a32-finish

\ Convert the value to a hex string and print

a32+to-string type cr



\ Create an Adler32 variable on the heap

a32-new value ad2

\ Update the variable with multiple data

s" The quick brown fox " ad2 a32-update
s" jumps over the lazy dog" ad2 a32-update

\ Finish the calculation

ad2 a32-finish

\ Convert the value to a hex string and print

a32+to-string type cr

\ Free the variable from the heap

ad2 a32-free

Generated by fsdocgen 0.1.0