MODULA - M2PROT.ZIP - CRC.DEF

 
Output of file : CRC.DEF contained in archive : M2PROT.ZIP

(*%F _fdata *)
(*# call(seg_name => null) *)
(*%E *)
(*# module(implementation=>on) *)
(*# module(init_code=>off) *)
(*# data(seg_name => null) *)
(*# call(o_a_copy => off) *)
DEFINITION MODULE CRC;

(*
Cyclic redundancy check and checksum routines for JPI Modula-2
by Carl Neiburger
169 N. 25th St.
San Jose, Calif. 95116

CompuServe No. 72336,2257

A program variable of TYPE ChkProc may be assigned to UpdCRC or
UpdChecksum, allowing procedures to use either check method without a lot
of IF ... THEN ... ELSE statements. Note, however, that an IF ... THEN
... ELSE statement is still required to compute the final CRC or checksum
because the CRC has 16 significant bits and the checksum, although of type
CARDINAL for compatibility, has only eight.

*)

TYPE
ChkProc = PROCEDURE ( ADDRESS, CARDINAL, CARDINAL): CARDINAL;

PROCEDURE DoCRC( V : ADDRESS; count, value: CARDINAL) : CARDINAL;
(* 16-bit CRC calculation *)

PROCEDURE DoC32( V : ADDRESS; count: CARDINAL; value: LONGCARD):LONGCARD;
(* 16-bit CRC calculation *)

PROCEDURE DoKCRC( V : ADDRESS; count, value: CARDINAL) : CARDINAL;
(* Kermit CRC calculation *)

PROCEDURE DoCks(V : ADDRESS; count, value: CARDINAL): CARDINAL;
(* checksum calculation *)

PROCEDURE DoBCks(V : ADDRESS; count, value: CARDINAL): CARDINAL;
(* CompuServe B checksum calculation *)

END CRC.