Sage-ST ä

Compress

Documentation

Global Declarations (Constants, Types, Variables)
Compress CompressBuffer CompressFile
UnCompress UnCompressBuffer UnCompressFile





  type LoadInputBufferProcType is access
  procedure (Buffer  : in     System.Address;
             totalIn : in out ModSys.S_Natural);

  pragma Convention
          (WIN32,
           LoadInputBufferProcType);

  type PutOutputBufferProcType is access
  procedure (Buffer   : in     System.Address;
             totalOut : in     ModSys.S_Natural;
             Success  : in out boolean);

  pragma Convention
          (WIN32,
           PutOutputBufferProcType);




  procedure Compress
             (compression   : in     ModSys.S_Natural;
              workBuffer    : in     System.Address;
              workLength    : in     ModSys.S_Natural;
              showProgress  : in     boolean;
              Status        : in out ModSys.S_Natural;
              LoadInputProc : in     LoadInputBufferProcType;
              PutOutputProc : in     PutOutputBufferProcType);

  --*
  --  Compress - Compress data from and to buffers.
  --
  --
  --  This procedure  begins the process  of compressing data.  The data
  --  compression method  used is a sliding  dictionary method to reduce
  --  repeated  byte sequences.  The size  of the  dictionary depends on
  --  compression factor. Valid compression factors are:
  --
  --    1  -   512 byte buffer, minimum compression, least time
  --    2  -  1024 byte buffer, better compression, more time
  --    3  -  2048 byte buffer, better compression, more time
  --    4  -  4096 byte buffer, best compression, longest time
  --
  --  Compression factors outside this range will default to a factor of
  --  2.
  --
  --  LoadInputBuffer will  be called by  the program when  more data is
  --  needed. The user  is required to fill in the  buffer up to the the
  --  totalIn (total to input) value received from compress and pass the
  --  total number of bytes loaded back in totalIn. A value of zero will
  --  end compress processing signaling the end of data.
  --
  --  PutOutputBuffer  will be  called when  there is  no room to output
  --  more data  or at the  conclusion of the  program. Total number  of
  --  bytes in the  output buffer is passed to  you. Process this buffer
  --  as needed. When control is  passed back to the compression program
  --  data will again  be written to the buffer  from the first. Success
  --  set to FALSE will indicate an error and processing will quit.
  --
  --  CALLING SEQUENCE -
  --
  --    Compress (compression, workBuffer, workLength, status,
  --              LoadInput'access, PutOutput'access);
  --
  --  ENTRY -
  --
  --    compression : ModSys.S_Natural
  --      Compression factor (1..4).
  --
  --    workBuffer : System.Address
  --      Address of a working buffer.  Must be at least four times
  --      bigger than the search buffer size indicated by the
  --      compression factor.
  --
  --    workLength : ModSys.S_Natural
  --      Total length of workbuffer in bytes.
  --
  --    showProgress : boolean
  --      Show a device (propeller) which indicates compression in
  --      progress.
  --
  --  EXIT -
  --
  --    status : ModSys.S_Natural
  --      Number indicating the status of the compression result.
  --        0 - No error occurred
  --        4 - Error putting output buffer
  --        5 - Work buffer too small
  --
  --  EXAMPLE -
  --
  --    procedure LoadInput
  --               (buffer  : in     System.Address;
  --               totalIn : in out Modsys.S_Natural) is
  --      pragma Convention (Win32, LoadInput);
  --    begin
  --      ReadData(buffer,totalIn);
  --    end LoadInput;
  --
  --    procedure PutOutputBuffer
  --               (buffer   : in     System.Address;
  --                totalOut : in     ModSys.S_Natural;
  --                success  : in out boolean);
  --
  --      pragma Convention (Win32, PutOutputBuffer);
  --
  --    begin
  --      success := WriteData(buffer,totalOut);
  --    end PutOutput;
  --
  --
  --    procedure MyProgram is
  --    begin
  --      .
  --      .
  --      Compress.Compress (compression,workBuffer'address,workLength,status,
  --                         LoadInput'access, PutOutput'access);
  --      .
  --      .
  --    end MyProgram;
  --




  procedure UnCompress
             (workBuffer    : in     System.Address;
              workLength    : in     ModSys.S_Natural;
              showProgress  : in     boolean;
              Status        : in out ModSys.S_Natural;
              LoadInputProc : in     LoadInputBufferProcType;
              PutOutputProc : in     PutOutputBufferProcType);

  --*
  --  UnCompress - Uncompress data from and to buffers.
  --
  --
  --  This procedure reverses the process  of compressing data. The data
  --  must have been compressed using this compression package.
  --
  --  LoadInputBuffer will  be called by  the program when  more data is
  --  needed. The user  is required to fill in the  buffer up to the the
  --  totalIn (total to input) value received from compress and pass the
  --  total number of bytes loaded back in totalIn. A value of zero will
  --  end compress processing signaling the end of data.
  --
  --  PutOutputBuffer  will be  called when  there is  no room to output
  --  more data  or at the  conclusion of the  program. Total number  of
  --  bytes in the  output buffer is passed to  you. Process this buffer
  --  as needed. When control is  passed back to the compression program
  --  data will again  be written to the buffer  from the first. Success
  --  set to FALSE will indicate an error and processing will quit.
  --
  --  CALLING SEQUENCE -
  --
  --    UnCompress (workBuffer, workLength, status,
  --                LoadInput'access, PutOutput'access);
  --
  --  ENTRY -
  --
  --    workBuffer : System.Address
  --      Address of a working buffer.  Must be at least four times
  --      bigger than the search buffer size indicated by the
  --      compression factor used to compress the data.
  --
  --    workLength : ModSys.S_Natural
  --      Total length of workbuffer in bytes.
  --
  --    showProgress : boolean
  --      Show a device (propeller) which indicates compression in
  --      progress.
  --
  --  EXIT -
  --
  --    status : ModSys.S_Natural
  --      Number indicating the status of the uncompression result.
  --        0 - No error occurred
  --        4 - Error putting output buffer
  --        5 - Work buffer too small
  --
  --  EXAMPLE -
  --
  --    procedure LoadInput
  --              (buffer  : in     System.Address;
  --              totalIn : in out Modsys.S_Natural) is
  --      pragma Convention (Win32, LoadInput);
  --    begin
  --      ReadData(buffer,totalIn);
  --    end LoadInput;
  --
  --    procedure PutOutputBuffer
  --               (buffer   : in     System.Address;
  --                totalOut : in     ModSys.S_Natural;
  --                success  : in out boolean) is
  --      pragma Convention (Win32, PutOutputBuffer);
  --    begin
  --      success := WriteData(buffer,totalOut);
  --    end PutOutput;
  --
  --    procedure MyProgram is
  --    begin
  --      .
  --      .
  --      Compress.UnCompress (compression, workBuffer'address, workLength,
  --                           status, LoadInput'access, PutOutput'access);
  --      .
  --      .
  --    end MyProgram;
  --




  procedure CompressBuffer
             (compression  : in     ModSys.S_Natural;
              inBuffer     : in     System.Address;
              inBufLength  : in     ModSys.S_Natural;
              outBuffer    : in     System.Address;
              outBufLength : in     ModSys.S_Natural;
              showProgress : in     boolean;
              resultLength : in out ModSys.S_Natural;
              Status       : in out ModSys.S_Natural);

  --*
  --  CompressBuffer - Compress a memory buffer.
  --
  --
  --  This routine will use the  Compress procedure to compress an input
  --  buffer and write the compressed data to an output buffer.
  --
  --  The size  of the dictionary  depends on compression  factor. Valid
  --  compression factors are:
  --
  --    1  -   512 byte buffer, minimum compression, least time
  --    2  -  1024 byte buffer, better compression, more time
  --    3  -  2048 byte buffer, better compression, more time
  --    4  -  4096 byte buffer, best compression, longest time
  --
  --  Compression factors outside this range will default to a factor of
  --  2.
  --
  --  CALLING SEQUENCE -
  --
  --    CompressBuffer (compression,
  --                    inBuffer, inBufLength,
  --                    outBuffer, outBufLength,
  --                    showProgress,
  --                    resultLength, status);
  --
  --  ENTRY -
  --
  --    compression : ModSys.S_Natural
  --      Compression factor (1..4).
  --
  --    inBuffer : System.Address
  --      Address  of  the  buffer  containing  the  input  data  to  be
  --      compressed.
  --
  --    inBufLength : ModSys.S_Natural
  --      Length of the input buffer
  --
  --    outBuffer : System.Address
  --      Address of the buffer where compressed input buffer data is
  --      to be stored.
  --
  --    outBufLength : ModSys.S_Natural
  --      Length of the output buffer
  --
  --    showProgress : boolean
  --      Show a device (propeller) which indicates compression in
  --      progress.
  --
  --    resultLength : ModSys.S_Natural
  --      The valid length of the resluting compressed data stored in
  --      the output buffer.
  --
  --  EXIT -
  --
  --    status : ModSys.S_Natural
  --      Number indicating the status of the compression result.
  --        0 - No error occurred
  --        4 - Error putting output buffer
  --        5 - Work buffer too small
  --




  procedure UnCompressBuffer
             (inBuffer     : in     System.Address;
              inBufLength  : in     ModSys.S_Natural;
              outBuffer    : in     System.Address;
              outBufLength : in     ModSys.S_Natural;
              showProgress : in     boolean;
              resultLength : in out ModSys.S_Natural;
              Status       : in out ModSys.S_Natural);

  --*
  --  UnCompressBuffer - Uncompress a memory buffer.
  --
  --
  --  This routine  will use the  Uncompress procedure to  uncompress an
  --  input buffer and write the uncompressed data to an output buffer.
  --
  --  This procedure reverses the process  of compressing data. The data
  --  must have been compressed using this compression package.
  --
  --  CALLING SEQUENCE -
  --
  --    UnCompressBuffer (inBuffer, inBufLength,
  --                      outBuffer, outBufLength,
  --                      showProgress,
  --                      resultLength, status);
  --
  --  ENTRY -
  --
  --    inBuffer : System.Address
  --      Address  of  the  buffer  containing  the  input  data  to  be
  --      uncompressed.
  --
  --    inBufLength : ModSys.S_Natural
  --      Length of the input buffer
  --
  --    outBuffer : System.Address
  --      Address of the buffer where  uncompressed input buffer data is
  --      to be stored.
  --
  --    outBufLength : ModSys.S_Natural
  --      Length of the output buffer
  --
  --    showProgress : boolean
  --      Show  a  device  (propeller)  which  indicates  compression in
  --      progress.
  --
  --  EXIT -
  --
  --    resultLength : ModSys.S_Natural
  --      The valid  length of the  resluting compressed data  stored in
  --      the output buffer.
  --
  --    status : ModSys.S_Natural
  --      Number indicating the status of the uncompression result.
  --        0 - No error occurred
  --        4 - Error putting output buffer
  --        5 - Work buffer too small
  --




  procedure CompressFile
             (fileIn       : in     string;
              fileOut      : in     string;
              compression  : in     ModSys.S_Natural;
              showProgress : in     boolean;
              bytesIn      : in out ModSys.S_Natural;
              bytesOut     : in out ModSys.S_Natural;
              Status       : in out ModSys.S_Natural);

  --*
  --  CompressFile - Compress a DOS file to another file.
  --
  --
  --  This routine will use the Compress procedure, read the input file,
  --  compress the data and write the compressed data to another file.
  --
  --  CALLING SEQUENCE -
  --
  --    CompressFile (fileIn, fileOut, compression,
  --                  bytesIn, bytesOut, status)
  --
  --  ENTRY -
  --
  --    fileIn : string
  --      File  name of  file to  be compressed.  Must include  any path
  --      information if needed.
  --
  --    fileOut : string
  --      File  name  of  the  comressed  file.  Must  include  any path
  --      information if needed. The compressed  file cannot be the same
  --      as  the input  file name.  The file  is tagged  with a special
  --      sequence  of characters  to indicate  that it  is a compressed
  --      file and the compression used.
  --
  --    compression : ModSys.S_Natural
  --      Compression factor (1..4) (See Compress for info)
  --
  --    showProgress : boolean
  --      Show  a  device  (propeller)  which  indicates  compression in
  --      progress.
  --
  --  EXIT -
  --
  --    bytesIn : ModSys.S_Natural
  --      Number of bytes compressed from the input file. (File size)
  --
  --    bytesOut : ModSys.S_Natural
  --      Number of  bytes in the  compressed file. A  compression ratio
  --      can be calculated from this information.
  --
  --    status : ModSys.S_Natural
  --      Number indicating the status of the compression result.
  --        0 - No error occurred
  --        1 - Could not open input file
  --        2 - Could not open output file
  --        4 - Error putting output buffer
  --        5 - Work buffer too small
  --




  procedure UnCompressFile
             (fileIn       : in     string;
              fileOut      : in     string;
              showProgress : in     boolean;
              Status       : in out ModSys.S_Natural);

  --*
  --  UnCompressFile - Uncompress a compressed file to another file.
  --
  --
  --  This  routine will  use the  UnCompress procedure,  read the input
  --  compressed file,  uncompress the data  and write the  uncompressed
  --  data to another file.
  --
  --  CALLING SEQUENCE -
  --
  --    UnCompressFile (fileIn, fileOut, status);
  --
  --  ENTRY -
  --
  --    fileIn : string
  --      File name  of file to  be uncompressed. Must  include any path
  --      information  if needed.  The file  must be  a file  compressed
  --      using the CompressFile routine above.
  --
  --    fileOut : string
  --      File  name  of  the  uncomressed  file.  Must include any path
  --      information if needed.
  --
  --    showProgress : boolean
  --      Show  a  device  (propeller)  which  indicates  compression in
  --      progress.
  --
  --  EXIT -
  --
  --    status : ModSys.S_Natural
  --      Number indicating the status of the uncompression result.
  --        0 - No error occurred
  --        1 - Could not open input file
  --        2 - Could not open output file
  --        3 - Not a compressed file
  --        4 - Error putting output buffer
  --        5 - Work buffer too small
  --




Send mail to   warren.merrill@inl.gov with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance