home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / packery / xpkilzr / source / xpk.c < prev    next >
C/C++ Source or Header  |  1977-12-31  |  2KB  |  101 lines

  1. /*
  2.  * This library is mainly intended to demonstrate how to program an
  3.  * encryption sub library/
  4.  */
  5.  
  6. #include <stdio.h>
  7.  
  8. #include "ilzr.h"
  9.  
  10. char __VersTag__[]="$VER: xpkIZLR.library 1.2 ("__DATE__") Jose Renau";
  11.  
  12. #define NO_SUB_PRAGMAS
  13.  
  14. #include <string.h>
  15. #include <stdlib.h>
  16. #include <libraries/xpksub.h>
  17.  
  18. #define A3000 XPKMF_A3000SPEED
  19.  
  20. XMINFO ILZRMode = {
  21.     NULL,    // next
  22.     100,     // upto
  23.     A3000,   // flags
  24.     0,       // packmem
  25.     0,       // unpackmem
  26.     200,     // packspeed,   K/sec
  27.     300,     // unpackspeed, K/sec
  28.     655,     // ratio,      *0.1%
  29.     0,       // reserved
  30.     "Fast" // description
  31. };
  32.  
  33. static struct XpkInfo ILZRInfo = {
  34.         1,               /* info version */
  35.         0,               /* lib  version */
  36.         0,               /* master vers  */
  37.         0,               /* pad          */
  38.         "ILZR",          /* short name   */
  39.         "Incremental Lempel Ziv Renau",   
  40.                      /* long name    */
  41.         "A very fast low memory compression, fast hash version of LZSS", 
  42.                      /* description*/
  43.         'ILZR',          /* 4 letter ID  */
  44.         XPKIF_PK_CHUNK  |/* flags        */
  45.         XPKIF_UP_CHUNK  |
  46.         XPKIF_MODES,
  47.         16*1024,         /* max in chunk */
  48.         0,               /* min in chunk */
  49.         16*1024,         /* def in chunk */
  50.         "Compressing",   /* pk message   */
  51.         "Expanding",     /* up message   */
  52.         "Packed",        /* pk past msg  */
  53.         "unpacked",      /* up past msg  */
  54.         50,              /* def mode     */
  55.         0,               /* pad          */
  56.         &ILZRMode        /* modes        */
  57. };
  58.  
  59. /**------------------------------------------------------------------
  60.   *   Retorna la estructura de información usada en el
  61.   * compresor de datos.
  62.   *
  63.   **/
  64. struct XpkInfo * __saveds __asm
  65. XpksPackerInfo( void )
  66. {
  67.     return &ILZRInfo;
  68. }
  69.  
  70.  
  71. void __saveds __asm
  72. XpksPackFree( REG __a0 XPARAMS* xpar )
  73. {
  74.  
  75.   if( xpar->Sub[0] )
  76.     {
  77.     free( (void *)xpar->Sub[0] );   /*  free( prev );  */
  78.     xpar->Sub[0]=0;
  79.     }
  80.   if( xpar->Sub[1] )
  81.     {
  82.     free( (void *)xpar->Sub[1] );   /*  free( head );  */
  83.     xpar->Sub[1]=0;
  84.     }
  85.  
  86. }
  87.  
  88. long __saveds __asm
  89. XpksPackReset( REG __a0 XPARAMS* xpar )
  90. {
  91.   if( xpar->Sub[1] )
  92.     memset( (void *)xpar->Sub[1] , NIL , HASH_SIZE*sizeof( UWORD ) ); /* head */
  93.     return 0;
  94. }
  95.  
  96.  
  97. void __saveds __asm
  98. XpksUnpackFree( REG __a0 XPARAMS* xpar )
  99. {
  100. }
  101.