Скачать PKWARE Data Compression Library v1.02

PKWARE Inc.
29.03.1995
Скачать файл (30,44 Кб)

New Basic interface example code for Microsoft QuickBasic 4.5 and Professional Basic 7.1. Updated Clipper interface example that no longer requires the EXTOR module and includes compiled INTERFCE.OBJ module. Minor anomalies when running on older 8088 CPU's have been corrected. Problems when running as a DLL under Windows or OS/2 have been fixed, i.e. it is no longer assumed that DS == SS.

Additional notes

The segments used/declared in the PKWARE Data Compression Library are:

DGROUP GROUP _DATA
    ASSUME DS: DGROUP
    _DATA SEGMENT use16 WORD PUBLIC 'DATA'
 
    PK_TEXT SEGMENT use16 DWORD 'CODE'
    ASSUME CS: PK_TEXT

When used under Windows or OS/2, the _DATA segment used by the library should be declared 'non shareable' in the .DEF file. When used with a 32-bit application using a DOS extender, these segments must be declared to be 16-bit segments.

CRC-32 routine

This routine calculates a running CRC-32 value on the buffer passed to it. You should use proper CRC pre and post-conditioning, meaning an initial start value of ~0 (all ones) and the final value be one's complemented. Below is an example pseudo-code code using the CRC 32 routine:

unsigned long far pascal crc32(
  unsigned char far *buffer,
  unsigned short int far *size,
  unsigned long far *old_crc);
 
  unsigned long crc_cal = ~0;
  unsigned short int size;
  extern char far buffer[];     /* some buffer containing data */
                                /* data to be CRC'd */
 
 
  while (data is being put in buffer)
    { size = amount of data in buffer;
      crc_val=crc32(buffer,&size,&crc_val);
    }
 
  crc_val=~crc_val;
 
  printf("Final CRC residual value is: %lu\n",crc_val);

When using Turbo Pascal 5.0 use the { $F+ } meta-command instead of using the 'far' keyword in the example program.